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

[Harmony] - prefix for mangle property names #1472

Closed
wants to merge 3 commits into from

Conversation

dabretin
Copy link

@dabretin dabretin commented Feb 8, 2017

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.

@avdg
Copy link
Contributor

avdg commented Feb 8, 2017 via email

@dabretin
Copy link
Author

dabretin commented Feb 8, 2017

Example:

class Test
{
	__privateMethod()
	{
		console.log("This is private");
	}
	publicMethod()
	{
		console.log("This is public");
	}
}

Uglify with mangle-regex="/^--/" and mangle-prefix="__" will result this:

class Test{__a(){console.log("This is private")}publicMethod(){console.log("This is public")}}

Now for remote access (RPC in my case) it will be soo easy to restrict access on public methods (wich not starts with "__").

@avdg
Copy link
Contributor

avdg commented Feb 8, 2017

@dabretin
Copy link
Author

dabretin commented Feb 8, 2017

Ah...ok :)
Sorry I'm not very confortable with git

@kzc
Copy link
Contributor

kzc commented Feb 8, 2017

This PR would break minify().

Need CLI and minify() tests in test/mocha/cli.js, as well as tests in test/compress/.

@dabretin
Copy link
Author

dabretin commented Feb 8, 2017

Close for #1475

@dabretin dabretin closed this Feb 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants