tdewolff / minify

Go minifiers for web formats
https://go.tacodewolff.nl/minify
MIT License
3.68k stars 216 forks source link

Minify private methods and private properties of JS classes #652

Open AnatoliyDanchuk opened 8 months ago

AnatoliyDanchuk commented 8 months ago

Actual: Private methods and private properties of JS classes are not minified. Expected: Private methods and private properties of JS classes are minified.

Example:

class AnyClassName {
        #anyPrivateProperty = 1;
        #anyPrivateMethod() {}
}
tdewolff commented 8 months ago

It seems to work on my part: https://go.tacodewolff.nl/minify?q=b21pbWU9dGV4dCUyRmphdmFzY3JpcHQmanMtcHJlY2lzaW9uPTAmanMtdmVyc2lvbj0wJnNyYz1jbGFzcytBbnlDbGFzc05hbWUrJTdCJTBEJTBBKysrKysrKyslMjNhbnlQcml2YXRlUHJvcGVydHkrJTNEKzElM0IlMEQlMEErKysrKysrKyUyM2FueVByaXZhdGVNZXRob2QoKSslN0IlN0QlMEQlMEElN0Q=

What version are you using?

AnatoliyDanchuk commented 8 months ago

I have checked your link. And your link confirms names of private properties/methods are not minimized. I expect that names will be minimized to single char, because private properties and methods have only local scope like const|let, thus minimizer may safety minimize their names. I used versions: v2.20.10, v2.20.9.

tdewolff commented 8 months ago

Ah now I understand, you mean that the names themselves are not minified, even though the syntax of private properties and methods are minified. I will look into this, great idea!