mirror of
https://gitlab.com/octtspacc/staticoso
synced 2025-06-05 22:09:23 +02:00
Transition to monorepo on a new Dev branch
This commit is contained in:
4
App/Source/node_modules/pug-walk/HISTORY.md
generated
vendored
Normal file
4
App/Source/node_modules/pug-walk/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
1.0.0 / 2016-08-22
|
||||
==================
|
||||
|
||||
* Initial stable release
|
19
App/Source/node_modules/pug-walk/LICENSE
generated
vendored
Normal file
19
App/Source/node_modules/pug-walk/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2015 Forbes Lindesay
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
112
App/Source/node_modules/pug-walk/index.js
generated
vendored
Normal file
112
App/Source/node_modules/pug-walk/index.js
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = walkAST;
|
||||
function walkAST(ast, before, after, options) {
|
||||
if (after && typeof after === 'object' && typeof options === 'undefined') {
|
||||
options = after;
|
||||
after = null;
|
||||
}
|
||||
options = options || {includeDependencies: false};
|
||||
var parents = options.parents = options.parents || [];
|
||||
|
||||
var replace = function replace(replacement) {
|
||||
if (Array.isArray(replacement) && !replace.arrayAllowed) {
|
||||
throw new Error('replace() can only be called with an array if the last parent is a Block or NamedBlock');
|
||||
}
|
||||
ast = replacement;
|
||||
};
|
||||
replace.arrayAllowed = parents[0] && (
|
||||
/^(Named)?Block$/.test(parents[0].type) ||
|
||||
parents[0].type === 'RawInclude' && ast.type === 'IncludeFilter');
|
||||
|
||||
if (before) {
|
||||
var result = before(ast, replace);
|
||||
if (result === false) {
|
||||
return ast;
|
||||
} else if (Array.isArray(ast)) {
|
||||
// return right here to skip after() call on array
|
||||
return walkAndMergeNodes(ast);
|
||||
}
|
||||
}
|
||||
|
||||
parents.unshift(ast);
|
||||
|
||||
switch (ast.type) {
|
||||
case 'NamedBlock':
|
||||
case 'Block':
|
||||
ast.nodes = walkAndMergeNodes(ast.nodes);
|
||||
break;
|
||||
case 'Case':
|
||||
case 'Filter':
|
||||
case 'Mixin':
|
||||
case 'Tag':
|
||||
case 'InterpolatedTag':
|
||||
case 'When':
|
||||
case 'Code':
|
||||
case 'While':
|
||||
if (ast.block) {
|
||||
ast.block = walkAST(ast.block, before, after, options);
|
||||
}
|
||||
break;
|
||||
case 'Each':
|
||||
if (ast.block) {
|
||||
ast.block = walkAST(ast.block, before, after, options);
|
||||
}
|
||||
if (ast.alternate) {
|
||||
ast.alternate = walkAST(ast.alternate, before, after, options);
|
||||
}
|
||||
break;
|
||||
case 'Conditional':
|
||||
if (ast.consequent) {
|
||||
ast.consequent = walkAST(ast.consequent, before, after, options);
|
||||
}
|
||||
if (ast.alternate) {
|
||||
ast.alternate = walkAST(ast.alternate, before, after, options);
|
||||
}
|
||||
break;
|
||||
case 'Include':
|
||||
walkAST(ast.block, before, after, options);
|
||||
walkAST(ast.file, before, after, options);
|
||||
break;
|
||||
case 'Extends':
|
||||
walkAST(ast.file, before, after, options);
|
||||
break;
|
||||
case 'RawInclude':
|
||||
ast.filters = walkAndMergeNodes(ast.filters);
|
||||
walkAST(ast.file, before, after, options);
|
||||
break;
|
||||
case 'Attrs':
|
||||
case 'BlockComment':
|
||||
case 'Comment':
|
||||
case 'Doctype':
|
||||
case 'IncludeFilter':
|
||||
case 'MixinBlock':
|
||||
case 'YieldBlock':
|
||||
case 'Text':
|
||||
break;
|
||||
case 'FileReference':
|
||||
if (options.includeDependencies && ast.ast) {
|
||||
walkAST(ast.ast, before, after, options);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Error('Unexpected node type ' + ast.type);
|
||||
break;
|
||||
}
|
||||
|
||||
parents.shift();
|
||||
|
||||
after && after(ast, replace);
|
||||
return ast;
|
||||
|
||||
function walkAndMergeNodes(nodes) {
|
||||
return nodes.reduce(function (nodes, node) {
|
||||
var result = walkAST(node, before, after, options);
|
||||
if (Array.isArray(result)) {
|
||||
return nodes.concat(result);
|
||||
} else {
|
||||
return nodes.concat([result]);
|
||||
}
|
||||
}, []);
|
||||
}
|
||||
}
|
22
App/Source/node_modules/pug-walk/package.json
generated
vendored
Normal file
22
App/Source/node_modules/pug-walk/package.json
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "pug-walk",
|
||||
"version": "1.1.8",
|
||||
"description": "Walk and transform a pug AST",
|
||||
"keywords": [
|
||||
"pug"
|
||||
],
|
||||
"devDependencies": {
|
||||
"pug-lexer": "^4.1.0",
|
||||
"pug-parser": "^5.0.1"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pugjs/pug/tree/master/packages/pug-walk"
|
||||
},
|
||||
"author": "ForbesLindesay",
|
||||
"license": "MIT",
|
||||
"gitHead": "1bdf628a70fda7a0d840c52f3abce54b1c6b0130"
|
||||
}
|
Reference in New Issue
Block a user