Last change
on this file since 84d0fbb was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
963 bytes
|
Line | |
---|
1 | import defineProvider from '@babel/helper-define-polyfill-provider';
|
---|
2 |
|
---|
3 | const runtimeCompat = "#__secret_key__@babel/runtime__compatibility";
|
---|
4 | var index = defineProvider(({
|
---|
5 | debug
|
---|
6 | }, options) => {
|
---|
7 | const {
|
---|
8 | [runtimeCompat]: {
|
---|
9 | useBabelRuntime
|
---|
10 | } = {}
|
---|
11 | } = options;
|
---|
12 | const pureName = useBabelRuntime ? `${useBabelRuntime}/regenerator` : "regenerator-runtime";
|
---|
13 | return {
|
---|
14 | name: "regenerator",
|
---|
15 | polyfills: ["regenerator-runtime"],
|
---|
16 |
|
---|
17 | usageGlobal(meta, utils) {
|
---|
18 | if (isRegenerator(meta)) {
|
---|
19 | debug("regenerator-runtime");
|
---|
20 | utils.injectGlobalImport("regenerator-runtime/runtime.js");
|
---|
21 | }
|
---|
22 | },
|
---|
23 |
|
---|
24 | usagePure(meta, utils, path) {
|
---|
25 | if (isRegenerator(meta)) {
|
---|
26 | path.replaceWith(utils.injectDefaultImport(pureName, "regenerator-runtime"));
|
---|
27 | }
|
---|
28 | }
|
---|
29 |
|
---|
30 | };
|
---|
31 | });
|
---|
32 |
|
---|
33 | const isRegenerator = meta => meta.kind === "global" && meta.name === "regeneratorRuntime";
|
---|
34 |
|
---|
35 | export default index;
|
---|
36 | //# sourceMappingURL=index.mjs.map
|
---|
Note:
See
TracBrowser
for help on using the repository browser.