JSPM

traceur-mozilla-ast

0.0.7
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q30104F
  • License Apache 2.0

Convert Traceur AST to Spidermonkey AST.

Package Exports

  • traceur-mozilla-ast

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (traceur-mozilla-ast) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

traceur-mozilla-ast

Build Status

What is it?

This library will convert traceur-compiler AST into a Mozilla Spidermonkey one.

Right now, it's only converting ES5 nodes, all ES6 nodes are ignored.

Whatever for?

Tooling. Traceur boasts an excellent ES6 parser, that can also transpile code down to ES5. This library makes it easier to take the transpiled syntax tree from Traceur, and feed it through existing tools that work with Spidermonkey AST, like estraverse and escodegen.

Location information is retained in the translation from Traceur AST.

Alternatives

I opted for this approach as a somewhat academic exercise to learn more about Traceur and AST tooling like esprima.

An alternative approach could be to run esprima over Traceur generated code, and re-attach location information from the source map that Traceur also created whilst generating the code.

License

This project is licensed under Apache 2.0. Please see accompanying LICENSE file.