Set sane defaults when mangle_props=2
This commit is contained in:
parent
51ed9b80c9
commit
af42bbe976
12
README.md
12
README.md
|
|
@ -136,11 +136,13 @@ The available options are:
|
||||||
--mangle-props Mangle property names (default `0`). Set to
|
--mangle-props Mangle property names (default `0`). Set to
|
||||||
`true` or `1` to mangle all property names. Set
|
`true` or `1` to mangle all property names. Set
|
||||||
to `2` to only mangle unquoted property names.
|
to `2` to only mangle unquoted property names.
|
||||||
Use the `keep_quoted_props` beautifier option to
|
This also enables the `keep_quoted_props`
|
||||||
preserve the quotes around property names and set
|
beautifier option to preserve the quotes around
|
||||||
the `properties` compressor option to `false` to
|
property names and disables the `properties`
|
||||||
prevent rewriting quoted properties with dot
|
compressor option to prevent rewriting quoted
|
||||||
notation.
|
properties with dot notation. You can override
|
||||||
|
these by setting them explicitly on the command
|
||||||
|
line.
|
||||||
--mangle-regex Only mangle property names matching the regex
|
--mangle-regex Only mangle property names matching the regex
|
||||||
--name-cache File to hold mangled names mappings
|
--name-cache File to hold mangled names mappings
|
||||||
--pure-funcs List of functions that can be safely removed if
|
--pure-funcs List of functions that can be safely removed if
|
||||||
|
|
|
||||||
20
bin/uglifyjs
20
bin/uglifyjs
|
|
@ -212,12 +212,26 @@ if (ARGS.quotes === true) {
|
||||||
ARGS.quotes = 3;
|
ARGS.quotes = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ARGS.mangle_props === true) {
|
||||||
|
ARGS.mangle_props = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ARGS.mangle_props === "unquoted") {
|
||||||
|
ARGS.mangle_props = 2;
|
||||||
|
}
|
||||||
|
|
||||||
var OUTPUT_OPTIONS = {
|
var OUTPUT_OPTIONS = {
|
||||||
beautify : BEAUTIFY ? true : false,
|
beautify : BEAUTIFY ? true : false,
|
||||||
preamble : ARGS.preamble || null,
|
preamble : ARGS.preamble || null,
|
||||||
quote_style : ARGS.quotes != null ? ARGS.quotes : 0
|
quote_style : ARGS.quotes != null ? ARGS.quotes : 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (ARGS.mangle_props == 2) {
|
||||||
|
OUTPUT_OPTIONS.keep_quoted_props = true;
|
||||||
|
if (COMPRESS && !("properties" in COMPRESS))
|
||||||
|
COMPRESS.properties = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (ARGS.screw_ie8) {
|
if (ARGS.screw_ie8) {
|
||||||
if (COMPRESS) COMPRESS.screw_ie8 = true;
|
if (COMPRESS) COMPRESS.screw_ie8 = true;
|
||||||
if (MANGLE) MANGLE.screw_ie8 = true;
|
if (MANGLE) MANGLE.screw_ie8 = true;
|
||||||
|
|
@ -387,10 +401,6 @@ async.eachLimit(files, 1, function (file, cb) {
|
||||||
TOPLEVEL = TOPLEVEL.wrap_enclose(arg_parameter_list);
|
TOPLEVEL = TOPLEVEL.wrap_enclose(arg_parameter_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ARGS.mangle_props === true) {
|
|
||||||
ARGS.mangle_props = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ARGS.mangle_props || ARGS.name_cache) (function(){
|
if (ARGS.mangle_props || ARGS.name_cache) (function(){
|
||||||
var reserved = RESERVED ? RESERVED.props : null;
|
var reserved = RESERVED ? RESERVED.props : null;
|
||||||
var cache = readNameCache("props");
|
var cache = readNameCache("props");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user