23 Commits

Author SHA1 Message Date
Denis Pushkarev
3303b079c5 Update to core-js@3 (#7646)
### `@babel/runtime`
- Added `@babel/runtime-corejs3` package and `corejs: 3` options to `@babel/plugin-transform-runtime`.
- Added support of instance methods, fixes #8928.
- Added flag `proposals` (in `corejs: { version: 3, proposals: true }` format) for support all proposals polyfills from `core-js`.
- Used separate directories in runtime for `core-js` entry points with proposals and without.
- Used `get-iterator-method` helper for getting iterators, fixes #2500.
- As a cheap bonus, added support of IE8- (except some cases of `regenerator`).

### `@babel/polyfill`
- Should be deprecated in favor of separate usage required features from `core-js` and `regenerator-runtime` with an informative message.

### `@babel/preset-env`
- Uses for built-ins data from [`core-js-compat`](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat) instead of `compat-table` since information from `compat-table` [is not enough](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat).
- `useBuilIns` now requires direct setting of `corejs` version option, without it will be used `2` by default and shown deprecation warning.
- Added support of minor `core-js` versions for simplify updating in the future.
- For preventing some order-related problems, polyfills in the both `core-js@3` plugins added on `post` stage in the order of `core-js-compat` data.
- Divided plugins and polyfills parts of `preset-env`, instead of 2 internal plugins for adding polyfills, we have 6: usage and entry versions of plugins for `core-js@2`, ### Current state:
`core-js@3`, `regenerator-runtime`.
- Added support `samsung` target (for Samsung Internet) since `core-js-compat` and `compat-table` now contains mapping for this, fixes #6602.

#### `useBuilIns: entry` with `corejs: 3`
- No longer transforms `@babel/polyfill`.
- Transforms **all possible** `core-js` entry points to import of related modules (based on data from [`core-js-compat`](https://unpkg.com/core-js-compat@3.0.0-beta.15/entries.json)).
- Since of this, we no longer need `shippedProposals` / `proposals` flags with `useBuilIns: entry`.
- Removes `regenerator-runtime/runtime` import where it's not required.

#### `useBuilIns: usage` with `corejs: 3`
- In addition to `shippedProposals`, added flag `proposals`  (in `corejs: { version: 3, proposals: true }` format) for polyfill all proposals from `core-js`.
- Fixed list of dependencies in built-in definitions.
- Improved the way of determination method / built-in name and source of this method.
- Adds import of required polyfills on `MemberExpression`, `ObjectPattern`, `in` operator.
- Adds import of required polyfills on access to global object properties.
- Adds import of all required common iterators on all syntax features which use iterators protocol (`for-of`, destructuring, spread, `yield` delegation, etc.).
- Adds import of promises on syntax features which use promises (async functions/generators, dynamic import, etc.), fixes #9250, #7402, etc.

### `core-js@2` stuff
I didn't want to tough `core-js@2`-related stuff, however
- Fixed some serious errors in definitions which breaks `Object.getOwnPropertySymbols`, `Symbol.toStringTag` logic, `Promise#finally`, `Array#forEach`, etc.
- `Array#flatMap` and trim methods moved to stable features as a part of ES2019 and loaded by deprecated `@babel/polyfill` and `@babel/preset-env` with `corejs: 2` option.
2019-03-19 21:07:45 +01:00
Justin Ridgewell
039a74a8b9
preset-env: minimally supporting version (#9596)
* preset-env: minimally supporting version

This changes the "does browser support X" algorithm to "lowest version such that all higher versions support it".

Eg, given `{ chrome70: true, chrome60: false, chrome50: true }`, the lowest version is chrome70, not chrome50.

This is done to remove Tagged Template Literal support from Safari, which introduced a bug in Safari 12 but correctly implemented the feature in Safari 11-9.

* Add tests

* Fix tests

* Fix comment
2019-02-26 15:18:52 -05:00
Brian Ng
434fd32c90
Update esm and electron mappings in preset-env (#9573) 2019-02-25 16:51:38 -06:00
Denis Pushkarev
cade33c647 Update compat-table (#9566)
fix #9465
2019-02-23 12:47:43 +01:00
Brian Ng
b92ad318f1
Add support for transform-named-capturing-groups-regex in preset-env (#9345) 2019-01-17 19:51:38 -06:00
Brian Ng
40ae6568a4
Add support for proposal-json-strings in preset-env (#9323) 2019-01-13 08:32:33 -06:00
Kagami Sascha Rosylight
4dff205dc1 Disable parameter-destructuring in Edge 18 (#9140) 2018-12-07 08:14:08 -06:00
Brian Ng
3fda01b185
Update mapping for regex unicode plugin in preset-env (#9091) 2018-11-27 22:09:15 -06:00
Brian Ng
61c1c77a28
Update mappings for node 10 in preset-env (#9048) 2018-11-20 15:29:45 -06:00
Ben Mosher
c82750a48a edge incomplete support for arrow destructuring (babel #8349) (#8926) 2018-10-31 10:15:27 -05:00
Brian Ng
d942d47e10
Update preset-env data (#8898) 2018-10-25 09:48:41 -05:00
Brian Ng
55295cc545
Add initial ES2019 and saf12/elec3 support in env (#8438) 2018-08-20 12:32:18 -05:00
Brian Ng
cc4ee350e4
Ensure regex-dot-all runs before unicode-regex in preset-env (#8138)
<!--
Before making a PR please make sure to read our contributing guidelines
https://github.com/babel/babel/blob/master/CONTRIBUTING.md

For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. It should be underlined in the preview if done correctly.
-->

| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | --
| Patch: Bug Fix?          |
| Major: Breaking Change?  |
| Minor: New Feature?      |
| Tests Added + Pass?      | Yes
| Documentation PR         | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes?  |
| License                  | MIT

Good ol' plugin ordering 🙃

Ref: https://github.com/babel/babel/pull/7065#issuecomment-395959112
2018-06-11 08:09:44 -05:00
Brian Ng
b42b21f25c
Fix bug with handling minor versions when parsing compat-data (#7884) 2018-05-08 10:52:44 -05:00
Brian Ng
47201db61e
Bump compat-table for preset-env (#7808) 2018-04-25 16:23:49 -05:00
Brian Ng
81149a5cc9
Add initial support for ES2018 in preset-env (#7658) 2018-04-17 16:16:33 -05:00
Brian Ng
669f6b97b2
Tweak es2015-related plugin order in preset-env (#7586) 2018-03-19 14:19:42 -05:00
Yael Hermon
dfb3795a97 update preset-env after build-data (#7543) 2018-03-12 20:49:52 -05:00
Brian Ng
455c04e60a
Bump compat-table and regen preset-env data (#7401) 2018-02-23 08:46:14 -06:00
Mauro Bringolf
92fc26d399 Remove check-constants plugin (#6987)
* Rebased onto new version

* Moved constants check into a separate method
2018-01-26 10:43:09 -05:00
Brian Ng
3cea9f412a
Add dot-all regex support to preset-env and standalone 2017-12-19 11:39:00 -06:00
Brian Ng
8393a6d089
Add firefox 58 mappings to preset-env data (#6874) 2017-11-22 15:30:07 -06:00
Henry Zhu
70361f1200 Remove the experimental folder 2017-11-21 20:03:16 -05:00