aboutsummaryrefslogtreecommitdiff
path: root/bin/uglifyjs
diff options
context:
space:
mode:
authorRichard van Velzen <rvanvelzen@experty.com>2016-09-30 12:27:45 +0200
committerRichard van Velzen <rvanvelzen@experty.com>2016-10-06 14:11:32 +0200
commite05510f3bce78943f76649a4102c2f10bfccdaef (patch)
tree9e18dff4a3af126d4c85633e6561af5a6bc15b94 /bin/uglifyjs
parentfc9804b90955d3b38ac6e6c903a8c0e3f7945913 (diff)
downloadtracifyjs-e05510f3bce78943f76649a4102c2f10bfccdaef.tar.gz
tracifyjs-e05510f3bce78943f76649a4102c2f10bfccdaef.zip
Add an option to wrap IIFEs in parenthesis
For #1307.
Diffstat (limited to 'bin/uglifyjs')
-rwxr-xr-xbin/uglifyjs7
1 files changed, 7 insertions, 0 deletions
diff --git a/bin/uglifyjs b/bin/uglifyjs
index 8d7bd759..da9e0f10 100755
--- a/bin/uglifyjs
+++ b/bin/uglifyjs
@@ -76,6 +76,7 @@ You need to pass an argument to this option to specify the name that your module
.describe("name-cache", "File to hold mangled names mappings")
.describe("pure-funcs", "List of functions that can be safely removed if their return value is not used")
.describe("dump-spidermonkey-ast", "Dump SpiderMonkey AST to stdout.")
+ .describe("wrap-iife", "Wrap IIFEs in parenthesis. Note: this disables the negate_iife compression option")
.alias("p", "prefix")
.alias("o", "output")
@@ -130,6 +131,7 @@ You need to pass an argument to this option to specify the name that your module
.boolean("bare-returns")
.boolean("keep-fnames")
.boolean("reserve-domprops")
+ .boolean("wrap-iife")
.wrap(80)
@@ -247,6 +249,11 @@ if (ARGS.keep_fnames) {
if (MANGLE) MANGLE.keep_fnames = true;
}
+if (ARGS.wrap_iife) {
+ if (COMPRESS) COMPRESS.negate_iife = false;
+ OUTPUT_OPTIONS.wrap_iife = true;
+}
+
if (BEAUTIFY)
UglifyJS.merge(OUTPUT_OPTIONS, BEAUTIFY);