1.0.1 • Published 6 years ago

babel-ast-converter v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

npm version Travis

Babel AST converter

Converts between Babel 6 and 7 ASTs

Usage

Parser options

Set the parserOpts tokens to true for Babel 7, as this has become optional in Babel 7

Example:

let options = {
  parserOpts: {
    filename: 'index.js',
    tokens: true
  }
}

Using Babel AST converter

This library exports a function that takes in 2 arguments, the ast and the babelVersion of the AST.

The function will convert the AST to the other version, so 6 => 7 and 7 => 6.

babelConvert(babel6AST, 6) => Babel 7 AST

babelConvert(babel7AST, 7) => Babel 6 AST

This is necessary due to Babel not really keeping a version number in their AST.

1.0.1

6 years ago

1.0.0

6 years ago