@babel/plugin-proposal-decorators 7.23.5 → 7.23.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -8,7 +8,6 @@ var _helperPluginUtils = require("@babel/helper-plugin-utils");
8
8
  var _pluginSyntaxDecorators = require("@babel/plugin-syntax-decorators");
9
9
  var _helperCreateClassFeaturesPlugin = require("@babel/helper-create-class-features-plugin");
10
10
  var _transformerLegacy = require("./transformer-legacy.js");
11
- var _transformer = require("./transformer-2023-05.js");
12
11
  var _default = exports.default = (0, _helperPluginUtils.declare)((api, options) => {
13
12
  api.assertVersion(7);
14
13
  {
@@ -25,16 +24,17 @@ var _default = exports.default = (0, _helperPluginUtils.declare)((api, options)
25
24
  inherits: _pluginSyntaxDecorators.default,
26
25
  visitor: _transformerLegacy.default
27
26
  };
28
- } else if (version === "2021-12" || version === "2022-03" || version === "2023-01" || version === "2023-05") {
29
- return (0, _transformer.default)(api, options, version);
30
- } else {
27
+ } else if (!version || version === "2018-09" || version === "2021-12" || version === "2022-03" || version === "2023-01" || version === "2023-05") {
31
28
  api.assertVersion("^7.0.2");
32
29
  return (0, _helperCreateClassFeaturesPlugin.createClassFeaturePlugin)({
33
30
  name: "proposal-decorators",
34
31
  api,
35
32
  feature: _helperCreateClassFeaturesPlugin.FEATURES.decorators,
36
- inherits: _pluginSyntaxDecorators.default
33
+ inherits: _pluginSyntaxDecorators.default,
34
+ decoratorVersion: version
37
35
  });
36
+ } else {
37
+ throw new Error("The '.version' option must be one of 'legacy', '2023-05', '2023-01', '2022-03', or '2021-12'.");
38
38
  }
39
39
  });
40
40
 
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_helperPluginUtils","require","_pluginSyntaxDecorators","_helperCreateClassFeaturesPlugin","_transformerLegacy","_transformer","_default","exports","default","declare","api","options","assertVersion","legacy","version","name","inherits","syntaxDecorators","visitor","legacyVisitor","transformer2023_05","createClassFeaturePlugin","feature","FEATURES","decorators"],"sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable @babel/development/plugin-name */\n\nimport { declare } from \"@babel/helper-plugin-utils\";\nimport syntaxDecorators from \"@babel/plugin-syntax-decorators\";\nimport {\n createClassFeaturePlugin,\n FEATURES,\n} from \"@babel/helper-create-class-features-plugin\";\nimport legacyVisitor from \"./transformer-legacy.ts\";\nimport transformer2023_05 from \"./transformer-2023-05.ts\";\nimport type { Options as SyntaxOptions } from \"@babel/plugin-syntax-decorators\";\n\ninterface Options extends SyntaxOptions {\n /** @deprecated use `constantSuper` assumption instead. Only supported in 2021-12 version. */\n loose?: boolean;\n}\n\nexport type { Options };\n\nexport default declare((api, options: Options) => {\n api.assertVersion(\n process.env.BABEL_8_BREAKING && process.env.IS_PUBLISH\n ? PACKAGE_JSON.version\n : 7,\n );\n\n // Options are validated in @babel/plugin-syntax-decorators\n if (!process.env.BABEL_8_BREAKING) {\n // eslint-disable-next-line no-var\n var { legacy } = options;\n }\n const { version } = options;\n\n if (\n process.env.BABEL_8_BREAKING\n ? version === \"legacy\"\n : legacy || version === \"legacy\"\n ) {\n return {\n name: \"proposal-decorators\",\n inherits: syntaxDecorators,\n visitor: legacyVisitor,\n };\n } else if (\n version === \"2021-12\" ||\n version === \"2022-03\" ||\n version === \"2023-01\" ||\n version === \"2023-05\"\n ) {\n return transformer2023_05(api, options, version);\n } else if (!process.env.BABEL_8_BREAKING) {\n api.assertVersion(\n process.env.BABEL_8_BREAKING && process.env.IS_PUBLISH\n ? PACKAGE_JSON.version\n : \"^7.0.2\",\n );\n return createClassFeaturePlugin({\n name: \"proposal-decorators\",\n\n api,\n feature: FEATURES.decorators,\n inherits: syntaxDecorators,\n // loose: options.loose, Not supported\n });\n } else {\n throw new Error(\n \"The '.version' option must be one of 'legacy', '2021-12', '2022-03', or '2023-01'.\",\n );\n }\n});\n"],"mappings":";;;;;;AAEA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AACA,IAAAE,gCAAA,GAAAF,OAAA;AAIA,IAAAG,kBAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAA0D,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAU3C,IAAAC,0BAAO,EAAC,CAACC,GAAG,EAAEC,OAAgB,KAAK;EAChDD,GAAG,CAACE,aAAa,CAGX,CACN,CAAC;EAGkC;IAEjC,IAAI;MAAEC;IAAO,CAAC,GAAGF,OAAO;EAC1B;EACA,MAAM;IAAEG;EAAQ,CAAC,GAAGH,OAAO;EAE3B,IAGME,MAAM,IAAIC,OAAO,KAAK,QAAQ,EAClC;IACA,OAAO;MACLC,IAAI,EAAE,qBAAqB;MAC3BC,QAAQ,EAAEC,+BAAgB;MAC1BC,OAAO,EAAEC;IACX,CAAC;EACH,CAAC,MAAM,IACLL,OAAO,KAAK,SAAS,IACrBA,OAAO,KAAK,SAAS,IACrBA,OAAO,KAAK,SAAS,IACrBA,OAAO,KAAK,SAAS,EACrB;IACA,OAAO,IAAAM,oBAAkB,EAACV,GAAG,EAAEC,OAAO,EAAEG,OAAO,CAAC;EAClD,CAAC,MAAyC;IACxCJ,GAAG,CAACE,aAAa,CAGX,QACN,CAAC;IACD,OAAO,IAAAS,yDAAwB,EAAC;MAC9BN,IAAI,EAAE,qBAAqB;MAE3BL,GAAG;MACHY,OAAO,EAAEC,yCAAQ,CAACC,UAAU;MAC5BR,QAAQ,EAAEC;IAEZ,CAAC,CAAC;EACJ;AAKF,CAAC,CAAC"}
1
+ {"version":3,"names":["_helperPluginUtils","require","_pluginSyntaxDecorators","_helperCreateClassFeaturesPlugin","_transformerLegacy","_default","exports","default","declare","api","options","assertVersion","legacy","version","name","inherits","syntaxDecorators","visitor","legacyVisitor","createClassFeaturePlugin","feature","FEATURES","decorators","decoratorVersion","Error"],"sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable @babel/development/plugin-name */\n\nimport { declare } from \"@babel/helper-plugin-utils\";\nimport syntaxDecorators from \"@babel/plugin-syntax-decorators\";\nimport {\n createClassFeaturePlugin,\n FEATURES,\n} from \"@babel/helper-create-class-features-plugin\";\nimport legacyVisitor from \"./transformer-legacy.ts\";\nimport type { Options as SyntaxOptions } from \"@babel/plugin-syntax-decorators\";\n\ninterface Options extends SyntaxOptions {\n /** @deprecated use `constantSuper` assumption instead. Only supported in 2021-12 version. */\n loose?: boolean;\n}\n\nexport type { Options };\n\nexport default declare((api, options: Options) => {\n api.assertVersion(\n process.env.BABEL_8_BREAKING && process.env.IS_PUBLISH\n ? PACKAGE_JSON.version\n : 7,\n );\n\n // Options are validated in @babel/plugin-syntax-decorators\n if (!process.env.BABEL_8_BREAKING) {\n // eslint-disable-next-line no-var\n var { legacy } = options;\n }\n const { version } = options;\n\n if (\n process.env.BABEL_8_BREAKING\n ? version === \"legacy\"\n : legacy || version === \"legacy\"\n ) {\n return {\n name: \"proposal-decorators\",\n inherits: syntaxDecorators,\n visitor: legacyVisitor,\n };\n } else if (\n !version ||\n version === \"2018-09\" ||\n version === \"2021-12\" ||\n version === \"2022-03\" ||\n version === \"2023-01\" ||\n version === \"2023-05\"\n ) {\n api.assertVersion(\n process.env.BABEL_8_BREAKING && process.env.IS_PUBLISH\n ? PACKAGE_JSON.version\n : \"^7.0.2\",\n );\n return createClassFeaturePlugin({\n name: \"proposal-decorators\",\n\n api,\n feature: FEATURES.decorators,\n inherits: syntaxDecorators,\n // @ts-expect-error version must not be \"legacy\" here\n decoratorVersion: version,\n // loose: options.loose, Not supported\n });\n } else {\n throw new Error(\n \"The '.version' option must be one of 'legacy', '2023-05', '2023-01', '2022-03', or '2021-12'.\",\n );\n }\n});\n"],"mappings":";;;;;;AAEA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AACA,IAAAE,gCAAA,GAAAF,OAAA;AAIA,IAAAG,kBAAA,GAAAH,OAAA;AAAoD,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAUrC,IAAAC,0BAAO,EAAC,CAACC,GAAG,EAAEC,OAAgB,KAAK;EAChDD,GAAG,CAACE,aAAa,CAGX,CACN,CAAC;EAGkC;IAEjC,IAAI;MAAEC;IAAO,CAAC,GAAGF,OAAO;EAC1B;EACA,MAAM;IAAEG;EAAQ,CAAC,GAAGH,OAAO;EAE3B,IAGME,MAAM,IAAIC,OAAO,KAAK,QAAQ,EAClC;IACA,OAAO;MACLC,IAAI,EAAE,qBAAqB;MAC3BC,QAAQ,EAAEC,+BAAgB;MAC1BC,OAAO,EAAEC;IACX,CAAC;EACH,CAAC,MAAM,IACL,CAACL,OAAO,IACRA,OAAO,KAAK,SAAS,IACrBA,OAAO,KAAK,SAAS,IACrBA,OAAO,KAAK,SAAS,IACrBA,OAAO,KAAK,SAAS,IACrBA,OAAO,KAAK,SAAS,EACrB;IACAJ,GAAG,CAACE,aAAa,CAGX,QACN,CAAC;IACD,OAAO,IAAAQ,yDAAwB,EAAC;MAC9BL,IAAI,EAAE,qBAAqB;MAE3BL,GAAG;MACHW,OAAO,EAAEC,yCAAQ,CAACC,UAAU;MAC5BP,QAAQ,EAAEC,+BAAgB;MAE1BO,gBAAgB,EAAEV;IAEpB,CAAC,CAAC;EACJ,CAAC,MAAM;IACL,MAAM,IAAIW,KAAK,CACb,+FACF,CAAC;EACH;AACF,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babel/plugin-proposal-decorators",
3
- "version": "7.23.5",
3
+ "version": "7.23.7",
4
4
  "author": "The Babel Team (https://babel.dev/team)",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -20,23 +20,19 @@
