is-module.js 381 B

123456789101112131415161718
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = isModule;
  6. function isModule(path) {
  7. const {
  8. sourceType
  9. } = path.node;
  10. if (sourceType !== "module" && sourceType !== "script") {
  11. throw path.buildCodeFrameError(`Unknown sourceType "${sourceType}", cannot transform.`);
  12. }
  13. return path.node.sourceType === "module";
  14. }