suppress warnings by default
This commit is contained in:
parent
0792c77564
commit
32561c1517
|
|
@ -133,7 +133,8 @@ 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.
|
||||
--verbose Print diagnostic messages.
|
||||
--warn Print warning 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
|
||||
|
|
@ -743,9 +744,6 @@ Other options:
|
|||
|
||||
- `warnings` (default `false`) — pass `true` to display compressor warnings.
|
||||
|
||||
- `fromString` (default `false`) — if you pass `true` then you can pass
|
||||
JavaScript source code, rather than file names.
|
||||
|
||||
- `mangle` (default `true`) — pass `false` to skip mangling names, or pass
|
||||
an object to specify mangling options (see below).
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ 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("--verbose", "Print diagnostic messages.");
|
||||
program.option("--warn", "Print warning 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) {
|
||||
|
|
@ -99,6 +100,8 @@ if (program.sourceMap && "base" in program.sourceMap) {
|
|||
}
|
||||
if (program.verbose) {
|
||||
options.warnings = "verbose";
|
||||
} else if (program.warn) {
|
||||
options.warnings = true;
|
||||
}
|
||||
if (program.self) {
|
||||
if (program.args.length) {
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ function Compressor(options, false_by_default) {
|
|||
unsafe_math : false,
|
||||
unsafe_proto : false,
|
||||
unused : !false_by_default,
|
||||
warnings : true,
|
||||
warnings : false,
|
||||
}, true);
|
||||
var pure_funcs = this.options["pure_funcs"];
|
||||
if (typeof pure_funcs == "function") {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ function minify(files, options) {
|
|||
parse: {},
|
||||
sourceMap: false,
|
||||
toplevel: false,
|
||||
warnings: true,
|
||||
warnings: false,
|
||||
wrap: false,
|
||||
}, true);
|
||||
set_shorthand("ie8", options, [ "compress", "mangle", "output" ]);
|
||||
|
|
@ -70,7 +70,7 @@ function minify(files, options) {
|
|||
}, true);
|
||||
}
|
||||
var warnings = [];
|
||||
if (!AST_Node.warn_function) {
|
||||
if (options.warnings && !AST_Node.warn_function) {
|
||||
AST_Node.warn_function = function(warning) {
|
||||
warnings.push(warning);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ var createHash = require("crypto").createHash;
|
|||
var fork = require("child_process").fork;
|
||||
var args = process.argv.slice(2);
|
||||
if (!args.length) {
|
||||
args.push("-mc", "warnings=false");
|
||||
args.push("-mc");
|
||||
}
|
||||
args.push("--stats");
|
||||
var urls = [
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ if (typeof phantom == "undefined") {
|
|||
});
|
||||
var args = process.argv.slice(2);
|
||||
if (!args.length) {
|
||||
args.push("-mc", "warnings=false");
|
||||
args.push("-mc");
|
||||
}
|
||||
args.push("--stats");
|
||||
var child_process = require("child_process");
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ describe("test/jetstream.js", function() {
|
|||
run("npm", ["install", "phantomjs-prebuilt@2.1.14"], done);
|
||||
});
|
||||
[
|
||||
"-mc warnings=false",
|
||||
"-mc keep_fargs=false,passes=3,pure_getters,unsafe,unsafe_comps,unsafe_math,unsafe_proto,warnings=false",
|
||||
"-mc",
|
||||
"-mc keep_fargs=false,passes=3,pure_getters,unsafe,unsafe_comps,unsafe_math,unsafe_proto",
|
||||
].forEach(function(options) {
|
||||
it("Should pass with options " + options, function(done) {
|
||||
var args = options.split(/ /);
|
||||
|
|
|
|||
|
|
@ -11,20 +11,12 @@
|
|||
"compress": false
|
||||
},
|
||||
{
|
||||
"compress": {
|
||||
"warnings": false
|
||||
},
|
||||
"mangle": false
|
||||
},
|
||||
{},
|
||||
{
|
||||
"compress": {
|
||||
"warnings": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"compress": {
|
||||
"toplevel": true,
|
||||
"warnings": false
|
||||
"toplevel": true
|
||||
},
|
||||
"mangle": {
|
||||
"toplevel": true
|
||||
|
|
@ -33,8 +25,7 @@
|
|||
{
|
||||
"compress": {
|
||||
"keep_fargs": false,
|
||||
"passes": 3,
|
||||
"warnings": false
|
||||
"passes": 3
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user