20
20
  "decorators"
21
21
  ],
22
22
  "dependencies": {
23
- "@babel/helper-create-class-features-plugin": "^7.23.5",
23
+ "@babel/helper-create-class-features-plugin": "^7.23.7",
24
24
  "@babel/helper-plugin-utils": "^7.22.5",
25
- "@babel/helper-replace-supers": "^7.22.20",
26
- "@babel/helper-split-export-declaration": "^7.22.6",
27
25
  "@babel/plugin-syntax-decorators": "^7.23.3"
28
26
  },
29
27
  "peerDependencies": {
30
28
  "@babel/core": "^7.0.0-0"
31
29
  },
32
30
  "devDependencies": {
33
- "@babel/core": "^7.23.5",
31
+ "@babel/core": "^7.23.7",
34
32
  "@babel/helper-plugin-test-runner": "^7.22.5",
35
- "@babel/traverse": "^7.23.5",
36
- "@types/charcodes": "^0.2.0",
33
+ "@babel/traverse": "^7.23.7",
37
34
  "array.prototype.concat": "^1.0.2",
38
- "babel-plugin-polyfill-es-shims": "^0.10.0",
39
- "charcodes": "^0.2.0",
35
+ "babel-plugin-polyfill-es-shims": "^0.10.1",
40
36
  "object.getownpropertydescriptors": "^2.1.1"
41
37
  },
