@babel/plugin-proposal-decorators 7.23.6 → 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 +5 -5
- package/lib/index.js.map +1 -1
- package/package.json +5 -10
- package/lib/transformer-2023-05.js +0 -885
- package/lib/transformer-2023-05.js.map +0 -1
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","
|
|
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.
|
|
3
|
+
"version": "7.23.7",
|
|
4
4
|
"author": "The Babel Team (https://babel.dev/team)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,24 +20,19 @@
|
|
|
20
20
|
"decorators"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@babel/helper-create-class-features-plugin": "^7.23.
|
|
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-skip-transparent-expression-wrappers": "^7.22.5",
|
|
27
|
-
"@babel/helper-split-export-declaration": "^7.22.6",
|
|
28
25
|
"@babel/plugin-syntax-decorators": "^7.23.3"
|
|
29
26
|
},
|
|
30
27
|
"peerDependencies": {
|
|
31
28
|
"@babel/core": "^7.0.0-0"
|
|
32
29
|
},
|
|
33
30
|
"devDependencies": {
|
|
34
|
-
"@babel/core": "^7.23.
|
|
31
|
+
"@babel/core": "^7.23.7",
|
|
35
32
|
"@babel/helper-plugin-test-runner": "^7.22.5",
|
|
36
|
-
"@babel/traverse": "^7.23.
|
|
37
|
-
"@types/charcodes": "^0.2.0",
|
|
33
|
+
"@babel/traverse": "^7.23.7",
|
|
38
34
|
"array.prototype.concat": "^1.0.2",
|
|
39
|
-
"babel-plugin-polyfill-es-shims": "^0.10.
|
|
40
|
-
"charcodes": "^0.2.0",
|
|
35
|
+
"babel-plugin-polyfill-es-shims": "^0.10.1",
|
|
41
36
|
"object.getownpropertydescriptors": "^2.1.1"
|
|
42
37
|
},
|
|
43
38
|
"engines": {
|
|
@@ -1,885 +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
|
-
var _helperSkipTransparentExpressionWrappers = require("@babel/helper-skip-transparent-expression-wrappers");
|
|
12
|
-
function incrementId(id, idx = id.length - 1) {
|
|
13
|
-
if (idx === -1) {
|
|
14
|
-
id.unshift(65);
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const current = id[idx];
|
|
18
|
-
if (current === 90) {
|
|
19
|
-
id[idx] = 97;
|
|
20
|
-
} else if (current === 122) {
|
|
21
|
-
id[idx] = 65;
|
|
22
|
-
incrementId(id, idx - 1);
|
|
23
|
-
} else {
|
|
24
|
-
id[idx] = current + 1;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function createPrivateUidGeneratorForClass(classPath) {
|
|
28
|
-
const currentPrivateId = [];
|
|
29
|
-
const privateNames = new Set();
|
|
30
|
-
classPath.traverse({
|
|
31
|
-
PrivateName(path) {
|
|
32
|
-
privateNames.add(path.node.id.name);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
return () => {
|
|
36
|
-
let reifiedId;
|
|
37
|
-
do {
|
|
38
|
-
incrementId(currentPrivateId);
|
|
39
|
-
reifiedId = String.fromCharCode(...currentPrivateId);
|
|
40
|
-
} while (privateNames.has(reifiedId));
|
|
41
|
-
return _core.types.privateName(_core.types.identifier(reifiedId));
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
function createLazyPrivateUidGeneratorForClass(classPath) {
|
|
45
|
-
let generator;
|
|
46
|
-
return () => {
|
|
47
|
-
if (!generator) {
|
|
48
|
-
generator = createPrivateUidGeneratorForClass(classPath);
|
|
49
|
-
}
|
|
50
|
-
return generator();
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function replaceClassWithVar(path, className) {
|
|
54
|
-
if (path.type === "ClassDeclaration") {
|
|
55
|
-
const id = path.node.id;
|
|
56
|
-
const className = id.name;
|
|
57
|
-
const varId = path.scope.generateUidIdentifierBasedOnNode(id);
|
|
58
|
-
const classId = _core.types.identifier(className);
|
|
59
|
-
path.scope.rename(className, varId.name);
|
|
60
|
-
path.get("id").replaceWith(classId);
|
|
61
|
-
return {
|
|
62
|
-
id: _core.types.cloneNode(varId),
|
|
63
|
-
path
|
|
64
|
-
};
|
|
65
|
-
} else {
|
|
66
|
-
let varId;
|
|
67
|
-
if (path.node.id) {
|
|
68
|
-
className = path.node.id.name;
|
|
69
|
-
varId = path.scope.parent.generateDeclaredUidIdentifier(className);
|
|
70
|
-
path.scope.rename(className, varId.name);
|
|
71
|
-
} else {
|
|
72
|
-
varId = path.scope.parent.generateDeclaredUidIdentifier(typeof className === "string" ? className : "decorated_class");
|
|
73
|
-
}
|
|
74
|
-
const newClassExpr = _core.types.classExpression(typeof className === "string" ? _core.types.identifier(className) : null, path.node.superClass, path.node.body);
|
|
75
|
-
const [newPath] = path.replaceWith(_core.types.sequenceExpression([newClassExpr, varId]));
|
|
76
|
-
return {
|
|
77
|
-
id: _core.types.cloneNode(varId),
|
|
78
|
-
path: newPath.get("expressions.0")
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function generateClassProperty(key, value, isStatic) {
|
|
83
|
-
if (key.type === "PrivateName") {
|
|
84
|
-
return _core.types.classPrivateProperty(key, value, undefined, isStatic);
|
|
85
|
-
} else {
|
|
86
|
-
return _core.types.classProperty(key, value, undefined, undefined, isStatic);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
function addProxyAccessorsFor(className, element, originalKey, targetKey, version, isComputed = false) {
|
|
90
|
-
const {
|
|
91
|
-
static: isStatic
|
|
92
|
-
} = element.node;
|
|
93
|
-
const thisArg = version === "2023-05" && isStatic ? className : _core.types.thisExpression();
|
|
94
|
-
const getterBody = _core.types.blockStatement([_core.types.returnStatement(_core.types.memberExpression(_core.types.cloneNode(thisArg), _core.types.cloneNode(targetKey)))]);
|
|
95
|
-
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")))]);
|
|
96
|
-
let getter, setter;
|
|
97
|
-
if (originalKey.type === "PrivateName") {
|
|
98
|
-
getter = _core.types.classPrivateMethod("get", _core.types.cloneNode(originalKey), [], getterBody, isStatic);
|
|
99
|
-
setter = _core.types.classPrivateMethod("set", _core.types.cloneNode(originalKey), [_core.types.identifier("v")], setterBody, isStatic);
|
|
100
|
-
} else {
|
|
101
|
-
getter = _core.types.classMethod("get", _core.types.cloneNode(originalKey), [], getterBody, isComputed, isStatic);
|
|
102
|
-
setter = _core.types.classMethod("set", _core.types.cloneNode(originalKey), [_core.types.identifier("v")], setterBody, isComputed, isStatic);
|
|
103
|
-
}
|
|
104
|
-
element.insertAfter(setter);
|
|
105
|
-
element.insertAfter(getter);
|
|
106
|
-
}
|
|
107
|
-
function extractProxyAccessorsFor(targetKey, version) {
|
|
108
|
-
if (version !== "2023-05" && version !== "2023-01") {
|
|
109
|
-
return [_core.template.expression.ast`
|
|
110
|
-
function () {
|
|
111
|
-
return this.${_core.types.cloneNode(targetKey)};
|
|
112
|
-
}
|
|
113
|
-
`, _core.template.expression.ast`
|
|
114
|
-
function (value) {
|
|
115
|
-
this.${_core.types.cloneNode(targetKey)} = value;
|
|
116
|
-
}
|
|
117
|
-
`];
|
|
118
|
-
}
|
|
119
|
-
return [_core.template.expression.ast`
|
|
120
|
-
o => o.${_core.types.cloneNode(targetKey)}
|
|
121
|
-
`, _core.template.expression.ast`
|
|
122
|
-
(o, v) => o.${_core.types.cloneNode(targetKey)} = v
|
|
123
|
-
`];
|
|
124
|
-
}
|
|
125
|
-
const FIELD = 0;
|
|
126
|
-
const ACCESSOR = 1;
|
|
127
|
-
const METHOD = 2;
|
|
128
|
-
const GETTER = 3;
|
|
129
|
-
const SETTER = 4;
|
|
130
|
-
const STATIC_OLD_VERSION = 5;
|
|
131
|
-
const STATIC = 8;
|
|
132
|
-
const DECORATORS_HAVE_THIS = 16;
|
|
133
|
-
function getElementKind(element) {
|
|
134
|
-
switch (element.node.type) {
|
|
135
|
-
case "ClassProperty":
|
|
136
|
-
case "ClassPrivateProperty":
|
|
137
|
-
return FIELD;
|
|
138
|
-
case "ClassAccessorProperty":
|
|
139
|
-
return ACCESSOR;
|
|
140
|
-
case "ClassMethod":
|
|
141
|
-
case "ClassPrivateMethod":
|
|
142
|
-
if (element.node.kind === "get") {
|
|
143
|
-
return GETTER;
|
|
144
|
-
} else if (element.node.kind === "set") {
|
|
145
|
-
return SETTER;
|
|
146
|
-
} else {
|
|
147
|
-
return METHOD;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
function isDecoratorInfo(info) {
|
|
152
|
-
return "decorators" in info;
|
|
153
|
-
}
|
|
154
|
-
function filteredOrderedDecoratorInfo(info) {
|
|
155
|
-
const filtered = info.filter(isDecoratorInfo);
|
|
156
|
-
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)];
|
|
157
|
-
}
|
|
158
|
-
function generateDecorationList(decorators, decoratorsThis, version) {
|
|
159
|
-
const decsCount = decorators.length;
|
|
160
|
-
const hasOneThis = decoratorsThis.some(Boolean);
|
|
161
|
-
const decs = [];
|
|
162
|
-
for (let i = 0; i < decsCount; i++) {
|
|
163
|
-
if (version === "2023-05" && hasOneThis) {
|
|
164
|
-
decs.push(decoratorsThis[i] || _core.types.unaryExpression("void", _core.types.numericLiteral(0)));
|
|
165
|
-
}
|
|
166
|
-
decs.push(decorators[i]);
|
|
167
|
-
}
|
|
168
|
-
return {
|
|
169
|
-
hasThis: hasOneThis,
|
|
170
|
-
decs
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
function generateDecorationExprs(info, version) {
|
|
174
|
-
return _core.types.arrayExpression(filteredOrderedDecoratorInfo(info).map(el => {
|
|
175
|
-
const {
|
|
176
|
-
decs,
|
|
177
|
-
hasThis
|
|
178
|
-
} = generateDecorationList(el.decorators, el.decoratorsThis, version);
|
|
179
|
-
let flag = el.kind;
|
|
180
|
-
if (el.isStatic) {
|
|
181
|
-
flag += version === "2023-05" ? STATIC : STATIC_OLD_VERSION;
|
|
182
|
-
}
|
|
183
|
-
if (hasThis) flag += DECORATORS_HAVE_THIS;
|
|
184
|
-
return _core.types.arrayExpression([decs.length === 1 ? decs[0] : _core.types.arrayExpression(decs), _core.types.numericLiteral(flag), el.name, ...(el.privateMethods || [])]);
|
|
185
|
-
}));
|
|
186
|
-
}
|
|
187
|
-
function extractElementLocalAssignments(decorationInfo) {
|
|
188
|
-
const localIds = [];
|
|
189
|
-
for (const el of filteredOrderedDecoratorInfo(decorationInfo)) {
|
|
190
|
-
const {
|
|
191
|
-
locals
|
|
192
|
-
} = el;
|
|
193
|
-
if (Array.isArray(locals)) {
|
|
194
|
-
localIds.push(...locals);
|
|
195
|
-
} else if (locals !== undefined) {
|
|
196
|
-
localIds.push(locals);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
return localIds;
|
|
200
|
-
}
|
|
201
|
-
function addCallAccessorsFor(element, key, getId, setId) {
|
|
202
|
-
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()]))])));
|
|
203
|
-
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")]))])));
|
|
204
|
-
}
|
|
205
|
-
function isNotTsParameter(node) {
|
|
206
|
-
return node.type !== "TSParameterProperty";
|
|
207
|
-
}
|
|
208
|
-
function movePrivateAccessor(element, key, methodLocalVar, isStatic) {
|
|
209
|
-
let params;
|
|
210
|
-
let block;
|
|
211
|
-
if (element.node.kind === "set") {
|
|
212
|
-
params = [_core.types.identifier("v")];
|
|
213
|
-
block = [_core.types.expressionStatement(_core.types.callExpression(methodLocalVar, [_core.types.thisExpression(), _core.types.identifier("v")]))];
|
|
214
|
-
} else {
|
|
215
|
-
params = [];
|
|
216
|
-
block = [_core.types.returnStatement(_core.types.callExpression(methodLocalVar, [_core.types.thisExpression()]))];
|
|
217
|
-
}
|
|
218
|
-
element.replaceWith(_core.types.classPrivateMethod(element.node.kind, _core.types.cloneNode(key), params, _core.types.blockStatement(block), isStatic));
|
|
219
|
-
}
|
|
220
|
-
function isClassDecoratableElementPath(path) {
|
|
221
|
-
const {
|
|
222
|
-
type
|
|
223
|
-
} = path;
|
|
224
|
-
return type !== "TSDeclareMethod" && type !== "TSIndexSignature" && type !== "StaticBlock";
|
|
225
|
-
}
|
|
226
|
-
function staticBlockToIIFE(block) {
|
|
227
|
-
return _core.types.callExpression(_core.types.arrowFunctionExpression([], _core.types.blockStatement(block.body)), []);
|
|
228
|
-
}
|
|
229
|
-
function maybeSequenceExpression(exprs) {
|
|
230
|
-
if (exprs.length === 0) return _core.types.unaryExpression("void", _core.types.numericLiteral(0));
|
|
231
|
-
if (exprs.length === 1) return exprs[0];
|
|
232
|
-
return _core.types.sequenceExpression(exprs);
|
|
233
|
-
}
|
|
234
|
-
function createSetFunctionNameCall(state, className) {
|
|
235
|
-
return _core.types.callExpression(state.addHelper("setFunctionName"), [_core.types.thisExpression(), className]);
|
|
236
|
-
}
|
|
237
|
-
function createToPropertyKeyCall(state, propertyKey) {
|
|
238
|
-
return _core.types.callExpression(state.addHelper("toPropertyKey"), [propertyKey]);
|
|
239
|
-
}
|
|
240
|
-
function transformClass(path, state, constantSuper, version, className, propertyVisitor) {
|
|
241
|
-
const body = path.get("body.body");
|
|
242
|
-
const classDecorators = path.node.decorators;
|
|
243
|
-
let hasElementDecorators = false;
|
|
244
|
-
const generateClassPrivateUid = createLazyPrivateUidGeneratorForClass(path);
|
|
245
|
-
const assignments = [];
|
|
246
|
-
const scopeParent = path.scope.parent;
|
|
247
|
-
const memoiseExpression = (expression, hint) => {
|
|
248
|
-
const localEvaluatedId = scopeParent.generateDeclaredUidIdentifier(hint);
|
|
249
|
-
assignments.push(_core.types.assignmentExpression("=", localEvaluatedId, expression));
|
|
250
|
-
return _core.types.cloneNode(localEvaluatedId);
|
|
251
|
-
};
|
|
252
|
-
for (const element of body) {
|
|
253
|
-
if (!isClassDecoratableElementPath(element)) {
|
|
254
|
-
continue;
|
|
255
|
-
}
|
|
256
|
-
if (element.node.decorators && element.node.decorators.length > 0) {
|
|
257
|
-
switch (element.node.type) {
|
|
258
|
-
case "ClassProperty":
|
|
259
|
-
propertyVisitor.ClassProperty(element, state);
|
|
260
|
-
break;
|
|
261
|
-
case "ClassPrivateProperty":
|
|
262
|
-
propertyVisitor.ClassPrivateProperty(element, state);
|
|
263
|
-
break;
|
|
264
|
-
case "ClassAccessorProperty":
|
|
265
|
-
propertyVisitor.ClassAccessorProperty(element, state);
|
|
266
|
-
break;
|
|
267
|
-
}
|
|
268
|
-
hasElementDecorators = true;
|
|
269
|
-
} else if (element.node.type === "ClassAccessorProperty") {
|
|
270
|
-
propertyVisitor.ClassAccessorProperty(element, state);
|
|
271
|
-
const {
|
|
272
|
-
key,
|
|
273
|
-
value,
|
|
274
|
-
static: isStatic,
|
|
275
|
-
computed
|
|
276
|
-
} = element.node;
|
|
277
|
-
const newId = generateClassPrivateUid();
|
|
278
|
-
const newField = generateClassProperty(newId, value, isStatic);
|
|
279
|
-
const keyPath = element.get("key");
|
|
280
|
-
const [newPath] = element.replaceWith(newField);
|
|
281
|
-
addProxyAccessorsFor(path.node.id, newPath, computed && !keyPath.isConstantExpression() ? memoiseExpression(createToPropertyKeyCall(state, key), "computedKey") : key, newId, version, computed);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
if (!classDecorators && !hasElementDecorators) {
|
|
285
|
-
if (assignments.length > 0) {
|
|
286
|
-
path.insertBefore(assignments.map(expr => _core.types.expressionStatement(expr)));
|
|
287
|
-
path.scope.crawl();
|
|
288
|
-
}
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
const elementDecoratorInfo = [];
|
|
292
|
-
let firstFieldPath;
|
|
293
|
-
let constructorPath;
|
|
294
|
-
let requiresProtoInit = false;
|
|
295
|
-
let requiresStaticInit = false;
|
|
296
|
-
const decoratedPrivateMethods = new Set();
|
|
297
|
-
let protoInitLocal, staticInitLocal, classInitLocal, classIdLocal;
|
|
298
|
-
const decoratorsThis = new Map();
|
|
299
|
-
const maybeExtractDecorator = decorator => {
|
|
300
|
-
const {
|
|
301
|
-
expression
|
|
302
|
-
} = decorator;
|
|
303
|
-
if (version === "2023-05" && _core.types.isMemberExpression(expression)) {
|
|
304
|
-
let object;
|
|
305
|
-
if (_core.types.isSuper(expression.object) || _core.types.isThisExpression(expression.object)) {
|
|
306
|
-
object = memoiseExpression(_core.types.thisExpression(), "obj");
|
|
307
|
-
} else if (!scopeParent.isStatic(expression.object)) {
|
|
308
|
-
object = memoiseExpression(expression.object, "obj");
|
|
309
|
-
expression.object = object;
|
|
310
|
-
} else {
|
|
311
|
-
object = expression.object;
|
|
312
|
-
}
|
|
313
|
-
decoratorsThis.set(decorator, _core.types.cloneNode(object));
|
|
314
|
-
}
|
|
315
|
-
if (!scopeParent.isStatic(expression)) {
|
|
316
|
-
decorator.expression = memoiseExpression(expression, "dec");
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
let needsDeclaraionForClassBinding = false;
|
|
320
|
-
if (classDecorators) {
|
|
321
|
-
classInitLocal = scopeParent.generateDeclaredUidIdentifier("initClass");
|
|
322
|
-
needsDeclaraionForClassBinding = path.isClassDeclaration();
|
|
323
|
-
({
|
|
324
|
-
id: classIdLocal,
|
|
325
|
-
path
|
|
326
|
-
} = replaceClassWithVar(path, className));
|
|
327
|
-
path.node.decorators = null;
|
|
328
|
-
for (const classDecorator of classDecorators) {
|
|
329
|
-
maybeExtractDecorator(classDecorator);
|
|
330
|
-
}
|
|
331
|
-
} else {
|
|
332
|
-
if (!path.node.id) {
|
|
333
|
-
path.node.id = path.scope.generateUidIdentifier("Class");
|
|
334
|
-
}
|
|
335
|
-
classIdLocal = _core.types.cloneNode(path.node.id);
|
|
336
|
-
}
|
|
337
|
-
let lastInstancePrivateName;
|
|
338
|
-
let needsInstancePrivateBrandCheck = false;
|
|
339
|
-
if (hasElementDecorators) {
|
|
340
|
-
for (const element of body) {
|
|
341
|
-
if (!isClassDecoratableElementPath(element)) {
|
|
342
|
-
continue;
|
|
343
|
-
}
|
|
344
|
-
const {
|
|
345
|
-
node
|
|
346
|
-
} = element;
|
|
347
|
-
const decorators = element.get("decorators");
|
|
348
|
-
const hasDecorators = Array.isArray(decorators) && decorators.length > 0;
|
|
349
|
-
if (hasDecorators) {
|
|
350
|
-
for (const decoratorPath of decorators) {
|
|
351
|
-
maybeExtractDecorator(decoratorPath.node);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
const isComputed = "computed" in element.node && element.node.computed === true;
|
|
355
|
-
if (isComputed) {
|
|
356
|
-
if (!element.get("key").isConstantExpression()) {
|
|
357
|
-
node.key = memoiseExpression(createToPropertyKeyCall(state, node.key), "computedKey");
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
const kind = getElementKind(element);
|
|
361
|
-
const {
|
|
362
|
-
key
|
|
363
|
-
} = node;
|
|
364
|
-
const isPrivate = key.type === "PrivateName";
|
|
365
|
-
const isStatic = !!element.node.static;
|
|
366
|
-
let name = "computedKey";
|
|
367
|
-
if (isPrivate) {
|
|
368
|
-
name = key.id.name;
|
|
369
|
-
} else if (!isComputed && key.type === "Identifier") {
|
|
370
|
-
name = key.name;
|
|
371
|
-
}
|
|
372
|
-
if (isPrivate && !isStatic) {
|
|
373
|
-
if (hasDecorators) {
|
|
374
|
-
needsInstancePrivateBrandCheck = true;
|
|
375
|
-
}
|
|
376
|
-
if (_core.types.isClassPrivateProperty(node) || !lastInstancePrivateName) {
|
|
377
|
-
lastInstancePrivateName = key;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
if (element.isClassMethod({
|
|
381
|
-
kind: "constructor"
|
|
382
|
-
})) {
|
|
383
|
-
constructorPath = element;
|
|
384
|
-
}
|
|
385
|
-
if (hasDecorators) {
|
|
386
|
-
let locals;
|
|
387
|
-
let privateMethods;
|
|
388
|
-
if (kind === ACCESSOR) {
|
|
389
|
-
const {
|
|
390
|
-
value
|
|
391
|
-
} = element.node;
|
|
392
|
-
const params = [_core.types.thisExpression()];
|
|
393
|
-
if (value) {
|
|
394
|
-
params.push(_core.types.cloneNode(value));
|
|
395
|
-
}
|
|
396
|
-
const newId = generateClassPrivateUid();
|
|
397
|
-
const newFieldInitId = element.scope.parent.generateDeclaredUidIdentifier(`init_${name}`);
|
|
398
|
-
const newValue = _core.types.callExpression(_core.types.cloneNode(newFieldInitId), params);
|
|
399
|
-
const newField = generateClassProperty(newId, newValue, isStatic);
|
|
400
|
-
const [newPath] = element.replaceWith(newField);
|
|
401
|
-
if (isPrivate) {
|
|
402
|
-
privateMethods = extractProxyAccessorsFor(newId, version);
|
|
403
|
-
const getId = newPath.scope.parent.generateDeclaredUidIdentifier(`get_${name}`);
|
|
404
|
-
const setId = newPath.scope.parent.generateDeclaredUidIdentifier(`set_${name}`);
|
|
405
|
-
addCallAccessorsFor(newPath, key, getId, setId);
|
|
406
|
-
locals = [newFieldInitId, getId, setId];
|
|
407
|
-
} else {
|
|
408
|
-
addProxyAccessorsFor(path.node.id, newPath, key, newId, version, isComputed);
|
|
409
|
-
locals = newFieldInitId;
|
|
410
|
-
}
|
|
411
|
-
} else if (kind === FIELD) {
|
|
412
|
-
const initId = element.scope.parent.generateDeclaredUidIdentifier(`init_${name}`);
|
|
413
|
-
const valuePath = element.get("value");
|
|
414
|
-
valuePath.replaceWith(_core.types.callExpression(_core.types.cloneNode(initId), [_core.types.thisExpression(), valuePath.node].filter(v => v)));
|
|
415
|
-
locals = initId;
|
|
416
|
-
if (isPrivate) {
|
|
417
|
-
privateMethods = extractProxyAccessorsFor(key, version);
|
|
418
|
-
}
|
|
419
|
-
} else if (isPrivate) {
|
|
420
|
-
locals = element.scope.parent.generateDeclaredUidIdentifier(`call_${name}`);
|
|
421
|
-
const replaceSupers = new _helperReplaceSupers.default({
|
|
422
|
-
constantSuper,
|
|
423
|
-
methodPath: element,
|
|
424
|
-
objectRef: classIdLocal,
|
|
425
|
-
superRef: path.node.superClass,
|
|
426
|
-
file: state.file,
|
|
427
|
-
refToPreserve: classIdLocal
|
|
428
|
-
});
|
|
429
|
-
replaceSupers.replace();
|
|
430
|
-
const {
|
|
431
|
-
params,
|
|
432
|
-
body,
|
|
433
|
-
async: isAsync
|
|
434
|
-
} = element.node;
|
|
435
|
-
privateMethods = [_core.types.functionExpression(undefined, params.filter(isNotTsParameter), body, isAsync)];
|
|
436
|
-
if (kind === GETTER || kind === SETTER) {
|
|
437
|
-
movePrivateAccessor(element, _core.types.cloneNode(key), _core.types.cloneNode(locals), isStatic);
|
|
438
|
-
} else {
|
|
439
|
-
const node = element.node;
|
|
440
|
-
path.node.body.body.unshift(_core.types.classPrivateProperty(key, _core.types.cloneNode(locals), [], node.static));
|
|
441
|
-
decoratedPrivateMethods.add(key.id.name);
|
|
442
|
-
element.remove();
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
let nameExpr;
|
|
446
|
-
if (isComputed) {
|
|
447
|
-
nameExpr = _core.types.cloneNode(key);
|
|
448
|
-
} else if (key.type === "PrivateName") {
|
|
449
|
-
nameExpr = _core.types.stringLiteral(key.id.name);
|
|
450
|
-
} else if (key.type === "Identifier") {
|
|
451
|
-
nameExpr = _core.types.stringLiteral(key.name);
|
|
452
|
-
} else {
|
|
453
|
-
nameExpr = _core.types.cloneNode(key);
|
|
454
|
-
}
|
|
455
|
-
elementDecoratorInfo.push({
|
|
456
|
-
kind,
|
|
457
|
-
decorators: decorators.map(d => d.node.expression),
|
|
458
|
-
decoratorsThis: decorators.map(d => decoratorsThis.get(d.node)),
|
|
459
|
-
name: nameExpr,
|
|
460
|
-
isStatic,
|
|
461
|
-
privateMethods,
|
|
462
|
-
locals
|
|
463
|
-
});
|
|
464
|
-
if (kind !== FIELD) {
|
|
465
|
-
if (isStatic) {
|
|
466
|
-
requiresStaticInit = true;
|
|
467
|
-
} else {
|
|
468
|
-
requiresProtoInit = true;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
if (element.node) {
|
|
472
|
-
element.node.decorators = null;
|
|
473
|
-
}
|
|
474
|
-
if (!firstFieldPath && !isStatic && (kind === FIELD || kind === ACCESSOR)) {
|
|
475
|
-
firstFieldPath = element;
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
const elementDecorations = generateDecorationExprs(elementDecoratorInfo, version);
|
|
481
|
-
let classDecorationsFlag = 0;
|
|
482
|
-
let classDecorations = [];
|
|
483
|
-
if (classDecorators) {
|
|
484
|
-
const {
|
|
485
|
-
hasThis,
|
|
486
|
-
decs
|
|
487
|
-
} = generateDecorationList(classDecorators.map(el => el.expression), classDecorators.map(dec => decoratorsThis.get(dec)), version);
|
|
488
|
-
classDecorationsFlag = hasThis ? 1 : 0;
|
|
489
|
-
classDecorations = decs;
|
|
490
|
-
}
|
|
491
|
-
const elementLocals = extractElementLocalAssignments(elementDecoratorInfo);
|
|
492
|
-
if (requiresProtoInit) {
|
|
493
|
-
protoInitLocal = scopeParent.generateDeclaredUidIdentifier("initProto");
|
|
494
|
-
elementLocals.push(protoInitLocal);
|
|
495
|
-
const protoInitCall = _core.types.callExpression(_core.types.cloneNode(protoInitLocal), [_core.types.thisExpression()]);
|
|
496
|
-
if (firstFieldPath) {
|
|
497
|
-
const value = firstFieldPath.get("value");
|
|
498
|
-
const body = [protoInitCall];
|
|
499
|
-
if (value.node) {
|
|
500
|
-
body.push(value.node);
|
|
501
|
-
}
|
|
502
|
-
value.replaceWith(_core.types.sequenceExpression(body));
|
|
503
|
-
} else if (constructorPath) {
|
|
504
|
-
if (path.node.superClass) {
|
|
505
|
-
path.traverse({
|
|
506
|
-
CallExpression: {
|
|
507
|
-
exit(path) {
|
|
508
|
-
if (!path.get("callee").isSuper()) return;
|
|
509
|
-
path.replaceWith(_core.types.callExpression(_core.types.cloneNode(protoInitLocal), [path.node]));
|
|
510
|
-
path.skip();
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
});
|
|
514
|
-
} else {
|
|
515
|
-
constructorPath.node.body.body.unshift(_core.types.expressionStatement(protoInitCall));
|
|
516
|
-
}
|
|
517
|
-
} else {
|
|
518
|
-
const body = [_core.types.expressionStatement(protoInitCall)];
|
|
519
|
-
if (path.node.superClass) {
|
|
520
|
-
body.unshift(_core.types.expressionStatement(_core.types.callExpression(_core.types.super(), [_core.types.spreadElement(_core.types.identifier("args"))])));
|
|
521
|
-
}
|
|
522
|
-
path.node.body.body.unshift(_core.types.classMethod("constructor", _core.types.identifier("constructor"), [_core.types.restElement(_core.types.identifier("args"))], _core.types.blockStatement(body)));
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
if (requiresStaticInit) {
|
|
526
|
-
staticInitLocal = scopeParent.generateDeclaredUidIdentifier("initStatic");
|
|
527
|
-
elementLocals.push(staticInitLocal);
|
|
528
|
-
}
|
|
529
|
-
if (decoratedPrivateMethods.size > 0) {
|
|
530
|
-
path.traverse({
|
|
531
|
-
PrivateName(path) {
|
|
532
|
-
if (!decoratedPrivateMethods.has(path.node.id.name)) return;
|
|
533
|
-
const parentPath = path.parentPath;
|
|
534
|
-
const parentParentPath = parentPath.parentPath;
|
|
535
|
-
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) {
|
|
536
|
-
throw path.buildCodeFrameError(`Decorated private methods are not updatable, but "#${path.node.id.name}" is updated via this expression.`);
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
});
|
|
540
|
-
}
|
|
541
|
-
const classLocals = [];
|
|
542
|
-
let classInitInjected = false;
|
|
543
|
-
const classInitCall = classInitLocal && _core.types.callExpression(_core.types.cloneNode(classInitLocal), []);
|
|
544
|
-
const originalClass = path.node;
|
|
545
|
-
if (classDecorators) {
|
|
546
|
-
classLocals.push(classIdLocal, classInitLocal);
|
|
547
|
-
const statics = [];
|
|
548
|
-
let staticBlocks = [];
|
|
549
|
-
path.get("body.body").forEach(element => {
|
|
550
|
-
if (element.isStaticBlock()) {
|
|
551
|
-
staticBlocks.push(element.node);
|
|
552
|
-
element.remove();
|
|
553
|
-
return;
|
|
554
|
-
}
|
|
555
|
-
const isProperty = element.isClassProperty() || element.isClassPrivateProperty();
|
|
556
|
-
if ((isProperty || element.isClassPrivateMethod()) && element.node.static) {
|
|
557
|
-
if (isProperty && staticBlocks.length > 0) {
|
|
558
|
-
const allValues = staticBlocks.map(staticBlockToIIFE);
|
|
559
|
-
if (element.node.value) allValues.push(element.node.value);
|
|
560
|
-
element.node.value = maybeSequenceExpression(allValues);
|
|
561
|
-
staticBlocks = [];
|
|
562
|
-
}
|
|
563
|
-
element.node.static = false;
|
|
564
|
-
statics.push(element.node);
|
|
565
|
-
element.remove();
|
|
566
|
-
}
|
|
567
|
-
});
|
|
568
|
-
if (statics.length > 0 || staticBlocks.length > 0) {
|
|
569
|
-
const staticsClass = _core.template.expression.ast`
|
|
570
|
-
class extends ${state.addHelper("identity")} {}
|
|
571
|
-
`;
|
|
572
|
-
staticsClass.body.body = [_core.types.staticBlock([_core.types.toStatement(originalClass, true) || _core.types.expressionStatement(originalClass)]), ...statics];
|
|
573
|
-
const constructorBody = [];
|
|
574
|
-
const newExpr = _core.types.newExpression(staticsClass, []);
|
|
575
|
-
if (staticBlocks.length > 0) {
|
|
576
|
-
constructorBody.push(...staticBlocks.map(staticBlockToIIFE));
|
|
577
|
-
}
|
|
578
|
-
if (classInitCall) {
|
|
579
|
-
classInitInjected = true;
|
|
580
|
-
constructorBody.push(classInitCall);
|
|
581
|
-
}
|
|
582
|
-
if (constructorBody.length > 0) {
|
|
583
|
-
constructorBody.unshift(_core.types.callExpression(_core.types.super(), [_core.types.cloneNode(classIdLocal)]));
|
|
584
|
-
staticsClass.body.body.push(_core.types.classMethod("constructor", _core.types.identifier("constructor"), [], _core.types.blockStatement([_core.types.expressionStatement(_core.types.sequenceExpression(constructorBody))])));
|
|
585
|
-
} else {
|
|
586
|
-
newExpr.arguments.push(_core.types.cloneNode(classIdLocal));
|
|
587
|
-
}
|
|
588
|
-
path.replaceWith(newExpr);
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
if (!classInitInjected && classInitCall) {
|
|
592
|
-
path.node.body.body.push(_core.types.staticBlock([_core.types.expressionStatement(classInitCall)]));
|
|
593
|
-
}
|
|
594
|
-
let {
|
|
595
|
-
superClass
|
|
596
|
-
} = originalClass;
|
|
597
|
-
if (superClass && version === "2023-05") {
|
|
598
|
-
const id = path.scope.maybeGenerateMemoised(superClass);
|
|
599
|
-
if (id) {
|
|
600
|
-
originalClass.superClass = _core.types.assignmentExpression("=", id, superClass);
|
|
601
|
-
superClass = id;
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
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, typeof className === "object" ? className : undefined, _core.types.cloneNode(superClass), state, version)), requiresStaticInit && _core.types.expressionStatement(_core.types.callExpression(_core.types.cloneNode(staticInitLocal), [_core.types.thisExpression()]))].filter(Boolean)));
|
|
605
|
-
path.insertBefore(assignments.map(expr => _core.types.expressionStatement(expr)));
|
|
606
|
-
if (needsDeclaraionForClassBinding) {
|
|
607
|
-
path.insertBefore(_core.types.variableDeclaration("let", [_core.types.variableDeclarator(_core.types.cloneNode(classIdLocal))]));
|
|
608
|
-
}
|
|
609
|
-
path.scope.crawl();
|
|
610
|
-
return path;
|
|
611
|
-
}
|
|
612
|
-
function createLocalsAssignment(elementLocals, classLocals, elementDecorations, classDecorations, classDecorationsFlag, maybePrivateBranName, setClassName, superClass, state, version) {
|
|
613
|
-
let lhs, rhs;
|
|
614
|
-
const args = [setClassName ? createSetFunctionNameCall(state, setClassName) : _core.types.thisExpression(), elementDecorations, classDecorations];
|
|
615
|
-
{
|
|
616
|
-
if (version === "2021-12" || version === "2022-03" && !state.availableHelper("applyDecs2203R")) {
|
|
617
|
-
const lhs = _core.types.arrayPattern([...elementLocals, ...classLocals]);
|
|
618
|
-
const rhs = _core.types.callExpression(state.addHelper(version === "2021-12" ? "applyDecs" : "applyDecs2203"), args);
|
|
619
|
-
return _core.types.assignmentExpression("=", lhs, rhs);
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
if (version === "2023-05") {
|
|
623
|
-
if (maybePrivateBranName || superClass || classDecorationsFlag.value !== 0) {
|
|
624
|
-
args.push(classDecorationsFlag);
|
|
625
|
-
}
|
|
626
|
-
if (maybePrivateBranName) {
|
|
627
|
-
args.push(_core.template.expression.ast`
|
|
628
|
-
_ => ${_core.types.cloneNode(maybePrivateBranName)} in _
|
|
629
|
-
`);
|
|
630
|
-
} else if (superClass) {
|
|
631
|
-
args.push(_core.types.unaryExpression("void", _core.types.numericLiteral(0)));
|
|
632
|
-
}
|
|
633
|
-
if (superClass) args.push(superClass);
|
|
634
|
-
rhs = _core.types.callExpression(state.addHelper("applyDecs2305"), args);
|
|
635
|
-
} else if (version === "2023-01") {
|
|
636
|
-
if (maybePrivateBranName) {
|
|
637
|
-
args.push(_core.template.expression.ast`
|
|
638
|
-
_ => ${_core.types.cloneNode(maybePrivateBranName)} in _
|
|
639
|
-
`);
|
|
640
|
-
}
|
|
641
|
-
rhs = _core.types.callExpression(state.addHelper("applyDecs2301"), args);
|
|
642
|
-
} else {
|
|
643
|
-
rhs = _core.types.callExpression(state.addHelper("applyDecs2203R"), args);
|
|
644
|
-
}
|
|
645
|
-
if (elementLocals.length > 0) {
|
|
646
|
-
if (classLocals.length > 0) {
|
|
647
|
-
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))]);
|
|
648
|
-
} else {
|
|
649
|
-
lhs = _core.types.arrayPattern(elementLocals);
|
|
650
|
-
rhs = _core.types.memberExpression(rhs, _core.types.identifier("e"), false, false);
|
|
651
|
-
}
|
|
652
|
-
} else {
|
|
653
|
-
lhs = _core.types.arrayPattern(classLocals);
|
|
654
|
-
rhs = _core.types.memberExpression(rhs, _core.types.identifier("c"), false, false);
|
|
655
|
-
}
|
|
656
|
-
return _core.types.assignmentExpression("=", lhs, rhs);
|
|
657
|
-
}
|
|
658
|
-
function isProtoKey(node) {
|
|
659
|
-
return node.type === "Identifier" ? node.name === "__proto__" : node.value === "__proto__";
|
|
660
|
-
}
|
|
661
|
-
function isDecorated(node) {
|
|
662
|
-
return node.decorators && node.decorators.length > 0;
|
|
663
|
-
}
|
|
664
|
-
function shouldTransformElement(node) {
|
|
665
|
-
switch (node.type) {
|
|
666
|
-
case "ClassAccessorProperty":
|
|
667
|
-
return true;
|
|
668
|
-
case "ClassMethod":
|
|
669
|
-
case "ClassProperty":
|
|
670
|
-
case "ClassPrivateMethod":
|
|
671
|
-
case "ClassPrivateProperty":
|
|
672
|
-
return isDecorated(node);
|
|
673
|
-
default:
|
|
674
|
-
return false;
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
function shouldTransformClass(node) {
|
|
678
|
-
return isDecorated(node) || node.body.body.some(shouldTransformElement);
|
|
679
|
-
}
|
|
680
|
-
function NamedEvaluationVisitoryFactory(isAnonymous, visitor) {
|
|
681
|
-
function handleComputedProperty(propertyPath, key, state) {
|
|
682
|
-
switch (key.type) {
|
|
683
|
-
case "StringLiteral":
|
|
684
|
-
return _core.types.stringLiteral(key.value);
|
|
685
|
-
case "NumericLiteral":
|
|
686
|
-
case "BigIntLiteral":
|
|
687
|
-
{
|
|
688
|
-
const keyValue = key.value + "";
|
|
689
|
-
propertyPath.get("key").replaceWith(_core.types.stringLiteral(keyValue));
|
|
690
|
-
return _core.types.stringLiteral(keyValue);
|
|
691
|
-
}
|
|
692
|
-
default:
|
|
693
|
-
{
|
|
694
|
-
const ref = propertyPath.scope.maybeGenerateMemoised(key);
|
|
695
|
-
propertyPath.get("key").replaceWith(_core.types.assignmentExpression("=", ref, _core.types.callExpression(state.addHelper("toPropertyKey"), [key])));
|
|
696
|
-
return _core.types.cloneNode(ref);
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
return {
|
|
701
|
-
VariableDeclarator(path, state) {
|
|
702
|
-
const id = path.node.id;
|
|
703
|
-
if (id.type === "Identifier") {
|
|
704
|
-
const initializer = (0, _helperSkipTransparentExpressionWrappers.skipTransparentExprWrappers)(path.get("init"));
|
|
705
|
-
if (isAnonymous(initializer)) {
|
|
706
|
-
const name = id.name;
|
|
707
|
-
visitor(initializer, state, name);
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
},
|
|
711
|
-
AssignmentExpression(path, state) {
|
|
712
|
-
const id = path.node.left;
|
|
713
|
-
if (id.type === "Identifier") {
|
|
714
|
-
const initializer = (0, _helperSkipTransparentExpressionWrappers.skipTransparentExprWrappers)(path.get("right"));
|
|
715
|
-
if (isAnonymous(initializer)) {
|
|
716
|
-
switch (path.node.operator) {
|
|
717
|
-
case "=":
|
|
718
|
-
case "&&=":
|
|
719
|
-
case "||=":
|
|
720
|
-
case "??=":
|
|
721
|
-
visitor(initializer, state, id.name);
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
},
|
|
726
|
-
AssignmentPattern(path, state) {
|
|
727
|
-
const id = path.node.left;
|
|
728
|
-
if (id.type === "Identifier") {
|
|
729
|
-
const initializer = (0, _helperSkipTransparentExpressionWrappers.skipTransparentExprWrappers)(path.get("right"));
|
|
730
|
-
if (isAnonymous(initializer)) {
|
|
731
|
-
const name = id.name;
|
|
732
|
-
visitor(initializer, state, name);
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
},
|
|
736
|
-
ObjectExpression(path, state) {
|
|
737
|
-
for (const propertyPath of path.get("properties")) {
|
|
738
|
-
const {
|
|
739
|
-
node
|
|
740
|
-
} = propertyPath;
|
|
741
|
-
if (node.type !== "ObjectProperty") continue;
|
|
742
|
-
const id = node.key;
|
|
743
|
-
const initializer = (0, _helperSkipTransparentExpressionWrappers.skipTransparentExprWrappers)(propertyPath.get("value"));
|
|
744
|
-
if (isAnonymous(initializer)) {
|
|
745
|
-
if (!node.computed) {
|
|
746
|
-
if (!isProtoKey(id)) {
|
|
747
|
-
if (id.type === "Identifier") {
|
|
748
|
-
visitor(initializer, state, id.name);
|
|
749
|
-
} else {
|
|
750
|
-
const className = _core.types.stringLiteral(id.value + "");
|
|
751
|
-
visitor(initializer, state, className);
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
} else {
|
|
755
|
-
const ref = handleComputedProperty(propertyPath, id, state);
|
|
756
|
-
visitor(initializer, state, ref);
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
},
|
|
761
|
-
ClassPrivateProperty(path, state) {
|
|
762
|
-
const {
|
|
763
|
-
node
|
|
764
|
-
} = path;
|
|
765
|
-
const initializer = (0, _helperSkipTransparentExpressionWrappers.skipTransparentExprWrappers)(path.get("value"));
|
|
766
|
-
if (isAnonymous(initializer)) {
|
|
767
|
-
const className = _core.types.stringLiteral("#" + node.key.id.name);
|
|
768
|
-
visitor(initializer, state, className);
|
|
769
|
-
}
|
|
770
|
-
},
|
|
771
|
-
ClassAccessorProperty(path, state) {
|
|
772
|
-
const {
|
|
773
|
-
node
|
|
774
|
-
} = path;
|
|
775
|
-
const id = node.key;
|
|
776
|
-
const initializer = (0, _helperSkipTransparentExpressionWrappers.skipTransparentExprWrappers)(path.get("value"));
|
|
777
|
-
if (isAnonymous(initializer)) {
|
|
778
|
-
if (!node.computed) {
|
|
779
|
-
if (id.type === "Identifier") {
|
|
780
|
-
visitor(initializer, state, id.name);
|
|
781
|
-
} else if (id.type === "PrivateName") {
|
|
782
|
-
const className = _core.types.stringLiteral("#" + id.id.name);
|
|
783
|
-
visitor(initializer, state, className);
|
|
784
|
-
} else {
|
|
785
|
-
const className = _core.types.stringLiteral(id.value + "");
|
|
786
|
-
visitor(initializer, state, className);
|
|
787
|
-
}
|
|
788
|
-
} else {
|
|
789
|
-
const ref = handleComputedProperty(path, id, state);
|
|
790
|
-
visitor(initializer, state, ref);
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
},
|
|
794
|
-
ClassProperty(path, state) {
|
|
795
|
-
const {
|
|
796
|
-
node
|
|
797
|
-
} = path;
|
|
798
|
-
const id = node.key;
|
|
799
|
-
const initializer = (0, _helperSkipTransparentExpressionWrappers.skipTransparentExprWrappers)(path.get("value"));
|
|
800
|
-
if (isAnonymous(initializer)) {
|
|
801
|
-
if (!node.computed) {
|
|
802
|
-
if (id.type === "Identifier") {
|
|
803
|
-
visitor(initializer, state, id.name);
|
|
804
|
-
} else {
|
|
805
|
-
const className = _core.types.stringLiteral(id.value + "");
|
|
806
|
-
visitor(initializer, state, className);
|
|
807
|
-
}
|
|
808
|
-
} else {
|
|
809
|
-
const ref = handleComputedProperty(path, id, state);
|
|
810
|
-
visitor(initializer, state, ref);
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
};
|
|
815
|
-
}
|
|
816
|
-
function isDecoratedAnonymousClassExpression(path) {
|
|
817
|
-
return path.isClassExpression({
|
|
818
|
-
id: null
|
|
819
|
-
}) && shouldTransformClass(path.node);
|
|
820
|
-
}
|
|
821
|
-
function _default({
|
|
822
|
-
assertVersion,
|
|
823
|
-
assumption
|
|
824
|
-
}, {
|
|
825
|
-
loose
|
|
826
|
-
}, version) {
|
|
827
|
-
var _assumption;
|
|
828
|
-
{
|
|
829
|
-
if (version === "2023-05" || version === "2023-01") {
|
|
830
|
-
assertVersion("^7.21.0");
|
|
831
|
-
} else if (version === "2021-12") {
|
|
832
|
-
assertVersion("^7.16.0");
|
|
833
|
-
} else {
|
|
834
|
-
assertVersion("^7.19.0");
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
const VISITED = new WeakSet();
|
|
838
|
-
const constantSuper = (_assumption = assumption("constantSuper")) != null ? _assumption : loose;
|
|
839
|
-
const namedEvaluationVisitor = NamedEvaluationVisitoryFactory(isDecoratedAnonymousClassExpression, visitClass);
|
|
840
|
-
function visitClass(path, state, className) {
|
|
841
|
-
var _className, _node$id;
|
|
842
|
-
if (VISITED.has(path)) return;
|
|
843
|
-
const {
|
|
844
|
-
node
|
|
845
|
-
} = path;
|
|
846
|
-
(_className = className) != null ? _className : className = (_node$id = node.id) == null ? void 0 : _node$id.name;
|
|
847
|
-
const newPath = transformClass(path, state, constantSuper, version, className, namedEvaluationVisitor);
|
|
848
|
-
if (newPath) {
|
|
849
|
-
VISITED.add(newPath);
|
|
850
|
-
return;
|
|
851
|
-
}
|
|
852
|
-
VISITED.add(path);
|
|
853
|
-
}
|
|
854
|
-
return {
|
|
855
|
-
name: "proposal-decorators",
|
|
856
|
-
inherits: _pluginSyntaxDecorators.default,
|
|
857
|
-
visitor: Object.assign({
|
|
858
|
-
ExportDefaultDeclaration(path, state) {
|
|
859
|
-
const {
|
|
860
|
-
declaration
|
|
861
|
-
} = path.node;
|
|
862
|
-
if ((declaration == null ? void 0 : declaration.type) === "ClassDeclaration" && isDecorated(declaration)) {
|
|
863
|
-
const isAnonymous = !declaration.id;
|
|
864
|
-
const updatedVarDeclarationPath = (0, _helperSplitExportDeclaration.default)(path);
|
|
865
|
-
if (isAnonymous) {
|
|
866
|
-
visitClass(updatedVarDeclarationPath, state, _core.types.stringLiteral("default"));
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
},
|
|
870
|
-
ExportNamedDeclaration(path) {
|
|
871
|
-
const {
|
|
872
|
-
declaration
|
|
873
|
-
} = path.node;
|
|
874
|
-
if ((declaration == null ? void 0 : declaration.type) === "ClassDeclaration" && isDecorated(declaration)) {
|
|
875
|
-
(0, _helperSplitExportDeclaration.default)(path);
|
|
876
|
-
}
|
|
877
|
-
},
|
|
878
|
-
Class(path, state) {
|
|
879
|
-
visitClass(path, state, undefined);
|
|
880
|
-
}
|
|
881
|
-
}, namedEvaluationVisitor)
|
|
882
|
-
};
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
//# sourceMappingURL=transformer-2023-05.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_core","require","_pluginSyntaxDecorators","_helperReplaceSupers","_helperSplitExportDeclaration","_helperSkipTransparentExpressionWrappers","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","className","type","varId","scope","generateUidIdentifierBasedOnNode","classId","rename","get","replaceWith","cloneNode","parent","generateDeclaredUidIdentifier","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","createSetFunctionNameCall","state","addHelper","createToPropertyKeyCall","propertyKey","transformClass","constantSuper","propertyVisitor","classDecorators","hasElementDecorators","generateClassPrivateUid","assignments","scopeParent","memoiseExpression","hint","localEvaluatedId","ClassProperty","ClassPrivateProperty","ClassAccessorProperty","computed","newId","newField","keyPath","isConstantExpression","insertBefore","expr","crawl","elementDecoratorInfo","firstFieldPath","constructorPath","requiresProtoInit","requiresStaticInit","decoratedPrivateMethods","protoInitLocal","staticInitLocal","classInitLocal","classIdLocal","Map","maybeExtractDecorator","decorator","isMemberExpression","object","isSuper","isThisExpression","set","needsDeclaraionForClassBinding","isClassDeclaration","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","parentPath","parentParentPath","left","buildCodeFrameError","classLocals","classInitInjected","classInitCall","originalClass","statics","staticBlocks","forEach","isStaticBlock","isProperty","isClassProperty","isClassPrivateMethod","allValues","staticsClass","staticBlock","toStatement","constructorBody","newExpr","newExpression","arguments","maybeGenerateMemoised","createLocalsAssignment","variableDeclaration","variableDeclarator","maybePrivateBranName","setClassName","lhs","rhs","args","availableHelper","arrayPattern","objectPattern","objectProperty","isProtoKey","isDecorated","shouldTransformElement","shouldTransformClass","NamedEvaluationVisitoryFactory","isAnonymous","visitor","handleComputedProperty","propertyPath","keyValue","ref","VariableDeclarator","initializer","skipTransparentExprWrappers","AssignmentExpression","operator","AssignmentPattern","ObjectExpression","isDecoratedAnonymousClassExpression","isClassExpression","_default","assertVersion","assumption","loose","_assumption","VISITED","WeakSet","namedEvaluationVisitor","visitClass","_className","_node$id","inherits","syntaxDecorators","Object","assign","ExportDefaultDeclaration","declaration","updatedVarDeclarationPath","splitExportDeclaration","ExportNamedDeclaration","Class"],"sources":["../src/transformer-2023-05.ts"],"sourcesContent":["import type { NodePath, Scope, Visitor } 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\";\nimport { skipTransparentExprWrappers } from \"@babel/helper-skip-transparent-expression-wrappers\";\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 the desired class name if anonymous and\n * replaces it with an equivalent class declaration (path) which is then\n * assigned to a local variable (id). This allows us to reassign the local variable with the\n * decorated version of the class. The class definition retains its original\n * name so that `toString` is not affected, other references to the class\n * are renamed instead.\n */\nfunction replaceClassWithVar(\n path: NodePath<t.ClassDeclaration | t.ClassExpression>,\n className: string | t.Identifier | t.StringLiteral | undefined,\n): {\n id: t.Identifier;\n path: NodePath<t.ClassDeclaration | t.ClassExpression>;\n} {\n if (path.type === \"ClassDeclaration\") {\n const id = path.node.id;\n const className = id.name;\n const varId = path.scope.generateUidIdentifierBasedOnNode(id);\n const classId = t.identifier(className);\n\n path.scope.rename(className, varId.name);\n\n path.get(\"id\").replaceWith(classId);\n\n return { id: t.cloneNode(varId), path };\n } else {\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 {\n varId = path.scope.parent.generateDeclaredUidIdentifier(\n typeof className === \"string\" ? className : \"decorated_class\",\n );\n }\n\n const newClassExpr = t.classExpression(\n typeof className === \"string\" ? t.identifier(className) : null,\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 };\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 createSetFunctionNameCall(\n state: PluginPass,\n className: t.Identifier | t.StringLiteral,\n) {\n return t.callExpression(state.addHelper(\"setFunctionName\"), [\n t.thisExpression(),\n className,\n ]);\n}\n\nfunction createToPropertyKeyCall(state: PluginPass, propertyKey: t.Expression) {\n return t.callExpression(state.addHelper(\"toPropertyKey\"), [propertyKey]);\n}\n\nfunction transformClass(\n path: NodePath<t.ClassExpression | t.ClassDeclaration>,\n state: PluginPass,\n constantSuper: boolean,\n version: DecoratorVersionKind,\n className: string | t.Identifier | t.StringLiteral | undefined,\n propertyVisitor: Visitor<PluginPass>,\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 const assignments: t.AssignmentExpression[] = [];\n const scopeParent: Scope = path.scope.parent;\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 // 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 switch (element.node.type) {\n case \"ClassProperty\":\n // @ts-expect-error todo: propertyVisitor.ClassProperty should be callable. Improve typings.\n propertyVisitor.ClassProperty(\n element as NodePath<t.ClassProperty>,\n state,\n );\n break;\n case \"ClassPrivateProperty\":\n // @ts-expect-error todo: propertyVisitor.ClassPrivateProperty should be callable. Improve typings.\n propertyVisitor.ClassPrivateProperty(\n element as NodePath<t.ClassPrivateProperty>,\n state,\n );\n break;\n case \"ClassAccessorProperty\":\n // @ts-expect-error todo: propertyVisitor.ClassAccessorProperty should be callable. Improve typings.\n propertyVisitor.ClassAccessorProperty(\n element as NodePath<t.ClassAccessorProperty>,\n state,\n );\n break;\n }\n hasElementDecorators = true;\n } else if (element.node.type === \"ClassAccessorProperty\") {\n // @ts-expect-error todo: propertyVisitor.ClassAccessorProperty should be callable. Improve typings.\n propertyVisitor.ClassAccessorProperty(\n element as NodePath<t.ClassAccessorProperty>,\n state,\n );\n const { key, value, static: isStatic, computed } = element.node;\n\n const newId = generateClassPrivateUid();\n const newField = generateClassProperty(newId, value, isStatic);\n const keyPath = element.get(\"key\");\n const [newPath] = element.replaceWith(newField);\n\n addProxyAccessorsFor(\n path.node.id,\n newPath,\n computed && !keyPath.isConstantExpression()\n ? memoiseExpression(\n createToPropertyKeyCall(state, key as t.Expression),\n \"computedKey\",\n )\n : key,\n newId,\n version,\n computed,\n );\n }\n }\n\n if (!classDecorators && !hasElementDecorators) {\n // If nothing is decorated but we have assignments, it must be the memoised\n // computed keys of class accessors\n if (assignments.length > 0) {\n path.insertBefore(assignments.map(expr => t.expressionStatement(expr)));\n\n // Recrawl the scope to make sure new identifiers are properly synced\n path.scope.crawl();\n }\n // If nothing is decorated and no assignments inserted, return\n return;\n }\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\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 needsDeclaraionForClassBinding = path.isClassDeclaration();\n ({ id: classIdLocal, path } = replaceClassWithVar(path, className));\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 (!element.get(\"key\").isConstantExpression()) {\n node.key = memoiseExpression(\n createToPropertyKeyCall(state, node.key as t.Expression),\n \"computedKey\",\n );\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 typeof className === \"object\" ? className : undefined,\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 setClassName: t.Identifier | t.StringLiteral | undefined,\n superClass: null | t.Expression,\n state: PluginPass,\n version: DecoratorVersionKind,\n) {\n let lhs, rhs;\n const args: t.Expression[] = [\n setClassName\n ? createSetFunctionNameCall(state, setClassName)\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\nfunction isProtoKey(\n node: t.Identifier | t.StringLiteral | t.BigIntLiteral | t.NumericLiteral,\n) {\n return node.type === \"Identifier\"\n ? node.name === \"__proto__\"\n : node.value === \"__proto__\";\n}\n\nfunction isDecorated(node: t.Class | ClassDecoratableElement) {\n return node.decorators && node.decorators.length > 0;\n}\n\nfunction shouldTransformElement(node: ClassElement) {\n switch (node.type) {\n case \"ClassAccessorProperty\":\n return true;\n case \"ClassMethod\":\n case \"ClassProperty\":\n case \"ClassPrivateMethod\":\n case \"ClassPrivateProperty\":\n return isDecorated(node);\n default:\n return false;\n }\n}\n\nfunction shouldTransformClass(node: t.Class) {\n return isDecorated(node) || node.body.body.some(shouldTransformElement);\n}\n\n// Todo: unify name references logic with helper-function-name\nfunction NamedEvaluationVisitoryFactory(\n isAnonymous: (path: NodePath) => boolean,\n visitor: (\n path: NodePath,\n state: PluginPass,\n name:\n | string\n | t.Identifier\n | t.StringLiteral\n | t.NumericLiteral\n | t.BigIntLiteral,\n ) => void,\n) {\n function handleComputedProperty(\n propertyPath: NodePath<\n t.ObjectProperty | t.ClassProperty | t.ClassAccessorProperty\n >,\n key: t.Expression,\n state: PluginPass,\n ): t.StringLiteral | t.Identifier {\n switch (key.type) {\n case \"StringLiteral\":\n return t.stringLiteral(key.value);\n case \"NumericLiteral\":\n case \"BigIntLiteral\": {\n const keyValue = key.value + \"\";\n propertyPath.get(\"key\").replaceWith(t.stringLiteral(keyValue));\n return t.stringLiteral(keyValue);\n }\n default: {\n const ref = propertyPath.scope.maybeGenerateMemoised(key);\n propertyPath\n .get(\"key\")\n .replaceWith(\n t.assignmentExpression(\n \"=\",\n ref,\n t.callExpression(state.addHelper(\"toPropertyKey\"), [key]),\n ),\n );\n return t.cloneNode(ref);\n }\n }\n }\n return {\n VariableDeclarator(path, state) {\n const id = path.node.id;\n if (id.type === \"Identifier\") {\n const initializer = skipTransparentExprWrappers(path.get(\"init\"));\n if (isAnonymous(initializer)) {\n const name = id.name;\n visitor(initializer, state, name);\n }\n }\n },\n AssignmentExpression(path, state) {\n const id = path.node.left;\n if (id.type === \"Identifier\") {\n const initializer = skipTransparentExprWrappers(path.get(\"right\"));\n if (isAnonymous(initializer)) {\n switch (path.node.operator) {\n case \"=\":\n case \"&&=\":\n case \"||=\":\n case \"??=\":\n visitor(initializer, state, id.name);\n }\n }\n }\n },\n AssignmentPattern(path, state) {\n const id = path.node.left;\n if (id.type === \"Identifier\") {\n const initializer = skipTransparentExprWrappers(path.get(\"right\"));\n if (isAnonymous(initializer)) {\n const name = id.name;\n visitor(initializer, state, name);\n }\n }\n },\n // We listen on ObjectExpression so that we don't have to visit\n // the object properties under object patterns\n ObjectExpression(path, state) {\n for (const propertyPath of path.get(\"properties\")) {\n const { node } = propertyPath;\n if (node.type !== \"ObjectProperty\") continue;\n const id = node.key;\n const initializer = skipTransparentExprWrappers(\n propertyPath.get(\"value\"),\n );\n if (isAnonymous(initializer)) {\n if (!node.computed) {\n // 13.2.5.5 RS: PropertyDefinitionEvaluation\n if (!isProtoKey(id as t.StringLiteral | t.Identifier)) {\n if (id.type === \"Identifier\") {\n visitor(initializer, state, id.name);\n } else {\n const className = t.stringLiteral(\n (id as t.StringLiteral | t.NumericLiteral | t.BigIntLiteral)\n .value + \"\",\n );\n visitor(initializer, state, className);\n }\n }\n } else {\n const ref = handleComputedProperty(\n propertyPath as NodePath<t.ObjectProperty>,\n // The key of a computed object property must not be a private name\n id as t.Expression,\n state,\n );\n visitor(initializer, state, ref);\n }\n }\n }\n },\n ClassPrivateProperty(path, state) {\n const { node } = path;\n const initializer = skipTransparentExprWrappers(path.get(\"value\"));\n if (isAnonymous(initializer)) {\n const className = t.stringLiteral(\"#\" + node.key.id.name);\n visitor(initializer, state, className);\n }\n },\n ClassAccessorProperty(path, state) {\n const { node } = path;\n const id = node.key;\n const initializer = skipTransparentExprWrappers(path.get(\"value\"));\n if (isAnonymous(initializer)) {\n if (!node.computed) {\n if (id.type === \"Identifier\") {\n visitor(initializer, state, id.name);\n } else if (id.type === \"PrivateName\") {\n const className = t.stringLiteral(\"#\" + id.id.name);\n visitor(initializer, state, className);\n } else {\n const className = t.stringLiteral(\n (id as t.StringLiteral | t.NumericLiteral | t.BigIntLiteral)\n .value + \"\",\n );\n visitor(initializer, state, className);\n }\n } else {\n const ref = handleComputedProperty(\n path,\n // The key of a computed accessor property must not be a private name\n id as t.Expression,\n state,\n );\n visitor(initializer, state, ref);\n }\n }\n },\n ClassProperty(path, state) {\n const { node } = path;\n const id = node.key;\n const initializer = skipTransparentExprWrappers(path.get(\"value\"));\n if (isAnonymous(initializer)) {\n if (!node.computed) {\n if (id.type === \"Identifier\") {\n visitor(initializer, state, id.name);\n } else {\n const className = t.stringLiteral(\n (id as t.StringLiteral | t.NumericLiteral | t.BigIntLiteral)\n .value + \"\",\n );\n visitor(initializer, state, className);\n }\n } else {\n const ref = handleComputedProperty(path, id, state);\n visitor(initializer, state, ref);\n }\n }\n },\n } satisfies Visitor<PluginPass>;\n}\n\nfunction isDecoratedAnonymousClassExpression(path: NodePath) {\n return (\n path.isClassExpression({ id: null }) && shouldTransformClass(path.node)\n );\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 const namedEvaluationVisitor: Visitor<PluginPass> =\n NamedEvaluationVisitoryFactory(\n isDecoratedAnonymousClassExpression,\n visitClass,\n );\n\n function visitClass(\n path: NodePath<t.Class>,\n state: PluginPass,\n className: string | t.Identifier | t.StringLiteral | undefined,\n ) {\n if (VISITED.has(path)) return;\n const { node } = path;\n className ??= node.id?.name;\n const newPath = transformClass(\n path,\n state,\n constantSuper,\n version,\n className,\n namedEvaluationVisitor,\n );\n if (newPath) {\n VISITED.add(newPath);\n return;\n }\n VISITED.add(path);\n }\n\n return {\n name: \"proposal-decorators\",\n inherits: syntaxDecorators,\n\n visitor: {\n ExportDefaultDeclaration(path, state) {\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 isDecorated(declaration)\n ) {\n const isAnonymous = !declaration.id;\n const updatedVarDeclarationPath = splitExportDeclaration(\n path,\n ) as unknown as NodePath<t.ClassDeclaration>;\n if (isAnonymous) {\n visitClass(\n updatedVarDeclarationPath,\n state,\n t.stringLiteral(\"default\"),\n );\n }\n }\n },\n ExportNamedDeclaration(path) {\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 isDecorated(declaration)\n ) {\n splitExportDeclaration(path);\n }\n },\n\n Class(path, state) {\n visitClass(path, state, undefined);\n },\n\n ...namedEvaluationVisitor,\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;AAIA,IAAAI,wCAAA,GAAAJ,OAAA;AAiBA,SAASK,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,M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