UglifyJS
UglifyJS copied to clipboard
prefix for mangle property names
It could be very useful to set profix of mangle names. It could permit to restrict access (at runtime) to "private" properties/methods on proxified objects.
Sorry for the double post...
I have previously done an error (no default value for prefix in mangle_properties)
Previous post #1472
~~Could you please close #1472 if this PR replaces it?~~
To consider this PR we would need bin/uglifyjs and minify() tests in test/mocha/, as well as tests in test/compress/.
Could you please remove the [Harmony] prefix in the title if you intend this to be merged to the branch master?
Also would need documentation in README.md
Could you please change the bin/uglifyjs flag name to mangle-props-prefix?
@dabretin I apologize for not raising this issue earlier - I'm afraid I don't understand the use case of this PR:
https://github.com/mishoo/UglifyJS2/pull/1472#issuecomment-278281444
Why would anyone want to add a prefix to the mangled property name? That just wastes space in the minified output.
It can enable to restrict access at runtime to properties. After mangle, it's not possible to detect the "private" orientation of a property. The only possibility seems to be a prefix of the obfuscated properties...
Need a command line test in test/mocha/ to test the new bin/uglifyjs flag. See test/mocha/cli.js for an example.
This PR will not be approved without a command line test for bin/uglifyjs.
example: https://github.com/mishoo/UglifyJS2/blob/1eaa211e0932105439d98d4f03a981f157f0a77c/test/mocha/cli.js#L93-L102
This PR appears to be low risk and now has sufficient tests and documentation.
Please squash into a single commit and assign an appropriate commit comment.
Thanks.
I'm not confortable with git so sorry in advance for my (probably stupid) questions... Is the last comment for me ? If it is...how can I do that ?
@dabretin hope these help: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html https://help.github.com/articles/about-git-rebase/
I think it's done :)
If this PR gets in I think it could very well be the last new mangle option. They are getting harder to support and test with each new addition and combination.