1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 | var _helperPluginUtils = require("@babel/helper-plugin-utils");
|
8 | {
|
9 | var removePlugin = function (plugins, name) {
|
10 | const indices = [];
|
11 | plugins.forEach((plugin, i) => {
|
12 | const n = Array.isArray(plugin) ? plugin[0] : plugin;
|
13 | if (n === name) {
|
14 | indices.unshift(i);
|
15 | }
|
16 | });
|
17 | for (const i of indices) {
|
18 | plugins.splice(i, 1);
|
19 | }
|
20 | };
|
21 | }
|
22 | var _default = (0, _helperPluginUtils.declare)((api, opts) => {
|
23 | api.assertVersion(7);
|
24 | const {
|
25 | disallowAmbiguousJSXLike,
|
26 | dts
|
27 | } = opts;
|
28 | {
|
29 | var {
|
30 | isTSX
|
31 | } = opts;
|
32 | }
|
33 | return {
|
34 | name: "syntax-typescript",
|
35 | manipulateOptions(opts, parserOpts) {
|
36 | {
|
37 | const {
|
38 | plugins
|
39 | } = parserOpts;
|
40 | removePlugin(plugins, "flow");
|
41 | removePlugin(plugins, "jsx");
|
42 | plugins.push("objectRestSpread", "classProperties");
|
43 | if (isTSX) {
|
44 | plugins.push("jsx");
|
45 | }
|
46 | }
|
47 | parserOpts.plugins.push(["typescript", {
|
48 | disallowAmbiguousJSXLike,
|
49 | dts
|
50 | }]);
|
51 | }
|
52 | };
|
53 | });
|
54 | exports.default = _default;
|
55 |
|
56 |
|