42
38
  "engines": {
@@ -1,677 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = _default;
7
- var _core = require("@babel/core");
8
- var _pluginSyntaxDecorators = require("@babel/plugin-syntax-decorators");
9
- var _helperReplaceSupers = require("@babel/helper-replace-supers");
10
- var _helperSplitExportDeclaration = require("@babel/helper-split-export-declaration");
11
- function incrementId(id, idx = id.length - 1) {
12
- if (idx === -1) {
13
- id.unshift(65);
14
- return;
15
- }
16
- const current = id[idx];
17
- if (current === 90) {
18
- id[idx] = 97;
19
- } else if (current === 122) {
20
- id[idx] = 65;
21
- incrementId(id, idx - 1);
22
- } else {
23
- id[idx] = current + 1;
24
- }
25
- }
26
- function createPrivateUidGeneratorForClass(classPath) {
27
- const currentPrivateId = [];
28
- const privateNames = new Set();
29
- classPath.traverse({
30
- PrivateName(path) {
31
- privateNames.add(path.node.id.name);
32
- }
33
- });
34
- return () => {
35
- let reifiedId;
36
- do {
37
- incrementId(currentPrivateId);
38
- reifiedId = String.fromCharCode(...currentPrivateId);
39
- } while (privateNames.has(reifiedId));
40
- return _core.types.privateName(_core.types.identifier(reifiedId));
41
- };
42
- }
43
- function createLazyPrivateUidGeneratorForClass(classPath) {
44
- let generator;
45
- return () => {
46
- if (!generator) {
47
- generator = createPrivateUidGeneratorForClass(classPath);
48
- }
49
- return generator();
50
- };
51
- }
52
- function replaceClassWithVar(path) {
53
- if (path.type === "ClassDeclaration") {
54
- const varId = path.scope.generateUidIdentifierBasedOnNode(path.node.id);
55
- const classId = _core.types.identifier(path.node.id.name);
56
- path.scope.rename(classId.name, varId.name);
57
- path.get("id").replaceWith(classId);
58
- return {
59
- id: _core.types.cloneNode(varId),
60
- path,
61
- needsDeclaration: true
62
- };
63
- } else {
64
- let className;
65
- let varId;
66
- if (path.node.id) {
67
- className = path.node.id.name;
68
- varId = path.scope.parent.generateDeclaredUidIdentifier(className);
69
- path.scope.rename(className, varId.name);
70
- } else if (path.parentPath.node.type === "VariableDeclarator" && path.parentPath.node.id.type === "Identifier") {
71
- className = path.parentPath.node.id.name;
72
- varId = path.scope.parent.generateDeclaredUidIdentifier(className);
73
- } else {
74
- varId = path.scope.parent.generateDeclaredUidIdentifier("decorated_class");
75
- }
76
- const newClassExpr = _core.types.classExpression(className && _core.types.identifier(className), path.node.superClass, path.node.body);
77
- const [newPath] = path.replaceWith(_core.types.sequenceExpression([newClassExpr, varId]));
78
- return {
79
- id: _core.types.cloneNode(varId),
80
- path: newPath.get("expressions.0"),
81
- needsDeclaration: false
82
- };
83
- }
84
- }
85
- function generateClassProperty(key, value, isStatic) {
86
- if (key.type === "PrivateName") {
87
- return _core.types.classPrivateProperty(key, value, undefined, isStatic);
88
- } else {
89
- return _core.types.classProperty(key, value, undefined, undefined, isStatic);
90
- }
91
- }
92
- function addProxyAccessorsFor(className, element, originalKey, targetKey, version, isComputed = false) {
93
- const {
94
- static: isStatic
95
- } = element.node;
96
- const thisArg = version === "2023-05" && isStatic ? className : _core.types.thisExpression();
97
- const getterBody = _core.types.blockStatement([_core.types.returnStatement(_core.types.memberExpression(_core.types.cloneNode(thisArg), _core.types.cloneNode(targetKey)))]);
98
- const setterBody = _core.types.blockStatement([_core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.memberExpression(_core.types.cloneNode(thisArg), _core.types.cloneNode(targetKey)), _core.types.identifier("v")))]);
99
- let getter, setter;
100
- if (originalKey.type === "PrivateName") {
101
- getter = _core.types.classPrivateMethod("get", _core.types.cloneNode(originalKey), [], getterBody, isStatic);
102
- setter = _core.types.classPrivateMethod("set", _core.types.cloneNode(originalKey), [_core.types.identifier("v")], setterBody, isStatic);
103
- } else {
104
- getter = _core.types.classMethod("get", _core.types.cloneNode(originalKey), [], getterBody, isComputed, isStatic);
105
- setter = _core.types.classMethod("set", _core.types.cloneNode(originalKey), [_core.types.identifier("v")], setterBody, isComputed, isStatic);
106
- }
107
- element.insertAfter(setter);
108
- element.insertAfter(getter);
109
- }
110
- function extractProxyAccessorsFor(targetKey, version) {
111
- if (version !== "2023-05" && version !== "2023-01") {
112
- return [_core.template.expression.ast`
113
- function () {
114
- return this.${_core.types.cloneNode(targetKey)};
115
- }
116
- `, _core.template.expression.ast`
117
- function (value) {
118
- this.${_core.types.cloneNode(targetKey)} = value;
119
- }
120
- `];
121
- }
122
- return [_core.template.expression.ast`
123
- o => o.${_core.types.cloneNode(targetKey)}
124
- `, _core.template.expression.ast`
125
- (o, v) => o.${_core.types.cloneNode(targetKey)} = v
126
- `];
127
- }
128
- const FIELD = 0;
129
- const ACCESSOR = 1;
130
- const METHOD = 2;
131
- const GETTER = 3;
132
- const SETTER = 4;
133
- const STATIC_OLD_VERSION = 5;
134
- const STATIC = 8;
135
- const DECORATORS_HAVE_THIS = 16;
136
- function getElementKind(element) {
137
- switch (element.node.type) {
138
- case "ClassProperty":
139
- case "ClassPrivateProperty":
140
- return FIELD;
141
- case "ClassAccessorProperty":
142
- return ACCESSOR;
143
- case "ClassMethod":
144
- case "ClassPrivateMethod":
145
- if (element.node.kind === "get") {
146
- return GETTER;
147
- } else if (element.node.kind === "set") {
148
- return SETTER;
149
- } else {
150
- return METHOD;
151
- }
152
- }
153
- }
154
- function isDecoratorInfo(info) {
155
- return "decorators" in info;
156
- }
157
- function filteredOrderedDecoratorInfo(info) {
158
- const filtered = info.filter(isDecoratorInfo);
159
- return [...filtered.filter(el => el.isStatic && el.kind >= ACCESSOR && el.kind <= SETTER), ...filtered.filter(el => !el.isStatic && el.kind >= ACCESSOR && el.kind <= SETTER), ...filtered.filter(el => el.isStatic && el.kind === FIELD), ...filtered.filter(el => !el.isStatic && el.kind === FIELD)];
160
- }
161
- function generateDecorationList(decorators, decoratorsThis, version) {
162
- const decsCount = decorators.length;
163
- const hasOneThis = decoratorsThis.some(Boolean);
164
- const decs = [];
165
- for (let i = 0; i < decsCount; i++) {
166
- if (version === "2023-05" && hasOneThis) {
167
- decs.push(decoratorsThis[i] || _core.types.unaryExpression("void", _core.types.numericLiteral(0)));
168
- }
169
- decs.push(decorators[i]);
170
- }
171
- return {
172
- hasThis: hasOneThis,
173
- decs
174
- };
175
- }
176
- function generateDecorationExprs(info, version) {
177
- return _core.types.arrayExpression(filteredOrderedDecoratorInfo(info).map(el => {
178
- const {
179
- decs,
180
- hasThis
181
- } = generateDecorationList(el.decorators, el.decoratorsThis, version);
182
- let flag = el.kind;
183
- if (el.isStatic) {
184
- flag += version === "2023-05" ? STATIC : STATIC_OLD_VERSION;
185
- }
186
- if (hasThis) flag += DECORATORS_HAVE_THIS;
187
- return _core.types.arrayExpression([decs.length === 1 ? decs[0] : _core.types.arrayExpression(decs), _core.types.numericLiteral(flag), el.name, ...(el.privateMethods || [])]);
188
- }));
189
- }
190
- function extractElementLocalAssignments(decorationInfo) {
191
- const localIds = [];
192
- for (const el of filteredOrderedDecoratorInfo(decorationInfo)) {
193
- const {
194
- locals
195
- } = el;
196
- if (Array.isArray(locals)) {
197
- localIds.push(...locals);
198
- } else if (locals !== undefined) {
199
- localIds.push(locals);
200
- }
201
- }
202
- return localIds;
203
- }
204
- function addCallAccessorsFor(element, key, getId, setId) {
205
- element.insertAfter(_core.types.classPrivateMethod("get", _core.types.cloneNode(key), [], _core.types.blockStatement([_core.types.returnStatement(_core.types.callExpression(_core.types.cloneNode(getId), [_core.types.thisExpression()]))])));
206
- element.insertAfter(_core.types.classPrivateMethod("set", _core.types.cloneNode(key), [_core.types.identifier("v")], _core.types.blockStatement([_core.types.expressionStatement(_core.types.callExpression(_core.types.cloneNode(setId), [_core.types.thisExpression(), _core.types.identifier("v")]))])));
207
- }
208
- function isNotTsParameter(node) {
209
- return node.type !== "TSParameterProperty";
210
- }
211
- function movePrivateAccessor(element, key, methodLocalVar, isStatic) {
212
- let params;
213
- let block;
214
- if (element.node.kind === "set") {
215
- params = [_core.types.identifier("v")];
216
- block = [_core.types.expressionStatement(_core.types.callExpression(methodLocalVar, [_core.types.thisExpression(), _core.types.identifier("v")]))];
217
- } else {
218
- params = [];
219
- block = [_core.types.returnStatement(_core.types.callExpression(methodLocalVar, [_core.types.thisExpression()]))];
220
- }
221
- element.replaceWith(_core.types.classPrivateMethod(element.node.kind, _core.types.cloneNode(key), params, _core.types.blockStatement(block), isStatic));
222
- }
223
- function isClassDecoratableElementPath(path) {
224
- const {
225
- type
226
- } = path;
227
- return type !== "TSDeclareMethod" && type !== "TSIndexSignature" && type !== "StaticBlock";
228
- }
229
- function staticBlockToIIFE(block) {
230
- return _core.types.callExpression(_core.types.arrowFunctionExpression([], _core.types.blockStatement(block.body)), []);
231
- }
232
- function maybeSequenceExpression(exprs) {
233
- if (exprs.length === 0) return _core.types.unaryExpression("void", _core.types.numericLiteral(0));
234
- if (exprs.length === 1) return exprs[0];
235
- return _core.types.sequenceExpression(exprs);
236
- }
237
- function transformClass(path, state, constantSuper, version) {
238
- const body = path.get("body.body");
239
- const classDecorators = path.node.decorators;
240
- let hasElementDecorators = false;
241
- const generateClassPrivateUid = createLazyPrivateUidGeneratorForClass(path);
242
- for (const element of body) {
243
- if (!isClassDecoratableElementPath(element)) {
244
- continue;
245
- }
246
- if (element.node.decorators && element.node.decorators.length > 0) {
247
- hasElementDecorators = true;
248
- } else if (element.node.type === "ClassAccessorProperty") {
249
- const {
250
- key,
251
- value,
252
- static: isStatic,
253
- computed
254
- } = element.node;
255
- const newId = generateClassPrivateUid();
256
- const valueNode = value ? _core.types.cloneNode(value) : undefined;
257
- const newField = generateClassProperty(newId, valueNode, isStatic);
258
- const [newPath] = element.replaceWith(newField);
259
- addProxyAccessorsFor(path.node.id, newPath, key, newId, version, computed);
260
- }
261
- }
262
- if (!classDecorators && !hasElementDecorators) return;
263
- const elementDecoratorInfo = [];
264
- let firstFieldPath;
265
- let constructorPath;
266
- let requiresProtoInit = false;
267
- let requiresStaticInit = false;
268
- const decoratedPrivateMethods = new Set();
269
- let protoInitLocal, staticInitLocal, classInitLocal, classIdLocal;
270
- const assignments = [];
271
- const scopeParent = path.scope.parent;
272
- const memoiseExpression = (expression, hint) => {
273
- const localEvaluatedId = scopeParent.generateDeclaredUidIdentifier(hint);
274
- assignments.push(_core.types.assignmentExpression("=", localEvaluatedId, expression));
275
- return _core.types.cloneNode(localEvaluatedId);
276
- };
277
- const decoratorsThis = new Map();
278
- const maybeExtractDecorator = decorator => {
279
- const {
280
- expression
281
- } = decorator;
282
- if (version === "2023-05" && _core.types.isMemberExpression(expression)) {
283
- let object;
284
- if (_core.types.isSuper(expression.object) || _core.types.isThisExpression(expression.object)) {
285
- object = memoiseExpression(_core.types.thisExpression(), "obj");
286
- } else if (!scopeParent.isStatic(expression.object)) {
287
- object = memoiseExpression(expression.object, "obj");
288
- expression.object = object;
289
- } else {
290
- object = expression.object;
291
- }
292
- decoratorsThis.set(decorator, _core.types.cloneNode(object));
293
- }
294
- if (!scopeParent.isStatic(expression)) {
295
- decorator.expression = memoiseExpression(expression, "dec");
296
- }
297
- };
298
- let needsDeclaraionForClassBinding = false;
299
- if (classDecorators) {
300
- classInitLocal = scopeParent.generateDeclaredUidIdentifier("initClass");
301
- ({
302
- id: classIdLocal,
303
- path,
304
- needsDeclaration: needsDeclaraionForClassBinding
305
- } = replaceClassWithVar(path));
306
- path.node.decorators = null;
307
- for (const classDecorator of classDecorators) {
308
- maybeExtractDecorator(classDecorator);
309
- }
310
- } else {
311
- if (!path.node.id) {
312
- path.node.id = path.scope.generateUidIdentifier("Class");
313
- }
314
- classIdLocal = _core.types.cloneNode(path.node.id);
315
- }
316
- let lastInstancePrivateName;
317
- let needsInstancePrivateBrandCheck = false;
318
- if (hasElementDecorators) {
319
- for (const element of body) {
320
- if (!isClassDecoratableElementPath(element)) {
321
- continue;
322
- }
323
- const {
324
- node
325
- } = element;
326
- const decorators = element.get("decorators");
327
- const hasDecorators = Array.isArray(decorators) && decorators.length > 0;
328
- if (hasDecorators) {
329
- for (const decoratorPath of decorators) {
330
- maybeExtractDecorator(decoratorPath.node);
331
- }
332
- }
333
- const isComputed = "computed" in element.node && element.node.computed === true;
334
- if (isComputed) {
335
- if (!scopeParent.isStatic(node.key)) {
336
- node.key = memoiseExpression(node.key, "computedKey");
337
- }
338
- }
339
- const kind = getElementKind(element);
340
- const {
341
- key
342
- } = node;
343
- const isPrivate = key.type === "PrivateName";
344
- const isStatic = !!element.node.static;
345
- let name = "computedKey";
346
- if (isPrivate) {
347
- name = key.id.name;
348
- } else if (!isComputed && key.type === "Identifier") {
349
- name = key.name;
350
- }
351
- if (isPrivate && !isStatic) {
352
- if (hasDecorators) {
353
- needsInstancePrivateBrandCheck = true;
354
- }
355
- if (_core.types.isClassPrivateProperty(node) || !lastInstancePrivateName) {
356
- lastInstancePrivateName = key;
357
- }
358
- }
359
- if (element.isClassMethod({
360
- kind: "constructor"
361
- })) {
362
- constructorPath = element;
363
- }
364
- if (hasDecorators) {
365
- let locals;
366
- let privateMethods;
367
- if (kind === ACCESSOR) {
368
- const {
369
- value
370
- } = element.node;
371
- const params = [_core.types.thisExpression()];
372
- if (value) {
373
- params.push(_core.types.cloneNode(value));
374
- }
375
- const newId = generateClassPrivateUid();
376
- const newFieldInitId = element.scope.parent.generateDeclaredUidIdentifier(`init_${name}`);
377
- const newValue = _core.types.callExpression(_core.types.cloneNode(newFieldInitId), params);
378
- const newField = generateClassProperty(newId, newValue, isStatic);
379
- const [newPath] = element.replaceWith(newField);
380
- if (isPrivate) {
381
- privateMethods = extractProxyAccessorsFor(newId, version);
382
- const getId = newPath.scope.parent.generateDeclaredUidIdentifier(`get_${name}`);
383
- const setId = newPath.scope.parent.generateDeclaredUidIdentifier(`set_${name}`);
384
- addCallAccessorsFor(newPath, key, getId, setId);
385
- locals = [newFieldInitId, getId, setId];
386
- } else {
387
- addProxyAccessorsFor(path.node.id, newPath, key, newId, version, isComputed);
388
- locals = newFieldInitId;
389
- }
390
- } else if (kind === FIELD) {
391
- const initId = element.scope.parent.generateDeclaredUidIdentifier(`init_${name}`);
392
- const valuePath = element.get("value");
393
- valuePath.replaceWith(_core.types.callExpression(_core.types.cloneNode(initId), [_core.types.thisExpression(), valuePath.node].filter(v => v)));
394
- locals = initId;
395
- if (isPrivate) {
396
- privateMethods = extractProxyAccessorsFor(key, version);
397
- }
398
- } else if (isPrivate) {
399
- locals = element.scope.parent.generateDeclaredUidIdentifier(`call_${name}`);
400
- const replaceSupers = new _helperReplaceSupers.default({
401
- constantSuper,
402
- methodPath: element,
403
- objectRef: classIdLocal,
404
- superRef: path.node.superClass,
405
- file: state.file,
406
- refToPreserve: classIdLocal
407
- });
408
- replaceSupers.replace();
409
- const {
410
- params,
411
- body,
412
- async: isAsync
413
- } = element.node;
414
- privateMethods = [_core.types.functionExpression(undefined, params.filter(isNotTsParameter), body, isAsync)];
415
- if (kind === GETTER || kind === SETTER) {
416
- movePrivateAccessor(element, _core.types.cloneNode(key), _core.types.cloneNode(locals), isStatic);
417
- } else {
418
- const node = element.node;
419
- path.node.body.body.unshift(_core.types.classPrivateProperty(key, _core.types.cloneNode(locals), [], node.static));
420
- decoratedPrivateMethods.add(key.id.name);
421
- element.remove();
422
- }
423
- }
424
- let nameExpr;
425
- if (isComputed) {
426
- nameExpr = _core.types.cloneNode(key);
427
- } else if (key.type === "PrivateName") {
428
- nameExpr = _core.types.stringLiteral(key.id.name);
429
- } else if (key.type === "Identifier") {
430
- nameExpr = _core.types.stringLiteral(key.name);
431
- } else {
432
- nameExpr = _core.types.cloneNode(key);
433
- }
434
- elementDecoratorInfo.push({
435
- kind,
436
- decorators: decorators.map(d => d.node.expression),
437
- decoratorsThis: decorators.map(d => decoratorsThis.get(d.node)),
438
- name: nameExpr,
439
- isStatic,
440
- privateMethods,
441
- locals
442
- });
443
- if (kind !== FIELD) {
444
- if (isStatic) {
445
- requiresStaticInit = true;
446
- } else {
447
- requiresProtoInit = true;
448
- }
449
- }
450
- if (element.node) {
451
- element.node.decorators = null;
452
- }
453
- if (!firstFieldPath && !isStatic && (kind === FIELD || kind === ACCESSOR)) {
454
- firstFieldPath = element;
455
- }
456
- }
457
- }
458
- }
459
- const elementDecorations = generateDecorationExprs(elementDecoratorInfo, version);
460
- let classDecorationsFlag = 0;
461
- let classDecorations = [];
462
- if (classDecorators) {
463
- const {
464
- hasThis,
465
- decs
466
- } = generateDecorationList(classDecorators.map(el => el.expression), classDecorators.map(dec => decoratorsThis.get(dec)), version);
467
- classDecorationsFlag = hasThis ? 1 : 0;
468
- classDecorations = decs;
469
- }
470
- const elementLocals = extractElementLocalAssignments(elementDecoratorInfo);
471
- if (requiresProtoInit) {
472
- protoInitLocal = scopeParent.generateDeclaredUidIdentifier("initProto");
473
- elementLocals.push(protoInitLocal);
474
- const protoInitCall = _core.types.callExpression(_core.types.cloneNode(protoInitLocal), [_core.types.thisExpression()]);
475
- if (firstFieldPath) {
476
- const value = firstFieldPath.get("value");
477
- const body = [protoInitCall];
478
- if (value.node) {
479
- body.push(value.node);
480
- }
481
- value.replaceWith(_core.types.sequenceExpression(body));
482
- } else if (constructorPath) {
483
- if (path.node.superClass) {
484
- path.traverse({
485
- CallExpression: {
486
- exit(path) {
487
- if (!path.get("callee").isSuper()) return;
488
- path.replaceWith(_core.types.callExpression(_core.types.cloneNode(protoInitLocal), [path.node]));
489
- path.skip();
490
- }
491
- }
492
- });
493
- } else {
494
- constructorPath.node.body.body.unshift(_core.types.expressionStatement(protoInitCall));
495
- }
496
- } else {
497
- const body = [_core.types.expressionStatement(protoInitCall)];
498
- if (path.node.superClass) {
499
- body.unshift(_core.types.expressionStatement(_core.types.callExpression(_core.types.super(), [_core.types.spreadElement(_core.types.identifier("args"))])));
500
- }
501
- path.node.body.body.unshift(_core.types.classMethod("constructor", _core.types.identifier("constructor"), [_core.types.restElement(_core.types.identifier("args"))], _core.types.blockStatement(body)));
502
- }
503
- }
504
- if (requiresStaticInit) {
505
- staticInitLocal = scopeParent.generateDeclaredUidIdentifier("initStatic");
506
- elementLocals.push(staticInitLocal);
507
- }
508
- if (decoratedPrivateMethods.size > 0) {
509
- path.traverse({
510
- PrivateName(path) {
511
- if (!decoratedPrivateMethods.has(path.node.id.name)) return;
512
- const parentPath = path.parentPath;
513
- const parentParentPath = parentPath.parentPath;
514
- if (parentParentPath.node.type === "AssignmentExpression" && parentParentPath.node.left === parentPath.node || parentParentPath.node.type === "UpdateExpression" || parentParentPath.node.type === "RestElement" || parentParentPath.node.type === "ArrayPattern" || parentParentPath.node.type === "ObjectProperty" && parentParentPath.node.value === parentPath.node && parentParentPath.parentPath.type === "ObjectPattern" || parentParentPath.node.type === "ForOfStatement" && parentParentPath.node.left === parentPath.node) {
515
- throw path.buildCodeFrameError(`Decorated private methods are not updatable, but "#${path.node.id.name}" is updated via this expression.`);
516
- }
517
- }
518
- });
519
- }
520
- const classLocals = [];
521
- let classInitInjected = false;
522
- const classInitCall = classInitLocal && _core.types.callExpression(_core.types.cloneNode(classInitLocal), []);
523
- const originalClass = path.node;
524
- if (classDecorators) {
525
- classLocals.push(classIdLocal, classInitLocal);
526
- const statics = [];
527
- let staticBlocks = [];
528
- path.get("body.body").forEach(element => {
529
- if (element.isStaticBlock()) {
530
- staticBlocks.push(element.node);
531
- element.remove();
532
- return;
533
- }
534
- const isProperty = element.isClassProperty() || element.isClassPrivateProperty();
535
- if ((isProperty || element.isClassPrivateMethod()) && element.node.static) {
536
- if (isProperty && staticBlocks.length > 0) {
537
- const allValues = staticBlocks.map(staticBlockToIIFE);
538
- if (element.node.value) allValues.push(element.node.value);
539
- element.node.value = maybeSequenceExpression(allValues);
540
- staticBlocks = [];
541
- }
542
- element.node.static = false;
543
- statics.push(element.node);
544
- element.remove();
545
- }
546
- });
547
- if (statics.length > 0 || staticBlocks.length > 0) {
548
- const staticsClass = _core.template.expression.ast`
549
- class extends ${state.addHelper("identity")} {}
550
- `;
551
- staticsClass.body.body = [_core.types.staticBlock([_core.types.toStatement(originalClass, true) || _core.types.expressionStatement(originalClass)]), ...statics];
552
- const constructorBody = [];
553
- const newExpr = _core.types.newExpression(staticsClass, []);
554
- if (staticBlocks.length > 0) {
555
- constructorBody.push(...staticBlocks.map(staticBlockToIIFE));
556
- }
557
- if (classInitCall) {
558
- classInitInjected = true;
559
- constructorBody.push(classInitCall);
560
- }
561
- if (constructorBody.length > 0) {
562
- constructorBody.unshift(_core.types.callExpression(_core.types.super(), [_core.types.cloneNode(classIdLocal)]));
563
- staticsClass.body.body.push(_core.types.classMethod("constructor", _core.types.identifier("constructor"), [], _core.types.blockStatement([_core.types.expressionStatement(_core.types.sequenceExpression(constructorBody))])));
564
- } else {
565
- newExpr.arguments.push(_core.types.cloneNode(classIdLocal));
566
- }
567
- path.replaceWith(newExpr);
568
- }
569
- }
570
- if (!classInitInjected && classInitCall) {
571
- path.node.body.body.push(_core.types.staticBlock([_core.types.expressionStatement(classInitCall)]));
572
- }
573
- let {
574
- superClass
575
- } = originalClass;
576
- if (superClass && version === "2023-05") {
577
- const id = path.scope.maybeGenerateMemoised(superClass);
578
- if (id) {
579
- originalClass.superClass = _core.types.assignmentExpression("=", id, superClass);
580
- superClass = id;
581
- }
582
- }
583
- originalClass.body.body.unshift(_core.types.staticBlock([_core.types.expressionStatement(createLocalsAssignment(elementLocals, classLocals, elementDecorations, _core.types.arrayExpression(classDecorations), _core.types.numericLiteral(classDecorationsFlag), needsInstancePrivateBrandCheck ? lastInstancePrivateName : null, _core.types.cloneNode(superClass), state, version)), requiresStaticInit && _core.types.expressionStatement(_core.types.callExpression(_core.types.cloneNode(staticInitLocal), [_core.types.thisExpression()]))].filter(Boolean)));
584
- path.insertBefore(assignments.map(expr => _core.types.expressionStatement(expr)));
585
- if (needsDeclaraionForClassBinding) {
586
- path.insertBefore(_core.types.variableDeclaration("let", [_core.types.variableDeclarator(_core.types.cloneNode(classIdLocal))]));
587
- }
588
- path.scope.crawl();
589
- return path;
590
- }
591
- function createLocalsAssignment(elementLocals, classLocals, elementDecorations, classDecorations, classDecorationsFlag, maybePrivateBranName, superClass, state, version) {
592
- let lhs, rhs;
593
- const args = [_core.types.thisExpression(), elementDecorations, classDecorations];
594
- {
595
- if (version === "2021-12" || version === "2022-03" && !state.availableHelper("applyDecs2203R")) {
596
- const lhs = _core.types.arrayPattern([...elementLocals, ...classLocals]);
597
- const rhs = _core.types.callExpression(state.addHelper(version === "2021-12" ? "applyDecs" : "applyDecs2203"), args);
598
- return _core.types.assignmentExpression("=", lhs, rhs);
599
- }
600
- }
601
- if (version === "2023-05") {
602
- if (maybePrivateBranName || superClass || classDecorationsFlag.value !== 0) {
603
- args.push(classDecorationsFlag);
604
- }
605
- if (maybePrivateBranName) {
606
- args.push(_core.template.expression.ast`
607
- _ => ${_core.types.cloneNode(maybePrivateBranName)} in _
608
- `);
609
- } else if (superClass) {
610
- args.push(_core.types.unaryExpression("void", _core.types.numericLiteral(0)));
611
- }
612
- if (superClass) args.push(superClass);
613
- rhs = _core.types.callExpression(state.addHelper("applyDecs2305"), args);
614
- } else if (version === "2023-01") {
615
- if (maybePrivateBranName) {
616
- args.push(_core.template.expression.ast`
617
- _ => ${_core.types.cloneNode(maybePrivateBranName)} in _
618
- `);
619
- }
620
- rhs = _core.types.callExpression(state.addHelper("applyDecs2301"), args);
621
- } else {
622
- rhs = _core.types.callExpression(state.addHelper("applyDecs2203R"), args);
623
- }
624
- if (elementLocals.length > 0) {
625
- if (classLocals.length > 0) {
626
- lhs = _core.types.objectPattern([_core.types.objectProperty(_core.types.identifier("e"), _core.types.arrayPattern(elementLocals)), _core.types.objectProperty(_core.types.identifier("c"), _core.types.arrayPattern(classLocals))]);
627
- } else {
628
- lhs = _core.types.arrayPattern(elementLocals);
629
- rhs = _core.types.memberExpression(rhs, _core.types.identifier("e"), false, false);
630
- }
631
- } else {
632
- lhs = _core.types.arrayPattern(classLocals);
633
- rhs = _core.types.memberExpression(rhs, _core.types.identifier("c"), false, false);
634
- }
635
- return _core.types.assignmentExpression("=", lhs, rhs);
636
- }
637
- function _default({
638
- assertVersion,
639
- assumption
640
- }, {
641
- loose
642
- }, version) {
643
- var _assumption;
644
- {
645
- if (version === "2023-05" || version === "2023-01") {
646
- assertVersion("^7.21.0");
647
- } else if (version === "2021-12") {
648
- assertVersion("^7.16.0");
649
- } else {
650
- assertVersion("^7.19.0");
651
- }
652
- }
653
- const VISITED = new WeakSet();
654
- const constantSuper = (_assumption = assumption("constantSuper")) != null ? _assumption : loose;
655
- return {
656
- name: "proposal-decorators",
657
- inherits: _pluginSyntaxDecorators.default,
658
- visitor: {
659
- "ExportNamedDeclaration|ExportDefaultDeclaration"(path) {
660
- var _declaration$decorato;
661
- const {
662
- declaration
663
- } = path.node;
664
- if ((declaration == null ? void 0 : declaration.type) === "ClassDeclaration" && ((_declaration$decorato = declaration.decorators) == null ? void 0 : _declaration$decorato.length) > 0) {
665
- (0, _helperSplitExportDeclaration.default)(path);
666
- }
667
- },
668
- Class(path, state) {
669
- if (VISITED.has(path)) return;
670
- const newPath = transformClass(path, state, constantSuper, version);
671
- if (newPath) VISITED.add(newPath);
672
- }
673
- }
674
- };
675
- }
676
-
677
- //# sourceMappingURL=transformer-2023-05.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_core","require","_pluginSyntaxDecorators","_helperReplaceSupers","_helperSplitExportDeclaration","incrementId","id","idx","length","unshift","current","createPrivateUidGeneratorForClass","classPath","currentPrivateId","privateNames","Set","traverse","PrivateName","path","add","node","name","reifiedId","String","fromCharCode","has","t","privateName","identifier","createLazyPrivateUidGeneratorForClass","generator","replaceClassWithVar","type","varId","scope","generateUidIdentifierBasedOnNode","classId","rename","get","replaceWith","cloneNode","needsDeclaration","className","parent","generateDeclaredUidIdentifier","parentPath","newClassExpr","classExpression","superClass","body","newPath","sequenceExpression","generateClassProperty","key","value","isStatic","classPrivateProperty","undefined","classProperty","addProxyAccessorsFor","element","originalKey","targetKey","version","isComputed","static","thisArg","thisExpression","getterBody","blockStatement","returnStatement","memberExpression","setterBody","expressionStatement","assignmentExpression","getter","setter","classPrivateMethod","classMethod","insertAfter","extractProxyAccessorsFor","template","expression","ast","FIELD","ACCESSOR","METHOD","GETTER","SETTER","STATIC_OLD_VERSION","STATIC","DECORATORS_HAVE_THIS","getElementKind","kind","isDecoratorInfo","info","filteredOrderedDecoratorInfo","filtered","filter","el","generateDecorationList","decorators","decoratorsThis","decsCount","hasOneThis","some","Boolean","decs","i","push","unaryExpression","numericLiteral","hasThis","generateDecorationExprs","arrayExpression","map","flag","privateMethods","extractElementLocalAssignments","decorationInfo","localIds","locals","Array","isArray","addCallAccessorsFor","getId","setId","callExpression","isNotTsParameter","movePrivateAccessor","methodLocalVar","params","block","isClassDecoratableElementPath","staticBlockToIIFE","arrowFunctionExpression","maybeSequenceExpression","exprs","transformClass","state","constantSuper","classDecorators","hasElementDecorators","generateClassPrivateUid","computed","newId","valueNode","newField","elementDecoratorInfo","firstFieldPath","constructorPath","requiresProtoInit","requiresStaticInit","decoratedPrivateMethods","protoInitLocal","staticInitLocal","classInitLocal","classIdLocal","assignments","scopeParent","memoiseExpression","hint","localEvaluatedId","Map","maybeExtractDecorator","decorator","isMemberExpression","object","isSuper","isThisExpression","set","needsDeclaraionForClassBinding","classDecorator","generateUidIdentifier","lastInstancePrivateName","needsInstancePrivateBrandCheck","hasDecorators","decoratorPath","isPrivate","isClassPrivateProperty","isClassMethod","newFieldInitId","newValue","initId","valuePath","v","replaceSupers","ReplaceSupers","methodPath","objectRef","superRef","file","refToPreserve","replace","async","isAsync","functionExpression","remove","nameExpr","stringLiteral","d","elementDecorations","classDecorationsFlag","classDecorations","dec","elementLocals","protoInitCall","CallExpression","exit","skip","super","spreadElement","restElement","size","parentParentPath","left","buildCodeFrameError","classLocals","classInitInjected","classInitCall","originalClass","statics","staticBlocks","forEach","isStaticBlock","isProperty","isClassProperty","isClassPrivateMethod","allValues","staticsClass","addHelper","staticBlock","toStatement","constructorBody","newExpr","newExpression","arguments","maybeGenerateMemoised","createLocalsAssignment","insertBefore","expr","variableDeclaration","variableDeclarator","crawl","maybePrivateBranName","lhs","rhs","args","availableHelper","arrayPattern","objectPattern","objectProperty","_default","assertVersion","assumption","loose","_assumption","VISITED","WeakSet","inherits","syntaxDecorators","visitor","ExportNamedDeclaration|ExportDefaultDeclaration","_declaration$decorato","declaration","splitExportDeclaration","Class"],"sources":["../src/transformer-2023-05.ts"],"sourcesContent":["import type { NodePath, Scope } from \"@babel/traverse\";\nimport { types as t, template } from \"@babel/core\";\nimport syntaxDecorators from \"@babel/plugin-syntax-decorators\";\nimport ReplaceSupers from \"@babel/helper-replace-supers\";\nimport splitExportDeclaration from \"@babel/helper-split-export-declaration\";\nimport * as charCodes from \"charcodes\";\nimport type { PluginAPI, PluginObject, PluginPass } from \"@babel/core\";\nimport type { Options } from \"./index.ts\";\n\ntype ClassDecoratableElement =\n | t.ClassMethod\n | t.ClassPrivateMethod\n | t.ClassProperty\n | t.ClassPrivateProperty\n | t.ClassAccessorProperty;\n\ntype ClassElement =\n | ClassDecoratableElement\n | t.TSDeclareMethod\n | t.TSIndexSignature\n | t.StaticBlock;\n\ntype DecoratorVersionKind = \"2023-05\" | \"2023-01\" | \"2022-03\" | \"2021-12\";\n\nfunction incrementId(id: number[], idx = id.length - 1): void {\n // If index is -1, id needs an additional character, unshift A\n if (idx === -1) {\n id.unshift(charCodes.uppercaseA);\n return;\n }\n\n const current = id[idx];\n\n if (current === charCodes.uppercaseZ) {\n // if current is Z, skip to a\n id[idx] = charCodes.lowercaseA;\n } else if (current === charCodes.lowercaseZ) {\n // if current is z, reset to A and carry the 1\n id[idx] = charCodes.uppercaseA;\n incrementId(id, idx - 1);\n } else {\n // else, increment by one\n id[idx] = current + 1;\n }\n}\n\n/**\n * Generates a new private name that is unique to the given class. This can be\n * used to create extra class fields and methods for the implementation, while\n * keeping the length of those names as small as possible. This is important for\n * minification purposes (though private names can generally be minified,\n * transpilations and polyfills cannot yet).\n */\nfunction createPrivateUidGeneratorForClass(\n classPath: NodePath<t.ClassDeclaration | t.ClassExpression>,\n): () => t.PrivateName {\n const currentPrivateId: number[] = [];\n const privateNames = new Set<string>();\n\n classPath.traverse({\n PrivateName(path) {\n privateNames.add(path.node.id.name);\n },\n });\n\n return (): t.PrivateName => {\n let reifiedId;\n do {\n incrementId(currentPrivateId);\n reifiedId = String.fromCharCode(...currentPrivateId);\n } while (privateNames.has(reifiedId));\n\n return t.privateName(t.identifier(reifiedId));\n };\n}\n\n/**\n * Wraps the above generator function so that it's run lazily the first time\n * it's actually required. Several types of decoration do not require this, so it\n * saves iterating the class elements an additional time and allocating the space\n * for the Sets of element names.\n */\nfunction createLazyPrivateUidGeneratorForClass(\n classPath: NodePath<t.ClassDeclaration | t.ClassExpression>,\n): () => t.PrivateName {\n let generator: () => t.PrivateName;\n\n return (): t.PrivateName => {\n if (!generator) {\n generator = createPrivateUidGeneratorForClass(classPath);\n }\n\n return generator();\n };\n}\n\n/**\n * Takes a class definition and replaces it with an equivalent class declaration\n * which is then assigned to a local variable. This allows us to reassign the\n * local variable with the decorated version of the class. The class definition\n * retains its original name so that `toString` is not affected, other\n * references to the class are renamed instead.\n */\nfunction replaceClassWithVar(\n path: NodePath<t.ClassDeclaration | t.ClassExpression>,\n): {\n id: t.Identifier;\n path: NodePath<t.ClassDeclaration | t.ClassExpression>;\n needsDeclaration: boolean;\n} {\n if (path.type === \"ClassDeclaration\") {\n const varId = path.scope.generateUidIdentifierBasedOnNode(path.node.id);\n const classId = t.identifier(path.node.id.name);\n\n path.scope.rename(classId.name, varId.name);\n\n path.get(\"id\").replaceWith(classId);\n\n return { id: t.cloneNode(varId), path, needsDeclaration: true };\n } else {\n let className: string;\n let varId: t.Identifier;\n\n if (path.node.id) {\n className = path.node.id.name;\n varId = path.scope.parent.generateDeclaredUidIdentifier(className);\n path.scope.rename(className, varId.name);\n } else if (\n path.parentPath.node.type === \"VariableDeclarator\" &&\n path.parentPath.node.id.type === \"Identifier\"\n ) {\n className = path.parentPath.node.id.name;\n varId = path.scope.parent.generateDeclaredUidIdentifier(className);\n } else {\n varId =\n path.scope.parent.generateDeclaredUidIdentifier(\"decorated_class\");\n }\n\n const newClassExpr = t.classExpression(\n className && t.identifier(className),\n path.node.superClass,\n path.node.body,\n );\n\n const [newPath] = path.replaceWith(\n t.sequenceExpression([newClassExpr, varId]),\n );\n\n return {\n id: t.cloneNode(varId),\n path: newPath.get(\"expressions.0\") as NodePath<t.ClassExpression>,\n needsDeclaration: false,\n };\n }\n}\n\nfunction generateClassProperty(\n key: t.PrivateName | t.Identifier,\n value: t.Expression | undefined,\n isStatic: boolean,\n): t.ClassPrivateProperty | t.ClassProperty {\n if (key.type === \"PrivateName\") {\n return t.classPrivateProperty(key, value, undefined, isStatic);\n } else {\n return t.classProperty(key, value, undefined, undefined, isStatic);\n }\n}\n\nfunction addProxyAccessorsFor(\n className: t.Identifier,\n element: NodePath<ClassDecoratableElement>,\n originalKey: t.PrivateName | t.Expression,\n targetKey: t.PrivateName,\n version: DecoratorVersionKind,\n isComputed = false,\n): void {\n const { static: isStatic } = element.node;\n\n const thisArg =\n version === \"2023-05\" && isStatic ? className : t.thisExpression();\n\n const getterBody = t.blockStatement([\n t.returnStatement(\n t.memberExpression(t.cloneNode(thisArg), t.cloneNode(targetKey)),\n ),\n ]);\n\n const setterBody = t.blockStatement([\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.memberExpression(t.cloneNode(thisArg), t.cloneNode(targetKey)),\n t.identifier(\"v\"),\n ),\n ),\n ]);\n\n let getter: t.ClassMethod | t.ClassPrivateMethod,\n setter: t.ClassMethod | t.ClassPrivateMethod;\n\n if (originalKey.type === \"PrivateName\") {\n getter = t.classPrivateMethod(\n \"get\",\n t.cloneNode(originalKey),\n [],\n getterBody,\n isStatic,\n );\n setter = t.classPrivateMethod(\n \"set\",\n t.cloneNode(originalKey),\n [t.identifier(\"v\")],\n setterBody,\n isStatic,\n );\n } else {\n getter = t.classMethod(\n \"get\",\n t.cloneNode(originalKey),\n [],\n getterBody,\n isComputed,\n isStatic,\n );\n setter = t.classMethod(\n \"set\",\n t.cloneNode(originalKey),\n [t.identifier(\"v\")],\n setterBody,\n isComputed,\n isStatic,\n );\n }\n\n element.insertAfter(setter);\n element.insertAfter(getter);\n}\n\nfunction extractProxyAccessorsFor(\n targetKey: t.PrivateName,\n version: DecoratorVersionKind,\n): (t.FunctionExpression | t.ArrowFunctionExpression)[] {\n if (version !== \"2023-05\" && version !== \"2023-01\") {\n return [\n template.expression.ast`\n function () {\n return this.${t.cloneNode(targetKey)};\n }\n ` as t.FunctionExpression,\n template.expression.ast`\n function (value) {\n this.${t.cloneNode(targetKey)} = value;\n }\n ` as t.FunctionExpression,\n ];\n }\n return [\n template.expression.ast`\n o => o.${t.cloneNode(targetKey)}\n ` as t.ArrowFunctionExpression,\n template.expression.ast`\n (o, v) => o.${t.cloneNode(targetKey)} = v\n ` as t.ArrowFunctionExpression,\n ];\n}\n\n// 3 bits reserved to this (0-7)\nconst FIELD = 0;\nconst ACCESSOR = 1;\nconst METHOD = 2;\nconst GETTER = 3;\nconst SETTER = 4;\n\nconst STATIC_OLD_VERSION = 5; // Before 2023-05\nconst STATIC = 8; // 1 << 3\nconst DECORATORS_HAVE_THIS = 16; // 1 << 3\n\nfunction getElementKind(element: NodePath<ClassDecoratableElement>): number {\n switch (element.node.type) {\n case \"ClassProperty\":\n case \"ClassPrivateProperty\":\n return FIELD;\n case \"ClassAccessorProperty\":\n return ACCESSOR;\n case \"ClassMethod\":\n case \"ClassPrivateMethod\":\n if (element.node.kind === \"get\") {\n return GETTER;\n } else if (element.node.kind === \"set\") {\n return SETTER;\n } else {\n return METHOD;\n }\n }\n}\n\n// Information about the decorators applied to an element\ninterface DecoratorInfo {\n // The expressions of the decorators themselves\n decorators: t.Expression[];\n decoratorsThis: t.Expression[];\n\n // The kind of the decorated value, matches the kind value passed to applyDecs\n kind: number;\n\n // whether or not the field is static\n isStatic: boolean;\n\n // The name of the decorator\n name: t.StringLiteral | t.Expression;\n\n privateMethods:\n | (t.FunctionExpression | t.ArrowFunctionExpression)[]\n | undefined;\n\n // The names of local variables that will be used/returned from the decoration\n locals: t.Identifier | t.Identifier[] | undefined;\n}\n\n// Information about a computed property key. These must be evaluated\n// interspersed with decorator expressions, which is why they get added to the\n// array of DecoratorInfos later on.\ninterface ComputedPropInfo {\n localComputedNameId: t.Identifier;\n keyNode: t.Expression;\n}\n\nfunction isDecoratorInfo(\n info: DecoratorInfo | ComputedPropInfo,\n): info is DecoratorInfo {\n return \"decorators\" in info;\n}\n\nfunction filteredOrderedDecoratorInfo(\n info: (DecoratorInfo | ComputedPropInfo)[],\n): DecoratorInfo[] {\n const filtered = info.filter(isDecoratorInfo);\n\n return [\n ...filtered.filter(\n el => el.isStatic && el.kind >= ACCESSOR && el.kind <= SETTER,\n ),\n ...filtered.filter(\n el => !el.isStatic && el.kind >= ACCESSOR && el.kind <= SETTER,\n ),\n ...filtered.filter(el => el.isStatic && el.kind === FIELD),\n ...filtered.filter(el => !el.isStatic && el.kind === FIELD),\n ];\n}\n\nfunction generateDecorationList(\n decorators: t.Expression[],\n decoratorsThis: (t.Expression | null)[],\n version: DecoratorVersionKind,\n) {\n const decsCount = decorators.length;\n const hasOneThis = decoratorsThis.some(Boolean);\n const decs: t.Expression[] = [];\n for (let i = 0; i < decsCount; i++) {\n if (version === \"2023-05\" && hasOneThis) {\n decs.push(\n decoratorsThis[i] || t.unaryExpression(\"void\", t.numericLiteral(0)),\n );\n }\n decs.push(decorators[i]);\n }\n\n return { hasThis: hasOneThis, decs };\n}\n\nfunction generateDecorationExprs(\n info: (DecoratorInfo | ComputedPropInfo)[],\n version: DecoratorVersionKind,\n): t.ArrayExpression {\n return t.arrayExpression(\n filteredOrderedDecoratorInfo(info).map(el => {\n const { decs, hasThis } = generateDecorationList(\n el.decorators,\n el.decoratorsThis,\n version,\n );\n\n let flag = el.kind;\n if (el.isStatic) {\n flag += version === \"2023-05\" ? STATIC : STATIC_OLD_VERSION;\n }\n if (hasThis) flag += DECORATORS_HAVE_THIS;\n\n return t.arrayExpression([\n decs.length === 1 ? decs[0] : t.arrayExpression(decs),\n t.numericLiteral(flag),\n el.name,\n ...(el.privateMethods || []),\n ]);\n }),\n );\n}\n\nfunction extractElementLocalAssignments(\n decorationInfo: (DecoratorInfo | ComputedPropInfo)[],\n) {\n const localIds: t.Identifier[] = [];\n\n for (const el of filteredOrderedDecoratorInfo(decorationInfo)) {\n const { locals } = el;\n\n if (Array.isArray(locals)) {\n localIds.push(...locals);\n } else if (locals !== undefined) {\n localIds.push(locals);\n }\n }\n\n return localIds;\n}\n\nfunction addCallAccessorsFor(\n element: NodePath,\n key: t.PrivateName,\n getId: t.Identifier,\n setId: t.Identifier,\n) {\n element.insertAfter(\n t.classPrivateMethod(\n \"get\",\n t.cloneNode(key),\n [],\n t.blockStatement([\n t.returnStatement(\n t.callExpression(t.cloneNode(getId), [t.thisExpression()]),\n ),\n ]),\n ),\n );\n\n element.insertAfter(\n t.classPrivateMethod(\n \"set\",\n t.cloneNode(key),\n [t.identifier(\"v\")],\n t.blockStatement([\n t.expressionStatement(\n t.callExpression(t.cloneNode(setId), [\n t.thisExpression(),\n t.identifier(\"v\"),\n ]),\n ),\n ]),\n ),\n );\n}\n\nfunction isNotTsParameter(\n node: t.Identifier | t.Pattern | t.RestElement | t.TSParameterProperty,\n): node is t.Identifier | t.Pattern | t.RestElement {\n return node.type !== \"TSParameterProperty\";\n}\n\nfunction movePrivateAccessor(\n element: NodePath<t.ClassPrivateMethod>,\n key: t.PrivateName,\n methodLocalVar: t.Identifier,\n isStatic: boolean,\n) {\n let params: (t.Identifier | t.RestElement)[];\n let block: t.Statement[];\n\n if (element.node.kind === \"set\") {\n params = [t.identifier(\"v\")];\n block = [\n t.expressionStatement(\n t.callExpression(methodLocalVar, [\n t.thisExpression(),\n t.identifier(\"v\"),\n ]),\n ),\n ];\n } else {\n params = [];\n block = [\n t.returnStatement(t.callExpression(methodLocalVar, [t.thisExpression()])),\n ];\n }\n\n element.replaceWith(\n t.classPrivateMethod(\n element.node.kind,\n t.cloneNode(key),\n params,\n t.blockStatement(block),\n isStatic,\n ),\n );\n}\n\nfunction isClassDecoratableElementPath(\n path: NodePath<ClassElement>,\n): path is NodePath<ClassDecoratableElement> {\n const { type } = path;\n\n return (\n type !== \"TSDeclareMethod\" &&\n type !== \"TSIndexSignature\" &&\n type !== \"StaticBlock\"\n );\n}\n\nfunction staticBlockToIIFE(block: t.StaticBlock) {\n return t.callExpression(\n t.arrowFunctionExpression([], t.blockStatement(block.body)),\n [],\n );\n}\n\nfunction maybeSequenceExpression(exprs: t.Expression[]) {\n if (exprs.length === 0) return t.unaryExpression(\"void\", t.numericLiteral(0));\n if (exprs.length === 1) return exprs[0];\n return t.sequenceExpression(exprs);\n}\n\nfunction transformClass(\n path: NodePath<t.ClassExpression | t.ClassDeclaration>,\n state: PluginPass,\n constantSuper: boolean,\n version: DecoratorVersionKind,\n): NodePath {\n const body = path.get(\"body.body\");\n\n const classDecorators = path.node.decorators;\n let hasElementDecorators = false;\n\n const generateClassPrivateUid = createLazyPrivateUidGeneratorForClass(path);\n\n // Iterate over the class to see if we need to decorate it, and also to\n // transform simple auto accessors which are not decorated\n for (const element of body) {\n if (!isClassDecoratableElementPath(element)) {\n continue;\n }\n\n if (element.node.decorators && element.node.decorators.length > 0) {\n hasElementDecorators = true;\n } else if (element.node.type === \"ClassAccessorProperty\") {\n const { key, value, static: isStatic, computed } = element.node;\n\n const newId = generateClassPrivateUid();\n\n const valueNode = value ? t.cloneNode(value) : undefined;\n\n const newField = generateClassProperty(newId, valueNode, isStatic);\n\n const [newPath] = element.replaceWith(newField);\n addProxyAccessorsFor(\n path.node.id,\n newPath,\n key,\n newId,\n version,\n computed,\n );\n }\n }\n\n // If nothing is decorated, return\n if (!classDecorators && !hasElementDecorators) return;\n\n const elementDecoratorInfo: (DecoratorInfo | ComputedPropInfo)[] = [];\n\n // The initializer of the first non-static field will be injected with the protoInit call\n let firstFieldPath:\n | NodePath<t.ClassProperty | t.ClassPrivateProperty>\n | undefined;\n let constructorPath: NodePath<t.ClassMethod> | undefined;\n let requiresProtoInit = false;\n let requiresStaticInit = false;\n const decoratedPrivateMethods = new Set<string>();\n\n let protoInitLocal: t.Identifier,\n staticInitLocal: t.Identifier,\n classInitLocal: t.Identifier,\n classIdLocal: t.Identifier;\n const assignments: t.AssignmentExpression[] = [];\n const scopeParent: Scope = path.scope.parent;\n\n const memoiseExpression = (expression: t.Expression, hint: string) => {\n const localEvaluatedId = scopeParent.generateDeclaredUidIdentifier(hint);\n assignments.push(t.assignmentExpression(\"=\", localEvaluatedId, expression));\n return t.cloneNode(localEvaluatedId);\n };\n\n const decoratorsThis = new Map<t.Decorator, t.Expression>();\n const maybeExtractDecorator = (decorator: t.Decorator) => {\n const { expression } = decorator;\n if (version === \"2023-05\" && t.isMemberExpression(expression)) {\n let object;\n if (\n t.isSuper(expression.object) ||\n t.isThisExpression(expression.object)\n ) {\n object = memoiseExpression(t.thisExpression(), \"obj\");\n } else if (!scopeParent.isStatic(expression.object)) {\n object = memoiseExpression(expression.object, \"obj\");\n expression.object = object;\n } else {\n object = expression.object;\n }\n decoratorsThis.set(decorator, t.cloneNode(object));\n }\n if (!scopeParent.isStatic(expression)) {\n decorator.expression = memoiseExpression(expression, \"dec\");\n }\n };\n\n let needsDeclaraionForClassBinding = false;\n if (classDecorators) {\n classInitLocal = scopeParent.generateDeclaredUidIdentifier(\"initClass\");\n\n ({\n id: classIdLocal,\n path,\n needsDeclaration: needsDeclaraionForClassBinding,\n } = replaceClassWithVar(path));\n\n path.node.decorators = null;\n\n for (const classDecorator of classDecorators) {\n maybeExtractDecorator(classDecorator);\n }\n } else {\n if (!path.node.id) {\n path.node.id = path.scope.generateUidIdentifier(\"Class\");\n }\n classIdLocal = t.cloneNode(path.node.id);\n }\n\n let lastInstancePrivateName: t.PrivateName;\n let needsInstancePrivateBrandCheck = false;\n\n if (hasElementDecorators) {\n for (const element of body) {\n if (!isClassDecoratableElementPath(element)) {\n continue;\n }\n\n const { node } = element;\n const decorators = element.get(\"decorators\");\n\n const hasDecorators = Array.isArray(decorators) && decorators.length > 0;\n\n if (hasDecorators) {\n for (const decoratorPath of decorators) {\n maybeExtractDecorator(decoratorPath.node);\n }\n }\n\n const isComputed =\n \"computed\" in element.node && element.node.computed === true;\n if (isComputed) {\n if (!scopeParent.isStatic(node.key)) {\n node.key = memoiseExpression(node.key as t.Expression, \"computedKey\");\n }\n }\n\n const kind = getElementKind(element);\n const { key } = node;\n\n const isPrivate = key.type === \"PrivateName\";\n\n const isStatic = !!element.node.static;\n\n let name = \"computedKey\";\n\n if (isPrivate) {\n name = key.id.name;\n } else if (!isComputed && key.type === \"Identifier\") {\n name = key.name;\n }\n\n if (isPrivate && !isStatic) {\n if (hasDecorators) {\n needsInstancePrivateBrandCheck = true;\n }\n if (t.isClassPrivateProperty(node) || !lastInstancePrivateName) {\n lastInstancePrivateName = key;\n }\n }\n\n if (element.isClassMethod({ kind: \"constructor\" })) {\n constructorPath = element;\n }\n\n if (hasDecorators) {\n let locals: t.Identifier | t.Identifier[];\n let privateMethods: Array<\n t.FunctionExpression | t.ArrowFunctionExpression\n >;\n\n if (kind === ACCESSOR) {\n const { value } = element.node as t.ClassAccessorProperty;\n\n const params: t.Expression[] = [t.thisExpression()];\n\n if (value) {\n params.push(t.cloneNode(value));\n }\n\n const newId = generateClassPrivateUid();\n const newFieldInitId =\n element.scope.parent.generateDeclaredUidIdentifier(`init_${name}`);\n const newValue = t.callExpression(\n t.cloneNode(newFieldInitId),\n params,\n );\n\n const newField = generateClassProperty(newId, newValue, isStatic);\n const [newPath] = element.replaceWith(newField);\n\n if (isPrivate) {\n privateMethods = extractProxyAccessorsFor(newId, version);\n\n const getId = newPath.scope.parent.generateDeclaredUidIdentifier(\n `get_${name}`,\n );\n const setId = newPath.scope.parent.generateDeclaredUidIdentifier(\n `set_${name}`,\n );\n\n addCallAccessorsFor(newPath, key, getId, setId);\n\n locals = [newFieldInitId, getId, setId];\n } else {\n addProxyAccessorsFor(\n path.node.id,\n newPath,\n key,\n newId,\n version,\n isComputed,\n );\n locals = newFieldInitId;\n }\n } else if (kind === FIELD) {\n const initId = element.scope.parent.generateDeclaredUidIdentifier(\n `init_${name}`,\n );\n const valuePath = (\n element as NodePath<t.ClassProperty | t.ClassPrivateProperty>\n ).get(\"value\");\n\n valuePath.replaceWith(\n t.callExpression(\n t.cloneNode(initId),\n [t.thisExpression(), valuePath.node].filter(v => v),\n ),\n );\n\n locals = initId;\n\n if (isPrivate) {\n privateMethods = extractProxyAccessorsFor(key, version);\n }\n } else if (isPrivate) {\n locals = element.scope.parent.generateDeclaredUidIdentifier(\n `call_${name}`,\n );\n\n const replaceSupers = new ReplaceSupers({\n constantSuper,\n methodPath: element as NodePath<t.ClassPrivateMethod>,\n objectRef: classIdLocal,\n superRef: path.node.superClass,\n file: state.file,\n refToPreserve: classIdLocal,\n });\n\n replaceSupers.replace();\n\n const {\n params,\n body,\n async: isAsync,\n } = element.node as t.ClassPrivateMethod;\n\n privateMethods = [\n t.functionExpression(\n undefined,\n params.filter(isNotTsParameter),\n body,\n isAsync,\n ),\n ];\n\n if (kind === GETTER || kind === SETTER) {\n movePrivateAccessor(\n element as NodePath<t.ClassPrivateMethod>,\n t.cloneNode(key),\n t.cloneNode(locals),\n isStatic,\n );\n } else {\n const node = element.node as t.ClassPrivateMethod;\n\n // Unshift\n path.node.body.body.unshift(\n t.classPrivateProperty(key, t.cloneNode(locals), [], node.static),\n );\n\n decoratedPrivateMethods.add(key.id.name);\n\n element.remove();\n }\n }\n\n let nameExpr: t.Expression;\n\n if (isComputed) {\n nameExpr = t.cloneNode(key as t.Expression);\n } else if (key.type === \"PrivateName\") {\n nameExpr = t.stringLiteral(key.id.name);\n } else if (key.type === \"Identifier\") {\n nameExpr = t.stringLiteral(key.name);\n } else {\n nameExpr = t.cloneNode(key as t.Expression);\n }\n\n elementDecoratorInfo.push({\n kind,\n decorators: decorators.map(d => d.node.expression),\n decoratorsThis: decorators.map(d => decoratorsThis.get(d.node)),\n name: nameExpr,\n isStatic,\n privateMethods,\n locals,\n });\n\n if (kind !== FIELD) {\n if (isStatic) {\n requiresStaticInit = true;\n } else {\n requiresProtoInit = true;\n }\n }\n\n if (element.node) {\n element.node.decorators = null;\n }\n\n if (\n !firstFieldPath &&\n !isStatic &&\n (kind === FIELD || kind === ACCESSOR)\n ) {\n firstFieldPath = element as NodePath<\n t.ClassProperty | t.ClassPrivateProperty\n >;\n }\n }\n }\n }\n\n const elementDecorations = generateDecorationExprs(\n elementDecoratorInfo,\n version,\n );\n let classDecorationsFlag = 0;\n let classDecorations: t.Expression[] = [];\n if (classDecorators) {\n const { hasThis, decs } = generateDecorationList(\n classDecorators.map(el => el.expression),\n classDecorators.map(dec => decoratorsThis.get(dec)),\n version,\n );\n classDecorationsFlag = hasThis ? 1 : 0;\n classDecorations = decs;\n }\n\n const elementLocals: t.Identifier[] =\n extractElementLocalAssignments(elementDecoratorInfo);\n\n if (requiresProtoInit) {\n protoInitLocal = scopeParent.generateDeclaredUidIdentifier(\"initProto\");\n elementLocals.push(protoInitLocal);\n\n const protoInitCall = t.callExpression(t.cloneNode(protoInitLocal), [\n t.thisExpression(),\n ]);\n\n if (firstFieldPath) {\n const value = firstFieldPath.get(\"value\");\n const body: t.Expression[] = [protoInitCall];\n\n if (value.node) {\n body.push(value.node);\n }\n\n value.replaceWith(t.sequenceExpression(body));\n } else if (constructorPath) {\n if (path.node.superClass) {\n path.traverse({\n CallExpression: {\n exit(path) {\n if (!path.get(\"callee\").isSuper()) return;\n\n path.replaceWith(\n t.callExpression(t.cloneNode(protoInitLocal), [path.node]),\n );\n\n path.skip();\n },\n },\n });\n } else {\n constructorPath.node.body.body.unshift(\n t.expressionStatement(protoInitCall),\n );\n }\n } else {\n const body: t.Statement[] = [t.expressionStatement(protoInitCall)];\n\n if (path.node.superClass) {\n body.unshift(\n t.expressionStatement(\n t.callExpression(t.super(), [\n t.spreadElement(t.identifier(\"args\")),\n ]),\n ),\n );\n }\n\n path.node.body.body.unshift(\n t.classMethod(\n \"constructor\",\n t.identifier(\"constructor\"),\n [t.restElement(t.identifier(\"args\"))],\n t.blockStatement(body),\n ),\n );\n }\n }\n\n if (requiresStaticInit) {\n staticInitLocal = scopeParent.generateDeclaredUidIdentifier(\"initStatic\");\n elementLocals.push(staticInitLocal);\n }\n\n if (decoratedPrivateMethods.size > 0) {\n path.traverse({\n PrivateName(path) {\n if (!decoratedPrivateMethods.has(path.node.id.name)) return;\n\n const parentPath = path.parentPath;\n const parentParentPath = parentPath.parentPath;\n\n if (\n // this.bar().#x = 123;\n (parentParentPath.node.type === \"AssignmentExpression\" &&\n parentParentPath.node.left === parentPath.node) ||\n // this.#x++;\n parentParentPath.node.type === \"UpdateExpression\" ||\n // ([...this.#x] = foo);\n parentParentPath.node.type === \"RestElement\" ||\n // ([this.#x] = foo);\n parentParentPath.node.type === \"ArrayPattern\" ||\n // ({ a: this.#x } = bar);\n (parentParentPath.node.type === \"ObjectProperty\" &&\n parentParentPath.node.value === parentPath.node &&\n parentParentPath.parentPath.type === \"ObjectPattern\") ||\n // for (this.#x of []);\n (parentParentPath.node.type === \"ForOfStatement\" &&\n parentParentPath.node.left === parentPath.node)\n ) {\n throw path.buildCodeFrameError(\n `Decorated private methods are not updatable, but \"#${path.node.id.name}\" is updated via this expression.`,\n );\n }\n },\n });\n }\n\n const classLocals: t.Identifier[] = [];\n let classInitInjected = false;\n const classInitCall =\n classInitLocal && t.callExpression(t.cloneNode(classInitLocal), []);\n\n const originalClass = path.node;\n\n if (classDecorators) {\n classLocals.push(classIdLocal, classInitLocal);\n const statics: (\n | t.ClassProperty\n | t.ClassPrivateProperty\n | t.ClassPrivateMethod\n )[] = [];\n let staticBlocks: t.StaticBlock[] = [];\n path.get(\"body.body\").forEach(element => {\n // Static blocks cannot be compiled to \"instance blocks\", but we can inline\n // them as IIFEs in the next property.\n if (element.isStaticBlock()) {\n staticBlocks.push(element.node);\n element.remove();\n return;\n }\n\n const isProperty =\n element.isClassProperty() || element.isClassPrivateProperty();\n\n if (\n (isProperty || element.isClassPrivateMethod()) &&\n element.node.static\n ) {\n if (isProperty && staticBlocks.length > 0) {\n const allValues: t.Expression[] = staticBlocks.map(staticBlockToIIFE);\n if (element.node.value) allValues.push(element.node.value);\n element.node.value = maybeSequenceExpression(allValues);\n staticBlocks = [];\n }\n\n element.node.static = false;\n statics.push(element.node);\n element.remove();\n }\n });\n\n if (statics.length > 0 || staticBlocks.length > 0) {\n const staticsClass = template.expression.ast`\n class extends ${state.addHelper(\"identity\")} {}\n ` as t.ClassExpression;\n staticsClass.body.body = [\n t.staticBlock([\n t.toStatement(originalClass, true) ||\n // If toStatement returns false, originalClass must be an anonymous ClassExpression,\n // because `export default @dec ...` has been handled in the export visitor before.\n t.expressionStatement(originalClass as t.ClassExpression),\n ]),\n ...statics,\n ];\n\n const constructorBody: t.Expression[] = [];\n\n const newExpr = t.newExpression(staticsClass, []);\n\n if (staticBlocks.length > 0) {\n constructorBody.push(...staticBlocks.map(staticBlockToIIFE));\n }\n if (classInitCall) {\n classInitInjected = true;\n constructorBody.push(classInitCall);\n }\n if (constructorBody.length > 0) {\n constructorBody.unshift(\n t.callExpression(t.super(), [t.cloneNode(classIdLocal)]),\n );\n\n staticsClass.body.body.push(\n t.classMethod(\n \"constructor\",\n t.identifier(\"constructor\"),\n [],\n t.blockStatement([\n t.expressionStatement(t.sequenceExpression(constructorBody)),\n ]),\n ),\n );\n } else {\n newExpr.arguments.push(t.cloneNode(classIdLocal));\n }\n\n path.replaceWith(newExpr);\n }\n }\n if (!classInitInjected && classInitCall) {\n path.node.body.body.push(\n t.staticBlock([t.expressionStatement(classInitCall)]),\n );\n }\n\n let { superClass } = originalClass;\n if (superClass && (process.env.BABEL_8_BREAKING || version === \"2023-05\")) {\n const id = path.scope.maybeGenerateMemoised(superClass);\n if (id) {\n originalClass.superClass = t.assignmentExpression(\"=\", id, superClass);\n superClass = id;\n }\n }\n\n originalClass.body.body.unshift(\n t.staticBlock(\n [\n t.expressionStatement(\n createLocalsAssignment(\n elementLocals,\n classLocals,\n elementDecorations,\n t.arrayExpression(classDecorations),\n t.numericLiteral(classDecorationsFlag),\n needsInstancePrivateBrandCheck ? lastInstancePrivateName : null,\n t.cloneNode(superClass),\n state,\n version,\n ),\n ),\n requiresStaticInit &&\n t.expressionStatement(\n t.callExpression(t.cloneNode(staticInitLocal), [\n t.thisExpression(),\n ]),\n ),\n ].filter(Boolean),\n ),\n );\n\n // When path is a ClassExpression, path.insertBefore will convert `path`\n // into a SequenceExpression\n path.insertBefore(assignments.map(expr => t.expressionStatement(expr)));\n\n if (needsDeclaraionForClassBinding) {\n path.insertBefore(\n t.variableDeclaration(\"let\", [\n t.variableDeclarator(t.cloneNode(classIdLocal)),\n ]),\n );\n }\n\n // Recrawl the scope to make sure new identifiers are properly synced\n path.scope.crawl();\n\n return path;\n}\n\nfunction createLocalsAssignment(\n elementLocals: t.Identifier[],\n classLocals: t.Identifier[],\n elementDecorations: t.ArrayExpression,\n classDecorations: t.ArrayExpression,\n classDecorationsFlag: t.NumericLiteral,\n maybePrivateBranName: t.PrivateName | null,\n superClass: null | t.Expression,\n state: PluginPass,\n version: DecoratorVersionKind,\n) {\n let lhs, rhs;\n const args: t.Expression[] = [\n t.thisExpression(),\n elementDecorations,\n classDecorations,\n ];\n\n if (!process.env.BABEL_8_BREAKING) {\n if (\n version === \"2021-12\" ||\n (version === \"2022-03\" && !state.availableHelper(\"applyDecs2203R\"))\n ) {\n const lhs = t.arrayPattern([...elementLocals, ...classLocals]);\n const rhs = t.callExpression(\n state.addHelper(version === \"2021-12\" ? \"applyDecs\" : \"applyDecs2203\"),\n args,\n );\n return t.assignmentExpression(\"=\", lhs, rhs);\n }\n }\n\n if (process.env.BABEL_8_BREAKING || version === \"2023-05\") {\n if (\n maybePrivateBranName ||\n superClass ||\n classDecorationsFlag.value !== 0\n ) {\n args.push(classDecorationsFlag);\n }\n if (maybePrivateBranName) {\n args.push(\n template.expression.ast`\n _ => ${t.cloneNode(maybePrivateBranName)} in _\n ` as t.ArrowFunctionExpression,\n );\n } else if (superClass) {\n args.push(t.unaryExpression(\"void\", t.numericLiteral(0)));\n }\n if (superClass) args.push(superClass);\n rhs = t.callExpression(state.addHelper(\"applyDecs2305\"), args);\n } else if (version === \"2023-01\") {\n if (maybePrivateBranName) {\n args.push(\n template.expression.ast`\n _ => ${t.cloneNode(maybePrivateBranName)} in _\n ` as t.ArrowFunctionExpression,\n );\n }\n rhs = t.callExpression(state.addHelper(\"applyDecs2301\"), args);\n } else {\n rhs = t.callExpression(state.addHelper(\"applyDecs2203R\"), args);\n }\n // optimize `{ c: [classLocals] } = applyapplyDecs2203R(...)` to\n // `[classLocals] = applyapplyDecs2203R(...).c`\n if (elementLocals.length > 0) {\n if (classLocals.length > 0) {\n lhs = t.objectPattern([\n t.objectProperty(t.identifier(\"e\"), t.arrayPattern(elementLocals)),\n t.objectProperty(t.identifier(\"c\"), t.arrayPattern(classLocals)),\n ]);\n } else {\n lhs = t.arrayPattern(elementLocals);\n rhs = t.memberExpression(rhs, t.identifier(\"e\"), false, false);\n }\n } else {\n // invariant: classLocals.length > 0\n lhs = t.arrayPattern(classLocals);\n rhs = t.memberExpression(rhs, t.identifier(\"c\"), false, false);\n }\n\n return t.assignmentExpression(\"=\", lhs, rhs);\n}\n\nexport default function (\n { assertVersion, assumption }: PluginAPI,\n { loose }: Options,\n // TODO(Babel 8): Only keep 2023-05\n version: \"2023-05\" | \"2023-01\" | \"2022-03\" | \"2021-12\",\n): PluginObject {\n if (process.env.BABEL_8_BREAKING) {\n assertVersion(process.env.IS_PUBLISH ? PACKAGE_JSON.version : \"^7.21.0\");\n } else {\n if (version === \"2023-05\" || version === \"2023-01\") {\n assertVersion(\"^7.21.0\");\n } else if (version === \"2021-12\") {\n assertVersion(\"^7.16.0\");\n } else {\n assertVersion(\"^7.19.0\");\n }\n }\n\n const VISITED = new WeakSet<NodePath>();\n const constantSuper = assumption(\"constantSuper\") ?? loose;\n\n return {\n name: \"proposal-decorators\",\n inherits: syntaxDecorators,\n\n visitor: {\n \"ExportNamedDeclaration|ExportDefaultDeclaration\"(\n path: NodePath<t.ExportNamedDeclaration | t.ExportDefaultDeclaration>,\n ) {\n const { declaration } = path.node;\n if (\n declaration?.type === \"ClassDeclaration\" &&\n // When compiling class decorators we need to replace the class\n // binding, so we must split it in two separate declarations.\n declaration.decorators?.length > 0\n ) {\n splitExportDeclaration(path);\n }\n },\n\n Class(path, state) {\n if (VISITED.has(path)) return;\n\n const newPath = transformClass(path, state, constantSuper, version);\n if (newPath) VISITED.add(newPath);\n },\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,6BAAA,GAAAH,OAAA;AAoBA,SAASI,WAAWA,CAACC,EAAY,EAAEC,GAAG,GAAGD,EAAE,CAACE,MAAM,GAAG,CAAC,EAAQ;EAE5D,IAAID,GAAG,KAAK,CAAC,CAAC,EAAE;IACdD,EAAE,CAACG,OAAO,GAAqB,CAAC;IAChC;EACF;EAEA,MAAMC,OAAO,GAAGJ,EAAE,CAACC,GAAG,CAAC;EAEvB,IAAIG,OAAO,OAAyB,EAAE;IAEpCJ,EAAE,CAACC,GAAG,CAAC,KAAuB;EAChC,CAAC,MAAM,IAAIG,OAAO,QAAyB,EAAE;IAE3CJ,EAAE,CAACC,GAAG,CAAC,KAAuB;IA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