2.1.0 • Published 10 years ago

jstransformer-babel v2.1.0

Weekly downloads
401
License
MIT
Repository
github
Last release
10 years ago

jstransformer-babel

Babel support for JSTransformers.

Build Status Coverage Status Dependency Status NPM version

Installation

npm install jstransformer-babel

API

var babel = require('jstransformer')(require('jstransformer-babel'))

var src = 'let a = 0'
var transformed = babel.render(src, {presets: ['es2015']})
//=> '"use strict";\n\nvar a = 0;'

Only render method is implemented, which means that through the JSTransformer architecture all render* APIs are available.

Passing options to Babel is supported as well, and all options unsupported by Babel are filtered out before passing them to Babel.

In babel@6 (jstransformer-babel@2), the default of transpiling from ES2015 is removed. As a result, in order to transpile from ES2015 just like in jstransformer-babel@2, pass in ['es2015'] as the value of the presets option, just like in the example above. If that is too laborious, you can look into using a .babelrc file.

Babel configuration files like .babelrc are also supported. They can only be detected if you use the renderFile* APIs or manually pass in a filename option.

License

MIT

2.1.0

10 years ago

2.0.0

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.2.0

11 years ago

0.0.3

11 years ago

0.0.1

11 years ago