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

[PiranhaJS] Proposals for Enhancing PiranhaJS: Tree Sitter Integration, Support for Stage 2 Proposals, and Class Variable Cleanup #650

Open
vivek-freshworks opened this issue Mar 1, 2024 · 2 comments

Comments

@vivek-freshworks
Copy link

vivek-freshworks commented Mar 1, 2024

Feature request:

  1. Currently, PiranhaJS relies on the Esprima parser, which lacks support for stage 2 proposals. How can I handle decorators in my project using PiranhaJS? Can I contribute a pull request to replace Esprima with Babel parser to address this?

  2. I've noticed that class variables are not being cleaned up at all in PiranhaJS. For instance, in the provided input and expected output example, class variables was are retained. How can we ensure proper cleanup of class variables in PiranhaJS?

Input:

class Abc {
  get myFlag() {
    return isFlagTreated(featureFlag);
  }

  method() {
    return window.myVar && this.myFlag;
  }
}

Expected Output:

class Abc {
  method() {
    return window.myVar;
  }
}

Doubt: Why hasn't Javascript transitioned from legacy to Tree Sitter? Are there specific reasons for this?

@anag004 @s7rthak @mkr-plse

@ketkarameya
Copy link
Collaborator

ketkarameya commented Mar 1, 2024

Thank you for reaching out. There is no technical reason for not instantiating a js variant of polyglot piranha. It could be done. Its just that dynamic languages are tricky and require some thorough thinking. During my stint at uber, unfortunately I didnt have the bandwidth to migrate this.
@dvmarcilio do we want to continue advancing the legacy implementation ? Let me know based on your priorities.

@dvmarcilio
Copy link
Collaborator

We are not supporting the legacy implementation, this includes reviewing issues and future pull requests.

+1 for adding JavaScript in Polyglot Piranha. JS isn't in our immediate plans though. PRs are very welcome!

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

No branches or pull requests

3 participants