infuse
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -48,3 +48,3 @@ | ||
outfile: { | ||
string: "OUPUT_PATH", | ||
string: "OUTPUT_PATH", | ||
position: 1, | ||
@@ -51,0 +51,0 @@ help: "File or directory to write to. If not specified, write to STDOUT." |
@@ -25,3 +25,12 @@ | ||
; | ||
function spliceNode (node, start, end /*rest...*/) { | ||
var args = Proteus.slice(arguments, 3) || []; | ||
node.splice.apply(node, [start, end].concat(args)); | ||
} | ||
function replaceNode (node, newnode) { | ||
spliceNode.apply(this, [node, 0, node.length].concat(newnode)); | ||
} | ||
function valueToAst (val, ast) { | ||
@@ -31,3 +40,3 @@ var type = typeof val, | ||
; | ||
ast = ast || []; | ||
@@ -39,3 +48,6 @@ ast.length = 0; | ||
case "object": | ||
if (Array.isArray(val)) { | ||
if (val.ast) { | ||
replaceNode(ast, val.ast); | ||
} | ||
else if (Array.isArray(val)) { | ||
ast[0] = keysMap.array; | ||
@@ -59,3 +71,3 @@ ast[1] = val.map(function (i) { return valueToAst(i); }); | ||
fnStr = fnName ? fnStr : fnStr.replace(/^function/, "function foo"); | ||
jsp.parse(fnStr)[1][0].forEach(function (v, i) { | ||
@@ -77,6 +89,6 @@ if (i > 1) { | ||
} | ||
return ast; | ||
} | ||
function astToValue (ast) { | ||
@@ -86,4 +98,6 @@ var obj, fn, fnName, fnArgs, fnBody; | ||
switch (ast[0]) { | ||
case keysMap.intern: | ||
return keysMap[ast[1]]; | ||
case "name": | ||
case "dot": | ||
case "call": | ||
return {ast: ast}; | ||
case keysMap.string: | ||
@@ -95,3 +109,3 @@ case keysMap.number: | ||
ast[1].forEach(function (prop) { | ||
obj[prop[1]] = astToValue(prop[2]); | ||
obj[prop[0]] = astToValue(prop[1]); | ||
}); | ||
@@ -112,30 +126,25 @@ return obj; | ||
} | ||
function spliceNode (node, start, end /*rest...*/) { | ||
var args = Proteus.slice(arguments, 3) || []; | ||
node.splice.apply(node, [start, end].concat(args)); | ||
} | ||
function replaceNode (node, newnode) { | ||
spliceNode.apply(this, [node, 0, node.length].concat(newnode)); | ||
} | ||
module.exports = function (altKeysMap) { | ||
keysMap = altKeysMap; | ||
}; | ||
Proteus.merge(module.exports, { | ||
Proteus.merge(module.exports, { | ||
DEFAULT_KEY_MAPPING: AST_NAME_KEYS, | ||
astToValue: astToValue, | ||
valueToAst: valueToAst, | ||
spliceNode: spliceNode, | ||
replaceNode: replaceNode, | ||
replaceNode: replaceNode | ||
parser: jsp, | ||
generator: jsb | ||
}); | ||
}()); | ||
}()); |
{ | ||
"name": "infuse", | ||
"description": "Mainline your node JavaScript for universal consumption.", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"keywords": [ | ||
@@ -33,3 +33,3 @@ "javascript", | ||
"dependencies": { | ||
"uglify-js": ">=1.2.x", | ||
"uglify-js": ">=1.3.x", | ||
"nomnom": ">=1.5.x", | ||
@@ -43,3 +43,3 @@ "resolve": ">=0.2.x", | ||
"should": ">=0.5.x", | ||
"sake": ">=0.0.x", | ||
"sake": ">=0.1.x", | ||
"underscore": ">=1.3.x" | ||
@@ -46,0 +46,0 @@ }, |
@@ -31,6 +31,6 @@ Infuse | ||
usage: infuse INPUT_PATH OUPUT_PATH [options] | ||
usage: infuse INPUT_PATH OUTPUT_PATH [options] | ||
INPUT_PATH File or directory to read. | ||
OUPUT_PATH File or directory to write to. If not specified, write to STDOUT. | ||
OUTPUT_PATH File or directory to write to. If not specified, write to STDOUT. | ||
@@ -78,3 +78,3 @@ options: | ||
~~~ | ||
uglify-js: >=1.2.x | ||
uglify-js: >=1.3.x | ||
nomnom: >=1.5.x | ||
@@ -94,3 +94,3 @@ resolve: >=0.2.x | ||
should: >=0.5.x | ||
sake: >=0.0.x | ||
sake: >=0.1.x | ||
underscore: >=1.3.x | ||
@@ -97,0 +97,0 @@ ~~~ |
Sorry, the diff of this file is not supported yet
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
55066
26
1107
1
9
Updateduglify-js@>=1.3.x