summaryrefslogtreecommitdiff
path: root/node_modules/@babel/plugin-syntax-import-assertions/lib/index.js
blob: 33fe93cf981e95b501a39358da90667fa170f996 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _default = exports.default = (0, _helperPluginUtils.declare)(api => {
  api.assertVersion(7);
  return {
    name: "syntax-import-assertions",
    manipulateOptions(opts, {
      plugins
    }) {
      for (let i = 0; i < plugins.length; i++) {
        const plugin = plugins[i];
        if (plugin === "importAttributes") {
          plugins[i] = ["importAttributes", {
            deprecatedAssertSyntax: true
          }];
          return;
        }
        if (Array.isArray(plugin) && plugin[0] === "importAttributes") {
          if (plugin.length < 2) plugins[i].push({});
          plugin[1].deprecatedAssertSyntax = true;
          return;
        }
      }
      plugins.push("importAssertions");
    }
  };
});

//# sourceMappingURL=index.js.map