Skip to content

kassens/esprima_ast_explorer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A JavaScript AST explorer

Paste JavaScript code into the editor and inspect the generated AST.

The JS AST explorer uses esprima (or Babel) to parse the code, so it not only supports current JS (ES5), but also

Since future syntax is supported, the JS AST explorer is a useful tool for developers who want to create AST transforms, e.g. with recast.

Features

  • Save and fork code snippets. Copy the URL to share them.
  • Copying an AST or dropping a file containing an AST into the window will parse the AST and update the code using escodegen.
  • Otherwise, the content of texteditor will be replaced with the content of the file (i.e. you can drag and drop JS files).
  • Toggle between esprima or Babel as parsers.
  • Toggle Transform mode with jscodeshift.
  • shift+click on a node expands the full subtree.
  • Hovering over a node highlights the corresponding text in the source code: source highlight
  • Editing the source or moving the cursor around will automatically highlight the corresponding AST node (or its ancestors of it isn't expanded): source highlight

Contributions

I'm happy about any feedback, feature request or PR to make this tool as useful as possible!

Build your own version

Install all dependencies with npm install.

Run npm run build for the final minimized version.

Run npm start to start a simple static webserver.

About

A web tool to explore the AST generated by esprima harmony.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 72.2%
  • CSS 25.6%
  • HTML 2.2%