Skip to content

[Harmony] - prefix for mangle property names#1472

Closed
dabretin wants to merge 3 commits into
mishoo:harmonyfrom
dabretin:harmony
Closed

[Harmony] - prefix for mangle property names#1472
dabretin wants to merge 3 commits into
mishoo:harmonyfrom
dabretin:harmony

Conversation

@dabretin

@dabretin dabretin commented Feb 8, 2017

Copy link
Copy Markdown

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

avdg commented Feb 8, 2017 via email

Copy link
Copy Markdown
Contributor

@dabretin

dabretin commented Feb 8, 2017

Copy link
Copy Markdown
Author

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

avdg commented Feb 8, 2017

Copy link
Copy Markdown
Contributor

@dabretin

dabretin commented Feb 8, 2017

Copy link
Copy Markdown
Author

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

@kzc

kzc commented Feb 8, 2017

Copy link
Copy Markdown
Contributor

This PR would break minify().

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

@dabretin

dabretin commented Feb 8, 2017

Copy link
Copy Markdown
Author

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