Sha256: 6aba1ac5603fc87a4ebc9640c9bba891131431e1d269ab8859d67d254c47e4a6

Contents?: true

Size: 1.17 KB

Versions: 16

Compression:

Stored size: 1.17 KB

Contents

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = _default;

var _utils = require("../../utils");

function isRegeneratorSource(source) {
  return source === "regenerator-runtime/runtime";
}

function _default() {
  const visitor = {
    ImportDeclaration(path) {
      if (isRegeneratorSource((0, _utils.getImportSource)(path))) {
        this.regeneratorImportExcluded = true;
        path.remove();
      }
    },

    Program(path) {
      path.get("body").forEach(bodyPath => {
        if (isRegeneratorSource((0, _utils.getRequireSource)(bodyPath))) {
          this.regeneratorImportExcluded = true;
          bodyPath.remove();
        }
      });
    }

  };
  return {
    name: "regenerator-entry",
    visitor,

    pre() {
      this.regeneratorImportExcluded = false;
    },

    post() {
      if (this.opts.debug && this.regeneratorImportExcluded) {
        let filename = this.file.opts.filename;

        if (process.env.BABEL_ENV === "test") {
          filename = filename.replace(/\\/g, "/");
        }

        console.log(`\n[${filename}] Based on your targets, regenerator-runtime import excluded.`);
      }
    }

  };
}

Version data entries

16 entries across 16 versions & 6 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/@babel/preset-env/lib/polyfills/regenerator/entry-plugin.js
disco_app-0.18.0 test/dummy/node_modules/@babel/preset-env/lib/polyfills/regenerator/entry-plugin.js
disco_app-0.18.2 test/dummy/node_modules/@babel/preset-env/lib/polyfills/regenerator/entry-plugin.js
tang-0.2.1 spec/tang_app/node_modules/@babel/preset-env/lib/polyfills/regenerator/entry-plugin.js
tang-0.2.0 spec/tang_app/node_modules/@babel/preset-env/lib/polyfills/regenerator/entry-plugin.js
tang-0.1.0 spec/tang_app/node_modules/@babel/preset-env/lib/polyfills/regenerator/entry-plugin.js
tang-0.0.9 spec/tang_app/node_modules/@babel/preset-env/lib/polyfills/regenerator/entry-plugin.js
enju_library-0.3.8 spec/dummy/node_modules/@babel/preset-env/lib/polyfills/regenerator/entry-plugin.js
condenser-0.3 lib/condenser/processors/node_modules/@babel/preset-env/lib/polyfills/regenerator/entry-plugin.js
condenser-0.2 lib/condenser/processors/node_modules/@babel/preset-env/lib/polyfills/regenerator/entry-plugin.js
condenser-0.1 lib/condenser/processors/node_modules/@babel/preset-env/lib/polyfills/regenerator/entry-plugin.js
condenser-0.0.12 lib/condenser/processors/node_modules/@babel/preset-env/lib/polyfills/regenerator/entry-plugin.js
condenser-0.0.11 lib/condenser/processors/node_modules/@babel/preset-env/lib/polyfills/regenerator/entry-plugin.js
condenser-0.0.10 lib/condenser/processors/node_modules/@babel/preset-env/lib/polyfills/regenerator/entry-plugin.js
condenser-0.0.9 lib/condenser/processors/node_modules/@babel/preset-env/lib/polyfills/regenerator/entry-plugin.js
learn_create-0.0.22 lib/templates/javascript_lab_template/node_modules/@babel/preset-env/lib/polyfills/regenerator/entry-plugin.js