fkling / astexplorer

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

feat: Add support for Builder visualization #603

Open ganemone opened 3 years ago

ganemone commented 3 years ago

This adds support for a Builder tab in the visualization menu that will generate code to recreate the original ast in the code editor using calls to ast node constructors in the @babel/types library.

This can be very useful when writing codemods to quickly determine the proper usage of @babel/types library to generate ast nodes.

ganemone commented 3 years ago

Simple Example:

Screen Shot 2021-08-26 at 1 00 38 PM

Complex Example:

Screen Shot 2021-08-26 at 1 01 36 PM