aboutsummaryrefslogtreecommitdiff
path: root/bin/uglifyjs
diff options
context:
space:
mode:
Diffstat (limited to 'bin/uglifyjs')
-rwxr-xr-xbin/uglifyjs14
1 files changed, 8 insertions, 6 deletions
diff --git a/bin/uglifyjs b/bin/uglifyjs
index 822e9266..8ea7d16b 100755
--- a/bin/uglifyjs
+++ b/bin/uglifyjs
@@ -39,7 +39,7 @@ program.option("--keep-fnames", "Do not mangle/drop function names. Useful for c
program.option("--name-cache <file>", "File to hold mangled name mappings.");
program.option("--self", "Build UglifyJS as a library (implies --wrap UglifyJS)");
program.option("--source-map [options]", "Enable source map/specify source map options.", parse_source_map());
-program.option("--stats", "Display operations run time on STDERR.")
+program.option("--timings", "Display operations run time on STDERR.")
program.option("--toplevel", "Compress and/or mangle variables in toplevel scope.");
program.option("--verbose", "Print diagnostic messages.");
program.option("--warn", "Print warning messages.");
@@ -115,10 +115,10 @@ if (program.output == "ast") {
};
}
if (program.parse) {
- if (program.parse.acorn || program.parse.spidermonkey) {
- if (program.sourceMap) fatal("ERROR: inline source map only works with built-in parser");
- } else {
+ if (!program.parse.acorn && !program.parse.spidermonkey) {
options.parse = program.parse;
+ } else if (program.sourceMap && program.sourceMap.content == "inline") {
+ fatal("ERROR: inline source map only works with built-in parser");
}
}
var convert_path = function(name) {
@@ -172,7 +172,7 @@ function run() {
UglifyJS.AST_Node.warn_function = function(msg) {
console.error("WARN:", msg);
};
- if (program.stats) program.stats = Date.now();
+ if (program.timings) options.timings = true;
try {
if (program.parse) {
if (program.parse.acorn) {
@@ -259,7 +259,9 @@ function run() {
return value instanceof UglifyJS.Dictionary ? value.toObject() : value;
}));
}
- if (program.stats) console.error("Elapsed:", Date.now() - program.stats);
+ if (result.timings) for (var phase in result.timings) {
+ console.error("- " + phase + ": " + result.timings[phase].toFixed(3) + "s");
+ }
}
function fatal(message) {