source: imaps-frontend/node_modules/babel-plugin-polyfill-regenerator/lib/index.js

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

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[79a0317]1"use strict";
2
3exports.__esModule = true;
4exports.default = void 0;
5var _helperDefinePolyfillProvider = _interopRequireDefault(require("@babel/helper-define-polyfill-provider"));
6function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7const runtimeCompat = "#__secret_key__@babel/runtime__compatibility";
8var _default = (0, _helperDefinePolyfillProvider.default)(({
9 debug,
10 targets,
11 babel
12}, options) => {
13 if (!shallowEqual(targets, babel.targets())) {
14 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.");
15 }
16 const {
17 [runtimeCompat]: {
18 moduleName = null,
19 useBabelRuntime = false
20 } = {}
21 } = options;
22 return {
23 name: "regenerator",
24 polyfills: ["regenerator-runtime"],
25 usageGlobal(meta, utils) {
26 if (isRegenerator(meta)) {
27 debug("regenerator-runtime");
28 utils.injectGlobalImport("regenerator-runtime/runtime.js");
29 }
30 },
31 usagePure(meta, utils, path) {
32 if (isRegenerator(meta)) {
33 let pureName = "regenerator-runtime";
34 if (useBabelRuntime) {
35 var _ref;
36 const runtimeName = (_ref = moduleName != null ? moduleName : path.hub.file.get("runtimeHelpersModuleName")) != null ? _ref : "@babel/runtime";
37 pureName = `${runtimeName}/regenerator`;
38 }
39 path.replaceWith(utils.injectDefaultImport(pureName, "regenerator-runtime"));
40 }
41 }
42 };
43});
44exports.default = _default;
45const isRegenerator = meta => meta.kind === "global" && meta.name === "regeneratorRuntime";
46function shallowEqual(obj1, obj2) {
47 return JSON.stringify(obj1) === JSON.stringify(obj2);
48}
Note: See TracBrowser for help on using the repository browser.