diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-04-26 04:23:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-26 04:23:52 +0800 |
commit | 324587f76980114e030c59165a60bd285ca05be0 (patch) | |
tree | 1f609c396c01110faeb115151e45784c146a90fc /bin/uglifyjs | |
parent | 80efaa2f331b2c3f3ec35218d1086830a39bec93 (diff) | |
download | tracifyjs-324587f76980114e030c59165a60bd285ca05be0.tar.gz tracifyjs-324587f76980114e030c59165a60bd285ca05be0.zip |
upgrade AST<->ESTree translation (#4870)
fixes #968
Diffstat (limited to 'bin/uglifyjs')
-rwxr-xr-x | bin/uglifyjs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/bin/uglifyjs b/bin/uglifyjs index 682c6a5a..325dacdd 100755 --- a/bin/uglifyjs +++ b/bin/uglifyjs @@ -235,7 +235,7 @@ if (options.mangle && options.mangle.properties) { }); } } -if (output == "ast") options.output = { +if (output == "ast" || output == "spidermonkey") options.output = { ast: true, code: false, }; @@ -313,9 +313,11 @@ function run() { if (options.parse.acorn) { files = convert_ast(function(toplevel, name) { return require("acorn").parse(files[name], { + ecmaVersion: "latest", locations: true, program: toplevel, - sourceFile: name + sourceFile: name, + sourceType: "module", }); }); } else if (options.parse.spidermonkey) { @@ -409,14 +411,7 @@ function run() { return value; }, 2)); } else if (output == "spidermonkey") { - print(JSON.stringify(UglifyJS.minify(result.code, { - compress: false, - mangle: false, - output: { - ast: true, - code: false - }, - }).ast.to_mozilla_ast(), null, 2)); + print(JSON.stringify(result.ast.to_mozilla_ast(), null, 2)); } else if (output) { fs.writeFileSync(output, result.code); if (result.map) fs.writeFileSync(output + ".map", result.map); |