mrclay/jsmin-php

Minified JS broken with private class identifiers

Closed this issue · 4 comments

I report this here once more after posting it on autoptimize.

When a class contains private attributes or methods, the necessary line break or semicolon is not inserted.
As a minimum non-working example, the following class in valid JavaScript syntax does not work:

class TestClass {
    #a = 3
    #b = 5
    #fnc1() {
        do_something()
    }
    #fnc(2) {
        do_anything()
    }
}

It is minified to:

class TestClass{#a=3#b=5#fnc1(){do_something()}#fnc(2){do_anything()}}

which contains several syntax errors: There should be line breaks or semicolons between all the attributes and methods.

Assumption: The hash sign is treated the same way like an operator, and lines beginning with an operator can be appended to the preceding line.

I added a test case.

forgot to check PR uses issue close patterns

closing manually

thanks. released as 2.4.3