diff options
author | Jake Harding <jharding@twitter.com> | 2013-02-28 21:21:14 -0800 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2013-03-24 11:11:23 +0200 |
commit | 478bf4dbdde27f1110e36a56a2f9be6c11847b68 (patch) | |
tree | e9a6f6412cc9696af6054a3ce602a7afb6132cc5 /bin/uglifyjs | |
parent | e0f67baf2d73d80685781b55b9fbfa41539e0f37 (diff) | |
download | tracifyjs-478bf4dbdde27f1110e36a56a2f9be6c11847b68.tar.gz tracifyjs-478bf4dbdde27f1110e36a56a2f9be6c11847b68.zip |
Add support for enclose option. Closes #139.
Diffstat (limited to 'bin/uglifyjs')
-rwxr-xr-x | bin/uglifyjs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/uglifyjs b/bin/uglifyjs index 8a510d61..b8fad946 100755 --- a/bin/uglifyjs +++ b/bin/uglifyjs @@ -32,6 +32,7 @@ For example -p 3 will drop 3 directories from file names and ensure they are rel Pass options like -c hoist_vars=false,if_return=false. \ Use -c with no argument to use the default compression options.") .describe("d", "Global definitions") + .describe("e", "Embed everything in a big function, with a configurable parameter/argument list.") .describe("comments", "Preserve copyright comments in the output. \ By default this works like Google Closure, keeping JSDoc-style comments that contain \"@license\" or \"@preserve\". \ @@ -62,6 +63,7 @@ You need to pass an argument to this option to specify the name that your module .alias("d", "define") .alias("r", "reserved") .alias("V", "version") + .alias("e", "enclose") .string("source-map") .string("source-map-root") @@ -70,6 +72,7 @@ You need to pass an argument to this option to specify the name that your module .string("m") .string("c") .string("d") + .string("e") .string("comments") .string("wrap") .boolean("screw-ie") @@ -248,6 +251,16 @@ if (ARGS.wrap) { TOPLEVEL = TOPLEVEL.wrap_commonjs(ARGS.wrap, ARGS.export_all); } +if (ARGS.enclose) { + var arg_parameter_list = ARGS.enclose; + + if (!(arg_parameter_list instanceof Array)) { + arg_parameter_list = [arg_parameter_list]; + } + + TOPLEVEL = TOPLEVEL.wrap_enclose(arg_parameter_list); +} + var SCOPE_IS_NEEDED = COMPRESS || MANGLE || ARGS.lint; if (SCOPE_IS_NEEDED) { |