source: imaps-frontend/node_modules/babel-plugin-polyfill-regenerator/esm/index.mjs@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.6 KB
Line 
1import defineProvider from '@babel/helper-define-polyfill-provider';
2
3const runtimeCompat = "#__secret_key__@babel/runtime__compatibility";
4var index = defineProvider(({
5 debug,
6 targets,
7 babel
8}, options) => {
9 if (!shallowEqual(targets, babel.targets())) {
10 throw new Error("This plugin does not use the targets option. Only preset-env's targets" + " or top-level targets need to be configured for this plugin to work." + " See https://github.com/babel/babel-polyfills/issues/36 for more" + " details.");
11 }
12 const {
13 [runtimeCompat]: {
14 moduleName = null,
15 useBabelRuntime = false
16 } = {}
17 } = options;
18 return {
19 name: "regenerator",
20 polyfills: ["regenerator-runtime"],
21 usageGlobal(meta, utils) {
22 if (isRegenerator(meta)) {
23 debug("regenerator-runtime");
24 utils.injectGlobalImport("regenerator-runtime/runtime.js");
25 }
26 },
27 usagePure(meta, utils, path) {
28 if (isRegenerator(meta)) {
29 let pureName = "regenerator-runtime";
30 if (useBabelRuntime) {
31 var _ref;
32 const runtimeName = (_ref = moduleName != null ? moduleName : path.hub.file.get("runtimeHelpersModuleName")) != null ? _ref : "@babel/runtime";
33 pureName = `${runtimeName}/regenerator`;
34 }
35 path.replaceWith(utils.injectDefaultImport(pureName, "regenerator-runtime"));
36 }
37 }
38 };
39});
40const isRegenerator = meta => meta.kind === "global" && meta.name === "regeneratorRuntime";
41function shallowEqual(obj1, obj2) {
42 return JSON.stringify(obj1) === JSON.stringify(obj2);
43}
44
45export default index;
46//# sourceMappingURL=index.mjs.map
Note: See TracBrowser for help on using the repository browser.