Merge branch 'env'
This commit is contained in:
commit
2d6606fd5a
6
experimental/babel-preset-env/.eslintignore
Normal file
6
experimental/babel-preset-env/.eslintignore
Normal file
@ -0,0 +1,6 @@
|
||||
/lib
|
||||
debug-fixtures
|
||||
fixtures
|
||||
/data
|
||||
/flow-typed
|
||||
test/tmp
|
||||
23
experimental/babel-preset-env/.eslintrc
Normal file
23
experimental/babel-preset-env/.eslintrc
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"extends": [
|
||||
"babel",
|
||||
"plugin:flowtype/recommended"
|
||||
],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 7,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"flowtype"
|
||||
],
|
||||
"rules": {
|
||||
"arrow-parens": "off",
|
||||
"indent": "off",
|
||||
"comma-dangle": ["error", "always-multiline"],
|
||||
"curly": ["error", "multi-line"],
|
||||
"func-call-spacing": "error",
|
||||
"key-spacing": "error",
|
||||
"no-multi-spaces": "error",
|
||||
"flowtype/generic-spacing": "off"
|
||||
}
|
||||
}
|
||||
12
experimental/babel-preset-env/.flowconfig
Normal file
12
experimental/babel-preset-env/.flowconfig
Normal file
@ -0,0 +1,12 @@
|
||||
[ignore]
|
||||
.*/lib/.*
|
||||
.*/test/.*
|
||||
.*/build/.*
|
||||
.*/scripts/.*
|
||||
.*/node_modules/jest-validate/.*
|
||||
|
||||
[options]
|
||||
strip_root=true
|
||||
suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe
|
||||
suppress_comment= \\(.\\|\n\\)*\\$FlowIssue
|
||||
module.ignore_non_literal_requires=true
|
||||
24
experimental/babel-preset-env/.github/stale.yml
vendored
Normal file
24
experimental/babel-preset-env/.github/stale.yml
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# Configuration for probot-stale - https://github.com/probot/stale
|
||||
|
||||
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
||||
daysUntilStale: 60
|
||||
# Number of days of inactivity before a stale Issue or Pull Request is closed
|
||||
daysUntilClose: 7
|
||||
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
||||
exemptLabels:
|
||||
- has pr
|
||||
- pinned
|
||||
- security
|
||||
# Label to use when marking as stale
|
||||
staleLabel: stale
|
||||
# Comment to post when marking as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as `stale` because it has not had
|
||||
recent activity 😴. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions 👌!
|
||||
# Comment to post when removing the stale label. Set to `false` to disable
|
||||
unmarkComment: false
|
||||
# Comment to post when closing a stale Issue or Pull Request. Set to `false` to disable
|
||||
closeComment: false
|
||||
# Limit to only `issues` or `pulls`
|
||||
# only: issues
|
||||
10
experimental/babel-preset-env/.gitignore
vendored
Normal file
10
experimental/babel-preset-env/.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
node_modules
|
||||
coverage
|
||||
lib
|
||||
test/tmp
|
||||
.DS_Store
|
||||
*.log
|
||||
.vscode
|
||||
.nyc_output
|
||||
tmp
|
||||
babel-preset-env-*.tgz
|
||||
15
experimental/babel-preset-env/.npmignore
Normal file
15
experimental/babel-preset-env/.npmignore
Normal file
@ -0,0 +1,15 @@
|
||||
coverage
|
||||
src
|
||||
test
|
||||
lib/types.js
|
||||
node_modules
|
||||
scripts
|
||||
.eslintignore
|
||||
.travis.yml
|
||||
codecov.yml
|
||||
yarn.lock
|
||||
.nyc_output
|
||||
.vscode
|
||||
.eslintrc
|
||||
babel-preset-env-*.tgz
|
||||
flow-typed
|
||||
41
experimental/babel-preset-env/.travis.yml
Normal file
41
experimental/babel-preset-env/.travis.yml
Normal file
@ -0,0 +1,41 @@
|
||||
git:
|
||||
depth: 3
|
||||
sudo: false
|
||||
language: node_js
|
||||
cache:
|
||||
yarn: true
|
||||
directories:
|
||||
- node_modules
|
||||
node_js:
|
||||
- '8'
|
||||
- '6'
|
||||
- '4'
|
||||
env:
|
||||
global:
|
||||
- BABEL_ENV=test
|
||||
matrix:
|
||||
- PKG_CMD="npm"
|
||||
- PKG_CMD="yarn"
|
||||
before_install:
|
||||
- nvm use $TRAVIS_NODE_VERSION
|
||||
- npm set loglevel error
|
||||
- npm set progress false
|
||||
- 'if [ $PKG_CMD = "yarn" ]; then curl -o- -L https://yarnpkg.com/install.sh | bash && PATH=$HOME/.yarn/bin:$PATH ; fi'
|
||||
install:
|
||||
- $PKG_CMD install
|
||||
script:
|
||||
- 'if [ -n "${LINT-}" ]; then $PKG_CMD run lint ; fi'
|
||||
- 'if [ -n "${DATA_CHECK-}" ]; then $PKG_CMD run build-data -- --check ; fi'
|
||||
- 'if [ -n "${SMOKE_TEST-}" ]; then node scripts/smoke-test.js ; fi'
|
||||
- 'if [ -z "${LINT-}" ] && [ -z "${DATA_CHECK-}" ] && [ -z "${SMOKE_TEST-}" ]; then $PKG_CMD run test-ci ; fi'
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- node_js: "node"
|
||||
env: LINT=true PKG_CMD="npm"
|
||||
- node_js: "node"
|
||||
env: DATA_CHECK=true PKG_CMD="npm"
|
||||
- node_js: "node"
|
||||
env: SMOKE_TEST=true PKG_CMD="npm"
|
||||
|
||||
after_success: 'if [ -z "${LINT-}" ] && [ -z "${DATA_CHECK-}" ] && [ -z "${SMOKE_TEST-}" ]; then npm run coverage-ci ; fi'
|
||||
654
experimental/babel-preset-env/CHANGELOG.md
Normal file
654
experimental/babel-preset-env/CHANGELOG.md
Normal file
@ -0,0 +1,654 @@
|
||||
# Changelog
|
||||
|
||||
## v1.6.0 (2017-07-04)
|
||||
|
||||
### :rocket: New Feature
|
||||
|
||||
- Bump compat-table for node8 support ([#363](https://github.com/babel/babel-preset-env/pull/363)) (@existentialism)
|
||||
|
||||
We updated our mappings to support native trailing function commas and string paddings in Node.js 8+.
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Handle `chromeandroid` browserslist value ([#367](https://github.com/babel/babel-preset-env/pull/367)) (@yavorsky)
|
||||
|
||||
We added support for using browserslist's `chromeandroid` in `targets`.
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
- Tweak uglify option docs ([#368](https://github.com/babel/babel-preset-env/pull/368)) (@existentialism)
|
||||
|
||||
Thanks to @graingert and @pfiaux for pointing out some needed updates to the `uglify-js`-related docs.
|
||||
|
||||
## v1.5.2 (2017-06-07)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Ensure explicit targets always override browsers key targets ([#346](https://github.com/babel/babel-preset-env/pull/346)) (@existentialism)
|
||||
|
||||
`browser` targets should be overridden by explicit targets, and we inadvertently broke this when we landed string version support.
|
||||
|
||||
## v1.5.1 (2017-05-22)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Compile with loose mode ([#322](https://github.com/babel/babel-preset-env/pull/332)) (@existentialism)
|
||||
|
||||
## v1.5.0 (2017-05-19)
|
||||
|
||||
### :rocket: New Feature
|
||||
|
||||
- Support target versions as strings ([#321](https://github.com/babel/babel-preset-env/pull/321)) (@existentialism)
|
||||
|
||||
We were originally waiting on 2.x for a breaking change, but since node v7.10
|
||||
and other targets are causing some pain, we decided to land a backwards
|
||||
compatible version.
|
||||
|
||||
### :house: Internal
|
||||
|
||||
- Backport: use preset-env and remove flow-strip-types ([#324](https://github.com/babel/babel-preset-env/pull/324)) (@yavorsky)
|
||||
- Bump electron-to-chromium ([#329](https://github.com/babel/babel-preset-env/pull/329)) (@existentialism)
|
||||
- Tweak version mappings to match compat-table updates ([#323](https://github.com/babel/babel-preset-env/pull/323)) (@existentialism)
|
||||
- Bump browserslist ([#319](https://github.com/babel/babel-preset-env/pull/319)) (@existentialism)
|
||||
- Bump compat-table ([#307](https://github.com/babel/babel-preset-env/pull/307)) (@existentialism)
|
||||
- Add debug-fixtures and test/tmp to .eslintignore ([#305](https://github.com/babel/babel-preset-env/pull/305)) (@yavorsky)
|
||||
|
||||
## v1.4.0 (2017-04-14)
|
||||
|
||||
### :rocket: New Feature
|
||||
|
||||
- Support `spec` option ([#98](https://github.com/babel/babel-preset-env/pull/98)) (@Kovensky)
|
||||
|
||||
Added an option to enable more spec compliant, but potentially slower, transformations for any plugins in this preset that support them.
|
||||
|
||||
- Bump compat-table for Edge 15 support ([#273](https://github.com/babel/babel-preset-env/pull/273)) (@existentialism)
|
||||
|
||||
We updated our mappings so that you can get native support for async/await and other goodies when targeting Edge 15!
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Add Android browser to name map ([#270](https://github.com/babel/babel-preset-env/pull/270)) (@existentialism)
|
||||
|
||||
Fixed a bug that was ignoring Android targets in browserslist queries (for example: "Android >= 4").
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
- Clarify note about loading polyfills only once ([#282](https://github.com/babel/babel-preset-env/pull/282)) (@darahak)
|
||||
- Add a reminder about include/exclude options ([#275](https://github.com/babel/babel-preset-env/pull/275)) (@existentialism)
|
||||
|
||||
### :house: Internal
|
||||
|
||||
- Chore: reduce package size. ([#281](https://github.com/babel/babel-preset-env/pull/281)) (@evilebottnawi)
|
||||
- Remove deprecated comment ([#271](https://github.com/babel/babel-preset-env/pull/271)) (@yavorsky)
|
||||
|
||||
## v1.3.3 (2017-04-07)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Support electron version in a string format ([#252](https://github.com/babel/babel-preset-env/pull/252)) (@yavorsky)
|
||||
|
||||
Adding electron as a target was an inadvertent breaking change as it no longer
|
||||
allowed string versions. We added an exception for now, even though it is
|
||||
inconsistent with other versions. Just as a note, the upcoming version 2.x will
|
||||
allow _both_ number and string versions.
|
||||
|
||||
- Ensure const-check plugin order ([#257](https://github.com/babel/babel-preset-env/pull/257)) (@existentialism)
|
||||
|
||||
We now force the `const-es2015-check` plugin to run first (so that it can
|
||||
correctly report issues before they get transpiled away).
|
||||
|
||||
### :rocket: New Feature
|
||||
|
||||
- Allow use `babel-plugin-` prefix for include and exclude ([#242](https://github.com/babel/babel-preset-env/pull/242)) (@yavorsky)
|
||||
|
||||
The `include` and `exclude` options now allow both prefixed (`babel-plugin-transform-es2015-spread`)
|
||||
and prefix-less (`transform-es2015-spread`) plugin names.
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
- Note babel plugin prefix handling in include/exclude ([#245](https://github.com/babel/babel-preset-env/pull/245)) (@existentialism)
|
||||
- Fix README: debug option shows info in stdout. ([#236](https://github.com/babel/babel-preset-env/pull/236)) (@Gerhut)
|
||||
|
||||
### :house: Internal
|
||||
|
||||
- Add simple smoke-test ([#240](https://github.com/babel/babel-preset-env/pull/240)) (@existentialism)
|
||||
- Add prepublish script (@existentialism)
|
||||
|
||||
## v1.3.2 (2017-03-30)
|
||||
|
||||
- Fixed an issue with a broken publish
|
||||
|
||||
## v1.3.1 (2017-03-30)
|
||||
|
||||
- Fixed a regression with missing files due to `.npmignore`.
|
||||
|
||||
## v1.3.0 (2017-03-30)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Add check for ArrayBuffer[Symbol.species] ([#233](https://github.com/babel/babel-preset-env/pull/233)) (@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
|
||||
errors on IE9.
|
||||
|
||||
### :nail_care: Polish
|
||||
|
||||
- Fill data with electron as a target. ([#229](https://github.com/babel/babel-preset-env/pull/229)) (@yavorsky)
|
||||
|
||||
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.
|
||||
|
||||
- separate default builtins for platforms ([#226](https://github.com/babel/babel-preset-env/pull/226)) (@restrry)
|
||||
|
||||
If you are targeting the `node` environment exclusively, the always-included web polyfills
|
||||
(like `dom.iterable`, and a few others) will now no longer be included.
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
* remove deprecated projects ([#223](https://github.com/babel/babel-preset-env/pull/223)) [skip ci] (@stevemao)
|
||||
|
||||
### :house: Internal
|
||||
|
||||
* npmignore: Add related to build data and codecov. ([#216](https://github.com/babel/babel-preset-env/pull/216)) (@yavorsky)
|
||||
|
||||
## v1.2.2 (2017-03-14)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Refactor browser data parsing to handle families ([#208](https://github.com/babel/babel-preset-env/pull/208)) (@existentialism)
|
||||
|
||||
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!)
|
||||
|
||||
- Add typed array methods to built-ins features. ([#198](https://github.com/babel/babel-preset-env/pull/198)) (@yavorsky)
|
||||
|
||||
Fixes an issue where some TypedArray features were not being polyfilled properly. (s/o to @alippai for the report!)
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
- Fixed minor typo in readme ([#199](https://github.com/babel/babel-preset-env/pull/199)) (@bl4ckdu5t)
|
||||
- Add built-ins, better links, compat-table url, etc ([#195](https://github.com/babel/babel-preset-env/pull/195)) (@yavorsky)
|
||||
- Change CONTRIBUTING.md to use absolute paths ([#194](https://github.com/babel/babel-preset-env/pull/194)) (@aaronang)
|
||||
|
||||
### :house: Internal
|
||||
|
||||
- Bump plugins ([#201](https://github.com/babel/babel-preset-env/pull/201)) (@yavorsky)
|
||||
- Enable code coverage ([#200](https://github.com/babel/babel-preset-env/pull/200)) (@alxpy)
|
||||
- Increase mocha timeout to 10s ([#202](https://github.com/babel/babel-preset-env/pull/202)) (@yavorsky)
|
||||
|
||||
## v1.2.1 (2017-03-06)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Add transform-duplicate-keys mapping ([#192](https://github.com/babel/babel-preset-env/pull/192)) (@existentialism)
|
||||
|
||||
Our plugin data was missing a mapping for the `transform-duplicate-keys` plugin which caused it to never be included. (s/o to @Timer for the report!)
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
- Clarify reasons for the uglify option in README.md ([#188](https://github.com/babel/babel-preset-env/pull/188)) (@mikegreiling)
|
||||
|
||||
## v1.2.0 (2017-03-03)
|
||||
|
||||
### :rocket: New Feature
|
||||
|
||||
- Add uglify as a target ([#178](https://github.com/babel/babel-preset-env/pull/178)) (@yavorsky)
|
||||
|
||||
Support for `uglify` as a target is now available! This will enable all plugins and, as a result, fully compiles your code to ES5. Note, that useBuiltIns will work as before, and only the polyfills that your other target(s) need will be included.
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"chrome": 55,
|
||||
"uglify": true
|
||||
},
|
||||
"useBuiltIns": true,
|
||||
"modules": false
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Respect older versions in invert equals map ([#180](https://github.com/babel/babel-preset-env/pull/180)) (@danez)
|
||||
|
||||
Fixes a number of bugs that caused some incorrect and/or missing environment data when parsing `compat-table`.
|
||||
|
||||
## v1.1.11 (2017-03-01)
|
||||
|
||||
This release primarily upgrades `compat-table`, which adds support for async on Node 7.6!
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Fix hasBeenWarned condition. ([#175](https://github.com/babel/babel-preset-env/pull/175)) (@yavorsky)
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
- Add yarn example. ([#174](https://github.com/babel/babel-preset-env/pull/174)) (@yavorsky)
|
||||
|
||||
### :house: Internal
|
||||
|
||||
- Bump compat-table ([#177](https://github.com/babel/babel-preset-env/pull/177)) (@existentialism)
|
||||
- Add electron version exception test ([#176](https://github.com/babel/babel-preset-env/pull/176)) (@existentialism)
|
||||
|
||||
## v1.1.10 (2017-02-24)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Drop use of lodash/intersection from checkDuplicateIncludeExcludes ([#173](https://github.com/babel/babel-preset-env/pull/173)) (@existentialism)
|
||||
|
||||
## v1.1.9 (2017-02-24)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Add tests for debug output ([#156](https://github.com/babel/babel-preset-env/pull/156)) (@existentialism)
|
||||
|
||||
Since we've (mostly @yavorsky) have fixed a number of bugs recently with the `debug` option output, we added the ability to assert stdout matches what we expect. Read the updated [CONTRIBUTING.md](https://github.com/babel/babel-preset-env/blob/master/CONTRIBUTING.md#testing-the-debug-option) for more info.
|
||||
|
||||
- Fixes #143. Log correct targets. ([#155](https://github.com/babel/babel-preset-env/pull/155)) (@yavorsky)
|
||||
|
||||
This fixes a bug in the `debug` output where incorrect target(s) were being displayed for why a particular plugin/preset was being included.
|
||||
|
||||
Given targets:
|
||||
|
||||
```txt
|
||||
{
|
||||
"firefox": 52,
|
||||
"node": 7.4
|
||||
}
|
||||
```
|
||||
|
||||
Before:
|
||||
|
||||
```txt
|
||||
Using plugins:
|
||||
transform-es2015-destructuring {"node":6.5}
|
||||
transform-es2015-for-of {"node":6.5}
|
||||
transform-es2015-function-name {"node":6.5}
|
||||
transform-es2015-literals {"node":4}
|
||||
transform-exponentiation-operator {"firefox":52}
|
||||
syntax-trailing-function-commas {"firefox":52}
|
||||
```
|
||||
|
||||
After:
|
||||
|
||||
```txt
|
||||
Using plugins:
|
||||
transform-es2015-destructuring {"firefox":52}
|
||||
transform-es2015-for-of {"firefox":52}
|
||||
transform-es2015-function-name {"firefox":52}
|
||||
transform-es2015-literals {"firefox":52}
|
||||
transform-exponentiation-operator {"node":7.4}
|
||||
syntax-trailing-function-commas {"node":7.4}
|
||||
```
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
- Fix compat-table link in contributing.md (@existentialism)
|
||||
- Update README examples to fix website ([#151](https://github.com/babel/babel-preset-env/pull/)) (@existentialism)
|
||||
- Fix few typos ([#146](https://github.com/babel/babel-preset-env/pull/146)) (@existentialism)
|
||||
- Add configuration example to clarify `debug: true` ([#138](https://github.com/babel/babel-preset-env/pull/138)) (@yavorsky)
|
||||
- Fix CHANGELOG’s v1.1.8 updates typo. ([#136](https://github.com/babel/babel-preset-env/pull/136)) (@yavorsky)
|
||||
- README: Update `debug: true` example. ([#138](https://github.com/babel/babel-preset-env/pull/138)) (@yavorsky)
|
||||
|
||||
### :house: Internal
|
||||
|
||||
- update compat ([#169](https://github.com/babel/babel-preset-env/pull/169)) (@hzoo)
|
||||
- Use external Electron to Chromium library ([#144](https://github.com/babel/babel-preset-env/pull/144)) (@Kilian)
|
||||
- Update yarn lockfile ([#152](https://github.com/babel/babel-preset-env/pull/152)) (@existentialism)
|
||||
- Extract option normalization into independant file ([#125](https://github.com/babel/babel-preset-env/pull/125)) (@baer)
|
||||
- Update yarnfile ([#145](https://github.com/babel/babel-preset-env/pull/145)) (@baer)
|
||||
- devDeps: eslint-config-babel v5.0.0 ([#139](https://github.com/babel/babel-preset-env/pull/139)) (@kaicataldo)
|
||||
- Update compat-table, build data ([#135](https://github.com/babel/babel-preset-env/pull/135)) (@hzoo)
|
||||
|
||||
## v1.1.8 (2017-01-10)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Debug: Transformations before logs. ([#128](https://github.com/babel/babel-preset-env/pull/128)) (@yavorsky)
|
||||
|
||||
Makes sure that all transformations on `targets` (such as `exclude`/`include`) are run before logging out with the `debug` option. Fixes ([#127](https://github.com/babel/babel-preset-env/issues/127)).
|
||||
|
||||
### :house: Internal
|
||||
|
||||
- Remove unnecessary extension. ([#131](https://github.com/babel/babel-preset-env/pull/131)) (@roman-yakobnyuk)
|
||||
- Include yarn.lock and update CI. ([#124](https://github.com/babel/babel-preset-env/pull/124)) (@existentialism)
|
||||
|
||||
## v1.1.7 (2017-01-09)
|
||||
|
||||
Had a publishing issue in the previous release.
|
||||
|
||||
## v1.1.6 (2017-01-06)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Explicitly resolve lowest browser version. ([#121](https://github.com/babel/babel-preset-env/pull/121)) (@brokenmass)
|
||||
|
||||
```js
|
||||
{
|
||||
"targets": {
|
||||
"browsers": ["ios >= 6"] // was resolving to {ios: 10} rather than {ios: 6}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## v1.1.5 (2017-01-04)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Show error if target version is not a number. ([#107](https://github.com/babel/babel-preset-env/pull/107)) (@existentialism)
|
||||
|
||||
```js
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"chrome": "52", // will error since it's not a number,
|
||||
"chrome": 52 // correct!
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- Fix targets for the `debug` option. ([#109](https://github.com/babel/babel-preset-env/pull/109)) (@yavorsky)
|
||||
|
||||
Now it prints the transformed targets/environments rather than the browsers query.
|
||||
|
||||
```txt
|
||||
Using targets:
|
||||
{
|
||||
"chrome": 53,
|
||||
"ie": 10,
|
||||
"node": 6
|
||||
}
|
||||
|
||||
Modules transform: false
|
||||
|
||||
Using plugins:
|
||||
transform-es2015-arrow-functions {"chrome":47,"node":6}
|
||||
transform-es2015-block-scoped-functions {"chrome":41,"ie":11,"node":4}
|
||||
|
||||
Using polyfills:
|
||||
es6.typed.uint8-clamped-array {"chrome":5,"node":0.12}
|
||||
es6.map {"chrome":51,"node":6.5}
|
||||
```
|
||||
|
||||
## v1.1.4 (2016-12-16)
|
||||
|
||||
v1.1.2-v1.1.4
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
The new `exclude`/`include` options weren't working correctly for built-ins. ([#102](https://github.com/babel/babel-preset-env/pull/102)).
|
||||
|
||||
Also fixes an issue with debug option.
|
||||
|
||||
## v1.1.1 (2016-12-13)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
Regression with the previous release due to using `Object.values` (ES2017). This wasn't caught because we are using babel-register to run tests and includes polyfills so it didn't fail on CI even though we have Node 0.10 as an env. Looking into fixing this to prevent future issues.
|
||||
|
||||
## v1.1.0 (2016-12-13)
|
||||
|
||||
### :rocket: New Feature
|
||||
|
||||
- Add `exclude` option, rename `whitelist` to `include` ([#89](https://github.com/babel/babel-preset-env/pull/89)) (@hzoo)
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"browsers": ["last 2 versions", "safari >= 7"]
|
||||
},
|
||||
"include": ["transform-es2015-arrow-functions"],
|
||||
"exclude": [
|
||||
"transform-regenerator",
|
||||
"transform-async-to-generator",
|
||||
"map"
|
||||
],
|
||||
"useBuiltIns": true
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
`"exclude": ["transform-regenerator"]` doesn't transform generators and removes `regeneratorRuntime` from being imported.
|
||||
|
||||
`"exclude": ["transform-async-to-generator"]` doesn't use the built-in async-to-gen transform so you can use something like [fast-async](https://github.com/MatAtBread/fast-async).
|
||||
|
||||
`"exclude": ["map"]` doesn't include the `Map` polyfill if you know you aren't using it in your code (w/ `useBuiltIns`). (We will figure out a way to automatically do this [#84](https://github.com/babel/babel-preset-env/issues/84)).
|
||||
|
||||
If you pass a wrong plugin it will error: valid options for `include/exclude` are in [/data/plugin-features.js](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js) and [/data/built-in-features.js](https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js) (without the `es6.`)
|
||||
|
||||
### :house: Internal
|
||||
|
||||
- Optimize result filtration. ([#77](https://github.com/babel/babel-preset-env/pull/77)) (@yavorsky)
|
||||
- Update eslint config to align with other babel projects ([#79](https://github.com/babel/babel-preset-env/pull/79)) (@baer)
|
||||
- Update pathnames to avoid uppercase ([#80](https://github.com/babel/babel-preset-env/pull/80)) (@baer)
|
||||
- Refactor build data for clarity/consistency ([#81](https://github.com/babel/babel-preset-env/pull/81)) (@baer)
|
||||
- Update linting rules to cover all js ([#82](https://github.com/babel/babel-preset-env/pull/82)) (@baer)
|
||||
- Cleanup lib before rebuilding ([#87](https://github.com/babel/babel-preset-env/pull/87)) (@baer)
|
||||
- Move linting dependency to be dev only ([#88](https://github.com/babel/babel-preset-env/pull/88)) (@baer)
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
- Fix typo ([#78](https://github.com/babel/babel-preset-env/pull/78)) (@rohmanhm)
|
||||
- Fix PR link in changelog. ([#75](https://github.com/babel/babel-preset-env/pull/75)) (@nhajidin)
|
||||
|
||||
## v1.0.2 (2016-12-10)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
* Fix issue with Object.getOwnPropertySymbols ([#71](https://github.com/babel/babel-preset-env/pull/71)) ([@existentialism](https://github.com/existentialism))
|
||||
|
||||
Was requiring the wrong module kinda of like in v1.0.1:
|
||||
|
||||
https://github.com/zloirock/core-js#ecmascript-6-symbol
|
||||
|
||||
```diff
|
||||
-import "core-js/modules/es6.object.get-own-property-symbols";
|
||||
```
|
||||
|
||||
The test is just a part of `Symbol`.
|
||||
|
||||
## v1.0.1 (2016-12-10)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
* Fix regenerator import ([#68](https://github.com/babel/babel-preset-env/pull/68)) ([@hzoo](https://github.com/hzoo))
|
||||
|
||||
We were outputting an invalid path for `regenerator`!
|
||||
|
||||
```diff
|
||||
+import "regenerator-runtime/runtime";
|
||||
-import "core-js/modules/regenerator-runtime/runtime"-
|
||||
```
|
||||
|
||||
## v1.0.0 (2016-12-09)
|
||||
|
||||
### :rocket: New Feature
|
||||
|
||||
* Add `useBuiltIns` option ([#56](https://github.com/babel/babel-preset-env/pull/56)) ([@hzoo](https://github.com/hzoo)), ([@yavorsky](https://github.com/yavorsky)), ([@existentialism](https://github.com/existentialism))
|
||||
|
||||
A way to apply `babel-preset-env` for polyfills (via `"babel-polyfill"``).
|
||||
|
||||
> This option will apply a new Babel plugin that replaces `require("babel-polyfill")` with the individual requires for `babel-polyfill` based on the target environments.
|
||||
|
||||
Install
|
||||
|
||||
```
|
||||
npm install babel-polyfill --save
|
||||
```
|
||||
|
||||
In
|
||||
|
||||
```js
|
||||
import "babel-polyfill"; // create an entry js file that contains this
|
||||
// or
|
||||
import "core-js";
|
||||
```
|
||||
|
||||
Out (different based on environment)
|
||||
|
||||
```js
|
||||
// chrome 55
|
||||
import "core-js/modules/es7.string.pad-start"; // haha left_pad
|
||||
import "core-js/modules/es7.string.pad-end";
|
||||
import "core-js/modules/web.timers";
|
||||
import "core-js/modules/web.immediate";
|
||||
import "core-js/modules/web.dom.iterable";
|
||||
```
|
||||
|
||||
`.babelrc` Usage
|
||||
|
||||
```js
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"electron": 1.4
|
||||
},
|
||||
"modules": false, // webpack 2
|
||||
"useBuiltIns": true // new option
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
> Also looking to make an easier integration point via Webpack with this method. Please reach out if you have ideas!
|
||||
|
||||
---
|
||||
|
||||
* Support [Electron](http://electron.atom.io/) ([#55](https://github.com/babel/babel-preset-env/pull/55)) ([@paulcbetts](https://github.com/paulcbetts))
|
||||
|
||||
Electron is also an environment, so [Paul went ahead](https://twitter.com/paulcbetts/status/804507070103851008) and added support for this!
|
||||
|
||||
`.babelrc` Usage
|
||||
|
||||
```js
|
||||
{
|
||||
"presets": [ ["env", {"targets": { "electron": 1.4 }}]]
|
||||
}
|
||||
```
|
||||
|
||||
> Currently we are manually updating the data in [/data/electron-to-chromium.js](https://github.com/babel/babel-preset-env/blob/master/data/electron-to-chromium.js), but [@kevinsawicki](https://github.com/kevinsawicki) says we could generate the data from [atom-shell/dist/index.json](https://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist/index.json) as well! (Someone should make a PR :smile:)
|
||||
|
||||
|
||||
|
||||
## v0.0.9 (2016-11-24)
|
||||
|
||||
### :rocket: New Feature
|
||||
|
||||
* Support Opera ([#48](https://github.com/babel/babel-preset-env/pull/48)) (Henry Zhu)
|
||||
|
||||
Was as simple as modifying the chrome version and subtracting 13! (so chrome 54 = opera 41)
|
||||
|
||||
```js
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"opera": 41
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## v0.0.8 (2016-11-16)
|
||||
|
||||
### :nail_care: Polish
|
||||
|
||||
* Only print the debug info once ([#46](https://github.com/babel/babel-preset-env/pull/46) (Henry Zhu)
|
||||
|
||||
When using the `debug` option it was printing the data for each file processed rather than once.
|
||||
|
||||
```js
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"debug": true
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## v0.0.7 (2016-11-02)
|
||||
|
||||
### :rocket: New Feature
|
||||
|
||||
* hardcode a current node version option ([#35](https://github.com/babel/babel-preset-env/pull/35)) (Henry Zhu)
|
||||
|
||||
```js
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"node": "current" // parseFloat(process.versions.node)
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
* add 'whitelist' option ([#31](https://github.com/babel/babel-preset-env/pull/31)) (Henry Zhu)
|
||||
|
||||
```js
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"chrome": 52
|
||||
},
|
||||
"whitelist": ["transform-es2015-arrow-functions"]
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
* Add more aliases (Henry Zhu)
|
||||
* Update plugin data: firefox 52 supports async/await! ([#29](https://github.com/babel/babel-preset-env/pull/29)) (Henry Zhu)
|
||||
|
||||
### :bug: Bug Fixes
|
||||
|
||||
* Use compat-table equals option ([#36](https://github.com/babel/babel-preset-env/pull/36)) (Henry Zhu)
|
||||
|
||||
Compute and use `compat-table` equivalents
|
||||
|
||||
```js
|
||||
{
|
||||
"safari6": "phantom",
|
||||
"chrome44": "iojs",
|
||||
"chrome50": "node64",
|
||||
"chrome51": "node65",
|
||||
"chrome54": "node7",
|
||||
"chrome30": "android44",
|
||||
"chrome37": "android50",
|
||||
"chrome39": "android51",
|
||||
"safari7": "ios7",
|
||||
"safari71_8": "ios8",
|
||||
"safari9": "ios9",
|
||||
"safari10": "ios10",
|
||||
"chrome50": "node6"
|
||||
}
|
||||
```
|
||||
|
||||
* Change default behavior to act the same as babel-preset-latest ([#33](https://github.com/babel/babel-preset-env/pull/33)) (Henry Zhu)
|
||||
|
||||
```js
|
||||
{ "presets": ["env"] } // should act the same as babel-preset-latest
|
||||
```
|
||||
|
||||
## Internal
|
||||
|
||||
* Add fixture helper for tests ([#28](https://github.com/babel/babel-preset-env/pull/28)) (Henry Zhu)
|
||||
93
experimental/babel-preset-env/CONTRIBUTING.md
Normal file
93
experimental/babel-preset-env/CONTRIBUTING.md
Normal file
@ -0,0 +1,93 @@
|
||||
# Contributing
|
||||
|
||||
## Adding a new plugin to support (when approved in the next ECMAScript version)
|
||||
|
||||
### Update [`plugin-features.js`](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js)
|
||||
|
||||
*Example:*
|
||||
|
||||
If you were going to add `**` which is in ES2016:
|
||||
|
||||
Find the relevant entries on [compat-table](https://kangax.github.io/compat-table/es2016plus/#test-exponentiation_(**)_operator):
|
||||
|
||||
`exponentiation (**) operator`
|
||||
|
||||
Find the corresponding babel plugin:
|
||||
|
||||
`transform-exponentiation-operator`
|
||||
|
||||
And add them in this structure:
|
||||
|
||||
```js
|
||||
// es2016
|
||||
"transform-exponentiation-operator": {
|
||||
features: [
|
||||
"exponentiation (**) operator",
|
||||
],
|
||||
},
|
||||
```
|
||||
|
||||
### Update [`built-in-features.js`](https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js)
|
||||
|
||||
*Example:*
|
||||
|
||||
In case you want to add `Object.values` which is in ES2017:
|
||||
|
||||
Find the relevant feature and subfeature on [compat-table](https://kangax.github.io/compat-table/es2016plus/#test-Object_static_methods_Object.values)
|
||||
and split it with `/`:
|
||||
|
||||
`Object static methods / Object.values`
|
||||
|
||||
Find the corresponding module on [core-js](https://github.com/zloirock/core-js/tree/master/modules):
|
||||
|
||||
`es7.object.values.js`
|
||||
|
||||
Find required ES version in [`built-in-features.js`](https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js) and add the new feature:
|
||||
|
||||
```js
|
||||
const es2017 = {
|
||||
//...
|
||||
"es7.object.values": "Object static methods / Object.values"
|
||||
}
|
||||
```
|
||||
|
||||
### Update [`plugins.json`](https://github.com/babel/babel-preset-env/blob/master/data/plugins.json)
|
||||
|
||||
Until `compat-table` is a standalone npm module for data we are using the git url
|
||||
|
||||
`"compat-table": "kangax/compat-table#[latest-commit-hash]"`,
|
||||
|
||||
So we update and then run `npm run build-data`. If there are no changes, then `plugins.json` will be the same.
|
||||
|
||||
## Tests
|
||||
|
||||
### Running tests locally
|
||||
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
|
||||
### Checking code coverage locally
|
||||
|
||||
```bash
|
||||
npm run coverage
|
||||
```
|
||||
|
||||
### Writing tests
|
||||
|
||||
#### General
|
||||
|
||||
All the tests for `babel-preset-env` exist in the `test/fixtures` folder. The
|
||||
test setup and conventions are exactly the same as testing a Babel plugin, so
|
||||
please read our [documentation on writing tests](https://github.com/babel/babel/blob/master/CONTRIBUTING.md#babel-plugin-x).
|
||||
|
||||
#### Testing the `debug` option
|
||||
|
||||
Testing debug output to `stdout` is similar. Under the `test/debug-fixtures`,
|
||||
create a folder with a descriptive name of your test, and add the following:
|
||||
|
||||
* Add a `options.json` file (just as the other tests, this is essentially a
|
||||
`.babelrc`) with the desired test configuration (required)
|
||||
* Add a `stdout.txt` file with the expected debug output. For added
|
||||
convenience, if there is no `stdout.txt` present, the test runner will
|
||||
generate one for you.
|
||||
21
experimental/babel-preset-env/LICENSE
Normal file
21
experimental/babel-preset-env/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016-2017 Babel
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
572
experimental/babel-preset-env/README.md
Normal file
572
experimental/babel-preset-env/README.md
Normal file
@ -0,0 +1,572 @@
|
||||
# babel-preset-env [](https://www.npmjs.com/package/babel-preset-env) [](https://travis-ci.org/babel/babel-preset-env) [](https://www.npmjs.com/package/babel-preset-env) [](https://codecov.io/github/babel/babel-preset-env)
|
||||
|
||||
> 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.
|
||||
|
||||
```sh
|
||||
npm install babel-preset-env --save-dev
|
||||
```
|
||||
|
||||
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": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"browsers": ["last 2 versions", "safari >= 7"]
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
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"
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- [How it Works](#how-it-works)
|
||||
- [Install](#install)
|
||||
- [Usage](#usage)
|
||||
- [Options](#options)
|
||||
- [Examples](#examples)
|
||||
- [Issues](#issues)
|
||||
|
||||
## How it Works
|
||||
|
||||
### Determine environment support for ECMAScript features
|
||||
|
||||
Use external data such as [`compat-table`](https://github.com/kangax/compat-table) to determine browser support. (We should create PRs there when necessary)
|
||||
|
||||

|
||||
|
||||
We can periodically run [build-data.js](https://github.com/babel/babel-preset-env/blob/master/scripts/build-data.js) which generates [plugins.json](https://github.com/babel/babel-preset-env/blob/master/data/plugins.json).
|
||||
|
||||
Ref: [#7](https://github.com/babel/babel-preset-env/issues/7)
|
||||
|
||||
### Maintain a mapping between JavaScript features and Babel plugins
|
||||
|
||||
> Currently located at [plugin-features.js](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js).
|
||||
|
||||
This should be straightforward to do in most cases. There might be cases where plugins should be split up more or certain plugins aren't standalone enough (or impossible to do).
|
||||
|
||||
### Support all plugins in Babel that are considered `latest`
|
||||
|
||||
> Default behavior without options is the same as `babel-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/)).
|
||||
|
||||
Ref: [#14](https://github.com/babel/babel-preset-env/issues/14)
|
||||
|
||||
### Determine the lowest common denominator of plugins to be included in the preset
|
||||
|
||||
If you are targeting IE 8 and Chrome 55 it will include all plugins required by IE 8 since you would need to support both still.
|
||||
|
||||
### Support a target option `"node": "current"` to compile for the currently running node version.
|
||||
|
||||
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.
|
||||
|
||||
### Support a `browsers` option like autoprefixer.
|
||||
|
||||
Use [browserslist](https://github.com/ai/browserslist) to declare supported environments by performing queries like `> 1%, last 2 versions`.
|
||||
|
||||
Ref: [#19](https://github.com/babel/babel-preset-env/pull/19)
|
||||
|
||||
### Browserslist support.
|
||||
|
||||
[Browserslist](https://github.com/ai/browserslist) is a library used to share a supported list of browsers between different front-end tools like [autoprefixer](https://github.com/postcss/autoprefixer), [stylelint](https://stylelint.io/), [eslint-plugin-compat](https://github.com/amilajack/eslint-plugin-compat) and many others.
|
||||
|
||||
By default, babel-preset-env will use [browserslist config sources](https://github.com/ai/browserslist#queries).
|
||||
|
||||
For example, to enable only the polyfills and plugins needed for a project targeting *last 2 versions* and *IE10*:
|
||||
|
||||
**.babelrc**
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"useBuiltIns": true
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**browserslist**
|
||||
```
|
||||
Last 2 versions
|
||||
IE 10
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
**package.json**
|
||||
```
|
||||
"browserslist": "last 2 versions, ie 10"
|
||||
```
|
||||
|
||||
Browserslist config will be ignored if: 1) `targets.browsers` was specified 2) or with `ignoreBrowserslistConfig: true` option ([see more](#ignoreBrowserslistConfig)):
|
||||
|
||||
#### Targets merging.
|
||||
|
||||
1. If [targets.browsers](#targetsbrowsers) is defined - the browserslist config will be ignored. The browsers specified in `targets` will be merged with [any other explicitly defined targets](#targets). If merged, targets defined explicitly will override the same targets received from `targets.browsers`.
|
||||
|
||||
2. If [targets.browsers](#targetsbrowsers) is _not_ defined - the program will search browserslist file or `package.json` with `browserslist` field. The search will start from the working directory of the process or from the path specified by the `configPath` option, and go up to the system root. If both a browserslist file and configuration inside a `package.json` are found, an exception will be thrown.
|
||||
|
||||
3. If a browserslist config was found and other targets are defined (but not [targets.browsers](#targetsbrowsers)), the targets will be merged in the same way as `targets` defined explicitly with `targets.browsers`.
|
||||
|
||||
## Install
|
||||
|
||||
With [npm](https://www.npmjs.com):
|
||||
|
||||
```sh
|
||||
npm install --save-dev babel-preset-env
|
||||
```
|
||||
|
||||
Or [yarn](https://yarnpkg.com):
|
||||
|
||||
```sh
|
||||
yarn add babel-preset-env --dev
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
The default behavior without options runs all transforms (behaves the same as [babel-preset-latest](https://babeljs.io/docs/plugins/preset-latest/)).
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": ["env"]
|
||||
}
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
For more information on setting options for a preset, refer to the [plugin/preset options](http://babeljs.io/docs/plugins/#plugin-preset-options) documentation.
|
||||
|
||||
### `targets`
|
||||
|
||||
`{ [string]: number | string }`, defaults to `{}`.
|
||||
|
||||
Takes an object of environment versions to support.
|
||||
|
||||
Each target environment takes a number or a string (we recommend using a string when specifying minor versions like `node: "6.10"`).
|
||||
|
||||
Example environments: `chrome`, `opera`, `edge`, `firefox`, `safari`, `ie`, `ios`, `android`, `node`, `electron`.
|
||||
|
||||
The [data](https://github.com/babel/babel-preset-env/blob/master/data/plugins.json) for this is generated by running the [build-data script](https://github.com/babel/babel-preset-env/blob/master/scripts/build-data.js) which pulls in data from [compat-table](https://kangax.github.io/compat-table).
|
||||
|
||||
### `targets.node`
|
||||
|
||||
`number | string | "current" | true`
|
||||
|
||||
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`.
|
||||
|
||||
### `targets.browsers`
|
||||
|
||||
`Array<string> | string`
|
||||
|
||||
A query to select browsers (ex: last 2 versions, > 5%) using [browserslist](https://github.com/ai/browserslist).
|
||||
|
||||
Note, browsers' results are overridden by explicit items from `targets`.
|
||||
|
||||
### `spec`
|
||||
|
||||
`boolean`, defaults to `false`.
|
||||
|
||||
Enable more spec compliant, but potentially slower, transformations for any plugins in this preset that support them.
|
||||
|
||||
### `loose`
|
||||
|
||||
`boolean`, defaults to `false`.
|
||||
|
||||
Enable "loose" transformations for any plugins in this preset that allow them.
|
||||
|
||||
### `modules`
|
||||
|
||||
`"amd" | "umd" | "systemjs" | "commonjs" | false`, defaults to `"commonjs"`.
|
||||
|
||||
Enable transformation of ES6 module syntax to another module type.
|
||||
|
||||
Setting this to `false` will not transform modules.
|
||||
|
||||
### `debug`
|
||||
|
||||
`boolean`, defaults to `false`.
|
||||
|
||||
Outputs the targets/plugins used and the version specified in [plugin data version](https://github.com/babel/babel-preset-env/blob/master/data/plugins.json) to `console.log`.
|
||||
|
||||
### `include`
|
||||
|
||||
`Array<string>`, defaults to `[]`.
|
||||
|
||||
An array of plugins to always include.
|
||||
|
||||
Valid options include any:
|
||||
|
||||
- [Babel plugins](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js) - both with (`babel-plugin-transform-es2015-spread`) and without prefix (`transform-es2015-spread`) are supported.
|
||||
|
||||
- [Built-ins](https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js), such as `map`, `set`, or `object.assign`.
|
||||
|
||||
This option is useful if there is a bug in a native implementation, or a combination of a non-supported feature + a supported one doesn't work.
|
||||
|
||||
For example, Node 4 supports native classes but not spread. If `super` is used with a spread argument, then the `transform-es2015-classes` transform needs to be `include`d, as it is not possible to transpile a spread with `super` otherwise.
|
||||
|
||||
> NOTE: The `include` and `exclude` options _only_ work with the [plugins included with this preset](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js); so, for example, including `transform-do-expressions` or excluding `transform-function-bind` will throw errors. To use a plugin _not_ included with this preset, add them to your [config](https://babeljs.io/docs/usage/babelrc/) directly.
|
||||
|
||||
### `exclude`
|
||||
|
||||
`Array<string>`, defaults to `[]`.
|
||||
|
||||
An array of plugins to always exclude/remove.
|
||||
|
||||
The possible options are the same as the `include` option.
|
||||
|
||||
This option is useful for "blacklisting" a transform like `transform-regenerator` if you don't use generators and don't want to include `regeneratorRuntime` (when using `useBuiltIns`) or for using another plugin like [fast-async](https://github.com/MatAtBread/fast-async) instead of [Babel's async-to-gen](http://babeljs.io/docs/plugins/transform-async-generator-functions/).
|
||||
|
||||
### `useBuiltIns`
|
||||
|
||||
`"usage"` | `"entry"` | `false`, defaults to `false`.
|
||||
|
||||
A way to apply `babel-preset-env` for polyfills (via `babel-polyfill`).
|
||||
|
||||
```sh
|
||||
npm install babel-polyfill --save
|
||||
```
|
||||
|
||||
#### `useBuiltIns: 'usage'`
|
||||
|
||||
Adds specific imports for polyfills when they are used in each file. We take advantage of the fact that a bundler will load the same polyfill only once.
|
||||
|
||||
**In**
|
||||
|
||||
a.js
|
||||
|
||||
```js
|
||||
var a = new Promise();
|
||||
```
|
||||
|
||||
b.js
|
||||
|
||||
```js
|
||||
var b = new Map();
|
||||
```
|
||||
|
||||
**Out (if environment doesn't support it)**
|
||||
|
||||
```js
|
||||
import "babel-polyfill/core-js/modules/es6.promise";
|
||||
var a = new Promise();
|
||||
```
|
||||
|
||||
```js
|
||||
import "babel-polyfill/core-js/modules/es6.map";
|
||||
var b = new Map();
|
||||
```
|
||||
|
||||
**Out (if environment supports it)**
|
||||
|
||||
```js
|
||||
var a = new Promise();
|
||||
```
|
||||
|
||||
```js
|
||||
var b = new Map();
|
||||
```
|
||||
|
||||
#### `useBuiltIns: 'entry'`
|
||||
|
||||
> NOTE: Only use `require("babel-polyfill");` once in your whole app.
|
||||
> Multiple imports or requires of `babel-polyfill` will throw an error since it can cause global collisions and other issues that are hard to trace.
|
||||
> We recommend creating a single entry file that only contains the `require` statement.
|
||||
|
||||
This option enables a new plugin that replaces the statement `import "babel-polyfill"` or `require("babel-polyfill")` with individual requires for `babel-polyfill` based on environment.
|
||||
|
||||
**In**
|
||||
|
||||
```js
|
||||
import "babel-polyfill";
|
||||
```
|
||||
|
||||
**Out (different based on environment)**
|
||||
|
||||
```js
|
||||
import "babel-polyfill/core-js/modules/es7.string.pad-start";
|
||||
import "babel-polyfill/core-js/modules/es7.string.pad-end";
|
||||
```
|
||||
|
||||
#### `useBuiltIns: false`
|
||||
|
||||
Don't add polyfills automatically per file, or transform `import "babel-polyfill"` to individual polyfills.
|
||||
|
||||
### `forceAllTransforms`
|
||||
|
||||
`boolean`, defaults to `false`.
|
||||
|
||||
<p><details>
|
||||
<summary><b>Example</b></summary>
|
||||
|
||||
With Babel 7's .babelrc.js support, you can force all transforms to be run if env is set to `production`.
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
presets: [
|
||||
["env", {
|
||||
targets: {
|
||||
chrome: 59,
|
||||
edge: 13,
|
||||
firefox: 50,
|
||||
},
|
||||
// for uglifyjs...
|
||||
forceAllTransforms: process.env === "production"
|
||||
}],
|
||||
],
|
||||
};
|
||||
```
|
||||
</details></p>
|
||||
|
||||
|
||||
> NOTE: `targets.uglify` is deprecated and will be removed in the next major in
|
||||
favor of this.
|
||||
|
||||
By default, this preset will run all the transforms needed for the targeted
|
||||
environment(s). Enable this option if you want to force running _all_
|
||||
transforms, which is useful if the output will be run through UglifyJS or an
|
||||
environment that only supports ES5.
|
||||
|
||||
> NOTE: Uglify has a work-in-progress "Harmony" branch to address the lack of
|
||||
ES6 support, but it is not yet stable. You can follow its progress in
|
||||
[UglifyJS2 issue #448](https://github.com/mishoo/UglifyJS2/issues/448). If you
|
||||
require an alternative minifier which _does_ support ES6 syntax, we recommend
|
||||
using [babel-minify](https://github.com/babel/minify).
|
||||
|
||||
### `configPath`
|
||||
|
||||
`string`, defaults to `process.cwd()`
|
||||
|
||||
The starting point where the config search for browserslist will start, and ascend to the system root until found.
|
||||
|
||||
### `ignoreBrowserslistConfig`
|
||||
|
||||
`boolean`, defaults to `false`
|
||||
|
||||
Toggles whether or not [browserslist config sources](https://github.com/ai/browserslist#queries) are used, which includes searching for any browserslist files or referencing the browserslist key inside package.json. This is useful for projects that use a browserslist config for files that won't be compiled with Babel.
|
||||
|
||||
### `shippedProposals`
|
||||
|
||||
`boolean`, defaults to `false`
|
||||
|
||||
Toggles enabling support for builtin/feature proposals that have shipped in browsers. If your target environments have native support for a feature proposal, its matching parser syntax plugin is enabled instead of performing any transform. Note that this _does not_ enable the same transformations as [`babel-preset-stage3`](https://babeljs.io/docs/plugins/preset-stage-3/), since proposals can continue to change before landing in browsers.
|
||||
|
||||
The following are currently supported:
|
||||
|
||||
**Builtins**
|
||||
|
||||
- [Promise.prototype.finally](https://github.com/tc39/proposal-promise-finally)
|
||||
|
||||
**Features**
|
||||
|
||||
- [Asynchronous Iterators](https://github.com/tc39/proposal-async-iteration)
|
||||
- [Object rest/spread properties](https://github.com/tc39/proposal-object-rest-spread)
|
||||
- [Optional catch binding](https://github.com/tc39/proposal-optional-catch-binding)
|
||||
- [Unicode property escapes in regular expressions](https://github.com/tc39/proposal-regexp-unicode-property-escapes)
|
||||
|
||||
---
|
||||
|
||||
## Examples
|
||||
|
||||
### Export with various targets
|
||||
|
||||
```js
|
||||
export class A {}
|
||||
```
|
||||
|
||||
#### Target only Chrome 52
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"chrome": 52
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```js
|
||||
class A {}
|
||||
exports.A = A;
|
||||
```
|
||||
|
||||
#### Target Chrome 52 with webpack 2/rollup and loose mode
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"chrome": 52
|
||||
},
|
||||
"modules": false,
|
||||
"loose": true
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```js
|
||||
export class A {}
|
||||
```
|
||||
|
||||
#### Target specific browsers via browserslist
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"chrome": 52,
|
||||
"browsers": ["last 2 versions", "safari 7"]
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```js
|
||||
export var A = function A() {
|
||||
_classCallCheck(this, A);
|
||||
};
|
||||
```
|
||||
|
||||
#### Target latest node via `node: true` or `node: "current"`
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"node": "current"
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```js
|
||||
class A {}
|
||||
exports.A = A;
|
||||
```
|
||||
|
||||
### Show debug output
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
[ "env", {
|
||||
"targets": {
|
||||
"safari": 10
|
||||
},
|
||||
"modules": false,
|
||||
"useBuiltIns": true,
|
||||
"debug": true
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**stdout**
|
||||
|
||||
```sh
|
||||
Using targets:
|
||||
{
|
||||
"safari": 10
|
||||
}
|
||||
|
||||
Modules transform: false
|
||||
|
||||
Using plugins:
|
||||
transform-exponentiation-operator {}
|
||||
transform-async-to-generator {}
|
||||
|
||||
Using polyfills:
|
||||
es7.object.values {}
|
||||
es7.object.entries {}
|
||||
es7.object.get-own-property-descriptors {}
|
||||
web.timers {}
|
||||
web.immediate {}
|
||||
web.dom.iterable {}
|
||||
```
|
||||
|
||||
### Include and exclude specific plugins/built-ins
|
||||
|
||||
> always include arrow functions, explicitly exclude generators
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"browsers": ["last 2 versions", "safari >= 7"]
|
||||
},
|
||||
"include": ["transform-es2015-arrow-functions", "es6.map"],
|
||||
"exclude": ["transform-regenerator", "es6.set"]
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Issues
|
||||
|
||||
If you get a `SyntaxError: Unexpected token ...` error when using the [object-rest-spread](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-object-rest-spread) transform then make sure the plugin has been updated to, at least, `v6.19.0`.
|
||||
4
experimental/babel-preset-env/codecov.yml
Normal file
4
experimental/babel-preset-env/codecov.yml
Normal file
@ -0,0 +1,4 @@
|
||||
coverage:
|
||||
parsers:
|
||||
javascript:
|
||||
enable_partials: yes
|
||||
194
experimental/babel-preset-env/data/built-in-features.js
Normal file
194
experimental/babel-preset-env/data/built-in-features.js
Normal file
@ -0,0 +1,194 @@
|
||||
const typedArrayMethods = [
|
||||
"typed arrays / %TypedArray%.from",
|
||||
"typed arrays / %TypedArray%.of",
|
||||
"typed arrays / %TypedArray%.prototype.subarray",
|
||||
"typed arrays / %TypedArray%.prototype.join",
|
||||
"typed arrays / %TypedArray%.prototype.indexOf",
|
||||
"typed arrays / %TypedArray%.prototype.lastIndexOf",
|
||||
"typed arrays / %TypedArray%.prototype.slice",
|
||||
"typed arrays / %TypedArray%.prototype.every",
|
||||
"typed arrays / %TypedArray%.prototype.filter",
|
||||
"typed arrays / %TypedArray%.prototype.forEach",
|
||||
"typed arrays / %TypedArray%.prototype.map",
|
||||
"typed arrays / %TypedArray%.prototype.reduce",
|
||||
"typed arrays / %TypedArray%.prototype.reduceRight",
|
||||
"typed arrays / %TypedArray%.prototype.reverse",
|
||||
"typed arrays / %TypedArray%.prototype.some",
|
||||
"typed arrays / %TypedArray%.prototype.sort",
|
||||
"typed arrays / %TypedArray%.prototype.copyWithin",
|
||||
"typed arrays / %TypedArray%.prototype.find",
|
||||
"typed arrays / %TypedArray%.prototype.findIndex",
|
||||
"typed arrays / %TypedArray%.prototype.fill",
|
||||
"typed arrays / %TypedArray%.prototype.keys",
|
||||
"typed arrays / %TypedArray%.prototype.values",
|
||||
"typed arrays / %TypedArray%.prototype.entries",
|
||||
"typed arrays / %TypedArray%.prototype[Symbol.iterator]",
|
||||
"typed arrays / %TypedArray%[Symbol.species]",
|
||||
];
|
||||
|
||||
const es2015 = {
|
||||
"es6.typed.array-buffer": "typed arrays / ArrayBuffer[Symbol.species]",
|
||||
"es6.typed.data-view": "typed arrays / DataView",
|
||||
"es6.typed.int8-array": {
|
||||
features: ["typed arrays / Int8Array"].concat(typedArrayMethods)
|
||||
},
|
||||
"es6.typed.uint8-array": {
|
||||
features: ["typed arrays / Uint8Array"].concat(typedArrayMethods)
|
||||
},
|
||||
"es6.typed.uint8-clamped-array": {
|
||||
features: ["typed arrays / Uint8ClampedArray"].concat(typedArrayMethods)
|
||||
},
|
||||
"es6.typed.int16-array": {
|
||||
features: ["typed arrays / Int16Array"].concat(typedArrayMethods)
|
||||
},
|
||||
"es6.typed.uint16-array": {
|
||||
features: ["typed arrays / Uint16Array"].concat(typedArrayMethods)
|
||||
},
|
||||
"es6.typed.int32-array": {
|
||||
features: ["typed arrays / Int32Array"].concat(typedArrayMethods)
|
||||
},
|
||||
"es6.typed.uint32-array": {
|
||||
features: ["typed arrays / Uint32Array"].concat(typedArrayMethods)
|
||||
},
|
||||
"es6.typed.float32-array": {
|
||||
features: ["typed arrays / Float32Array"].concat(typedArrayMethods)
|
||||
},
|
||||
"es6.typed.float64-array": {
|
||||
features: ["typed arrays / Float64Array"].concat(typedArrayMethods)
|
||||
},
|
||||
|
||||
"es6.map": "Map",
|
||||
"es6.set": "Set",
|
||||
"es6.weak-map": "WeakMap",
|
||||
"es6.weak-set": "WeakSet",
|
||||
|
||||
// Proxy not implementable
|
||||
|
||||
"es6.reflect.apply": "Reflect / Reflect.apply",
|
||||
"es6.reflect.construct": "Reflect / Reflect.construct",
|
||||
"es6.reflect.define-property": "Reflect / Reflect.defineProperty",
|
||||
"es6.reflect.delete-property": "Reflect / Reflect.deleteProperty",
|
||||
"es6.reflect.get": "Reflect / Reflect.get",
|
||||
"es6.reflect.get-own-property-descriptor": "Reflect / Reflect.getOwnPropertyDescriptor",
|
||||
"es6.reflect.get-prototype-of": "Reflect / Reflect.getPrototypeOf",
|
||||
"es6.reflect.has": "Reflect / Reflect.has",
|
||||
"es6.reflect.is-extensible": "Reflect / Reflect.isExtensible",
|
||||
"es6.reflect.own-keys": "Reflect / Reflect.ownKeys",
|
||||
"es6.reflect.prevent-extensions": "Reflect / Reflect.preventExtensions",
|
||||
"es6.reflect.set": "Reflect / Reflect.set",
|
||||
"es6.reflect.set-prototype-of": "Reflect / Reflect.setPrototypeOf",
|
||||
|
||||
"es6.promise": {
|
||||
features: [
|
||||
"Promise / basic functionality",
|
||||
"Promise / constructor requires new",
|
||||
"Promise / Promise.prototype isn\'t an instance",
|
||||
"Promise / Promise.all",
|
||||
"Promise / Promise.all, generic iterables",
|
||||
"Promise / Promise.race",
|
||||
"Promise / Promise.race, generic iterables",
|
||||
"Promise / Promise[Symbol.species]"
|
||||
]
|
||||
},
|
||||
|
||||
"es6.symbol": {
|
||||
features: [
|
||||
"Symbol",
|
||||
"Object static methods / Object.getOwnPropertySymbols",
|
||||
"well-known symbols / Symbol.hasInstance",
|
||||
"well-known symbols / Symbol.isConcatSpreadable",
|
||||
"well-known symbols / Symbol.iterator",
|
||||
"well-known symbols / Symbol.match",
|
||||
"well-known symbols / Symbol.replace",
|
||||
"well-known symbols / Symbol.search",
|
||||
"well-known symbols / Symbol.species",
|
||||
"well-known symbols / Symbol.split",
|
||||
"well-known symbols / Symbol.toPrimitive",
|
||||
"well-known symbols / Symbol.toStringTag",
|
||||
"well-known symbols / Symbol.unscopables",
|
||||
]
|
||||
},
|
||||
|
||||
"es6.object.assign": "Object static methods / Object.assign",
|
||||
"es6.object.is": "Object static methods / Object.is",
|
||||
"es6.object.set-prototype-of": "Object static methods / Object.setPrototypeOf",
|
||||
|
||||
"es6.function.name": "function \"name\" property",
|
||||
|
||||
"es6.string.raw": "String static methods / String.raw",
|
||||
"es6.string.from-code-point": "String static methods / String.fromCodePoint",
|
||||
|
||||
"es6.string.code-point-at": "String.prototype methods / String.prototype.codePointAt",
|
||||
// "String.prototype methods / String.prototype.normalize" not implemented
|
||||
"es6.string.repeat": "String.prototype methods / String.prototype.repeat",
|
||||
"es6.string.starts-with": "String.prototype methods / String.prototype.startsWith",
|
||||
"es6.string.ends-with": "String.prototype methods / String.prototype.endsWith",
|
||||
"es6.string.includes": "String.prototype methods / String.prototype.includes",
|
||||
|
||||
"es6.regexp.flags": "RegExp.prototype properties / RegExp.prototype.flags",
|
||||
"es6.regexp.match": "RegExp.prototype properties / RegExp.prototype[Symbol.match]",
|
||||
"es6.regexp.replace": "RegExp.prototype properties / RegExp.prototype[Symbol.replace]",
|
||||
"es6.regexp.split": "RegExp.prototype properties / RegExp.prototype[Symbol.split]",
|
||||
"es6.regexp.search": "RegExp.prototype properties / RegExp.prototype[Symbol.search]",
|
||||
|
||||
"es6.array.from": "Array static methods / Array.from",
|
||||
"es6.array.of": "Array static methods / Array.of",
|
||||
|
||||
"es6.array.copy-within": "Array.prototype methods / Array.prototype.copyWithin",
|
||||
"es6.array.find": "Array.prototype methods / Array.prototype.find",
|
||||
"es6.array.find-index": "Array.prototype methods / Array.prototype.findIndex",
|
||||
"es6.array.fill": "Array.prototype methods / Array.prototype.fill",
|
||||
|
||||
"es6.array.iterator": {
|
||||
features: [
|
||||
"Array.prototype methods / Array.prototype.keys",
|
||||
// can use Symbol.iterator, not implemented in many environments
|
||||
// "Array.prototype methods / Array.prototype.values",
|
||||
"Array.prototype methods / Array.prototype.entries",
|
||||
]
|
||||
},
|
||||
|
||||
"es6.number.is-finite": "Number properties / Number.isFinite",
|
||||
"es6.number.is-integer": "Number properties / Number.isInteger",
|
||||
"es6.number.is-safe-integer": "Number properties / Number.isSafeInteger",
|
||||
"es6.number.is-nan": "Number properties / Number.isNaN",
|
||||
"es6.number.epsilon": "Number properties / Number.EPSILON",
|
||||
"es6.number.min-safe-integer": "Number properties / Number.MIN_SAFE_INTEGER",
|
||||
"es6.number.max-safe-integer": "Number properties / Number.MAX_SAFE_INTEGER",
|
||||
"es6.number.parse-float": "Number properties / Number.parseFloat",
|
||||
"es6.number.parse-int": "Number properties / Number.parseInt",
|
||||
|
||||
"es6.math.acosh": "Math methods / Math.acosh",
|
||||
"es6.math.asinh": "Math methods / Math.asinh",
|
||||
"es6.math.atanh": "Math methods / Math.atanh",
|
||||
"es6.math.cbrt": "Math methods / Math.cbrt",
|
||||
"es6.math.clz32": "Math methods / Math.clz32",
|
||||
"es6.math.cosh": "Math methods / Math.cosh",
|
||||
"es6.math.expm1": "Math methods / Math.expm1",
|
||||
"es6.math.fround": "Math methods / Math.fround",
|
||||
"es6.math.hypot": "Math methods / Math.hypot",
|
||||
"es6.math.imul": "Math methods / Math.imul",
|
||||
"es6.math.log1p": "Math methods / Math.log1p",
|
||||
"es6.math.log10": "Math methods / Math.log10",
|
||||
"es6.math.log2": "Math methods / Math.log2",
|
||||
"es6.math.sign": "Math methods / Math.sign",
|
||||
"es6.math.sinh": "Math methods / Math.sinh",
|
||||
"es6.math.tanh": "Math methods / Math.tanh",
|
||||
"es6.math.trunc": "Math methods / Math.trunc",
|
||||
};
|
||||
|
||||
const es2016 = {
|
||||
"es7.array.includes": "Array.prototype.includes",
|
||||
};
|
||||
|
||||
const es2017 = {
|
||||
"es7.object.values": "Object static methods / Object.values",
|
||||
"es7.object.entries": "Object static methods / Object.entries",
|
||||
"es7.object.get-own-property-descriptors": "Object static methods / Object.getOwnPropertyDescriptors",
|
||||
"es7.string.pad-start": "String padding / String.prototype.padStart",
|
||||
"es7.string.pad-end": "String padding / String.prototype.padEnd",
|
||||
};
|
||||
|
||||
const proposals = require("./shipped-proposals").builtIns;
|
||||
|
||||
module.exports = Object.assign({}, es2015, es2016, es2017, proposals);
|
||||
850
experimental/babel-preset-env/data/built-ins.json
Normal file
850
experimental/babel-preset-env/data/built-ins.json
Normal file
@ -0,0 +1,850 @@
|
||||
{
|
||||
"es6.typed.array-buffer": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.typed.data-view": {
|
||||
"chrome": "5",
|
||||
"opera": "12",
|
||||
"edge": "12",
|
||||
"firefox": "15",
|
||||
"safari": "5.1",
|
||||
"node": "0.12",
|
||||
"ie": "10",
|
||||
"android": "4",
|
||||
"ios": "6",
|
||||
"electron": "1.1"
|
||||
},
|
||||
"es6.typed.int8-array": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.typed.uint8-array": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.typed.uint8-clamped-array": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.typed.int16-array": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.typed.uint16-array": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.typed.int32-array": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.typed.uint32-array": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.typed.float32-array": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.typed.float64-array": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.map": {
|
||||
"chrome": "51",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.set": {
|
||||
"chrome": "51",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.weak-map": {
|
||||
"chrome": "51",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "9",
|
||||
"node": "6.5",
|
||||
"ios": "9",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.weak-set": {
|
||||
"chrome": "51",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "9",
|
||||
"node": "6.5",
|
||||
"ios": "9",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.reflect.apply": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.construct": {
|
||||
"chrome": "49",
|
||||
"edge": "13",
|
||||
"firefox": "44",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.define-property": {
|
||||
"chrome": "49",
|
||||
"edge": "13",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.delete-property": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.get": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.get-own-property-descriptor": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.get-prototype-of": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.has": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.is-extensible": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.own-keys": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.prevent-extensions": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.set": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.set-prototype-of": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.promise": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "45",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.symbol": {
|
||||
"chrome": "51",
|
||||
"firefox": "51",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.object.assign": {
|
||||
"chrome": "45",
|
||||
"edge": "12",
|
||||
"firefox": "34",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "32",
|
||||
"electron": "0.35"
|
||||
},
|
||||
"es6.object.is": {
|
||||
"chrome": "19",
|
||||
"edge": "12",
|
||||
"firefox": "22",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"android": "4.1",
|
||||
"ios": "9",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.object.set-prototype-of": {
|
||||
"chrome": "34",
|
||||
"edge": "12",
|
||||
"firefox": "31",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ie": "11",
|
||||
"ios": "9",
|
||||
"opera": "21",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.function.name": {
|
||||
"chrome": "51",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.string.raw": {
|
||||
"chrome": "41",
|
||||
"edge": "12",
|
||||
"firefox": "34",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "28",
|
||||
"electron": "0.24"
|
||||
},
|
||||
"es6.string.from-code-point": {
|
||||
"chrome": "41",
|
||||
"edge": "12",
|
||||
"firefox": "29",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "28",
|
||||
"electron": "0.24"
|
||||
},
|
||||
"es6.string.code-point-at": {
|
||||
"chrome": "41",
|
||||
"edge": "12",
|
||||
"firefox": "29",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "28",
|
||||
"electron": "0.24"
|
||||
},
|
||||
"es6.string.repeat": {
|
||||
"chrome": "41",
|
||||
"edge": "12",
|
||||
"firefox": "24",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "28",
|
||||
"electron": "0.24"
|
||||
},
|
||||
"es6.string.starts-with": {
|
||||
"chrome": "41",
|
||||
"edge": "12",
|
||||
"firefox": "29",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "28",
|
||||
"electron": "0.24"
|
||||
},
|
||||
"es6.string.ends-with": {
|
||||
"chrome": "41",
|
||||
"edge": "12",
|
||||
"firefox": "29",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "28",
|
||||
"electron": "0.24"
|
||||
},
|
||||
"es6.string.includes": {
|
||||
"chrome": "41",
|
||||
"edge": "12",
|
||||
"firefox": "40",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "28",
|
||||
"electron": "0.24"
|
||||
},
|
||||
"es6.regexp.flags": {
|
||||
"chrome": "49",
|
||||
"firefox": "37",
|
||||
"safari": "9",
|
||||
"node": "6",
|
||||
"ios": "9",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.regexp.match": {
|
||||
"chrome": "50",
|
||||
"firefox": "49",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "37",
|
||||
"electron": "1.1"
|
||||
},
|
||||
"es6.regexp.replace": {
|
||||
"chrome": "50",
|
||||
"firefox": "49",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "37",
|
||||
"electron": "1.1"
|
||||
},
|
||||
"es6.regexp.split": {
|
||||
"chrome": "50",
|
||||
"firefox": "49",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "37",
|
||||
"electron": "1.1"
|
||||
},
|
||||
"es6.regexp.search": {
|
||||
"chrome": "50",
|
||||
"firefox": "49",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "37",
|
||||
"electron": "1.1"
|
||||
},
|
||||
"es6.array.from": {
|
||||
"chrome": "51",
|
||||
"edge": "15",
|
||||
"firefox": "36",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.array.of": {
|
||||
"chrome": "45",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "32",
|
||||
"electron": "0.35"
|
||||
},
|
||||
"es6.array.copy-within": {
|
||||
"chrome": "45",
|
||||
"edge": "12",
|
||||
"firefox": "32",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "32",
|
||||
"electron": "0.35"
|
||||
},
|
||||
"es6.array.find": {
|
||||
"chrome": "45",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "4",
|
||||
"ios": "8",
|
||||
"opera": "32",
|
||||
"electron": "0.35"
|
||||
},
|
||||
"es6.array.find-index": {
|
||||
"chrome": "45",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "4",
|
||||
"ios": "8",
|
||||
"opera": "32",
|
||||
"electron": "0.35"
|
||||
},
|
||||
"es6.array.fill": {
|
||||
"chrome": "45",
|
||||
"edge": "12",
|
||||
"firefox": "31",
|
||||
"safari": "7.1",
|
||||
"node": "4",
|
||||
"ios": "8",
|
||||
"opera": "32",
|
||||
"electron": "0.35"
|
||||
},
|
||||
"es6.array.iterator": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "28",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.number.is-finite": {
|
||||
"chrome": "19",
|
||||
"edge": "12",
|
||||
"firefox": "16",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"android": "4.1",
|
||||
"ios": "9",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.number.is-integer": {
|
||||
"chrome": "34",
|
||||
"edge": "12",
|
||||
"firefox": "16",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "21",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.number.is-safe-integer": {
|
||||
"chrome": "34",
|
||||
"edge": "12",
|
||||
"firefox": "32",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "21",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.number.is-nan": {
|
||||
"chrome": "19",
|
||||
"edge": "12",
|
||||
"firefox": "15",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"android": "4.1",
|
||||
"ios": "9",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.number.epsilon": {
|
||||
"chrome": "34",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "21",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.number.min-safe-integer": {
|
||||
"chrome": "34",
|
||||
"edge": "12",
|
||||
"firefox": "31",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "21",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.number.max-safe-integer": {
|
||||
"chrome": "34",
|
||||
"edge": "12",
|
||||
"firefox": "31",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "21",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.number.parse-float": {
|
||||
"chrome": "34",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "21",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.number.parse-int": {
|
||||
"chrome": "34",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "21",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.acosh": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.asinh": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.atanh": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.cbrt": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.clz32": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "31",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.cosh": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.expm1": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.fround": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "26",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.hypot": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "27",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.imul": {
|
||||
"chrome": "30",
|
||||
"edge": "12",
|
||||
"firefox": "23",
|
||||
"safari": "7",
|
||||
"node": "0.12",
|
||||
"android": "4.4",
|
||||
"ios": "7",
|
||||
"opera": "17",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.log1p": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.log10": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.log2": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.sign": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.sinh": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.tanh": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.trunc": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es7.array.includes": {
|
||||
"chrome": "47",
|
||||
"edge": "14",
|
||||
"firefox": "43",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "34",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"es7.object.values": {
|
||||
"chrome": "54",
|
||||
"edge": "14",
|
||||
"firefox": "47",
|
||||
"safari": "10.1",
|
||||
"node": "7",
|
||||
"ios": "10.3",
|
||||
"opera": "41",
|
||||
"electron": "1.5"
|
||||
},
|
||||
"es7.object.entries": {
|
||||
"chrome": "54",
|
||||
"edge": "14",
|
||||
"firefox": "47",
|
||||
"safari": "10.1",
|
||||
"node": "7",
|
||||
"ios": "10.3",
|
||||
"opera": "41",
|
||||
"electron": "1.5"
|
||||
},
|
||||
"es7.object.get-own-property-descriptors": {
|
||||
"chrome": "54",
|
||||
"edge": "15",
|
||||
"firefox": "50",
|
||||
"safari": "10.1",
|
||||
"node": "7",
|
||||
"ios": "10.3",
|
||||
"opera": "41",
|
||||
"electron": "1.5"
|
||||
},
|
||||
"es7.string.pad-start": {
|
||||
"chrome": "57",
|
||||
"edge": "15",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "8",
|
||||
"ios": "10",
|
||||
"opera": "44",
|
||||
"electron": "1.7"
|
||||
},
|
||||
"es7.string.pad-end": {
|
||||
"chrome": "57",
|
||||
"edge": "15",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "8",
|
||||
"ios": "10",
|
||||
"opera": "44",
|
||||
"electron": "1.7"
|
||||
},
|
||||
"es7.promise.finally": {}
|
||||
}
|
||||
140
experimental/babel-preset-env/data/plugin-features.js
Normal file
140
experimental/babel-preset-env/data/plugin-features.js
Normal file
@ -0,0 +1,140 @@
|
||||
const es2015 = {
|
||||
"check-es2015-constants": {
|
||||
features: [
|
||||
"const",
|
||||
],
|
||||
},
|
||||
"transform-es2015-arrow-functions": {
|
||||
features: [
|
||||
"arrow functions",
|
||||
],
|
||||
},
|
||||
"transform-es2015-block-scoped-functions": {
|
||||
features: [
|
||||
"block-level function declaration"
|
||||
],
|
||||
},
|
||||
"transform-es2015-block-scoping": {
|
||||
features: [
|
||||
"const",
|
||||
"let",
|
||||
],
|
||||
},
|
||||
"transform-es2015-classes": {
|
||||
features: [
|
||||
"class",
|
||||
"super",
|
||||
],
|
||||
},
|
||||
"transform-es2015-computed-properties": {
|
||||
features: [
|
||||
"object literal extensions / computed properties",
|
||||
],
|
||||
},
|
||||
"transform-es2015-destructuring": {
|
||||
features: [
|
||||
"destructuring, assignment",
|
||||
"destructuring, declarations",
|
||||
"destructuring, parameters",
|
||||
],
|
||||
},
|
||||
"transform-es2015-duplicate-keys": {
|
||||
features: [
|
||||
"miscellaneous / duplicate property names in strict mode",
|
||||
],
|
||||
},
|
||||
"transform-es2015-for-of": {
|
||||
features: [
|
||||
"for..of loops",
|
||||
],
|
||||
},
|
||||
"transform-es2015-function-name": {
|
||||
features: [
|
||||
"function \"name\" property",
|
||||
]
|
||||
},
|
||||
"transform-es2015-literals": {
|
||||
features: [
|
||||
"Unicode code point escapes",
|
||||
],
|
||||
},
|
||||
"transform-es2015-object-super": {
|
||||
features: [
|
||||
"super",
|
||||
],
|
||||
},
|
||||
"transform-es2015-parameters": {
|
||||
features: [
|
||||
"default function parameters",
|
||||
"rest parameters",
|
||||
],
|
||||
},
|
||||
"transform-es2015-shorthand-properties": {
|
||||
features: [
|
||||
"object literal extensions / shorthand properties",
|
||||
],
|
||||
},
|
||||
"transform-es2015-spread": {
|
||||
features: [
|
||||
"spread (...) operator",
|
||||
],
|
||||
},
|
||||
"transform-es2015-sticky-regex": {
|
||||
features: [
|
||||
"RegExp \"y\" and \"u\" flags / \"y\" flag, lastIndex",
|
||||
"RegExp \"y\" and \"u\" flags / \"y\" flag",
|
||||
],
|
||||
},
|
||||
"transform-es2015-template-literals": {
|
||||
features: [
|
||||
"template literals",
|
||||
],
|
||||
},
|
||||
"transform-es2015-typeof-symbol": {
|
||||
features: [
|
||||
"Symbol / typeof support"
|
||||
],
|
||||
},
|
||||
"transform-es2015-unicode-regex": {
|
||||
features: [
|
||||
"RegExp \"y\" and \"u\" flags / \"u\" flag, case folding",
|
||||
"RegExp \"y\" and \"u\" flags / \"u\" flag, Unicode code point escapes",
|
||||
"RegExp \"y\" and \"u\" flags / \"u\" flag",
|
||||
],
|
||||
},
|
||||
"transform-new-target": {
|
||||
features: [
|
||||
"new.target",
|
||||
],
|
||||
},
|
||||
"transform-regenerator": {
|
||||
features: [
|
||||
"generators",
|
||||
],
|
||||
}
|
||||
};
|
||||
|
||||
const es2016 = {
|
||||
"transform-exponentiation-operator": {
|
||||
features: [
|
||||
"exponentiation (**) operator",
|
||||
],
|
||||
}
|
||||
};
|
||||
|
||||
const es2017 = {
|
||||
"transform-async-to-generator": {
|
||||
features: [
|
||||
"async functions",
|
||||
],
|
||||
},
|
||||
"syntax-trailing-function-commas": {
|
||||
features: [
|
||||
"trailing commas in function syntax",
|
||||
],
|
||||
}
|
||||
};
|
||||
|
||||
const proposals = require("./shipped-proposals").features;
|
||||
|
||||
module.exports = Object.assign({}, es2015, es2016, es2017, proposals);
|
||||
250
experimental/babel-preset-env/data/plugins.json
Normal file
250
experimental/babel-preset-env/data/plugins.json
Normal file
@ -0,0 +1,250 @@
|
||||
{
|
||||
"check-es2015-constants": {
|
||||
"chrome": "49",
|
||||
"edge": "14",
|
||||
"firefox": "51",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"transform-es2015-arrow-functions": {
|
||||
"chrome": "47",
|
||||
"edge": "13",
|
||||
"firefox": "45",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "34",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-es2015-block-scoped-functions": {
|
||||
"chrome": "41",
|
||||
"edge": "12",
|
||||
"firefox": "46",
|
||||
"safari": "10",
|
||||
"node": "4",
|
||||
"ie": "11",
|
||||
"ios": "10",
|
||||
"opera": "28",
|
||||
"electron": "0.24"
|
||||
},
|
||||
"transform-es2015-block-scoping": {
|
||||
"chrome": "49",
|
||||
"edge": "14",
|
||||
"firefox": "51",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"transform-es2015-classes": {
|
||||
"chrome": "46",
|
||||
"edge": "13",
|
||||
"firefox": "45",
|
||||
"safari": "10",
|
||||
"node": "5",
|
||||
"ios": "10",
|
||||
"opera": "33",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-es2015-computed-properties": {
|
||||
"chrome": "44",
|
||||
"edge": "12",
|
||||
"firefox": "34",
|
||||
"safari": "7.1",
|
||||
"node": "4",
|
||||
"ios": "8",
|
||||
"opera": "31",
|
||||
"electron": "0.31"
|
||||
},
|
||||
"transform-es2015-destructuring": {
|
||||
"chrome": "51",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-es2015-duplicate-keys": {
|
||||
"chrome": "42",
|
||||
"edge": "12",
|
||||
"firefox": "34",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "29",
|
||||
"electron": "0.27"
|
||||
},
|
||||
"transform-es2015-for-of": {
|
||||
"chrome": "51",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-es2015-function-name": {
|
||||
"chrome": "51",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-es2015-literals": {
|
||||
"chrome": "44",
|
||||
"edge": "12",
|
||||
"firefox": "53",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "31",
|
||||
"electron": "0.31"
|
||||
},
|
||||
"transform-es2015-object-super": {
|
||||
"chrome": "46",
|
||||
"edge": "13",
|
||||
"firefox": "45",
|
||||
"safari": "10",
|
||||
"node": "5",
|
||||
"ios": "10",
|
||||
"opera": "33",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-es2015-parameters": {
|
||||
"chrome": "49",
|
||||
"edge": "14",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"transform-es2015-shorthand-properties": {
|
||||
"chrome": "43",
|
||||
"edge": "12",
|
||||
"firefox": "33",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "30",
|
||||
"electron": "0.29"
|
||||
},
|
||||
"transform-es2015-spread": {
|
||||
"chrome": "46",
|
||||
"edge": "13",
|
||||
"firefox": "36",
|
||||
"safari": "10",
|
||||
"node": "5",
|
||||
"ios": "10",
|
||||
"opera": "33",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-es2015-sticky-regex": {
|
||||
"chrome": "49",
|
||||
"edge": "13",
|
||||
"firefox": "3",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"transform-es2015-template-literals": {
|
||||
"chrome": "41",
|
||||
"edge": "13",
|
||||
"firefox": "34",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "28",
|
||||
"electron": "0.24"
|
||||
},
|
||||
"transform-es2015-typeof-symbol": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "36",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"transform-es2015-unicode-regex": {
|
||||
"chrome": "50",
|
||||
"edge": "13",
|
||||
"firefox": "46",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "37",
|
||||
"electron": "1.1"
|
||||
},
|
||||
"transform-new-target": {
|
||||
"chrome": "46",
|
||||
"edge": "14",
|
||||
"firefox": "41",
|
||||
"safari": "10",
|
||||
"node": "5",
|
||||
"ios": "10",
|
||||
"opera": "33",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-regenerator": {
|
||||
"chrome": "50",
|
||||
"edge": "13",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "37",
|
||||
"electron": "1.1"
|
||||
},
|
||||
"transform-exponentiation-operator": {
|
||||
"chrome": "52",
|
||||
"edge": "14",
|
||||
"firefox": "52",
|
||||
"safari": "10.1",
|
||||
"node": "7",
|
||||
"ios": "10.3",
|
||||
"opera": "39",
|
||||
"electron": "1.3"
|
||||
},
|
||||
"transform-async-to-generator": {
|
||||
"chrome": "55",
|
||||
"edge": "15",
|
||||
"firefox": "52",
|
||||
"safari": "10.1",
|
||||
"node": "7.6",
|
||||
"ios": "10.3",
|
||||
"opera": "42",
|
||||
"electron": "1.6"
|
||||
},
|
||||
"syntax-trailing-function-commas": {
|
||||
"chrome": "58",
|
||||
"edge": "14",
|
||||
"firefox": "52",
|
||||
"safari": "10",
|
||||
"node": "8",
|
||||
"ios": "10",
|
||||
"opera": "45",
|
||||
"electron": "1.7"
|
||||
},
|
||||
"transform-async-generator-functions": {},
|
||||
"transform-object-rest-spread": {
|
||||
"chrome": "60",
|
||||
"firefox": "55",
|
||||
"node": "8.3",
|
||||
"opera": "47"
|
||||
},
|
||||
"transform-optional-catch-binding": {},
|
||||
"transform-unicode-property-regex": {}
|
||||
}
|
||||
22
experimental/babel-preset-env/data/shipped-proposals.js
Normal file
22
experimental/babel-preset-env/data/shipped-proposals.js
Normal file
@ -0,0 +1,22 @@
|
||||
// These mappings represent the builtin/feature proposals that have been
|
||||
// shipped by browsers, and are enabled by the `shippedProposals` option.
|
||||
|
||||
const builtIns = {
|
||||
"es7.promise.finally": "Promise.prototype.finally"
|
||||
};
|
||||
|
||||
const features = {
|
||||
"transform-async-generator-functions": "Asynchronous Iterators",
|
||||
"transform-object-rest-spread": "object rest/spread properties",
|
||||
"transform-optional-catch-binding": "optional catch binding",
|
||||
"transform-unicode-property-regex": "RegExp Unicode Property Escapes",
|
||||
};
|
||||
|
||||
const pluginSyntaxMap = new Map([
|
||||
["transform-async-generator-functions", "syntax-async-generators"],
|
||||
["transform-object-rest-spread", "syntax-object-rest-spread"],
|
||||
["transform-optional-catch-binding", "syntax-optional-catch-binding"],
|
||||
["transform-unicode-property-regex", null],
|
||||
]);
|
||||
|
||||
module.exports = { builtIns, features, pluginSyntaxMap };
|
||||
81
experimental/babel-preset-env/flow-typed/npm/semver_v5.1.x.js
vendored
Normal file
81
experimental/babel-preset-env/flow-typed/npm/semver_v5.1.x.js
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
// flow-typed signature: c5f918cd3de18b19a20558e6f3bbcc84
|
||||
// flow-typed version: cdd17a64e0/semver_v5.1.x/flow_>=v0.27.0
|
||||
|
||||
// List of members taken from here: https://www.npmjs.com/package/semver/#functions
|
||||
// TODO support the `loose` parameter
|
||||
// TODO support SemVer instances as input parameters
|
||||
declare module 'semver' {
|
||||
declare type Release =
|
||||
'major' |
|
||||
'premajor' |
|
||||
'minor' |
|
||||
'preminor' |
|
||||
'patch' |
|
||||
'prepatch' |
|
||||
'prerelease';
|
||||
|
||||
// The supported comparators are taken from the source here:
|
||||
// https://github.com/npm/node-semver/blob/8bd070b550db2646362c9883c8d008d32f66a234/semver.js#L623
|
||||
declare type Comparator =
|
||||
'===' |
|
||||
'!==' |
|
||||
'==' |
|
||||
'=' |
|
||||
'' | // Not sure why you would want this, but whatever.
|
||||
'!=' |
|
||||
'>' |
|
||||
'>=' |
|
||||
'<' |
|
||||
'<=';
|
||||
|
||||
declare class SemVer {
|
||||
loose: ?boolean,
|
||||
raw: string,
|
||||
major: number,
|
||||
minor: number,
|
||||
patch: number,
|
||||
prerelease: Array<string | number>,
|
||||
build: Array<string>,
|
||||
version: string,
|
||||
}
|
||||
|
||||
// Functions
|
||||
declare function valid(v: string): string | null;
|
||||
declare function inc(v: string, release: Release): string | null;
|
||||
declare function major(v: string): number;
|
||||
declare function minor(v: string): number;
|
||||
declare function patch(v: string): number;
|
||||
|
||||
// Comparison
|
||||
declare function gt(v1: string, v2: string): boolean;
|
||||
declare function gte(v1: string, v2: string): boolean;
|
||||
declare function lt(v1: string, v2: string): boolean;
|
||||
declare function lte(v1: string, v2: string): boolean;
|
||||
declare function eq(v1: string, v2: string): boolean;
|
||||
declare function neq(v1: string, v2: string): boolean;
|
||||
declare function cmp(v1: string, comparator: Comparator, v2: string): boolean;
|
||||
declare function compare(v1: string, v2: string): -1 | 0 | 1;
|
||||
declare function rcompare(v1: string, v2: string): -1 | 0 | 1;
|
||||
declare function diff(v1: string, v2: string): ?Release;
|
||||
|
||||
// Ranges
|
||||
declare function validRange(r: string): string | null;
|
||||
declare function satisfies(version: string, range: string): boolean;
|
||||
declare function maxSatisfying(versions: Array<string>, range: string): string | null;
|
||||
declare function gtr(version: string, range: string): boolean;
|
||||
declare function ltr(version: string, range: string): boolean;
|
||||
declare function outside(version: string, range: string, hilo: '>' | '<'): boolean;
|
||||
|
||||
// Not explicitly documented
|
||||
declare function parse(version: string): ?SemVer;
|
||||
|
||||
declare class Range {
|
||||
set: Array<Array<{semver: SemVer}>>;
|
||||
|
||||
constructor(range: string, loose?: boolean): Range;
|
||||
|
||||
format(): string;
|
||||
test(version: string): boolean;
|
||||
toString(): string;
|
||||
}
|
||||
}
|
||||
154
experimental/babel-preset-env/package.json
Normal file
154
experimental/babel-preset-env/package.json
Normal file
@ -0,0 +1,154 @@
|
||||
{
|
||||
"name": "babel-preset-env",
|
||||
"version": "2.0.0-beta.2",
|
||||
"description": "A Babel preset for each environment.",
|
||||
"author": "Henry Zhu <hi@henryzoo.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/babel/babel-preset-env",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
"build": "rimraf lib && babel src -d lib",
|
||||
"build-data": "node ./scripts/build-data.js",
|
||||
"changelog": "git log `git describe --tags --abbrev=0`..HEAD --pretty=format:' * %s (%an)' | grep -v 'Merge pull request'",
|
||||
"coverage": "BABEL_ENV=test nyc npm run test",
|
||||
"coverage-ci": "nyc report --reporter=json && codecov -f coverage/coverage-final.json",
|
||||
"dev": "babel -w src -d lib",
|
||||
"fix": "eslint . --fix",
|
||||
"flow": "flow",
|
||||
"format": "prettier --trailing-comma all --write \"src/*.js\" \"test/*.js\" && prettier --trailing-comma es5 --write \"scripts/*.js\"",
|
||||
"lint": "eslint .",
|
||||
"precommit": "lint-staged",
|
||||
"prepublish": "npm run build",
|
||||
"test": "npm run build && npm run flow && npm run test-only",
|
||||
"test-ci": "nyc npm run test",
|
||||
"test-only": "mocha ./test --compilers js:babel-register -t 10000"
|
||||
},
|
||||
"dependencies": {
|
||||
"babel-plugin-check-es2015-constants": "7.0.0-beta.2",
|
||||
"babel-plugin-syntax-async-generators": "7.0.0-beta.0",
|
||||
"babel-plugin-syntax-object-rest-spread": "7.0.0-beta.0",
|
||||
"babel-plugin-syntax-optional-catch-binding": "7.0.0-beta.0",
|
||||
"babel-plugin-syntax-trailing-function-commas": "7.0.0-beta.0",
|
||||
"babel-plugin-transform-async-to-generator": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-async-generator-functions": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-arrow-functions": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-block-scoped-functions": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-block-scoping": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-classes": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-computed-properties": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-destructuring": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-duplicate-keys": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-for-of": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-function-name": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-literals": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-modules-amd": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-modules-commonjs": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-modules-systemjs": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-modules-umd": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-object-super": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-parameters": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-shorthand-properties": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-spread": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-sticky-regex": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-template-literals": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-typeof-symbol": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-es2015-unicode-regex": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-exponentiation-operator": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-new-target": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-regenerator": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-object-rest-spread": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-optional-catch-binding": "7.0.0-beta.2",
|
||||
"babel-plugin-transform-unicode-property-regex": "^2.0.5",
|
||||
"browserslist": "^2.4.0",
|
||||
"invariant": "^2.2.2",
|
||||
"semver": "^5.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "7.0.0-beta.2",
|
||||
"babel-eslint": "^8.0.1",
|
||||
"babel-helper-fixtures": "7.0.0-beta.2",
|
||||
"babel-helper-plugin-test-runner": "7.0.0-beta.2",
|
||||
"babel-plugin-istanbul": "^4.1.5",
|
||||
"babel-plugin-transform-flow-strip-types": "7.0.0-beta.2",
|
||||
"babel-preset-env": "2.0.0-beta.2",
|
||||
"babel-register": "7.0.0-beta.2",
|
||||
"chai": "^4.0.2",
|
||||
"codecov": "^2.2.0",
|
||||
"compat-table": "kangax/compat-table#b8477cc0f6d65c000c46213e654d19f350de9fa8",
|
||||
"eslint": "^4.8.0",
|
||||
"eslint-config-babel": "^7.0.2",
|
||||
"eslint-plugin-flowtype": "^2.37.0",
|
||||
"flow-bin": "^0.46.0",
|
||||
"fs-extra": "^3.0.1",
|
||||
"husky": "^0.13.2",
|
||||
"lint-staged": "^4.0.0",
|
||||
"lodash": "^4.17.4",
|
||||
"mocha": "^3.4.2",
|
||||
"nyc": "^11.0.3",
|
||||
"prettier": "1.5.2",
|
||||
"rimraf": "^2.6.1"
|
||||
},
|
||||
"babel": {
|
||||
"presets": [
|
||||
[
|
||||
"env",
|
||||
{
|
||||
"targets": {
|
||||
"node": 4
|
||||
},
|
||||
"loose": true
|
||||
}
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
"transform-flow-strip-types"
|
||||
],
|
||||
"env": {
|
||||
"test": {
|
||||
"plugins": [
|
||||
"istanbul"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"changelog": {
|
||||
"repo": "babel/babel-preset-env",
|
||||
"labels": {
|
||||
"Tag: Breaking Change": ":boom: Breaking Change",
|
||||
"Tag: New Feature": ":rocket: New Feature",
|
||||
"Tag: Bug Fix": ":bug: Bug Fix",
|
||||
"Tag: Polish": ":nail_care: Polish",
|
||||
"Tag: Docs": ":memo: Documentation",
|
||||
"Tag: Internal": ":house: Internal",
|
||||
"Tag: Chore": "Chore",
|
||||
"Tag: Deprecation": "Deprecation"
|
||||
}
|
||||
},
|
||||
"nyc": {
|
||||
"all": true,
|
||||
"include": [
|
||||
"src/*.js"
|
||||
],
|
||||
"instrument": false,
|
||||
"sourceMap": false
|
||||
},
|
||||
"lint-staged": {
|
||||
"src/**/*.js": [
|
||||
"prettier --trailing-comma all --write",
|
||||
"git add"
|
||||
],
|
||||
"scripts/*.js": [
|
||||
"prettier --trailing-comma es5 --write",
|
||||
"git add"
|
||||
],
|
||||
"test/*.js": [
|
||||
"prettier --trailing-comma all --write",
|
||||
"git add"
|
||||
],
|
||||
"package.json": [
|
||||
"node ./scripts/yarn-install.js",
|
||||
"git add yarn.lock"
|
||||
]
|
||||
}
|
||||
}
|
||||
287
experimental/babel-preset-env/scripts/build-data.js
Normal file
287
experimental/babel-preset-env/scripts/build-data.js
Normal file
@ -0,0 +1,287 @@
|
||||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const flattenDeep = require("lodash/flattenDeep");
|
||||
const isEqual = require("lodash/isEqual");
|
||||
const mapValues = require("lodash/mapValues");
|
||||
const pickBy = require("lodash/pickBy");
|
||||
const electronToChromiumVersions = require("electron-to-chromium").versions;
|
||||
|
||||
const electronToChromiumKeys = Object.keys(
|
||||
electronToChromiumVersions
|
||||
).reverse();
|
||||
|
||||
const chromiumToElectronMap = electronToChromiumKeys.reduce((all, electron) => {
|
||||
all[electronToChromiumVersions[electron]] = +electron;
|
||||
return all;
|
||||
}, {});
|
||||
const chromiumToElectronVersions = Object.keys(chromiumToElectronMap);
|
||||
|
||||
const findClosestElectronVersion = targetVersion => {
|
||||
const chromiumVersionsLength = chromiumToElectronVersions.length;
|
||||
const maxChromium = +chromiumToElectronVersions[chromiumVersionsLength - 1];
|
||||
if (targetVersion > maxChromium) return null;
|
||||
|
||||
const closestChrome = chromiumToElectronVersions.find(
|
||||
version => targetVersion <= version
|
||||
);
|
||||
return chromiumToElectronMap[closestChrome];
|
||||
};
|
||||
|
||||
const chromiumToElectron = chromium =>
|
||||
chromiumToElectronMap[chromium] || findClosestElectronVersion(chromium);
|
||||
|
||||
const renameTests = (tests, getName, category) =>
|
||||
tests.map(test =>
|
||||
Object.assign({}, test, { name: getName(test.name), category })
|
||||
);
|
||||
|
||||
// The following is adapted from compat-table:
|
||||
// https://github.com/kangax/compat-table/blob/gh-pages/build.js
|
||||
//
|
||||
// It parses and interpolates data so environments that "equal" other
|
||||
// environments (node4 and chrome45), as well as familial relationships (edge
|
||||
// and ie11) can be handled properly.
|
||||
|
||||
const envs = require("compat-table/environments");
|
||||
|
||||
const byTestSuite = suite => browser => {
|
||||
return Array.isArray(browser.test_suites)
|
||||
? browser.test_suites.indexOf(suite) > -1
|
||||
: true;
|
||||
};
|
||||
|
||||
const compatSources = [
|
||||
"es6",
|
||||
"es2016plus",
|
||||
"esnext",
|
||||
].reduce((result, source) => {
|
||||
const data = require(`compat-table/data-${source}`);
|
||||
data.browsers = pickBy(envs, byTestSuite(source));
|
||||
result.push(data);
|
||||
return result;
|
||||
}, []);
|
||||
|
||||
const interpolateAllResults = (rawBrowsers, tests) => {
|
||||
const interpolateResults = res => {
|
||||
let browser;
|
||||
let prevBrowser;
|
||||
let result;
|
||||
let prevResult;
|
||||
let prevBid;
|
||||
|
||||
for (const bid in rawBrowsers) {
|
||||
// For browsers that are essentially equal to other browsers,
|
||||
// copy over the results.
|
||||
browser = rawBrowsers[bid];
|
||||
if (browser.equals && res[bid] === undefined) {
|
||||
result = res[browser.equals];
|
||||
res[bid] =
|
||||
browser.ignore_flagged && result === "flagged" ? false : result;
|
||||
// For each browser, check if the previous browser has the same
|
||||
// browser full name (e.g. Firefox) or family name (e.g. Chakra) as this one.
|
||||
} else if (
|
||||
prevBrowser &&
|
||||
(prevBrowser.full.replace(/,.+$/, "") ===
|
||||
browser.full.replace(/,.+$/, "") ||
|
||||
(browser.family !== undefined &&
|
||||
prevBrowser.family === browser.family))
|
||||
) {
|
||||
// For each test, check if the previous browser has a result
|
||||
// that this browser lacks.
|
||||
result = res[bid];
|
||||
prevResult = res[prevBid];
|
||||
if (prevResult !== undefined && result === undefined) {
|
||||
res[bid] = prevResult;
|
||||
}
|
||||
}
|
||||
prevBrowser = browser;
|
||||
prevBid = bid;
|
||||
}
|
||||
};
|
||||
|
||||
// Now print the results.
|
||||
tests.forEach(function(t) {
|
||||
// Calculate the result totals for tests which consist solely of subtests.
|
||||
if ("subtests" in t) {
|
||||
t.subtests.forEach(function(e) {
|
||||
interpolateResults(e.res);
|
||||
});
|
||||
} else {
|
||||
interpolateResults(t.res);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
compatSources.forEach(({ browsers, tests }) =>
|
||||
interpolateAllResults(browsers, tests)
|
||||
);
|
||||
|
||||
// End of compat-table code adaptation
|
||||
|
||||
const environments = [
|
||||
"chrome",
|
||||
"opera",
|
||||
"edge",
|
||||
"firefox",
|
||||
"safari",
|
||||
"node",
|
||||
"ie",
|
||||
"android",
|
||||
"ios",
|
||||
"phantom",
|
||||
];
|
||||
|
||||
const compatibilityTests = flattenDeep(
|
||||
compatSources.map(data =>
|
||||
data.tests.map(test => {
|
||||
return test.subtests
|
||||
? [
|
||||
test,
|
||||
renameTests(
|
||||
test.subtests,
|
||||
name => test.name + " / " + name,
|
||||
test.category
|
||||
),
|
||||
]
|
||||
: test;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
const getLowestImplementedVersion = ({ features }, env) => {
|
||||
const tests = compatibilityTests
|
||||
.filter(test => {
|
||||
return (
|
||||
features.indexOf(test.name) >= 0 ||
|
||||
// for features === ["DataView"]
|
||||
// it covers "DataView (Int8)" and "DataView (UInt8)"
|
||||
(features.length === 1 && test.name.indexOf(features[0]) === 0)
|
||||
);
|
||||
})
|
||||
.reduce((result, test) => {
|
||||
const isBuiltIn =
|
||||
test.category === "built-ins" ||
|
||||
test.category === "built-in extensions";
|
||||
|
||||
if (!test.subtests) {
|
||||
result.push({
|
||||
name: test.name,
|
||||
res: test.res,
|
||||
isBuiltIn,
|
||||
});
|
||||
} else {
|
||||
test.subtests.forEach(subtest =>
|
||||
result.push({
|
||||
name: `${test.name}/${subtest.name}`,
|
||||
res: subtest.res,
|
||||
isBuiltIn,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
}, []);
|
||||
|
||||
const envTests = tests.map(({ res: test, isBuiltIn }, i) => {
|
||||
// Babel itself doesn't implement the feature correctly,
|
||||
// don't count against it
|
||||
// only doing this for built-ins atm
|
||||
if (!test.babel && isBuiltIn) {
|
||||
return "-1";
|
||||
}
|
||||
|
||||
return (
|
||||
Object.keys(test)
|
||||
.filter(t => t.startsWith(env))
|
||||
// Babel assumes strict mode
|
||||
.filter(
|
||||
test => tests[i].res[test] === true || tests[i].res[test] === "strict"
|
||||
)
|
||||
// normalize some keys
|
||||
.map(test => test.replace("_", "."))
|
||||
.filter(test => !isNaN(parseFloat(test.replace(env, ""))))
|
||||
.shift()
|
||||
);
|
||||
});
|
||||
|
||||
const envFiltered = envTests.filter(t => t);
|
||||
if (envTests.length > envFiltered.length || envTests.length === 0) {
|
||||
// envTests.forEach((test, i) => {
|
||||
// if (!test) {
|
||||
// // print unsupported features
|
||||
// if (env === 'node') {
|
||||
// console.log(`ENV(${env}): ${tests[i].name}`);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
return null;
|
||||
}
|
||||
|
||||
return envTests.map(str => Number(str.replace(env, ""))).reduce((a, b) => {
|
||||
return a < b ? b : a;
|
||||
});
|
||||
};
|
||||
|
||||
const generateData = (environments, features) => {
|
||||
return mapValues(features, options => {
|
||||
if (!options.features) {
|
||||
options = {
|
||||
features: [options],
|
||||
};
|
||||
}
|
||||
|
||||
const plugin = {};
|
||||
|
||||
environments.forEach(env => {
|
||||
const version = getLowestImplementedVersion(options, env);
|
||||
|
||||
if (version !== null) {
|
||||
plugin[env] = version.toString();
|
||||
}
|
||||
});
|
||||
|
||||
if (plugin.chrome) {
|
||||
// add opera
|
||||
if (plugin.chrome >= 28) {
|
||||
plugin.opera = (plugin.chrome - 13).toString();
|
||||
} else if (plugin.chrome === 5) {
|
||||
plugin.opera = "12";
|
||||
}
|
||||
|
||||
// add electron
|
||||
const electronVersion = chromiumToElectron(plugin.chrome);
|
||||
if (electronVersion) {
|
||||
plugin.electron = electronVersion.toString();
|
||||
}
|
||||
}
|
||||
|
||||
return plugin;
|
||||
});
|
||||
};
|
||||
|
||||
["plugin", "built-in"].forEach(target => {
|
||||
const newData = generateData(
|
||||
environments,
|
||||
require(`../data/${target}-features`)
|
||||
);
|
||||
const dataPath = path.join(__dirname, `../data/${target}s.json`);
|
||||
|
||||
if (process.argv[2] === "--check") {
|
||||
const currentData = require(dataPath);
|
||||
|
||||
if (!isEqual(currentData, newData)) {
|
||||
console.error(
|
||||
"The newly generated plugin/built-in data does not match the current " +
|
||||
"files. Re-run `npm run build-data`."
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
fs.writeFileSync(dataPath, `${JSON.stringify(newData, null, 2)}\n`);
|
||||
});
|
||||
111
experimental/babel-preset-env/scripts/smoke-test.js
Executable file
111
experimental/babel-preset-env/scripts/smoke-test.js
Executable file
@ -0,0 +1,111 @@
|
||||
const fs = require("fs-extra");
|
||||
const execSync = require("child_process").execSync;
|
||||
const path = require("path");
|
||||
const pkg = require("../package.json");
|
||||
|
||||
let errorOccurred = false;
|
||||
|
||||
const tempFolderPath = path.join(__dirname, "../tmp");
|
||||
const packPath = path.join(__dirname, `../babel-preset-env-${pkg.version}.tgz`);
|
||||
|
||||
try {
|
||||
console.log("Creating package");
|
||||
execSync("npm pack");
|
||||
|
||||
console.log("Setting up smoke test dependencies");
|
||||
|
||||
fs.ensureDirSync(tempFolderPath);
|
||||
process.chdir(tempFolderPath);
|
||||
|
||||
const babelCliVersion = pkg.devDependencies["babel-cli"];
|
||||
|
||||
if (!babelCliVersion) {
|
||||
throw new Error("Could not read version of babel-cli from package.json");
|
||||
}
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(tempFolderPath, "package.json"),
|
||||
`
|
||||
{
|
||||
"name": "babel-preset-env-smoke-test",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"build": "babel index.js --out-file index.es6"
|
||||
},
|
||||
"dependencies": {
|
||||
"babel-cli": "${babelCliVersion}",
|
||||
"babel-preset-env": "${packPath}"
|
||||
}
|
||||
}
|
||||
`
|
||||
);
|
||||
|
||||
execSync("npm install");
|
||||
|
||||
console.log("Setting up 'usage' smoke test");
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(tempFolderPath, ".babelrc"),
|
||||
`
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
modules: false,
|
||||
useBuiltIns: "usage"
|
||||
}]
|
||||
]
|
||||
}
|
||||
`
|
||||
);
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(tempFolderPath, "index.js"),
|
||||
`
|
||||
const foo = new Promise((resolve) => {
|
||||
resolve(new Map());
|
||||
});
|
||||
`
|
||||
);
|
||||
|
||||
console.log("Running 'usage' smoke test");
|
||||
|
||||
execSync("npm run build");
|
||||
|
||||
console.log("Setting up 'entry' smoke test");
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(tempFolderPath, ".babelrc"),
|
||||
`
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
modules: false,
|
||||
useBuiltIns: "entry"
|
||||
}]
|
||||
]
|
||||
}
|
||||
`
|
||||
);
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(tempFolderPath, "index.js"),
|
||||
`
|
||||
import "babel-polyfill";
|
||||
1 ** 2;
|
||||
`
|
||||
);
|
||||
|
||||
console.log("Running 'entry' smoke test");
|
||||
|
||||
execSync("npm run build");
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
errorOccurred = true;
|
||||
}
|
||||
|
||||
console.log("Cleaning up");
|
||||
fs.removeSync(tempFolderPath);
|
||||
fs.removeSync(packPath);
|
||||
|
||||
process.exit(errorOccurred ? 1 : 0);
|
||||
13
experimental/babel-preset-env/scripts/yarn-install.js
Normal file
13
experimental/babel-preset-env/scripts/yarn-install.js
Normal file
@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
const exec = require("child_process").exec;
|
||||
|
||||
const runIfYarn = fn => {
|
||||
exec("yarn -V", error => {
|
||||
if (error === null) fn();
|
||||
});
|
||||
};
|
||||
runIfYarn(() => {
|
||||
console.log("`package.json` was changed. Running yarn...🐈");
|
||||
exec("yarn");
|
||||
});
|
||||
37
experimental/babel-preset-env/src/available-plugins.js
Normal file
37
experimental/babel-preset-env/src/available-plugins.js
Normal file
@ -0,0 +1,37 @@
|
||||
export default {
|
||||
"check-es2015-constants": require("babel-plugin-check-es2015-constants"),
|
||||
"syntax-async-generators": require("babel-plugin-syntax-async-generators"),
|
||||
"syntax-object-rest-spread": require("babel-plugin-syntax-object-rest-spread"),
|
||||
"syntax-optional-catch-binding": require("babel-plugin-syntax-optional-catch-binding"),
|
||||
"syntax-trailing-function-commas": require("babel-plugin-syntax-trailing-function-commas"),
|
||||
"transform-async-to-generator": require("babel-plugin-transform-async-to-generator"),
|
||||
"transform-async-generator-functions": require("babel-plugin-transform-async-generator-functions"),
|
||||
"transform-es2015-arrow-functions": require("babel-plugin-transform-es2015-arrow-functions"),
|
||||
"transform-es2015-block-scoped-functions": require("babel-plugin-transform-es2015-block-scoped-functions"),
|
||||
"transform-es2015-block-scoping": require("babel-plugin-transform-es2015-block-scoping"),
|
||||
"transform-es2015-classes": require("babel-plugin-transform-es2015-classes"),
|
||||
"transform-es2015-computed-properties": require("babel-plugin-transform-es2015-computed-properties"),
|
||||
"transform-es2015-destructuring": require("babel-plugin-transform-es2015-destructuring"),
|
||||
"transform-es2015-duplicate-keys": require("babel-plugin-transform-es2015-duplicate-keys"),
|
||||
"transform-es2015-for-of": require("babel-plugin-transform-es2015-for-of"),
|
||||
"transform-es2015-function-name": require("babel-plugin-transform-es2015-function-name"),
|
||||
"transform-es2015-literals": require("babel-plugin-transform-es2015-literals"),
|
||||
"transform-es2015-modules-amd": require("babel-plugin-transform-es2015-modules-amd"),
|
||||
"transform-es2015-modules-commonjs": require("babel-plugin-transform-es2015-modules-commonjs"),
|
||||
"transform-es2015-modules-systemjs": require("babel-plugin-transform-es2015-modules-systemjs"),
|
||||
"transform-es2015-modules-umd": require("babel-plugin-transform-es2015-modules-umd"),
|
||||
"transform-es2015-object-super": require("babel-plugin-transform-es2015-object-super"),
|
||||
"transform-es2015-parameters": require("babel-plugin-transform-es2015-parameters"),
|
||||
"transform-es2015-shorthand-properties": require("babel-plugin-transform-es2015-shorthand-properties"),
|
||||
"transform-es2015-spread": require("babel-plugin-transform-es2015-spread"),
|
||||
"transform-es2015-sticky-regex": require("babel-plugin-transform-es2015-sticky-regex"),
|
||||
"transform-es2015-template-literals": require("babel-plugin-transform-es2015-template-literals"),
|
||||
"transform-es2015-typeof-symbol": require("babel-plugin-transform-es2015-typeof-symbol"),
|
||||
"transform-es2015-unicode-regex": require("babel-plugin-transform-es2015-unicode-regex"),
|
||||
"transform-exponentiation-operator": require("babel-plugin-transform-exponentiation-operator"),
|
||||
"transform-new-target": require("babel-plugin-transform-new-target"),
|
||||
"transform-object-rest-spread": require("babel-plugin-transform-object-rest-spread"),
|
||||
"transform-optional-catch-binding": require("babel-plugin-transform-optional-catch-binding"),
|
||||
"transform-regenerator": require("babel-plugin-transform-regenerator"),
|
||||
"transform-unicode-property-regex": require("babel-plugin-transform-unicode-property-regex"),
|
||||
};
|
||||
109
experimental/babel-preset-env/src/built-in-definitions.js
Normal file
109
experimental/babel-preset-env/src/built-in-definitions.js
Normal file
@ -0,0 +1,109 @@
|
||||
// TODO: this is the opposite of built-in-features so maybe generate one from the other?
|
||||
export const definitions = {
|
||||
builtins: {
|
||||
DataView: "es6.typed.data-view",
|
||||
Int8Array: "es6.typed.int8-array",
|
||||
Uint8Array: "es6.typed.uint8-array",
|
||||
Uint8ClampedArray: "es6.typed.uint8-clamped-array",
|
||||
Int16Array: "es6.typed.int16-array",
|
||||
Uint16Array: "es6.typed.uint16-array",
|
||||
Int32Array: "es6.typed.int32-array",
|
||||
Uint32Array: "es6.typed.uint32-array",
|
||||
Float32Array: "es6.typed.float32-array",
|
||||
Float64Array: "es6.typed.float64-array",
|
||||
Map: "es6.map",
|
||||
Set: "es6.set",
|
||||
WeakMap: "es6.weak-map",
|
||||
WeakSet: "es6.weak-set",
|
||||
Promise: "es6.promise",
|
||||
Symbol: "es6.symbol",
|
||||
},
|
||||
|
||||
instanceMethods: {
|
||||
name: ["es6.function.name"],
|
||||
fromCodePoint: ["es6.string.from-code-point"],
|
||||
codePointAt: ["es6.string.code-point-at"],
|
||||
repeat: ["es6.string.repeat"],
|
||||
startsWith: ["es6.string.starts-with"],
|
||||
endsWith: ["es6.string.ends-with"],
|
||||
includes: ["es6.string.includes", "es7.array.includes"],
|
||||
flags: ["es6.regexp.flags"],
|
||||
match: ["es6.regexp.match"],
|
||||
replace: ["es6.regexp.replace"],
|
||||
split: ["es6.regexp.split"],
|
||||
search: ["es6.regexp.search"],
|
||||
copyWithin: ["es6.array.copy-within"],
|
||||
find: ["es6.array.find"],
|
||||
findIndex: ["es6.array.find-index"],
|
||||
fill: ["es6.array.fill"],
|
||||
padStart: ["es7.string.pad-start"],
|
||||
padEnd: ["es7.string.pad-end"],
|
||||
},
|
||||
|
||||
staticMethods: {
|
||||
Array: {
|
||||
from: "es6.array.from",
|
||||
of: "es6.array.of",
|
||||
},
|
||||
|
||||
Object: {
|
||||
assign: "es6.object.assign",
|
||||
is: "es6.object.is",
|
||||
getOwnPropertySymbols: "es6.object.get-own-property-symbols",
|
||||
setPrototypeOf: "es6.object.set-prototype-of",
|
||||
values: "es7.object.values",
|
||||
entries: "es7.object.entries",
|
||||
getOwnPropertyDescriptors: "es7.object.get-own-property-descriptors",
|
||||
},
|
||||
|
||||
Math: {
|
||||
acosh: "es6.math.acosh",
|
||||
asinh: "es6.math.asinh",
|
||||
atanh: "es6.math.atanh",
|
||||
cbrt: "es6.math.cbrt",
|
||||
clz32: "es6.math.clz32",
|
||||
cosh: "es6.math.cosh",
|
||||
expm1: "es6.math.expm1",
|
||||
fround: "es6.math.fround",
|
||||
hypot: "es6.math.hypot",
|
||||
imul: "es6.math.imul",
|
||||
log1p: "es6.math.log1p",
|
||||
log10: "es6.math.log10",
|
||||
log2: "es6.math.log2",
|
||||
sign: "es6.math.sign",
|
||||
sinh: "es6.math.sinh",
|
||||
tanh: "es6.math.tanh",
|
||||
trunc: "es6.math.trunc",
|
||||
},
|
||||
|
||||
String: {
|
||||
raw: "es6.string.raw",
|
||||
},
|
||||
|
||||
Number: {
|
||||
isFinite: "es6.number.is-finite",
|
||||
isInteger: "es6.number.is-integer",
|
||||
isSafeInteger: "es6.number.is-safe-integer",
|
||||
isNaN: "es6.number.is-nan",
|
||||
EPSILON: "es6.number.epsilon",
|
||||
MIN_SAFE_INTEGER: "es6.number.min-safe-integer",
|
||||
MAX_SAFE_INTEGER: "es6.number.max-safe-integer",
|
||||
},
|
||||
|
||||
Reflect: {
|
||||
apply: "es6.reflect.apply",
|
||||
construct: "es6.reflect.construct",
|
||||
defineProperty: "es6.reflect.define-property",
|
||||
deleteProperty: "es6.reflect.delete-property",
|
||||
get: "es6.reflect.get",
|
||||
getOwnPropertyDescriptor: "es6.reflect.get-own-property-descriptor",
|
||||
getPrototypeOf: "es6.reflect.get-prototype-of",
|
||||
has: "es6.reflect.has",
|
||||
isExtensible: "es6.reflect.is-extensible",
|
||||
ownKeys: "es6.reflect.own-keys",
|
||||
preventExtensions: "es6.reflect.prevent-extensions",
|
||||
set: "es6.reflect.set",
|
||||
setPrototypeOf: "es6.reflect.set-prototype-of",
|
||||
},
|
||||
},
|
||||
};
|
||||
75
experimental/babel-preset-env/src/debug.js
Normal file
75
experimental/babel-preset-env/src/debug.js
Normal file
@ -0,0 +1,75 @@
|
||||
/*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
|
||||
import semver from "semver";
|
||||
import { prettifyVersion, semverify } from "./utils";
|
||||
|
||||
const wordEnds = size => {
|
||||
return size > 1 ? "s" : "";
|
||||
};
|
||||
|
||||
export const logMessage = (message, context) => {
|
||||
const pre = context ? `[${context}] ` : "";
|
||||
const logStr = ` ${pre}${message}`;
|
||||
console.log(logStr);
|
||||
};
|
||||
|
||||
export const logPlugin = (plugin, targets, list, context) => {
|
||||
const envList = list[plugin] || {};
|
||||
const filteredList = Object.keys(targets).reduce((a, b) => {
|
||||
if (!envList[b] || semver.lt(targets[b], semverify(envList[b]))) {
|
||||
a[b] = prettifyVersion(targets[b]);
|
||||
}
|
||||
return a;
|
||||
}, {});
|
||||
|
||||
const formattedTargets = JSON.stringify(filteredList)
|
||||
.replace(/,/g, ", ")
|
||||
.replace(/^\{"/, '{ "')
|
||||
.replace(/"\}$/, '" }');
|
||||
|
||||
logMessage(`${plugin} ${formattedTargets}`, context);
|
||||
};
|
||||
|
||||
export const logEntryPolyfills = (
|
||||
importPolyfillIncluded,
|
||||
polyfills,
|
||||
filename,
|
||||
onDebug,
|
||||
) => {
|
||||
if (!importPolyfillIncluded) {
|
||||
console.log(
|
||||
`
|
||||
[${filename}] \`import 'babel-polyfill'\` was not found.`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!polyfills.size) {
|
||||
console.log(
|
||||
`
|
||||
[${filename}] Based on your targets, none were added.`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(
|
||||
`
|
||||
[${filename}] Replaced \`babel-polyfill\` with the following polyfill${wordEnds(
|
||||
polyfills.size,
|
||||
)}:`,
|
||||
);
|
||||
onDebug(polyfills);
|
||||
};
|
||||
|
||||
export const logUsagePolyfills = (polyfills, filename, onDebug) => {
|
||||
if (!polyfills.size) {
|
||||
console.log(
|
||||
`
|
||||
[${filename}] Based on your code and targets, none were added.`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
console.log(
|
||||
`
|
||||
[${filename}] Added following polyfill${wordEnds(polyfills.size)}:`,
|
||||
);
|
||||
onDebug(polyfills);
|
||||
};
|
||||
5
experimental/babel-preset-env/src/default-includes.js
Normal file
5
experimental/babel-preset-env/src/default-includes.js
Normal file
@ -0,0 +1,5 @@
|
||||
export const defaultWebIncludes = [
|
||||
"web.timers",
|
||||
"web.immediate",
|
||||
"web.dom.iterable",
|
||||
];
|
||||
272
experimental/babel-preset-env/src/index.js
Normal file
272
experimental/babel-preset-env/src/index.js
Normal file
@ -0,0 +1,272 @@
|
||||
//@flow
|
||||
|
||||
import semver from "semver";
|
||||
import builtInsList from "../data/built-ins.json";
|
||||
import { logPlugin } from "./debug";
|
||||
import { defaultWebIncludes } from "./default-includes";
|
||||
import moduleTransformations from "./module-transformations";
|
||||
import normalizeOptions from "./normalize-options.js";
|
||||
import pluginList from "../data/plugins.json";
|
||||
import {
|
||||
builtIns as proposalBuiltIns,
|
||||
features as proposalPlugins,
|
||||
pluginSyntaxMap,
|
||||
} from "../data/shipped-proposals.js";
|
||||
import useBuiltInsEntryPlugin from "./use-built-ins-entry-plugin";
|
||||
import addUsedBuiltInsPlugin from "./use-built-ins-plugin";
|
||||
import getTargets from "./targets-parser";
|
||||
import availablePlugins from "./available-plugins";
|
||||
import { filterStageFromList, prettifyTargets, semverify } from "./utils";
|
||||
import type { Plugin, Targets } from "./types";
|
||||
|
||||
const getPlugin = (pluginName: string) => {
|
||||
const plugin = availablePlugins[pluginName];
|
||||
|
||||
if (!plugin) {
|
||||
throw new Error(
|
||||
`Could not find plugin "${pluginName}". Ensure there is an entry in ./available-plugins.js for it.`,
|
||||
);
|
||||
}
|
||||
|
||||
return plugin;
|
||||
};
|
||||
|
||||
const builtInsListWithoutProposals = filterStageFromList(
|
||||
builtInsList,
|
||||
proposalBuiltIns,
|
||||
);
|
||||
|
||||
const pluginListWithoutProposals = filterStageFromList(
|
||||
pluginList,
|
||||
proposalPlugins,
|
||||
);
|
||||
|
||||
export const isPluginRequired = (
|
||||
supportedEnvironments: Targets,
|
||||
plugin: Targets,
|
||||
): boolean => {
|
||||
const targetEnvironments: Array<string> = Object.keys(supportedEnvironments);
|
||||
|
||||
if (targetEnvironments.length === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const isRequiredForEnvironments: Array<
|
||||
string,
|
||||
> = targetEnvironments.filter(environment => {
|
||||
// Feature is not implemented in that environment
|
||||
if (!plugin[environment]) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const lowestImplementedVersion: string = plugin[environment];
|
||||
const lowestTargetedVersion: string = supportedEnvironments[environment];
|
||||
|
||||
if (!semver.valid(lowestTargetedVersion)) {
|
||||
throw new Error(
|
||||
// eslint-disable-next-line max-len
|
||||
`Invalid version passed for target "${environment}": "${lowestTargetedVersion}". Versions must be in semver format (major.minor.patch)`,
|
||||
);
|
||||
}
|
||||
|
||||
return semver.gt(
|
||||
semverify(lowestImplementedVersion),
|
||||
lowestTargetedVersion,
|
||||
);
|
||||
});
|
||||
|
||||
return isRequiredForEnvironments.length > 0;
|
||||
};
|
||||
|
||||
let hasBeenLogged = false;
|
||||
|
||||
const getBuiltInTargets = targets => {
|
||||
const builtInTargets = Object.assign({}, targets);
|
||||
if (builtInTargets.uglify != null) {
|
||||
delete builtInTargets.uglify;
|
||||
}
|
||||
return builtInTargets;
|
||||
};
|
||||
|
||||
export const transformIncludesAndExcludes = (opts: Array<string>): Object => {
|
||||
return opts.reduce(
|
||||
(result, opt) => {
|
||||
const target = opt.match(/^(es\d+|web)\./) ? "builtIns" : "plugins";
|
||||
result[target].add(opt);
|
||||
return result;
|
||||
},
|
||||
{
|
||||
all: opts,
|
||||
plugins: new Set(),
|
||||
builtIns: new Set(),
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
const getPlatformSpecificDefaultFor = (targets: Targets): ?Array<string> => {
|
||||
const targetNames = Object.keys(targets);
|
||||
const isAnyTarget = !targetNames.length;
|
||||
const isWebTarget = targetNames.some(name => name !== "node");
|
||||
|
||||
return isAnyTarget || isWebTarget ? defaultWebIncludes : null;
|
||||
};
|
||||
|
||||
const filterItems = (
|
||||
list,
|
||||
includes,
|
||||
excludes,
|
||||
targets,
|
||||
defaultItems,
|
||||
): Set<string> => {
|
||||
const result = new Set();
|
||||
|
||||
for (const item in list) {
|
||||
const excluded = excludes.has(item);
|
||||
|
||||
if (!excluded) {
|
||||
if (isPluginRequired(targets, list[item])) {
|
||||
result.add(item);
|
||||
} else {
|
||||
const shippedProposalsSyntax = pluginSyntaxMap.get(item);
|
||||
|
||||
if (shippedProposalsSyntax) {
|
||||
result.add(shippedProposalsSyntax);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (defaultItems) {
|
||||
defaultItems.forEach(item => !excludes.has(item) && result.add(item));
|
||||
}
|
||||
|
||||
includes.forEach(item => result.add(item));
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
export default function buildPreset(
|
||||
context: Object,
|
||||
opts: Object = {},
|
||||
): { plugins: Array<Plugin> } {
|
||||
const {
|
||||
configPath,
|
||||
debug,
|
||||
exclude: optionsExclude,
|
||||
forceAllTransforms,
|
||||
ignoreBrowserslistConfig,
|
||||
include: optionsInclude,
|
||||
loose,
|
||||
modules,
|
||||
shippedProposals,
|
||||
spec,
|
||||
targets: optionsTargets,
|
||||
useBuiltIns,
|
||||
} = normalizeOptions(opts);
|
||||
// TODO: remove this in next major
|
||||
let hasUglifyTarget = false;
|
||||
|
||||
if (optionsTargets && optionsTargets.uglify) {
|
||||
hasUglifyTarget = true;
|
||||
delete optionsTargets.uglify;
|
||||
|
||||
console.log("");
|
||||
console.log("The uglify target has been deprecated. Set the top level");
|
||||
console.log("option `forceAllTransforms: true` instead.");
|
||||
console.log("");
|
||||
}
|
||||
|
||||
const targets = getTargets(optionsTargets, {
|
||||
ignoreBrowserslistConfig,
|
||||
configPath,
|
||||
});
|
||||
const include = transformIncludesAndExcludes(optionsInclude);
|
||||
const exclude = transformIncludesAndExcludes(optionsExclude);
|
||||
|
||||
const transformTargets = forceAllTransforms || hasUglifyTarget ? {} : targets;
|
||||
|
||||
const transformations = filterItems(
|
||||
shippedProposals ? pluginList : pluginListWithoutProposals,
|
||||
include.plugins,
|
||||
exclude.plugins,
|
||||
transformTargets,
|
||||
);
|
||||
|
||||
let polyfills;
|
||||
let polyfillTargets;
|
||||
|
||||
if (useBuiltIns) {
|
||||
polyfillTargets = getBuiltInTargets(targets);
|
||||
|
||||
polyfills = filterItems(
|
||||
shippedProposals ? builtInsList : builtInsListWithoutProposals,
|
||||
include.builtIns,
|
||||
exclude.builtIns,
|
||||
polyfillTargets,
|
||||
getPlatformSpecificDefaultFor(polyfillTargets),
|
||||
);
|
||||
}
|
||||
|
||||
const plugins = [];
|
||||
const pluginUseBuiltIns = useBuiltIns !== false;
|
||||
|
||||
// NOTE: not giving spec here yet to avoid compatibility issues when
|
||||
// babel-plugin-transform-es2015-modules-commonjs gets its spec mode
|
||||
if (modules !== false && moduleTransformations[modules]) {
|
||||
plugins.push([getPlugin(moduleTransformations[modules]), { loose }]);
|
||||
}
|
||||
|
||||
transformations.forEach(pluginName =>
|
||||
plugins.push([
|
||||
getPlugin(pluginName),
|
||||
{ spec, loose, useBuiltIns: pluginUseBuiltIns },
|
||||
]),
|
||||
);
|
||||
|
||||
const regenerator = transformations.has("transform-regenerator");
|
||||
|
||||
if (debug && !hasBeenLogged) {
|
||||
hasBeenLogged = true;
|
||||
console.log("babel-preset-env: `DEBUG` option");
|
||||
console.log("\nUsing targets:");
|
||||
console.log(JSON.stringify(prettifyTargets(targets), null, 2));
|
||||
console.log(`\nUsing modules transform: ${modules.toString()}`);
|
||||
console.log("\nUsing plugins:");
|
||||
transformations.forEach(transform => {
|
||||
logPlugin(transform, targets, pluginList);
|
||||
});
|
||||
|
||||
if (!useBuiltIns) {
|
||||
console.log(
|
||||
"\nUsing polyfills: No polyfills were added, since the `useBuiltIns` option was not set.",
|
||||
);
|
||||
} else {
|
||||
console.log(
|
||||
`
|
||||
Using polyfills with \`${useBuiltIns}\` option:`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (useBuiltIns === "usage" || useBuiltIns === "entry") {
|
||||
const pluginOptions = {
|
||||
debug,
|
||||
polyfills,
|
||||
regenerator,
|
||||
onDebug: (polyfills, context) => {
|
||||
polyfills.forEach(polyfill =>
|
||||
logPlugin(polyfill, polyfillTargets, builtInsList, context),
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
plugins.push([
|
||||
useBuiltIns === "usage" ? addUsedBuiltInsPlugin : useBuiltInsEntryPlugin,
|
||||
pluginOptions,
|
||||
]);
|
||||
}
|
||||
|
||||
return {
|
||||
plugins,
|
||||
};
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
export default {
|
||||
amd: "transform-es2015-modules-amd",
|
||||
commonjs: "transform-es2015-modules-commonjs",
|
||||
systemjs: "transform-es2015-modules-systemjs",
|
||||
umd: "transform-es2015-modules-umd",
|
||||
};
|
||||
175
experimental/babel-preset-env/src/normalize-options.js
Normal file
175
experimental/babel-preset-env/src/normalize-options.js
Normal file
@ -0,0 +1,175 @@
|
||||
//@flow
|
||||
|
||||
import invariant from "invariant";
|
||||
import browserslist from "browserslist";
|
||||
import builtInsList from "../data/built-ins.json";
|
||||
import { defaultWebIncludes } from "./default-includes";
|
||||
import moduleTransformations from "./module-transformations";
|
||||
import pluginsList from "../data/plugins.json";
|
||||
import type { Targets, Options, ModuleOption, BuiltInsOption } from "./types";
|
||||
|
||||
const validIncludesAndExcludes = new Set([
|
||||
...Object.keys(pluginsList),
|
||||
...Object.keys(moduleTransformations).map(m => moduleTransformations[m]),
|
||||
...Object.keys(builtInsList),
|
||||
...defaultWebIncludes,
|
||||
]);
|
||||
|
||||
export const validateIncludesAndExcludes = (
|
||||
opts: Array<string> = [],
|
||||
type: string,
|
||||
): Array<string> => {
|
||||
invariant(
|
||||
Array.isArray(opts),
|
||||
`Invalid Option: The '${type}' option must be an Array<String> of plugins/built-ins`,
|
||||
);
|
||||
|
||||
const unknownOpts = opts.filter(opt => !validIncludesAndExcludes.has(opt));
|
||||
|
||||
invariant(
|
||||
unknownOpts.length === 0,
|
||||
`Invalid Option: The plugins/built-ins '${unknownOpts.join(
|
||||
", ",
|
||||
)}' passed to the '${type}' option are not
|
||||
valid. Please check data/[plugin-features|built-in-features].js in babel-preset-env`,
|
||||
);
|
||||
|
||||
return opts;
|
||||
};
|
||||
|
||||
const validBrowserslistTargets = [
|
||||
...Object.keys(browserslist.data),
|
||||
...Object.keys(browserslist.aliases),
|
||||
];
|
||||
|
||||
export const normalizePluginName = (plugin: string): string =>
|
||||
plugin.replace(/^babel-plugin-/, "");
|
||||
|
||||
export const normalizePluginNames = (plugins: Array<string>): Array<string> =>
|
||||
plugins.map(normalizePluginName);
|
||||
|
||||
export const checkDuplicateIncludeExcludes = (
|
||||
include: Array<string> = [],
|
||||
exclude: Array<string> = [],
|
||||
): void => {
|
||||
const duplicates: Array<string> = include.filter(
|
||||
opt => exclude.indexOf(opt) >= 0,
|
||||
);
|
||||
|
||||
invariant(
|
||||
duplicates.length === 0,
|
||||
`Invalid Option: The plugins/built-ins '${duplicates.join(
|
||||
", ",
|
||||
)}' were found in both the "include" and
|
||||
"exclude" options.`,
|
||||
);
|
||||
};
|
||||
|
||||
export const validateConfigPathOption = (
|
||||
configPath: string = process.cwd(),
|
||||
) => {
|
||||
invariant(
|
||||
typeof configPath === "string",
|
||||
`Invalid Option: The configPath option '${configPath}' is invalid, only strings are allowed.`,
|
||||
);
|
||||
return configPath;
|
||||
};
|
||||
|
||||
export const validateBoolOption = (
|
||||
name: string,
|
||||
value: ?boolean,
|
||||
defaultValue: boolean,
|
||||
) => {
|
||||
if (typeof value === "undefined") {
|
||||
value = defaultValue;
|
||||
}
|
||||
|
||||
if (typeof value !== "boolean") {
|
||||
throw new Error(`Preset env: '${name}' option must be a boolean.`);
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
export const validateIgnoreBrowserslistConfig = (
|
||||
ignoreBrowserslistConfig: boolean,
|
||||
) =>
|
||||
validateBoolOption(
|
||||
"ignoreBrowserslistConfig",
|
||||
ignoreBrowserslistConfig,
|
||||
false,
|
||||
);
|
||||
|
||||
export const validateModulesOption = (
|
||||
modulesOpt: ModuleOption = "commonjs",
|
||||
) => {
|
||||
invariant(
|
||||
modulesOpt === false ||
|
||||
Object.keys(moduleTransformations).indexOf(modulesOpt) > -1,
|
||||
`Invalid Option: The 'modules' option must be either 'false' to indicate no modules, or a
|
||||
module type which can be be one of: 'commonjs' (default), 'amd', 'umd', 'systemjs'.`,
|
||||
);
|
||||
|
||||
return modulesOpt;
|
||||
};
|
||||
|
||||
export const objectToBrowserslist = (object: Targets) => {
|
||||
return Object.keys(object).reduce((list, targetName) => {
|
||||
if (validBrowserslistTargets.indexOf(targetName) >= 0) {
|
||||
const targetVersion = object[targetName];
|
||||
return list.concat(`${targetName} ${targetVersion}`);
|
||||
}
|
||||
return list;
|
||||
}, []);
|
||||
};
|
||||
|
||||
export const validateUseBuiltInsOption = (
|
||||
builtInsOpt: BuiltInsOption = false,
|
||||
): BuiltInsOption => {
|
||||
invariant(
|
||||
builtInsOpt === "usage" || builtInsOpt === false || builtInsOpt === "entry",
|
||||
`Invalid Option: The 'useBuiltIns' option must be either
|
||||
'false' (default) to indicate no polyfill,
|
||||
'"entry"' to indicate replacing the entry polyfill, or
|
||||
'"usage"' to import only used polyfills per file`,
|
||||
);
|
||||
|
||||
return builtInsOpt;
|
||||
};
|
||||
|
||||
export default function normalizeOptions(opts: Options) {
|
||||
if (opts.exclude) {
|
||||
opts.exclude = normalizePluginNames(opts.exclude);
|
||||
}
|
||||
|
||||
if (opts.include) {
|
||||
opts.include = normalizePluginNames(opts.include);
|
||||
}
|
||||
|
||||
checkDuplicateIncludeExcludes(opts.include, opts.exclude);
|
||||
|
||||
return {
|
||||
configPath: validateConfigPathOption(opts.configPath),
|
||||
debug: opts.debug,
|
||||
exclude: validateIncludesAndExcludes(opts.exclude, "exclude"),
|
||||
forceAllTransforms: validateBoolOption(
|
||||
"forceAllTransforms",
|
||||
opts.forceAllTransforms,
|
||||
false,
|
||||
),
|
||||
ignoreBrowserslistConfig: validateIgnoreBrowserslistConfig(
|
||||
opts.ignoreBrowserslistConfig,
|
||||
),
|
||||
include: validateIncludesAndExcludes(opts.include, "include"),
|
||||
loose: validateBoolOption("loose", opts.loose, false),
|
||||
modules: validateModulesOption(opts.modules),
|
||||
shippedProposals: validateBoolOption(
|
||||
"shippedProposals",
|
||||
opts.shippedProposals,
|
||||
false,
|
||||
),
|
||||
spec: validateBoolOption("loose", opts.spec, false),
|
||||
targets: opts.targets,
|
||||
useBuiltIns: validateUseBuiltInsOption(opts.useBuiltIns),
|
||||
};
|
||||
}
|
||||
142
experimental/babel-preset-env/src/targets-parser.js
Normal file
142
experimental/babel-preset-env/src/targets-parser.js
Normal file
@ -0,0 +1,142 @@
|
||||
// @flow
|
||||
|
||||
import browserslist from "browserslist";
|
||||
import semver from "semver";
|
||||
import { semverify } from "./utils";
|
||||
import { objectToBrowserslist } from "./normalize-options";
|
||||
import type { Targets } from "./types";
|
||||
|
||||
const browserNameMap = {
|
||||
android: "android",
|
||||
chrome: "chrome",
|
||||
and_chr: "chrome",
|
||||
edge: "edge",
|
||||
firefox: "firefox",
|
||||
ie: "ie",
|
||||
ios_saf: "ios",
|
||||
safari: "safari",
|
||||
};
|
||||
|
||||
const isBrowsersQueryValid = (browsers: string | Array<string>): boolean =>
|
||||
typeof browsers === "string" || Array.isArray(browsers);
|
||||
|
||||
const semverMin = (first: ?string, second: string): string => {
|
||||
return first && semver.lt(first, second) ? first : second;
|
||||
};
|
||||
|
||||
const mergeBrowsers = (fromQuery: Targets, fromTarget: Targets) => {
|
||||
return Object.keys(fromTarget).reduce((queryObj, targKey) => {
|
||||
if (targKey !== "browsers") {
|
||||
queryObj[targKey] = fromTarget[targKey];
|
||||
}
|
||||
return queryObj;
|
||||
}, fromQuery);
|
||||
};
|
||||
|
||||
const getLowestVersions = (browsers: Array<string>): Targets => {
|
||||
return browsers.reduce((all: Object, browser: string): Object => {
|
||||
const [browserName, browserVersion] = browser.split(" ");
|
||||
const normalizedBrowserName = browserNameMap[browserName];
|
||||
|
||||
if (!normalizedBrowserName) {
|
||||
return all;
|
||||
}
|
||||
|
||||
try {
|
||||
// Browser version can return as "10.0-10.2"
|
||||
const splitVersion = browserVersion.split("-")[0];
|
||||
const parsedBrowserVersion = semverify(splitVersion);
|
||||
|
||||
all[normalizedBrowserName] = semverMin(
|
||||
all[normalizedBrowserName],
|
||||
parsedBrowserVersion,
|
||||
);
|
||||
} catch (e) {}
|
||||
|
||||
return all;
|
||||
}, {});
|
||||
};
|
||||
|
||||
const outputDecimalWarning = (decimalTargets: Array<Object>): void => {
|
||||
if (!decimalTargets || !decimalTargets.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("Warning, the following targets are using a decimal version:");
|
||||
console.log("");
|
||||
decimalTargets.forEach(({ target, value }) =>
|
||||
console.log(` ${target}: ${value}`),
|
||||
);
|
||||
console.log("");
|
||||
console.log(
|
||||
"We recommend using a string for minor/patch versions to avoid numbers like 6.10",
|
||||
);
|
||||
console.log("getting parsed as 6.1, which can lead to unexpected behavior.");
|
||||
console.log("");
|
||||
};
|
||||
|
||||
const targetParserMap = {
|
||||
__default: (target, value) => [target, semverify(value)],
|
||||
|
||||
// Parse `node: true` and `node: "current"` to version
|
||||
node: (target, value) => {
|
||||
const parsed =
|
||||
value === true || value === "current"
|
||||
? process.versions.node
|
||||
: semverify(value);
|
||||
|
||||
return [target, parsed];
|
||||
},
|
||||
};
|
||||
|
||||
type ParsedResult = {
|
||||
targets: Targets,
|
||||
decimalWarnings: Array<Object>,
|
||||
};
|
||||
const getTargets = (targets: Object = {}, options: Object = {}): Targets => {
|
||||
const targetOpts: Targets = {};
|
||||
// Parse browsers target via browserslist;
|
||||
const queryIsValid = isBrowsersQueryValid(targets.browsers);
|
||||
const browsersquery = queryIsValid ? targets.browsers : null;
|
||||
if (queryIsValid || !options.ignoreBrowserslistConfig) {
|
||||
browserslist.defaults = objectToBrowserslist(targets);
|
||||
|
||||
const browsers = browserslist(browsersquery, { path: options.configPath });
|
||||
const queryBrowsers = getLowestVersions(browsers);
|
||||
targets = mergeBrowsers(queryBrowsers, targets);
|
||||
}
|
||||
// Parse remaining targets
|
||||
const parsed = Object.keys(targets).sort().reduce((
|
||||
results: ParsedResult,
|
||||
target: string,
|
||||
): ParsedResult => {
|
||||
if (target !== "browsers") {
|
||||
const value = targets[target];
|
||||
|
||||
// Warn when specifying minor/patch as a decimal
|
||||
if (typeof value === "number" && value % 1 !== 0) {
|
||||
results.decimalWarnings.push({ target, value });
|
||||
}
|
||||
|
||||
// Check if we have a target parser?
|
||||
const parser = targetParserMap[target] || targetParserMap.__default;
|
||||
const [parsedTarget, parsedValue] = parser(target, value);
|
||||
|
||||
if (parsedValue) {
|
||||
// Merge (lowest wins)
|
||||
results.targets[parsedTarget] = parsedValue;
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}, {
|
||||
targets: targetOpts,
|
||||
decimalWarnings: [],
|
||||
});
|
||||
|
||||
outputDecimalWarning(parsed.decimalWarnings);
|
||||
|
||||
return parsed.targets;
|
||||
};
|
||||
|
||||
export default getTargets;
|
||||
30
experimental/babel-preset-env/src/types.js
Normal file
30
experimental/babel-preset-env/src/types.js
Normal file
@ -0,0 +1,30 @@
|
||||
//@flow
|
||||
|
||||
// Targets
|
||||
export type Target = string;
|
||||
export type Targets = {
|
||||
[target: string]: Target,
|
||||
};
|
||||
|
||||
// Options
|
||||
// Use explicit modules to prevent typo errors.
|
||||
export type ModuleOption = false | "amd" | "commonjs" | "systemjs" | "umd";
|
||||
export type BuiltInsOption = false | "entry" | "usage";
|
||||
|
||||
export type Options = {
|
||||
configPath: string,
|
||||
debug: boolean,
|
||||
exclude: Array<string>,
|
||||
forceAllTransforms: boolean,
|
||||
ignoreBrowserslistConfig: boolean,
|
||||
include: Array<string>,
|
||||
loose: boolean,
|
||||
modules: ModuleOption,
|
||||
shippedProposals: boolean,
|
||||
spec: boolean,
|
||||
targets: Targets,
|
||||
useBuiltIns: BuiltInsOption,
|
||||
};
|
||||
|
||||
// Babel
|
||||
export type Plugin = [Object, Object];
|
||||
126
experimental/babel-preset-env/src/use-built-ins-entry-plugin.js
Normal file
126
experimental/babel-preset-env/src/use-built-ins-entry-plugin.js
Normal file
@ -0,0 +1,126 @@
|
||||
//@flow
|
||||
import { logEntryPolyfills } from "./debug";
|
||||
|
||||
type Plugin = {
|
||||
visitor: Object,
|
||||
pre: Function,
|
||||
post: Function,
|
||||
name: string,
|
||||
};
|
||||
|
||||
type RequireType = "require" | "import";
|
||||
|
||||
function isPolyfillSource(value: string): boolean {
|
||||
return value === "babel-polyfill";
|
||||
}
|
||||
|
||||
export default function({ types: t }: { types: Object }): Plugin {
|
||||
function createImportDeclaration(polyfill: string): Object {
|
||||
const declar = t.importDeclaration([], t.stringLiteral(polyfill));
|
||||
declar._blockHoist = 3;
|
||||
return declar;
|
||||
}
|
||||
|
||||
function createRequireStatement(polyfill: string): Object {
|
||||
return t.expressionStatement(
|
||||
t.callExpression(t.identifier("require"), [t.stringLiteral(polyfill)]),
|
||||
);
|
||||
}
|
||||
|
||||
function isRequire(path: Object): boolean {
|
||||
return (
|
||||
t.isExpressionStatement(path.node) &&
|
||||
t.isCallExpression(path.node.expression) &&
|
||||
t.isIdentifier(path.node.expression.callee) &&
|
||||
path.node.expression.callee.name === "require" &&
|
||||
path.node.expression.arguments.length === 1 &&
|
||||
t.isStringLiteral(path.node.expression.arguments[0]) &&
|
||||
isPolyfillSource(path.node.expression.arguments[0].value)
|
||||
);
|
||||
}
|
||||
|
||||
function createImport(
|
||||
polyfill: string,
|
||||
requireType: RequireType,
|
||||
core: ?boolean,
|
||||
): Object {
|
||||
if (core) {
|
||||
polyfill = `babel-polyfill/lib/core-js/modules/${polyfill}`;
|
||||
}
|
||||
|
||||
if (requireType === "import") {
|
||||
return createImportDeclaration(polyfill);
|
||||
}
|
||||
return createRequireStatement(polyfill);
|
||||
}
|
||||
|
||||
function createImports(
|
||||
polyfills: Array<string>,
|
||||
requireType: RequireType,
|
||||
regenerator: boolean,
|
||||
): Array<Object> {
|
||||
const items = Array.isArray(polyfills) ? new Set(polyfills) : polyfills;
|
||||
const imports = [];
|
||||
|
||||
items.forEach(p => imports.push(createImport(p, requireType, true)));
|
||||
|
||||
if (regenerator) {
|
||||
imports.push(
|
||||
createImport(
|
||||
"babel-polyfill/lib/regenerator-runtime/runtime",
|
||||
requireType,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return imports;
|
||||
}
|
||||
|
||||
const isPolyfillImport = {
|
||||
ImportDeclaration(path, state) {
|
||||
if (
|
||||
path.node.specifiers.length === 0 &&
|
||||
isPolyfillSource(path.node.source.value)
|
||||
) {
|
||||
this.importPolyfillIncluded = true;
|
||||
path.replaceWithMultiple(
|
||||
createImports(state.opts.polyfills, "import", state.opts.regenerator),
|
||||
);
|
||||
}
|
||||
},
|
||||
Program(path, state) {
|
||||
path.get("body").forEach(bodyPath => {
|
||||
if (isRequire(bodyPath)) {
|
||||
bodyPath.replaceWithMultiple(
|
||||
createImports(
|
||||
state.opts.polyfills,
|
||||
"require",
|
||||
state.opts.regenerator,
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
name: "transform-polyfill-require",
|
||||
visitor: isPolyfillImport,
|
||||
pre() {
|
||||
this.numPolyfillImports = 0;
|
||||
this.importPolyfillIncluded = false;
|
||||
},
|
||||
post() {
|
||||
const { debug, onDebug, polyfills } = this.opts;
|
||||
|
||||
if (debug) {
|
||||
logEntryPolyfills(
|
||||
this.importPolyfillIncluded,
|
||||
polyfills,
|
||||
this.file.opts.filename,
|
||||
onDebug,
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
303
experimental/babel-preset-env/src/use-built-ins-plugin.js
Normal file
303
experimental/babel-preset-env/src/use-built-ins-plugin.js
Normal file
@ -0,0 +1,303 @@
|
||||
//@flow
|
||||
|
||||
import { definitions } from "./built-in-definitions";
|
||||
import { logUsagePolyfills } from "./debug";
|
||||
|
||||
type Plugin = {
|
||||
visitor: Object,
|
||||
pre: Function,
|
||||
name: string,
|
||||
};
|
||||
|
||||
function isPolyfillSource(value: string): boolean {
|
||||
return value === "babel-polyfill";
|
||||
}
|
||||
|
||||
function warnOnInstanceMethod() {
|
||||
// state.opts.debug &&
|
||||
// console.warn(
|
||||
// `Adding a polyfill: An instance method may have been used: ${details}`,
|
||||
// );
|
||||
}
|
||||
|
||||
function has(obj: Object, key: string): boolean {
|
||||
return Object.prototype.hasOwnProperty.call(obj, key);
|
||||
}
|
||||
|
||||
function getObjectString(node: Object): string {
|
||||
if (node.type === "Identifier") {
|
||||
return node.name;
|
||||
} else if (node.type === "MemberExpression") {
|
||||
return `${getObjectString(node.object)}.${getObjectString(node.property)}`;
|
||||
}
|
||||
return node.name;
|
||||
}
|
||||
|
||||
const modulePathMap = {
|
||||
"regenerator-runtime": "babel-polyfill/lib/regenerator-runtime/runtime",
|
||||
};
|
||||
|
||||
const getModulePath = module => {
|
||||
return (
|
||||
modulePathMap[module] || `babel-polyfill/lib/core-js/modules/${module}`
|
||||
);
|
||||
};
|
||||
|
||||
export default function({ types: t }: { types: Object }): Plugin {
|
||||
function addImport(
|
||||
path: Object,
|
||||
builtIn: string,
|
||||
builtIns: Set<string>,
|
||||
): void {
|
||||
if (builtIn && !builtIns.has(builtIn)) {
|
||||
builtIns.add(builtIn);
|
||||
|
||||
const importDec = t.importDeclaration(
|
||||
[],
|
||||
t.stringLiteral(getModulePath(builtIn)),
|
||||
);
|
||||
|
||||
importDec._blockHoist = 3;
|
||||
const programPath = path.find(path => path.isProgram());
|
||||
programPath.unshiftContainer("body", importDec);
|
||||
}
|
||||
}
|
||||
|
||||
function addUnsupported(
|
||||
path: Object,
|
||||
polyfills: Set<string>,
|
||||
builtIn: Array<string> | string,
|
||||
builtIns: Set<string>,
|
||||
): void {
|
||||
if (Array.isArray(builtIn)) {
|
||||
for (const i of builtIn) {
|
||||
if (polyfills.has(i)) {
|
||||
addImport(path, i, builtIns);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (polyfills.has(builtIn)) {
|
||||
addImport(path, builtIn, builtIns);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isRequire(path: Object): boolean {
|
||||
return (
|
||||
t.isExpressionStatement(path.node) &&
|
||||
t.isCallExpression(path.node.expression) &&
|
||||
t.isIdentifier(path.node.expression.callee) &&
|
||||
path.node.expression.callee.name === "require" &&
|
||||
path.node.expression.arguments.length === 1 &&
|
||||
t.isStringLiteral(path.node.expression.arguments[0]) &&
|
||||
isPolyfillSource(path.node.expression.arguments[0].value)
|
||||
);
|
||||
}
|
||||
|
||||
const addAndRemovePolyfillImports = {
|
||||
ImportDeclaration(path) {
|
||||
if (
|
||||
path.node.specifiers.length === 0 &&
|
||||
isPolyfillSource(path.node.source.value)
|
||||
) {
|
||||
console.warn(
|
||||
`
|
||||
When setting \`useBuiltIns: 'usage'\`, polyfills are automatically imported when needed.
|
||||
Please remove the \`import 'babel-polyfill'\` call or use \`useBuiltIns: 'entry'\` instead.`,
|
||||
);
|
||||
path.remove();
|
||||
}
|
||||
},
|
||||
Program: {
|
||||
enter(path) {
|
||||
path.get("body").forEach(bodyPath => {
|
||||
if (isRequire(bodyPath)) {
|
||||
console.warn(
|
||||
`
|
||||
When setting \`useBuiltIns: 'usage'\`, polyfills are automatically imported when needed.
|
||||
Please remove the \`require('babel-polyfill')\` call or use \`useBuiltIns: 'entry'\` instead.`,
|
||||
);
|
||||
bodyPath.remove();
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
// Symbol()
|
||||
// new Promise
|
||||
ReferencedIdentifier(path, state) {
|
||||
const { node, parent, scope } = path;
|
||||
|
||||
if (t.isMemberExpression(parent)) return;
|
||||
if (!has(definitions.builtins, node.name)) return;
|
||||
if (scope.getBindingIdentifier(node.name)) return;
|
||||
|
||||
const builtIn = definitions.builtins[node.name];
|
||||
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
|
||||
},
|
||||
|
||||
// arr[Symbol.iterator]()
|
||||
CallExpression(path) {
|
||||
// we can't compile this
|
||||
if (path.node.arguments.length) return;
|
||||
|
||||
const callee = path.node.callee;
|
||||
if (!t.isMemberExpression(callee)) return;
|
||||
if (!callee.computed) return;
|
||||
if (!path.get("callee.property").matchesPattern("Symbol.iterator")) {
|
||||
return;
|
||||
}
|
||||
|
||||
addImport(path, "web.dom.iterable", this.builtIns);
|
||||
},
|
||||
|
||||
// Symbol.iterator in arr
|
||||
BinaryExpression(path) {
|
||||
if (path.node.operator !== "in") return;
|
||||
if (!path.get("left").matchesPattern("Symbol.iterator")) return;
|
||||
|
||||
addImport(path, "web.dom.iterable", this.builtIns);
|
||||
},
|
||||
|
||||
// yield*
|
||||
YieldExpression(path) {
|
||||
if (!path.node.delegate) return;
|
||||
|
||||
addImport(path, "web.dom.iterable", this.builtIns);
|
||||
},
|
||||
|
||||
// Array.from
|
||||
MemberExpression: {
|
||||
enter(path, state) {
|
||||
if (!path.isReferenced()) return;
|
||||
|
||||
const { node } = path;
|
||||
const obj = node.object;
|
||||
const prop = node.property;
|
||||
|
||||
if (!t.isReferenced(obj, node)) return;
|
||||
|
||||
// doesn't reference the global
|
||||
if (path.scope.getBindingIdentifier(obj.name)) return;
|
||||
|
||||
if (has(definitions.staticMethods, obj.name)) {
|
||||
const staticMethods = definitions.staticMethods[obj.name];
|
||||
if (has(staticMethods, prop.name)) {
|
||||
const builtIn = staticMethods[prop.name];
|
||||
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
|
||||
// if (obj.name === "Array" && prop.name === "from") {
|
||||
// addImport(
|
||||
// path,
|
||||
// "babel-polyfill/lib/core-js/modules/web.dom.iterable",
|
||||
// this.builtIns,
|
||||
// );
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!node.computed &&
|
||||
t.isIdentifier(prop) &&
|
||||
has(definitions.instanceMethods, prop.name)
|
||||
) {
|
||||
warnOnInstanceMethod(state, getObjectString(node));
|
||||
const builtIn = definitions.instanceMethods[prop.name];
|
||||
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
|
||||
} else if (node.computed) {
|
||||
if (
|
||||
t.isStringLiteral(prop) &&
|
||||
has(definitions.instanceMethods, prop.value)
|
||||
) {
|
||||
const builtIn = definitions.instanceMethods[prop.value];
|
||||
warnOnInstanceMethod(state, `${obj.name}['${prop.value}']`);
|
||||
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
|
||||
} else {
|
||||
const res = path.get("property").evaluate();
|
||||
if (res.confident) {
|
||||
const builtIn = definitions.instanceMethods[res.value];
|
||||
warnOnInstanceMethod(state, `${obj.name}['${res.value}']`);
|
||||
addUnsupported(
|
||||
path.get("property"),
|
||||
state.opts.polyfills,
|
||||
builtIn,
|
||||
this.builtIns,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Symbol.match
|
||||
exit(path, state) {
|
||||
if (!path.isReferenced()) return;
|
||||
|
||||
const { node } = path;
|
||||
const obj = node.object;
|
||||
|
||||
if (!has(definitions.builtins, obj.name)) return;
|
||||
if (path.scope.getBindingIdentifier(obj.name)) return;
|
||||
|
||||
const builtIn = definitions.builtins[obj.name];
|
||||
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
|
||||
},
|
||||
},
|
||||
|
||||
// var { repeat, startsWith } = String
|
||||
VariableDeclarator(path, state) {
|
||||
if (!path.isReferenced()) return;
|
||||
|
||||
const { node } = path;
|
||||
const obj = node.init;
|
||||
|
||||
if (!t.isObjectPattern(node.id)) return;
|
||||
const props = node.id.properties;
|
||||
|
||||
if (!t.isReferenced(obj, node)) return;
|
||||
|
||||
// doesn't reference the global
|
||||
if (path.scope.getBindingIdentifier(obj.name)) return;
|
||||
|
||||
for (let prop of props) {
|
||||
prop = prop.key;
|
||||
if (
|
||||
!node.computed &&
|
||||
t.isIdentifier(prop) &&
|
||||
has(definitions.instanceMethods, prop.name)
|
||||
) {
|
||||
warnOnInstanceMethod(
|
||||
state,
|
||||
`${path.parentPath.node.kind} { ${prop.name} } = ${obj.name}`,
|
||||
);
|
||||
|
||||
const builtIn = definitions.instanceMethods[prop.name];
|
||||
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Function(path, state) {
|
||||
if (!this.usesRegenerator && (path.node.generator || path.node.async)) {
|
||||
this.usesRegenerator = true;
|
||||
if (state.opts.regenerator) {
|
||||
addImport(path, "regenerator-runtime", this.builtIns);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
name: "use-built-ins",
|
||||
pre() {
|
||||
this.builtIns = new Set();
|
||||
this.usesRegenerator = false;
|
||||
},
|
||||
post() {
|
||||
const { debug, onDebug } = this.opts;
|
||||
|
||||
if (debug) {
|
||||
logUsagePolyfills(this.builtIns, this.file.opts.filename, onDebug);
|
||||
}
|
||||
},
|
||||
visitor: addAndRemovePolyfillImports,
|
||||
};
|
||||
}
|
||||
63
experimental/babel-preset-env/src/utils.js
Normal file
63
experimental/babel-preset-env/src/utils.js
Normal file
@ -0,0 +1,63 @@
|
||||
// @flow
|
||||
|
||||
import semver from "semver";
|
||||
import type { Targets } from "./types";
|
||||
|
||||
// Convert version to a semver value.
|
||||
// 2.5 -> 2.5.0; 1 -> 1.0.0;
|
||||
export const semverify = (version: string | number): string => {
|
||||
if (typeof version === "string" && semver.valid(version)) {
|
||||
return version;
|
||||
}
|
||||
|
||||
const split = version.toString().split(".");
|
||||
|
||||
while (split.length < 3) {
|
||||
split.push("0");
|
||||
}
|
||||
|
||||
return split.join(".");
|
||||
};
|
||||
|
||||
export const prettifyVersion = (version: string): string => {
|
||||
if (typeof version !== "string") {
|
||||
return version;
|
||||
}
|
||||
|
||||
const parts = [semver.major(version)];
|
||||
const minor = semver.minor(version);
|
||||
const patch = semver.patch(version);
|
||||
|
||||
if (minor || patch) {
|
||||
parts.push(minor);
|
||||
}
|
||||
|
||||
if (patch) {
|
||||
parts.push(patch);
|
||||
}
|
||||
|
||||
return parts.join(".");
|
||||
};
|
||||
|
||||
export const prettifyTargets = (targets: Targets): Object => {
|
||||
return Object.keys(targets).reduce((results, target) => {
|
||||
let value = targets[target];
|
||||
|
||||
if (typeof value === "string") {
|
||||
value = prettifyVersion(value);
|
||||
}
|
||||
|
||||
results[target] = value;
|
||||
return results;
|
||||
}, {});
|
||||
};
|
||||
|
||||
export const filterStageFromList = (list: any, stageList: any) => {
|
||||
return Object.keys(list).reduce((result, item) => {
|
||||
if (!stageList[item]) {
|
||||
result[item] = list[item];
|
||||
}
|
||||
|
||||
return result;
|
||||
}, {});
|
||||
};
|
||||
8
experimental/babel-preset-env/test/.eslintrc
Normal file
8
experimental/babel-preset-env/test/.eslintrc
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"env": {
|
||||
"mocha": true
|
||||
},
|
||||
"rules": {
|
||||
"max-len": 0
|
||||
}
|
||||
}
|
||||
125
experimental/babel-preset-env/test/debug-fixtures.js
Normal file
125
experimental/babel-preset-env/test/debug-fixtures.js
Normal file
@ -0,0 +1,125 @@
|
||||
const chai = require("chai");
|
||||
const child = require("child_process");
|
||||
const fs = require("fs-extra");
|
||||
const helper = require("babel-helper-fixtures");
|
||||
const path = require("path");
|
||||
|
||||
const fixtureLoc = path.join(__dirname, "debug-fixtures");
|
||||
const tmpLoc = path.join(__dirname, "tmp");
|
||||
|
||||
const clear = () => {
|
||||
process.chdir(__dirname);
|
||||
if (fs.existsSync(tmpLoc)) fs.removeSync(tmpLoc);
|
||||
fs.mkdirSync(tmpLoc);
|
||||
process.chdir(tmpLoc);
|
||||
};
|
||||
|
||||
const saveInFiles = files => {
|
||||
Object.keys(files).forEach(filename => {
|
||||
const content = files[filename];
|
||||
fs.outputFileSync(filename, content);
|
||||
});
|
||||
};
|
||||
|
||||
const testOutputType = (type, stdTarg, opts) => {
|
||||
stdTarg = stdTarg.trim();
|
||||
stdTarg = stdTarg.replace(/\\/g, "/");
|
||||
const optsTarg = opts[type];
|
||||
|
||||
if (optsTarg) {
|
||||
const expectStdout = optsTarg.trim();
|
||||
chai.expect(stdTarg).to.equal(expectStdout, `${type} didn't match`);
|
||||
} else {
|
||||
const file = path.join(opts.testLoc, `${type}.txt`);
|
||||
console.log(`New test file created: ${file}`);
|
||||
fs.outputFileSync(file, stdTarg);
|
||||
}
|
||||
};
|
||||
|
||||
const assertTest = (stdout, stderr, opts) => {
|
||||
testOutputType("stdout", stdout, opts);
|
||||
if (stderr) {
|
||||
testOutputType("stderr", stderr, opts);
|
||||
}
|
||||
};
|
||||
|
||||
const buildTest = opts => {
|
||||
const binLoc = path.join(process.cwd(), "node_modules/.bin/babel");
|
||||
|
||||
return callback => {
|
||||
clear();
|
||||
saveInFiles(opts.inFiles);
|
||||
|
||||
let args = [binLoc];
|
||||
args = args.concat(opts.args);
|
||||
|
||||
const spawn = child.spawn(process.execPath, args);
|
||||
|
||||
let stdout = "";
|
||||
let stderr = "";
|
||||
|
||||
spawn.stdout.on("data", chunk => (stdout += chunk));
|
||||
spawn.stderr.on("data", chunk => (stderr += chunk));
|
||||
|
||||
spawn.on("close", () => {
|
||||
let err;
|
||||
|
||||
try {
|
||||
assertTest(stdout, stderr, opts);
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
|
||||
callback(err);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
describe("debug output", () => {
|
||||
fs.readdirSync(fixtureLoc).forEach(testName => {
|
||||
if (testName.slice(0, 1) === ".") return;
|
||||
const testLoc = path.join(fixtureLoc, testName);
|
||||
if (testName.slice(0, 1) === ".") return;
|
||||
|
||||
const opts = {
|
||||
args: ["src", "--out-dir", "lib"],
|
||||
testLoc: testLoc,
|
||||
};
|
||||
|
||||
const stdoutLoc = path.join(testLoc, "stdout.txt");
|
||||
const stderrLoc = path.join(testLoc, "stderr.txt");
|
||||
|
||||
if (fs.existsSync(stdoutLoc)) {
|
||||
opts.stdout = helper.readFile(stdoutLoc);
|
||||
}
|
||||
|
||||
if (fs.existsSync(stderrLoc)) {
|
||||
opts.stderr = helper.readFile(stderrLoc);
|
||||
}
|
||||
|
||||
const optionsLoc = path.join(testLoc, "options.json");
|
||||
|
||||
if (!fs.existsSync(optionsLoc)) {
|
||||
throw new Error(
|
||||
`Debug test '${testName}' is missing an options.json file`,
|
||||
);
|
||||
}
|
||||
|
||||
const inFilesFolderLoc = path.join(testLoc, "in");
|
||||
|
||||
opts.inFiles = {
|
||||
".babelrc": helper.readFile(optionsLoc),
|
||||
};
|
||||
|
||||
if (!fs.existsSync(inFilesFolderLoc)) {
|
||||
opts.inFiles["src/in.js"] = "";
|
||||
} else {
|
||||
fs.readdirSync(inFilesFolderLoc).forEach(filename => {
|
||||
opts.inFiles[`src/${filename}`] = helper.readFile(
|
||||
path.join(inFilesFolderLoc, filename),
|
||||
);
|
||||
});
|
||||
}
|
||||
it(testName, buildTest(opts));
|
||||
});
|
||||
});
|
||||
@ -0,0 +1 @@
|
||||
import 'babel-polyfill';
|
||||
@ -0,0 +1,11 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../lib", {
|
||||
"debug": true,
|
||||
"targets": {
|
||||
"browsers": [ "Android >= 4" ]
|
||||
},
|
||||
"useBuiltIns": "entry"
|
||||
}]
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,126 @@
|
||||
babel-preset-env: `DEBUG` option
|
||||
|
||||
Using targets:
|
||||
{
|
||||
"android": "4"
|
||||
}
|
||||
|
||||
Using modules transform: commonjs
|
||||
|
||||
Using plugins:
|
||||
check-es2015-constants { "android":"4" }
|
||||
transform-es2015-arrow-functions { "android":"4" }
|
||||
transform-es2015-block-scoped-functions { "android":"4" }
|
||||
transform-es2015-block-scoping { "android":"4" }
|
||||
transform-es2015-classes { "android":"4" }
|
||||
transform-es2015-computed-properties { "android":"4" }
|
||||
transform-es2015-destructuring { "android":"4" }
|
||||
transform-es2015-duplicate-keys { "android":"4" }
|
||||
transform-es2015-for-of { "android":"4" }
|
||||
transform-es2015-function-name { "android":"4" }
|
||||
transform-es2015-literals { "android":"4" }
|
||||
transform-es2015-object-super { "android":"4" }
|
||||
transform-es2015-parameters { "android":"4" }
|
||||
transform-es2015-shorthand-properties { "android":"4" }
|
||||
transform-es2015-spread { "android":"4" }
|
||||
transform-es2015-sticky-regex { "android":"4" }
|
||||
transform-es2015-template-literals { "android":"4" }
|
||||
transform-es2015-typeof-symbol { "android":"4" }
|
||||
transform-es2015-unicode-regex { "android":"4" }
|
||||
transform-new-target { "android":"4" }
|
||||
transform-regenerator { "android":"4" }
|
||||
transform-exponentiation-operator { "android":"4" }
|
||||
transform-async-to-generator { "android":"4" }
|
||||
syntax-trailing-function-commas { "android":"4" }
|
||||
|
||||
Using polyfills with `entry` option:
|
||||
|
||||
[src/in.js] Replaced `babel-polyfill` with the following polyfills:
|
||||
es6.typed.array-buffer { "android":"4" }
|
||||
es6.typed.int8-array { "android":"4" }
|
||||
es6.typed.uint8-array { "android":"4" }
|
||||
es6.typed.uint8-clamped-array { "android":"4" }
|
||||
es6.typed.int16-array { "android":"4" }
|
||||
es6.typed.uint16-array { "android":"4" }
|
||||
es6.typed.int32-array { "android":"4" }
|
||||
es6.typed.uint32-array { "android":"4" }
|
||||
es6.typed.float32-array { "android":"4" }
|
||||
es6.typed.float64-array { "android":"4" }
|
||||
es6.map { "android":"4" }
|
||||
es6.set { "android":"4" }
|
||||
es6.weak-map { "android":"4" }
|
||||
es6.weak-set { "android":"4" }
|
||||
es6.reflect.apply { "android":"4" }
|
||||
es6.reflect.construct { "android":"4" }
|
||||
es6.reflect.define-property { "android":"4" }
|
||||
es6.reflect.delete-property { "android":"4" }
|
||||
es6.reflect.get { "android":"4" }
|
||||
es6.reflect.get-own-property-descriptor { "android":"4" }
|
||||
es6.reflect.get-prototype-of { "android":"4" }
|
||||
es6.reflect.has { "android":"4" }
|
||||
es6.reflect.is-extensible { "android":"4" }
|
||||
es6.reflect.own-keys { "android":"4" }
|
||||
es6.reflect.prevent-extensions { "android":"4" }
|
||||
es6.reflect.set { "android":"4" }
|
||||
es6.reflect.set-prototype-of { "android":"4" }
|
||||
es6.promise { "android":"4" }
|
||||
es6.symbol { "android":"4" }
|
||||
es6.object.assign { "android":"4" }
|
||||
es6.object.is { "android":"4" }
|
||||
es6.object.set-prototype-of { "android":"4" }
|
||||
es6.function.name { "android":"4" }
|
||||
es6.string.raw { "android":"4" }
|
||||
es6.string.from-code-point { "android":"4" }
|
||||
es6.string.code-point-at { "android":"4" }
|
||||
es6.string.repeat { "android":"4" }
|
||||
es6.string.starts-with { "android":"4" }
|
||||
es6.string.ends-with { "android":"4" }
|
||||
es6.string.includes { "android":"4" }
|
||||
es6.regexp.flags { "android":"4" }
|
||||
es6.regexp.match { "android":"4" }
|
||||
es6.regexp.replace { "android":"4" }
|
||||
es6.regexp.split { "android":"4" }
|
||||
es6.regexp.search { "android":"4" }
|
||||
es6.array.from { "android":"4" }
|
||||
es6.array.of { "android":"4" }
|
||||
es6.array.copy-within { "android":"4" }
|
||||
es6.array.find { "android":"4" }
|
||||
es6.array.find-index { "android":"4" }
|
||||
es6.array.fill { "android":"4" }
|
||||
es6.array.iterator { "android":"4" }
|
||||
es6.number.is-finite { "android":"4" }
|
||||
es6.number.is-integer { "android":"4" }
|
||||
es6.number.is-safe-integer { "android":"4" }
|
||||
es6.number.is-nan { "android":"4" }
|
||||
es6.number.epsilon { "android":"4" }
|
||||
es6.number.min-safe-integer { "android":"4" }
|
||||
es6.number.max-safe-integer { "android":"4" }
|
||||
es6.number.parse-float { "android":"4" }
|
||||
es6.number.parse-int { "android":"4" }
|
||||
es6.math.acosh { "android":"4" }
|
||||
es6.math.asinh { "android":"4" }
|
||||
es6.math.atanh { "android":"4" }
|
||||
es6.math.cbrt { "android":"4" }
|
||||
es6.math.clz32 { "android":"4" }
|
||||
es6.math.cosh { "android":"4" }
|
||||
es6.math.expm1 { "android":"4" }
|
||||
es6.math.fround { "android":"4" }
|
||||
es6.math.hypot { "android":"4" }
|
||||
es6.math.imul { "android":"4" }
|
||||
es6.math.log1p { "android":"4" }
|
||||
es6.math.log10 { "android":"4" }
|
||||
es6.math.log2 { "android":"4" }
|
||||
es6.math.sign { "android":"4" }
|
||||
es6.math.sinh { "android":"4" }
|
||||
es6.math.tanh { "android":"4" }
|
||||
es6.math.trunc { "android":"4" }
|
||||
es7.array.includes { "android":"4" }
|
||||
es7.object.values { "android":"4" }
|
||||
es7.object.entries { "android":"4" }
|
||||
es7.object.get-own-property-descriptors { "android":"4" }
|
||||
es7.string.pad-start { "android":"4" }
|
||||
es7.string.pad-end { "android":"4" }
|
||||
web.timers { "android":"4" }
|
||||
web.immediate { "android":"4" }
|
||||
web.dom.iterable { "android":"4" }
|
||||
src/in.js -> lib/in.js
|
||||
@ -0,0 +1 @@
|
||||
function hasAnyoneSeenImportBabelPolyfill() { return false };
|
||||
@ -0,0 +1,11 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../lib", {
|
||||
"debug": true,
|
||||
"targets": {
|
||||
"node": 6
|
||||
},
|
||||
"useBuiltIns": "entry"
|
||||
}]
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
babel-preset-env: `DEBUG` option
|
||||
|
||||
Using targets:
|
||||
{
|
||||
"node": "6"
|
||||
}
|
||||
|
||||
Using modules transform: commonjs
|
||||
|
||||
Using plugins:
|
||||
transform-es2015-destructuring { "node":"6" }
|
||||
transform-es2015-for-of { "node":"6" }
|
||||
transform-es2015-function-name { "node":"6" }
|
||||
transform-exponentiation-operator { "node":"6" }
|
||||
transform-async-to-generator { "node":"6" }
|
||||
syntax-trailing-function-commas { "node":"6" }
|
||||
|
||||
Using polyfills with `entry` option:
|
||||
|
||||
[src/in.js] `import 'babel-polyfill'` was not found.
|
||||
src/in.js -> lib/in.js
|
||||
@ -0,0 +1 @@
|
||||
import 'babel-polyfill';
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../lib", {
|
||||
"debug": true,
|
||||
"targets": {
|
||||
"chrome": 55,
|
||||
"uglify": true
|
||||
},
|
||||
"useBuiltIns": "entry",
|
||||
"modules": false
|
||||
}]
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
The uglify target has been deprecated. Set the top level
|
||||
option `forceAllTransforms: true` instead.
|
||||
|
||||
babel-preset-env: `DEBUG` option
|
||||
|
||||
Using targets:
|
||||
{
|
||||
"chrome": "55"
|
||||
}
|
||||
|
||||
Using modules transform: false
|
||||
|
||||
Using plugins:
|
||||
check-es2015-constants {}
|
||||
transform-es2015-arrow-functions {}
|
||||
transform-es2015-block-scoped-functions {}
|
||||
transform-es2015-block-scoping {}
|
||||
transform-es2015-classes {}
|
||||
transform-es2015-computed-properties {}
|
||||
transform-es2015-destructuring {}
|
||||
transform-es2015-duplicate-keys {}
|
||||
transform-es2015-for-of {}
|
||||
transform-es2015-function-name {}
|
||||
transform-es2015-literals {}
|
||||
transform-es2015-object-super {}
|
||||
transform-es2015-parameters {}
|
||||
transform-es2015-shorthand-properties {}
|
||||
transform-es2015-spread {}
|
||||
transform-es2015-sticky-regex {}
|
||||
transform-es2015-template-literals {}
|
||||
transform-es2015-typeof-symbol {}
|
||||
transform-es2015-unicode-regex {}
|
||||
transform-new-target {}
|
||||
transform-regenerator {}
|
||||
transform-exponentiation-operator {}
|
||||
transform-async-to-generator {}
|
||||
syntax-trailing-function-commas { "chrome":"55" }
|
||||
|
||||
Using polyfills with `entry` option:
|
||||
|
||||
[src/in.js] Replaced `babel-polyfill` with the following polyfills:
|
||||
es7.string.pad-start { "chrome":"55" }
|
||||
es7.string.pad-end { "chrome":"55" }
|
||||
web.timers { "chrome":"55" }
|
||||
web.immediate { "chrome":"55" }
|
||||
web.dom.iterable { "chrome":"55" }
|
||||
src/in.js -> lib/in.js
|
||||
@ -0,0 +1 @@
|
||||
import 'babel-polyfill';
|
||||
@ -0,0 +1,12 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../lib", {
|
||||
"debug": true,
|
||||
"targets": {
|
||||
"browsers": "chrome >= 54, ie 10",
|
||||
"node": 6
|
||||
},
|
||||
"useBuiltIns": "entry"
|
||||
}]
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,128 @@
|
||||
babel-preset-env: `DEBUG` option
|
||||
|
||||
Using targets:
|
||||
{
|
||||
"chrome": "54",
|
||||
"ie": "10",
|
||||
"node": "6"
|
||||
}
|
||||
|
||||
Using modules transform: commonjs
|
||||
|
||||
Using plugins:
|
||||
check-es2015-constants { "ie":"10" }
|
||||
transform-es2015-arrow-functions { "ie":"10" }
|
||||
transform-es2015-block-scoped-functions { "ie":"10" }
|
||||
transform-es2015-block-scoping { "ie":"10" }
|
||||
transform-es2015-classes { "ie":"10" }
|
||||
transform-es2015-computed-properties { "ie":"10" }
|
||||
transform-es2015-destructuring { "ie":"10", "node":"6" }
|
||||
transform-es2015-duplicate-keys { "ie":"10" }
|
||||
transform-es2015-for-of { "ie":"10", "node":"6" }
|
||||
transform-es2015-function-name { "ie":"10", "node":"6" }
|
||||
transform-es2015-literals { "ie":"10" }
|
||||
transform-es2015-object-super { "ie":"10" }
|
||||
transform-es2015-parameters { "ie":"10" }
|
||||
transform-es2015-shorthand-properties { "ie":"10" }
|
||||
transform-es2015-spread { "ie":"10" }
|
||||
transform-es2015-sticky-regex { "ie":"10" }
|
||||
transform-es2015-template-literals { "ie":"10" }
|
||||
transform-es2015-typeof-symbol { "ie":"10" }
|
||||
transform-es2015-unicode-regex { "ie":"10" }
|
||||
transform-new-target { "ie":"10" }
|
||||
transform-regenerator { "ie":"10" }
|
||||
transform-exponentiation-operator { "ie":"10", "node":"6" }
|
||||
transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6" }
|
||||
syntax-trailing-function-commas { "chrome":"54", "ie":"10", "node":"6" }
|
||||
|
||||
Using polyfills with `entry` option:
|
||||
|
||||
[src/in.js] Replaced `babel-polyfill` with the following polyfills:
|
||||
es6.typed.array-buffer { "ie":"10", "node":"6" }
|
||||
es6.typed.int8-array { "ie":"10", "node":"6" }
|
||||
es6.typed.uint8-array { "ie":"10", "node":"6" }
|
||||
es6.typed.uint8-clamped-array { "ie":"10", "node":"6" }
|
||||
es6.typed.int16-array { "ie":"10", "node":"6" }
|
||||
es6.typed.uint16-array { "ie":"10", "node":"6" }
|
||||
es6.typed.int32-array { "ie":"10", "node":"6" }
|
||||
es6.typed.uint32-array { "ie":"10", "node":"6" }
|
||||
es6.typed.float32-array { "ie":"10", "node":"6" }
|
||||
es6.typed.float64-array { "ie":"10", "node":"6" }
|
||||
es6.map { "ie":"10", "node":"6" }
|
||||
es6.set { "ie":"10", "node":"6" }
|
||||
es6.weak-map { "ie":"10", "node":"6" }
|
||||
es6.weak-set { "ie":"10", "node":"6" }
|
||||
es6.reflect.apply { "ie":"10" }
|
||||
es6.reflect.construct { "ie":"10" }
|
||||
es6.reflect.define-property { "ie":"10" }
|
||||
es6.reflect.delete-property { "ie":"10" }
|
||||
es6.reflect.get { "ie":"10" }
|
||||
es6.reflect.get-own-property-descriptor { "ie":"10" }
|
||||
es6.reflect.get-prototype-of { "ie":"10" }
|
||||
es6.reflect.has { "ie":"10" }
|
||||
es6.reflect.is-extensible { "ie":"10" }
|
||||
es6.reflect.own-keys { "ie":"10" }
|
||||
es6.reflect.prevent-extensions { "ie":"10" }
|
||||
es6.reflect.set { "ie":"10" }
|
||||
es6.reflect.set-prototype-of { "ie":"10" }
|
||||
es6.promise { "ie":"10", "node":"6" }
|
||||
es6.symbol { "ie":"10", "node":"6" }
|
||||
es6.object.assign { "ie":"10" }
|
||||
es6.object.is { "ie":"10" }
|
||||
es6.object.set-prototype-of { "ie":"10" }
|
||||
es6.function.name { "ie":"10", "node":"6" }
|
||||
es6.string.raw { "ie":"10" }
|
||||
es6.string.from-code-point { "ie":"10" }
|
||||
es6.string.code-point-at { "ie":"10" }
|
||||
es6.string.repeat { "ie":"10" }
|
||||
es6.string.starts-with { "ie":"10" }
|
||||
es6.string.ends-with { "ie":"10" }
|
||||
es6.string.includes { "ie":"10" }
|
||||
es6.regexp.flags { "ie":"10" }
|
||||
es6.regexp.match { "ie":"10" }
|
||||
es6.regexp.replace { "ie":"10" }
|
||||
es6.regexp.split { "ie":"10" }
|
||||
es6.regexp.search { "ie":"10" }
|
||||
es6.array.from { "ie":"10", "node":"6" }
|
||||
es6.array.of { "ie":"10" }
|
||||
es6.array.copy-within { "ie":"10" }
|
||||
es6.array.find { "ie":"10" }
|
||||
es6.array.find-index { "ie":"10" }
|
||||
es6.array.fill { "ie":"10" }
|
||||
es6.array.iterator { "ie":"10" }
|
||||
es6.number.is-finite { "ie":"10" }
|
||||
es6.number.is-integer { "ie":"10" }
|
||||
es6.number.is-safe-integer { "ie":"10" }
|
||||
es6.number.is-nan { "ie":"10" }
|
||||
es6.number.epsilon { "ie":"10" }
|
||||
es6.number.min-safe-integer { "ie":"10" }
|
||||
es6.number.max-safe-integer { "ie":"10" }
|
||||
es6.number.parse-float { "ie":"10" }
|
||||
es6.number.parse-int { "ie":"10" }
|
||||
es6.math.acosh { "ie":"10" }
|
||||
es6.math.asinh { "ie":"10" }
|
||||
es6.math.atanh { "ie":"10" }
|
||||
es6.math.cbrt { "ie":"10" }
|
||||
es6.math.clz32 { "ie":"10" }
|
||||
es6.math.cosh { "ie":"10" }
|
||||
es6.math.expm1 { "ie":"10" }
|
||||
es6.math.fround { "ie":"10" }
|
||||
es6.math.hypot { "ie":"10" }
|
||||
es6.math.imul { "ie":"10" }
|
||||
es6.math.log1p { "ie":"10" }
|
||||
es6.math.log10 { "ie":"10" }
|
||||
es6.math.log2 { "ie":"10" }
|
||||
es6.math.sign { "ie":"10" }
|
||||
es6.math.sinh { "ie":"10" }
|
||||
es6.math.tanh { "ie":"10" }
|
||||
es6.math.trunc { "ie":"10" }
|
||||
es7.array.includes { "ie":"10" }
|
||||
es7.object.values { "ie":"10", "node":"6" }
|
||||
es7.object.entries { "ie":"10", "node":"6" }
|
||||
es7.object.get-own-property-descriptors { "ie":"10", "node":"6" }
|
||||
es7.string.pad-start { "chrome":"54", "ie":"10", "node":"6" }
|
||||
es7.string.pad-end { "chrome":"54", "ie":"10", "node":"6" }
|
||||
web.timers { "chrome":"54", "ie":"10", "node":"6" }
|
||||
web.immediate { "chrome":"54", "ie":"10", "node":"6" }
|
||||
web.dom.iterable { "chrome":"54", "ie":"10", "node":"6" }
|
||||
src/in.js -> lib/in.js
|
||||
@ -0,0 +1 @@
|
||||
import 'babel-polyfill';
|
||||
@ -0,0 +1,11 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../lib", {
|
||||
"debug": true,
|
||||
"targets": {
|
||||
"electron": 0.36
|
||||
},
|
||||
"useBuiltIns": "entry"
|
||||
}]
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
Warning, the following targets are using a decimal version:
|
||||
|
||||
electron: 0.36
|
||||
|
||||
We recommend using a string for minor/patch versions to avoid numbers like 6.10
|
||||
getting parsed as 6.1, which can lead to unexpected behavior.
|
||||
|
||||
babel-preset-env: `DEBUG` option
|
||||
|
||||
Using targets:
|
||||
{
|
||||
"electron": "0.36"
|
||||
}
|
||||
|
||||
Using modules transform: commonjs
|
||||
|
||||
Using plugins:
|
||||
check-es2015-constants { "electron":"0.36" }
|
||||
transform-es2015-block-scoping { "electron":"0.36" }
|
||||
transform-es2015-destructuring { "electron":"0.36" }
|
||||
transform-es2015-for-of { "electron":"0.36" }
|
||||
transform-es2015-function-name { "electron":"0.36" }
|
||||
transform-es2015-parameters { "electron":"0.36" }
|
||||
transform-es2015-sticky-regex { "electron":"0.36" }
|
||||
transform-es2015-unicode-regex { "electron":"0.36" }
|
||||
transform-regenerator { "electron":"0.36" }
|
||||
transform-exponentiation-operator { "electron":"0.36" }
|
||||
transform-async-to-generator { "electron":"0.36" }
|
||||
syntax-trailing-function-commas { "electron":"0.36" }
|
||||
|
||||
Using polyfills with `entry` option:
|
||||
|
||||
[src/in.js] Replaced `babel-polyfill` with the following polyfills:
|
||||
es6.typed.array-buffer { "electron":"0.36" }
|
||||
es6.typed.data-view { "electron":"0.36" }
|
||||
es6.typed.int8-array { "electron":"0.36" }
|
||||
es6.typed.uint8-array { "electron":"0.36" }
|
||||
es6.typed.uint8-clamped-array { "electron":"0.36" }
|
||||
es6.typed.int16-array { "electron":"0.36" }
|
||||
es6.typed.uint16-array { "electron":"0.36" }
|
||||
es6.typed.int32-array { "electron":"0.36" }
|
||||
es6.typed.uint32-array { "electron":"0.36" }
|
||||
es6.typed.float32-array { "electron":"0.36" }
|
||||
es6.typed.float64-array { "electron":"0.36" }
|
||||
es6.map { "electron":"0.36" }
|
||||
es6.set { "electron":"0.36" }
|
||||
es6.weak-map { "electron":"0.36" }
|
||||
es6.weak-set { "electron":"0.36" }
|
||||
es6.reflect.apply { "electron":"0.36" }
|
||||
es6.reflect.construct { "electron":"0.36" }
|
||||
es6.reflect.define-property { "electron":"0.36" }
|
||||
es6.reflect.delete-property { "electron":"0.36" }
|
||||
es6.reflect.get { "electron":"0.36" }
|
||||
es6.reflect.get-own-property-descriptor { "electron":"0.36" }
|
||||
es6.reflect.get-prototype-of { "electron":"0.36" }
|
||||
es6.reflect.has { "electron":"0.36" }
|
||||
es6.reflect.is-extensible { "electron":"0.36" }
|
||||
es6.reflect.own-keys { "electron":"0.36" }
|
||||
es6.reflect.prevent-extensions { "electron":"0.36" }
|
||||
es6.reflect.set { "electron":"0.36" }
|
||||
es6.reflect.set-prototype-of { "electron":"0.36" }
|
||||
es6.promise { "electron":"0.36" }
|
||||
es6.symbol { "electron":"0.36" }
|
||||
es6.function.name { "electron":"0.36" }
|
||||
es6.regexp.flags { "electron":"0.36" }
|
||||
es6.regexp.match { "electron":"0.36" }
|
||||
es6.regexp.replace { "electron":"0.36" }
|
||||
es6.regexp.split { "electron":"0.36" }
|
||||
es6.regexp.search { "electron":"0.36" }
|
||||
es6.array.from { "electron":"0.36" }
|
||||
es7.object.values { "electron":"0.36" }
|
||||
es7.object.entries { "electron":"0.36" }
|
||||
es7.object.get-own-property-descriptors { "electron":"0.36" }
|
||||
es7.string.pad-start { "electron":"0.36" }
|
||||
es7.string.pad-end { "electron":"0.36" }
|
||||
web.timers { "electron":"0.36" }
|
||||
web.immediate { "electron":"0.36" }
|
||||
web.dom.iterable { "electron":"0.36" }
|
||||
src/in.js -> lib/in.js
|
||||
@ -0,0 +1 @@
|
||||
import 'babel-polyfill';
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../lib", {
|
||||
"debug": true,
|
||||
"modules": false,
|
||||
"targets": {
|
||||
"chrome": 55
|
||||
},
|
||||
"useBuiltIns": "entry",
|
||||
"forceAllTransforms": true
|
||||
}]
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
babel-preset-env: `DEBUG` option
|
||||
|
||||
Using targets:
|
||||
{
|
||||
"chrome": "55"
|
||||
}
|
||||
|
||||
Using modules transform: false
|
||||
|
||||
Using plugins:
|
||||
check-es2015-constants {}
|
||||
transform-es2015-arrow-functions {}
|
||||
transform-es2015-block-scoped-functions {}
|
||||
transform-es2015-block-scoping {}
|
||||
transform-es2015-classes {}
|
||||
transform-es2015-computed-properties {}
|
||||
transform-es2015-destructuring {}
|
||||
transform-es2015-duplicate-keys {}
|
||||
transform-es2015-for-of {}
|
||||
transform-es2015-function-name {}
|
||||
transform-es2015-literals {}
|
||||
transform-es2015-object-super {}
|
||||
transform-es2015-parameters {}
|
||||
transform-es2015-shorthand-properties {}
|
||||
transform-es2015-spread {}
|
||||
transform-es2015-sticky-regex {}
|
||||
transform-es2015-template-literals {}
|
||||
transform-es2015-typeof-symbol {}
|
||||
transform-es2015-unicode-regex {}
|
||||
transform-new-target {}
|
||||
transform-regenerator {}
|
||||
transform-exponentiation-operator {}
|
||||
transform-async-to-generator {}
|
||||
syntax-trailing-function-commas { "chrome":"55" }
|
||||
|
||||
Using polyfills with `entry` option:
|
||||
|
||||
[src/in.js] Replaced `babel-polyfill` with the following polyfills:
|
||||
es7.string.pad-start { "chrome":"55" }
|
||||
es7.string.pad-end { "chrome":"55" }
|
||||
web.timers { "chrome":"55" }
|
||||
web.immediate { "chrome":"55" }
|
||||
web.dom.iterable { "chrome":"55" }
|
||||
src/in.js -> lib/in.js
|
||||
@ -0,0 +1,17 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../lib", {
|
||||
"debug": true,
|
||||
"exclude": [
|
||||
"transform-async-to-generator",
|
||||
"transform-regenerator",
|
||||
"transform-es2015-parameters"
|
||||
],
|
||||
"targets": {
|
||||
"firefox": 52,
|
||||
"node": 7.4
|
||||
},
|
||||
"useBuiltIns": false
|
||||
}]
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
Warning, the following targets are using a decimal version:
|
||||
|
||||
node: 7.4
|
||||
|
||||
We recommend using a string for minor/patch versions to avoid numbers like 6.10
|
||||
getting parsed as 6.1, which can lead to unexpected behavior.
|
||||
|
||||
babel-preset-env: `DEBUG` option
|
||||
|
||||
Using targets:
|
||||
{
|
||||
"firefox": "52",
|
||||
"node": "7.4"
|
||||
}
|
||||
|
||||
Using modules transform: commonjs
|
||||
|
||||
Using plugins:
|
||||
transform-es2015-destructuring { "firefox":"52" }
|
||||
transform-es2015-for-of { "firefox":"52" }
|
||||
transform-es2015-function-name { "firefox":"52" }
|
||||
transform-es2015-literals { "firefox":"52" }
|
||||
syntax-trailing-function-commas { "node":"7.4" }
|
||||
|
||||
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
|
||||
src/in.js -> lib/in.js
|
||||
@ -0,0 +1 @@
|
||||
import 'babel-polyfill';
|
||||
@ -0,0 +1,12 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../lib", {
|
||||
"debug": true,
|
||||
"targets": {
|
||||
"browsers": "chrome 60"
|
||||
},
|
||||
"shippedProposals": true,
|
||||
"useBuiltIns": "entry"
|
||||
}]
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
babel-preset-env: `DEBUG` option
|
||||
|
||||
Using targets:
|
||||
{
|
||||
"chrome": "60"
|
||||
}
|
||||
|
||||
Using modules transform: commonjs
|
||||
|
||||
Using plugins:
|
||||
transform-async-generator-functions { "chrome":"60" }
|
||||
syntax-object-rest-spread { "chrome":"60" }
|
||||
transform-optional-catch-binding { "chrome":"60" }
|
||||
transform-unicode-property-regex { "chrome":"60" }
|
||||
|
||||
Using polyfills with `entry` option:
|
||||
|
||||
[src/in.js] Replaced `babel-polyfill` with the following polyfills:
|
||||
es7.promise.finally { "chrome":"60" }
|
||||
web.timers { "chrome":"60" }
|
||||
web.immediate { "chrome":"60" }
|
||||
web.dom.iterable { "chrome":"60" }
|
||||
src/in.js -> lib/in.js
|
||||
@ -0,0 +1 @@
|
||||
import 'babel-polyfill';
|
||||
@ -0,0 +1,9 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../lib", {
|
||||
"debug": true,
|
||||
"shippedProposals": true,
|
||||
"useBuiltIns": "entry"
|
||||
}]
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,130 @@
|
||||
babel-preset-env: `DEBUG` option
|
||||
|
||||
Using targets:
|
||||
{}
|
||||
|
||||
Using modules transform: commonjs
|
||||
|
||||
Using plugins:
|
||||
check-es2015-constants {}
|
||||
transform-es2015-arrow-functions {}
|
||||
transform-es2015-block-scoped-functions {}
|
||||
transform-es2015-block-scoping {}
|
||||
transform-es2015-classes {}
|
||||
transform-es2015-computed-properties {}
|
||||
transform-es2015-destructuring {}
|
||||
transform-es2015-duplicate-keys {}
|
||||
transform-es2015-for-of {}
|
||||
transform-es2015-function-name {}
|
||||
transform-es2015-literals {}
|
||||
transform-es2015-object-super {}
|
||||
transform-es2015-parameters {}
|
||||
transform-es2015-shorthand-properties {}
|
||||
transform-es2015-spread {}
|
||||
transform-es2015-sticky-regex {}
|
||||
transform-es2015-template-literals {}
|
||||
transform-es2015-typeof-symbol {}
|
||||
transform-es2015-unicode-regex {}
|
||||
transform-new-target {}
|
||||
transform-regenerator {}
|
||||
transform-exponentiation-operator {}
|
||||
transform-async-to-generator {}
|
||||
syntax-trailing-function-commas {}
|
||||
transform-async-generator-functions {}
|
||||
transform-object-rest-spread {}
|
||||
transform-optional-catch-binding {}
|
||||
transform-unicode-property-regex {}
|
||||
|
||||
Using polyfills with `entry` option:
|
||||
|
||||
[src/in.js] Replaced `babel-polyfill` with the following polyfills:
|
||||
es6.typed.array-buffer {}
|
||||
es6.typed.data-view {}
|
||||
es6.typed.int8-array {}
|
||||
es6.typed.uint8-array {}
|
||||
es6.typed.uint8-clamped-array {}
|
||||
es6.typed.int16-array {}
|
||||
es6.typed.uint16-array {}
|
||||
es6.typed.int32-array {}
|
||||
es6.typed.uint32-array {}
|
||||
es6.typed.float32-array {}
|
||||
es6.typed.float64-array {}
|
||||
es6.map {}
|
||||
es6.set {}
|
||||
es6.weak-map {}
|
||||
es6.weak-set {}
|
||||
es6.reflect.apply {}
|
||||
es6.reflect.construct {}
|
||||
es6.reflect.define-property {}
|
||||
es6.reflect.delete-property {}
|
||||
es6.reflect.get {}
|
||||
es6.reflect.get-own-property-descriptor {}
|
||||
es6.reflect.get-prototype-of {}
|
||||
es6.reflect.has {}
|
||||
es6.reflect.is-extensible {}
|
||||
es6.reflect.own-keys {}
|
||||
es6.reflect.prevent-extensions {}
|
||||
es6.reflect.set {}
|
||||
es6.reflect.set-prototype-of {}
|
||||
es6.promise {}
|
||||
es6.symbol {}
|
||||
es6.object.assign {}
|
||||
es6.object.is {}
|
||||
es6.object.set-prototype-of {}
|
||||
es6.function.name {}
|
||||
es6.string.raw {}
|
||||
es6.string.from-code-point {}
|
||||
es6.string.code-point-at {}
|
||||
es6.string.repeat {}
|
||||
es6.string.starts-with {}
|
||||
es6.string.ends-with {}
|
||||
es6.string.includes {}
|
||||
es6.regexp.flags {}
|
||||
es6.regexp.match {}
|
||||
es6.regexp.replace {}
|
||||
es6.regexp.split {}
|
||||
es6.regexp.search {}
|
||||
es6.array.from {}
|
||||
es6.array.of {}
|
||||
es6.array.copy-within {}
|
||||
es6.array.find {}
|
||||
es6.array.find-index {}
|
||||
es6.array.fill {}
|
||||
es6.array.iterator {}
|
||||
es6.number.is-finite {}
|
||||
es6.number.is-integer {}
|
||||
es6.number.is-safe-integer {}
|
||||
es6.number.is-nan {}
|
||||
es6.number.epsilon {}
|
||||
es6.number.min-safe-integer {}
|
||||
es6.number.max-safe-integer {}
|
||||
es6.number.parse-float {}
|
||||
es6.number.parse-int {}
|
||||
es6.math.acosh {}
|
||||
es6.math.asinh {}
|
||||
es6.math.atanh {}
|
||||
es6.math.cbrt {}
|
||||
es6.math.clz32 {}
|
||||
es6.math.cosh {}
|
||||
es6.math.expm1 {}
|
||||
es6.math.fround {}
|
||||
es6.math.hypot {}
|
||||
es6.math.imul {}
|
||||
es6.math.log1p {}
|
||||
es6.math.log10 {}
|
||||
es6.math.log2 {}
|
||||
es6.math.sign {}
|
||||
es6.math.sinh {}
|
||||
es6.math.tanh {}
|
||||
es6.math.trunc {}
|
||||
es7.array.includes {}
|
||||
es7.object.values {}
|
||||
es7.object.entries {}
|
||||
es7.object.get-own-property-descriptors {}
|
||||
es7.string.pad-start {}
|
||||
es7.string.pad-end {}
|
||||
es7.promise.finally {}
|
||||
web.timers {}
|
||||
web.immediate {}
|
||||
web.dom.iterable {}
|
||||
src/in.js -> lib/in.js
|
||||
@ -0,0 +1 @@
|
||||
import 'babel-polyfill';
|
||||
@ -0,0 +1,11 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../lib", {
|
||||
"debug": true,
|
||||
"targets": {
|
||||
"browsers": "ie 10, ios 9, safari 7, edge 13, chrome 54, firefox 49"
|
||||
},
|
||||
"useBuiltIns": "entry"
|
||||
}]
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,131 @@
|
||||
babel-preset-env: `DEBUG` option
|
||||
|
||||
Using targets:
|
||||
{
|
||||
"chrome": "54",
|
||||
"edge": "13",
|
||||
"firefox": "49",
|
||||
"ie": "10",
|
||||
"ios": "9",
|
||||
"safari": "7"
|
||||
}
|
||||
|
||||
Using modules transform: commonjs
|
||||
|
||||
Using plugins:
|
||||
check-es2015-constants { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
|
||||
transform-es2015-arrow-functions { "ie":"10", "ios":"9", "safari":"7" }
|
||||
transform-es2015-block-scoped-functions { "ie":"10", "ios":"9", "safari":"7" }
|
||||
transform-es2015-block-scoping { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
|
||||
transform-es2015-classes { "ie":"10", "ios":"9", "safari":"7" }
|
||||
transform-es2015-computed-properties { "ie":"10", "safari":"7" }
|
||||
transform-es2015-destructuring { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
|
||||
transform-es2015-duplicate-keys { "ie":"10", "safari":"7" }
|
||||
transform-es2015-for-of { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
|
||||
transform-es2015-function-name { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
|
||||
transform-es2015-literals { "firefox":"49", "ie":"10", "safari":"7" }
|
||||
transform-es2015-object-super { "ie":"10", "ios":"9", "safari":"7" }
|
||||
transform-es2015-parameters { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
|
||||
transform-es2015-shorthand-properties { "ie":"10", "safari":"7" }
|
||||
transform-es2015-spread { "ie":"10", "ios":"9", "safari":"7" }
|
||||
transform-es2015-sticky-regex { "ie":"10", "ios":"9", "safari":"7" }
|
||||
transform-es2015-template-literals { "ie":"10", "safari":"7" }
|
||||
transform-es2015-typeof-symbol { "ie":"10", "safari":"7" }
|
||||
transform-es2015-unicode-regex { "ie":"10", "ios":"9", "safari":"7" }
|
||||
transform-new-target { "edge":"13", "ie":"10", "ios":"9", "safari":"7" }
|
||||
transform-regenerator { "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
|
||||
transform-exponentiation-operator { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
|
||||
transform-async-to-generator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
|
||||
syntax-trailing-function-commas { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
|
||||
|
||||
Using polyfills with `entry` option:
|
||||
|
||||
[src/in.js] Replaced `babel-polyfill` with the following polyfills:
|
||||
es6.typed.array-buffer { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.typed.int8-array { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.typed.uint8-array { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.typed.uint8-clamped-array { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.typed.int16-array { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.typed.uint16-array { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.typed.int32-array { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.typed.uint32-array { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.typed.float32-array { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.typed.float64-array { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.map { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.set { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.weak-map { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" }
|
||||
es6.weak-set { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" }
|
||||
es6.reflect.apply { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.reflect.construct { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.reflect.define-property { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.reflect.delete-property { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.reflect.get { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.reflect.get-own-property-descriptor { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.reflect.get-prototype-of { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.reflect.has { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.reflect.is-extensible { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.reflect.own-keys { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.reflect.prevent-extensions { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.reflect.set { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.reflect.set-prototype-of { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.promise { "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.symbol { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.object.assign { "ie":"10", "safari":"7" }
|
||||
es6.object.is { "ie":"10", "safari":"7" }
|
||||
es6.object.set-prototype-of { "ie":"10", "safari":"7" }
|
||||
es6.function.name { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.string.raw { "ie":"10", "safari":"7" }
|
||||
es6.string.from-code-point { "ie":"10", "safari":"7" }
|
||||
es6.string.code-point-at { "ie":"10", "safari":"7" }
|
||||
es6.string.repeat { "ie":"10", "safari":"7" }
|
||||
es6.string.starts-with { "ie":"10", "safari":"7" }
|
||||
es6.string.ends-with { "ie":"10", "safari":"7" }
|
||||
es6.string.includes { "ie":"10", "safari":"7" }
|
||||
es6.regexp.flags { "edge":"13", "ie":"10", "safari":"7" }
|
||||
es6.regexp.match { "edge":"13", "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.regexp.replace { "edge":"13", "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.regexp.split { "edge":"13", "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.regexp.search { "edge":"13", "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.array.from { "edge":"13", "ie":"10", "ios":"9", "safari":"7" }
|
||||
es6.array.of { "ie":"10", "safari":"7" }
|
||||
es6.array.copy-within { "ie":"10", "safari":"7" }
|
||||
es6.array.find { "ie":"10", "safari":"7" }
|
||||
es6.array.find-index { "ie":"10", "safari":"7" }
|
||||
es6.array.fill { "ie":"10", "safari":"7" }
|
||||
es6.array.iterator { "ie":"10", "safari":"7" }
|
||||
es6.number.is-finite { "ie":"10", "safari":"7" }
|
||||
es6.number.is-integer { "ie":"10", "safari":"7" }
|
||||
es6.number.is-safe-integer { "ie":"10", "safari":"7" }
|
||||
es6.number.is-nan { "ie":"10", "safari":"7" }
|
||||
es6.number.epsilon { "ie":"10", "safari":"7" }
|
||||
es6.number.min-safe-integer { "ie":"10", "safari":"7" }
|
||||
es6.number.max-safe-integer { "ie":"10", "safari":"7" }
|
||||
es6.number.parse-float { "ie":"10", "safari":"7" }
|
||||
es6.number.parse-int { "ie":"10", "safari":"7" }
|
||||
es6.math.acosh { "ie":"10", "safari":"7" }
|
||||
es6.math.asinh { "ie":"10", "safari":"7" }
|
||||
es6.math.atanh { "ie":"10", "safari":"7" }
|
||||
es6.math.cbrt { "ie":"10", "safari":"7" }
|
||||
es6.math.clz32 { "ie":"10", "safari":"7" }
|
||||
es6.math.cosh { "ie":"10", "safari":"7" }
|
||||
es6.math.expm1 { "ie":"10", "safari":"7" }
|
||||
es6.math.fround { "ie":"10", "safari":"7" }
|
||||
es6.math.hypot { "ie":"10", "safari":"7" }
|
||||
es6.math.imul { "ie":"10" }
|
||||
es6.math.log1p { "ie":"10", "safari":"7" }
|
||||
es6.math.log10 { "ie":"10", "safari":"7" }
|
||||
es6.math.log2 { "ie":"10", "safari":"7" }
|
||||
es6.math.sign { "ie":"10", "safari":"7" }
|
||||
es6.math.sinh { "ie":"10", "safari":"7" }
|
||||
es6.math.tanh { "ie":"10", "safari":"7" }
|
||||
es6.math.trunc { "ie":"10", "safari":"7" }
|
||||
es7.array.includes { "edge":"13", "ie":"10", "ios":"9", "safari":"7" }
|
||||
es7.object.values { "edge":"13", "ie":"10", "ios":"9", "safari":"7" }
|
||||
es7.object.entries { "edge":"13", "ie":"10", "ios":"9", "safari":"7" }
|
||||
es7.object.get-own-property-descriptors { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
|
||||
es7.string.pad-start { "chrome":"54", "edge":"13", "ie":"10", "ios":"9", "safari":"7" }
|
||||
es7.string.pad-end { "chrome":"54", "edge":"13", "ie":"10", "ios":"9", "safari":"7" }
|
||||
web.timers { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
|
||||
web.immediate { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
|
||||
web.dom.iterable { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" }
|
||||
src/in.js -> lib/in.js
|
||||
@ -0,0 +1 @@
|
||||
var foo = "bar";
|
||||
@ -0,0 +1,5 @@
|
||||
var x = 0;
|
||||
|
||||
for (var i = 0; i < 5; i++) {
|
||||
x += i;
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../lib", {
|
||||
"debug": true,
|
||||
"targets": {
|
||||
"chrome": 52,
|
||||
"firefox": 50,
|
||||
"ie": 11
|
||||
},
|
||||
"useBuiltIns": "usage"
|
||||
}]
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
babel-preset-env: `DEBUG` option
|
||||
|
||||
Using targets:
|
||||
{
|
||||
"chrome": "52",
|
||||
"firefox": "50",
|
||||
"ie": "11"
|
||||
}
|
||||
|
||||
Using modules transform: commonjs
|
||||
|
||||
Using plugins:
|
||||
check-es2015-constants { "firefox":"50", "ie":"11" }
|
||||
transform-es2015-arrow-functions { "ie":"11" }
|
||||
transform-es2015-block-scoping { "firefox":"50", "ie":"11" }
|
||||
transform-es2015-classes { "ie":"11" }
|
||||
transform-es2015-computed-properties { "ie":"11" }
|
||||
transform-es2015-destructuring { "firefox":"50", "ie":"11" }
|
||||
transform-es2015-duplicate-keys { "ie":"11" }
|
||||
transform-es2015-for-of { "firefox":"50", "ie":"11" }
|
||||
transform-es2015-function-name { "firefox":"50", "ie":"11" }
|
||||
transform-es2015-literals { "firefox":"50", "ie":"11" }
|
||||
transform-es2015-object-super { "ie":"11" }
|
||||
transform-es2015-parameters { "firefox":"50", "ie":"11" }
|
||||
transform-es2015-shorthand-properties { "ie":"11" }
|
||||
transform-es2015-spread { "ie":"11" }
|
||||
transform-es2015-sticky-regex { "ie":"11" }
|
||||
transform-es2015-template-literals { "ie":"11" }
|
||||
transform-es2015-typeof-symbol { "ie":"11" }
|
||||
transform-es2015-unicode-regex { "ie":"11" }
|
||||
transform-new-target { "ie":"11" }
|
||||
transform-regenerator { "firefox":"50", "ie":"11" }
|
||||
transform-exponentiation-operator { "firefox":"50", "ie":"11" }
|
||||
transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" }
|
||||
syntax-trailing-function-commas { "chrome":"52", "firefox":"50", "ie":"11" }
|
||||
|
||||
Using polyfills with `usage` option:
|
||||
|
||||
[src/in.js] Based on your code and targets, none were added.
|
||||
src/in.js -> lib/in.js
|
||||
|
||||
[src/in2.js] Based on your code and targets, none were added.
|
||||
src/in2.js -> lib/in2.js
|
||||
@ -0,0 +1 @@
|
||||
import 'babel-polyfill';
|
||||
@ -0,0 +1,11 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../lib", {
|
||||
"debug": true,
|
||||
"targets": {
|
||||
"chrome": 55
|
||||
},
|
||||
"useBuiltIns": "usage"
|
||||
}]
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
When setting `useBuiltIns: 'usage'`, polyfills are automatically imported when needed.
|
||||
Please remove the `import 'babel-polyfill'` call or use `useBuiltIns: 'entry'` instead.
|
||||
@ -0,0 +1,16 @@
|
||||
babel-preset-env: `DEBUG` option
|
||||
|
||||
Using targets:
|
||||
{
|
||||
"chrome": "55"
|
||||
}
|
||||
|
||||
Using modules transform: commonjs
|
||||
|
||||
Using plugins:
|
||||
syntax-trailing-function-commas { "chrome":"55" }
|
||||
|
||||
Using polyfills with `usage` option:
|
||||
|
||||
[src/in.js] Based on your code and targets, none were added.
|
||||
src/in.js -> lib/in.js
|
||||
@ -0,0 +1,3 @@
|
||||
const foo = new Promise((resolve) => {
|
||||
resolve(new Map());
|
||||
});
|
||||
@ -0,0 +1,3 @@
|
||||
function* a() {
|
||||
yield* 1;
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../lib", {
|
||||
"debug": true,
|
||||
"targets": {
|
||||
"chrome": 52,
|
||||
"firefox": 50,
|
||||
"ie": 11
|
||||
},
|
||||
"useBuiltIns": "usage"
|
||||
}]
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
babel-preset-env: `DEBUG` option
|
||||
|
||||
Using targets:
|
||||
{
|
||||
"chrome": "52",
|
||||
"firefox": "50",
|
||||
"ie": "11"
|
||||
}
|
||||
|
||||
Using modules transform: commonjs
|
||||
|
||||
Using plugins:
|
||||
check-es2015-constants { "firefox":"50", "ie":"11" }
|
||||
transform-es2015-arrow-functions { "ie":"11" }
|
||||
transform-es2015-block-scoping { "firefox":"50", "ie":"11" }
|
||||
transform-es2015-classes { "ie":"11" }
|
||||
transform-es2015-computed-properties { "ie":"11" }
|
||||
transform-es2015-destructuring { "firefox":"50", "ie":"11" }
|
||||
transform-es2015-duplicate-keys { "ie":"11" }
|
||||
transform-es2015-for-of { "firefox":"50", "ie":"11" }
|
||||
transform-es2015-function-name { "firefox":"50", "ie":"11" }
|
||||
transform-es2015-literals { "firefox":"50", "ie":"11" }
|
||||
transform-es2015-object-super { "ie":"11" }
|
||||
transform-es2015-parameters { "firefox":"50", "ie":"11" }
|
||||
transform-es2015-shorthand-properties { "ie":"11" }
|
||||
transform-es2015-spread { "ie":"11" }
|
||||
transform-es2015-sticky-regex { "ie":"11" }
|
||||
transform-es2015-template-literals { "ie":"11" }
|
||||
transform-es2015-typeof-symbol { "ie":"11" }
|
||||
transform-es2015-unicode-regex { "ie":"11" }
|
||||
transform-new-target { "ie":"11" }
|
||||
transform-regenerator { "firefox":"50", "ie":"11" }
|
||||
transform-exponentiation-operator { "firefox":"50", "ie":"11" }
|
||||
transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" }
|
||||
syntax-trailing-function-commas { "chrome":"52", "firefox":"50", "ie":"11" }
|
||||
|
||||
Using polyfills with `usage` option:
|
||||
|
||||
[src/in.js] Added following polyfills:
|
||||
es6.promise { "ie":"11" }
|
||||
es6.map { "firefox":"50", "ie":"11" }
|
||||
src/in.js -> lib/in.js
|
||||
|
||||
[src/in2.js] Added following polyfills:
|
||||
regenerator-runtime { "chrome":"52", "firefox":"50", "ie":"11" }
|
||||
web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" }
|
||||
src/in2.js -> lib/in2.js
|
||||
@ -0,0 +1 @@
|
||||
import 'babel-polyfill';
|
||||
@ -0,0 +1,14 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../lib", {
|
||||
"useBuiltIns": "entry",
|
||||
"debug": true,
|
||||
"targets": {
|
||||
"chrome": 54,
|
||||
"electron": 0.36,
|
||||
"node": 6.10,
|
||||
"ie": 10
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,138 @@
|
||||
Warning, the following targets are using a decimal version:
|
||||
|
||||
electron: 0.36
|
||||
node: 6.1
|
||||
|
||||
We recommend using a string for minor/patch versions to avoid numbers like 6.10
|
||||
getting parsed as 6.1, which can lead to unexpected behavior.
|
||||
|
||||
babel-preset-env: `DEBUG` option
|
||||
|
||||
Using targets:
|
||||
{
|
||||
"chrome": "54",
|
||||
"electron": "0.36",
|
||||
"ie": "10",
|
||||
"node": "6.1"
|
||||
}
|
||||
|
||||
Using modules transform: commonjs
|
||||
|
||||
Using plugins:
|
||||
check-es2015-constants { "electron":"0.36", "ie":"10" }
|
||||
transform-es2015-arrow-functions { "ie":"10" }
|
||||
transform-es2015-block-scoped-functions { "ie":"10" }
|
||||
transform-es2015-block-scoping { "electron":"0.36", "ie":"10" }
|
||||
transform-es2015-classes { "ie":"10" }
|
||||
transform-es2015-computed-properties { "ie":"10" }
|
||||
transform-es2015-destructuring { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
transform-es2015-duplicate-keys { "ie":"10" }
|
||||
transform-es2015-for-of { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
transform-es2015-function-name { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
transform-es2015-literals { "ie":"10" }
|
||||
transform-es2015-object-super { "ie":"10" }
|
||||
transform-es2015-parameters { "electron":"0.36", "ie":"10" }
|
||||
transform-es2015-shorthand-properties { "ie":"10" }
|
||||
transform-es2015-spread { "ie":"10" }
|
||||
transform-es2015-sticky-regex { "electron":"0.36", "ie":"10" }
|
||||
transform-es2015-template-literals { "ie":"10" }
|
||||
transform-es2015-typeof-symbol { "ie":"10" }
|
||||
transform-es2015-unicode-regex { "electron":"0.36", "ie":"10" }
|
||||
transform-new-target { "ie":"10" }
|
||||
transform-regenerator { "electron":"0.36", "ie":"10" }
|
||||
transform-exponentiation-operator { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
transform-async-to-generator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
syntax-trailing-function-commas { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
|
||||
Using polyfills with `entry` option:
|
||||
|
||||
[src/in.js] Replaced `babel-polyfill` with the following polyfills:
|
||||
es6.typed.array-buffer { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es6.typed.data-view { "electron":"0.36" }
|
||||
es6.typed.int8-array { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es6.typed.uint8-array { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es6.typed.uint8-clamped-array { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es6.typed.int16-array { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es6.typed.uint16-array { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es6.typed.int32-array { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es6.typed.uint32-array { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es6.typed.float32-array { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es6.typed.float64-array { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es6.map { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es6.set { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es6.weak-map { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es6.weak-set { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es6.reflect.apply { "electron":"0.36", "ie":"10" }
|
||||
es6.reflect.construct { "electron":"0.36", "ie":"10" }
|
||||
es6.reflect.define-property { "electron":"0.36", "ie":"10" }
|
||||
es6.reflect.delete-property { "electron":"0.36", "ie":"10" }
|
||||
es6.reflect.get { "electron":"0.36", "ie":"10" }
|
||||
es6.reflect.get-own-property-descriptor { "electron":"0.36", "ie":"10" }
|
||||
es6.reflect.get-prototype-of { "electron":"0.36", "ie":"10" }
|
||||
es6.reflect.has { "electron":"0.36", "ie":"10" }
|
||||
es6.reflect.is-extensible { "electron":"0.36", "ie":"10" }
|
||||
es6.reflect.own-keys { "electron":"0.36", "ie":"10" }
|
||||
es6.reflect.prevent-extensions { "electron":"0.36", "ie":"10" }
|
||||
es6.reflect.set { "electron":"0.36", "ie":"10" }
|
||||
es6.reflect.set-prototype-of { "electron":"0.36", "ie":"10" }
|
||||
es6.promise { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es6.symbol { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es6.object.assign { "ie":"10" }
|
||||
es6.object.is { "ie":"10" }
|
||||
es6.object.set-prototype-of { "ie":"10" }
|
||||
es6.function.name { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es6.string.raw { "ie":"10" }
|
||||
es6.string.from-code-point { "ie":"10" }
|
||||
es6.string.code-point-at { "ie":"10" }
|
||||
es6.string.repeat { "ie":"10" }
|
||||
es6.string.starts-with { "ie":"10" }
|
||||
es6.string.ends-with { "ie":"10" }
|
||||
es6.string.includes { "ie":"10" }
|
||||
es6.regexp.flags { "electron":"0.36", "ie":"10" }
|
||||
es6.regexp.match { "electron":"0.36", "ie":"10" }
|
||||
es6.regexp.replace { "electron":"0.36", "ie":"10" }
|
||||
es6.regexp.split { "electron":"0.36", "ie":"10" }
|
||||
es6.regexp.search { "electron":"0.36", "ie":"10" }
|
||||
es6.array.from { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es6.array.of { "ie":"10" }
|
||||
es6.array.copy-within { "ie":"10" }
|
||||
es6.array.find { "ie":"10" }
|
||||
es6.array.find-index { "ie":"10" }
|
||||
es6.array.fill { "ie":"10" }
|
||||
es6.array.iterator { "ie":"10" }
|
||||
es6.number.is-finite { "ie":"10" }
|
||||
es6.number.is-integer { "ie":"10" }
|
||||
es6.number.is-safe-integer { "ie":"10" }
|
||||
es6.number.is-nan { "ie":"10" }
|
||||
es6.number.epsilon { "ie":"10" }
|
||||
es6.number.min-safe-integer { "ie":"10" }
|
||||
es6.number.max-safe-integer { "ie":"10" }
|
||||
es6.number.parse-float { "ie":"10" }
|
||||
es6.number.parse-int { "ie":"10" }
|
||||
es6.math.acosh { "ie":"10" }
|
||||
es6.math.asinh { "ie":"10" }
|
||||
es6.math.atanh { "ie":"10" }
|
||||
es6.math.cbrt { "ie":"10" }
|
||||
es6.math.clz32 { "ie":"10" }
|
||||
es6.math.cosh { "ie":"10" }
|
||||
es6.math.expm1 { "ie":"10" }
|
||||
es6.math.fround { "ie":"10" }
|
||||
es6.math.hypot { "ie":"10" }
|
||||
es6.math.imul { "ie":"10" }
|
||||
es6.math.log1p { "ie":"10" }
|
||||
es6.math.log10 { "ie":"10" }
|
||||
es6.math.log2 { "ie":"10" }
|
||||
es6.math.sign { "ie":"10" }
|
||||
es6.math.sinh { "ie":"10" }
|
||||
es6.math.tanh { "ie":"10" }
|
||||
es6.math.trunc { "ie":"10" }
|
||||
es7.array.includes { "ie":"10" }
|
||||
es7.object.values { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es7.object.entries { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es7.object.get-own-property-descriptors { "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es7.string.pad-start { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
es7.string.pad-end { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
web.timers { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
web.immediate { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
web.dom.iterable { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" }
|
||||
src/in.js -> lib/in.js
|
||||
@ -0,0 +1 @@
|
||||
import 'babel-polyfill';
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../lib", {
|
||||
"useBuiltIns": "entry",
|
||||
"debug": true,
|
||||
"targets": {
|
||||
"chrome": "54",
|
||||
"node": "6.10",
|
||||
"ie": "10"
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,128 @@
|
||||
babel-preset-env: `DEBUG` option
|
||||
|
||||
Using targets:
|
||||
{
|
||||
"chrome": "54",
|
||||
"ie": "10",
|
||||
"node": "6.10"
|
||||
}
|
||||
|
||||
Using modules transform: commonjs
|
||||
|
||||
Using plugins:
|
||||
check-es2015-constants { "ie":"10" }
|
||||
transform-es2015-arrow-functions { "ie":"10" }
|
||||
transform-es2015-block-scoped-functions { "ie":"10" }
|
||||
transform-es2015-block-scoping { "ie":"10" }
|
||||
transform-es2015-classes { "ie":"10" }
|
||||
transform-es2015-computed-properties { "ie":"10" }
|
||||
transform-es2015-destructuring { "ie":"10" }
|
||||
transform-es2015-duplicate-keys { "ie":"10" }
|
||||
transform-es2015-for-of { "ie":"10" }
|
||||
transform-es2015-function-name { "ie":"10" }
|
||||
transform-es2015-literals { "ie":"10" }
|
||||
transform-es2015-object-super { "ie":"10" }
|
||||
transform-es2015-parameters { "ie":"10" }
|
||||
transform-es2015-shorthand-properties { "ie":"10" }
|
||||
transform-es2015-spread { "ie":"10" }
|
||||
transform-es2015-sticky-regex { "ie":"10" }
|
||||
transform-es2015-template-literals { "ie":"10" }
|
||||
transform-es2015-typeof-symbol { "ie":"10" }
|
||||
transform-es2015-unicode-regex { "ie":"10" }
|
||||
transform-new-target { "ie":"10" }
|
||||
transform-regenerator { "ie":"10" }
|
||||
transform-exponentiation-operator { "ie":"10", "node":"6.10" }
|
||||
transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" }
|
||||
syntax-trailing-function-commas { "chrome":"54", "ie":"10", "node":"6.10" }
|
||||
|
||||
Using polyfills with `entry` option:
|
||||
|
||||
[src/in.js] Replaced `babel-polyfill` with the following polyfills:
|
||||
es6.typed.array-buffer { "ie":"10" }
|
||||
es6.typed.int8-array { "ie":"10" }
|
||||
es6.typed.uint8-array { "ie":"10" }
|
||||
es6.typed.uint8-clamped-array { "ie":"10" }
|
||||
es6.typed.int16-array { "ie":"10" }
|
||||
es6.typed.uint16-array { "ie":"10" }
|
||||
es6.typed.int32-array { "ie":"10" }
|
||||
es6.typed.uint32-array { "ie":"10" }
|
||||
es6.typed.float32-array { "ie":"10" }
|
||||
es6.typed.float64-array { "ie":"10" }
|
||||
es6.map { "ie":"10" }
|
||||
es6.set { "ie":"10" }
|
||||
es6.weak-map { "ie":"10" }
|
||||
es6.weak-set { "ie":"10" }
|
||||
es6.reflect.apply { "ie":"10" }
|
||||
es6.reflect.construct { "ie":"10" }
|
||||
es6.reflect.define-property { "ie":"10" }
|
||||
es6.reflect.delete-property { "ie":"10" }
|
||||
es6.reflect.get { "ie":"10" }
|
||||
es6.reflect.get-own-property-descriptor { "ie":"10" }
|
||||
es6.reflect.get-prototype-of { "ie":"10" }
|
||||
es6.reflect.has { "ie":"10" }
|
||||
es6.reflect.is-extensible { "ie":"10" }
|
||||
es6.reflect.own-keys { "ie":"10" }
|
||||
es6.reflect.prevent-extensions { "ie":"10" }
|
||||
es6.reflect.set { "ie":"10" }
|
||||
es6.reflect.set-prototype-of { "ie":"10" }
|
||||
es6.promise { "ie":"10" }
|
||||
es6.symbol { "ie":"10" }
|
||||
es6.object.assign { "ie":"10" }
|
||||
es6.object.is { "ie":"10" }
|
||||
es6.object.set-prototype-of { "ie":"10" }
|
||||
es6.function.name { "ie":"10" }
|
||||
es6.string.raw { "ie":"10" }
|
||||
es6.string.from-code-point { "ie":"10" }
|
||||
es6.string.code-point-at { "ie":"10" }
|
||||
es6.string.repeat { "ie":"10" }
|
||||
es6.string.starts-with { "ie":"10" }
|
||||
es6.string.ends-with { "ie":"10" }
|
||||
es6.string.includes { "ie":"10" }
|
||||
es6.regexp.flags { "ie":"10" }
|
||||
es6.regexp.match { "ie":"10" }
|
||||
es6.regexp.replace { "ie":"10" }
|
||||
es6.regexp.split { "ie":"10" }
|
||||
es6.regexp.search { "ie":"10" }
|
||||
es6.array.from { "ie":"10" }
|
||||
es6.array.of { "ie":"10" }
|
||||
es6.array.copy-within { "ie":"10" }
|
||||
es6.array.find { "ie":"10" }
|
||||
es6.array.find-index { "ie":"10" }
|
||||
es6.array.fill { "ie":"10" }
|
||||
es6.array.iterator { "ie":"10" }
|
||||
es6.number.is-finite { "ie":"10" }
|
||||
es6.number.is-integer { "ie":"10" }
|
||||
es6.number.is-safe-integer { "ie":"10" }
|
||||
es6.number.is-nan { "ie":"10" }
|
||||
es6.number.epsilon { "ie":"10" }
|
||||
es6.number.min-safe-integer { "ie":"10" }
|
||||
es6.number.max-safe-integer { "ie":"10" }
|
||||
es6.number.parse-float { "ie":"10" }
|
||||
es6.number.parse-int { "ie":"10" }
|
||||
es6.math.acosh { "ie":"10" }
|
||||
es6.math.asinh { "ie":"10" }
|
||||
es6.math.atanh { "ie":"10" }
|
||||
es6.math.cbrt { "ie":"10" }
|
||||
es6.math.clz32 { "ie":"10" }
|
||||
es6.math.cosh { "ie":"10" }
|
||||
es6.math.expm1 { "ie":"10" }
|
||||
es6.math.fround { "ie":"10" }
|
||||
es6.math.hypot { "ie":"10" }
|
||||
es6.math.imul { "ie":"10" }
|
||||
es6.math.log1p { "ie":"10" }
|
||||
es6.math.log10 { "ie":"10" }
|
||||
es6.math.log2 { "ie":"10" }
|
||||
es6.math.sign { "ie":"10" }
|
||||
es6.math.sinh { "ie":"10" }
|
||||
es6.math.tanh { "ie":"10" }
|
||||
es6.math.trunc { "ie":"10" }
|
||||
es7.array.includes { "ie":"10" }
|
||||
es7.object.values { "ie":"10", "node":"6.10" }
|
||||
es7.object.entries { "ie":"10", "node":"6.10" }
|
||||
es7.object.get-own-property-descriptors { "ie":"10", "node":"6.10" }
|
||||
es7.string.pad-start { "chrome":"54", "ie":"10", "node":"6.10" }
|
||||
es7.string.pad-end { "chrome":"54", "ie":"10", "node":"6.10" }
|
||||
web.timers { "chrome":"54", "ie":"10", "node":"6.10" }
|
||||
web.immediate { "chrome":"54", "ie":"10", "node":"6.10" }
|
||||
web.dom.iterable { "chrome":"54", "ie":"10", "node":"6.10" }
|
||||
src/in.js -> lib/in.js
|
||||
3
experimental/babel-preset-env/test/fixtures.js
Normal file
3
experimental/babel-preset-env/test/fixtures.js
Normal file
@ -0,0 +1,3 @@
|
||||
import runner from "babel-helper-plugin-test-runner";
|
||||
|
||||
runner(__dirname);
|
||||
1
experimental/babel-preset-env/test/fixtures/dom-iterable/symbol-iterator-in/actual.js
vendored
Normal file
1
experimental/babel-preset-env/test/fixtures/dom-iterable/symbol-iterator-in/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
Symbol.iterator in arr
|
||||
3
experimental/babel-preset-env/test/fixtures/dom-iterable/symbol-iterator-in/expected.js
vendored
Normal file
3
experimental/babel-preset-env/test/fixtures/dom-iterable/symbol-iterator-in/expected.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import "babel-polyfill/lib/core-js/modules/es6.symbol";
|
||||
import "babel-polyfill/lib/core-js/modules/web.dom.iterable";
|
||||
Symbol.iterator in arr;
|
||||
8
experimental/babel-preset-env/test/fixtures/dom-iterable/symbol-iterator-in/options.json
vendored
Normal file
8
experimental/babel-preset-env/test/fixtures/dom-iterable/symbol-iterator-in/options.json
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../../../lib", {
|
||||
"useBuiltIns": "usage",
|
||||
"modules": false
|
||||
}]
|
||||
]
|
||||
}
|
||||
1
experimental/babel-preset-env/test/fixtures/dom-iterable/symbol-iterator/actual.js
vendored
Normal file
1
experimental/babel-preset-env/test/fixtures/dom-iterable/symbol-iterator/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
arr[Symbol.iterator]()
|
||||
3
experimental/babel-preset-env/test/fixtures/dom-iterable/symbol-iterator/expected.js
vendored
Normal file
3
experimental/babel-preset-env/test/fixtures/dom-iterable/symbol-iterator/expected.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import "babel-polyfill/lib/core-js/modules/es6.symbol";
|
||||
import "babel-polyfill/lib/core-js/modules/web.dom.iterable";
|
||||
arr[Symbol.iterator]();
|
||||
8
experimental/babel-preset-env/test/fixtures/dom-iterable/symbol-iterator/options.json
vendored
Normal file
8
experimental/babel-preset-env/test/fixtures/dom-iterable/symbol-iterator/options.json
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../../../lib", {
|
||||
"useBuiltIns": "usage",
|
||||
"modules": false
|
||||
}]
|
||||
]
|
||||
}
|
||||
3
experimental/babel-preset-env/test/fixtures/dom-iterable/yield-non-star/actual.js
vendored
Normal file
3
experimental/babel-preset-env/test/fixtures/dom-iterable/yield-non-star/actual.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
function* a() {
|
||||
yield 1;
|
||||
}
|
||||
3
experimental/babel-preset-env/test/fixtures/dom-iterable/yield-non-star/expected.js
vendored
Normal file
3
experimental/babel-preset-env/test/fixtures/dom-iterable/yield-non-star/expected.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
function* a() {
|
||||
yield 1;
|
||||
}
|
||||
11
experimental/babel-preset-env/test/fixtures/dom-iterable/yield-non-star/options.json
vendored
Normal file
11
experimental/babel-preset-env/test/fixtures/dom-iterable/yield-non-star/options.json
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../../../lib", {
|
||||
"useBuiltIns": "usage",
|
||||
"targets": {
|
||||
"chrome": 55
|
||||
},
|
||||
"modules": false
|
||||
}]
|
||||
]
|
||||
}
|
||||
3
experimental/babel-preset-env/test/fixtures/dom-iterable/yield-star/actual.js
vendored
Normal file
3
experimental/babel-preset-env/test/fixtures/dom-iterable/yield-star/actual.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
function* a() {
|
||||
yield* 1;
|
||||
}
|
||||
5
experimental/babel-preset-env/test/fixtures/dom-iterable/yield-star/expected.js
vendored
Normal file
5
experimental/babel-preset-env/test/fixtures/dom-iterable/yield-star/expected.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import "babel-polyfill/lib/core-js/modules/web.dom.iterable";
|
||||
|
||||
function* a() {
|
||||
yield* 1;
|
||||
}
|
||||
11
experimental/babel-preset-env/test/fixtures/dom-iterable/yield-star/options.json
vendored
Normal file
11
experimental/babel-preset-env/test/fixtures/dom-iterable/yield-star/options.json
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../../../lib", {
|
||||
"useBuiltIns": "usage",
|
||||
"targets": {
|
||||
"chrome": 55
|
||||
},
|
||||
"modules": false
|
||||
}]
|
||||
]
|
||||
}
|
||||
1
experimental/babel-preset-env/test/fixtures/plugin-options/filters-duplicates/actual.js
vendored
Normal file
1
experimental/babel-preset-env/test/fixtures/plugin-options/filters-duplicates/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
import "babel-polyfill";
|
||||
2
experimental/babel-preset-env/test/fixtures/plugin-options/filters-duplicates/expected.js
vendored
Normal file
2
experimental/babel-preset-env/test/fixtures/plugin-options/filters-duplicates/expected.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import "babel-polyfill/lib/core-js/modules/es6.typed.data-view";
|
||||
import "babel-polyfill/lib/core-js/modules/es6.reflect.apply";
|
||||
11
experimental/babel-preset-env/test/fixtures/plugin-options/filters-duplicates/options.json
vendored
Normal file
11
experimental/babel-preset-env/test/fixtures/plugin-options/filters-duplicates/options.json
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"plugins": [
|
||||
["../../../../lib/use-built-ins-entry-plugin", {
|
||||
"polyfills": [
|
||||
"es6.typed.data-view",
|
||||
"es6.typed.data-view",
|
||||
"es6.reflect.apply"
|
||||
]
|
||||
}]
|
||||
]
|
||||
}
|
||||
1
experimental/babel-preset-env/test/fixtures/plugin-options/regenerator-false/actual.js
vendored
Normal file
1
experimental/babel-preset-env/test/fixtures/plugin-options/regenerator-false/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
import "babel-polyfill";
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user