github fkling/astexplorer v1.0.0
on GitHub

I thought it might make sense to tag releases to keep better track of new features.

Parsers

  • babylon v6 and babel v6 can now be selected, in addition to babylon v5 and babel v5

UI/UX improvements

  • The last opened / toggled node is now accessible in the console via the global variable $node. This makes it easier to inspect and play with an AST node.
  • AST node methods are now rendered in the tree. Clicking such a method invokes it and the function will be replaced with the value it returns. Of course this may not always work without errors (e.g. if the method expects arguments). In that case you can use $node in the console and run the method there.
    Methods can be hidden via the “Hide functions” checkbox

Other

  • Parsers have been given more control over how to render an AST node. Parsers don’t have to return a nested plain object structure anymore. Instead, when a node ist rendered, the forEachPropertyof the parser is called, via which the parser can tell the rendered which keys and values to render for the given node. This also allows the parser to add custom properties without having to traverse the whole AST upfront.
  • The tree renderer now keeps track of which AST nodes have been rendered / opened. This allows it to detect recursive structures in which case it won’t try to open nested, recursive nodes.

Overall these changes should make it easier to add new parsers, even if the structure of the resulting AST isn’t well known.

4 years ago