Skip to content

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.

3 participants