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`. `//# sourceMappingURL`.
--stats Display operations run time on STDERR. --stats Display operations run time on STDERR.
--toplevel Compress and/or mangle variables in toplevel scope. --toplevel Compress and/or mangle variables in toplevel scope.
--verbose Print informational/diagnostic messages.
--wrap <name> Embed everything in a big function, making the --wrap <name> Embed everything in a big function, making the
“exports” and “global” variables available. You “exports” and “global” variables available. You
need to pass an argument to this option to need to pass an argument to this option to
@ -126,7 +127,6 @@ TODOs:
parsed, but the source map will adjust for its parsed, but the source map will adjust for its
presence. presence.
--lint Display some scope warnings --lint Display some scope warnings
-v, --verbose Verbose
--reserved-file File containing reserved names --reserved-file File containing reserved names
--reserve-domprops Make (most?) DOM properties reserved for --reserve-domprops Make (most?) DOM properties reserved for
--mangle-props --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("--source-map [options]", "Enable source map/specify source map options.", parseSourceMap());
program.option("--stats", "Display operations run time on STDERR.") program.option("--stats", "Display operations run time on STDERR.")
program.option("--toplevel", "Compress and/or mangle variables in toplevel scope."); 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.option("--wrap <name>", "Embed everything as a function with “exports” corresponding to “name” globally.");
program.arguments("[files...]").parseArgv(process.argv); program.arguments("[files...]").parseArgv(process.argv);
if (program.configFile) { if (program.configFile) {
@ -79,6 +80,10 @@ if (program.parse) {
options.parse = 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.self) {
if (program.args.length) { if (program.args.length) {
console.error("WARN: Ignoring input files since --self was passed"); console.error("WARN: Ignoring input files since --self was passed");