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