fkling / astexplorer

A web tool to explore the ASTs generated by various parsers.
https://astexplorer.net/
MIT License
6.04k stars 711 forks source link

[Feature request] add a tab with the generated Babel code #678

Open budarin opened 1 year ago

budarin commented 1 year ago

Often we either need to see how the Babel code is generated for some code, or there is a need to quickly get the generated Babel code for a specific code, but it takes a very long and tedious time to write it with your hands

It would be just great if there was a tab next to the Tree and JSON - "Code", which would display the generated Babel code for the example on the left side

Every plugin developer would be very grateful to you for this - it would be a huge help in writing plugins even for beginners

fkling commented 1 year ago

What exactly do you mean with "babel code"? How one one use @babel/types to generate the same AST/code structure? Or something else?

I'm currently working on an update to astexplorer and this would allow parsers to return multiple "artifacts", not just an AST. That would allow e.g. the babel parser to return an additional file.

budarin commented 1 year ago

Yes, I would like to see code based on @babel/types that constructs this code in js