Skip to content
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

add `keep_quoted=strict` mode #310

merged 1 commit into from Mar 16, 2019


None yet
2 participants
Copy link

syranide commented Mar 8, 2019

I made a PR for uglify-js some time back for adding keep_quoted=strict mode which prevents quoted properties from being automatically reserved (which stops unquoted properties of the same name from being mangled). This is much closer to how google-closure-compiler works; it generates less code, more completely obfuscates code and more clearly brings mistakes in code to light. If you mix quoted and unquoted for the same the property with strict-mode, the name mangling will become incorrect and the app will not work correctly, rather than silently fixing it by making any quoted props reserved. It's not as nice, but it's opt-in and for me a more desirable behavior.

Source issue: #304

@fabiosantoscode I know you said you were busy with Terser 4, but I had some time over and just thought I'd prepare a PR anyway. So it's here when you feel you have the time, I don't mind rebasing if necessary later on.

PS. I kept quote instead of original_quote because I saw that it is the naming used for all the other AST-nodes which saves the original quote character. It's not for exactly the same purpose, but it's rather close. Do you still prefer that I rename it to original_quote?

I've also tested it on my large-scale work project with 700KB+ worth of source code. It work perfectly and even helped me discover some places in my code where I had gotten it wrong.

Copy link

fabiosantoscode left a comment

This looks great, just the note on documentation needs changes.

Show resolved Hide resolved Outdated

This comment has been minimized.

Copy link

fabiosantoscode commented Mar 16, 2019

I don't use mangle props personally but I can see how these changes make it better. Thank you

@fabiosantoscode fabiosantoscode merged commit cc00e78 into terser-js:master Mar 16, 2019

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed

@syranide syranide deleted the syranide:kqstrict branch Mar 17, 2019


This comment has been minimized.

Copy link
Contributor Author

syranide commented Mar 17, 2019

Thank you! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.