aboutsummaryrefslogtreecommitdiff
path: root/lib/minify.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/minify.js')
-rw-r--r--lib/minify.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/minify.js b/lib/minify.js
index b4bfe451..773e953a 100644
--- a/lib/minify.js
+++ b/lib/minify.js
@@ -68,6 +68,7 @@ function minify(files, options) {
set_shorthand("keep_fnames", options, [ "compress", "mangle" ]);
set_shorthand("toplevel", options, [ "compress", "mangle" ]);
set_shorthand("warnings", options, [ "compress" ]);
+ var quoted_props;
if (options.mangle) {
options.mangle = defaults(options.mangle, {
cache: options.nameCache && (options.nameCache.vars || {}),
@@ -78,11 +79,16 @@ function minify(files, options) {
reserved: [],
toplevel: false,
}, true);
- if (options.nameCache && options.mangle.properties) {
+ if (options.mangle.properties) {
if (typeof options.mangle.properties != "object") {
options.mangle.properties = {};
}
- if (!("cache" in options.mangle.properties)) {
+ if (options.mangle.properties.keep_quoted) {
+ quoted_props = options.mangle.properties.reserved;
+ if (!Array.isArray(quoted_props)) quoted_props = [];
+ options.mangle.properties.reserved = quoted_props;
+ }
+ if (options.nameCache && !("cache" in options.mangle.properties)) {
options.mangle.properties.cache = options.nameCache.props || {};
}
}
@@ -125,6 +131,9 @@ function minify(files, options) {
}
toplevel = options.parse.toplevel;
}
+ if (quoted_props) {
+ reserve_quoted_keys(toplevel, quoted_props);
+ }
if (options.wrap) {
toplevel = toplevel.wrap_commonjs(options.wrap);
}