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 | var _pluginSyntaxDecorators = require("@babel/plugin-syntax-decorators");
|
9 | var _helperCreateClassFeaturesPlugin = require("@babel/helper-create-class-features-plugin");
|
10 | var _transformerLegacy = require("./transformer-legacy.js");
|
11 | var _default = exports.default = (0, _helperPluginUtils.declare)((api, options) => {
|
12 | api.assertVersion(7);
|
13 | {
|
14 | var {
|
15 | legacy
|
16 | } = options;
|
17 | }
|
18 | const {
|
19 | version
|
20 | } = options;
|
21 | if (legacy || version === "legacy") {
|
22 | return {
|
23 | name: "proposal-decorators",
|
24 | inherits: _pluginSyntaxDecorators.default,
|
25 | visitor: _transformerLegacy.default
|
26 | };
|
27 | } else if (!version || version === "2018-09" || version === "2021-12" || version === "2022-03" || version === "2023-01" || version === "2023-05" || version === "2023-11") {
|
28 | api.assertVersion("^7.0.2");
|
29 | return (0, _helperCreateClassFeaturesPlugin.createClassFeaturePlugin)({
|
30 | name: "proposal-decorators",
|
31 | api,
|
32 | feature: _helperCreateClassFeaturesPlugin.FEATURES.decorators,
|
33 | inherits: _pluginSyntaxDecorators.default,
|
34 | decoratorVersion: version
|
35 | });
|
36 | } else {
|
37 | throw new Error("The '.version' option must be one of 'legacy', '2023-11', '2023-05', '2023-01', '2022-03', or '2021-12'.");
|
38 | }
|
39 | });
|
40 |
|
41 |
|