0.2.0 - Mid migration

This commit is contained in:
Daniel Mason 2022-04-25 14:47:15 +12:00
parent 139e6a915e
commit 7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions

View file

@ -0,0 +1,22 @@
MIT License
Copyright (c) 2014-present Nicolò Ribaudo 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,28 @@
# babel-plugin-polyfill-regenerator
## Install
Using npm:
```sh
npm install --save-dev babel-plugin-polyfill-regenerator
```
or using yarn:
```sh
yarn add babel-plugin-polyfill-regenerator --dev
```
## Usage
Add this plugin to your Babel configuration:
```json
{
"plugins": [["polyfill-regenerator", { "method": "usage-global" }]]
}
```
This package supports the `usage-pure`, `usage-global`, and `entry-global` methods.
When `entry-global` is used, it replaces imports to `regenerator-runtime`.

View file

@ -0,0 +1,36 @@
import defineProvider from '@babel/helper-define-polyfill-provider';
const runtimeCompat = "#__secret_key__@babel/runtime__compatibility";
var index = defineProvider(({
debug
}, options) => {
const {
[runtimeCompat]: {
useBabelRuntime
} = {}
} = options;
const pureName = useBabelRuntime ? `${useBabelRuntime}/regenerator` : "regenerator-runtime";
return {
name: "regenerator",
polyfills: ["regenerator-runtime"],
usageGlobal(meta, utils) {
if (isRegenerator(meta)) {
debug("regenerator-runtime");
utils.injectGlobalImport("regenerator-runtime/runtime.js");
}
},
usagePure(meta, utils, path) {
if (isRegenerator(meta)) {
path.replaceWith(utils.injectDefaultImport(pureName, "regenerator-runtime"));
}
}
};
});
const isRegenerator = meta => meta.kind === "global" && meta.name === "regeneratorRuntime";
export default index;
//# sourceMappingURL=index.mjs.map

View file

@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../src/index.js"],"sourcesContent":["// @flow\n\nimport defineProvider from \"@babel/helper-define-polyfill-provider\";\n\nconst runtimeCompat = \"#__secret_key__@babel/runtime__compatibility\";\n\nexport default defineProvider(({ debug }, options) => {\n const { [runtimeCompat]: { useBabelRuntime } = {} } = options;\n\n const pureName = useBabelRuntime\n ? `${useBabelRuntime}/regenerator`\n : \"regenerator-runtime\";\n\n return {\n name: \"regenerator\",\n\n polyfills: [\"regenerator-runtime\"],\n\n usageGlobal(meta, utils) {\n if (isRegenerator(meta)) {\n debug(\"regenerator-runtime\");\n utils.injectGlobalImport(\"regenerator-runtime/runtime.js\");\n }\n },\n usagePure(meta, utils, path) {\n if (isRegenerator(meta)) {\n path.replaceWith(\n utils.injectDefaultImport(pureName, \"regenerator-runtime\"),\n );\n }\n },\n };\n});\n\nconst isRegenerator = meta =>\n meta.kind === \"global\" && meta.name === \"regeneratorRuntime\";\n"],"names":["runtimeCompat","defineProvider","debug","options","useBabelRuntime","pureName","name","polyfills","usageGlobal","meta","utils","isRegenerator","injectGlobalImport","usagePure","path","replaceWith","injectDefaultImport","kind"],"mappings":";;AAIA,MAAMA,aAAa,GAAG,8CAAtB;AAEA,YAAeC,cAAc,CAAC,CAAC;AAAEC,EAAAA;AAAF,CAAD,EAAYC,OAAZ,KAAwB;AACpD,QAAM;AAAE,KAACH,aAAD,GAAiB;AAAEI,MAAAA;AAAF,QAAsB;AAAzC,MAAgDD,OAAtD;AAEA,QAAME,QAAQ,GAAGD,eAAe,GAC3B,GAAEA,eAAgB,cADS,GAE5B,qBAFJ;AAIA,SAAO;AACLE,IAAAA,IAAI,EAAE,aADD;AAGLC,IAAAA,SAAS,EAAE,CAAC,qBAAD,CAHN;;AAKLC,IAAAA,WAAW,CAACC,IAAD,EAAOC,KAAP,EAAc;AACvB,UAAIC,aAAa,CAACF,IAAD,CAAjB,EAAyB;AACvBP,QAAAA,KAAK,CAAC,qBAAD,CAAL;AACAQ,QAAAA,KAAK,CAACE,kBAAN,CAAyB,gCAAzB;AACD;AACF,KAVI;;AAWLC,IAAAA,SAAS,CAACJ,IAAD,EAAOC,KAAP,EAAcI,IAAd,EAAoB;AAC3B,UAAIH,aAAa,CAACF,IAAD,CAAjB,EAAyB;AACvBK,QAAAA,IAAI,CAACC,WAAL,CACEL,KAAK,CAACM,mBAAN,CAA0BX,QAA1B,EAAoC,qBAApC,CADF;AAGD;AACF;;AAjBI,GAAP;AAmBD,CA1B4B,CAA7B;;AA4BA,MAAMM,aAAa,GAAGF,IAAI,IACxBA,IAAI,CAACQ,IAAL,KAAc,QAAd,IAA0BR,IAAI,CAACH,IAAL,KAAc,oBAD1C;;;;"}

View file

@ -0,0 +1,43 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _helperDefinePolyfillProvider = _interopRequireDefault(require("@babel/helper-define-polyfill-provider"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const runtimeCompat = "#__secret_key__@babel/runtime__compatibility";
var _default = (0, _helperDefinePolyfillProvider.default)(({
debug
}, options) => {
const {
[runtimeCompat]: {
useBabelRuntime
} = {}
} = options;
const pureName = useBabelRuntime ? `${useBabelRuntime}/regenerator` : "regenerator-runtime";
return {
name: "regenerator",
polyfills: ["regenerator-runtime"],
usageGlobal(meta, utils) {
if (isRegenerator(meta)) {
debug("regenerator-runtime");
utils.injectGlobalImport("regenerator-runtime/runtime.js");
}
},
usagePure(meta, utils, path) {
if (isRegenerator(meta)) {
path.replaceWith(utils.injectDefaultImport(pureName, "regenerator-runtime"));
}
}
};
});
exports.default = _default;
const isRegenerator = meta => meta.kind === "global" && meta.name === "regeneratorRuntime";

View file

@ -0,0 +1,39 @@
{
"name": "babel-plugin-polyfill-regenerator",
"version": "0.2.2",
"description": "A Babel plugin to inject imports to regenerator-runtime",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel-polyfills.git",
"directory": "packages/babel-plugin-polyfill-regenerator"
},
"license": "MIT",
"publishConfig": {
"access": "public"
},
"main": "lib/index.js",
"exports": {
".": [
{
"import": "./esm/index.mjs",
"default": "./lib/index.js"
},
"./lib/index.js"
],
"./package.json": "./package.json"
},
"keywords": [
"babel-plugin"
],
"dependencies": {
"@babel/helper-define-polyfill-provider": "^0.2.2"
},
"devDependencies": {
"@babel/core": "^7.13.0",
"@babel/helper-plugin-test-runner": "^7.10.4"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"gitHead": "1db1e16a7e6855094c52a6cf9b98410e3f0e80de"
}