add --verbose

shortcut for `options.compress.warnings="verbose"`
This commit is contained in:
alexlamsl 2017-04-14 16:01:43 +08:00
parent 4a927b0d48
commit 95e2ec803d
2 changed files with 6 additions and 1 deletions

View File

@ -111,6 +111,7 @@ The available options are:
`//# sourceMappingURL`.
--stats Display operations run time on STDERR.
--toplevel Compress and/or mangle variables in toplevel scope.
--verbose Print informational/diagnostic messages.
--wrap <name> Embed everything in a big function, making the
“exports” and “global” variables available. You
need to pass an argument to this option to
@ -126,7 +127,6 @@ TODOs:
parsed, but the source map will adjust for its
presence.
--lint Display some scope warnings
-v, --verbose Verbose
--reserved-file File containing reserved names
--reserve-domprops Make (most?) DOM properties reserved for
--mangle-props

View File

@ -32,6 +32,7 @@ program.option("--self", "Build UglifyJS2 as a library (implies --wrap UglifyJS)
program.option("--source-map [options]", "Enable source map/specify source map options.", parseSourceMap());
program.option("--stats", "Display operations run time on STDERR.")
program.option("--toplevel", "Compress and/or mangle variables in toplevel scope.");
program.option("--verbose", "Print informational/diagnostic messages.");
program.option("--wrap <name>", "Embed everything as a function with “exports” corresponding to “name” globally.");
program.arguments("[files...]").parseArgv(process.argv);
if (program.configFile) {
@ -79,6 +80,10 @@ if (program.parse) {
options.parse = program.parse;
}
}
if (program.verbose && options.compress) {
if (typeof options.compress != "object") options.compress = {};
options.compress.warnings = "verbose";
}
if (program.self) {
if (program.args.length) {
console.error("WARN: Ignoring input files since --self was passed");