babel-preset-env
Advanced tools
Comparing version 1.6.0 to 1.6.1
# Changelog | ||
## v1.6.1 (2017-10-17) | ||
### :bug: Bug Fix | ||
- Update compat table to fix two small issues ([#445](https://github.com/babel/babel-preset-env/pull/445)) (@danez) | ||
ES6 destructuring is not fully supported in Edge 15 and the polyfill required again. `es6.math.imul` is supported on Android as of version 4.4 | ||
- Add polyfills for ES6 static Object methods ([#441](https://github.com/babel/babel-preset-env/pull/441)) (@danez) | ||
Functions such as `Object.keys`, `Object.freeze`, ...do already exist in ES5, but their behaviour changed in ES6. `babel-preset-env` with `builtIns: true` now adds the core-js polyfills for this methods if the browser only supports the ES5 variant of the version (like IE11 for example) | ||
- Normalize module format of plugins/built-ins data ([#376](https://github.com/babel/babel-preset-env/pull/376)) (@rtsao) | ||
## v1.6.0 (2017-07-04) | ||
@@ -104,6 +118,6 @@ | ||
The `include` and `exclude` options now allow both prefixed (`babel-plugin-transform-es2015-spread`) | ||
The `include` and `exclude` options now allow both prefixed (`babel-plugin-transform-es2015-spread`) | ||
and prefix-less (`transform-es2015-spread`) plugin names. | ||
### :memo: Documentation | ||
### :memo: Documentation | ||
@@ -133,3 +147,3 @@ - Note babel plugin prefix handling in include/exclude ([#245](https://github.com/babel/babel-preset-env/pull/245)) (@existentialism) | ||
We now properly check for `Symbol.species` support in ArrayBuffer and include the | ||
polyfill if necessary. This should, as a side effect, fix ArrayBuffer-related | ||
polyfill if necessary. This should, as a side effect, fix ArrayBuffer-related | ||
errors on IE9. | ||
@@ -141,3 +155,3 @@ | ||
We've simplified things by adding `electron` as a target instead of doing a bunch of | ||
We've simplified things by adding `electron` as a target instead of doing a bunch of | ||
things at runtime. Electron targets should now also be displayed in the debug output. | ||
@@ -150,3 +164,3 @@ | ||
### :memo: Documentation | ||
### :memo: Documentation | ||
@@ -165,4 +179,4 @@ * remove deprecated projects ([#223](https://github.com/babel/babel-preset-env/pull/223)) [skip ci] (@stevemao) | ||
When parsing plugin data, we weren't properly handling browser families. This caused | ||
`transform-es2015-block-scoping` and other plugins to be incorrectly added for Edge >= 12. | ||
When parsing plugin data, we weren't properly handling browser families. This caused | ||
`transform-es2015-block-scoping` and other plugins to be incorrectly added for Edge >= 12. | ||
(s/o to @mgol for the the report and review!) | ||
@@ -267,3 +281,3 @@ | ||
"firefox": 52, | ||
"node": 7.4 | ||
"node": 7.4 | ||
} | ||
@@ -314,3 +328,3 @@ ``` | ||
- Update compat-table, build data ([#135](https://github.com/babel/babel-preset-env/pull/135)) (@hzoo) | ||
## v1.1.8 (2017-01-10) | ||
@@ -330,3 +344,3 @@ | ||
## v1.1.7 (2017-01-09) | ||
Had a publishing issue in the previous release. | ||
@@ -505,3 +519,3 @@ | ||
import "babel-polyfill"; // create an entry js file that contains this | ||
// or | ||
// or | ||
import "core-js"; | ||
@@ -508,0 +522,0 @@ ``` |
@@ -103,2 +103,14 @@ // https://github.com/zloirock/core-js | ||
"es6.object.freeze": "Object static methods accept primitives / Object.freeze", | ||
"es6.object.seal": "Object static methods accept primitives / Object.seal", | ||
"es6.object.prevent-extensions": "Object static methods accept primitives / Object.preventExtensions", | ||
"es6.object.is-frozen": "Object static methods accept primitives / Object.isFrozen", | ||
"es6.object.is-sealed": "Object static methods accept primitives / Object.isSealed", | ||
"es6.object.is-extensible": "Object static methods accept primitives / Object.isExtensible", | ||
"es6.object.get-own-property-descriptor": | ||
"Object static methods accept primitives / Object.getOwnPropertyDescriptor", | ||
"es6.object.get-prototype-of": "Object static methods accept primitives / Object.getPrototypeOf", | ||
"es6.object.keys": "Object static methods accept primitives / Object.keys", | ||
"es6.object.get-own-property-names": "Object static methods accept primitives / Object.getOwnPropertyNames", | ||
"es6.object.assign": "Object static methods / Object.assign", | ||
@@ -105,0 +117,0 @@ "es6.object.is": "Object static methods / Object.is", |
@@ -303,2 +303,102 @@ { | ||
}, | ||
"es6.object.freeze": { | ||
"chrome": "44", | ||
"edge": "12", | ||
"firefox": "35", | ||
"safari": "9", | ||
"node": "4", | ||
"ios": "9", | ||
"opera": "31", | ||
"electron": "0.31" | ||
}, | ||
"es6.object.seal": { | ||
"chrome": "44", | ||
"edge": "12", | ||
"firefox": "35", | ||
"safari": "9", | ||
"node": "4", | ||
"ios": "9", | ||
"opera": "31", | ||
"electron": "0.31" | ||
}, | ||
"es6.object.prevent-extensions": { | ||
"chrome": "44", | ||
"edge": "12", | ||
"firefox": "35", | ||
"safari": "9", | ||
"node": "4", | ||
"ios": "9", | ||
"opera": "31", | ||
"electron": "0.31" | ||
}, | ||
"es6.object.is-frozen": { | ||
"chrome": "44", | ||
"edge": "12", | ||
"firefox": "35", | ||
"safari": "9", | ||
"node": "4", | ||
"ios": "9", | ||
"opera": "31", | ||
"electron": "0.31" | ||
}, | ||
"es6.object.is-sealed": { | ||
"chrome": "44", | ||
"edge": "12", | ||
"firefox": "35", | ||
"safari": "9", | ||
"node": "4", | ||
"ios": "9", | ||
"opera": "31", | ||
"electron": "0.31" | ||
}, | ||
"es6.object.is-extensible": { | ||
"chrome": "44", | ||
"edge": "12", | ||
"firefox": "35", | ||
"safari": "9", | ||
"node": "4", | ||
"ios": "9", | ||
"opera": "31", | ||
"electron": "0.31" | ||
}, | ||
"es6.object.get-own-property-descriptor": { | ||
"chrome": "44", | ||
"edge": "12", | ||
"firefox": "35", | ||
"safari": "9", | ||
"node": "4", | ||
"ios": "9", | ||
"opera": "31", | ||
"electron": "0.31" | ||
}, | ||
"es6.object.get-prototype-of": { | ||
"chrome": "44", | ||
"edge": "12", | ||
"firefox": "3.5", | ||
"safari": "9", | ||
"node": "4", | ||
"ios": "9", | ||
"opera": "31", | ||
"electron": "0.31" | ||
}, | ||
"es6.object.keys": { | ||
"chrome": "40", | ||
"edge": "12", | ||
"firefox": "35", | ||
"safari": "9", | ||
"node": "4", | ||
"ios": "9", | ||
"opera": "27", | ||
"electron": "0.21" | ||
}, | ||
"es6.object.get-own-property-names": { | ||
"chrome": "40", | ||
"edge": "12", | ||
"firefox": "33", | ||
"safari": "9", | ||
"node": "4", | ||
"ios": "9", | ||
"opera": "27", | ||
"electron": "0.21" | ||
}, | ||
"es6.object.assign": { | ||
@@ -695,2 +795,3 @@ "chrome": "45", | ||
"node": "0.12", | ||
"android": "4.4", | ||
"ios": "7", | ||
@@ -697,0 +798,0 @@ "opera": "17", |
@@ -1,3 +0,2 @@ | ||
module.exports = { | ||
// es2015 | ||
const es2015 = { | ||
"check-es2015-constants": { | ||
@@ -110,5 +109,6 @@ features: [ | ||
], | ||
}, | ||
} | ||
}; | ||
// es2016 | ||
const es2016 = { | ||
"transform-exponentiation-operator": { | ||
@@ -118,5 +118,6 @@ features: [ | ||
], | ||
}, | ||
} | ||
}; | ||
// es2017 | ||
const es2017 = { | ||
"transform-async-to-generator": { | ||
@@ -133,1 +134,3 @@ features: [ | ||
}; | ||
module.exports = Object.assign({}, es2015, es2016, es2017); |
@@ -65,3 +65,2 @@ { | ||
"chrome": "51", | ||
"edge": "15", | ||
"firefox": "53", | ||
@@ -68,0 +67,0 @@ "safari": "10", |
@@ -21,9 +21,9 @@ "use strict"; | ||
var _pluginFeatures = require("../data/plugin-features"); | ||
var _plugins = require("../data/plugins.json"); | ||
var _pluginFeatures2 = _interopRequireDefault(_pluginFeatures); | ||
var _plugins2 = _interopRequireDefault(_plugins); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var validIncludesAndExcludes = [].concat(Object.keys(_pluginFeatures2.default), Object.keys(_moduleTransformations2.default).map(function (m) { | ||
var validIncludesAndExcludes = [].concat(Object.keys(_plugins2.default), Object.keys(_moduleTransformations2.default).map(function (m) { | ||
return _moduleTransformations2.default[m]; | ||
@@ -30,0 +30,0 @@ }), Object.keys(_builtIns2.default), _defaultIncludes.defaultWebIncludes); |
{ | ||
"name": "babel-preset-env", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"description": "A Babel preset for each environment.", | ||
@@ -66,3 +66,3 @@ "author": "Henry Zhu <hi@henryzoo.com>", | ||
"codecov": "^1.0.1", | ||
"compat-table": "kangax/compat-table#d88c80ea6dcbc7064112eb46bb020718107892f7", | ||
"compat-table": "kangax/compat-table#957f1ff15972e8fb2892a172f985e9af27bf1c75", | ||
"eslint": "^3.17.1", | ||
@@ -69,0 +69,0 @@ "eslint-config-babel": "^6.0.0", |
# babel-preset-env [![npm](https://img.shields.io/npm/v/babel-preset-env.svg)](https://www.npmjs.com/package/babel-preset-env) [![travis](https://img.shields.io/travis/babel/babel-preset-env/master.svg)](https://travis-ci.org/babel/babel-preset-env) [![npm-downloads](https://img.shields.io/npm/dm/babel-preset-env.svg)](https://www.npmjs.com/package/babel-preset-env) [![codecov](https://img.shields.io/codecov/c/github/babel/babel-preset-env/master.svg?maxAge=43200)](https://codecov.io/github/babel/babel-preset-env) | ||
> A Babel preset that can automatically determine the Babel plugins and polyfills you need based on your supported environments. | ||
> A Babel preset that compiles [ES2015+](https://github.com/tc39/proposals/blob/master/finished-proposals.md) down to ES5 by automatically determining the Babel plugins and polyfills you need based on your targeted browser or runtime environments. | ||
@@ -9,4 +9,16 @@ ```sh | ||
Without any configuration options, babel-preset-env behaves exactly the same as babel-preset-latest (or babel-preset-es2015, babel-preset-es2016, and babel-preset-es2017 together). | ||
```json | ||
{ | ||
"presets": ["env"] | ||
} | ||
``` | ||
You can also configure it to only include the polyfills and transforms needed for the browsers you support. Compiling only what's needed can make your bundles smaller and your life easier. | ||
This example only includes the polyfills and code transforms needed for the last two versions of each browser, and versions of Safari greater than or equal to 7. We use [browserslist](https://github.com/ai/browserslist) to parse this information, so you can use [any valid query format supported by browserslist](https://github.com/ai/browserslist#queries). | ||
```json | ||
{ | ||
"presets": [ | ||
@@ -22,2 +34,30 @@ ["env", { | ||
Similarly, if you're targeting Node.js instead of the browser, you can configure babel-preset-env to only include the polyfills and transforms necessary for a particular version: | ||
```json | ||
{ | ||
"presets": [ | ||
["env", { | ||
"targets": { | ||
"node": "6.10" | ||
} | ||
}] | ||
] | ||
} | ||
``` | ||
For convenience, you can use `"node": "current"` to only include the necessary polyfills and transforms for the Node.js version that you use to run Babel: | ||
```json | ||
{ | ||
"presets": [ | ||
["env", { | ||
"targets": { | ||
"node": "current" | ||
} | ||
}] | ||
] | ||
} | ||
``` | ||
Check out the many options (especially `useBuiltIns` to polyfill less)! | ||
@@ -55,3 +95,3 @@ | ||
It won't include `stage-x` plugins. env will support all plugins in what we consider the latest version of Javascript (by matching what we do in [`babel-preset-latest`](http://babeljs.io/docs/plugins/preset-latest/)). | ||
It won't include `stage-x` plugins. env will support all plugins in what we consider the latest version of JavaScript (by matching what we do in [`babel-preset-latest`](http://babeljs.io/docs/plugins/preset-latest/)). | ||
@@ -66,3 +106,3 @@ Ref: [#14](https://github.com/babel/babel-preset-env/issues/14) | ||
For example, if you are building on Node 4, arrow functions won't be converted, but they will if you build on Node 0.12. | ||
For example, if you are building on Node 6, arrow functions won't be converted, but they will if you build on Node 0.12. | ||
@@ -119,3 +159,3 @@ ### Support a `browsers` option like autoprefixer | ||
If you want to compile against the current node version, you can specify `"node": true` or `"node": "current"`, which would be the same as `"node": parseFloat(process.versions.node)`. | ||
If you want to compile against the current node version, you can specify `"node": true` or `"node": "current"`, which would be the same as `"node": process.versions.node`. | ||
@@ -138,3 +178,3 @@ ### `targets.browsers` | ||
> Uglify has support for ES2015 syntax via [uglify-es](https://github.com/mishoo/UglifyJS2/tree/harmony). If you are using syntax unsupported by `uglify-es`, we recommend using [Babili](https://github.com/babel/babili). | ||
> Uglify has support for ES2015 syntax via [uglify-es](https://github.com/mishoo/UglifyJS2/tree/harmony). If you are using syntax unsupported by `uglify-es`, we recommend using [babel-minify](https://github.com/babel/minify). | ||
@@ -141,0 +181,0 @@ > Note: This option is deprecated in 2.x and replaced with a [`forceAllTransforms` option](https://github.com/babel/babel-preset-env/pull/264). |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
155656
25
1940
447
1