aboutsummaryrefslogtreecommitdiff
path: root/bin/uglifyjs
diff options
context:
space:
mode:
authorkzc <zaxxon2011@gmail.com>2016-06-30 00:24:34 -0400
committerRichard van Velzen <rvanvelzen1@gmail.com>2016-06-30 21:49:48 +0200
commit02c638209ee22816b1324ff0c0f47b27db1336af (patch)
treeab0477bc05a88c73e818b059c3c23baa34b48508 /bin/uglifyjs
parent030611b729af46d2239bd09c95f88e708660f254 (diff)
downloadtracifyjs-02c638209ee22816b1324ff0c0f47b27db1336af.tar.gz
tracifyjs-02c638209ee22816b1324ff0c0f47b27db1336af.zip
Enable --screw-ie8 by default.
catch identifier is mangled correctly for ES5 standards-compliant JS engines by default. Unconditionally use the ie8 if/do-while workaround whether or not --screw-ie8 is enabled. To support non-standard ie8 javascript use: uglifyjs --support-ie8
Diffstat (limited to 'bin/uglifyjs')
-rwxr-xr-xbin/uglifyjs20
1 files changed, 13 insertions, 7 deletions
diff --git a/bin/uglifyjs b/bin/uglifyjs
index b7009426..30d234fd 100755
--- a/bin/uglifyjs
+++ b/bin/uglifyjs
@@ -10,6 +10,7 @@ var fs = require("fs");
var path = require("path");
var async = require("async");
var acorn;
+var screw_ie8 = true;
var ARGS = yargs
.usage("$0 input1.js [input2.js ...] [options]\n\
Use a single dash to read input from the standard input.\
@@ -24,7 +25,8 @@ mangling you need to use `-c` and `-m`.\
.describe("source-map-url", "The path to the source map to be added in //# sourceMappingURL. Defaults to the value passed with --source-map.")
.describe("source-map-include-sources", "Pass this flag if you want to include the content of source files in the source map as sourcesContent property.")
.describe("in-source-map", "Input source map, useful if you're compressing JS that was generated from some other original code.")
- .describe("screw-ie8", "Pass this flag if you don't care about full compliance with Internet Explorer 6-8 quirks (by default UglifyJS will try to be IE-proof).")
+ .describe("screw-ie8", "Do not support Internet Explorer 6-8 quirks. This flag is enabled by default.")
+ .describe("support-ie8", "Support non-standard Internet Explorer 6-8 javascript. Note: may break standards compliant `catch` identifiers.")
.describe("expr", "Parse a single expression, rather than a program (for parsing JSON)")
.describe("p", "Skip prefix for original filenames that appear in source maps. \
For example -p 3 will drop 3 directories from file names and ensure they are relative paths. \
@@ -105,12 +107,14 @@ You need to pass an argument to this option to specify the name that your module
.string("p")
.string("prefix")
.string("name-cache")
+
.array("reserved-file")
.array("pure-funcs")
.boolean("expr")
.boolean("source-map-include-sources")
.boolean("screw-ie8")
+ .boolean("support-ie8")
.boolean("export-all")
.boolean("self")
.boolean("v")
@@ -230,12 +234,14 @@ if (ARGS.mangle_props == 2) {
COMPRESS.properties = false;
}
-if (ARGS.screw_ie8) {
- if (COMPRESS) COMPRESS.screw_ie8 = true;
- if (MANGLE) MANGLE.screw_ie8 = true;
- OUTPUT_OPTIONS.screw_ie8 = true;
+if (ARGS.support_ie8 === true && ARGS.screw_ie8 !== true) {
+ screw_ie8 = false;
}
+if (COMPRESS) COMPRESS.screw_ie8 = screw_ie8;
+if (MANGLE) MANGLE.screw_ie8 = screw_ie8;
+OUTPUT_OPTIONS.screw_ie8 = screw_ie8;
+
if (ARGS.keep_fnames) {
if (COMPRESS) COMPRESS.keep_fnames = true;
if (MANGLE) MANGLE.keep_fnames = true;
@@ -426,7 +432,7 @@ async.eachLimit(files, 1, function (file, cb) {
if (SCOPE_IS_NEEDED) {
time_it("scope", function(){
- TOPLEVEL.figure_out_scope({ screw_ie8: ARGS.screw_ie8, cache: TL_CACHE });
+ TOPLEVEL.figure_out_scope({ screw_ie8: screw_ie8, cache: TL_CACHE });
if (ARGS.lint) {
TOPLEVEL.scope_warnings();
}
@@ -441,7 +447,7 @@ async.eachLimit(files, 1, function (file, cb) {
if (SCOPE_IS_NEEDED) {
time_it("scope", function(){
- TOPLEVEL.figure_out_scope({ screw_ie8: ARGS.screw_ie8, cache: TL_CACHE });
+ TOPLEVEL.figure_out_scope({ screw_ie8: screw_ie8, cache: TL_CACHE });
if (MANGLE && !TL_CACHE) {
TOPLEVEL.compute_char_frequency(MANGLE);
}