diff options
author | Jeremy Marzka <jeremy.marzka@techthrive.com> | 2016-01-17 21:54:09 -0500 |
---|---|---|
committer | Richard van Velzen <rvanvelzen@experty.com> | 2016-01-26 22:10:08 +0100 |
commit | 799509e145e56a9a6ccbaad6d32e1c404e0469eb (patch) | |
tree | ba23535850821c2fcc556859b27a5b0736f33048 /tools | |
parent | b5a7197ae592a1ccdb217e74df4973d2a02a3a06 (diff) | |
download | tracifyjs-799509e145e56a9a6ccbaad6d32e1c404e0469eb.tar.gz tracifyjs-799509e145e56a9a6ccbaad6d32e1c404e0469eb.zip |
Added a mangle properties option
Diffstat (limited to 'tools')
-rw-r--r-- | tools/node.js | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/tools/node.js b/tools/node.js index f6048661..5764286e 100644 --- a/tools/node.js +++ b/tools/node.js @@ -32,15 +32,17 @@ UglifyJS.AST_Node.warn_function = function(txt) { exports.minify = function(files, options) { options = UglifyJS.defaults(options, { - spidermonkey : false, - outSourceMap : null, - sourceRoot : null, - inSourceMap : null, - fromString : false, - warnings : false, - mangle : {}, - output : null, - compress : {} + spidermonkey : false, + outSourceMap : null, + sourceRoot : null, + inSourceMap : null, + fromString : false, + warnings : false, + mangle : {}, + mangleProperties : false, + nameCache : null, + output : null, + compress : {} }); UglifyJS.base54.reset(); @@ -77,14 +79,21 @@ exports.minify = function(files, options) { toplevel = toplevel.transform(sq); } - // 3. mangle + // 3. mangle properties + if (options.mangleProperties || options.nameCache) { + options.mangleProperties.cache = UglifyJS.readNameCache(options.nameCache, "props"); + toplevel = UglifyJS.mangle_properties(toplevel, options.mangleProperties); + UglifyJS.writeNameCache(options.nameCache, "props", options.mangleProperties.cache); + } + + // 4. mangle if (options.mangle) { toplevel.figure_out_scope(options.mangle); toplevel.compute_char_frequency(options.mangle); toplevel.mangle_names(options.mangle); } - // 4. output + // 5. output var inMap = options.inSourceMap; var output = {}; if (typeof options.inSourceMap == "string") { |