babel-plugin-polyfill-regenerator 0.5.4 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.mjs +3 -2
- package/esm/index.mjs.map +1 -1
- package/lib/index.js +3 -2
- package/package.json +3 -3
package/esm/index.mjs
CHANGED
|
@@ -11,6 +11,7 @@ var index = defineProvider(({
|
|
|
11
11
|
}
|
|
12
12
|
const {
|
|
13
13
|
[runtimeCompat]: {
|
|
14
|
+
moduleName = null,
|
|
14
15
|
useBabelRuntime = false
|
|
15
16
|
} = {}
|
|
16
17
|
} = options;
|
|
@@ -27,8 +28,8 @@ var index = defineProvider(({
|
|
|
27
28
|
if (isRegenerator(meta)) {
|
|
28
29
|
let pureName = "regenerator-runtime";
|
|
29
30
|
if (useBabelRuntime) {
|
|
30
|
-
var
|
|
31
|
-
const runtimeName = (
|
|
31
|
+
var _ref;
|
|
32
|
+
const runtimeName = (_ref = moduleName != null ? moduleName : path.hub.file.get("runtimeHelpersModuleName")) != null ? _ref : "@babel/runtime";
|
|
32
33
|
pureName = `${runtimeName}/regenerator`;
|
|
33
34
|
}
|
|
34
35
|
path.replaceWith(utils.injectDefaultImport(pureName, "regenerator-runtime"));
|
package/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import defineProvider from \"@babel/helper-define-polyfill-provider\";\nimport type { PluginPass } from \"@babel/core\";\n\nconst runtimeCompat = \"#__secret_key__@babel/runtime__compatibility\";\n\ntype Options = {\n \"#__secret_key__@babel/runtime__compatibility\": void | {\n useBabelRuntime: string;\n };\n};\n\nexport default defineProvider<Options>(({ debug, targets, babel }, options) => {\n if (!shallowEqual(targets, babel.targets())) {\n throw new Error(\n \"This plugin does not use the targets option. Only preset-env's targets\" +\n \" or top-level targets need to be configured for this plugin to work.\" +\n \" See https://github.com/babel/babel-polyfills/issues/36 for more\" +\n \" details.\",\n );\n }\n\n const {
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import defineProvider from \"@babel/helper-define-polyfill-provider\";\nimport type { PluginPass } from \"@babel/core\";\n\nconst runtimeCompat = \"#__secret_key__@babel/runtime__compatibility\";\n\ntype Options = {\n \"#__secret_key__@babel/runtime__compatibility\": void | {\n useBabelRuntime: boolean;\n moduleName: string;\n };\n};\n\nexport default defineProvider<Options>(({ debug, targets, babel }, options) => {\n if (!shallowEqual(targets, babel.targets())) {\n throw new Error(\n \"This plugin does not use the targets option. Only preset-env's targets\" +\n \" or top-level targets need to be configured for this plugin to work.\" +\n \" See https://github.com/babel/babel-polyfills/issues/36 for more\" +\n \" details.\",\n );\n }\n\n const {\n [runtimeCompat]: { moduleName = null, useBabelRuntime = false } = {},\n } = options;\n\n return {\n name: \"regenerator\",\n\n polyfills: [\"regenerator-runtime\"],\n\n usageGlobal(meta, utils): undefined {\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 let pureName = \"regenerator-runtime\";\n if (useBabelRuntime) {\n const runtimeName =\n moduleName ??\n ((path.hub as any).file as PluginPass).get(\n \"runtimeHelpersModuleName\",\n ) ??\n \"@babel/runtime\";\n pureName = `${runtimeName}/regenerator`;\n }\n\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\nfunction shallowEqual(obj1: any, obj2: any) {\n return JSON.stringify(obj1) === JSON.stringify(obj2);\n}\n"],"names":["runtimeCompat","defineProvider","debug","targets","babel","options","shallowEqual","Error","moduleName","useBabelRuntime","name","polyfills","usageGlobal","meta","utils","isRegenerator","injectGlobalImport","usagePure","path","pureName","_ref","runtimeName","hub","file","get","replaceWith","injectD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,IAAI,IACxBA,IAAI,CAACc,IAAI,KAAK,QAAQ,IAAId,IAAI,CAACH,IAAI,KAAK,oBAAoB;AAE9D,SAASJ,YAAYA,CAACsB,IAAS,EAAEC,IAAS,EAAE;EAC1C,OAAOC,IAAI,CAACC,SAAS,CAACH,IAAI,CAAC,KAAKE,IAAI,CAACC,SAAS,CAACF,IAAI,CAAC;AACtD;;;;"}
|
package/lib/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var _default = (0, _helperDefinePolyfillProvider.default)(({
|
|
|
15
15
|
}
|
|
16
16
|
const {
|
|
17
17
|
[runtimeCompat]: {
|
|
18
|
+
moduleName = null,
|
|
18
19
|
useBabelRuntime = false
|
|
19
20
|
} = {}
|
|
20
21
|
} = options;
|
|
@@ -31,8 +32,8 @@ var _default = (0, _helperDefinePolyfillProvider.default)(({
|
|
|
31
32
|
if (isRegenerator(meta)) {
|
|
32
33
|
let pureName = "regenerator-runtime";
|
|
33
34
|
if (useBabelRuntime) {
|
|
34
|
-
var
|
|
35
|
-
const runtimeName = (
|
|
35
|
+
var _ref;
|
|
36
|
+
const runtimeName = (_ref = moduleName != null ? moduleName : path.hub.file.get("runtimeHelpersModuleName")) != null ? _ref : "@babel/runtime";
|
|
36
37
|
pureName = `${runtimeName}/regenerator`;
|
|
37
38
|
}
|
|
38
39
|
path.replaceWith(utils.injectDefaultImport(pureName, "regenerator-runtime"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-plugin-polyfill-regenerator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "A Babel plugin to inject imports to regenerator-runtime",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"babel-plugin"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@babel/helper-define-polyfill-provider": "^0.
|
|
29
|
+
"@babel/helper-define-polyfill-provider": "^0.6.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@babel/core": "^7.17.8",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "58703f07c9cff9f27d145215265042094739a175"
|
|
40
40
|
}
|