babel-preset-node5
Advanced tools
Comparing version 6.2.1 to 10.0.0
34
index.js
/* global module */ | ||
var presets = [ | ||
'babel-preset-react', | ||
]; | ||
var plugins = [ | ||
'babel-plugin-transform-es2015-destructuring', | ||
'babel-plugin-transform-es2015-modules-commonjs', | ||
'babel-plugin-transform-es2015-parameters', | ||
'babel-plugin-transform-es2015-sticky-regex', | ||
'babel-plugin-transform-es2015-unicode-regex', | ||
'babel-plugin-transform-strict-mode', | ||
'babel-plugin-transform-flow-strip-types', | ||
'babel-plugin-syntax-object-rest-spread', | ||
'babel-plugin-transform-object-rest-spread' | ||
]; | ||
module.exports = { | ||
presets: presets.map(function(preset) { | ||
return require(preset); | ||
}), | ||
plugins: plugins.map(function(plugin) { | ||
return require(plugin); | ||
}), | ||
plugins: [ | ||
require('babel-plugin-syntax-object-rest-spread'), | ||
require('babel-plugin-transform-es2015-destructuring'), | ||
require('babel-plugin-transform-es2015-modules-commonjs'), | ||
require('babel-plugin-transform-es2015-parameters'), | ||
require('babel-plugin-transform-es2015-sticky-regex'), | ||
require('babel-plugin-transform-es2015-unicode-regex'), | ||
require('babel-plugin-transform-strict-mode'), | ||
require('babel-plugin-transform-flow-strip-types'), | ||
require('babel-plugin-transform-object-rest-spread') | ||
] | ||
}; |
{ | ||
"name": "babel-preset-node5", | ||
"version": "6.2.1", | ||
"description": "Babel preset for Node 5.x (ES6, React, Flow)", | ||
"version": "10.0.0", | ||
"description": "Babel preset for Node 5.x (ES6 / ES2015)", | ||
"repository": "git://github.com/leebenson/babel-preset-node5.git", | ||
@@ -16,3 +16,3 @@ "main": "index.js", | ||
"es2015", | ||
"react" | ||
"es6" | ||
], | ||
@@ -31,5 +31,4 @@ "author": "Lee Benson <lee@leebenson.com>", | ||
"babel-plugin-transform-strict-mode": "^6.1.18", | ||
"babel-polyfill": "^6.1.19", | ||
"babel-preset-react": "^6.1.18" | ||
"babel-polyfill": "^6.1.19" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# Babel presets for Node 5.x | ||
# Babel 6.x presets for Node 5.x (updated regularly!) | ||
@@ -8,3 +8,3 @@ Node 5.x brings ~59% [native ES6/ES2015 coverage](https://nodejs.org/en/docs/es6/). This preset for Babel 6 attempts | ||
Babel 6.x is awesome, but simply including the [ES2015 preset](babel-preset-es2015) means you're transpiling features | ||
Babel 6.x is awesome, but simply including the [ES2015 preset](https://www.npmjs.com/package/babel-preset-es2015) means you're transpiling features | ||
that your Node 5.x installation can already do faster and natively, replacing them with inferior / old code. | ||
@@ -18,4 +18,2 @@ | ||
* Versioning that tracks [Babel releases](https://github.com/babel/babel/releases) | ||
* React / JSX support (via [babel-preset-react](https://www.npmjs.com/package/babel-preset-react)) | ||
* Flow support (removes types) via [babel-plugin-transform-flow-strip-types](https://www.npmjs.com/package/babel-plugin-transform-flow-strip-types) | ||
@@ -28,1 +26,68 @@ * Strict mode, to enable Classes and `let` (via [babel-plugin-transform-strict-mode](https://www.npmjs.com/package/babel-plugin-transform-strict-mode)) | ||
* Unicode RegEx (via [babel-plugin-transform-es2015-unicode-regex](https://www.npmjs.com/package/babel-plugin-transform-es2015-unicode-regex)) | ||
**Note: This package originally shipped with the React preset, but to avoid bloat, doesn't any longer. If you want to add that, please install [babel-preset-react](https://www.npmjs.com/package/babel-preset-react) too** | ||
## Usage instructions | ||
## Installation | ||
Install via NPM the usual way: | ||
`npm i babel-preset-node5` | ||
## Usage | ||
### Via `.babelrc` (recommended) | ||
Create a `.babelrc` file in your project root, and include 'node5' in your preset path: | ||
``` | ||
{ | ||
"presets": [ | ||
"node5" | ||
] | ||
} | ||
``` | ||
Now whenever you run `babel-node`, it will polyfill your app with the ES2015 features that Node 5 is missing. | ||
### Via CLI | ||
`$ babel script.js --presets node5` | ||
### Via Node API | ||
``` | ||
require("babel-core").transform("code", { | ||
presets: ["node5"] | ||
}); | ||
``` | ||
### Webpack, Gulp, Browserify, etc | ||
Follow vendor instructions and include `node5` in your babel "preset" list. | ||
## How to add React support | ||
Babel has a ready-made preset for React, and you now need to install it separately. | ||
Just grab it via NPM: | ||
`npm i babel-preset-react` | ||
And then add it to your "presets" list in `.babelrc`: | ||
``` | ||
{ | ||
"presets": [ | ||
"node5", | ||
"react" | ||
] | ||
} | ||
``` | ||
## No longer tracking Babel 6 versions | ||
This package originally tracked Babel 6.x versioning. The problem is, many of the plug-ins and transforms provided by Babel don't always track the the `babel-core` version, so updating one dependency can throw the versioning schema off. | ||
This package will instead now follow its own semver, starting (arbitrarily) at v10.0.0. | ||
I'm using this repo in production, so you can be assured that I'm making it a priority to update Babel 6 deps regularly and track the latest plug-in versions. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
5187
10
91
1
14
- Removedbabel-preset-react@^6.1.18
- Removedbabel-helper-builder-react-jsx@6.26.0(transitive)
- Removedbabel-plugin-syntax-jsx@6.18.0(transitive)
- Removedbabel-plugin-transform-react-display-name@6.25.0(transitive)
- Removedbabel-plugin-transform-react-jsx@6.24.1(transitive)
- Removedbabel-plugin-transform-react-jsx-self@6.22.0(transitive)
- Removedbabel-plugin-transform-react-jsx-source@6.22.0(transitive)
- Removedbabel-preset-flow@6.23.0(transitive)
- Removedbabel-preset-react@6.24.1(transitive)