diff options
Diffstat (limited to 'node_modules/uglify-js/tools/node.js')
-rw-r--r-- | node_modules/uglify-js/tools/node.js | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/node_modules/uglify-js/tools/node.js b/node_modules/uglify-js/tools/node.js index dc2701060..3e37092cb 100644 --- a/node_modules/uglify-js/tools/node.js +++ b/node_modules/uglify-js/tools/node.js @@ -1,7 +1,6 @@ var fs = require("fs"); -var UglifyJS = exports; -var FILES = UglifyJS.FILES = [ +exports.FILES = [ "../lib/utils.js", "../lib/ast.js", "../lib/parse.js", @@ -14,32 +13,29 @@ var FILES = UglifyJS.FILES = [ "../lib/propmangle.js", "../lib/minify.js", "./exports.js", -].map(function(file){ +].map(function(file) { return require.resolve(file); }); new Function("MOZ_SourceMap", "exports", function() { - var code = FILES.map(function(file) { + var code = exports.FILES.map(function(file) { return fs.readFileSync(file, "utf8"); }); code.push("exports.describe_ast = " + describe_ast.toString()); return code.join("\n\n"); -}())( - require("source-map"), - UglifyJS -); +}())(require("source-map"), exports); function describe_ast() { var out = OutputStream({ beautify: true }); function doitem(ctor) { out.print("AST_" + ctor.TYPE); - var props = ctor.SELF_PROPS.filter(function(prop){ + var props = ctor.SELF_PROPS.filter(function(prop) { return !/^\$/.test(prop); }); if (props.length > 0) { out.space(); - out.with_parens(function(){ - props.forEach(function(prop, i){ + out.with_parens(function() { + props.forEach(function(prop, i) { if (i) out.space(); out.print(prop); }); @@ -51,8 +47,8 @@ function describe_ast() { } if (ctor.SUBCLASSES.length > 0) { out.space(); - out.with_block(function(){ - ctor.SUBCLASSES.forEach(function(ctor, i){ + out.with_block(function() { + ctor.SUBCLASSES.forEach(function(ctor, i) { out.indent(); doitem(ctor); out.newline(); @@ -65,11 +61,11 @@ function describe_ast() { } function infer_options(options) { - var result = UglifyJS.minify("", options); + var result = exports.minify("", options); return result.error && result.error.defs; } -UglifyJS.default_options = function() { +exports.default_options = function() { var defs = {}; Object.keys(infer_options({ 0: 0 })).forEach(function(component) { var options = {}; |