aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2014-10-20 18:12:13 +0300
committerMihai Bazon <mihai@bazon.net>2014-10-20 18:12:13 +0300
commitf36a1eaa8b5203ab7e4616108c33a0b68668a8db (patch)
tree3a869f736a04317d44ea6b699ec92b52620625e6 /bin
parenta64bdda9ae42ff39543fcfe16d70c4e064780e92 (diff)
downloadtracifyjs-f36a1eaa8b5203ab7e4616108c33a0b68668a8db.tar.gz
tracifyjs-f36a1eaa8b5203ab7e4616108c33a0b68668a8db.zip
Add option to allow return outside of functions.
Close #288
Diffstat (limited to 'bin')
-rwxr-xr-xbin/uglifyjs9
1 files changed, 6 insertions, 3 deletions
diff --git a/bin/uglifyjs b/bin/uglifyjs
index 3a3318b2..fc33f96f 100755
--- a/bin/uglifyjs
+++ b/bin/uglifyjs
@@ -64,6 +64,7 @@ You need to pass an argument to this option to specify the name that your module
.describe("v", "Verbose")
.describe("V", "Print version number and exit.")
.describe("noerr", "Don't throw an error for unknown options in -c, -b or -m.")
+ .describe("bare-returns", "Allow return outside of functions. Useful when minifying CommonJS modules.")
.alias("p", "prefix")
.alias("o", "output")
@@ -100,6 +101,7 @@ You need to pass an argument to this option to specify the name that your module
.boolean("lint")
.boolean("V")
.boolean("noerr")
+ .boolean("bare-returns")
.wrap(80)
@@ -275,9 +277,10 @@ async.eachLimit(files, 1, function (file, cb) {
else {
try {
TOPLEVEL = UglifyJS.parse(code, {
- filename : file,
- toplevel : TOPLEVEL,
- expression : ARGS.expr,
+ filename : file,
+ toplevel : TOPLEVEL,
+ expression : ARGS.expr,
+ bare_returns : ARGS.bare_returns,
});
} catch(ex) {
if (ex instanceof UglifyJS.JS_Parse_Error) {