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

sequence as class property breaks everything #638

Closed
dilame opened this issue Jun 22, 2020 · 8 comments · Fixed by estools/escodegen#415 or #639
Closed

sequence as class property breaks everything #638

dilame opened this issue Jun 22, 2020 · 8 comments · Fixed by estools/escodegen#415 or #639

Comments

@dilame
Copy link

dilame commented Jun 22, 2020

Valid JS code

class Foo {
  [(1, Symbol.asyncIterator)]() {}
}

obfuscated as

class Foo {
    [0x1, Symbol['asyncIterator']]() {
    }
}

invalid js code. The bug exists in the latest 0.x.x and latest 1.x.x versions.

It's very important bug, TypeScript generates such code, i can't even fix it.

@sanex3339 sanex3339 added the bug label Jun 22, 2020
@sanex3339
Copy link
Member

sanex3339 commented Jun 22, 2020

Problem in escodegen again =(
Will try to create the PR there.

@sanex3339
Copy link
Member

sanex3339 commented Jun 22, 2020

The PR estools/escodegen#415

@sanex3339
Copy link
Member

The PR here:
#639

@sanex3339
Copy link
Member

will release 1.1.1 in an hour.

@sanex3339
Copy link
Member

New 1.1.1 version with the fix has been released

@dilame
Copy link
Author

dilame commented Jun 23, 2020

Wow, thank you!
Let me use the ability and ask you something - do you plan to support ESNext? I want to use ES private fields and nullish coalescing.
Is there any way to tell the obfuscator to ignore parts it can not parse?

@sanex3339
Copy link
Member

sanex3339 commented Jun 23, 2020

Hi. Obfuscator supports only stage4 features that are implemented both in acorn, estraverse, and escodegen.
The last two packages are the bottleneck. Currently, I created the PRs with optional chaining support:
estools/escodegen#412
estools/estraverse#113

But one week has passed since then and still no activity there.

You can go there and let the maintainer know that these PRs are important for you.

So until the support of each feature, the best way is to use babel BEFORE obfuscator to transpile unsupported features.

@sanex3339
Copy link
Member

sanex3339 commented Jun 23, 2020

Obfuscator has been updated on 1.1.1 everywhere.
You can test it here: https://obfuscator.io/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment