-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support minify()
output as AST
#1878
Conversation
https://github.com/mishoo/UglifyJS2/pull/1878/files?w=1 for less scary diff |
How would the following output scenarios be supported?
|
I'd prefer the |
I thought about supporting those, but take |
I can live with the AST/code mismatch in that scenario. Comments are a whole different problem unto themselves. |
The way this PR is done, |
Okay, as long as it does not incur any output cost for |
In that case, we can just output both |
No, no, no. That would mean that the AST cannot be released in most common minify() scenarios causing more memory use. We only want to return |
Ah wait, what I meant to say is we don't need |
True, VMs do optimise memory usage quite aggressively. I'll update the PR with your proposal then. |
I think the |
- `options.output.ast` (default `false`) - `options.output.code` (default `true`)
As of your latest PR commit, we no longer need to export |
looks good |
After removing that test under |
If the CLI |
$ echo 'console.log("PASS")' | node bin/uglifyjs -cmb ast
console.log("PASS");
$ echo 'console.log("PASS")' | node bin/uglifyjs -cmb ast=0
console.log("PASS");
$ echo 'console.log("PASS")' | node bin/uglifyjs -cmb code
console.log("PASS"); However, $ echo 'console.log("PASS")' | node bin/uglifyjs -cmb code=0
undefined |
That makes sense - it was requested. As long the bash program return value is still |
Eventually I'd like to see the dump uglify AST patch integrated into the CLI with the |
I just had a brief visit at #769 - what does |
They're essentially the same except that Edit: and to make |
@alexlamsl If you do merge some variant of the dump AST patch into the CLI, please apply these changes: #769 (comment) |
Okay, in that case we can safely eliminate that since we have I read the PR and my first reaction was "why isn't this done as |
By all means - whatever works to not introduce more AST object overhead. |
options.output.ast
(defaultfalse
)options.output.code
(defaulttrue
)@kzc this is from your #1877 (comment)