introduce --safari10 (#2530)

This commit is contained in:
Alex Lam S.L
2017-11-29 03:34:47 +08:00
committed by GitHub
parent 1646c5844f
commit 736c366d93
4 changed files with 10 additions and 1 deletions

View File

@@ -111,6 +111,11 @@ a double dash to prevent input files being used as option arguments:
--keep-fnames Do not mangle/drop function names. Useful for --keep-fnames Do not mangle/drop function names. Useful for
code relying on Function.prototype.name. code relying on Function.prototype.name.
--name-cache <file> File to hold mangled name mappings. --name-cache <file> File to hold mangled name mappings.
--safari10 Support non-standard Safari 10/11.
Equivalent to setting `safari10: true` in `minify()`
for `mangle` and `output` options.
By default `uglify-es` will not work around
Safari 10/11 bugs.
--self Build UglifyJS as a library (implies --wrap UglifyJS) --self Build UglifyJS as a library (implies --wrap UglifyJS)
--source-map [options] Enable source map/specify source map options: --source-map [options] Enable source map/specify source map options:
`base` Path to compute relative paths from input files. `base` Path to compute relative paths from input files.

View File

@@ -50,6 +50,7 @@ program.option("--keep-classnames", "Do not mangle/drop class names.");
program.option("--keep-fnames", "Do not mangle/drop function names. Useful for code relying on Function.prototype.name."); program.option("--keep-fnames", "Do not mangle/drop function names. Useful for code relying on Function.prototype.name.");
program.option("--name-cache <file>", "File to hold mangled name mappings."); program.option("--name-cache <file>", "File to hold mangled name mappings.");
program.option("--no-rename", "Disable symbol expansion."); program.option("--no-rename", "Disable symbol expansion.");
program.option("--safari10", "Support non-standard Safari 10.");
program.option("--self", "Build UglifyJS as a library (implies --wrap UglifyJS)"); 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("--source-map [options]", "Enable source map/specify source map options.", parse_source_map());
program.option("--timings", "Display operations run time on STDERR.") program.option("--timings", "Display operations run time on STDERR.")
@@ -69,6 +70,7 @@ if (!program.output && program.sourceMap && program.sourceMap.url != "inline") {
"ie8", "ie8",
"mangle", "mangle",
"rename", "rename",
"safari10",
"sourceMap", "sourceMap",
"toplevel", "toplevel",
"wrap" "wrap"

View File

@@ -58,6 +58,7 @@ function minify(files, options) {
output: {}, output: {},
parse: {}, parse: {},
rename: undefined, rename: undefined,
safari10: false,
sourceMap: false, sourceMap: false,
timings: false, timings: false,
toplevel: false, toplevel: false,
@@ -77,6 +78,7 @@ function minify(files, options) {
set_shorthand("ie8", options, [ "compress", "mangle", "output" ]); set_shorthand("ie8", options, [ "compress", "mangle", "output" ]);
set_shorthand("keep_classnames", options, [ "compress", "mangle" ]); set_shorthand("keep_classnames", options, [ "compress", "mangle" ]);
set_shorthand("keep_fnames", options, [ "compress", "mangle" ]); set_shorthand("keep_fnames", options, [ "compress", "mangle" ]);
set_shorthand("safari10", options, [ "mangle", "output" ]);
set_shorthand("toplevel", options, [ "compress", "mangle" ]); set_shorthand("toplevel", options, [ "compress", "mangle" ]);
set_shorthand("warnings", options, [ "compress" ]); set_shorthand("warnings", options, [ "compress" ]);
var quoted_props; var quoted_props;

View File

@@ -16,7 +16,7 @@ describe("bin/uglifyjs", function () {
command += semver.satisfies(process.version, ">=4") ? "6" : "5"; command += semver.satisfies(process.version, ">=4") ? "6" : "5";
command += ',passes=3,keep_fargs=false,unsafe --wrap WrappedUglifyJS'; command += ',passes=3,keep_fargs=false,unsafe --wrap WrappedUglifyJS';
exec(command, function (err, stdout) { exec(command, { maxBuffer: 1048576 }, function (err, stdout) {
if (err) throw err; if (err) throw err;
eval(stdout); eval(stdout);