Socket
Book a DemoInstallSign in
Socket

jstransformer-babel

Package Overview
Dependencies
Maintainers
5
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jstransformer-babel

Babel support for JS Transformers.

latest
Source
npmnpm
Version
2.1.0
Version published
Maintainers
5
Created
Source

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

Keywords

jstransformer

FAQs

Package last updated on 13 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts