source: imaps-frontend/node_modules/@babel/preset-env/lib/polyfills/regenerator.cjs@ 79a0317

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

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.2 KB
Line 
1;
2const {
3 getImportSource,
4 getRequireSource
5} = require("./utils.cjs");
6function isRegeneratorSource(source) {
7 return source === "regenerator-runtime/runtime" || source === "regenerator-runtime/runtime.js";
8}
9module.exports = function () {
10 const visitor = {
11 ImportDeclaration(path) {
12 if (isRegeneratorSource(getImportSource(path))) {
13 this.regeneratorImportExcluded = true;
14 path.remove();
15 }
16 },
17 Program(path) {
18 path.get("body").forEach(bodyPath => {
19 if (isRegeneratorSource(getRequireSource(bodyPath))) {
20 this.regeneratorImportExcluded = true;
21 bodyPath.remove();
22 }
23 });
24 }
25 };
26 return {
27 name: "preset-env/remove-regenerator",
28 visitor,
29 pre() {
30 this.regeneratorImportExcluded = false;
31 },
32 post() {
33 if (this.opts.debug && this.regeneratorImportExcluded) {
34 let filename = this.file.opts.filename;
35 if (process.env.BABEL_ENV === "test") {
36 filename = filename.replace(/\\/g, "/");
37 }
38 console.log(`\n[${filename}] Based on your targets, regenerator-runtime import excluded.`);
39 }
40 }
41 };
42};
43
44//# sourceMappingURL=regenerator.cjs.map
Note: See TracBrowser for help on using the repository browser.