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

[Feature] Consider/ Requesting Access to read-only AST of Javascript Parser #50949

Closed
ganeshkbhat opened this issue Nov 28, 2023 · 5 comments
Closed
Labels
feature request Issues that request new features to be added to Node.js. wrong repo Issues that should be opened in another repository.

Comments

@ganeshkbhat
Copy link

ganeshkbhat commented Nov 28, 2023

What is the problem this feature will solve?

Has the Access AST of the javascript module proposal been accepted into tc9 and node.js? Can someone take lead and help raise an proposal for this?

Can you make the AST available as read-only to developers in browsers [rethink security concerns] and js server environments if not on browers? Seems like the mozilla docs Parser_API documentation is somehow removed and I am still wondering how to access the file's parsed, even if read-only, AST

  1. Access AST: Proposal status: Access AST of the javascript module #45158
  2. Use Cases of AST like JS Parsers: access the import cache imported packages cache like require.cache #45207
  3. https://stackoverflow.com/questions/16127985/what-is-javascript-ast-how-to-play-with-it

I wish to strongly vote for it, if this is in consideration. I recommend the access using a separate nodejs module api, if requested for my view. pls consider security and runtime risks based on your immense experience with such an nodejs module api access without a commandline's force access ast option enabled or other secure alternatives.

What is the feature you are proposing to solve the problem?

Access AST of the javascript module in runtime engines if not on browsers.

What alternatives have you considered?

  1. Using a bundler parser like ESTree, Typescript, and Babel. https://stackoverflow.com/questions/16127985/what-is-javascript-ast-how-to-play-with-it
  2. Use Cases of AST like JS Parsers: access the import cache imported packages cache like require.cache #45207
  3. One of many JS Parsers [Use Cases]: Upgrade to latest version of ECMAScript 2021/ 2022 dop251/goja#498
  4. JS Parsers in the market [Use Cases]: https://github.com/fkling/astexplorer
  5. https://stackoverflow.com/questions/16127985/what-is-javascript-ast-how-to-play-with-it
@ganeshkbhat ganeshkbhat added the feature request Issues that request new features to be added to Node.js. label Nov 28, 2023
@ganeshkbhat
Copy link
Author

+1 Adding to v8/v8.dev#717

@ganeshkbhat
Copy link
Author

+1 Adding to #45158

@aduh95
Copy link
Contributor

aduh95 commented Nov 28, 2023

Node.js does not have access to any AST; you could open that feature request on the V8 bug tracker (v8/v8.dev#717 is for https://v8.dev, not the JS engine), but my guess is they won't be interested (because otherwise they would have done it already).

@aduh95 aduh95 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 28, 2023
@aduh95 aduh95 added the wrong repo Issues that should be opened in another repository. label Nov 28, 2023
@aduh95
Copy link
Contributor

aduh95 commented Nov 28, 2023

Has the Access AST of the javascript module proposal been accepted into tc9

FWIW I'm not aware of any TC39 proposal to expose the AST.

Can someone take lead and help raise an proposal for this?

I appreciate that it can be hard to find the right person to tak to, however I don't think opening issues on random repos will get you what you want – because it shows you don't understand (or you don't care) what are the existing processes and how your request fits into it.
Maybe you could try to hire someone to take the lead, as it seems unlikely someone would volunteer to do that work you don't / can't do yourself – but also keep in mind that there's a reason folks have build standalone JS parsers, maybe because you're more likely to succeed building your own parser than have V8 export theirs.

@ganeshkbhat
Copy link
Author

ganeshkbhat commented Dec 31, 2023

@aduh95 Can someone help me reopen this for a read only ast feature in nodejs? I recommended a sugar access of readonly AST for the server environment only. hope someone considered it to reopen this. let me raise an v8 request for sure but a realtime AST across in v8 and every browser associated can be __**. Happy new year in advance.

Web capture_31-12-2023_205321_www google com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. wrong repo Issues that should be opened in another repository.
Projects
Status: Pending Triage
Development

No branches or pull requests

2 participants