refactor: init cypress-cucumber-preprocessor install.

This commit is contained in:
2021-09-02 17:02:45 +02:00
parent 89ec2d42ac
commit 1aa57bbd0a
5000 changed files with 408119 additions and 231 deletions

668
node_modules/@babel/preset-env/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,668 @@
# Changelog
## v1.6.1 (2017-10-17)
### :bug: Bug Fix
- Update compat table to fix two small issues ([#445](https://github.com/babel/babel-preset-env/pull/445)) (@danez)
ES2015 destructuring is not fully supported in Edge 15 and the polyfill required again. `es6.math.imul` is supported on Android as of version 4.4
- Add polyfills for ES6 static Object methods ([#441](https://github.com/babel/babel-preset-env/pull/441)) (@danez)
Functions such as `Object.keys`, `Object.freeze`, ... do already exist in ES5, but their behaviour changed in ES2015. `babel-preset-env` with `builtIns: true` now adds the core-js polyfills for this methods if the browser only supports the ES5 variant of the method (like IE11 for example)
- Normalize module format of plugins/built-ins data ([#376](https://github.com/babel/babel-preset-env/pull/376)) (@rtsao)
## v1.6.0 (2017-07-04)
### :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/experimental/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 CHANGELOGs 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/experimental/babel-preset-env/blob/master/data/plugin-features.js) and [/data/built-in-features.js](https://github.com/babel/experimental/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/experimental/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)

103
node_modules/@babel/preset-env/CONTRIBUTING.md generated vendored Normal file
View File

@@ -0,0 +1,103 @@
# Contributing
## Adding a new plugin or polyfill to support (when approved in the next ECMAScript version)
### Update [`plugin-features.js`](https://github.com/babel/babel/blob/master/packages/babel-preset-env/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:
`@babel/plugin-transform-exponentiation-operator`
And add them in this structure:
```js
// es2016
"@babel/plugin-transform-exponentiation-operator": {
features: [
"exponentiation (**) operator",
],
},
```
### Update data for `core-js@2` polyfilling
*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@2`](https://github.com/zloirock/core-js/tree/v2/modules):
`es7.object.values.js`
Find required ES version in [`corejs2-built-in-features.js`](https://github.com/babel/babel/blob/master/packages/babel-preset-env/data/corejs2-built-in-features.js) and add the new feature:
```js
const es = {
//...
"es7.object.values": "Object static methods / Object.values"
}
```
If you wan to transform a new built-in by `useBuiltIns: 'usage'`, add mapping to related `core-js` modules to [this file](https://github.com/babel/babel/blob/master/packages/babel-preset-env/polyfills/corejs2/built-in-definitions.js).
### Update data for `core-js@3` polyfilling
Just update the version of [`core-js-compat`](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat) in dependencies.
If you wan to transform a new built-in by `useBuiltIns: 'usage'`, add mapping to related [`core-js`](https://github.com/zloirock/core-js/tree/master/packages/core-js/modules) modules to [this file](https://github.com/babel/babel/blob/master/packages/babel-preset-env/polyfills/corejs3/built-in-definitions.js).
If you want to mark a new proposal as shipped, add it to [this list](https://github.com/babel/babel/blob/master/packages/babel-preset-env/polyfills/corejs3/shipped-proposals.js).
### Update [`plugins.json`](https://github.com/babel/babel/blob/master/packages/babel-preset-env/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.

22
node_modules/@babel/preset-env/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
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.

19
node_modules/@babel/preset-env/README.md generated vendored Normal file
View File

@@ -0,0 +1,19 @@
# @babel/preset-env
> A Babel preset for each environment.
See our website [@babel/preset-env](https://babeljs.io/docs/en/next/babel-preset-env.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20preset-env%22+is%3Aopen) associated with this package.
## Install
Using npm:
```sh
npm install --save-dev @babel/preset-env
```
or using yarn:
```sh
yarn add @babel/preset-env --dev
```

View File

@@ -0,0 +1,12 @@
{
"es6.module": {
"edge": "16",
"firefox": "60",
"chrome": "61",
"safari": "10.1",
"opera": "48",
"ios_saf": "10.3",
"and_chr": "71",
"and_ff": "64"
}
}

View File

@@ -0,0 +1,4 @@
// TODO: Remove in Babel 8
// https://github.com/vuejs/vue-cli/issues/3671
module.exports = require("./corejs2-built-ins.json");

View File

@@ -0,0 +1,335 @@
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 es = {
// compat-table missing babel6 mapping
// "es6.array.concat": {
// features: [
// "well-known symbols / Symbol.isConcatSpreadable",
// "well-known symbols / Symbol.species, Array.prototype.concat",
// ]
// },
"es6.array.copy-within": "Array.prototype methods / Array.prototype.copyWithin",
"es6.array.every": "Array methods / Array.prototype.every",
"es6.array.fill": "Array.prototype methods / Array.prototype.fill",
"es6.array.filter": {
features: [
"Array methods / Array.prototype.filter",
// compat-table missing babel6 mapping
// "well-known symbols / Symbol.species, Array.prototype.filter",
],
},
"es6.array.find": "Array.prototype methods / Array.prototype.find",
"es6.array.find-index": "Array.prototype methods / Array.prototype.findIndex",
"es7.array.flat-map": "Array.prototype.{flat, flatMap} / Array.prototype.flatMap",
"es6.array.for-each": "Array methods / Array.prototype.forEach",
"es6.array.from": "Array static methods / Array.from",
"es7.array.includes": "Array.prototype.includes",
"es6.array.index-of": "Array methods / Array.prototype.indexOf",
"es6.array.is-array": "Array methods / Array.isArray",
// "es.array.join": "", required tests for that
"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.array.last-index-of": "Array methods / Array.prototype.lastIndexOf",
"es6.array.map": {
features: [
"Array methods / Array.prototype.map",
// compat-table missing babel6 mapping
// "well-known symbols / Symbol.species, Array.prototype.map",
],
},
"es6.array.of": "Array static methods / Array.of",
"es6.array.reduce": "Array methods / Array.prototype.reduce",
"es6.array.reduce-right": "Array methods / Array.prototype.reduceRight",
// compat-table missing babel6 mapping
// "es6.array.slice": "well-known symbols / Symbol.species, Array.prototype.slice",
"es6.array.some": "Array methods / Array.prototype.some",
"es6.array.sort": "Array methods / Array.prototype.sort",
"es6.array.species": "Array static methods / Array[Symbol.species]",
// compat-table missing babel6 mapping
//"es6.array.splice": "well-known symbols / Symbol.species, Array.prototype.splice",
"es6.date.now": "Date methods / Date.now",
"es6.date.to-iso-string": "Date methods / Date.prototype.toISOString",
"es6.date.to-json": "Date methods / Date.prototype.toJSON",
"es6.date.to-primitive": "Date.prototype[Symbol.toPrimitive]",
"es6.date.to-string": "miscellaneous / Invalid Date",
"es6.function.bind": "Function.prototype.bind",
"es6.function.has-instance": "well-known symbols / Symbol.hasInstance",
"es6.function.name": {
features: [
"function \"name\" property / function statements",
"function \"name\" property / function expressions",
],
},
"es6.map": "Map",
"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",
"es6.number.constructor": {
features: [
"octal and binary literals / octal supported by Number()",
"octal and binary literals / binary supported by Number()",
],
},
"es6.number.epsilon": "Number properties / Number.EPSILON",
"es6.number.is-finite": "Number properties / Number.isFinite",
"es6.number.is-integer": "Number properties / Number.isInteger",
"es6.number.is-nan": "Number properties / Number.isNaN",
"es6.number.is-safe-integer": "Number properties / Number.isSafeInteger",
"es6.number.max-safe-integer": "Number properties / Number.MAX_SAFE_INTEGER",
"es6.number.min-safe-integer": "Number properties / Number.MIN_SAFE_INTEGER",
"es6.number.parse-float": "Number properties / Number.parseFloat",
"es6.number.parse-int": "Number properties / Number.parseInt",
"es6.object.assign": {
features: ["Object static methods / Object.assign", "Symbol"],
},
"es6.object.create": "Object static methods / Object.create",
"es7.object.define-getter": {
features: [
"Object.prototype getter/setter methods / __defineGetter__",
"Object.prototype getter/setter methods / __defineGetter__, symbols",
"Object.prototype getter/setter methods / __defineGetter__, ToObject(this)",
],
},
"es7.object.define-setter": {
features: [
"Object.prototype getter/setter methods / __defineSetter__",
"Object.prototype getter/setter methods / __defineSetter__, symbols",
"Object.prototype getter/setter methods / __defineSetter__, ToObject(this)",
],
},
"es6.object.define-property": "Object static methods / Object.defineProperty",
"es6.object.define-properties": "Object static methods / Object.defineProperties",
"es7.object.entries": "Object static methods / Object.entries",
"es6.object.freeze": "Object static methods accept primitives / Object.freeze",
"es6.object.get-own-property-descriptor": "Object static methods accept primitives / Object.getOwnPropertyDescriptor",
"es7.object.get-own-property-descriptors": "Object static methods / Object.getOwnPropertyDescriptors",
"es6.object.get-own-property-names": "Object static methods accept primitives / Object.getOwnPropertyNames",
"es6.object.get-prototype-of": "Object static methods accept primitives / Object.getPrototypeOf",
"es7.object.lookup-getter": {
features: [
"Object.prototype getter/setter methods / __lookupGetter__",
"Object.prototype getter/setter methods / __lookupGetter__, prototype chain",
"Object.prototype getter/setter methods / __lookupGetter__, symbols",
"Object.prototype getter/setter methods / __lookupGetter__, ToObject(this)",
"Object.prototype getter/setter methods / __lookupGetter__, data properties can shadow accessors",
],
},
"es7.object.lookup-setter": {
features: [
"Object.prototype getter/setter methods / __lookupSetter__",
"Object.prototype getter/setter methods / __lookupSetter__, prototype chain",
"Object.prototype getter/setter methods / __lookupSetter__, symbols",
"Object.prototype getter/setter methods / __lookupSetter__, ToObject(this)",
"Object.prototype getter/setter methods / __lookupSetter__, data properties can shadow accessors",
],
},
"es6.object.prevent-extensions": "Object static methods accept primitives / Object.preventExtensions",
"es6.object.to-string": "well-known symbols / Symbol.toStringTag",
"es6.object.is": "Object static methods / Object.is",
"es6.object.is-frozen": "Object static methods accept primitives / Object.isFrozen",
"es6.object.is-sealed": "Object static methods accept primitives / Object.isSealed",
"es6.object.is-extensible": "Object static methods accept primitives / Object.isExtensible",
"es6.object.keys": "Object static methods accept primitives / Object.keys",
"es6.object.seal": "Object static methods accept primitives / Object.seal",
"es6.object.set-prototype-of": "Object static methods / Object.setPrototypeOf",
"es7.object.values": "Object static methods / Object.values",
"es6.promise": {
features: [
// required unhandled rejection tracking tests
"Promise",
"well-known symbols / Symbol.species, Promise.prototype.then",
],
},
"es7.promise.finally": "Promise.prototype.finally",
"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.regexp.constructor": {
features: [
"miscellaneous / RegExp constructor can alter flags",
"well-known symbols / Symbol.match, RegExp constructor",
],
},
"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.regexp.to-string": "miscellaneous / RegExp.prototype.toString generic and uses \"flags\" property",
// This is explicit due to prevent the stage-1 Set proposals under the
// category "Set methods" from being included.
"es6.set": {
features: [
"Set / basic functionality",
"Set / constructor arguments",
"Set / constructor requires new",
"Set / constructor accepts null",
"Set / constructor invokes add",
"Set / iterator closing",
"Set / Set.prototype.add returns this",
"Set / -0 key converts to +0",
"Set / Set.prototype.size",
"Set / Set.prototype.delete",
"Set / Set.prototype.clear",
"Set / Set.prototype.forEach",
"Set / Set.prototype.keys",
"Set / Set.prototype.values",
"Set / Set.prototype.entries",
"Set / Set.prototype[Symbol.iterator]",
"Set / Set.prototype isn't an instance",
"Set / Set iterator prototype chain",
"Set / Set[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",
],
},
"es7.symbol.async-iterator": "Asynchronous Iterators",
"es6.string.anchor": "String.prototype HTML methods",
"es6.string.big": "String.prototype HTML methods",
"es6.string.blink": "String.prototype HTML methods",
"es6.string.bold": "String.prototype HTML methods",
"es6.string.code-point-at": "String.prototype methods / String.prototype.codePointAt",
"es6.string.ends-with": "String.prototype methods / String.prototype.endsWith",
"es6.string.fixed": "String.prototype HTML methods",
"es6.string.fontcolor": "String.prototype HTML methods",
"es6.string.fontsize": "String.prototype HTML methods",
"es6.string.from-code-point": "String static methods / String.fromCodePoint",
"es6.string.includes": "String.prototype methods / String.prototype.includes",
"es6.string.italics": "String.prototype HTML methods",
"es6.string.iterator": "String.prototype methods / String.prototype[Symbol.iterator]",
"es6.string.link": "String.prototype HTML methods",
// "String.prototype methods / String.prototype.normalize" not implemented
"es7.string.pad-start": "String padding / String.prototype.padStart",
"es7.string.pad-end": "String padding / String.prototype.padEnd",
"es6.string.raw": "String static methods / String.raw",
"es6.string.repeat": "String.prototype methods / String.prototype.repeat",
"es6.string.small": "String.prototype HTML methods",
"es6.string.starts-with": "String.prototype methods / String.prototype.startsWith",
"es6.string.strike": "String.prototype HTML methods",
"es6.string.sub": "String.prototype HTML methods",
"es6.string.sup": "String.prototype HTML methods",
"es6.string.trim": "String properties and methods / String.prototype.trim",
"es7.string.trim-left": "string trimming / String.prototype.trimStart",
"es7.string.trim-right": "string trimming / String.prototype.trimEnd",
"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.weak-map": "WeakMap",
"es6.weak-set": "WeakSet",
};
const proposals = require("./shipped-proposals").builtIns;
module.exports = Object.assign({}, es, proposals);

File diff suppressed because it is too large Load Diff

108
node_modules/@babel/preset-env/data/plugin-features.js generated vendored Normal file
View File

@@ -0,0 +1,108 @@
const es = {
"transform-template-literals": {
features: ["template literals"],
},
"transform-literals": {
features: ["Unicode code point escapes"],
},
"transform-function-name": {
features: ['function "name" property'],
},
"transform-arrow-functions": {
features: ["arrow functions"],
},
"transform-block-scoped-functions": {
features: ["block-level function declaration"],
},
"transform-classes": {
features: ["class", "super"],
},
"transform-object-super": {
features: ["super"],
},
"transform-shorthand-properties": {
features: ["object literal extensions / shorthand properties"],
},
"transform-duplicate-keys": {
features: ["miscellaneous / duplicate property names in strict mode"],
},
"transform-computed-properties": {
features: ["object literal extensions / computed properties"],
},
"transform-for-of": {
features: ["for..of loops"],
},
"transform-sticky-regex": {
features: [
'RegExp "y" and "u" flags / "y" flag, lastIndex',
'RegExp "y" and "u" flags / "y" flag',
],
},
// We want to apply this prior to unicode regex so that "." and "u"
// are properly handled.
//
// Ref: https://github.com/babel/babel/pull/7065#issuecomment-395959112
"transform-dotall-regex": "s (dotAll) flag for regular expressions",
"transform-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, non-BMP Unicode characters',
'RegExp "y" and "u" flags / "u" flag',
],
},
"transform-spread": {
features: "spread syntax for iterable objects",
},
"transform-parameters": {
features: [
"default function parameters",
"rest parameters",
"destructuring, parameters / defaults, arrow function",
],
},
"transform-destructuring": {
features: [
"destructuring, assignment",
"destructuring, declarations",
],
},
"transform-block-scoping": {
features: ["const", "let"],
},
"transform-typeof-symbol": {
features: ["Symbol / typeof support"],
},
"transform-new-target": {
features: ["new.target"],
},
"transform-regenerator": {
features: ["generators"],
},
"transform-exponentiation-operator": {
features: ["exponentiation (**) operator"],
},
"transform-async-to-generator": {
features: ["async functions"],
},
"proposal-async-generator-functions": "Asynchronous Iterators",
"proposal-object-rest-spread": "object rest/spread properties",
"proposal-unicode-property-regex": "RegExp Unicode Property Escapes",
"proposal-json-strings": "JSON superset",
"proposal-optional-catch-binding": "optional catch binding",
"transform-named-capturing-groups-regex": "RegExp named capture groups",
"transform-member-expression-literals": "Object/array literal extensions / Reserved words as property names",
"transform-property-literals": "Object/array literal extensions / Reserved words as property names",
"transform-reserved-words": "Miscellaneous / Unreserved words",
};
const proposals = require("./shipped-proposals").features;
module.exports = Object.assign({}, es, proposals);

347
node_modules/@babel/preset-env/data/plugins.json generated vendored Normal file
View File

@@ -0,0 +1,347 @@
{
"transform-template-literals": {
"chrome": "41",
"edge": "13",
"firefox": "34",
"node": "4",
"samsung": "3.4",
"opera": "28",
"electron": "0.24"
},
"transform-literals": {
"chrome": "44",
"edge": "12",
"firefox": "53",
"safari": "9",
"node": "4",
"ios": "9",
"samsung": "4",
"opera": "31",
"electron": "0.31"
},
"transform-function-name": {
"chrome": "51",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"samsung": "5",
"opera": "38",
"electron": "1.2"
},
"transform-arrow-functions": {
"chrome": "47",
"edge": "13",
"firefox": "45",
"safari": "10",
"node": "6",
"ios": "10",
"samsung": "5",
"opera": "34",
"electron": "0.36"
},
"transform-block-scoped-functions": {
"chrome": "41",
"edge": "12",
"firefox": "46",
"safari": "10",
"node": "4",
"ie": "11",
"ios": "10",
"samsung": "3.4",
"opera": "28",
"electron": "0.24"
},
"transform-classes": {
"chrome": "46",
"edge": "13",
"firefox": "45",
"safari": "10",
"node": "5",
"ios": "10",
"samsung": "5",
"opera": "33",
"electron": "0.36"
},
"transform-object-super": {
"chrome": "46",
"edge": "13",
"firefox": "45",
"safari": "10",
"node": "5",
"ios": "10",
"samsung": "5",
"opera": "33",
"electron": "0.36"
},
"transform-shorthand-properties": {
"chrome": "43",
"edge": "12",
"firefox": "33",
"safari": "9",
"node": "4",
"ios": "9",
"samsung": "4",
"opera": "30",
"electron": "0.29"
},
"transform-duplicate-keys": {
"chrome": "42",
"edge": "12",
"firefox": "34",
"safari": "9",
"node": "4",
"ios": "9",
"samsung": "3.4",
"opera": "29",
"electron": "0.27"
},
"transform-computed-properties": {
"chrome": "44",
"edge": "12",
"firefox": "34",
"safari": "7.1",
"node": "4",
"ios": "8",
"samsung": "4",
"opera": "31",
"electron": "0.31"
},
"transform-for-of": {
"chrome": "51",
"edge": "15",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"samsung": "5",
"opera": "38",
"electron": "1.2"
},
"transform-sticky-regex": {
"chrome": "49",
"edge": "13",
"firefox": "3",
"safari": "10",
"node": "6",
"ios": "10",
"samsung": "5",
"opera": "36",
"electron": "1"
},
"transform-dotall-regex": {
"chrome": "62",
"safari": "11.1",
"node": "8.10",
"ios": "11.3",
"samsung": "8.2",
"opera": "49",
"electron": "3.1"
},
"transform-unicode-regex": {
"chrome": "50",
"edge": "13",
"firefox": "46",
"safari": "12",
"node": "6",
"ios": "12",
"samsung": "5",
"opera": "37",
"electron": "1.1"
},
"transform-spread": {
"chrome": "46",
"edge": "13",
"firefox": "36",
"safari": "10",
"node": "5",
"ios": "10",
"samsung": "5",
"opera": "33",
"electron": "0.36"
},
"transform-parameters": {
"chrome": "49",
"edge": "18",
"firefox": "53",
"safari": "10",
"node": "6",
"ios": "10",
"samsung": "5",
"opera": "36",
"electron": "1"
},
"transform-destructuring": {
"chrome": "51",
"edge": "15",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"samsung": "5",
"opera": "38",
"electron": "1.2"
},
"transform-block-scoping": {
"chrome": "49",
"edge": "14",
"firefox": "51",
"safari": "10.1",
"node": "6",
"ios": "10.3",
"samsung": "5",
"opera": "36",
"electron": "1"
},
"transform-typeof-symbol": {
"chrome": "38",
"edge": "12",
"firefox": "36",
"safari": "9",
"node": "0.12",
"ios": "9",
"samsung": "3",
"opera": "25",
"electron": "0.2"
},
"transform-new-target": {
"chrome": "46",
"edge": "14",
"firefox": "41",
"safari": "10",
"node": "5",
"ios": "10",
"samsung": "5",
"opera": "33",
"electron": "0.36"
},
"transform-regenerator": {
"chrome": "50",
"edge": "13",
"firefox": "53",
"safari": "10",
"node": "6",
"ios": "10",
"samsung": "5",
"opera": "37",
"electron": "1.1"
},
"transform-exponentiation-operator": {
"chrome": "52",
"edge": "14",
"firefox": "52",
"safari": "10.1",
"node": "7",
"ios": "10.3",
"samsung": "6.2",
"opera": "39",
"electron": "1.3"
},
"transform-async-to-generator": {
"chrome": "55",
"edge": "15",
"firefox": "52",
"safari": "11",
"node": "7.6",
"ios": "11",
"samsung": "6.2",
"opera": "42",
"electron": "1.6"
},
"proposal-async-generator-functions": {
"chrome": "63",
"firefox": "57",
"safari": "12",
"node": "10",
"ios": "12",
"samsung": "8.2",
"opera": "50",
"electron": "3.1"
},
"proposal-object-rest-spread": {
"chrome": "60",
"firefox": "55",
"safari": "11.1",
"node": "8.3",
"ios": "11.3",
"samsung": "8.2",
"opera": "47",
"electron": "2.1"
},
"proposal-unicode-property-regex": {
"chrome": "64",
"safari": "11.1",
"node": "10",
"ios": "11.3",
"opera": "51",
"electron": "3.1"
},
"proposal-json-strings": {
"chrome": "66",
"firefox": "62",
"safari": "12",
"node": "10",
"ios": "12",
"opera": "53",
"electron": "3.1"
},
"proposal-optional-catch-binding": {
"chrome": "66",
"firefox": "58",
"safari": "11.1",
"node": "10",
"ios": "11.3",
"opera": "53",
"electron": "3.1"
},
"transform-named-capturing-groups-regex": {
"chrome": "64",
"safari": "11.1",
"node": "10",
"ios": "11.3",
"opera": "51",
"electron": "3.1"
},
"transform-member-expression-literals": {
"chrome": "7",
"opera": "12",
"edge": "12",
"firefox": "2",
"safari": "5.1",
"node": "0.10",
"ie": "9",
"android": "4",
"ios": "6",
"phantom": "2",
"samsung": "2.1",
"electron": "5"
},
"transform-property-literals": {
"chrome": "7",
"opera": "12",
"edge": "12",
"firefox": "2",
"safari": "5.1",
"node": "0.10",
"ie": "9",
"android": "4",
"ios": "6",
"phantom": "2",
"samsung": "2.1",
"electron": "5"
},
"transform-reserved-words": {
"chrome": "13",
"opera": "10.50",
"edge": "12",
"firefox": "2",
"safari": "3.1",
"node": "0.10",
"ie": "9",
"android": "4.4",
"ios": "6",
"phantom": "2",
"samsung": "2.1",
"electron": "0.2"
}
}

View File

@@ -0,0 +1,14 @@
// These mappings represent the syntax proposals that have been
// shipped by browsers, and are enabled by the `shippedProposals` option.
const proposalPlugins = {};
const pluginSyntaxMap = new Map([
["proposal-async-generator-functions", "syntax-async-generators"],
["proposal-object-rest-spread", "syntax-object-rest-spread"],
["proposal-optional-catch-binding", "syntax-optional-catch-binding"],
["proposal-unicode-property-regex", null],
["proposal-json-strings", "syntax-json-strings"],
]);
module.exports = { proposalPlugins, pluginSyntaxMap };

View File

@@ -0,0 +1,3 @@
module.exports = {
safari: "tp",
};

View File

@@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _default = {
"syntax-async-generators": require("@babel/plugin-syntax-async-generators"),
"syntax-json-strings": require("@babel/plugin-syntax-json-strings"),
"syntax-object-rest-spread": require("@babel/plugin-syntax-object-rest-spread"),
"syntax-optional-catch-binding": require("@babel/plugin-syntax-optional-catch-binding"),
"transform-async-to-generator": require("@babel/plugin-transform-async-to-generator"),
"proposal-async-generator-functions": require("@babel/plugin-proposal-async-generator-functions"),
"proposal-json-strings": require("@babel/plugin-proposal-json-strings"),
"transform-arrow-functions": require("@babel/plugin-transform-arrow-functions"),
"transform-block-scoped-functions": require("@babel/plugin-transform-block-scoped-functions"),
"transform-block-scoping": require("@babel/plugin-transform-block-scoping"),
"transform-classes": require("@babel/plugin-transform-classes"),
"transform-computed-properties": require("@babel/plugin-transform-computed-properties"),
"transform-destructuring": require("@babel/plugin-transform-destructuring"),
"transform-dotall-regex": require("@babel/plugin-transform-dotall-regex"),
"transform-duplicate-keys": require("@babel/plugin-transform-duplicate-keys"),
"transform-for-of": require("@babel/plugin-transform-for-of"),
"transform-function-name": require("@babel/plugin-transform-function-name"),
"transform-literals": require("@babel/plugin-transform-literals"),
"transform-member-expression-literals": require("@babel/plugin-transform-member-expression-literals"),
"transform-modules-amd": require("@babel/plugin-transform-modules-amd"),
"transform-modules-commonjs": require("@babel/plugin-transform-modules-commonjs"),
"transform-modules-systemjs": require("@babel/plugin-transform-modules-systemjs"),
"transform-modules-umd": require("@babel/plugin-transform-modules-umd"),
"transform-named-capturing-groups-regex": require("@babel/plugin-transform-named-capturing-groups-regex"),
"transform-object-super": require("@babel/plugin-transform-object-super"),
"transform-parameters": require("@babel/plugin-transform-parameters"),
"transform-property-literals": require("@babel/plugin-transform-property-literals"),
"transform-reserved-words": require("@babel/plugin-transform-reserved-words"),
"transform-shorthand-properties": require("@babel/plugin-transform-shorthand-properties"),
"transform-spread": require("@babel/plugin-transform-spread"),
"transform-sticky-regex": require("@babel/plugin-transform-sticky-regex"),
"transform-template-literals": require("@babel/plugin-transform-template-literals"),
"transform-typeof-symbol": require("@babel/plugin-transform-typeof-symbol"),
"transform-unicode-regex": require("@babel/plugin-transform-unicode-regex"),
"transform-exponentiation-operator": require("@babel/plugin-transform-exponentiation-operator"),
"transform-new-target": require("@babel/plugin-transform-new-target"),
"proposal-object-rest-spread": require("@babel/plugin-proposal-object-rest-spread"),
"proposal-optional-catch-binding": require("@babel/plugin-proposal-optional-catch-binding"),
"transform-regenerator": require("@babel/plugin-transform-regenerator"),
"proposal-unicode-property-regex": require("@babel/plugin-proposal-unicode-property-regex")
};
exports.default = _default;

84
node_modules/@babel/preset-env/lib/debug.js generated vendored Normal file
View File

@@ -0,0 +1,84 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.logUsagePolyfills = exports.logEntryPolyfills = exports.logPluginOrPolyfill = void 0;
function _semver() {
const data = _interopRequireDefault(require("semver"));
_semver = function () {
return data;
};
return data;
}
var _utils = require("./utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const wordEnds = size => {
return size > 1 ? "s" : "";
};
const logPluginOrPolyfill = (item, targetVersions, list) => {
const minVersions = list[item] || {};
const filteredList = Object.keys(targetVersions).reduce((result, env) => {
const minVersion = minVersions[env];
const targetVersion = targetVersions[env];
if (!minVersion) {
result[env] = (0, _utils.prettifyVersion)(targetVersion);
} else {
const minIsUnreleased = (0, _utils.isUnreleasedVersion)(minVersion, env);
const targetIsUnreleased = (0, _utils.isUnreleasedVersion)(targetVersion, env);
if (!targetIsUnreleased && (minIsUnreleased || _semver().default.lt(targetVersion.toString(), (0, _utils.semverify)(minVersion)))) {
result[env] = (0, _utils.prettifyVersion)(targetVersion);
}
}
return result;
}, {});
const formattedTargets = JSON.stringify(filteredList).replace(/,/g, ", ").replace(/^\{"/, '{ "').replace(/"\}$/, '" }');
console.log(` ${item} ${formattedTargets}`);
};
exports.logPluginOrPolyfill = logPluginOrPolyfill;
const logEntryPolyfills = (polyfillName, importPolyfillIncluded, polyfills, filename, polyfillTargets, allBuiltInsList) => {
if (!importPolyfillIncluded) {
console.log(`\n[${filename}] Import of ${polyfillName} was not found.`);
return;
}
if (!polyfills.size) {
console.log(`\n[${filename}] Based on your targets, polyfills were not added.`);
return;
}
console.log(`\n[${filename}] Replaced ${polyfillName} entries with the following polyfill${wordEnds(polyfills.size)}:`);
for (const polyfill of polyfills) {
logPluginOrPolyfill(polyfill, polyfillTargets, allBuiltInsList);
}
};
exports.logEntryPolyfills = logEntryPolyfills;
const logUsagePolyfills = (polyfills, filename, polyfillTargets, allBuiltInsList) => {
if (!polyfills.size) {
console.log(`\n[${filename}] Based on your code and targets, core-js polyfills were not added.`);
return;
}
console.log(`\n[${filename}] Added following core-js polyfill${wordEnds(polyfills.size)}:`);
for (const polyfill of polyfills) {
logPluginOrPolyfill(polyfill, polyfillTargets, allBuiltInsList);
}
};
exports.logUsagePolyfills = logUsagePolyfills;

79
node_modules/@babel/preset-env/lib/filter-items.js generated vendored Normal file
View File

@@ -0,0 +1,79 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isPluginRequired = isPluginRequired;
exports.default = _default;
function _semver() {
const data = _interopRequireDefault(require("semver"));
_semver = function () {
return data;
};
return data;
}
var _utils = require("./utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function isPluginRequired(supportedEnvironments, plugin) {
const targetEnvironments = Object.keys(supportedEnvironments);
if (targetEnvironments.length === 0) {
return true;
}
const isRequiredForEnvironments = targetEnvironments.filter(environment => {
if (!plugin[environment]) {
return true;
}
const lowestImplementedVersion = plugin[environment];
const lowestTargetedVersion = supportedEnvironments[environment];
if ((0, _utils.isUnreleasedVersion)(lowestTargetedVersion, environment)) {
return false;
}
if ((0, _utils.isUnreleasedVersion)(lowestImplementedVersion, environment)) {
return true;
}
if (!_semver().default.valid(lowestTargetedVersion.toString())) {
throw new Error(`Invalid version passed for target "${environment}": "${lowestTargetedVersion}". ` + "Versions must be in semver format (major.minor.patch)");
}
return _semver().default.gt((0, _utils.semverify)(lowestImplementedVersion), lowestTargetedVersion.toString());
});
return isRequiredForEnvironments.length > 0;
}
function _default(list, includes, excludes, targets, defaultIncludes, defaultExcludes, pluginSyntaxMap) {
const result = new Set();
for (const item in list) {
if (!excludes.has(item) && (isPluginRequired(targets, list[item]) || includes.has(item))) {
result.add(item);
} else if (pluginSyntaxMap) {
const shippedProposalsSyntax = pluginSyntaxMap.get(item);
if (shippedProposalsSyntax) {
result.add(shippedProposalsSyntax);
}
}
}
if (defaultIncludes) {
defaultIncludes.forEach(item => !excludes.has(item) && result.add(item));
}
if (defaultExcludes) {
defaultExcludes.forEach(item => !includes.has(item) && result.delete(item));
}
return result;
}

View File

@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
const defaultExcludesForLooseMode = ["transform-typeof-symbol"];
function _default({
loose
}) {
return loose ? defaultExcludesForLooseMode : null;
}

213
node_modules/@babel/preset-env/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,213 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "isPluginRequired", {
enumerable: true,
get: function () {
return _filterItems.isPluginRequired;
}
});
exports.default = exports.transformIncludesAndExcludes = void 0;
var _debug = require("./debug");
var _getOptionSpecificExcludes = _interopRequireDefault(require("./get-option-specific-excludes"));
var _filterItems = _interopRequireWildcard(require("./filter-items"));
var _moduleTransformations = _interopRequireDefault(require("./module-transformations"));
var _normalizeOptions = _interopRequireDefault(require("./normalize-options"));
var _plugins = _interopRequireDefault(require("../data/plugins.json"));
var _shippedProposals = require("../data/shipped-proposals");
var _usagePlugin = _interopRequireDefault(require("./polyfills/corejs2/usage-plugin"));
var _usagePlugin2 = _interopRequireDefault(require("./polyfills/corejs3/usage-plugin"));
var _usagePlugin3 = _interopRequireDefault(require("./polyfills/regenerator/usage-plugin"));
var _entryPlugin = _interopRequireDefault(require("./polyfills/corejs2/entry-plugin"));
var _entryPlugin2 = _interopRequireDefault(require("./polyfills/corejs3/entry-plugin"));
var _entryPlugin3 = _interopRequireDefault(require("./polyfills/regenerator/entry-plugin"));
var _targetsParser = _interopRequireDefault(require("./targets-parser"));
var _availablePlugins = _interopRequireDefault(require("./available-plugins"));
var _utils = require("./utils");
function _helperPluginUtils() {
const data = require("@babel/helper-plugin-utils");
_helperPluginUtils = function () {
return data;
};
return data;
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const pluginListWithoutProposals = (0, _utils.filterStageFromList)(_plugins.default, _shippedProposals.proposalPlugins);
const getPlugin = pluginName => {
const plugin = _availablePlugins.default[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 transformIncludesAndExcludes = opts => {
return opts.reduce((result, opt) => {
const target = opt.match(/^(es|es6|es7|esnext|web)\./) ? "builtIns" : "plugins";
result[target].add(opt);
return result;
}, {
all: opts,
plugins: new Set(),
builtIns: new Set()
});
};
exports.transformIncludesAndExcludes = transformIncludesAndExcludes;
function supportsStaticESM(caller) {
return !!(caller && caller.supportsStaticESM);
}
var _default = (0, _helperPluginUtils().declare)((api, opts) => {
api.assertVersion(7);
const {
configPath,
debug,
exclude: optionsExclude,
forceAllTransforms,
ignoreBrowserslistConfig,
include: optionsInclude,
loose,
modules,
shippedProposals,
spec,
targets: optionsTargets,
useBuiltIns,
corejs: {
version: corejs,
proposals
}
} = (0, _normalizeOptions.default)(opts);
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("");
}
if (optionsTargets && optionsTargets.esmodules && optionsTargets.browsers) {
console.log("");
console.log("@babel/preset-env: esmodules and browsers targets have been specified together.");
console.log(`\`browsers\` target, \`${optionsTargets.browsers}\` will be ignored.`);
console.log("");
}
const targets = (0, _targetsParser.default)(optionsTargets, {
ignoreBrowserslistConfig,
configPath
});
const include = transformIncludesAndExcludes(optionsInclude);
const exclude = transformIncludesAndExcludes(optionsExclude);
const transformTargets = forceAllTransforms || hasUglifyTarget ? {} : targets;
const transformations = (0, _filterItems.default)(shippedProposals ? _plugins.default : pluginListWithoutProposals, include.plugins, exclude.plugins, transformTargets, null, (0, _getOptionSpecificExcludes.default)({
loose
}), _shippedProposals.pluginSyntaxMap);
const plugins = [];
const pluginUseBuiltIns = useBuiltIns !== false;
if (modules !== false && _moduleTransformations.default[modules] && (modules !== "auto" || !api.caller || !api.caller(supportsStaticESM))) {
plugins.push([getPlugin(_moduleTransformations.default[modules]), {
loose
}]);
}
transformations.forEach(pluginName => plugins.push([getPlugin(pluginName), {
spec,
loose,
useBuiltIns: pluginUseBuiltIns
}]));
if (debug) {
console.log("@babel/preset-env: `DEBUG` option");
console.log("\nUsing targets:");
console.log(JSON.stringify((0, _utils.prettifyTargets)(targets), null, 2));
console.log(`\nUsing modules transform: ${modules.toString()}`);
console.log("\nUsing plugins:");
transformations.forEach(transform => {
(0, _debug.logPluginOrPolyfill)(transform, targets, _plugins.default);
});
if (!useBuiltIns) {
console.log("\nUsing polyfills: No polyfills were added, since the `useBuiltIns` option was not set.");
} else {
console.log(`\nUsing polyfills with \`${useBuiltIns}\` option:`);
}
}
if (useBuiltIns === "usage" || useBuiltIns === "entry") {
const regenerator = transformations.has("transform-regenerator");
const pluginOptions = {
corejs,
polyfillTargets: targets,
include: include.builtIns,
exclude: exclude.builtIns,
proposals,
shippedProposals,
regenerator,
debug
};
if (corejs) {
if (useBuiltIns === "usage") {
if (corejs.major === 2) {
plugins.push([_usagePlugin.default, pluginOptions]);
} else {
plugins.push([_usagePlugin2.default, pluginOptions]);
}
if (regenerator) {
plugins.push([_usagePlugin3.default, pluginOptions]);
}
} else {
if (corejs.major === 2) {
plugins.push([_entryPlugin.default, pluginOptions]);
} else {
plugins.push([_entryPlugin2.default, pluginOptions]);
if (!regenerator) {
plugins.push([_entryPlugin3.default, pluginOptions]);
}
}
}
}
}
return {
plugins
};
});
exports.default = _default;

View File

@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _default = {
auto: "transform-modules-commonjs",
amd: "transform-modules-amd",
commonjs: "transform-modules-commonjs",
cjs: "transform-modules-commonjs",
systemjs: "transform-modules-systemjs",
umd: "transform-modules-umd"
};
exports.default = _default;

212
node_modules/@babel/preset-env/lib/normalize-options.js generated vendored Normal file
View File

@@ -0,0 +1,212 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.normalizeCoreJSOption = normalizeCoreJSOption;
exports.default = normalizeOptions;
exports.validateUseBuiltInsOption = exports.validateModulesOption = exports.validateIgnoreBrowserslistConfig = exports.validateBoolOption = exports.validateConfigPathOption = exports.checkDuplicateIncludeExcludes = exports.normalizePluginName = void 0;
function _data() {
const data = _interopRequireDefault(require("core-js-compat/data"));
_data = function () {
return data;
};
return data;
}
function _invariant() {
const data = _interopRequireDefault(require("invariant"));
_invariant = function () {
return data;
};
return data;
}
function _semver() {
const data = require("semver");
_semver = function () {
return data;
};
return data;
}
var _corejs2BuiltIns = _interopRequireDefault(require("../data/corejs2-built-ins.json"));
var _plugins = _interopRequireDefault(require("../data/plugins.json"));
var _moduleTransformations = _interopRequireDefault(require("./module-transformations"));
var _options = require("./options");
var _getPlatformSpecificDefault = require("./polyfills/corejs2/get-platform-specific-default");
var _targetsParser = require("./targets-parser");
var _utils = require("./utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const validateTopLevelOptions = options => {
const validOptions = Object.keys(_options.TopLevelOptions);
for (const option in options) {
if (!_options.TopLevelOptions[option]) {
throw new Error(`Invalid Option: ${option} is not a valid top-level option.
Maybe you meant to use '${(0, _utils.findSuggestion)(validOptions, option)}'?`);
}
}
};
const allPluginsList = [...Object.keys(_plugins.default), ...Object.keys(_moduleTransformations.default).map(m => _moduleTransformations.default[m])];
const validIncludesAndExcludesWithoutCoreJS = new Set(allPluginsList);
const validIncludesAndExcludesWithCoreJS2 = new Set([...allPluginsList, ...Object.keys(_corejs2BuiltIns.default), ..._getPlatformSpecificDefault.defaultWebIncludes]);
const validIncludesAndExcludesWithCoreJS3 = new Set([...allPluginsList, ...Object.keys(_data().default)]);
const pluginToRegExp = plugin => {
if (plugin instanceof RegExp) return plugin;
try {
return new RegExp(`^${normalizePluginName(plugin)}$`);
} catch (e) {
return null;
}
};
const selectPlugins = (regexp, corejs) => Array.from(corejs ? corejs == 2 ? validIncludesAndExcludesWithCoreJS2 : validIncludesAndExcludesWithCoreJS3 : validIncludesAndExcludesWithoutCoreJS).filter(item => regexp instanceof RegExp && regexp.test(item));
const flatten = array => [].concat(...array);
const expandIncludesAndExcludes = (plugins = [], type, corejs) => {
if (plugins.length === 0) return [];
const selectedPlugins = plugins.map(plugin => selectPlugins(pluginToRegExp(plugin), corejs));
const invalidRegExpList = plugins.filter((p, i) => selectedPlugins[i].length === 0);
(0, _invariant().default)(invalidRegExpList.length === 0, `Invalid Option: The plugins/built-ins '${invalidRegExpList.join(", ")}' passed to the '${type}' option are not
valid. Please check data/[plugin-features|built-in-features].js in babel-preset-env`);
return flatten(selectedPlugins);
};
const normalizePluginName = plugin => plugin.replace(/^(@babel\/|babel-)(plugin-)?/, "");
exports.normalizePluginName = normalizePluginName;
const checkDuplicateIncludeExcludes = (include = [], exclude = []) => {
const duplicates = include.filter(opt => exclude.indexOf(opt) >= 0);
(0, _invariant().default)(duplicates.length === 0, `Invalid Option: The plugins/built-ins '${duplicates.join(", ")}' were found in both the "include" and
"exclude" options.`);
};
exports.checkDuplicateIncludeExcludes = checkDuplicateIncludeExcludes;
const normalizeTargets = targets => {
if ((0, _targetsParser.isBrowsersQueryValid)(targets)) {
return {
browsers: targets
};
}
return Object.assign({}, targets);
};
const validateConfigPathOption = (configPath = process.cwd()) => {
(0, _invariant().default)(typeof configPath === "string", `Invalid Option: The configPath option '${configPath}' is invalid, only strings are allowed.`);
return configPath;
};
exports.validateConfigPathOption = validateConfigPathOption;
const validateBoolOption = (name, value, defaultValue) => {
if (typeof value === "undefined") {
value = defaultValue;
}
if (typeof value !== "boolean") {
throw new Error(`Preset env: '${name}' option must be a boolean.`);
}
return value;
};
exports.validateBoolOption = validateBoolOption;
const validateIgnoreBrowserslistConfig = ignoreBrowserslistConfig => validateBoolOption(_options.TopLevelOptions.ignoreBrowserslistConfig, ignoreBrowserslistConfig, false);
exports.validateIgnoreBrowserslistConfig = validateIgnoreBrowserslistConfig;
const validateModulesOption = (modulesOpt = _options.ModulesOption.auto) => {
(0, _invariant().default)(_options.ModulesOption[modulesOpt.toString()] || _options.ModulesOption[modulesOpt.toString()] === _options.ModulesOption.false, `Invalid Option: The 'modules' option must be one of \n` + ` - 'false' to indicate no module processing\n` + ` - a specific module type: 'commonjs', 'amd', 'umd', 'systemjs'` + ` - 'auto' (default) which will automatically select 'false' if the current\n` + ` process is known to support ES module syntax, or "commonjs" otherwise\n`);
return modulesOpt;
};
exports.validateModulesOption = validateModulesOption;
const validateUseBuiltInsOption = (builtInsOpt = false) => {
(0, _invariant().default)(_options.UseBuiltInsOption[builtInsOpt.toString()] || _options.UseBuiltInsOption[builtInsOpt.toString()] === _options.UseBuiltInsOption.false, `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;
};
exports.validateUseBuiltInsOption = validateUseBuiltInsOption;
function normalizeCoreJSOption(corejs, useBuiltIns) {
let proposals = false;
let rawVersion;
if (useBuiltIns && corejs === undefined) {
rawVersion = 2;
console.warn("\nWARNING: We noticed you're using the `useBuiltIns` option without declaring a " + "core-js version. Currently, we assume version 2.x when no version " + "is passed. Since this default version will likely change in future " + "versions of Babel, we recommend explicitly setting the core-js version " + "you are using via the `corejs` option.\n" + "\nYou should also be sure that the version you pass to the `corejs` " + "option matches the version specified in your `package.json`'s " + "`dependencies` section. If it doesn't, you need to run one of the " + "following commands:\n\n" + " npm install --save core-js@2 npm install --save core-js@3\n" + " yarn add core-js@2 yarn add core-js@3\n");
} else if (typeof corejs === "object" && corejs !== null) {
rawVersion = corejs.version;
proposals = Boolean(corejs.proposals);
} else {
rawVersion = corejs;
}
const version = rawVersion ? (0, _semver().coerce)(String(rawVersion)) : false;
if (!useBuiltIns && version) {
console.log("\nThe `corejs` option only has an effect when the `useBuiltIns` option is not `false`\n");
}
if (useBuiltIns && (!version || version.major < 2 || version.major > 3)) {
throw new RangeError("Invalid Option: The version passed to `corejs` is invalid. Currently, " + "only core-js@2 and core-js@3 are supported.");
}
return {
version,
proposals
};
}
function normalizeOptions(opts) {
validateTopLevelOptions(opts);
const useBuiltIns = validateUseBuiltInsOption(opts.useBuiltIns);
const corejs = normalizeCoreJSOption(opts.corejs, useBuiltIns);
const include = expandIncludesAndExcludes(opts.include, _options.TopLevelOptions.include, !!corejs.version && corejs.version.major);
const exclude = expandIncludesAndExcludes(opts.exclude, _options.TopLevelOptions.exclude, !!corejs.version && corejs.version.major);
checkDuplicateIncludeExcludes(include, exclude);
const shippedProposals = validateBoolOption(_options.TopLevelOptions.shippedProposals, opts.shippedProposals, false) || corejs.proposals;
return {
configPath: validateConfigPathOption(opts.configPath),
corejs,
debug: validateBoolOption(_options.TopLevelOptions.debug, opts.debug, false),
include,
exclude,
forceAllTransforms: validateBoolOption(_options.TopLevelOptions.forceAllTransforms, opts.forceAllTransforms, false),
ignoreBrowserslistConfig: validateIgnoreBrowserslistConfig(opts.ignoreBrowserslistConfig),
loose: validateBoolOption(_options.TopLevelOptions.loose, opts.loose, false),
modules: validateModulesOption(opts.modules),
shippedProposals,
spec: validateBoolOption(_options.TopLevelOptions.spec, opts.spec, false),
targets: normalizeTargets(opts.targets),
useBuiltIns: useBuiltIns
};
}

55
node_modules/@babel/preset-env/lib/options.js generated vendored Normal file
View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.TargetNames = exports.UseBuiltInsOption = exports.ModulesOption = exports.TopLevelOptions = void 0;
const TopLevelOptions = {
configPath: "configPath",
corejs: "corejs",
debug: "debug",
exclude: "exclude",
forceAllTransforms: "forceAllTransforms",
ignoreBrowserslistConfig: "ignoreBrowserslistConfig",
include: "include",
loose: "loose",
modules: "modules",
shippedProposals: "shippedProposals",
spec: "spec",
targets: "targets",
useBuiltIns: "useBuiltIns"
};
exports.TopLevelOptions = TopLevelOptions;
const ModulesOption = {
false: false,
auto: "auto",
amd: "amd",
commonjs: "commonjs",
cjs: "cjs",
systemjs: "systemjs",
umd: "umd"
};
exports.ModulesOption = ModulesOption;
const UseBuiltInsOption = {
false: false,
entry: "entry",
usage: "usage"
};
exports.UseBuiltInsOption = UseBuiltInsOption;
const TargetNames = {
esmodules: "esmodules",
node: "node",
browsers: "browsers",
chrome: "chrome",
opera: "opera",
edge: "edge",
firefox: "firefox",
safari: "safari",
ie: "ie",
ios: "ios",
android: "android",
electron: "electron",
samsung: "samsung",
uglify: "uglify"
};
exports.TargetNames = TargetNames;

View File

@@ -0,0 +1,175 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.StaticProperties = exports.InstanceProperties = exports.BuiltIns = void 0;
const ArrayNatureIterators = ["es6.object.to-string", "es6.array.iterator", "web.dom.iterable"];
const CommonIterators = ["es6.string.iterator", ...ArrayNatureIterators];
const PromiseDependencies = ["es6.object.to-string", "es6.promise"];
const BuiltIns = {
DataView: "es6.typed.data-view",
Float32Array: "es6.typed.float32-array",
Float64Array: "es6.typed.float64-array",
Int8Array: "es6.typed.int8-array",
Int16Array: "es6.typed.int16-array",
Int32Array: "es6.typed.int32-array",
Map: ["es6.map", ...CommonIterators],
Number: "es6.number.constructor",
Promise: PromiseDependencies,
RegExp: ["es6.regexp.constructor"],
Set: ["es6.set", ...CommonIterators],
Symbol: ["es6.symbol", "es7.symbol.async-iterator"],
Uint8Array: "es6.typed.uint8-array",
Uint8ClampedArray: "es6.typed.uint8-clamped-array",
Uint16Array: "es6.typed.uint16-array",
Uint32Array: "es6.typed.uint32-array",
WeakMap: ["es6.weak-map", ...CommonIterators],
WeakSet: ["es6.weak-set", ...CommonIterators]
};
exports.BuiltIns = BuiltIns;
const InstanceProperties = {
__defineGetter__: ["es7.object.define-getter"],
__defineSetter__: ["es7.object.define-setter"],
__lookupGetter__: ["es7.object.lookup-getter"],
__lookupSetter__: ["es7.object.lookup-setter"],
anchor: ["es6.string.anchor"],
big: ["es6.string.big"],
bind: ["es6.function.bind"],
blink: ["es6.string.blink"],
bold: ["es6.string.bold"],
codePointAt: ["es6.string.code-point-at"],
copyWithin: ["es6.array.copy-within"],
endsWith: ["es6.string.ends-with"],
entries: ArrayNatureIterators,
every: ["es6.array.is-array"],
fill: ["es6.array.fill"],
filter: ["es6.array.filter"],
finally: ["es7.promise.finally", ...PromiseDependencies],
find: ["es6.array.find"],
findIndex: ["es6.array.find-index"],
fixed: ["es6.string.fixed"],
flags: ["es6.regexp.flags"],
flatMap: ["es7.array.flat-map"],
fontcolor: ["es6.string.fontcolor"],
fontsize: ["es6.string.fontsize"],
forEach: ["es6.array.for-each"],
includes: ["es6.string.includes", "es7.array.includes"],
indexOf: ["es6.array.index-of"],
italics: ["es6.string.italics"],
keys: ArrayNatureIterators,
lastIndexOf: ["es6.array.last-index-of"],
link: ["es6.string.link"],
map: ["es6.array.map"],
match: ["es6.regexp.match"],
name: ["es6.function.name"],
padStart: ["es7.string.pad-start"],
padEnd: ["es7.string.pad-end"],
reduce: ["es6.array.reduce"],
reduceRight: ["es6.array.reduce-right"],
repeat: ["es6.string.repeat"],
replace: ["es6.regexp.replace"],
search: ["es6.regexp.search"],
slice: ["es6.array.slice"],
small: ["es6.string.small"],
some: ["es6.array.some"],
sort: ["es6.array.sort"],
split: ["es6.regexp.split"],
startsWith: ["es6.string.starts-with"],
strike: ["es6.string.strike"],
sub: ["es6.string.sub"],
sup: ["es6.string.sup"],
toISOString: ["es6.date.to-iso-string"],
toJSON: ["es6.date.to-json"],
toString: ["es6.object.to-string", "es6.date.to-string", "es6.regexp.to-string"],
trim: ["es6.string.trim"],
trimEnd: ["es7.string.trim-right"],
trimLeft: ["es7.string.trim-left"],
trimRight: ["es7.string.trim-right"],
trimStart: ["es7.string.trim-left"],
values: ArrayNatureIterators
};
exports.InstanceProperties = InstanceProperties;
const StaticProperties = {
Array: {
from: ["es6.array.from", "es6.string.iterator"],
isArray: "es6.array.is-array",
of: "es6.array.of"
},
Date: {
now: "es6.date.now"
},
Object: {
assign: "es6.object.assign",
create: "es6.object.create",
defineProperty: "es6.object.define-property",
defineProperties: "es6.object.define-properties",
entries: "es7.object.entries",
freeze: "es6.object.freeze",
getOwnPropertyDescriptors: "es7.object.get-own-property-descriptors",
getOwnPropertySymbols: "es6.symbol",
is: "es6.object.is",
isExtensible: "es6.object.is-extensible",
isFrozen: "es6.object.is-frozen",
isSealed: "es6.object.is-sealed",
keys: "es6.object.keys",
preventExtensions: "es6.object.prevent-extensions",
seal: "es6.object.seal",
setPrototypeOf: "es6.object.set-prototype-of",
values: "es7.object.values"
},
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: {
fromCodePoint: "es6.string.from-code-point",
raw: "es6.string.raw"
},
Number: {
EPSILON: "es6.number.epsilon",
MIN_SAFE_INTEGER: "es6.number.min-safe-integer",
MAX_SAFE_INTEGER: "es6.number.max-safe-integer",
isFinite: "es6.number.is-finite",
isInteger: "es6.number.is-integer",
isSafeInteger: "es6.number.is-safe-integer",
isNaN: "es6.number.is-nan",
parseFloat: "es6.number.parse-float",
parseInt: "es6.number.parse-int"
},
Promise: {
all: CommonIterators,
race: CommonIterators
},
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"
}
};
exports.StaticProperties = StaticProperties;

View File

@@ -0,0 +1,75 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _corejs2BuiltIns = _interopRequireDefault(require("../../../data/corejs2-built-ins.json"));
var _getPlatformSpecificDefault = _interopRequireDefault(require("./get-platform-specific-default"));
var _filterItems = _interopRequireDefault(require("../../filter-items"));
var _utils = require("../../utils");
var _debug = require("../../debug");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _default(_, {
include,
exclude,
polyfillTargets,
regenerator,
debug
}) {
const polyfills = (0, _filterItems.default)(_corejs2BuiltIns.default, include, exclude, polyfillTargets, (0, _getPlatformSpecificDefault.default)(polyfillTargets));
const isPolyfillImport = {
ImportDeclaration(path) {
if ((0, _utils.isPolyfillSource)((0, _utils.getImportSource)(path))) {
this.replaceBySeparateModulesImport(path);
}
},
Program(path) {
path.get("body").forEach(bodyPath => {
if ((0, _utils.isPolyfillSource)((0, _utils.getRequireSource)(bodyPath))) {
this.replaceBySeparateModulesImport(bodyPath);
}
});
}
};
return {
name: "corejs2-entry",
visitor: isPolyfillImport,
pre() {
this.importPolyfillIncluded = false;
this.replaceBySeparateModulesImport = function (path) {
this.importPolyfillIncluded = true;
if (regenerator) {
(0, _utils.createImport)(path, "regenerator-runtime");
}
const modules = Array.from(polyfills).reverse();
for (const module of modules) {
(0, _utils.createImport)(path, module);
}
path.remove();
};
},
post() {
if (debug) {
(0, _debug.logEntryPolyfills)("@babel/polyfill", this.importPolyfillIncluded, polyfills, this.file.opts.filename, polyfillTargets, _corejs2BuiltIns.default);
}
}
};
}

View File

@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
exports.defaultWebIncludes = void 0;
const defaultWebIncludes = ["web.timers", "web.immediate", "web.dom.iterable"];
exports.defaultWebIncludes = defaultWebIncludes;
function _default(targets) {
const targetNames = Object.keys(targets);
const isAnyTarget = !targetNames.length;
const isWebTarget = targetNames.some(name => name !== "node");
return isAnyTarget || isWebTarget ? defaultWebIncludes : null;
}

View File

@@ -0,0 +1,216 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _corejs2BuiltIns = _interopRequireDefault(require("../../../data/corejs2-built-ins.json"));
var _getPlatformSpecificDefault = _interopRequireDefault(require("./get-platform-specific-default"));
var _filterItems = _interopRequireDefault(require("../../filter-items"));
var _builtInDefinitions = require("./built-in-definitions");
var _utils = require("../../utils");
var _debug = require("../../debug");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const NO_DIRECT_POLYFILL_IMPORT = `
When setting \`useBuiltIns: 'usage'\`, polyfills are automatically imported when needed.
Please remove the \`import '@babel/polyfill'\` call or use \`useBuiltIns: 'entry'\` instead.`;
function _default({
types: t
}, {
include,
exclude,
polyfillTargets,
debug
}) {
const polyfills = (0, _filterItems.default)(_corejs2BuiltIns.default, include, exclude, polyfillTargets, (0, _getPlatformSpecificDefault.default)(polyfillTargets));
const addAndRemovePolyfillImports = {
ImportDeclaration(path) {
if ((0, _utils.isPolyfillSource)((0, _utils.getImportSource)(path))) {
console.warn(NO_DIRECT_POLYFILL_IMPORT);
path.remove();
}
},
Program(path) {
path.get("body").forEach(bodyPath => {
if ((0, _utils.isPolyfillSource)((0, _utils.getRequireSource)(bodyPath))) {
console.warn(NO_DIRECT_POLYFILL_IMPORT);
bodyPath.remove();
}
});
},
ReferencedIdentifier({
node: {
name
},
parent,
scope
}) {
if (t.isMemberExpression(parent)) return;
if (!(0, _utils.has)(_builtInDefinitions.BuiltIns, name)) return;
if (scope.getBindingIdentifier(name)) return;
const BuiltInDependencies = _builtInDefinitions.BuiltIns[name];
this.addUnsupported(BuiltInDependencies);
},
CallExpression(path) {
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;
}
this.addImport("web.dom.iterable");
},
BinaryExpression(path) {
if (path.node.operator !== "in") return;
if (!path.get("left").matchesPattern("Symbol.iterator")) return;
this.addImport("web.dom.iterable");
},
YieldExpression(path) {
if (path.node.delegate) {
this.addImport("web.dom.iterable");
}
},
MemberExpression: {
enter(path) {
const {
node
} = path;
const {
object,
property
} = node;
let evaluatedPropType = object.name;
let propertyName = property.name;
let instanceType = "";
if (node.computed) {
if (t.isStringLiteral(property)) {
propertyName = property.value;
} else {
const result = path.get("property").evaluate();
if (result.confident && result.value) {
propertyName = result.value;
}
}
}
if (path.scope.getBindingIdentifier(object.name)) {
const result = path.get("object").evaluate();
if (result.value) {
instanceType = (0, _utils.getType)(result.value);
} else if (result.deopt && result.deopt.isIdentifier()) {
evaluatedPropType = result.deopt.node.name;
}
}
if ((0, _utils.has)(_builtInDefinitions.StaticProperties, evaluatedPropType)) {
const BuiltInProperties = _builtInDefinitions.StaticProperties[evaluatedPropType];
if ((0, _utils.has)(BuiltInProperties, propertyName)) {
const StaticPropertyDependencies = BuiltInProperties[propertyName];
this.addUnsupported(StaticPropertyDependencies);
}
}
if ((0, _utils.has)(_builtInDefinitions.InstanceProperties, propertyName)) {
let InstancePropertyDependencies = _builtInDefinitions.InstanceProperties[propertyName];
if (instanceType) {
InstancePropertyDependencies = InstancePropertyDependencies.filter(module => module.includes(instanceType));
}
this.addUnsupported(InstancePropertyDependencies);
}
},
exit(path) {
const {
name
} = path.node.object;
if (!(0, _utils.has)(_builtInDefinitions.BuiltIns, name)) return;
if (path.scope.getBindingIdentifier(name)) return;
const BuiltInDependencies = _builtInDefinitions.BuiltIns[name];
this.addUnsupported(BuiltInDependencies);
}
},
VariableDeclarator(path) {
const {
node
} = path;
const {
id,
init
} = node;
if (!t.isObjectPattern(id)) return;
if (init && path.scope.getBindingIdentifier(init.name)) return;
for (const _ref of id.properties) {
const {
key
} = _ref;
if (!node.computed && t.isIdentifier(key) && (0, _utils.has)(_builtInDefinitions.InstanceProperties, key.name)) {
const InstancePropertyDependencies = _builtInDefinitions.InstanceProperties[key.name];
this.addUnsupported(InstancePropertyDependencies);
}
}
}
};
return {
name: "corejs2-usage",
pre({
path
}) {
this.polyfillsSet = new Set();
this.addImport = function (builtIn) {
if (!this.polyfillsSet.has(builtIn)) {
this.polyfillsSet.add(builtIn);
(0, _utils.createImport)(path, builtIn);
}
};
this.addUnsupported = function (builtIn) {
const modules = Array.isArray(builtIn) ? builtIn : [builtIn];
for (const module of modules) {
if (polyfills.has(module)) {
this.addImport(module);
}
}
};
},
post() {
if (debug) {
(0, _debug.logUsagePolyfills)(this.polyfillsSet, this.file.opts.filename, polyfillTargets, _corejs2BuiltIns.default);
}
},
visitor: addAndRemovePolyfillImports
};
}

View File

@@ -0,0 +1,304 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PossibleGlobalObjects = exports.CommonInstanceDependencies = exports.StaticProperties = exports.InstanceProperties = exports.BuiltIns = exports.PromiseDependencies = exports.CommonIterators = void 0;
const ArrayNatureIterators = ["es.array.iterator", "web.dom-collections.iterator"];
const CommonIterators = ["es.string.iterator", ...ArrayNatureIterators];
exports.CommonIterators = CommonIterators;
const ArrayNatureIteratorsWithTag = ["es.object.to-string", ...ArrayNatureIterators];
const CommonIteratorsWithTag = ["es.object.to-string", ...CommonIterators];
const TypedArrayDependencies = ["es.typed-array.copy-within", "es.typed-array.every", "es.typed-array.fill", "es.typed-array.filter", "es.typed-array.find", "es.typed-array.find-index", "es.typed-array.for-each", "es.typed-array.includes", "es.typed-array.index-of", "es.typed-array.iterator", "es.typed-array.join", "es.typed-array.last-index-of", "es.typed-array.map", "es.typed-array.reduce", "es.typed-array.reduce-right", "es.typed-array.reverse", "es.typed-array.set", "es.typed-array.slice", "es.typed-array.some", "es.typed-array.sort", "es.typed-array.subarray", "es.typed-array.to-locale-string", "es.typed-array.to-string", "es.object.to-string", "es.array.iterator", "es.array-buffer.slice"];
const TypedArrayStaticMethods = {
from: "es.typed-array.from",
of: "es.typed-array.of"
};
const PromiseDependencies = ["es.promise", "es.object.to-string"];
exports.PromiseDependencies = PromiseDependencies;
const PromiseDependenciesWithIterators = [...PromiseDependencies, ...CommonIterators];
const SymbolDependencies = ["es.symbol", "es.symbol.description", "es.object.to-string"];
const MapDependencies = ["es.map", "esnext.map.delete-all", "esnext.map.every", "esnext.map.filter", "esnext.map.find", "esnext.map.find-key", "esnext.map.includes", "esnext.map.key-of", "esnext.map.map-keys", "esnext.map.map-values", "esnext.map.merge", "esnext.map.reduce", "esnext.map.some", "esnext.map.update", ...CommonIteratorsWithTag];
const SetDependencies = ["es.set", "esnext.set.add-all", "esnext.set.delete-all", "esnext.set.difference", "esnext.set.every", "esnext.set.filter", "esnext.set.find", "esnext.set.intersection", "esnext.set.is-disjoint-from", "esnext.set.is-subset-of", "esnext.set.is-superset-of", "esnext.set.join", "esnext.set.map", "esnext.set.reduce", "esnext.set.some", "esnext.set.symmetric-difference", "esnext.set.union", ...CommonIteratorsWithTag];
const WeakMapDependencies = ["es.weak-map", "esnext.weak-map.delete-all", ...CommonIteratorsWithTag];
const WeakSetDependencies = ["es.weak-set", "esnext.weak-set.add-all", "esnext.weak-set.delete-all", ...CommonIteratorsWithTag];
const URLSearchParamsDependencies = ["web.url", ...CommonIteratorsWithTag];
const BuiltIns = {
AggregateError: ["esnext.aggregate-error", ...CommonIterators],
ArrayBuffer: ["es.array-buffer.constructor", "es.array-buffer.slice", "es.object.to-string"],
DataView: ["es.data-view", "es.array-buffer.slice", "es.object.to-string"],
Date: ["es.date.to-string"],
Float32Array: ["es.typed-array.float32-array", ...TypedArrayDependencies],
Float64Array: ["es.typed-array.float64-array", ...TypedArrayDependencies],
Int8Array: ["es.typed-array.int8-array", ...TypedArrayDependencies],
Int16Array: ["es.typed-array.int16-array", ...TypedArrayDependencies],
Int32Array: ["es.typed-array.int32-array", ...TypedArrayDependencies],
Uint8Array: ["es.typed-array.uint8-array", ...TypedArrayDependencies],
Uint8ClampedArray: ["es.typed-array.uint8-clamped-array", ...TypedArrayDependencies],
Uint16Array: ["es.typed-array.uint16-array", ...TypedArrayDependencies],
Uint32Array: ["es.typed-array.uint32-array", ...TypedArrayDependencies],
Map: MapDependencies,
Number: ["es.number.constructor"],
Observable: ["esnext.observable", "esnext.symbol.observable", "es.object.to-string", ...CommonIteratorsWithTag],
Promise: PromiseDependencies,
RegExp: ["es.regexp.constructor", "es.regexp.exec", "es.regexp.to-string"],
Set: SetDependencies,
Symbol: SymbolDependencies,
URL: ["web.url", ...URLSearchParamsDependencies],
URLSearchParams: URLSearchParamsDependencies,
WeakMap: WeakMapDependencies,
WeakSet: WeakSetDependencies,
clearImmediate: ["web.immediate"],
compositeKey: ["esnext.composite-key"],
compositeSymbol: ["esnext.composite-symbol", ...SymbolDependencies],
fetch: PromiseDependencies,
globalThis: ["esnext.global-this"],
parseFloat: ["es.parse-float"],
parseInt: ["es.parse-int"],
queueMicrotask: ["web.queue-microtask"],
setTimeout: ["web.timers"],
setInterval: ["web.timers"],
setImmediate: ["web.immediate"]
};
exports.BuiltIns = BuiltIns;
const InstanceProperties = {
at: ["esnext.string.at"],
anchor: ["es.string.anchor"],
big: ["es.string.big"],
bind: ["es.function.bind"],
blink: ["es.string.blink"],
bold: ["es.string.bold"],
codePointAt: ["es.string.code-point-at"],
codePoints: ["esnext.string.code-points"],
concat: ["es.array.concat"],
copyWithin: ["es.array.copy-within"],
description: ["es.symbol", "es.symbol.description"],
endsWith: ["es.string.ends-with"],
entries: ArrayNatureIteratorsWithTag,
every: ["es.array.every"],
exec: ["es.regexp.exec"],
fill: ["es.array.fill"],
filter: ["es.array.filter"],
finally: ["es.promise.finally", ...PromiseDependencies],
find: ["es.array.find"],
findIndex: ["es.array.find-index"],
fixed: ["es.string.fixed"],
flags: ["es.regexp.flags"],
flat: ["es.array.flat", "es.array.unscopables.flat"],
flatMap: ["es.array.flat-map", "es.array.unscopables.flat-map"],
fontcolor: ["es.string.fontcolor"],
fontsize: ["es.string.fontsize"],
forEach: ["es.array.for-each", "web.dom-collections.for-each"],
includes: ["es.array.includes", "es.string.includes"],
indexOf: ["es.array.index-of"],
italic: ["es.string.italics"],
join: ["es.array.join"],
keys: ArrayNatureIteratorsWithTag,
lastIndex: ["esnext.array.last-index"],
lastIndexOf: ["es.array.last-index-of"],
lastItem: ["esnext.array.last-item"],
link: ["es.string.link"],
match: ["es.string.match", "es.regexp.exec"],
matchAll: ["esnext.string.match-all"],
map: ["es.array.map"],
name: ["es.function.name"],
padEnd: ["es.string.pad-end"],
padStart: ["es.string.pad-start"],
reduce: ["es.array.reduce"],
reduceRight: ["es.array.reduce-right"],
repeat: ["es.string.repeat"],
replace: ["es.string.replace", "es.regexp.exec"],
replaceAll: ["esnext.string.replace-all"],
reverse: ["es.string.reverse"],
search: ["es.string.search", "es.regexp.exec"],
slice: ["es.array.slice"],
small: ["es.string.small"],
some: ["es.array.some"],
sort: ["es.array.sort"],
splice: ["es.array.splice"],
split: ["es.string.split", "es.regexp.exec"],
startsWith: ["es.string.starts-with"],
strike: ["es.string.strike"],
sub: ["es.string.sub"],
sup: ["es.string.sup"],
toFixed: ["es.number.to-fixed"],
toISOString: ["es.date.to-iso-string"],
toJSON: ["es.date.to-json", "web.url.to-json"],
toPrecision: ["es.number.to-precision"],
toString: ["es.object.to-string", "es.regexp.to-string", "es.date.to-string"],
trim: ["es.string.trim"],
trimEnd: ["es.string.trim-end"],
trimLeft: ["es.string.trim-start"],
trimRight: ["es.string.trim-end"],
trimStart: ["es.string.trim-start"],
values: ArrayNatureIteratorsWithTag,
__defineGetter__: ["es.object.define-getter"],
__defineSetter__: ["es.object.define-setter"],
__lookupGetter__: ["es.object.lookup-getter"],
__lookupSetter__: ["es.object.lookup-setter"]
};
exports.InstanceProperties = InstanceProperties;
const StaticProperties = {
Array: {
from: ["es.array.from", "es.string.iterator"],
isArray: ["es.array.is-array"],
of: ["es.array.of"]
},
Date: {
now: "es.date.now"
},
Object: {
assign: "es.object.assign",
create: "es.object.create",
defineProperty: "es.object.define-property",
defineProperties: "es.object.define-properties",
entries: "es.object.entries",
freeze: "es.object.freeze",
fromEntries: ["es.object.from-entries", "es.array.iterator"],
getOwnPropertyDescriptor: "es.object.get-own-property-descriptor",
getOwnPropertyDescriptors: "es.object.get-own-property-descriptors",
getOwnPropertyNames: "es.object.get-own-property-names",
getOwnPropertySymbols: "es.symbol",
getPrototypeOf: "es.object.get-prototype-of",
is: "es.object.is",
isExtensible: "es.object.is-extensible",
isFrozen: "es.object.is-frozen",
isSealed: "es.object.is-sealed",
keys: "es.object.keys",
preventExtensions: "es.object.prevent-extensions",
seal: "es.object.seal",
setPrototypeOf: "es.object.set-prototype-of",
values: "es.object.values"
},
Math: {
DEG_PER_RAD: "esnext.math.deg-per-rad",
RAD_PER_DEG: "esnext.math.rad-per-deg",
acosh: "es.math.acosh",
asinh: "es.math.asinh",
atanh: "es.math.atanh",
cbrt: "es.math.cbrt",
clamp: "esnext.math.clamp",
clz32: "es.math.clz32",
cosh: "es.math.cosh",
degrees: "esnext.math.degrees",
expm1: "es.math.expm1",
fround: "es.math.fround",
fscale: "esnext.math.fscale",
hypot: "es.math.hypot",
iaddh: "esnext.math.iaddh",
imul: "es.math.imul",
imulh: "esnext.math.imulh",
isubh: "esnext.math.isubh",
log1p: "es.math.log1p",
log10: "es.math.log10",
log2: "es.math.log2",
radians: "esnext.math.radians",
scale: "esnext.math.scale",
seededPRNG: "esnext.math.seeded-prng",
sign: "es.math.sign",
signbit: "esnext.math.signbit",
sinh: "es.math.sinh",
tanh: "es.math.tanh",
trunc: "es.math.trunc",
umulh: "esnext.math.umulh"
},
String: {
fromCodePoint: "es.string.from-code-point",
raw: "es.string.raw"
},
Number: {
EPSILON: "es.number.epsilon",
MIN_SAFE_INTEGER: "es.number.min-safe-integer",
MAX_SAFE_INTEGER: "es.number.max-safe-integer",
fromString: "esnext.number.from-string",
isFinite: "es.number.is-finite",
isInteger: "es.number.is-integer",
isSafeInteger: "es.number.is-safe-integer",
isNaN: "es.number.is-nan",
parseFloat: "es.number.parse-float",
parseInt: "es.number.parse-int"
},
Map: {
from: ["esnext.map.from", ...MapDependencies],
groupBy: ["esnext.map.group-by", ...MapDependencies],
keyBy: ["esnext.map.key-by", ...MapDependencies],
of: ["esnext.map.of", ...MapDependencies]
},
Set: {
from: ["esnext.set.from", ...SetDependencies],
of: ["esnext.set.of", ...SetDependencies]
},
WeakMap: {
from: ["esnext.weak-map.from", ...WeakMapDependencies],
of: ["esnext.weak-map.of", ...WeakMapDependencies]
},
WeakSet: {
from: ["esnext.weak-set.from", ...WeakSetDependencies],
of: ["esnext.weak-set.of", ...WeakSetDependencies]
},
Promise: {
all: PromiseDependenciesWithIterators,
allSettled: ["esnext.promise.all-settled", ...PromiseDependenciesWithIterators],
any: ["esnext.promise.any", ...PromiseDependenciesWithIterators],
race: PromiseDependenciesWithIterators,
try: ["esnext.promise.try", ...PromiseDependenciesWithIterators]
},
Reflect: {
apply: "es.reflect.apply",
construct: "es.reflect.construct",
defineMetadata: "esnext.reflect.define-metadata",
defineProperty: "es.reflect.define-property",
deleteMetadata: "esnext.reflect.delete-metadata",
deleteProperty: "es.reflect.delete-property",
get: "es.reflect.get",
getMetadata: "esnext.reflect.get-metadata",
getMetadataKeys: "esnext.reflect.get-metadata-keys",
getOwnMetadata: "esnext.reflect.get-own-metadata",
getOwnMetadataKeys: "esnext.reflect.get-own-metadata-keys",
getOwnPropertyDescriptor: "es.reflect.get-own-property-descriptor",
getPrototypeOf: "es.reflect.get-prototype-of",
has: "es.reflect.has",
hasMetadata: "esnext.reflect.has-metadata",
hasOwnMetadata: "esnext.reflect.has-own-metadata",
isExtensible: "es.reflect.is-extensible",
metadata: "esnext.reflect.metadata",
ownKeys: "es.reflect.own-keys",
preventExtensions: "es.reflect.prevent-extensions",
set: "es.reflect.set",
setPrototypeOf: "es.reflect.set-prototype-of"
},
Symbol: {
asyncIterator: ["es.symbol.async-iterator"],
dispose: ["esnext.symbol.dispose"],
hasInstance: ["es.symbol.has-instance", "es.function.has-instance"],
isConcatSpreadable: ["es.symbol.is-concat-spreadable", "es.array.concat"],
iterator: ["es.symbol.iterator", ...CommonIteratorsWithTag],
match: ["es.symbol.match", "es.string.match"],
observable: ["esnext.symbol.observable"],
patternMatch: ["esnext.symbol.pattern-match"],
replace: ["es.symbol.replace", "es.string.replace"],
search: ["es.symbol.search", "es.string.search"],
species: ["es.symbol.species", "es.array.species"],
split: ["es.symbol.split", "es.string.split"],
toPrimitive: ["es.symbol.to-primitive", "es.date.to-primitive"],
toStringTag: ["es.symbol.to-string-tag", "es.object.to-string", "es.math.to-string-tag", "es.json.to-string-tag"],
unscopables: ["es.symbol.unscopables"]
},
ArrayBuffer: {
isView: ["es.array-buffer.is-view"]
},
Int8Array: TypedArrayStaticMethods,
Uint8Array: TypedArrayStaticMethods,
Uint8ClampedArray: TypedArrayStaticMethods,
Int16Array: TypedArrayStaticMethods,
Uint16Array: TypedArrayStaticMethods,
Int32Array: TypedArrayStaticMethods,
Uint32Array: TypedArrayStaticMethods,
Float32Array: TypedArrayStaticMethods,
Float64Array: TypedArrayStaticMethods
};
exports.StaticProperties = StaticProperties;
const CommonInstanceDependencies = new Set(["es.object.to-string", "es.object.define-getter", "es.object.define-setter", "es.object.lookup-getter", "es.object.lookup-setter", "es.regexp.exec"]);
exports.CommonInstanceDependencies = CommonInstanceDependencies;
const PossibleGlobalObjects = new Set(["global", "globalThis", "self", "window"]);
exports.PossibleGlobalObjects = PossibleGlobalObjects;

View File

@@ -0,0 +1,137 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _data() {
const data = _interopRequireDefault(require("core-js-compat/data"));
_data = function () {
return data;
};
return data;
}
function _entries() {
const data = _interopRequireDefault(require("core-js-compat/entries"));
_entries = function () {
return data;
};
return data;
}
function _getModulesListForTargetVersion() {
const data = _interopRequireDefault(require("core-js-compat/get-modules-list-for-target-version"));
_getModulesListForTargetVersion = function () {
return data;
};
return data;
}
var _filterItems = _interopRequireDefault(require("../../filter-items"));
var _utils = require("../../utils");
var _debug = require("../../debug");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function isBabelPolyfillSource(source) {
return source === "@babel/polyfill" || source === "babel-polyfill";
}
function isCoreJSSource(source) {
if (typeof source === "string") {
source = source.replace(/\\/g, "/").replace(/(\/(index)?)?(\.js)?$/i, "").toLowerCase();
}
return (0, _utils.has)(_entries().default, source) && _entries().default[source];
}
const BABEL_POLYFILL_DEPRECATION = `
\`@babel/polyfill\` is deprecated. Please, use required parts of \`core-js\`
and \`regenerator-runtime/runtime\` separately`;
function _default(_, {
corejs,
include,
exclude,
polyfillTargets,
debug
}) {
const polyfills = (0, _filterItems.default)(_data().default, include, exclude, polyfillTargets, null);
const available = new Set((0, _getModulesListForTargetVersion().default)(corejs.version));
const isPolyfillImport = {
ImportDeclaration(path) {
const source = (0, _utils.getImportSource)(path);
if (!source) return;
if (isBabelPolyfillSource(source)) {
console.warn(BABEL_POLYFILL_DEPRECATION);
} else {
const modules = isCoreJSSource(source);
if (modules) {
this.replaceBySeparateModulesImport(path, modules);
}
}
},
Program(path) {
path.get("body").forEach(bodyPath => {
const source = (0, _utils.getRequireSource)(bodyPath);
if (!source) return;
if (isBabelPolyfillSource(source)) {
console.warn(BABEL_POLYFILL_DEPRECATION);
} else {
const modules = isCoreJSSource(source);
if (modules) {
this.replaceBySeparateModulesImport(bodyPath, modules);
}
}
});
}
};
return {
name: "corejs3-entry",
visitor: isPolyfillImport,
pre() {
this.polyfillsSet = new Set();
this.replaceBySeparateModulesImport = function (path, modules) {
for (const module of modules) {
this.polyfillsSet.add(module);
}
path.remove();
};
},
post({
path
}) {
const filtered = (0, _utils.intersection)(polyfills, this.polyfillsSet, available);
const reversed = Array.from(filtered).reverse();
for (const module of reversed) {
(0, _utils.createImport)(path, module);
}
if (debug) {
(0, _debug.logEntryPolyfills)("core-js", this.polyfillsSet.size > 0, filtered, this.file.opts.filename, polyfillTargets, _data().default);
}
}
};
}

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _default = ["esnext.global-this", "esnext.string.match-all"];
exports.default = _default;

View File

@@ -0,0 +1,285 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _data() {
const data = _interopRequireDefault(require("core-js-compat/data"));
_data = function () {
return data;
};
return data;
}
var _shippedProposals = _interopRequireDefault(require("./shipped-proposals"));
function _getModulesListForTargetVersion() {
const data = _interopRequireDefault(require("core-js-compat/get-modules-list-for-target-version"));
_getModulesListForTargetVersion = function () {
return data;
};
return data;
}
var _filterItems = _interopRequireDefault(require("../../filter-items"));
var _builtInDefinitions = require("./built-in-definitions");
var _utils = require("../../utils");
var _debug = require("../../debug");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const NO_DIRECT_POLYFILL_IMPORT = `
When setting \`useBuiltIns: 'usage'\`, polyfills are automatically imported when needed.
Please remove the direct import of \`core-js\` or use \`useBuiltIns: 'entry'\` instead.`;
const corejs3PolyfillsWithoutProposals = Object.keys(_data().default).filter(name => !name.startsWith("esnext.")).reduce((memo, key) => {
memo[key] = _data().default[key];
return memo;
}, {});
const corejs3PolyfillsWithShippedProposals = _shippedProposals.default.reduce((memo, key) => {
memo[key] = _data().default[key];
return memo;
}, Object.assign({}, corejs3PolyfillsWithoutProposals));
function _default(_, {
corejs,
include,
exclude,
polyfillTargets,
proposals,
shippedProposals,
debug
}) {
const polyfills = (0, _filterItems.default)(proposals ? _data().default : shippedProposals ? corejs3PolyfillsWithShippedProposals : corejs3PolyfillsWithoutProposals, include, exclude, polyfillTargets, null);
const available = new Set((0, _getModulesListForTargetVersion().default)(corejs.version));
function resolveKey(path, computed) {
const {
node,
parent,
scope
} = path;
if (path.isStringLiteral()) return node.value;
const {
name
} = node;
const isIdentifier = path.isIdentifier();
if (isIdentifier && !(computed || parent.computed)) return name;
if (!isIdentifier || scope.getBindingIdentifier(name)) {
const {
value
} = path.evaluate();
if (typeof value === "string") return value;
}
}
function resolveSource(path) {
const {
node,
scope
} = path;
let builtIn, instanceType;
if (node) {
builtIn = node.name;
if (!path.isIdentifier() || scope.getBindingIdentifier(builtIn)) {
const {
deopt,
value
} = path.evaluate();
if (value !== undefined) {
instanceType = (0, _utils.getType)(value);
} else if (deopt && deopt.isIdentifier()) {
builtIn = deopt.node.name;
}
}
}
return {
builtIn,
instanceType
};
}
const addAndRemovePolyfillImports = {
ImportDeclaration(path) {
if ((0, _utils.isPolyfillSource)((0, _utils.getImportSource)(path))) {
console.warn(NO_DIRECT_POLYFILL_IMPORT);
path.remove();
}
},
Program(path) {
path.get("body").forEach(bodyPath => {
if ((0, _utils.isPolyfillSource)((0, _utils.getRequireSource)(bodyPath))) {
console.warn(NO_DIRECT_POLYFILL_IMPORT);
bodyPath.remove();
}
});
},
Import() {
this.addUnsupported(_builtInDefinitions.PromiseDependencies);
},
Function({
node
}) {
if (node.async) {
this.addUnsupported(_builtInDefinitions.PromiseDependencies);
}
},
"ForOfStatement|ArrayPattern"() {
this.addUnsupported(_builtInDefinitions.CommonIterators);
},
SpreadElement({
parentPath
}) {
if (!parentPath.isObjectExpression()) {
this.addUnsupported(_builtInDefinitions.CommonIterators);
}
},
YieldExpression({
node
}) {
if (node.delegate) {
this.addUnsupported(_builtInDefinitions.CommonIterators);
}
},
ReferencedIdentifier({
node: {
name
},
scope
}) {
if (scope.getBindingIdentifier(name)) return;
this.addBuiltInDependencies(name);
},
MemberExpression(path) {
const source = resolveSource(path.get("object"));
const key = resolveKey(path.get("property"));
this.addPropertyDependencies(source, key);
},
ObjectPattern(path) {
const {
parentPath,
parent,
key
} = path;
let source;
if (parentPath.isVariableDeclarator()) {
source = resolveSource(parentPath.get("init"));
} else if (parentPath.isAssignmentExpression()) {
source = resolveSource(parentPath.get("right"));
} else if (parentPath.isFunctionExpression()) {
const grand = parentPath.parentPath;
if (grand.isCallExpression() || grand.isNewExpression()) {
if (grand.node.callee === parent) {
source = resolveSource(grand.get("arguments")[key]);
}
}
}
for (const property of path.get("properties")) {
if (property.isObjectProperty()) {
const key = resolveKey(property.get("key"));
this.addPropertyDependencies(source, key);
}
}
},
BinaryExpression(path) {
if (path.node.operator !== "in") return;
const source = resolveSource(path.get("right"));
const key = resolveKey(path.get("left"), true);
this.addPropertyDependencies(source, key);
}
};
return {
name: "corejs3-usage",
pre() {
this.polyfillsSet = new Set();
this.addUnsupported = function (builtIn) {
const modules = Array.isArray(builtIn) ? builtIn : [builtIn];
for (const module of modules) {
this.polyfillsSet.add(module);
}
};
this.addBuiltInDependencies = function (builtIn) {
if ((0, _utils.has)(_builtInDefinitions.BuiltIns, builtIn)) {
const BuiltInDependencies = _builtInDefinitions.BuiltIns[builtIn];
this.addUnsupported(BuiltInDependencies);
}
};
this.addPropertyDependencies = function (source = {}, key) {
const {
builtIn,
instanceType
} = source;
if (_builtInDefinitions.PossibleGlobalObjects.has(builtIn)) {
this.addBuiltInDependencies(key);
} else if ((0, _utils.has)(_builtInDefinitions.StaticProperties, builtIn)) {
const BuiltInProperties = _builtInDefinitions.StaticProperties[builtIn];
if ((0, _utils.has)(BuiltInProperties, key)) {
const StaticPropertyDependencies = BuiltInProperties[key];
return this.addUnsupported(StaticPropertyDependencies);
}
}
if (!(0, _utils.has)(_builtInDefinitions.InstanceProperties, key)) return;
let InstancePropertyDependencies = _builtInDefinitions.InstanceProperties[key];
if (instanceType) {
InstancePropertyDependencies = InstancePropertyDependencies.filter(m => m.includes(instanceType) || _builtInDefinitions.CommonInstanceDependencies.has(m));
}
this.addUnsupported(InstancePropertyDependencies);
};
},
post({
path
}) {
const filtered = (0, _utils.intersection)(polyfills, this.polyfillsSet, available);
const reversed = Array.from(filtered).reverse();
for (const module of reversed) {
(0, _utils.createImport)(path, module);
}
if (debug) {
(0, _debug.logUsagePolyfills)(filtered, this.file.opts.filename, polyfillTargets, _data().default);
}
},
visitor: addAndRemovePolyfillImports
};
}

View File

@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _utils = require("../../utils");
function isRegeneratorSource(source) {
return source === "regenerator-runtime/runtime";
}
function _default() {
const visitor = {
ImportDeclaration(path) {
if (isRegeneratorSource((0, _utils.getImportSource)(path))) {
this.regeneratorImportExcluded = true;
path.remove();
}
},
Program(path) {
path.get("body").forEach(bodyPath => {
if (isRegeneratorSource((0, _utils.getRequireSource)(bodyPath))) {
this.regeneratorImportExcluded = true;
bodyPath.remove();
}
});
}
};
return {
name: "regenerator-entry",
visitor,
pre() {
this.regeneratorImportExcluded = false;
},
post() {
if (this.opts.debug && this.regeneratorImportExcluded) {
console.log(`\n[${this.file.opts.filename}] Based on your targets, regenerator-runtime import excluded.`);
}
}
};
}

View File

@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var _utils = require("../../utils");
function _default() {
return {
name: "regenerator-usage",
pre() {
this.usesRegenerator = false;
},
visitor: {
Function(path) {
const {
node
} = path;
if (!this.usesRegenerator && (node.generator || node.async)) {
this.usesRegenerator = true;
(0, _utils.createImport)(path, "regenerator-runtime");
}
}
},
post() {
if (this.opts.debug && this.usesRegenerator) {
console.log(`\n[${this.file.opts.filename}] Based on your code and targets, added regenerator-runtime.`);
}
}
};
}

238
node_modules/@babel/preset-env/lib/targets-parser.js generated vendored Normal file
View File

@@ -0,0 +1,238 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.semverMin = exports.isBrowsersQueryValid = void 0;
function _browserslist() {
const data = _interopRequireDefault(require("browserslist"));
_browserslist = function () {
return data;
};
return data;
}
function _invariant() {
const data = _interopRequireDefault(require("invariant"));
_invariant = function () {
return data;
};
return data;
}
function _semver() {
const data = _interopRequireDefault(require("semver"));
_semver = function () {
return data;
};
return data;
}
var _utils = require("./utils");
var _builtInModules = _interopRequireDefault(require("../data/built-in-modules.json"));
var _options = require("./options");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const browserslistDefaults = _browserslist().default.defaults;
const validBrowserslistTargets = [...Object.keys(_browserslist().default.data), ...Object.keys(_browserslist().default.aliases)];
const objectToBrowserslist = object => {
return Object.keys(object).reduce((list, targetName) => {
if (validBrowserslistTargets.indexOf(targetName) >= 0) {
const targetVersion = object[targetName];
return list.concat(`${targetName} ${targetVersion}`);
}
return list;
}, []);
};
const validateTargetNames = targets => {
const validTargets = Object.keys(_options.TargetNames);
for (const target in targets) {
if (!_options.TargetNames[target]) {
throw new Error(`Invalid Option: '${target}' is not a valid target
Maybe you meant to use '${(0, _utils.findSuggestion)(validTargets, target)}'?`);
}
}
};
const browserNameMap = {
and_chr: "chrome",
and_ff: "firefox",
android: "android",
chrome: "chrome",
edge: "edge",
firefox: "firefox",
ie: "ie",
ie_mob: "ie",
ios_saf: "ios",
node: "node",
op_mob: "opera",
opera: "opera",
safari: "safari",
samsung: "samsung"
};
const isBrowsersQueryValid = browsers => typeof browsers === "string" || Array.isArray(browsers);
exports.isBrowsersQueryValid = isBrowsersQueryValid;
const validateBrowsers = browsers => {
(0, _invariant().default)(typeof browsers === "undefined" || isBrowsersQueryValid(browsers), `Invalid Option: '${browsers}' is not a valid browserslist query`);
return browsers;
};
const semverMin = (first, second) => {
return first && _semver().default.lt(first, second) ? first : second;
};
exports.semverMin = semverMin;
const mergeBrowsers = (fromQuery, fromTarget) => {
return Object.keys(fromTarget).reduce((queryObj, targKey) => {
if (targKey !== _options.TargetNames.browsers) {
queryObj[targKey] = fromTarget[targKey];
}
return queryObj;
}, fromQuery);
};
const getLowestVersions = browsers => {
return browsers.reduce((all, browser) => {
const [browserName, browserVersion] = browser.split(" ");
const normalizedBrowserName = browserNameMap[browserName];
if (!normalizedBrowserName) {
return all;
}
try {
const splitVersion = browserVersion.split("-")[0].toLowerCase();
const isSplitUnreleased = (0, _utils.isUnreleasedVersion)(splitVersion, browserName);
if (!all[normalizedBrowserName]) {
all[normalizedBrowserName] = isSplitUnreleased ? splitVersion : (0, _utils.semverify)(splitVersion);
return all;
}
const version = all[normalizedBrowserName];
const isUnreleased = (0, _utils.isUnreleasedVersion)(version, browserName);
if (isUnreleased && isSplitUnreleased) {
all[normalizedBrowserName] = (0, _utils.getLowestUnreleased)(version, splitVersion, browserName);
} else if (isUnreleased) {
all[normalizedBrowserName] = (0, _utils.semverify)(splitVersion);
} else if (!isUnreleased && !isSplitUnreleased) {
const parsedBrowserVersion = (0, _utils.semverify)(splitVersion);
all[normalizedBrowserName] = semverMin(version, parsedBrowserVersion);
}
} catch (e) {}
return all;
}, {});
};
const outputDecimalWarning = decimalTargets => {
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 semverifyTarget = (target, value) => {
try {
return (0, _utils.semverify)(value);
} catch (error) {
throw new Error(`Invalid Option: '${value}' is not a valid value for 'targets.${target}'.`);
}
};
const targetParserMap = {
__default: (target, value) => {
const version = (0, _utils.isUnreleasedVersion)(value, target) ? value.toLowerCase() : semverifyTarget(target, value);
return [target, version];
},
node: (target, value) => {
const parsed = value === true || value === "current" ? process.versions.node : semverifyTarget(target, value);
return [target, parsed];
}
};
const getTargets = (targets = {}, options = {}) => {
const targetOpts = {};
validateTargetNames(targets);
if (targets.esmodules) {
const supportsESModules = _builtInModules.default["es6.module"];
targets.browsers = Object.keys(supportsESModules).map(browser => `${browser} ${supportsESModules[browser]}`).join(", ");
}
const browsersquery = validateBrowsers(targets.browsers);
const shouldParseBrowsers = !!targets.browsers;
const shouldSearchForConfig = !options.ignoreBrowserslistConfig && !Object.keys(targets).length;
if (shouldParseBrowsers || shouldSearchForConfig) {
_browserslist().default.defaults = objectToBrowserslist(targets);
const browsers = (0, _browserslist().default)(browsersquery, {
path: options.configPath,
mobileToDesktop: true
});
const queryBrowsers = getLowestVersions(browsers);
targets = mergeBrowsers(queryBrowsers, targets);
_browserslist().default.defaults = browserslistDefaults;
}
const parsed = Object.keys(targets).filter(value => value !== _options.TargetNames.esmodules).sort().reduce((results, target) => {
if (target !== _options.TargetNames.browsers) {
const value = targets[target];
if (typeof value === "number" && value % 1 !== 0) {
results.decimalWarnings.push({
target,
value
});
}
const parser = targetParserMap[target] || targetParserMap.__default;
const [parsedTarget, parsedValue] = parser(target, value);
if (parsedValue) {
results.targets[parsedTarget] = parsedValue;
}
}
return results;
}, {
targets: targetOpts,
decimalWarnings: []
});
outputDecimalWarning(parsed.decimalWarnings);
return parsed.targets;
};
var _default = getTargets;
exports.default = _default;

221
node_modules/@babel/preset-env/lib/utils.js generated vendored Normal file
View File

@@ -0,0 +1,221 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getType = getType;
exports.semverify = semverify;
exports.intersection = intersection;
exports.findSuggestion = findSuggestion;
exports.prettifyVersion = prettifyVersion;
exports.prettifyTargets = prettifyTargets;
exports.isUnreleasedVersion = isUnreleasedVersion;
exports.getLowestUnreleased = getLowestUnreleased;
exports.filterStageFromList = filterStageFromList;
exports.getImportSource = getImportSource;
exports.getRequireSource = getRequireSource;
exports.isPolyfillSource = isPolyfillSource;
exports.getModulePath = getModulePath;
exports.createImport = createImport;
exports.has = void 0;
function t() {
const data = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
function _invariant() {
const data = _interopRequireDefault(require("invariant"));
_invariant = function () {
return data;
};
return data;
}
function _semver() {
const data = _interopRequireDefault(require("semver"));
_semver = function () {
return data;
};
return data;
}
function _jsLevenshtein() {
const data = _interopRequireDefault(require("js-levenshtein"));
_jsLevenshtein = function () {
return data;
};
return data;
}
function _helperModuleImports() {
const data = require("@babel/helper-module-imports");
_helperModuleImports = function () {
return data;
};
return data;
}
var _unreleasedLabels = _interopRequireDefault(require("../data/unreleased-labels"));
var _targetsParser = require("./targets-parser");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
const has = Object.hasOwnProperty.call.bind(Object.hasOwnProperty);
exports.has = has;
function getType(target) {
return Object.prototype.toString.call(target).slice(8, -1).toLowerCase();
}
const versionRegExp = /^(\d+|\d+.\d+)$/;
function semverify(version) {
if (typeof version === "string" && _semver().default.valid(version)) {
return version;
}
(0, _invariant().default)(typeof version === "number" || typeof version === "string" && versionRegExp.test(version), `'${version}' is not a valid version`);
const split = version.toString().split(".");
while (split.length < 3) {
split.push("0");
}
return split.join(".");
}
function intersection(first, second, third) {
const result = new Set();
for (const el of first) {
if (second.has(el) && third.has(el)) result.add(el);
}
return result;
}
function findSuggestion(options, option) {
let levenshteinValue = Infinity;
return options.reduce((suggestion, validOption) => {
const value = (0, _jsLevenshtein().default)(validOption, option);
if (value < levenshteinValue) {
levenshteinValue = value;
return validOption;
}
return suggestion;
}, undefined);
}
function prettifyVersion(version) {
if (typeof version !== "string") {
return version;
}
const parts = [_semver().default.major(version)];
const minor = _semver().default.minor(version);
const patch = _semver().default.patch(version);
if (minor || patch) {
parts.push(minor);
}
if (patch) {
parts.push(patch);
}
return parts.join(".");
}
function prettifyTargets(targets) {
return Object.keys(targets).reduce((results, target) => {
let value = targets[target];
const unreleasedLabel = _unreleasedLabels.default[target];
if (typeof value === "string" && unreleasedLabel !== value) {
value = prettifyVersion(value);
}
results[target] = value;
return results;
}, {});
}
function isUnreleasedVersion(version, env) {
const unreleasedLabel = _unreleasedLabels.default[env];
return !!unreleasedLabel && unreleasedLabel === version.toString().toLowerCase();
}
function getLowestUnreleased(a, b, env) {
const unreleasedLabel = _unreleasedLabels.default[env];
const hasUnreleased = [a, b].some(item => item === unreleasedLabel);
if (hasUnreleased) {
return a === hasUnreleased ? b : a || b;
}
return (0, _targetsParser.semverMin)(a, b);
}
function filterStageFromList(list, stageList) {
return Object.keys(list).reduce((result, item) => {
if (!stageList[item]) {
result[item] = list[item];
}
return result;
}, {});
}
function getImportSource({
node
}) {
if (node.specifiers.length === 0) return node.source.value;
}
function getRequireSource({
node
}) {
if (!t().isExpressionStatement(node)) return;
const {
expression
} = node;
const isRequire = t().isCallExpression(expression) && t().isIdentifier(expression.callee) && expression.callee.name === "require" && expression.arguments.length === 1 && t().isStringLiteral(expression.arguments[0]);
if (isRequire) return expression.arguments[0].value;
}
function isPolyfillSource(source) {
return source === "@babel/polyfill" || source === "core-js";
}
const modulePathMap = {
"regenerator-runtime": "regenerator-runtime/runtime"
};
function getModulePath(mod) {
return modulePathMap[mod] || `core-js/modules/${mod}`;
}
function createImport(path, mod) {
return (0, _helperModuleImports().addSideEffect)(path, getModulePath(mod));
}

View File

@@ -0,0 +1,22 @@
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
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.

View File

@@ -0,0 +1,19 @@
# @babel/plugin-proposal-object-rest-spread
> Compile object rest and spread to ES5
See our website [@babel/plugin-proposal-object-rest-spread](https://babeljs.io/docs/en/babel-plugin-proposal-object-rest-spread) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-proposal-object-rest-spread
```
or using yarn:
```sh
yarn add @babel/plugin-proposal-object-rest-spread --dev
```

View File

@@ -0,0 +1,505 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _pluginSyntaxObjectRestSpread = require("@babel/plugin-syntax-object-rest-spread");
var _core = require("@babel/core");
var _pluginTransformParameters = require("@babel/plugin-transform-parameters");
var _helperCompilationTargets = require("@babel/helper-compilation-targets");
var _corejs2BuiltIns = require("@babel/compat-data/corejs2-built-ins");
const ZERO_REFS = (() => {
const node = _core.types.identifier("a");
const property = _core.types.objectProperty(_core.types.identifier("key"), node);
const pattern = _core.types.objectPattern([property]);
return _core.types.isReferenced(node, property, pattern) ? 1 : 0;
})();
var _default = (0, _helperPluginUtils.declare)((api, opts) => {
var _api$assumption, _api$assumption2, _api$assumption3, _api$assumption4;
api.assertVersion(7);
const targets = api.targets();
const supportsObjectAssign = !(0, _helperCompilationTargets.isRequired)("es6.object.assign", targets, {
compatData: _corejs2BuiltIns
});
const {
useBuiltIns = supportsObjectAssign,
loose = false
} = opts;
if (typeof loose !== "boolean") {
throw new Error(".loose must be a boolean, or undefined");
}
const ignoreFunctionLength = (_api$assumption = api.assumption("ignoreFunctionLength")) != null ? _api$assumption : loose;
const objectRestNoSymbols = (_api$assumption2 = api.assumption("objectRestNoSymbols")) != null ? _api$assumption2 : loose;
const pureGetters = (_api$assumption3 = api.assumption("pureGetters")) != null ? _api$assumption3 : loose;
const setSpreadProperties = (_api$assumption4 = api.assumption("setSpreadProperties")) != null ? _api$assumption4 : loose;
function getExtendsHelper(file) {
return useBuiltIns ? _core.types.memberExpression(_core.types.identifier("Object"), _core.types.identifier("assign")) : file.addHelper("extends");
}
function hasRestElement(path) {
let foundRestElement = false;
visitRestElements(path, restElement => {
foundRestElement = true;
restElement.stop();
});
return foundRestElement;
}
function hasObjectPatternRestElement(path) {
let foundRestElement = false;
visitRestElements(path, restElement => {
if (restElement.parentPath.isObjectPattern()) {
foundRestElement = true;
restElement.stop();
}
});
return foundRestElement;
}
function visitRestElements(path, visitor) {
path.traverse({
Expression(path) {
const parentType = path.parent.type;
if (parentType === "AssignmentPattern" && path.key === "right" || parentType === "ObjectProperty" && path.parent.computed && path.key === "key") {
path.skip();
}
},
RestElement: visitor
});
}
function hasSpread(node) {
for (const prop of node.properties) {
if (_core.types.isSpreadElement(prop)) {
return true;
}
}
return false;
}
function extractNormalizedKeys(path) {
const props = path.node.properties;
const keys = [];
let allLiteral = true;
let hasTemplateLiteral = false;
for (const prop of props) {
if (_core.types.isIdentifier(prop.key) && !prop.computed) {
keys.push(_core.types.stringLiteral(prop.key.name));
} else if (_core.types.isTemplateLiteral(prop.key)) {
keys.push(_core.types.cloneNode(prop.key));
hasTemplateLiteral = true;
} else if (_core.types.isLiteral(prop.key)) {
keys.push(_core.types.stringLiteral(String(prop.key.value)));
} else {
keys.push(_core.types.cloneNode(prop.key));
allLiteral = false;
}
}
return {
keys,
allLiteral,
hasTemplateLiteral
};
}
function replaceImpureComputedKeys(properties, scope) {
const impureComputedPropertyDeclarators = [];
for (const propPath of properties) {
const key = propPath.get("key");
if (propPath.node.computed && !key.isPure()) {
const name = scope.generateUidBasedOnNode(key.node);
const declarator = _core.types.variableDeclarator(_core.types.identifier(name), key.node);
impureComputedPropertyDeclarators.push(declarator);
key.replaceWith(_core.types.identifier(name));
}
}
return impureComputedPropertyDeclarators;
}
function removeUnusedExcludedKeys(path) {
const bindings = path.getOuterBindingIdentifierPaths();
Object.keys(bindings).forEach(bindingName => {
const bindingParentPath = bindings[bindingName].parentPath;
if (path.scope.getBinding(bindingName).references > ZERO_REFS || !bindingParentPath.isObjectProperty()) {
return;
}
bindingParentPath.remove();
});
}
function createObjectRest(path, file, objRef) {
const props = path.get("properties");
const last = props[props.length - 1];
_core.types.assertRestElement(last.node);
const restElement = _core.types.cloneNode(last.node);
last.remove();
const impureComputedPropertyDeclarators = replaceImpureComputedKeys(path.get("properties"), path.scope);
const {
keys,
allLiteral,
hasTemplateLiteral
} = extractNormalizedKeys(path);
if (keys.length === 0) {
return [impureComputedPropertyDeclarators, restElement.argument, _core.types.callExpression(getExtendsHelper(file), [_core.types.objectExpression([]), _core.types.cloneNode(objRef)])];
}
let keyExpression;
if (!allLiteral) {
keyExpression = _core.types.callExpression(_core.types.memberExpression(_core.types.arrayExpression(keys), _core.types.identifier("map")), [file.addHelper("toPropertyKey")]);
} else {
keyExpression = _core.types.arrayExpression(keys);
if (!hasTemplateLiteral && !_core.types.isProgram(path.scope.block)) {
const program = path.findParent(path => path.isProgram());
const id = path.scope.generateUidIdentifier("excluded");
program.scope.push({
id,
init: keyExpression,
kind: "const"
});
keyExpression = _core.types.cloneNode(id);
}
}
return [impureComputedPropertyDeclarators, restElement.argument, _core.types.callExpression(file.addHelper(`objectWithoutProperties${objectRestNoSymbols ? "Loose" : ""}`), [_core.types.cloneNode(objRef), keyExpression])];
}
function replaceRestElement(parentPath, paramPath, container) {
if (paramPath.isAssignmentPattern()) {
replaceRestElement(parentPath, paramPath.get("left"), container);
return;
}
if (paramPath.isArrayPattern() && hasRestElement(paramPath)) {
const elements = paramPath.get("elements");
for (let i = 0; i < elements.length; i++) {
replaceRestElement(parentPath, elements[i], container);
}
}
if (paramPath.isObjectPattern() && hasRestElement(paramPath)) {
const uid = parentPath.scope.generateUidIdentifier("ref");
const declar = _core.types.variableDeclaration("let", [_core.types.variableDeclarator(paramPath.node, uid)]);
if (container) {
container.push(declar);
} else {
parentPath.ensureBlock();
parentPath.get("body").unshiftContainer("body", declar);
}
paramPath.replaceWith(_core.types.cloneNode(uid));
}
}
return {
name: "proposal-object-rest-spread",
inherits: _pluginSyntaxObjectRestSpread.default,
visitor: {
Function(path) {
const params = path.get("params");
const paramsWithRestElement = new Set();
const idsInRestParams = new Set();
for (let i = 0; i < params.length; ++i) {
const param = params[i];
if (hasRestElement(param)) {
paramsWithRestElement.add(i);
for (const name of Object.keys(param.getBindingIdentifiers())) {
idsInRestParams.add(name);
}
}
}
let idInRest = false;
const IdentifierHandler = function (path, functionScope) {
const name = path.node.name;
if (path.scope.getBinding(name) === functionScope.getBinding(name) && idsInRestParams.has(name)) {
idInRest = true;
path.stop();
}
};
let i;
for (i = 0; i < params.length && !idInRest; ++i) {
const param = params[i];
if (!paramsWithRestElement.has(i)) {
if (param.isReferencedIdentifier() || param.isBindingIdentifier()) {
IdentifierHandler(path, path.scope);
} else {
param.traverse({
"Scope|TypeAnnotation|TSTypeAnnotation": path => path.skip(),
"ReferencedIdentifier|BindingIdentifier": IdentifierHandler
}, path.scope);
}
}
}
if (!idInRest) {
for (let i = 0; i < params.length; ++i) {
const param = params[i];
if (paramsWithRestElement.has(i)) {
replaceRestElement(param.parentPath, param);
}
}
} else {
const shouldTransformParam = idx => idx >= i - 1 || paramsWithRestElement.has(idx);
(0, _pluginTransformParameters.convertFunctionParams)(path, ignoreFunctionLength, shouldTransformParam, replaceRestElement);
}
},
VariableDeclarator(path, file) {
if (!path.get("id").isObjectPattern()) {
return;
}
let insertionPath = path;
const originalPath = path;
visitRestElements(path.get("id"), path => {
if (!path.parentPath.isObjectPattern()) {
return;
}
if (originalPath.node.id.properties.length > 1 && !_core.types.isIdentifier(originalPath.node.init)) {
const initRef = path.scope.generateUidIdentifierBasedOnNode(originalPath.node.init, "ref");
originalPath.insertBefore(_core.types.variableDeclarator(initRef, originalPath.node.init));
originalPath.replaceWith(_core.types.variableDeclarator(originalPath.node.id, _core.types.cloneNode(initRef)));
return;
}
let ref = originalPath.node.init;
const refPropertyPath = [];
let kind;
path.findParent(path => {
if (path.isObjectProperty()) {
refPropertyPath.unshift(path);
} else if (path.isVariableDeclarator()) {
kind = path.parentPath.node.kind;
return true;
}
});
const impureObjRefComputedDeclarators = replaceImpureComputedKeys(refPropertyPath, path.scope);
refPropertyPath.forEach(prop => {
const {
node
} = prop;
ref = _core.types.memberExpression(ref, _core.types.cloneNode(node.key), node.computed || _core.types.isLiteral(node.key));
});
const objectPatternPath = path.findParent(path => path.isObjectPattern());
const [impureComputedPropertyDeclarators, argument, callExpression] = createObjectRest(objectPatternPath, file, ref);
if (pureGetters) {
removeUnusedExcludedKeys(objectPatternPath);
}
_core.types.assertIdentifier(argument);
insertionPath.insertBefore(impureComputedPropertyDeclarators);
insertionPath.insertBefore(impureObjRefComputedDeclarators);
insertionPath.insertAfter(_core.types.variableDeclarator(argument, callExpression));
insertionPath = insertionPath.getSibling(insertionPath.key + 1);
path.scope.registerBinding(kind, insertionPath);
if (objectPatternPath.node.properties.length === 0) {
objectPatternPath.findParent(path => path.isObjectProperty() || path.isVariableDeclarator()).remove();
}
});
},
ExportNamedDeclaration(path) {
const declaration = path.get("declaration");
if (!declaration.isVariableDeclaration()) return;
const hasRest = declaration.get("declarations").some(path => hasObjectPatternRestElement(path.get("id")));
if (!hasRest) return;
const specifiers = [];
for (const name of Object.keys(path.getOuterBindingIdentifiers(path))) {
specifiers.push(_core.types.exportSpecifier(_core.types.identifier(name), _core.types.identifier(name)));
}
path.replaceWith(declaration.node);
path.insertAfter(_core.types.exportNamedDeclaration(null, specifiers));
},
CatchClause(path) {
const paramPath = path.get("param");
replaceRestElement(paramPath.parentPath, paramPath);
},
AssignmentExpression(path, file) {
const leftPath = path.get("left");
if (leftPath.isObjectPattern() && hasRestElement(leftPath)) {
const nodes = [];
const refName = path.scope.generateUidBasedOnNode(path.node.right, "ref");
nodes.push(_core.types.variableDeclaration("var", [_core.types.variableDeclarator(_core.types.identifier(refName), path.node.right)]));
const [impureComputedPropertyDeclarators, argument, callExpression] = createObjectRest(leftPath, file, _core.types.identifier(refName));
if (impureComputedPropertyDeclarators.length > 0) {
nodes.push(_core.types.variableDeclaration("var", impureComputedPropertyDeclarators));
}
const nodeWithoutSpread = _core.types.cloneNode(path.node);
nodeWithoutSpread.right = _core.types.identifier(refName);
nodes.push(_core.types.expressionStatement(nodeWithoutSpread));
nodes.push(_core.types.toStatement(_core.types.assignmentExpression("=", argument, callExpression)));
nodes.push(_core.types.expressionStatement(_core.types.identifier(refName)));
path.replaceWithMultiple(nodes);
}
},
ForXStatement(path) {
const {
node,
scope
} = path;
const leftPath = path.get("left");
const left = node.left;
if (!hasObjectPatternRestElement(leftPath)) {
return;
}
if (!_core.types.isVariableDeclaration(left)) {
const temp = scope.generateUidIdentifier("ref");
node.left = _core.types.variableDeclaration("var", [_core.types.variableDeclarator(temp)]);
path.ensureBlock();
if (node.body.body.length === 0 && path.isCompletionRecord()) {
node.body.body.unshift(_core.types.expressionStatement(scope.buildUndefinedNode()));
}
node.body.body.unshift(_core.types.expressionStatement(_core.types.assignmentExpression("=", left, _core.types.cloneNode(temp))));
} else {
const pattern = left.declarations[0].id;
const key = scope.generateUidIdentifier("ref");
node.left = _core.types.variableDeclaration(left.kind, [_core.types.variableDeclarator(key, null)]);
path.ensureBlock();
node.body.body.unshift(_core.types.variableDeclaration(node.left.kind, [_core.types.variableDeclarator(pattern, _core.types.cloneNode(key))]));
}
},
ArrayPattern(path) {
const objectPatterns = [];
visitRestElements(path, path => {
if (!path.parentPath.isObjectPattern()) {
return;
}
const objectPattern = path.parentPath;
const uid = path.scope.generateUidIdentifier("ref");
objectPatterns.push(_core.types.variableDeclarator(objectPattern.node, uid));
objectPattern.replaceWith(_core.types.cloneNode(uid));
path.skip();
});
if (objectPatterns.length > 0) {
const statementPath = path.getStatementParent();
statementPath.insertAfter(_core.types.variableDeclaration(statementPath.node.kind || "var", objectPatterns));
}
},
ObjectExpression(path, file) {
if (!hasSpread(path.node)) return;
let helper;
if (setSpreadProperties) {
helper = getExtendsHelper(file);
} else {
try {
helper = file.addHelper("objectSpread2");
} catch (_unused) {
this.file.declarations["objectSpread2"] = null;
helper = file.addHelper("objectSpread");
}
}
let exp = null;
let props = [];
function make() {
const hadProps = props.length > 0;
const obj = _core.types.objectExpression(props);
props = [];
if (!exp) {
exp = _core.types.callExpression(helper, [obj]);
return;
}
if (pureGetters) {
if (hadProps) {
exp.arguments.push(obj);
}
return;
}
exp = _core.types.callExpression(_core.types.cloneNode(helper), [exp, ...(hadProps ? [_core.types.objectExpression([]), obj] : [])]);
}
for (const prop of path.node.properties) {
if (_core.types.isSpreadElement(prop)) {
make();
exp.arguments.push(prop.argument);
} else {
props.push(prop);
}
}
if (props.length) make();
path.replaceWith(exp);
}
}
};
});
exports.default = _default;

View File

@@ -0,0 +1,69 @@
{
"_from": "@babel/plugin-proposal-object-rest-spread@^7.4.4",
"_id": "@babel/plugin-proposal-object-rest-spread@7.14.7",
"_inBundle": false,
"_integrity": "sha512-082hsZz+sVabfmDWo1Oct1u1AgbKbUAyVgmX4otIc7bdsRgHBXwTwb3DpDmD4Eyyx6DNiuz5UAATT655k+kL5g==",
"_location": "/@babel/preset-env/@babel/plugin-proposal-object-rest-spread",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/plugin-proposal-object-rest-spread@^7.4.4",
"name": "@babel/plugin-proposal-object-rest-spread",
"escapedName": "@babel%2fplugin-proposal-object-rest-spread",
"scope": "@babel",
"rawSpec": "^7.4.4",
"saveSpec": null,
"fetchSpec": "^7.4.4"
},
"_requiredBy": [
"/@babel/preset-env"
],
"_resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.14.7.tgz",
"_shasum": "5920a2b3df7f7901df0205974c0641b13fd9d363",
"_spec": "@babel/plugin-proposal-object-rest-spread@^7.4.4",
"_where": "/home/simon/Documents/lifen-autotest/node_modules/@babel/preset-env",
"author": {
"name": "The Babel Team",
"url": "https://babel.dev/team"
},
"bugs": {
"url": "https://github.com/babel/babel/issues"
},
"bundleDependencies": false,
"dependencies": {
"@babel/compat-data": "^7.14.7",
"@babel/helper-compilation-targets": "^7.14.5",
"@babel/helper-plugin-utils": "^7.14.5",
"@babel/plugin-syntax-object-rest-spread": "^7.8.3",
"@babel/plugin-transform-parameters": "^7.14.5"
},
"deprecated": false,
"description": "Compile object rest and spread to ES5",
"devDependencies": {
"@babel/core": "7.14.6",
"@babel/helper-plugin-test-runner": "7.14.5"
},
"engines": {
"node": ">=6.9.0"
},
"homepage": "https://babel.dev/docs/en/next/babel-plugin-proposal-object-rest-spread",
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "./lib/index.js",
"name": "@babel/plugin-proposal-object-rest-spread",
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/babel/babel.git",
"directory": "packages/babel-plugin-proposal-object-rest-spread"
},
"version": "7.14.7"
}

118
node_modules/@babel/preset-env/package.json generated vendored Normal file
View File

@@ -0,0 +1,118 @@
{
"_from": "@babel/preset-env@7.4.5",
"_id": "@babel/preset-env@7.4.5",
"_inBundle": false,
"_integrity": "sha512-f2yNVXM+FsR5V8UwcFeIHzHWgnhXg3NpRmy0ADvALpnhB0SLbCvrCRr4BLOUYbQNLS+Z0Yer46x9dJXpXewI7w==",
"_location": "/@babel/preset-env",
"_phantomChildren": {
"@babel/compat-data": "7.15.0",
"@babel/helper-compilation-targets": "7.15.0",
"@babel/helper-plugin-utils": "7.14.5",
"@babel/plugin-syntax-object-rest-spread": "7.8.3",
"@babel/plugin-transform-parameters": "7.14.5"
},
"_requested": {
"type": "version",
"registry": true,
"raw": "@babel/preset-env@7.4.5",
"name": "@babel/preset-env",
"escapedName": "@babel%2fpreset-env",
"scope": "@babel",
"rawSpec": "7.4.5",
"saveSpec": null,
"fetchSpec": "7.4.5"
},
"_requiredBy": [
"/@cypress/browserify-preprocessor"
],
"_resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.4.5.tgz",
"_shasum": "2fad7f62983d5af563b5f3139242755884998a58",
"_spec": "@babel/preset-env@7.4.5",
"_where": "/home/simon/Documents/lifen-autotest/node_modules/@cypress/browserify-preprocessor",
"author": {
"name": "Henry Zhu",
"email": "hi@henryzoo.com"
},
"bundleDependencies": false,
"dependencies": {
"@babel/helper-module-imports": "^7.0.0",
"@babel/helper-plugin-utils": "^7.0.0",
"@babel/plugin-proposal-async-generator-functions": "^7.2.0",
"@babel/plugin-proposal-json-strings": "^7.2.0",
"@babel/plugin-proposal-object-rest-spread": "^7.4.4",
"@babel/plugin-proposal-optional-catch-binding": "^7.2.0",
"@babel/plugin-proposal-unicode-property-regex": "^7.4.4",
"@babel/plugin-syntax-async-generators": "^7.2.0",
"@babel/plugin-syntax-json-strings": "^7.2.0",
"@babel/plugin-syntax-object-rest-spread": "^7.2.0",
"@babel/plugin-syntax-optional-catch-binding": "^7.2.0",
"@babel/plugin-transform-arrow-functions": "^7.2.0",
"@babel/plugin-transform-async-to-generator": "^7.4.4",
"@babel/plugin-transform-block-scoped-functions": "^7.2.0",
"@babel/plugin-transform-block-scoping": "^7.4.4",
"@babel/plugin-transform-classes": "^7.4.4",
"@babel/plugin-transform-computed-properties": "^7.2.0",
"@babel/plugin-transform-destructuring": "^7.4.4",
"@babel/plugin-transform-dotall-regex": "^7.4.4",
"@babel/plugin-transform-duplicate-keys": "^7.2.0",
"@babel/plugin-transform-exponentiation-operator": "^7.2.0",
"@babel/plugin-transform-for-of": "^7.4.4",
"@babel/plugin-transform-function-name": "^7.4.4",
"@babel/plugin-transform-literals": "^7.2.0",
"@babel/plugin-transform-member-expression-literals": "^7.2.0",
"@babel/plugin-transform-modules-amd": "^7.2.0",
"@babel/plugin-transform-modules-commonjs": "^7.4.4",
"@babel/plugin-transform-modules-systemjs": "^7.4.4",
"@babel/plugin-transform-modules-umd": "^7.2.0",
"@babel/plugin-transform-named-capturing-groups-regex": "^7.4.5",
"@babel/plugin-transform-new-target": "^7.4.4",
"@babel/plugin-transform-object-super": "^7.2.0",
"@babel/plugin-transform-parameters": "^7.4.4",
"@babel/plugin-transform-property-literals": "^7.2.0",
"@babel/plugin-transform-regenerator": "^7.4.5",
"@babel/plugin-transform-reserved-words": "^7.2.0",
"@babel/plugin-transform-shorthand-properties": "^7.2.0",
"@babel/plugin-transform-spread": "^7.2.0",
"@babel/plugin-transform-sticky-regex": "^7.2.0",
"@babel/plugin-transform-template-literals": "^7.4.4",
"@babel/plugin-transform-typeof-symbol": "^7.2.0",
"@babel/plugin-transform-unicode-regex": "^7.4.4",
"@babel/types": "^7.4.4",
"browserslist": "^4.6.0",
"core-js-compat": "^3.1.1",
"invariant": "^2.2.2",
"js-levenshtein": "^1.1.3",
"semver": "^5.5.0"
},
"deprecated": false,
"description": "A Babel preset for each environment.",
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/helper-fixtures": "^7.4.4",
"@babel/helper-plugin-test-runner": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"caniuse-db": "1.0.30000969",
"compat-table": "github:kangax/compat-table#45cbb3a3778815c973c5b09d69bf7d1f7ed0c316",
"electron-to-chromium": "1.3.113"
},
"gitHead": "33ab4f166117e2380de3955a0842985f578b01b8",
"homepage": "https://babeljs.io/",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/preset-env",
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-preset-env"
},
"scripts": {
"build-data": "node ./scripts/build-data.js; node ./scripts/build-modules-support.js"
},
"version": "7.4.5"
}