An open API service indexing awesome lists of open source software.

https://github.com/binded/babel-preset-eslatest-node6

Babel preset to make Node v6 fully compatible with the latest ECMAScript specification.
https://github.com/binded/babel-preset-eslatest-node6

Last synced: about 1 year ago
JSON representation

Babel preset to make Node v6 fully compatible with the latest ECMAScript specification.

Awesome Lists containing this project

README

          

# babel-preset-eslatest-node6

[![Build Status](https://travis-ci.org/blockai/babel-preset-eslatest-node6.svg?branch=master)](https://travis-ci.org/blockai/babel-preset-eslatest-node6)

Babel preset to make Node v6 fully compatible with the [latest
ECMAScript specification](https://tc39.github.io/ecma262/). This
includes all [finished proposals](https://github.com/tc39/proposals/blob/master/finished-proposals.md) but not stage 0 to 3 proposals.

It intentionally won't compile things that are already natively
supported by Node v6.

**Included plugins**

- ES2015
- modules ([transform-es2015-modules-commonjs](http://babeljs.io/docs/plugins/transform-es2015-modules-commonjs))
- ES2016
- exponentiation operator ([transform-exponentiation-operator](http://babeljs.io/docs/plugins/transform-exponentiation-operator))
- ES2017
- trailing function commas ([syntax-trailing-function-commas](http://babeljs.io/docs/plugins/syntax-trailing-function-commas))
- async / await ([transform-async-to-generator](http://babeljs.io/docs/plugins/transform-async-to-generator))

**Missing features**

For [Object.values/Object.entries](https://github.com/tc39/proposal-object-values-entries), [String padding](https://github.com/tc39/proposal-string-pad-start-end) or [Object.getOwnPropertyDescriptors](https://github.com/tc39/proposal-object-getownpropertydescriptors) support, use [babel-polyfill](https://babeljs.io/docs/usage/polyfill/) or [transform-runtime](https://babeljs.io/docs/plugins/transform-runtime/).

## Install

```bash
npm install --save-dev babel-preset-eslatest-node6
```

## Usage

### Via `.babelrc` (recommended)

**.babelrc**

```json
{
"presets": ["eslatest-node6"]
}
```

**Note**: if you are using [object rest/spread](https://babeljs.io/docs/plugins/transform-object-rest-spread/), you will need to add a few additional plugins to make it work:

```sh
npm install --save-dev \
babel-plugin-transform-es2015-destructuring \
babel-plugin-transform-es2015-parameters \
babel-plugin-transform-object-rest-spread
```

```json
{
"presets": ["eslatest-node6"],
"plugins": [
"transform-es2015-destructuring",
"transform-es2015-parameters",
["transform-object-rest-spread", { "useBuiltIns": true }]
]
}
```

### Via CLI

```js
babel script.js --presets eslatest-node6
```

### Via Node API

```js
require('babel-core').transform('code', {
presets: ['eslatest-node6'],
})
```

### Options

* `loose` - Enable "[loose](http://www.2ality.com/2015/12/babel6-loose-mode.html)" transformations for any plugins in this preset that allow them (disabled by default).

```json
{
"presets": [
["eslatest-node6", { "loose": true }]
]
}
```

## Credits

Inspired by [babel-preset-es2015-node6](https://github.com/jhen0409/babel-preset-es2015-node6)