diff options
author | b-fuze <b-fuze.root@live.com> | 2018-03-31 07:26:40 -0400 |
---|---|---|
committer | Alex Lam S.L <alexlamsl@gmail.com> | 2018-03-31 20:26:40 +0900 |
commit | 8adfc29f914efd2af62638491b6c3034e1cc8712 (patch) | |
tree | 8857313f6c50f96972ea274f16bb1565a2a59f2c /bin | |
parent | 02f47e1713cb413ac0d2602039c18292f43db863 (diff) | |
download | tracifyjs-8adfc29f914efd2af62638491b6c3034e1cc8712.tar.gz tracifyjs-8adfc29f914efd2af62638491b6c3034e1cc8712.zip |
Don't load source map until the JS source is fully received (#3040)
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/uglifyjs | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/bin/uglifyjs b/bin/uglifyjs index 2ff1feb7..7617d781 100755 --- a/bin/uglifyjs +++ b/bin/uglifyjs @@ -46,7 +46,7 @@ program.option("--name-cache <file>", "File to hold mangled name mappings."); program.option("--rename", "Force symbol expansion."); program.option("--no-rename", "Disable symbol expansion."); program.option("--self", "Build UglifyJS as a library (implies --wrap UglifyJS)"); -program.option("--source-map [options]", "Enable source map/specify source map options.", parse_source_map()); +program.option("--source-map [options]", "Enable source map/specify source map options.", parse_js()); program.option("--timings", "Display operations run time on STDERR.") program.option("--toplevel", "Compress and/or mangle variables in toplevel scope."); program.option("--verbose", "Print diagnostic messages."); @@ -176,6 +176,11 @@ function run() { UglifyJS.AST_Node.warn_function = function(msg) { print_error("WARN: " + msg); }; + var content = program.sourceMap && program.sourceMap.content; + if (content && content != "inline") { + print_error("INFO: Using input source map: " + content); + options.sourceMap.content = read_file(content, content); + } if (program.timings) options.timings = true; try { if (program.parse) { @@ -377,19 +382,6 @@ function parse_js(flag) { } } -function parse_source_map() { - var parse = parse_js(); - return function(value, options) { - var hasContent = options && "content" in options; - var settings = parse(value, options); - if (!hasContent && settings.content && settings.content != "inline") { - print_error("INFO: Using input source map: " + settings.content); - settings.content = read_file(settings.content, settings.content); - } - return settings; - } -} - function skip_key(key) { return skip_keys.indexOf(key) >= 0; } |