Merge 1175ed8c51 into 5c7705fcad
This commit is contained in:
commit
ab3a12fbdd
23
bin/uglifyjs
23
bin/uglifyjs
|
|
@ -9,6 +9,7 @@ var yargs = require("yargs");
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
var async = require("async");
|
var async = require("async");
|
||||||
|
var exit = require("exit");
|
||||||
var acorn;
|
var acorn;
|
||||||
var screw_ie8 = true;
|
var screw_ie8 = true;
|
||||||
var ARGS = yargs
|
var ARGS = yargs
|
||||||
|
|
@ -152,18 +153,18 @@ if (ARGS.noerr) {
|
||||||
if (ARGS.version || ARGS.V) {
|
if (ARGS.version || ARGS.V) {
|
||||||
var json = require("../package.json");
|
var json = require("../package.json");
|
||||||
print(json.name + ' ' + json.version);
|
print(json.name + ' ' + json.version);
|
||||||
process.exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ARGS.ast_help) {
|
if (ARGS.ast_help) {
|
||||||
var desc = UglifyJS.describe_ast();
|
var desc = UglifyJS.describe_ast();
|
||||||
print(typeof desc == "string" ? desc : JSON.stringify(desc, null, 2));
|
print(typeof desc == "string" ? desc : JSON.stringify(desc, null, 2));
|
||||||
process.exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ARGS.h || ARGS.help) {
|
if (ARGS.h || ARGS.help) {
|
||||||
print(yargs.help());
|
print(yargs.help());
|
||||||
process.exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ARGS.acorn) {
|
if (ARGS.acorn) {
|
||||||
|
|
@ -298,12 +299,12 @@ if (files.length == 0) {
|
||||||
|
|
||||||
if (files.indexOf("-") >= 0 && ARGS.source_map) {
|
if (files.indexOf("-") >= 0 && ARGS.source_map) {
|
||||||
print_error("ERROR: Source map doesn't work with input from STDIN");
|
print_error("ERROR: Source map doesn't work with input from STDIN");
|
||||||
process.exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (files.filter(function(el){ return el == "-" }).length > 1) {
|
if (files.filter(function(el){ return el == "-" }).length > 1) {
|
||||||
print_error("ERROR: Can read a single file from STDIN (two or more dashes specified)");
|
print_error("ERROR: Can read a single file from STDIN (two or more dashes specified)");
|
||||||
process.exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var STATS = {};
|
var STATS = {};
|
||||||
|
|
@ -328,7 +329,7 @@ try {
|
||||||
print_error(ex.msg);
|
print_error(ex.msg);
|
||||||
print_error("Supported options:");
|
print_error("Supported options:");
|
||||||
print_error(sys.inspect(ex.defs));
|
print_error(sys.inspect(ex.defs));
|
||||||
process.exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -336,7 +337,7 @@ async.eachLimit(files, 1, function (file, cb) {
|
||||||
read_whole_file(file, function (err, code) {
|
read_whole_file(file, function (err, code) {
|
||||||
if (err) {
|
if (err) {
|
||||||
print_error("ERROR: can't read file: " + file);
|
print_error("ERROR: can't read file: " + file);
|
||||||
process.exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (ARGS.p != null) {
|
if (ARGS.p != null) {
|
||||||
if (P_RELATIVE) {
|
if (P_RELATIVE) {
|
||||||
|
|
@ -375,7 +376,7 @@ async.eachLimit(files, 1, function (file, cb) {
|
||||||
print_error("Parse error at " + file + ":" + ex.line + "," + ex.col);
|
print_error("Parse error at " + file + ":" + ex.line + "," + ex.col);
|
||||||
print_error(ex.message);
|
print_error(ex.message);
|
||||||
print_error(ex.stack);
|
print_error(ex.stack);
|
||||||
process.exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
|
@ -412,7 +413,7 @@ async.eachLimit(files, 1, function (file, cb) {
|
||||||
regex = ARGS.mangle_regex ? extractRegex(ARGS.mangle_regex) : null;
|
regex = ARGS.mangle_regex ? extractRegex(ARGS.mangle_regex) : null;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print_error("ERROR: Invalid --mangle-regex: " + e.message);
|
print_error("ERROR: Invalid --mangle-regex: " + e.message);
|
||||||
process.exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
TOPLEVEL = UglifyJS.mangle_properties(TOPLEVEL, {
|
TOPLEVEL = UglifyJS.mangle_properties(TOPLEVEL, {
|
||||||
|
|
@ -534,7 +535,7 @@ function getOptions(flag, constants) {
|
||||||
} catch(ex) {
|
} catch(ex) {
|
||||||
if (ex instanceof UglifyJS.JS_Parse_Error) {
|
if (ex instanceof UglifyJS.JS_Parse_Error) {
|
||||||
print_error("Error parsing arguments for flag `" + flag + "': " + x);
|
print_error("Error parsing arguments for flag `" + flag + "': " + x);
|
||||||
process.exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast.walk(new UglifyJS.TreeWalker(function(node){
|
ast.walk(new UglifyJS.TreeWalker(function(node){
|
||||||
|
|
@ -554,7 +555,7 @@ function getOptions(flag, constants) {
|
||||||
}
|
}
|
||||||
print_error(node.TYPE)
|
print_error(node.TYPE)
|
||||||
print_error("Error parsing arguments for flag `" + flag + "': " + x);
|
print_error("Error parsing arguments for flag `" + flag + "': " + x);
|
||||||
process.exit(1);
|
exit(1);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": "~0.2.6",
|
"async": "~0.2.6",
|
||||||
|
"exit": "~0.1.2",
|
||||||
"source-map": "~0.5.1",
|
"source-map": "~0.5.1",
|
||||||
"uglify-to-browserify": "~1.0.0",
|
"uglify-to-browserify": "~1.0.0",
|
||||||
"yargs": "~3.10.0"
|
"yargs": "~3.10.0"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
var Mocha = require('mocha'),
|
var Mocha = require('mocha'),
|
||||||
fs = require('fs'),
|
fs = require('fs'),
|
||||||
path = require('path');
|
path = require('path'),
|
||||||
|
exit = require('exit');
|
||||||
|
|
||||||
// Instantiate a Mocha instance.
|
// Instantiate a Mocha instance.
|
||||||
var mocha = new Mocha({});
|
var mocha = new Mocha({});
|
||||||
|
|
@ -22,7 +23,7 @@ module.exports = function() {
|
||||||
mocha.run(function(failures) {
|
mocha.run(function(failures) {
|
||||||
if (failures !== 0) {
|
if (failures !== 0) {
|
||||||
process.on('exit', function () {
|
process.on('exit', function () {
|
||||||
process.exit(failures);
|
exit(failures);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ var U = require("../tools/node");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
var assert = require("assert");
|
var assert = require("assert");
|
||||||
|
var exit = require("exit");
|
||||||
|
|
||||||
var tests_dir = path.dirname(module.filename);
|
var tests_dir = path.dirname(module.filename);
|
||||||
var failures = 0;
|
var failures = 0;
|
||||||
|
|
@ -15,7 +16,7 @@ run_compress_tests();
|
||||||
if (failures) {
|
if (failures) {
|
||||||
console.error("\n!!! Failed " + failures + " test cases.");
|
console.error("\n!!! Failed " + failures + " test cases.");
|
||||||
console.error("!!! " + Object.keys(failed_files).join(", "));
|
console.error("!!! " + Object.keys(failed_files).join(", "));
|
||||||
process.exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var mocha_tests = require("./mocha.js");
|
var mocha_tests = require("./mocha.js");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user