fkling / astexplorer

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

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

Open budarin opened 2 years ago

budarin commented 2 years 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 2 years 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 2 years ago

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