Add a prepublish step to package.json
This commit is contained in:
parent
4d4daa07e0
commit
0322beb0aa
@ -188,7 +188,8 @@ in a context with such a
|
||||
|
||||
The `bin/without_eval` script can be used to generate a version of
|
||||
`acorn.js` that has the generated code inlined, and can thus run
|
||||
without evaluating anything.
|
||||
without evaluating anything. In versions of this library downloaded
|
||||
from NPM, this script will be available as `acorn_csp.js`.
|
||||
|
||||
### acorn_loose.js ###
|
||||
|
||||
|
||||
@ -6,15 +6,12 @@ var acornSrc = fs.readFileSync(require.resolve("../acorn"), "utf8");
|
||||
var acorn = require("../acorn"), walk = require("../util/walk");
|
||||
|
||||
var ast = acorn.parse(acornSrc);
|
||||
var touchups = [];
|
||||
var uses = [], declaration;
|
||||
var touchups = [], uses = [];
|
||||
|
||||
walk.simple(ast, {
|
||||
FunctionDeclaration: function(node) {
|
||||
if (node.id.name == "makePredicate") {
|
||||
if (node.id.name == "makePredicate")
|
||||
touchups.push({text: "// Removed to create an eval-free library", from: node.start, to: node.end});
|
||||
declaration = node;
|
||||
}
|
||||
},
|
||||
VariableDeclaration: function(node) {
|
||||
node.declarations.forEach(function(decl) {
|
||||
|
||||
@ -12,7 +12,10 @@
|
||||
"url": "http://marijnhaverbeke.nl/git/acorn"},
|
||||
"licenses": [{"type": "MIT",
|
||||
"url": "http://marijnhaverbeke.nl/acorn/LICENSE"}],
|
||||
"scripts": {"test": "node test/run.js"},
|
||||
"scripts": {
|
||||
"test": "node test/run.js",
|
||||
"prepublish": "bin/without_eval > acorn_csp.js"
|
||||
},
|
||||
"bin": {"acorn": "./bin/acorn"},
|
||||
"devDependencies": {"regenerate": "~0.6.2",
|
||||
"unicode-7.0.0": "~0.1.5"}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user