@babel/plugin-proposal-decorators 7.21.4-esm.2 → 7.21.4-esm.3
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 +19 -12
- package/lib/index.js.map +1 -1
- package/lib/transformer-2023-01.js +96 -90
- package/lib/transformer-2023-01.js.map +1 -1
- package/lib/transformer-legacy.js +35 -28
- package/lib/transformer-legacy.js.map +1 -1
- package/package.json +9 -9
package/lib/index.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _helperPluginUtils = require("@babel/helper-plugin-utils");
|
|
8
|
+
var _pluginSyntaxDecorators = require("@babel/plugin-syntax-decorators");
|
|
9
|
+
var _helperCreateClassFeaturesPlugin = require("@babel/helper-create-class-features-plugin");
|
|
10
|
+
var _transformerLegacy = require("./transformer-legacy");
|
|
11
|
+
var _transformer = require("./transformer-2023-01");
|
|
12
|
+
var _default = (0, _helperPluginUtils.declare)((api, options) => {
|
|
7
13
|
api.assertVersion(7);
|
|
8
14
|
{
|
|
9
15
|
var {
|
|
@@ -16,20 +22,21 @@ export default declare((api, options) => {
|
|
|
16
22
|
if (legacy || version === "legacy") {
|
|
17
23
|
return {
|
|
18
24
|
name: "proposal-decorators",
|
|
19
|
-
inherits:
|
|
20
|
-
visitor:
|
|
25
|
+
inherits: _pluginSyntaxDecorators.default,
|
|
26
|
+
visitor: _transformerLegacy.default
|
|
21
27
|
};
|
|
22
28
|
} else if (version === "2021-12" || version === "2022-03" || version === "2023-01") {
|
|
23
|
-
return
|
|
29
|
+
return (0, _transformer.default)(api, options, version);
|
|
24
30
|
} else {
|
|
25
31
|
api.assertVersion("^7.0.2");
|
|
26
|
-
return createClassFeaturePlugin({
|
|
32
|
+
return (0, _helperCreateClassFeaturesPlugin.createClassFeaturePlugin)({
|
|
27
33
|
name: "proposal-decorators",
|
|
28
34
|
api,
|
|
29
|
-
feature: FEATURES.decorators,
|
|
30
|
-
inherits:
|
|
35
|
+
feature: _helperCreateClassFeaturesPlugin.FEATURES.decorators,
|
|
36
|
+
inherits: _pluginSyntaxDecorators.default
|
|
31
37
|
});
|
|
32
38
|
}
|
|
33
39
|
});
|
|
40
|
+
exports.default = _default;
|
|
34
41
|
|
|
35
42
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_helperPluginUtils","require","_pluginSyntaxDecorators","_helperCreateClassFeaturesPlugin","_transformerLegacy","_transformer","_default","declare","api","options","assertVersion","legacy","version","name","inherits","syntaxDecorators","visitor","legacyVisitor","transformer2022_03","createClassFeaturePlugin","feature","FEATURES","decorators","exports","default"],"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\";\nimport transformer2022_03 from \"./transformer-2023-01\";\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(7);\n\n // Options are validated in @babel/plugin-syntax-decorators\n if (!process.env.BABEL_8_BREAKING) {\n // eslint-disable-next-line no-var\n var { legacy } = options;\n }\n const { version } = options;\n\n if (\n process.env.BABEL_8_BREAKING\n ? version === \"legacy\"\n : legacy || version === \"legacy\"\n ) {\n return {\n name: \"proposal-decorators\",\n inherits: syntaxDecorators,\n visitor: legacyVisitor,\n };\n } else if (\n version === \"2021-12\" ||\n version === \"2022-03\" ||\n version === \"2023-01\"\n ) {\n return transformer2022_03(api, options, version);\n } else if (!process.env.BABEL_8_BREAKING) {\n api.assertVersion(\"^7.0.2\");\n return createClassFeaturePlugin({\n name: \"proposal-decorators\",\n\n api,\n feature: FEATURES.decorators,\n inherits: syntaxDecorators,\n // loose: options.loose, Not supported\n });\n } else {\n throw new Error(\n \"The '.version' option must be one of 'legacy', '2021-12', '2022-03', or '2023-01'.\",\n );\n }\n});\n"],"mappings":";;;;;;AAEA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AACA,IAAAE,gCAAA,GAAAF,OAAA;AAIA,IAAAG,kBAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAAuD,IAAAK,QAAA,GAUxC,IAAAC,0BAAO,EAAC,CAACC,GAAG,EAAEC,OAAgB,KAAK;EAChDD,GAAG,CAACE,aAAa,CAAC,CAAC,CAAC;EAGe;IAEjC,IAAI;MAAEC;IAAO,CAAC,GAAGF,OAAO;EAC1B;EACA,MAAM;IAAEG;EAAQ,CAAC,GAAGH,OAAO;EAE3B,IAGME,MAAM,IAAIC,OAAO,KAAK,QAAQ,EAClC;IACA,OAAO;MACLC,IAAI,EAAE,qBAAqB;MAC3BC,QAAQ,EAAEC,+BAAgB;MAC1BC,OAAO,EAAEC;IACX,CAAC;EACH,CAAC,MAAM,IACLL,OAAO,KAAK,SAAS,IACrBA,OAAO,KAAK,SAAS,IACrBA,OAAO,KAAK,SAAS,EACrB;IACA,OAAO,IAAAM,oBAAkB,EAACV,GAAG,EAAEC,OAAO,EAAEG,OAAO,CAAC;EAClD,CAAC,MAAyC;IACxCJ,GAAG,CAACE,aAAa,CAAC,QAAQ,CAAC;IAC3B,OAAO,IAAAS,yDAAwB,EAAC;MAC9BN,IAAI,EAAE,qBAAqB;MAE3BL,GAAG;MACHY,OAAO,EAAEC,yCAAQ,CAACC,UAAU;MAC5BR,QAAQ,EAAEC;IAEZ,CAAC,CAAC;EACJ;AAKF,CAAC,CAAC;AAAAQ,OAAA,CAAAC,OAAA,GAAAlB,QAAA"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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");
|
|
5
11
|
function incrementId(id, idx = id.length - 1) {
|
|
6
12
|
if (idx === -1) {
|
|
7
13
|
id.unshift(65);
|
|
@@ -31,7 +37,7 @@ function createPrivateUidGeneratorForClass(classPath) {
|
|
|
31
37
|
incrementId(currentPrivateId);
|
|
32
38
|
reifiedId = String.fromCharCode(...currentPrivateId);
|
|
33
39
|
} while (privateNames.has(reifiedId));
|
|
34
|
-
return
|
|
40
|
+
return _core.types.privateName(_core.types.identifier(reifiedId));
|
|
35
41
|
};
|
|
36
42
|
}
|
|
37
43
|
function createLazyPrivateUidGeneratorForClass(classPath) {
|
|
@@ -46,11 +52,11 @@ function createLazyPrivateUidGeneratorForClass(classPath) {
|
|
|
46
52
|
function replaceClassWithVar(path) {
|
|
47
53
|
if (path.type === "ClassDeclaration") {
|
|
48
54
|
const varId = path.scope.generateUidIdentifierBasedOnNode(path.node.id);
|
|
49
|
-
const classId =
|
|
55
|
+
const classId = _core.types.identifier(path.node.id.name);
|
|
50
56
|
path.scope.rename(classId.name, varId.name);
|
|
51
|
-
path.insertBefore(
|
|
57
|
+
path.insertBefore(_core.types.variableDeclaration("let", [_core.types.variableDeclarator(varId)]));
|
|
52
58
|
path.get("id").replaceWith(classId);
|
|
53
|
-
return [
|
|
59
|
+
return [_core.types.cloneNode(varId), path];
|
|
54
60
|
} else {
|
|
55
61
|
let className;
|
|
56
62
|
let varId;
|
|
@@ -64,51 +70,51 @@ function replaceClassWithVar(path) {
|
|
|
64
70
|
} else {
|
|
65
71
|
varId = path.scope.parent.generateDeclaredUidIdentifier("decorated_class");
|
|
66
72
|
}
|
|
67
|
-
const newClassExpr =
|
|
68
|
-
const [newPath] = path.replaceWith(
|
|
69
|
-
return [
|
|
73
|
+
const newClassExpr = _core.types.classExpression(className && _core.types.identifier(className), path.node.superClass, path.node.body);
|
|
74
|
+
const [newPath] = path.replaceWith(_core.types.sequenceExpression([newClassExpr, varId]));
|
|
75
|
+
return [_core.types.cloneNode(varId), newPath.get("expressions.0")];
|
|
70
76
|
}
|
|
71
77
|
}
|
|
72
78
|
function generateClassProperty(key, value, isStatic) {
|
|
73
79
|
if (key.type === "PrivateName") {
|
|
74
|
-
return
|
|
80
|
+
return _core.types.classPrivateProperty(key, value, undefined, isStatic);
|
|
75
81
|
} else {
|
|
76
|
-
return
|
|
82
|
+
return _core.types.classProperty(key, value, undefined, undefined, isStatic);
|
|
77
83
|
}
|
|
78
84
|
}
|
|
79
85
|
function addProxyAccessorsFor(element, originalKey, targetKey, isComputed = false) {
|
|
80
86
|
const {
|
|
81
87
|
static: isStatic
|
|
82
88
|
} = element.node;
|
|
83
|
-
const getterBody =
|
|
84
|
-
const setterBody =
|
|
89
|
+
const getterBody = _core.types.blockStatement([_core.types.returnStatement(_core.types.memberExpression(_core.types.thisExpression(), _core.types.cloneNode(targetKey)))]);
|
|
90
|
+
const setterBody = _core.types.blockStatement([_core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.memberExpression(_core.types.thisExpression(), _core.types.cloneNode(targetKey)), _core.types.identifier("v")))]);
|
|
85
91
|
let getter, setter;
|
|
86
92
|
if (originalKey.type === "PrivateName") {
|
|
87
|
-
getter =
|
|
88
|
-
setter =
|
|
93
|
+
getter = _core.types.classPrivateMethod("get", _core.types.cloneNode(originalKey), [], getterBody, isStatic);
|
|
94
|
+
setter = _core.types.classPrivateMethod("set", _core.types.cloneNode(originalKey), [_core.types.identifier("v")], setterBody, isStatic);
|
|
89
95
|
} else {
|
|
90
|
-
getter =
|
|
91
|
-
setter =
|
|
96
|
+
getter = _core.types.classMethod("get", _core.types.cloneNode(originalKey), [], getterBody, isComputed, isStatic);
|
|
97
|
+
setter = _core.types.classMethod("set", _core.types.cloneNode(originalKey), [_core.types.identifier("v")], setterBody, isComputed, isStatic);
|
|
92
98
|
}
|
|
93
99
|
element.insertAfter(setter);
|
|
94
100
|
element.insertAfter(getter);
|
|
95
101
|
}
|
|
96
102
|
function extractProxyAccessorsFor(targetKey, version) {
|
|
97
103
|
if (version !== "2023-01") {
|
|
98
|
-
return [template.expression.ast`
|
|
104
|
+
return [_core.template.expression.ast`
|
|
99
105
|
function () {
|
|
100
|
-
return this.${
|
|
106
|
+
return this.${_core.types.cloneNode(targetKey)};
|
|
101
107
|
}
|
|
102
|
-
`, template.expression.ast`
|
|
108
|
+
`, _core.template.expression.ast`
|
|
103
109
|
function (value) {
|
|
104
|
-
this.${
|
|
110
|
+
this.${_core.types.cloneNode(targetKey)} = value;
|
|
105
111
|
}
|
|
106
112
|
`];
|
|
107
113
|
}
|
|
108
|
-
return [template.expression.ast`
|
|
109
|
-
o => o.${
|
|
110
|
-
`, template.expression.ast`
|
|
111
|
-
(o, v) => o.${
|
|
114
|
+
return [_core.template.expression.ast`
|
|
115
|
+
o => o.${_core.types.cloneNode(targetKey)}
|
|
116
|
+
`, _core.template.expression.ast`
|
|
117
|
+
(o, v) => o.${_core.types.cloneNode(targetKey)} = v
|
|
112
118
|
`];
|
|
113
119
|
}
|
|
114
120
|
const FIELD = 0;
|
|
@@ -143,10 +149,10 @@ function filteredOrderedDecoratorInfo(info) {
|
|
|
143
149
|
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)];
|
|
144
150
|
}
|
|
145
151
|
function generateDecorationExprs(info) {
|
|
146
|
-
return
|
|
147
|
-
const decs = el.decorators.length > 1 ?
|
|
152
|
+
return _core.types.arrayExpression(filteredOrderedDecoratorInfo(info).map(el => {
|
|
153
|
+
const decs = el.decorators.length > 1 ? _core.types.arrayExpression(el.decorators) : el.decorators[0];
|
|
148
154
|
const kind = el.isStatic ? el.kind + STATIC : el.kind;
|
|
149
|
-
return
|
|
155
|
+
return _core.types.arrayExpression([decs, _core.types.numericLiteral(kind), el.name, ...(el.privateMethods || [])]);
|
|
150
156
|
}));
|
|
151
157
|
}
|
|
152
158
|
function extractElementLocalAssignments(decorationInfo) {
|
|
@@ -164,8 +170,8 @@ function extractElementLocalAssignments(decorationInfo) {
|
|
|
164
170
|
return localIds;
|
|
165
171
|
}
|
|
166
172
|
function addCallAccessorsFor(element, key, getId, setId) {
|
|
167
|
-
element.insertAfter(
|
|
168
|
-
element.insertAfter(
|
|
173
|
+
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()]))])));
|
|
174
|
+
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")]))])));
|
|
169
175
|
}
|
|
170
176
|
function isNotTsParameter(node) {
|
|
171
177
|
return node.type !== "TSParameterProperty";
|
|
@@ -174,13 +180,13 @@ function movePrivateAccessor(element, key, methodLocalVar, isStatic) {
|
|
|
174
180
|
let params;
|
|
175
181
|
let block;
|
|
176
182
|
if (element.node.kind === "set") {
|
|
177
|
-
params = [
|
|
178
|
-
block = [
|
|
183
|
+
params = [_core.types.identifier("v")];
|
|
184
|
+
block = [_core.types.expressionStatement(_core.types.callExpression(methodLocalVar, [_core.types.thisExpression(), _core.types.identifier("v")]))];
|
|
179
185
|
} else {
|
|
180
186
|
params = [];
|
|
181
|
-
block = [
|
|
187
|
+
block = [_core.types.returnStatement(_core.types.callExpression(methodLocalVar, [_core.types.thisExpression()]))];
|
|
182
188
|
}
|
|
183
|
-
element.replaceWith(
|
|
189
|
+
element.replaceWith(_core.types.classPrivateMethod(element.node.kind, _core.types.cloneNode(key), params, _core.types.blockStatement(block), isStatic));
|
|
184
190
|
}
|
|
185
191
|
function isClassDecoratableElementPath(path) {
|
|
186
192
|
const {
|
|
@@ -189,12 +195,12 @@ function isClassDecoratableElementPath(path) {
|
|
|
189
195
|
return type !== "TSDeclareMethod" && type !== "TSIndexSignature" && type !== "StaticBlock";
|
|
190
196
|
}
|
|
191
197
|
function staticBlockToIIFE(block) {
|
|
192
|
-
return
|
|
198
|
+
return _core.types.callExpression(_core.types.arrowFunctionExpression([], _core.types.blockStatement(block.body)), []);
|
|
193
199
|
}
|
|
194
200
|
function maybeSequenceExpression(exprs) {
|
|
195
|
-
if (exprs.length === 0) return
|
|
201
|
+
if (exprs.length === 0) return _core.types.unaryExpression("void", _core.types.numericLiteral(0));
|
|
196
202
|
if (exprs.length === 1) return exprs[0];
|
|
197
|
-
return
|
|
203
|
+
return _core.types.sequenceExpression(exprs);
|
|
198
204
|
}
|
|
199
205
|
function transformClass(path, state, constantSuper, version) {
|
|
200
206
|
const body = path.get("body.body");
|
|
@@ -215,7 +221,7 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
215
221
|
computed
|
|
216
222
|
} = element.node;
|
|
217
223
|
const newId = generateClassPrivateUid();
|
|
218
|
-
const valueNode = value ?
|
|
224
|
+
const valueNode = value ? _core.types.cloneNode(value) : undefined;
|
|
219
225
|
const newField = generateClassProperty(newId, valueNode, isStatic);
|
|
220
226
|
const [newPath] = element.replaceWith(newField);
|
|
221
227
|
addProxyAccessorsFor(newPath, key, newId, computed);
|
|
@@ -233,8 +239,8 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
233
239
|
const scopeParent = path.scope.parent;
|
|
234
240
|
const memoiseExpression = (expression, hint) => {
|
|
235
241
|
const localEvaluatedId = scopeParent.generateDeclaredUidIdentifier(hint);
|
|
236
|
-
assignments.push(
|
|
237
|
-
return
|
|
242
|
+
assignments.push(_core.types.assignmentExpression("=", localEvaluatedId, expression));
|
|
243
|
+
return _core.types.cloneNode(localEvaluatedId);
|
|
238
244
|
};
|
|
239
245
|
if (classDecorators) {
|
|
240
246
|
classInitLocal = scopeParent.generateDeclaredUidIdentifier("initClass");
|
|
@@ -251,7 +257,7 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
251
257
|
if (!path.node.id) {
|
|
252
258
|
path.node.id = path.scope.generateUidIdentifier("Class");
|
|
253
259
|
}
|
|
254
|
-
classIdLocal =
|
|
260
|
+
classIdLocal = _core.types.cloneNode(path.node.id);
|
|
255
261
|
}
|
|
256
262
|
let lastInstancePrivateName;
|
|
257
263
|
let needsInstancePrivateBrandCheck = false;
|
|
@@ -294,7 +300,7 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
294
300
|
if (hasDecorators) {
|
|
295
301
|
needsInstancePrivateBrandCheck = true;
|
|
296
302
|
}
|
|
297
|
-
if (
|
|
303
|
+
if (_core.types.isClassPrivateProperty(node) || !lastInstancePrivateName) {
|
|
298
304
|
lastInstancePrivateName = key;
|
|
299
305
|
}
|
|
300
306
|
}
|
|
@@ -310,13 +316,13 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
310
316
|
const {
|
|
311
317
|
value
|
|
312
318
|
} = element.node;
|
|
313
|
-
const params = [
|
|
319
|
+
const params = [_core.types.thisExpression()];
|
|
314
320
|
if (value) {
|
|
315
|
-
params.push(
|
|
321
|
+
params.push(_core.types.cloneNode(value));
|
|
316
322
|
}
|
|
317
323
|
const newId = generateClassPrivateUid();
|
|
318
324
|
const newFieldInitId = element.scope.parent.generateDeclaredUidIdentifier(`init_${name}`);
|
|
319
|
-
const newValue =
|
|
325
|
+
const newValue = _core.types.callExpression(_core.types.cloneNode(newFieldInitId), params);
|
|
320
326
|
const newField = generateClassProperty(newId, newValue, isStatic);
|
|
321
327
|
const [newPath] = element.replaceWith(newField);
|
|
322
328
|
if (isPrivate) {
|
|
@@ -332,14 +338,14 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
332
338
|
} else if (kind === FIELD) {
|
|
333
339
|
const initId = element.scope.parent.generateDeclaredUidIdentifier(`init_${name}`);
|
|
334
340
|
const valuePath = element.get("value");
|
|
335
|
-
valuePath.replaceWith(
|
|
341
|
+
valuePath.replaceWith(_core.types.callExpression(_core.types.cloneNode(initId), [_core.types.thisExpression(), valuePath.node].filter(v => v)));
|
|
336
342
|
locals = initId;
|
|
337
343
|
if (isPrivate) {
|
|
338
344
|
privateMethods = extractProxyAccessorsFor(key, version);
|
|
339
345
|
}
|
|
340
346
|
} else if (isPrivate) {
|
|
341
347
|
locals = element.scope.parent.generateDeclaredUidIdentifier(`call_${name}`);
|
|
342
|
-
const replaceSupers = new
|
|
348
|
+
const replaceSupers = new _helperReplaceSupers.default({
|
|
343
349
|
constantSuper,
|
|
344
350
|
methodPath: element,
|
|
345
351
|
objectRef: classIdLocal,
|
|
@@ -353,25 +359,25 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
353
359
|
body,
|
|
354
360
|
async: isAsync
|
|
355
361
|
} = element.node;
|
|
356
|
-
privateMethods = [
|
|
362
|
+
privateMethods = [_core.types.functionExpression(undefined, params.filter(isNotTsParameter), body, isAsync)];
|
|
357
363
|
if (kind === GETTER || kind === SETTER) {
|
|
358
|
-
movePrivateAccessor(element,
|
|
364
|
+
movePrivateAccessor(element, _core.types.cloneNode(key), _core.types.cloneNode(locals), isStatic);
|
|
359
365
|
} else {
|
|
360
366
|
const node = element.node;
|
|
361
|
-
path.node.body.body.unshift(
|
|
367
|
+
path.node.body.body.unshift(_core.types.classPrivateProperty(key, _core.types.cloneNode(locals), [], node.static));
|
|
362
368
|
decoratedPrivateMethods.add(key.id.name);
|
|
363
369
|
element.remove();
|
|
364
370
|
}
|
|
365
371
|
}
|
|
366
372
|
let nameExpr;
|
|
367
373
|
if (isComputed) {
|
|
368
|
-
nameExpr =
|
|
374
|
+
nameExpr = _core.types.cloneNode(key);
|
|
369
375
|
} else if (key.type === "PrivateName") {
|
|
370
|
-
nameExpr =
|
|
376
|
+
nameExpr = _core.types.stringLiteral(key.id.name);
|
|
371
377
|
} else if (key.type === "Identifier") {
|
|
372
|
-
nameExpr =
|
|
378
|
+
nameExpr = _core.types.stringLiteral(key.name);
|
|
373
379
|
} else {
|
|
374
|
-
nameExpr =
|
|
380
|
+
nameExpr = _core.types.cloneNode(key);
|
|
375
381
|
}
|
|
376
382
|
elementDecoratorInfo.push({
|
|
377
383
|
kind,
|
|
@@ -398,39 +404,39 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
398
404
|
}
|
|
399
405
|
}
|
|
400
406
|
const elementDecorations = generateDecorationExprs(elementDecoratorInfo);
|
|
401
|
-
const classDecorations =
|
|
407
|
+
const classDecorations = _core.types.arrayExpression((classDecorators || []).map(d => d.expression));
|
|
402
408
|
const elementLocals = extractElementLocalAssignments(elementDecoratorInfo);
|
|
403
409
|
if (requiresProtoInit) {
|
|
404
410
|
protoInitLocal = scopeParent.generateDeclaredUidIdentifier("initProto");
|
|
405
411
|
elementLocals.push(protoInitLocal);
|
|
406
|
-
const protoInitCall =
|
|
412
|
+
const protoInitCall = _core.types.callExpression(_core.types.cloneNode(protoInitLocal), [_core.types.thisExpression()]);
|
|
407
413
|
if (firstFieldPath) {
|
|
408
414
|
const value = firstFieldPath.get("value");
|
|
409
415
|
const body = [protoInitCall];
|
|
410
416
|
if (value.node) {
|
|
411
417
|
body.push(value.node);
|
|
412
418
|
}
|
|
413
|
-
value.replaceWith(
|
|
419
|
+
value.replaceWith(_core.types.sequenceExpression(body));
|
|
414
420
|
} else if (constructorPath) {
|
|
415
421
|
if (path.node.superClass) {
|
|
416
422
|
path.traverse({
|
|
417
423
|
CallExpression: {
|
|
418
424
|
exit(path) {
|
|
419
425
|
if (!path.get("callee").isSuper()) return;
|
|
420
|
-
path.replaceWith(
|
|
426
|
+
path.replaceWith(_core.types.callExpression(_core.types.cloneNode(protoInitLocal), [path.node]));
|
|
421
427
|
path.skip();
|
|
422
428
|
}
|
|
423
429
|
}
|
|
424
430
|
});
|
|
425
431
|
} else {
|
|
426
|
-
constructorPath.node.body.body.unshift(
|
|
432
|
+
constructorPath.node.body.body.unshift(_core.types.expressionStatement(protoInitCall));
|
|
427
433
|
}
|
|
428
434
|
} else {
|
|
429
|
-
const body = [
|
|
435
|
+
const body = [_core.types.expressionStatement(protoInitCall)];
|
|
430
436
|
if (path.node.superClass) {
|
|
431
|
-
body.unshift(
|
|
437
|
+
body.unshift(_core.types.expressionStatement(_core.types.callExpression(_core.types.super(), [_core.types.spreadElement(_core.types.identifier("args"))])));
|
|
432
438
|
}
|
|
433
|
-
path.node.body.body.unshift(
|
|
439
|
+
path.node.body.body.unshift(_core.types.classMethod("constructor", _core.types.identifier("constructor"), [_core.types.restElement(_core.types.identifier("args"))], _core.types.blockStatement(body)));
|
|
434
440
|
}
|
|
435
441
|
}
|
|
436
442
|
if (requiresStaticInit) {
|
|
@@ -451,7 +457,7 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
451
457
|
}
|
|
452
458
|
const classLocals = [];
|
|
453
459
|
let classInitInjected = false;
|
|
454
|
-
const classInitCall = classInitLocal &&
|
|
460
|
+
const classInitCall = classInitLocal && _core.types.callExpression(_core.types.cloneNode(classInitLocal), []);
|
|
455
461
|
const originalClass = path.node;
|
|
456
462
|
if (classDecorators) {
|
|
457
463
|
classLocals.push(classIdLocal, classInitLocal);
|
|
@@ -477,12 +483,12 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
477
483
|
}
|
|
478
484
|
});
|
|
479
485
|
if (statics.length > 0 || staticBlocks.length > 0) {
|
|
480
|
-
const staticsClass = template.expression.ast`
|
|
486
|
+
const staticsClass = _core.template.expression.ast`
|
|
481
487
|
class extends ${state.addHelper("identity")} {}
|
|
482
488
|
`;
|
|
483
|
-
staticsClass.body.body = [
|
|
489
|
+
staticsClass.body.body = [_core.types.staticBlock([_core.types.toStatement(originalClass, true) || _core.types.expressionStatement(originalClass)]), ...statics];
|
|
484
490
|
const constructorBody = [];
|
|
485
|
-
const newExpr =
|
|
491
|
+
const newExpr = _core.types.newExpression(staticsClass, []);
|
|
486
492
|
if (staticBlocks.length > 0) {
|
|
487
493
|
constructorBody.push(...staticBlocks.map(staticBlockToIIFE));
|
|
488
494
|
}
|
|
@@ -491,54 +497,54 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
491
497
|
constructorBody.push(classInitCall);
|
|
492
498
|
}
|
|
493
499
|
if (constructorBody.length > 0) {
|
|
494
|
-
constructorBody.unshift(
|
|
495
|
-
staticsClass.body.body.push(
|
|
500
|
+
constructorBody.unshift(_core.types.callExpression(_core.types.super(), [_core.types.cloneNode(classIdLocal)]));
|
|
501
|
+
staticsClass.body.body.push(_core.types.classMethod("constructor", _core.types.identifier("constructor"), [], _core.types.blockStatement([_core.types.expressionStatement(_core.types.sequenceExpression(constructorBody))])));
|
|
496
502
|
} else {
|
|
497
|
-
newExpr.arguments.push(
|
|
503
|
+
newExpr.arguments.push(_core.types.cloneNode(classIdLocal));
|
|
498
504
|
}
|
|
499
505
|
path.replaceWith(newExpr);
|
|
500
506
|
}
|
|
501
507
|
}
|
|
502
508
|
if (!classInitInjected && classInitCall) {
|
|
503
|
-
path.node.body.body.push(
|
|
509
|
+
path.node.body.body.push(_core.types.staticBlock([_core.types.expressionStatement(classInitCall)]));
|
|
504
510
|
}
|
|
505
|
-
originalClass.body.body.unshift(
|
|
506
|
-
path.insertBefore(assignments.map(expr =>
|
|
511
|
+
originalClass.body.body.unshift(_core.types.staticBlock([_core.types.expressionStatement(createLocalsAssignment(elementLocals, classLocals, elementDecorations, classDecorations, needsInstancePrivateBrandCheck ? lastInstancePrivateName : null, state, version)), requiresStaticInit && _core.types.expressionStatement(_core.types.callExpression(_core.types.cloneNode(staticInitLocal), [_core.types.thisExpression()]))].filter(Boolean)));
|
|
512
|
+
path.insertBefore(assignments.map(expr => _core.types.expressionStatement(expr)));
|
|
507
513
|
path.scope.crawl();
|
|
508
514
|
return path;
|
|
509
515
|
}
|
|
510
516
|
function createLocalsAssignment(elementLocals, classLocals, elementDecorations, classDecorations, maybePrivateBranName, state, version) {
|
|
511
517
|
let lhs, rhs;
|
|
512
|
-
const args = [
|
|
518
|
+
const args = [_core.types.thisExpression(), elementDecorations, classDecorations];
|
|
513
519
|
if (version === "2021-12" || version === "2022-03" && !state.availableHelper("applyDecs2203R")) {
|
|
514
|
-
lhs =
|
|
515
|
-
rhs =
|
|
520
|
+
lhs = _core.types.arrayPattern([...elementLocals, ...classLocals]);
|
|
521
|
+
rhs = _core.types.callExpression(state.addHelper(version === "2021-12" ? "applyDecs" : "applyDecs2203"), args);
|
|
516
522
|
} else {
|
|
517
523
|
if (version === "2023-01") {
|
|
518
524
|
if (maybePrivateBranName) {
|
|
519
|
-
args.push(template.expression.ast`
|
|
520
|
-
_ => ${
|
|
525
|
+
args.push(_core.template.expression.ast`
|
|
526
|
+
_ => ${_core.types.cloneNode(maybePrivateBranName)} in _
|
|
521
527
|
`);
|
|
522
528
|
}
|
|
523
|
-
rhs =
|
|
529
|
+
rhs = _core.types.callExpression(state.addHelper("applyDecs2301"), args);
|
|
524
530
|
} else {
|
|
525
|
-
rhs =
|
|
531
|
+
rhs = _core.types.callExpression(state.addHelper("applyDecs2203R"), args);
|
|
526
532
|
}
|
|
527
533
|
if (elementLocals.length > 0) {
|
|
528
534
|
if (classLocals.length > 0) {
|
|
529
|
-
lhs =
|
|
535
|
+
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))]);
|
|
530
536
|
} else {
|
|
531
|
-
lhs =
|
|
532
|
-
rhs =
|
|
537
|
+
lhs = _core.types.arrayPattern(elementLocals);
|
|
538
|
+
rhs = _core.types.memberExpression(rhs, _core.types.identifier("e"), false, false);
|
|
533
539
|
}
|
|
534
540
|
} else {
|
|
535
|
-
lhs =
|
|
536
|
-
rhs =
|
|
541
|
+
lhs = _core.types.arrayPattern(classLocals);
|
|
542
|
+
rhs = _core.types.memberExpression(rhs, _core.types.identifier("c"), false, false);
|
|
537
543
|
}
|
|
538
544
|
}
|
|
539
|
-
return
|
|
545
|
+
return _core.types.assignmentExpression("=", lhs, rhs);
|
|
540
546
|
}
|
|
541
|
-
|
|
547
|
+
function _default({
|
|
542
548
|
assertVersion,
|
|
543
549
|
assumption
|
|
544
550
|
}, {
|
|
@@ -556,7 +562,7 @@ export default function ({
|
|
|
556
562
|
const constantSuper = (_assumption = assumption("constantSuper")) != null ? _assumption : loose;
|
|
557
563
|
return {
|
|
558
564
|
name: "proposal-decorators",
|
|
559
|
-
inherits:
|
|
565
|
+
inherits: _pluginSyntaxDecorators.default,
|
|
560
566
|
visitor: {
|
|
561
567
|
"ExportNamedDeclaration|ExportDefaultDeclaration"(path) {
|
|
562
568
|
var _declaration$decorato;
|
|
@@ -564,7 +570,7 @@ export default function ({
|
|
|
564
570
|
declaration
|
|
565
571
|
} = path.node;
|
|
566
572
|
if ((declaration == null ? void 0 : declaration.type) === "ClassDeclaration" && ((_declaration$decorato = declaration.decorators) == null ? void 0 : _declaration$decorato.length) > 0) {
|
|
567
|
-
|
|
573
|
+
(0, _helperSplitExportDeclaration.default)(path);
|
|
568
574
|
}
|
|
569
575
|
},
|
|
570
576
|
Class(path, state) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["types","t","template","syntaxDecorators","ReplaceSupers","splitExportDeclaration","incrementId","id","idx","length","unshift","current","createPrivateUidGeneratorForClass","classPath","currentPrivateId","privateNames","Set","traverse","PrivateName","path","add","node","name","reifiedId","String","fromCharCode","has","privateName","identifier","createLazyPrivateUidGeneratorForClass","generator","replaceClassWithVar","type","varId","scope","generateUidIdentifierBasedOnNode","classId","rename","insertBefore","variableDeclaration","variableDeclarator","get","replaceWith","cloneNode","className","parent","generateDeclaredUidIdentifier","parentPath","newClassExpr","classExpression","superClass","body","newPath","sequenceExpression","generateClassProperty","key","value","isStatic","classPrivateProperty","undefined","classProperty","addProxyAccessorsFor","element","originalKey","targetKey","isComputed","static","getterBody","blockStatement","returnStatement","memberExpression","thisExpression","setterBody","expressionStatement","assignmentExpression","getter","setter","classPrivateMethod","classMethod","insertAfter","extractProxyAccessorsFor","version","expression","ast","FIELD","ACCESSOR","METHOD","GETTER","SETTER","STATIC","getElementKind","kind","isDecoratorInfo","info","filteredOrderedDecoratorInfo","filtered","filter","el","generateDecorationExprs","arrayExpression","map","decs","decorators","numericLiteral","privateMethods","extractElementLocalAssignments","decorationInfo","localIds","locals","Array","isArray","push","addCallAccessorsFor","getId","setId","callExpression","isNotTsParameter","movePrivateAccessor","methodLocalVar","params","block","isClassDecoratableElementPath","staticBlockToIIFE","arrowFunctionExpression","maybeSequenceExpression","exprs","unaryExpression","transformClass","state","constantSuper","classDecorators","hasElementDecorators","generateClassPrivateUid","computed","newId","valueNode","newField","elementDecoratorInfo","firstFieldPath","constructorPath","requiresProtoInit","requiresStaticInit","decoratedPrivateMethods","protoInitLocal","staticInitLocal","classInitLocal","classIdLocal","assignments","scopeParent","memoiseExpression","hint","localEvaluatedId","classDecorator","generateUidIdentifier","lastInstancePrivateName","needsInstancePrivateBrandCheck","hasDecorators","decoratorPath","isPrivate","isClassPrivateProperty","isClassMethod","newFieldInitId","newValue","initId","valuePath","v","replaceSupers","methodPath","objectRef","superRef","file","refToPreserve","replace","async","isAsync","functionExpression","remove","nameExpr","stringLiteral","d","elementDecorations","classDecorations","elementLocals","protoInitCall","CallExpression","exit","isSuper","skip","super","spreadElement","restElement","size","parentParentPath","left","buildCodeFrameError","classLocals","classInitInjected","classInitCall","originalClass","statics","staticBlocks","forEach","isStaticBlock","isProperty","isClassProperty","isClassPrivateMethod","allValues","staticsClass","addHelper","staticBlock","toStatement","constructorBody","newExpr","newExpression","arguments","createLocalsAssignment","Boolean","expr","crawl","maybePrivateBranName","lhs","rhs","args","availableHelper","arrayPattern","objectPattern","objectProperty","assertVersion","assumption","loose","_assumption","VISITED","WeakSet","inherits","visitor","ExportNamedDeclaration|ExportDefaultDeclaration","_declaration$decorato","declaration","Class"],"sources":["../src/transformer-2023-01.ts"],"sourcesContent":["import type { NodePath, Scope } from \"@babel/traverse\";\nimport { types as t, template } from \"@babel/core\";\nimport syntaxDecorators from \"@babel/plugin-syntax-decorators\";\nimport ReplaceSupers from \"@babel/helper-replace-supers\";\nimport splitExportDeclaration from \"@babel/helper-split-export-declaration\";\nimport * as charCodes from \"charcodes\";\nimport type { PluginAPI, PluginObject, PluginPass } from \"@babel/core\";\nimport type { Options } from \"./index\";\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-01\" | \"2022-03\" | \"2021-12\";\n\nfunction incrementId(id: number[], idx = id.length - 1): void {\n // If index is -1, id needs an additional character, unshift A\n if (idx === -1) {\n id.unshift(charCodes.uppercaseA);\n return;\n }\n\n const current = id[idx];\n\n if (current === charCodes.uppercaseZ) {\n // if current is Z, skip to a\n id[idx] = charCodes.lowercaseA;\n } else if (current === charCodes.lowercaseZ) {\n // if current is z, reset to A and carry the 1\n id[idx] = charCodes.uppercaseA;\n incrementId(id, idx - 1);\n } else {\n // else, increment by one\n id[idx] = current + 1;\n }\n}\n\n/**\n * Generates a new private name that is unique to the given class. This can be\n * used to create extra class fields and methods for the implementation, while\n * keeping the length of those names as small as possible. This is important for\n * minification purposes (though private names can generally be minified,\n * transpilations and polyfills cannot yet).\n */\nfunction createPrivateUidGeneratorForClass(\n classPath: NodePath<t.ClassDeclaration | t.ClassExpression>,\n): () => t.PrivateName {\n const currentPrivateId: number[] = [];\n const privateNames = new Set<string>();\n\n classPath.traverse({\n PrivateName(path) {\n privateNames.add(path.node.id.name);\n },\n });\n\n return (): t.PrivateName => {\n let reifiedId;\n do {\n incrementId(currentPrivateId);\n reifiedId = String.fromCharCode(...currentPrivateId);\n } while (privateNames.has(reifiedId));\n\n return t.privateName(t.identifier(reifiedId));\n };\n}\n\n/**\n * Wraps the above generator function so that it's run lazily the first time\n * it's actually required. Several types of decoration do not require this, so it\n * saves iterating the class elements an additional time and allocating the space\n * for the Sets of element names.\n */\nfunction createLazyPrivateUidGeneratorForClass(\n classPath: NodePath<t.ClassDeclaration | t.ClassExpression>,\n): () => t.PrivateName {\n let generator: () => t.PrivateName;\n\n return (): t.PrivateName => {\n if (!generator) {\n generator = createPrivateUidGeneratorForClass(classPath);\n }\n\n return generator();\n };\n}\n\n/**\n * Takes a class definition and replaces it with an equivalent class declaration\n * which is then assigned to a local variable. This allows us to reassign the\n * local variable with the decorated version of the class. The class definition\n * retains its original name so that `toString` is not affected, other\n * references to the class are renamed instead.\n */\nfunction replaceClassWithVar(\n path: NodePath<t.ClassDeclaration | t.ClassExpression>,\n): [t.Identifier, NodePath<t.ClassDeclaration | t.ClassExpression>] {\n if (path.type === \"ClassDeclaration\") {\n const varId = path.scope.generateUidIdentifierBasedOnNode(path.node.id);\n const classId = t.identifier(path.node.id.name);\n\n path.scope.rename(classId.name, varId.name);\n\n path.insertBefore(\n t.variableDeclaration(\"let\", [t.variableDeclarator(varId)]),\n );\n path.get(\"id\").replaceWith(classId);\n\n return [t.cloneNode(varId), path];\n } else {\n let className: string;\n let varId: t.Identifier;\n\n if (path.node.id) {\n className = path.node.id.name;\n varId = path.scope.parent.generateDeclaredUidIdentifier(className);\n path.scope.rename(className, varId.name);\n } else if (\n path.parentPath.node.type === \"VariableDeclarator\" &&\n path.parentPath.node.id.type === \"Identifier\"\n ) {\n className = path.parentPath.node.id.name;\n varId = path.scope.parent.generateDeclaredUidIdentifier(className);\n } else {\n varId =\n path.scope.parent.generateDeclaredUidIdentifier(\"decorated_class\");\n }\n\n const newClassExpr = t.classExpression(\n className && t.identifier(className),\n path.node.superClass,\n path.node.body,\n );\n\n const [newPath] = path.replaceWith(\n t.sequenceExpression([newClassExpr, varId]),\n );\n\n return [\n t.cloneNode(varId),\n 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 element: NodePath<ClassDecoratableElement>,\n originalKey: t.PrivateName | t.Expression,\n targetKey: t.PrivateName,\n isComputed = false,\n): void {\n const { static: isStatic } = element.node;\n\n const getterBody = t.blockStatement([\n t.returnStatement(\n t.memberExpression(t.thisExpression(), t.cloneNode(targetKey)),\n ),\n ]);\n\n const setterBody = t.blockStatement([\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.memberExpression(t.thisExpression(), 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-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\nconst FIELD = 0;\nconst ACCESSOR = 1;\nconst METHOD = 2;\nconst GETTER = 3;\nconst SETTER = 4;\n\nconst STATIC = 5;\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\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 generateDecorationExprs(\n info: (DecoratorInfo | ComputedPropInfo)[],\n): t.ArrayExpression {\n return t.arrayExpression(\n filteredOrderedDecoratorInfo(info).map(el => {\n const decs =\n el.decorators.length > 1\n ? t.arrayExpression(el.decorators)\n : el.decorators[0];\n\n const kind = el.isStatic ? el.kind + STATIC : el.kind;\n\n return t.arrayExpression([\n decs,\n t.numericLiteral(kind),\n el.name,\n ...(el.privateMethods || []),\n ]);\n }),\n );\n}\n\nfunction extractElementLocalAssignments(\n decorationInfo: (DecoratorInfo | ComputedPropInfo)[],\n) {\n const localIds: t.Identifier[] = [];\n\n for (const el of filteredOrderedDecoratorInfo(decorationInfo)) {\n const { locals } = el;\n\n if (Array.isArray(locals)) {\n localIds.push(...locals);\n } else if (locals !== undefined) {\n localIds.push(locals);\n }\n }\n\n return localIds;\n}\n\nfunction addCallAccessorsFor(\n element: NodePath,\n key: t.PrivateName,\n getId: t.Identifier,\n setId: t.Identifier,\n) {\n element.insertAfter(\n t.classPrivateMethod(\n \"get\",\n t.cloneNode(key),\n [],\n t.blockStatement([\n t.returnStatement(\n t.callExpression(t.cloneNode(getId), [t.thisExpression()]),\n ),\n ]),\n ),\n );\n\n element.insertAfter(\n t.classPrivateMethod(\n \"set\",\n t.cloneNode(key),\n [t.identifier(\"v\")],\n t.blockStatement([\n t.expressionStatement(\n t.callExpression(t.cloneNode(setId), [\n t.thisExpression(),\n t.identifier(\"v\"),\n ]),\n ),\n ]),\n ),\n );\n}\n\nfunction isNotTsParameter(\n node: t.Identifier | t.Pattern | t.RestElement | t.TSParameterProperty,\n): node is t.Identifier | t.Pattern | t.RestElement {\n return node.type !== \"TSParameterProperty\";\n}\n\nfunction movePrivateAccessor(\n element: NodePath<t.ClassPrivateMethod>,\n key: t.PrivateName,\n methodLocalVar: t.Identifier,\n isStatic: boolean,\n) {\n let params: (t.Identifier | t.RestElement)[];\n let block: t.Statement[];\n\n if (element.node.kind === \"set\") {\n params = [t.identifier(\"v\")];\n block = [\n t.expressionStatement(\n t.callExpression(methodLocalVar, [\n t.thisExpression(),\n t.identifier(\"v\"),\n ]),\n ),\n ];\n } else {\n params = [];\n block = [\n t.returnStatement(t.callExpression(methodLocalVar, [t.thisExpression()])),\n ];\n }\n\n element.replaceWith(\n t.classPrivateMethod(\n element.node.kind,\n t.cloneNode(key),\n params,\n t.blockStatement(block),\n isStatic,\n ),\n );\n}\n\nfunction isClassDecoratableElementPath(\n path: NodePath<ClassElement>,\n): path is NodePath<ClassDecoratableElement> {\n const { type } = path;\n\n return (\n type !== \"TSDeclareMethod\" &&\n type !== \"TSIndexSignature\" &&\n type !== \"StaticBlock\"\n );\n}\n\nfunction staticBlockToIIFE(block: t.StaticBlock) {\n return t.callExpression(\n t.arrowFunctionExpression([], t.blockStatement(block.body)),\n [],\n );\n}\n\nfunction maybeSequenceExpression(exprs: t.Expression[]) {\n if (exprs.length === 0) return t.unaryExpression(\"void\", t.numericLiteral(0));\n if (exprs.length === 1) return exprs[0];\n return t.sequenceExpression(exprs);\n}\n\nfunction transformClass(\n path: NodePath<t.ClassExpression | t.ClassDeclaration>,\n state: PluginPass,\n constantSuper: boolean,\n version: DecoratorVersionKind,\n): NodePath {\n const body = path.get(\"body.body\");\n\n const classDecorators = path.node.decorators;\n let hasElementDecorators = false;\n\n const generateClassPrivateUid = createLazyPrivateUidGeneratorForClass(path);\n\n // Iterate over the class to see if we need to decorate it, and also to\n // transform simple auto accessors which are not decorated\n for (const element of body) {\n if (!isClassDecoratableElementPath(element)) {\n continue;\n }\n\n if (element.node.decorators && element.node.decorators.length > 0) {\n hasElementDecorators = true;\n } else if (element.node.type === \"ClassAccessorProperty\") {\n const { key, value, static: isStatic, computed } = element.node;\n\n const newId = generateClassPrivateUid();\n\n const valueNode = value ? t.cloneNode(value) : undefined;\n\n const newField = generateClassProperty(newId, valueNode, isStatic);\n\n const [newPath] = element.replaceWith(newField);\n addProxyAccessorsFor(newPath, key, newId, computed);\n }\n }\n\n // If nothing is decorated, return\n if (!classDecorators && !hasElementDecorators) return;\n\n const elementDecoratorInfo: (DecoratorInfo | ComputedPropInfo)[] = [];\n\n // The initializer of the first non-static field will be injected with the protoInit call\n let firstFieldPath:\n | NodePath<t.ClassProperty | t.ClassPrivateProperty>\n | undefined;\n let constructorPath: NodePath<t.ClassMethod> | undefined;\n let requiresProtoInit = false;\n let requiresStaticInit = false;\n const decoratedPrivateMethods = new Set<string>();\n\n let protoInitLocal: t.Identifier,\n staticInitLocal: t.Identifier,\n classInitLocal: t.Identifier,\n classIdLocal: t.Identifier;\n const assignments: t.AssignmentExpression[] = [];\n const scopeParent: Scope = path.scope.parent;\n\n const memoiseExpression = (expression: t.Expression, hint: string) => {\n const localEvaluatedId = scopeParent.generateDeclaredUidIdentifier(hint);\n assignments.push(t.assignmentExpression(\"=\", localEvaluatedId, expression));\n return t.cloneNode(localEvaluatedId);\n };\n\n if (classDecorators) {\n classInitLocal = scopeParent.generateDeclaredUidIdentifier(\"initClass\");\n\n const [classId, classPath] = replaceClassWithVar(path);\n path = classPath;\n classIdLocal = classId;\n\n path.node.decorators = null;\n\n for (const classDecorator of classDecorators) {\n if (!scopeParent.isStatic(classDecorator.expression)) {\n classDecorator.expression = memoiseExpression(\n classDecorator.expression,\n \"dec\",\n );\n }\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 if (!scopeParent.isStatic(decoratorPath.node.expression)) {\n decoratorPath.node.expression = memoiseExpression(\n decoratorPath.node.expression,\n \"dec\",\n );\n }\n }\n }\n\n const isComputed =\n \"computed\" in element.node && element.node.computed === true;\n if (isComputed) {\n if (!scopeParent.isStatic(node.key)) {\n node.key = memoiseExpression(node.key as t.Expression, \"computedKey\");\n }\n }\n\n const kind = getElementKind(element);\n const { key } = node;\n\n const isPrivate = key.type === \"PrivateName\";\n\n const isStatic = !!element.node.static;\n\n let name = \"computedKey\";\n\n if (isPrivate) {\n name = key.id.name;\n } else if (!isComputed && key.type === \"Identifier\") {\n name = key.name;\n }\n\n if (isPrivate && !isStatic) {\n if (hasDecorators) {\n needsInstancePrivateBrandCheck = true;\n }\n if (t.isClassPrivateProperty(node) || !lastInstancePrivateName) {\n lastInstancePrivateName = key;\n }\n }\n\n if (element.isClassMethod({ kind: \"constructor\" })) {\n constructorPath = element;\n }\n\n if (hasDecorators) {\n let locals: t.Identifier | t.Identifier[];\n let privateMethods: Array<\n t.FunctionExpression | t.ArrowFunctionExpression\n >;\n\n if (kind === ACCESSOR) {\n const { value } = element.node as t.ClassAccessorProperty;\n\n const params: t.Expression[] = [t.thisExpression()];\n\n if (value) {\n params.push(t.cloneNode(value));\n }\n\n const newId = generateClassPrivateUid();\n const newFieldInitId =\n element.scope.parent.generateDeclaredUidIdentifier(`init_${name}`);\n const newValue = t.callExpression(\n t.cloneNode(newFieldInitId),\n params,\n );\n\n const newField = generateClassProperty(newId, newValue, isStatic);\n const [newPath] = element.replaceWith(newField);\n\n if (isPrivate) {\n privateMethods = extractProxyAccessorsFor(newId, version);\n\n const getId = newPath.scope.parent.generateDeclaredUidIdentifier(\n `get_${name}`,\n );\n const setId = newPath.scope.parent.generateDeclaredUidIdentifier(\n `set_${name}`,\n );\n\n addCallAccessorsFor(newPath, key, getId, setId);\n\n locals = [newFieldInitId, getId, setId];\n } else {\n addProxyAccessorsFor(newPath, key, newId, isComputed);\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 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(elementDecoratorInfo);\n const classDecorations = t.arrayExpression(\n (classDecorators || []).map(d => d.expression),\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 originalClass.body.body.unshift(\n t.staticBlock(\n [\n t.expressionStatement(\n createLocalsAssignment(\n elementLocals,\n classLocals,\n elementDecorations,\n classDecorations,\n needsInstancePrivateBrandCheck ? lastInstancePrivateName : null,\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 // 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 maybePrivateBranName: t.PrivateName | null,\n state: PluginPass,\n version: DecoratorVersionKind,\n) {\n let lhs, rhs;\n const args: t.Expression[] = [\n t.thisExpression(),\n elementDecorations,\n classDecorations,\n ];\n // TODO(Babel 8): Only keep the else branch\n if (\n version === \"2021-12\" ||\n (version === \"2022-03\" && !state.availableHelper(\"applyDecs2203R\"))\n ) {\n lhs = t.arrayPattern([...elementLocals, ...classLocals]);\n rhs = t.callExpression(\n state.addHelper(version === \"2021-12\" ? \"applyDecs\" : \"applyDecs2203\"),\n args,\n );\n } else {\n // TODO(Babel 8): Only keep the if branch\n if (version === \"2023-01\") {\n if (maybePrivateBranName) {\n args.push(\n template.expression.ast`\n _ => ${t.cloneNode(maybePrivateBranName)} in _\n ` as t.ArrowFunctionExpression,\n );\n }\n rhs = t.callExpression(state.addHelper(\"applyDecs2301\"), args);\n } else {\n rhs = t.callExpression(state.addHelper(\"applyDecs2203R\"), args);\n }\n // optimize `{ c: [classLocals] } = applyapplyDecs2203R(...)` to\n // `[classLocals] = applyapplyDecs2203R(...).c`\n if (elementLocals.length > 0) {\n if (classLocals.length > 0) {\n lhs = t.objectPattern([\n t.objectProperty(t.identifier(\"e\"), t.arrayPattern(elementLocals)),\n t.objectProperty(t.identifier(\"c\"), t.arrayPattern(classLocals)),\n ]);\n } else {\n lhs = t.arrayPattern(elementLocals);\n rhs = t.memberExpression(rhs, t.identifier(\"e\"), false, false);\n }\n } else {\n // invariant: classLocals.length > 0\n lhs = t.arrayPattern(classLocals);\n rhs = t.memberExpression(rhs, t.identifier(\"c\"), false, false);\n }\n }\n return t.assignmentExpression(\"=\", lhs, rhs);\n}\n\nexport default function (\n { assertVersion, assumption }: PluginAPI,\n { loose }: Options,\n version: \"2023-01\" | \"2022-03\" | \"2021-12\",\n): PluginObject {\n if (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 const VISITED = new WeakSet<NodePath>();\n const constantSuper = assumption(\"constantSuper\") ?? loose;\n\n return {\n name: \"proposal-decorators\",\n inherits: syntaxDecorators,\n\n visitor: {\n \"ExportNamedDeclaration|ExportDefaultDeclaration\"(\n path: NodePath<t.ExportNamedDeclaration | t.ExportDefaultDeclaration>,\n ) {\n const { declaration } = path.node;\n if (\n declaration?.type === \"ClassDeclaration\" &&\n // When compiling class decorators we need to replace the class\n // binding, so we must split it in two separate declarations.\n declaration.decorators?.length > 0\n ) {\n splitExportDeclaration(path);\n }\n },\n\n Class(path, state) {\n if (VISITED.has(path)) return;\n\n const newPath = transformClass(path, state, constantSuper, version);\n if (newPath) VISITED.add(newPath);\n },\n },\n };\n}\n"],"mappings":"AACA,SAASA,KAAK,IAAIC,CAAC,EAAEC,QAAQ,QAAQ,aAAa;AAClD,OAAOC,gBAAgB,MAAM,iCAAiC;AAC9D,OAAOC,aAAa,MAAM,8BAA8B;AACxD,OAAOC,sBAAsB,MAAM,wCAAwC;AAoB3E,SAASC,WAAWA,CAACC,EAAY,EAAEC,GAAG,GAAGD,EAAE,CAACE,MAAM,GAAG,CAAC,EAAQ;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,CAC/CxN,IAAqE,EACrE;QAAA,IAAAyN,qBAAA;QACA,MAAM;UAAEC;QAAY,CAAC,GAAG1N,IAAI,CAACE,IAAI;QACjC,IACE,CAAAwN,WAAW,oBAAXA,WAAW,CAAE7M,IAAI,MAAK,kBAAkB,IAGxC,EAAA4M,qBAAA,GAAAC,WAAW,CAACvI,UAAU,qBAAtBsI,qBAAA,CAAwBnO,MAAM,IAAG,CAAC,EAClC;UACAJ,sBAAsB,CAACc,IAAI,CAAC;QAC9B;MACF,CAAC;MAED2N,KAAKA,CAAC3N,IAAI,EAAE6G,KAAK,EAAE;QACjB,IAAIuG,OAAO,CAAC7M,GAAG,CAACP,IAAI,CAAC,EAAE;QAEvB,MAAMiC,OAAO,GAAG2E,cAAc,CAAC5G,IAAI,EAAE6G,KAAK,EAAEC,aAAa,EAAEhD,OAAO,CAAC;QACnE,IAAI7B,OAAO,EAAEmL,OAAO,CAACnN,GAAG,CAACgC,OAAO,CAAC;MACnC;IACF;EACF,CAAC;AACH"}
|
|
1
|
+
{"version":3,"names":["_core","require","_pluginSyntaxDecorators","_helperReplaceSupers","_helperSplitExportDeclaration","incrementId","id","idx","length","unshift","current","createPrivateUidGeneratorForClass","classPath","currentPrivateId","privateNames","Set","traverse","PrivateName","path","add","node","name","reifiedId","String","fromCharCode","has","t","privateName","identifier","createLazyPrivateUidGeneratorForClass","generator","replaceClassWithVar","type","varId","scope","generateUidIdentifierBasedOnNode","classId","rename","insertBefore","variableDeclaration","variableDeclarator","get","replaceWith","cloneNode","className","parent","generateDeclaredUidIdentifier","parentPath","newClassExpr","classExpression","superClass","body","newPath","sequenceExpression","generateClassProperty","key","value","isStatic","classPrivateProperty","undefined","classProperty","addProxyAccessorsFor","element","originalKey","targetKey","isComputed","static","getterBody","blockStatement","returnStatement","memberExpression","thisExpression","setterBody","expressionStatement","assignmentExpression","getter","setter","classPrivateMethod","classMethod","insertAfter","extractProxyAccessorsFor","version","template","expression","ast","FIELD","ACCESSOR","METHOD","GETTER","SETTER","STATIC","getElementKind","kind","isDecoratorInfo","info","filteredOrderedDecoratorInfo","filtered","filter","el","generateDecorationExprs","arrayExpression","map","decs","decorators","numericLiteral","privateMethods","extractElementLocalAssignments","decorationInfo","localIds","locals","Array","isArray","push","addCallAccessorsFor","getId","setId","callExpression","isNotTsParameter","movePrivateAccessor","methodLocalVar","params","block","isClassDecoratableElementPath","staticBlockToIIFE","arrowFunctionExpression","maybeSequenceExpression","exprs","unaryExpression","transformClass","state","constantSuper","classDecorators","hasElementDecorators","generateClassPrivateUid","computed","newId","valueNode","newField","elementDecoratorInfo","firstFieldPath","constructorPath","requiresProtoInit","requiresStaticInit","decoratedPrivateMethods","protoInitLocal","staticInitLocal","classInitLocal","classIdLocal","assignments","scopeParent","memoiseExpression","hint","localEvaluatedId","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","classDecorations","elementLocals","protoInitCall","CallExpression","exit","isSuper","skip","super","spreadElement","restElement","size","parentParentPath","left","buildCodeFrameError","classLocals","classInitInjected","classInitCall","originalClass","statics","staticBlocks","forEach","isStaticBlock","isProperty","isClassProperty","isClassPrivateMethod","allValues","staticsClass","addHelper","staticBlock","toStatement","constructorBody","newExpr","newExpression","arguments","createLocalsAssignment","Boolean","expr","crawl","maybePrivateBranName","lhs","rhs","args","availableHelper","arrayPattern","objectPattern","objectProperty","_default","assertVersion","assumption","loose","_assumption","VISITED","WeakSet","inherits","syntaxDecorators","visitor","ExportNamedDeclaration|ExportDefaultDeclaration","_declaration$decorato","declaration","splitExportDeclaration","Class"],"sources":["../src/transformer-2023-01.ts"],"sourcesContent":["import type { NodePath, Scope } from \"@babel/traverse\";\nimport { types as t, template } from \"@babel/core\";\nimport syntaxDecorators from \"@babel/plugin-syntax-decorators\";\nimport ReplaceSupers from \"@babel/helper-replace-supers\";\nimport splitExportDeclaration from \"@babel/helper-split-export-declaration\";\nimport * as charCodes from \"charcodes\";\nimport type { PluginAPI, PluginObject, PluginPass } from \"@babel/core\";\nimport type { Options } from \"./index\";\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-01\" | \"2022-03\" | \"2021-12\";\n\nfunction incrementId(id: number[], idx = id.length - 1): void {\n // If index is -1, id needs an additional character, unshift A\n if (idx === -1) {\n id.unshift(charCodes.uppercaseA);\n return;\n }\n\n const current = id[idx];\n\n if (current === charCodes.uppercaseZ) {\n // if current is Z, skip to a\n id[idx] = charCodes.lowercaseA;\n } else if (current === charCodes.lowercaseZ) {\n // if current is z, reset to A and carry the 1\n id[idx] = charCodes.uppercaseA;\n incrementId(id, idx - 1);\n } else {\n // else, increment by one\n id[idx] = current + 1;\n }\n}\n\n/**\n * Generates a new private name that is unique to the given class. This can be\n * used to create extra class fields and methods for the implementation, while\n * keeping the length of those names as small as possible. This is important for\n * minification purposes (though private names can generally be minified,\n * transpilations and polyfills cannot yet).\n */\nfunction createPrivateUidGeneratorForClass(\n classPath: NodePath<t.ClassDeclaration | t.ClassExpression>,\n): () => t.PrivateName {\n const currentPrivateId: number[] = [];\n const privateNames = new Set<string>();\n\n classPath.traverse({\n PrivateName(path) {\n privateNames.add(path.node.id.name);\n },\n });\n\n return (): t.PrivateName => {\n let reifiedId;\n do {\n incrementId(currentPrivateId);\n reifiedId = String.fromCharCode(...currentPrivateId);\n } while (privateNames.has(reifiedId));\n\n return t.privateName(t.identifier(reifiedId));\n };\n}\n\n/**\n * Wraps the above generator function so that it's run lazily the first time\n * it's actually required. Several types of decoration do not require this, so it\n * saves iterating the class elements an additional time and allocating the space\n * for the Sets of element names.\n */\nfunction createLazyPrivateUidGeneratorForClass(\n classPath: NodePath<t.ClassDeclaration | t.ClassExpression>,\n): () => t.PrivateName {\n let generator: () => t.PrivateName;\n\n return (): t.PrivateName => {\n if (!generator) {\n generator = createPrivateUidGeneratorForClass(classPath);\n }\n\n return generator();\n };\n}\n\n/**\n * Takes a class definition and replaces it with an equivalent class declaration\n * which is then assigned to a local variable. This allows us to reassign the\n * local variable with the decorated version of the class. The class definition\n * retains its original name so that `toString` is not affected, other\n * references to the class are renamed instead.\n */\nfunction replaceClassWithVar(\n path: NodePath<t.ClassDeclaration | t.ClassExpression>,\n): [t.Identifier, NodePath<t.ClassDeclaration | t.ClassExpression>] {\n if (path.type === \"ClassDeclaration\") {\n const varId = path.scope.generateUidIdentifierBasedOnNode(path.node.id);\n const classId = t.identifier(path.node.id.name);\n\n path.scope.rename(classId.name, varId.name);\n\n path.insertBefore(\n t.variableDeclaration(\"let\", [t.variableDeclarator(varId)]),\n );\n path.get(\"id\").replaceWith(classId);\n\n return [t.cloneNode(varId), path];\n } else {\n let className: string;\n let varId: t.Identifier;\n\n if (path.node.id) {\n className = path.node.id.name;\n varId = path.scope.parent.generateDeclaredUidIdentifier(className);\n path.scope.rename(className, varId.name);\n } else if (\n path.parentPath.node.type === \"VariableDeclarator\" &&\n path.parentPath.node.id.type === \"Identifier\"\n ) {\n className = path.parentPath.node.id.name;\n varId = path.scope.parent.generateDeclaredUidIdentifier(className);\n } else {\n varId =\n path.scope.parent.generateDeclaredUidIdentifier(\"decorated_class\");\n }\n\n const newClassExpr = t.classExpression(\n className && t.identifier(className),\n path.node.superClass,\n path.node.body,\n );\n\n const [newPath] = path.replaceWith(\n t.sequenceExpression([newClassExpr, varId]),\n );\n\n return [\n t.cloneNode(varId),\n 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 element: NodePath<ClassDecoratableElement>,\n originalKey: t.PrivateName | t.Expression,\n targetKey: t.PrivateName,\n isComputed = false,\n): void {\n const { static: isStatic } = element.node;\n\n const getterBody = t.blockStatement([\n t.returnStatement(\n t.memberExpression(t.thisExpression(), t.cloneNode(targetKey)),\n ),\n ]);\n\n const setterBody = t.blockStatement([\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.memberExpression(t.thisExpression(), 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-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\nconst FIELD = 0;\nconst ACCESSOR = 1;\nconst METHOD = 2;\nconst GETTER = 3;\nconst SETTER = 4;\n\nconst STATIC = 5;\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\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 generateDecorationExprs(\n info: (DecoratorInfo | ComputedPropInfo)[],\n): t.ArrayExpression {\n return t.arrayExpression(\n filteredOrderedDecoratorInfo(info).map(el => {\n const decs =\n el.decorators.length > 1\n ? t.arrayExpression(el.decorators)\n : el.decorators[0];\n\n const kind = el.isStatic ? el.kind + STATIC : el.kind;\n\n return t.arrayExpression([\n decs,\n t.numericLiteral(kind),\n el.name,\n ...(el.privateMethods || []),\n ]);\n }),\n );\n}\n\nfunction extractElementLocalAssignments(\n decorationInfo: (DecoratorInfo | ComputedPropInfo)[],\n) {\n const localIds: t.Identifier[] = [];\n\n for (const el of filteredOrderedDecoratorInfo(decorationInfo)) {\n const { locals } = el;\n\n if (Array.isArray(locals)) {\n localIds.push(...locals);\n } else if (locals !== undefined) {\n localIds.push(locals);\n }\n }\n\n return localIds;\n}\n\nfunction addCallAccessorsFor(\n element: NodePath,\n key: t.PrivateName,\n getId: t.Identifier,\n setId: t.Identifier,\n) {\n element.insertAfter(\n t.classPrivateMethod(\n \"get\",\n t.cloneNode(key),\n [],\n t.blockStatement([\n t.returnStatement(\n t.callExpression(t.cloneNode(getId), [t.thisExpression()]),\n ),\n ]),\n ),\n );\n\n element.insertAfter(\n t.classPrivateMethod(\n \"set\",\n t.cloneNode(key),\n [t.identifier(\"v\")],\n t.blockStatement([\n t.expressionStatement(\n t.callExpression(t.cloneNode(setId), [\n t.thisExpression(),\n t.identifier(\"v\"),\n ]),\n ),\n ]),\n ),\n );\n}\n\nfunction isNotTsParameter(\n node: t.Identifier | t.Pattern | t.RestElement | t.TSParameterProperty,\n): node is t.Identifier | t.Pattern | t.RestElement {\n return node.type !== \"TSParameterProperty\";\n}\n\nfunction movePrivateAccessor(\n element: NodePath<t.ClassPrivateMethod>,\n key: t.PrivateName,\n methodLocalVar: t.Identifier,\n isStatic: boolean,\n) {\n let params: (t.Identifier | t.RestElement)[];\n let block: t.Statement[];\n\n if (element.node.kind === \"set\") {\n params = [t.identifier(\"v\")];\n block = [\n t.expressionStatement(\n t.callExpression(methodLocalVar, [\n t.thisExpression(),\n t.identifier(\"v\"),\n ]),\n ),\n ];\n } else {\n params = [];\n block = [\n t.returnStatement(t.callExpression(methodLocalVar, [t.thisExpression()])),\n ];\n }\n\n element.replaceWith(\n t.classPrivateMethod(\n element.node.kind,\n t.cloneNode(key),\n params,\n t.blockStatement(block),\n isStatic,\n ),\n );\n}\n\nfunction isClassDecoratableElementPath(\n path: NodePath<ClassElement>,\n): path is NodePath<ClassDecoratableElement> {\n const { type } = path;\n\n return (\n type !== \"TSDeclareMethod\" &&\n type !== \"TSIndexSignature\" &&\n type !== \"StaticBlock\"\n );\n}\n\nfunction staticBlockToIIFE(block: t.StaticBlock) {\n return t.callExpression(\n t.arrowFunctionExpression([], t.blockStatement(block.body)),\n [],\n );\n}\n\nfunction maybeSequenceExpression(exprs: t.Expression[]) {\n if (exprs.length === 0) return t.unaryExpression(\"void\", t.numericLiteral(0));\n if (exprs.length === 1) return exprs[0];\n return t.sequenceExpression(exprs);\n}\n\nfunction transformClass(\n path: NodePath<t.ClassExpression | t.ClassDeclaration>,\n state: PluginPass,\n constantSuper: boolean,\n version: DecoratorVersionKind,\n): NodePath {\n const body = path.get(\"body.body\");\n\n const classDecorators = path.node.decorators;\n let hasElementDecorators = false;\n\n const generateClassPrivateUid = createLazyPrivateUidGeneratorForClass(path);\n\n // Iterate over the class to see if we need to decorate it, and also to\n // transform simple auto accessors which are not decorated\n for (const element of body) {\n if (!isClassDecoratableElementPath(element)) {\n continue;\n }\n\n if (element.node.decorators && element.node.decorators.length > 0) {\n hasElementDecorators = true;\n } else if (element.node.type === \"ClassAccessorProperty\") {\n const { key, value, static: isStatic, computed } = element.node;\n\n const newId = generateClassPrivateUid();\n\n const valueNode = value ? t.cloneNode(value) : undefined;\n\n const newField = generateClassProperty(newId, valueNode, isStatic);\n\n const [newPath] = element.replaceWith(newField);\n addProxyAccessorsFor(newPath, key, newId, computed);\n }\n }\n\n // If nothing is decorated, return\n if (!classDecorators && !hasElementDecorators) return;\n\n const elementDecoratorInfo: (DecoratorInfo | ComputedPropInfo)[] = [];\n\n // The initializer of the first non-static field will be injected with the protoInit call\n let firstFieldPath:\n | NodePath<t.ClassProperty | t.ClassPrivateProperty>\n | undefined;\n let constructorPath: NodePath<t.ClassMethod> | undefined;\n let requiresProtoInit = false;\n let requiresStaticInit = false;\n const decoratedPrivateMethods = new Set<string>();\n\n let protoInitLocal: t.Identifier,\n staticInitLocal: t.Identifier,\n classInitLocal: t.Identifier,\n classIdLocal: t.Identifier;\n const assignments: t.AssignmentExpression[] = [];\n const scopeParent: Scope = path.scope.parent;\n\n const memoiseExpression = (expression: t.Expression, hint: string) => {\n const localEvaluatedId = scopeParent.generateDeclaredUidIdentifier(hint);\n assignments.push(t.assignmentExpression(\"=\", localEvaluatedId, expression));\n return t.cloneNode(localEvaluatedId);\n };\n\n if (classDecorators) {\n classInitLocal = scopeParent.generateDeclaredUidIdentifier(\"initClass\");\n\n const [classId, classPath] = replaceClassWithVar(path);\n path = classPath;\n classIdLocal = classId;\n\n path.node.decorators = null;\n\n for (const classDecorator of classDecorators) {\n if (!scopeParent.isStatic(classDecorator.expression)) {\n classDecorator.expression = memoiseExpression(\n classDecorator.expression,\n \"dec\",\n );\n }\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 if (!scopeParent.isStatic(decoratorPath.node.expression)) {\n decoratorPath.node.expression = memoiseExpression(\n decoratorPath.node.expression,\n \"dec\",\n );\n }\n }\n }\n\n const isComputed =\n \"computed\" in element.node && element.node.computed === true;\n if (isComputed) {\n if (!scopeParent.isStatic(node.key)) {\n node.key = memoiseExpression(node.key as t.Expression, \"computedKey\");\n }\n }\n\n const kind = getElementKind(element);\n const { key } = node;\n\n const isPrivate = key.type === \"PrivateName\";\n\n const isStatic = !!element.node.static;\n\n let name = \"computedKey\";\n\n if (isPrivate) {\n name = key.id.name;\n } else if (!isComputed && key.type === \"Identifier\") {\n name = key.name;\n }\n\n if (isPrivate && !isStatic) {\n if (hasDecorators) {\n needsInstancePrivateBrandCheck = true;\n }\n if (t.isClassPrivateProperty(node) || !lastInstancePrivateName) {\n lastInstancePrivateName = key;\n }\n }\n\n if (element.isClassMethod({ kind: \"constructor\" })) {\n constructorPath = element;\n }\n\n if (hasDecorators) {\n let locals: t.Identifier | t.Identifier[];\n let privateMethods: Array<\n t.FunctionExpression | t.ArrowFunctionExpression\n >;\n\n if (kind === ACCESSOR) {\n const { value } = element.node as t.ClassAccessorProperty;\n\n const params: t.Expression[] = [t.thisExpression()];\n\n if (value) {\n params.push(t.cloneNode(value));\n }\n\n const newId = generateClassPrivateUid();\n const newFieldInitId =\n element.scope.parent.generateDeclaredUidIdentifier(`init_${name}`);\n const newValue = t.callExpression(\n t.cloneNode(newFieldInitId),\n params,\n );\n\n const newField = generateClassProperty(newId, newValue, isStatic);\n const [newPath] = element.replaceWith(newField);\n\n if (isPrivate) {\n privateMethods = extractProxyAccessorsFor(newId, version);\n\n const getId = newPath.scope.parent.generateDeclaredUidIdentifier(\n `get_${name}`,\n );\n const setId = newPath.scope.parent.generateDeclaredUidIdentifier(\n `set_${name}`,\n );\n\n addCallAccessorsFor(newPath, key, getId, setId);\n\n locals = [newFieldInitId, getId, setId];\n } else {\n addProxyAccessorsFor(newPath, key, newId, isComputed);\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 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(elementDecoratorInfo);\n const classDecorations = t.arrayExpression(\n (classDecorators || []).map(d => d.expression),\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 originalClass.body.body.unshift(\n t.staticBlock(\n [\n t.expressionStatement(\n createLocalsAssignment(\n elementLocals,\n classLocals,\n elementDecorations,\n classDecorations,\n needsInstancePrivateBrandCheck ? lastInstancePrivateName : null,\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 // 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 maybePrivateBranName: t.PrivateName | null,\n state: PluginPass,\n version: DecoratorVersionKind,\n) {\n let lhs, rhs;\n const args: t.Expression[] = [\n t.thisExpression(),\n elementDecorations,\n classDecorations,\n ];\n // TODO(Babel 8): Only keep the else branch\n if (\n version === \"2021-12\" ||\n (version === \"2022-03\" && !state.availableHelper(\"applyDecs2203R\"))\n ) {\n lhs = t.arrayPattern([...elementLocals, ...classLocals]);\n rhs = t.callExpression(\n state.addHelper(version === \"2021-12\" ? \"applyDecs\" : \"applyDecs2203\"),\n args,\n );\n } else {\n // TODO(Babel 8): Only keep the if branch\n if (version === \"2023-01\") {\n if (maybePrivateBranName) {\n args.push(\n template.expression.ast`\n _ => ${t.cloneNode(maybePrivateBranName)} in _\n ` as t.ArrowFunctionExpression,\n );\n }\n rhs = t.callExpression(state.addHelper(\"applyDecs2301\"), args);\n } else {\n rhs = t.callExpression(state.addHelper(\"applyDecs2203R\"), args);\n }\n // optimize `{ c: [classLocals] } = applyapplyDecs2203R(...)` to\n // `[classLocals] = applyapplyDecs2203R(...).c`\n if (elementLocals.length > 0) {\n if (classLocals.length > 0) {\n lhs = t.objectPattern([\n t.objectProperty(t.identifier(\"e\"), t.arrayPattern(elementLocals)),\n t.objectProperty(t.identifier(\"c\"), t.arrayPattern(classLocals)),\n ]);\n } else {\n lhs = t.arrayPattern(elementLocals);\n rhs = t.memberExpression(rhs, t.identifier(\"e\"), false, false);\n }\n } else {\n // invariant: classLocals.length > 0\n lhs = t.arrayPattern(classLocals);\n rhs = t.memberExpression(rhs, t.identifier(\"c\"), false, false);\n }\n }\n return t.assignmentExpression(\"=\", lhs, rhs);\n}\n\nexport default function (\n { assertVersion, assumption }: PluginAPI,\n { loose }: Options,\n version: \"2023-01\" | \"2022-03\" | \"2021-12\",\n): PluginObject {\n if (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 const VISITED = new WeakSet<NodePath>();\n const constantSuper = assumption(\"constantSuper\") ?? loose;\n\n return {\n name: \"proposal-decorators\",\n inherits: syntaxDecorators,\n\n visitor: {\n \"ExportNamedDeclaration|ExportDefaultDeclaration\"(\n path: NodePath<t.ExportNamedDeclaration | t.ExportDefaultDeclaration>,\n ) {\n const { declaration } = path.node;\n if (\n declaration?.type === \"ClassDeclaration\" &&\n // When compiling class decorators we need to replace the class\n // binding, so we must split it in two separate declarations.\n declaration.decorators?.length > 0\n ) {\n splitExportDeclaration(path);\n }\n },\n\n Class(path, state) {\n if (VISITED.has(path)) return;\n\n const newPath = transformClass(path, state, constantSuper, version);\n if (newPath) VISITED.add(newPath);\n },\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,6BAAA,GAAAH,OAAA;AAoBA,SAASI,WAAWA,CAACC,EAAY,EAAEC,GAAG,GAAGD,EAAE,CAACE,MAAM,GAAG,CAAC,EAAQ;EAE5D,IAAID,GAAG,KAAK,CAAC,CAAC,EAAE;IACdD,EAAE,CAACG,OAAO,IAAsB;IAChC;EACF;EAEA,MAAMC,OAAO,GAAGJ,EAAE,CAACC,GAAG,CAAC;EAEvB,IAAIG,OAAO,OAAyB,EAAE;IAEpCJ,EAAE,CAACC,GAAG,CAAC,KAAuB;EAChC,CAAC,MAAM,IAAIG,OAAO,QAAyB,EAAE;IAE3CJ,EAAE,CAACC,GAAG,CAAC,KAAuB;IAC9BF,WAAW,CAACC,EAAE,EAAEC,GAAG,GAAG,CAAC,CAAC;EAC1B,CAAC,MAAM;IAELD,EAAE,CAACC,GAAG,CAAC,GAAGG,OAAO,GAAG,CAAC;EACvB;AACF;AASA,SAASC,iCAAiCA,CACxCC,SAA2D,EACtC;EACrB,MAAMC,gBAA0B,GAAG,EAAE;EACrC,MAAMC,YAAY,G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D,OAAO,CAAC;QACnE,IAAI7B,OAAO,EAAEsL,OAAO,CAACvN,GAAG,CAACiC,OAAO,CAAC;MACnC;IACF;EACF,CAAC;AACH"}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _core = require("@babel/core");
|
|
8
|
+
const buildClassDecorator = _core.template.statement(`
|
|
3
9
|
DECORATOR(CLASS_REF = INNER) || CLASS_REF;
|
|
4
10
|
`);
|
|
5
|
-
const buildClassPrototype = template(`
|
|
11
|
+
const buildClassPrototype = (0, _core.template)(`
|
|
6
12
|
CLASS_REF.prototype;
|
|
7
13
|
`);
|
|
8
|
-
const buildGetDescriptor = template(`
|
|
14
|
+
const buildGetDescriptor = (0, _core.template)(`
|
|
9
15
|
Object.getOwnPropertyDescriptor(TARGET, PROPERTY);
|
|
10
16
|
`);
|
|
11
|
-
const buildGetObjectInitializer = template(`
|
|
17
|
+
const buildGetObjectInitializer = (0, _core.template)(`
|
|
12
18
|
(TEMP = Object.getOwnPropertyDescriptor(TARGET, PROPERTY), (TEMP = TEMP ? TEMP.value : undefined), {
|
|
13
19
|
enumerable: true,
|
|
14
20
|
configurable: true,
|
|
@@ -21,12 +27,12 @@ const buildGetObjectInitializer = template(`
|
|
|
21
27
|
const WARNING_CALLS = new WeakSet();
|
|
22
28
|
function applyEnsureOrdering(path) {
|
|
23
29
|
const decorators = (path.isClass() ? [path, ...path.get("body.body")] : path.get("properties")).reduce((acc, prop) => acc.concat(prop.node.decorators || []), []);
|
|
24
|
-
const identDecorators = decorators.filter(decorator => !
|
|
30
|
+
const identDecorators = decorators.filter(decorator => !_core.types.isIdentifier(decorator.expression));
|
|
25
31
|
if (identDecorators.length === 0) return;
|
|
26
|
-
return
|
|
32
|
+
return _core.types.sequenceExpression(identDecorators.map(decorator => {
|
|
27
33
|
const expression = decorator.expression;
|
|
28
34
|
const id = decorator.expression = path.scope.generateDeclaredUidIdentifier("dec");
|
|
29
|
-
return
|
|
35
|
+
return _core.types.assignmentExpression("=", id, expression);
|
|
30
36
|
}).concat([path.node]));
|
|
31
37
|
}
|
|
32
38
|
function applyClassDecorators(classPath) {
|
|
@@ -36,8 +42,8 @@ function applyClassDecorators(classPath) {
|
|
|
36
42
|
const name = classPath.scope.generateDeclaredUidIdentifier("class");
|
|
37
43
|
return decorators.map(dec => dec.expression).reverse().reduce(function (acc, decorator) {
|
|
38
44
|
return buildClassDecorator({
|
|
39
|
-
CLASS_REF:
|
|
40
|
-
DECORATOR:
|
|
45
|
+
CLASS_REF: _core.types.cloneNode(name),
|
|
46
|
+
DECORATOR: _core.types.cloneNode(decorator),
|
|
41
47
|
INNER: acc
|
|
42
48
|
}).expression;
|
|
43
49
|
}, classPath.node);
|
|
@@ -71,33 +77,33 @@ function applyTargetDecorators(path, state, decoratedProps) {
|
|
|
71
77
|
if (node.computed) {
|
|
72
78
|
throw path.buildCodeFrameError("Computed method/property decorators are not yet supported.");
|
|
73
79
|
}
|
|
74
|
-
const property =
|
|
80
|
+
const property = _core.types.isLiteral(node.key) ? node.key : _core.types.stringLiteral(node.key.name);
|
|
75
81
|
const target = path.isClass() && !node.static ? buildClassPrototype({
|
|
76
82
|
CLASS_REF: name
|
|
77
83
|
}).expression : name;
|
|
78
|
-
if (
|
|
84
|
+
if (_core.types.isClassProperty(node, {
|
|
79
85
|
static: false
|
|
80
86
|
})) {
|
|
81
87
|
const descriptor = path.scope.generateDeclaredUidIdentifier("descriptor");
|
|
82
|
-
const initializer = node.value ?
|
|
83
|
-
node.value =
|
|
88
|
+
const initializer = node.value ? _core.types.functionExpression(null, [], _core.types.blockStatement([_core.types.returnStatement(node.value)])) : _core.types.nullLiteral();
|
|
89
|
+
node.value = _core.types.callExpression(state.addHelper("initializerWarningHelper"), [descriptor, _core.types.thisExpression()]);
|
|
84
90
|
WARNING_CALLS.add(node.value);
|
|
85
|
-
acc.push(
|
|
91
|
+
acc.push(_core.types.assignmentExpression("=", _core.types.cloneNode(descriptor), _core.types.callExpression(state.addHelper("applyDecoratedDescriptor"), [_core.types.cloneNode(target), _core.types.cloneNode(property), _core.types.arrayExpression(decorators.map(dec => _core.types.cloneNode(dec.expression))), _core.types.objectExpression([_core.types.objectProperty(_core.types.identifier("configurable"), _core.types.booleanLiteral(true)), _core.types.objectProperty(_core.types.identifier("enumerable"), _core.types.booleanLiteral(true)), _core.types.objectProperty(_core.types.identifier("writable"), _core.types.booleanLiteral(true)), _core.types.objectProperty(_core.types.identifier("initializer"), initializer)])])));
|
|
86
92
|
} else {
|
|
87
|
-
acc.push(
|
|
93
|
+
acc.push(_core.types.callExpression(state.addHelper("applyDecoratedDescriptor"), [_core.types.cloneNode(target), _core.types.cloneNode(property), _core.types.arrayExpression(decorators.map(dec => _core.types.cloneNode(dec.expression))), _core.types.isObjectProperty(node) || _core.types.isClassProperty(node, {
|
|
88
94
|
static: true
|
|
89
95
|
}) ? buildGetObjectInitializer({
|
|
90
96
|
TEMP: path.scope.generateDeclaredUidIdentifier("init"),
|
|
91
|
-
TARGET:
|
|
92
|
-
PROPERTY:
|
|
97
|
+
TARGET: _core.types.cloneNode(target),
|
|
98
|
+
PROPERTY: _core.types.cloneNode(property)
|
|
93
99
|
}).expression : buildGetDescriptor({
|
|
94
|
-
TARGET:
|
|
95
|
-
PROPERTY:
|
|
96
|
-
}).expression,
|
|
100
|
+
TARGET: _core.types.cloneNode(target),
|
|
101
|
+
PROPERTY: _core.types.cloneNode(property)
|
|
102
|
+
}).expression, _core.types.cloneNode(target)]));
|
|
97
103
|
}
|
|
98
104
|
return acc;
|
|
99
105
|
}, []);
|
|
100
|
-
return
|
|
106
|
+
return _core.types.sequenceExpression([_core.types.assignmentExpression("=", _core.types.cloneNode(name), path.node), _core.types.sequenceExpression(exprs), _core.types.cloneNode(name)]);
|
|
101
107
|
}
|
|
102
108
|
function decoratedClassToExpression({
|
|
103
109
|
node,
|
|
@@ -106,8 +112,8 @@ function decoratedClassToExpression({
|
|
|
106
112
|
if (!hasClassDecorators(node) && !hasMethodDecorators(node.body.body)) {
|
|
107
113
|
return;
|
|
108
114
|
}
|
|
109
|
-
const ref = node.id ?
|
|
110
|
-
return
|
|
115
|
+
const ref = node.id ? _core.types.cloneNode(node.id) : scope.generateUidIdentifier("class");
|
|
116
|
+
return _core.types.variableDeclaration("let", [_core.types.variableDeclarator(ref, _core.types.toExpression(node))]);
|
|
111
117
|
}
|
|
112
118
|
const visitor = {
|
|
113
119
|
ExportDefaultDeclaration(path) {
|
|
@@ -115,7 +121,7 @@ const visitor = {
|
|
|
115
121
|
if (!decl.isClassDeclaration()) return;
|
|
116
122
|
const replacement = decoratedClassToExpression(decl);
|
|
117
123
|
if (replacement) {
|
|
118
|
-
const [varDeclPath] = path.replaceWithMultiple([replacement,
|
|
124
|
+
const [varDeclPath] = path.replaceWithMultiple([replacement, _core.types.exportNamedDeclaration(null, [_core.types.exportSpecifier(_core.types.cloneNode(replacement.declarations[0].id), _core.types.identifier("default"))])]);
|
|
119
125
|
if (!decl.node.id) {
|
|
120
126
|
path.scope.registerDeclaration(varDeclPath);
|
|
121
127
|
}
|
|
@@ -142,7 +148,7 @@ const visitor = {
|
|
|
142
148
|
},
|
|
143
149
|
AssignmentExpression(path, state) {
|
|
144
150
|
if (!WARNING_CALLS.has(path.node.right)) return;
|
|
145
|
-
path.replaceWith(
|
|
151
|
+
path.replaceWith(_core.types.callExpression(state.addHelper("initializerDefineProperty"), [_core.types.cloneNode(path.get("left.object").node), _core.types.stringLiteral(path.get("left.property").node.name || path.get("left.property").node.value), _core.types.cloneNode(path.get("right.arguments")[0].node), _core.types.cloneNode(path.get("right.arguments")[1].node)]));
|
|
146
152
|
},
|
|
147
153
|
CallExpression(path, state) {
|
|
148
154
|
if (path.node.arguments.length !== 3) return;
|
|
@@ -150,9 +156,10 @@ const visitor = {
|
|
|
150
156
|
if (path.node.callee.name !== state.addHelper("defineProperty").name) {
|
|
151
157
|
return;
|
|
152
158
|
}
|
|
153
|
-
path.replaceWith(
|
|
159
|
+
path.replaceWith(_core.types.callExpression(state.addHelper("initializerDefineProperty"), [_core.types.cloneNode(path.get("arguments")[0].node), _core.types.cloneNode(path.get("arguments")[1].node), _core.types.cloneNode(path.get("arguments.2.arguments")[0].node), _core.types.cloneNode(path.get("arguments.2.arguments")[1].node)]));
|
|
154
160
|
}
|
|
155
161
|
};
|
|
156
|
-
|
|
162
|
+
var _default = visitor;
|
|
163
|
+
exports.default = _default;
|
|
157
164
|
|
|
158
165
|
//# sourceMappingURL=transformer-legacy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["template","types","t","buildClassDecorator","statement","buildClassPrototype","buildGetDescriptor","buildGetObjectInitializer","WARNING_CALLS","WeakSet","applyEnsureOrdering","path","decorators","isClass","get","reduce","acc","prop","concat","node","identDecorators","filter","decorator","isIdentifier","expression","length","sequenceExpression","map","id","scope","generateDeclaredUidIdentifier","assignmentExpression","applyClassDecorators","classPath","hasClassDecorators","name","dec","reverse","CLASS_REF","cloneNode","DECORATOR","INNER","classNode","applyMethodDecorators","state","hasMethodDecorators","body","applyTargetDecorators","some","_node$decorators","applyObjectDecorators","properties","type","decoratedProps","exprs","computed","buildCodeFrameError","property","isLiteral","key","stringLiteral","target","static","isClassProperty","descriptor","initializer","value","functionExpression","blockStatement","returnStatement","nullLiteral","callExpression","addHelper","thisExpression","add","push","arrayExpression","objectExpression","objectProperty","identifier","booleanLiteral","isObjectProperty","TEMP","TARGET","PROPERTY","decoratedClassToExpression","ref","generateUidIdentifier","variableDeclaration","variableDeclarator","toExpression","visitor","ExportDefaultDeclaration","decl","isClassDeclaration","replacement","varDeclPath","replaceWithMultiple","exportNamedDeclaration","exportSpecifier","declarations","registerDeclaration","ClassDeclaration","newPath","replaceWith","binding","getOwnBinding","ClassExpression","decoratedClass","ObjectExpression","decoratedObject","AssignmentExpression","has","right","CallExpression","arguments","callee"],"sources":["../src/transformer-legacy.ts"],"sourcesContent":["// Fork of https://github.com/loganfsmyth/babel-plugin-proposal-decorators-legacy\n\nimport { template, types as t, type PluginPass } from \"@babel/core\";\nimport type { NodePath, Visitor } from \"@babel/traverse\";\n\nconst buildClassDecorator = template.statement(`\n DECORATOR(CLASS_REF = INNER) || CLASS_REF;\n`) as (replacements: {\n DECORATOR: t.Expression;\n CLASS_REF: t.Identifier;\n INNER: t.Expression;\n}) => t.ExpressionStatement;\n\nconst buildClassPrototype = template(`\n CLASS_REF.prototype;\n`) as (replacements: { CLASS_REF: t.Identifier }) => t.ExpressionStatement;\n\nconst buildGetDescriptor = template(`\n Object.getOwnPropertyDescriptor(TARGET, PROPERTY);\n`) as (replacements: {\n TARGET: t.Expression;\n PROPERTY: t.Literal;\n}) => t.ExpressionStatement;\n\nconst buildGetObjectInitializer = template(`\n (TEMP = Object.getOwnPropertyDescriptor(TARGET, PROPERTY), (TEMP = TEMP ? TEMP.value : undefined), {\n enumerable: true,\n configurable: true,\n writable: true,\n initializer: function(){\n return TEMP;\n }\n })\n`) as (replacements: {\n TEMP: t.Identifier;\n TARGET: t.Expression;\n PROPERTY: t.Literal;\n}) => t.ExpressionStatement;\n\nconst WARNING_CALLS = new WeakSet();\n\n// legacy decorator does not support ClassAccessorProperty\ntype ClassDecoratableElement =\n | t.ClassMethod\n | t.ClassPrivateMethod\n | t.ClassProperty\n | t.ClassPrivateProperty;\n\n/**\n * If the decorator expressions are non-identifiers, hoist them to before the class so we can be sure\n * that they are evaluated in order.\n */\nfunction applyEnsureOrdering(\n path: NodePath<t.ClassExpression | t.ObjectExpression>,\n) {\n // TODO: This should probably also hoist computed properties.\n const decorators: t.Decorator[] = (\n path.isClass()\n ? [\n path,\n ...(path.get(\"body.body\") as NodePath<ClassDecoratableElement>[]),\n ]\n : path.get(\"properties\")\n ).reduce(\n (\n acc: t.Decorator[],\n prop: NodePath<\n t.ObjectMember | t.ClassExpression | ClassDecoratableElement\n >,\n ) => acc.concat(prop.node.decorators || []),\n [],\n );\n\n const identDecorators = decorators.filter(\n decorator => !t.isIdentifier(decorator.expression),\n );\n if (identDecorators.length === 0) return;\n\n return t.sequenceExpression(\n identDecorators\n .map((decorator): t.Expression => {\n const expression = decorator.expression;\n const id = (decorator.expression =\n path.scope.generateDeclaredUidIdentifier(\"dec\"));\n return t.assignmentExpression(\"=\", id, expression);\n })\n .concat([path.node]),\n );\n}\n\n/**\n * Given a class expression with class-level decorators, create a new expression\n * with the proper decorated behavior.\n */\nfunction applyClassDecorators(classPath: NodePath<t.ClassExpression>) {\n if (!hasClassDecorators(classPath.node)) return;\n\n const decorators = classPath.node.decorators || [];\n classPath.node.decorators = null;\n\n const name = classPath.scope.generateDeclaredUidIdentifier(\"class\");\n\n return decorators\n .map(dec => dec.expression)\n .reverse()\n .reduce(function (acc, decorator) {\n return buildClassDecorator({\n CLASS_REF: t.cloneNode(name),\n DECORATOR: t.cloneNode(decorator),\n INNER: acc,\n }).expression;\n }, classPath.node);\n}\n\nfunction hasClassDecorators(classNode: t.Class) {\n return !!(classNode.decorators && classNode.decorators.length);\n}\n\n/**\n * Given a class expression with method-level decorators, create a new expression\n * with the proper decorated behavior.\n */\nfunction applyMethodDecorators(\n path: NodePath<t.ClassExpression>,\n state: PluginPass,\n) {\n if (!hasMethodDecorators(path.node.body.body)) return;\n\n return applyTargetDecorators(\n path,\n state,\n // @ts-expect-error ClassAccessorProperty is not supported in legacy decorator\n path.node.body.body,\n );\n}\n\nfunction hasMethodDecorators(\n body: t.ClassBody[\"body\"] | t.ObjectExpression[\"properties\"],\n) {\n return body.some(\n node =>\n // @ts-expect-error decorators not in SpreadElement/StaticBlock\n node.decorators?.length,\n );\n}\n\n/**\n * Given an object expression with property decorators, create a new expression\n * with the proper decorated behavior.\n */\nfunction applyObjectDecorators(\n path: NodePath<t.ObjectExpression>,\n state: PluginPass,\n) {\n if (!hasMethodDecorators(path.node.properties)) return;\n\n return applyTargetDecorators(\n path,\n state,\n path.node.properties.filter(\n (prop): prop is t.ObjectMember => prop.type !== \"SpreadElement\",\n ),\n );\n}\n\n/**\n * A helper to pull out property decorators into a sequence expression.\n */\nfunction applyTargetDecorators(\n path: NodePath<t.ClassExpression | t.ObjectExpression>,\n state: PluginPass,\n decoratedProps: (t.ObjectMember | ClassDecoratableElement)[],\n) {\n const name = path.scope.generateDeclaredUidIdentifier(\n path.isClass() ? \"class\" : \"obj\",\n );\n\n const exprs = decoratedProps.reduce(function (acc, node) {\n let decorators: t.Decorator[] = [];\n if (node.decorators != null) {\n decorators = node.decorators;\n node.decorators = null;\n }\n\n if (decorators.length === 0) return acc;\n\n if (\n // @ts-expect-error computed is not in ClassPrivateProperty\n node.computed\n ) {\n throw path.buildCodeFrameError(\n \"Computed method/property decorators are not yet supported.\",\n );\n }\n\n const property: t.Literal = t.isLiteral(node.key)\n ? node.key\n : t.stringLiteral(\n // @ts-expect-error: should we handle ClassPrivateProperty?\n node.key.name,\n );\n\n const target =\n path.isClass() && !(node as ClassDecoratableElement).static\n ? buildClassPrototype({\n CLASS_REF: name,\n }).expression\n : name;\n\n if (t.isClassProperty(node, { static: false })) {\n const descriptor = path.scope.generateDeclaredUidIdentifier(\"descriptor\");\n\n const initializer = node.value\n ? t.functionExpression(\n null,\n [],\n t.blockStatement([t.returnStatement(node.value)]),\n )\n : t.nullLiteral();\n\n node.value = t.callExpression(\n state.addHelper(\"initializerWarningHelper\"),\n [descriptor, t.thisExpression()],\n );\n\n WARNING_CALLS.add(node.value);\n\n acc.push(\n t.assignmentExpression(\n \"=\",\n t.cloneNode(descriptor),\n t.callExpression(state.addHelper(\"applyDecoratedDescriptor\"), [\n t.cloneNode(target),\n t.cloneNode(property),\n t.arrayExpression(\n decorators.map(dec => t.cloneNode(dec.expression)),\n ),\n t.objectExpression([\n t.objectProperty(\n t.identifier(\"configurable\"),\n t.booleanLiteral(true),\n ),\n t.objectProperty(\n t.identifier(\"enumerable\"),\n t.booleanLiteral(true),\n ),\n t.objectProperty(\n t.identifier(\"writable\"),\n t.booleanLiteral(true),\n ),\n t.objectProperty(t.identifier(\"initializer\"), initializer),\n ]),\n ]),\n ),\n );\n } else {\n acc.push(\n t.callExpression(state.addHelper(\"applyDecoratedDescriptor\"), [\n t.cloneNode(target),\n t.cloneNode(property),\n t.arrayExpression(decorators.map(dec => t.cloneNode(dec.expression))),\n t.isObjectProperty(node) || t.isClassProperty(node, { static: true })\n ? buildGetObjectInitializer({\n TEMP: path.scope.generateDeclaredUidIdentifier(\"init\"),\n TARGET: t.cloneNode(target),\n PROPERTY: t.cloneNode(property),\n }).expression\n : buildGetDescriptor({\n TARGET: t.cloneNode(target),\n PROPERTY: t.cloneNode(property),\n }).expression,\n t.cloneNode(target),\n ]),\n );\n }\n\n return acc;\n }, []);\n\n return t.sequenceExpression([\n t.assignmentExpression(\"=\", t.cloneNode(name), path.node),\n t.sequenceExpression(exprs),\n t.cloneNode(name),\n ]);\n}\n\nfunction decoratedClassToExpression({ node, scope }: NodePath<t.Class>) {\n if (!hasClassDecorators(node) && !hasMethodDecorators(node.body.body)) {\n return;\n }\n\n const ref = node.id\n ? t.cloneNode(node.id)\n : scope.generateUidIdentifier(\"class\");\n\n return t.variableDeclaration(\"let\", [\n t.variableDeclarator(ref, t.toExpression(node)),\n ]);\n}\n\nconst visitor: Visitor<PluginPass> = {\n ExportDefaultDeclaration(path) {\n const decl = path.get(\"declaration\");\n if (!decl.isClassDeclaration()) return;\n\n const replacement = decoratedClassToExpression(decl);\n if (replacement) {\n const [varDeclPath] = path.replaceWithMultiple([\n replacement,\n t.exportNamedDeclaration(null, [\n t.exportSpecifier(\n // @ts-expect-error todo(flow->ts) might be add more specific return type for decoratedClassToExpression\n t.cloneNode(replacement.declarations[0].id),\n t.identifier(\"default\"),\n ),\n ]),\n ]);\n\n if (!decl.node.id) {\n path.scope.registerDeclaration(varDeclPath);\n }\n }\n },\n ClassDeclaration(path) {\n const replacement = decoratedClassToExpression(path);\n if (replacement) {\n const [newPath] = path.replaceWith(replacement);\n\n const decl = newPath.get(\"declarations.0\");\n const id = decl.node.id as t.Identifier;\n\n // TODO: Maybe add this logic to @babel/traverse\n const binding = path.scope.getOwnBinding(id.name);\n binding.identifier = id;\n binding.path = decl;\n }\n },\n ClassExpression(path, state) {\n // Create a replacement for the class node if there is one. We do one pass to replace classes with\n // class decorators, and a second pass to process method decorators.\n const decoratedClass =\n applyEnsureOrdering(path) ||\n applyClassDecorators(path) ||\n applyMethodDecorators(path, state);\n\n if (decoratedClass) path.replaceWith(decoratedClass);\n },\n ObjectExpression(path, state) {\n const decoratedObject =\n applyEnsureOrdering(path) || applyObjectDecorators(path, state);\n\n if (decoratedObject) path.replaceWith(decoratedObject);\n },\n\n AssignmentExpression(path, state) {\n if (!WARNING_CALLS.has(path.node.right)) return;\n\n path.replaceWith(\n t.callExpression(state.addHelper(\"initializerDefineProperty\"), [\n // @ts-expect-error todo(flow->ts) typesafe NodePath.get\n t.cloneNode(path.get(\"left.object\").node),\n t.stringLiteral(\n // @ts-expect-error todo(flow->ts) typesafe NodePath.get\n path.get(\"left.property\").node.name ||\n // @ts-expect-error todo(flow->ts) typesafe NodePath.get\n path.get(\"left.property\").node.value,\n ),\n // @ts-expect-error todo(flow->ts)\n t.cloneNode(path.get(\"right.arguments\")[0].node),\n // @ts-expect-error todo(flow->ts)\n t.cloneNode(path.get(\"right.arguments\")[1].node),\n ]),\n );\n },\n\n CallExpression(path, state) {\n if (path.node.arguments.length !== 3) return;\n if (!WARNING_CALLS.has(path.node.arguments[2])) return;\n\n // If the class properties plugin isn't enabled, this line will add an unused helper\n // to the code. It's not ideal, but it's ok since the configuration is not valid anyway.\n // @ts-expect-error todo(flow->ts) check that `callee` is Identifier\n if (path.node.callee.name !== state.addHelper(\"defineProperty\").name) {\n return;\n }\n\n path.replaceWith(\n t.callExpression(state.addHelper(\"initializerDefineProperty\"), [\n t.cloneNode(path.get(\"arguments\")[0].node),\n t.cloneNode(path.get(\"arguments\")[1].node),\n // @ts-expect-error todo(flow->ts)\n t.cloneNode(path.get(\"arguments.2.arguments\")[0].node),\n // @ts-expect-error todo(flow->ts)\n t.cloneNode(path.get(\"arguments.2.arguments\")[1].node),\n ]),\n );\n },\n};\n\nexport default visitor;\n"],"mappings":"AAEA,SAASA,QAAQ,EAAEC,KAAK,IAAIC,CAAC,QAAyB,aAAa;AAGnE,MAAMC,mBAAmB,GAAGH,QAAQ,CAACI,SAAS,CAAE;AAChD;AACA,CAAC,CAI0B;AAE3B,MAAMC,mBAAmB,GAAGL,QAAQ,CAAE;AACtC;AACA,CAAC,CAAyE;AAE1E,MAAMM,kBAAkB,GAAGN,QAAQ,CAAE;AACrC;AACA,CAAC,CAG0B;AAE3B,MAAMO,yBAAyB,GAAGP,QAAQ,CAAE;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAI0B;AAE3B,MAAMQ,aAAa,GAAG,IAAIC,OAAO,EAAE;AAanC,SAASC,mBAAmBA,CAC1BC,IAAsD,EACtD;EAEA,MAAMC,UAAyB,GAAG,CAChCD,IAAI,CAACE,OAAO,EAAE,GACV,CACEF,IAAI,EACJ,GAAIA,IAAI,CAACG,GAAG,CAAC,WAAW,CAAyC,CAClE,GACDH,IAAI,CAACG,GAAG,CAAC,YAAY,CAAC,EAC1BC,MAAM,CACN,CACEC,GAAkB,EAClBC,IAEC,KACED,GAAG,CAACE,MAAM,CAACD,IAAI,CAACE,IAAI,CAACP,UAAU,IAAI,EAAE,CAAC,EAC3C,EAAE,CACH;EAED,MAAMQ,eAAe,GAAGR,UAAU,CAACS,MAAM,CACvCC,SAAS,IAAI,CAACpB,CAAC,CAACqB,YAAY,CAACD,SAAS,CAACE,UAAU,CAAC,CACnD;EACD,IAAIJ,eAAe,CAACK,MAAM,KAAK,CAAC,EAAE;EAElC,OAAOvB,CAAC,CAACwB,kBAAkB,CACzBN,eAAe,CACZO,GAAG,CAAEL,SAAS,IAAmB;IAChC,MAAME,UAAU,GA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CAAC,CACH;EACH;AACF,CAAC;AAED,eAAewE,OAAO"}
|
|
1
|
+
{"version":3,"names":["_core","require","buildClassDecorator","template","statement","buildClassPrototype","buildGetDescriptor","buildGetObjectInitializer","WARNING_CALLS","WeakSet","applyEnsureOrdering","path","decorators","isClass","get","reduce","acc","prop","concat","node","identDecorators","filter","decorator","t","isIdentifier","expression","length","sequenceExpression","map","id","scope","generateDeclaredUidIdentifier","assignmentExpression","applyClassDecorators","classPath","hasClassDecorators","name","dec","reverse","CLASS_REF","cloneNode","DECORATOR","INNER","classNode","applyMethodDecorators","state","hasMethodDecorators","body","applyTargetDecorators","some","_node$decorators","applyObjectDecorators","properties","type","decoratedProps","exprs","computed","buildCodeFrameError","property","isLiteral","key","stringLiteral","target","static","isClassProperty","descriptor","initializer","value","functionExpression","blockStatement","returnStatement","nullLiteral","callExpression","addHelper","thisExpression","add","push","arrayExpression","objectExpression","objectProperty","identifier","booleanLiteral","isObjectProperty","TEMP","TARGET","PROPERTY","decoratedClassToExpression","ref","generateUidIdentifier","variableDeclaration","variableDeclarator","toExpression","visitor","ExportDefaultDeclaration","decl","isClassDeclaration","replacement","varDeclPath","replaceWithMultiple","exportNamedDeclaration","exportSpecifier","declarations","registerDeclaration","ClassDeclaration","newPath","replaceWith","binding","getOwnBinding","ClassExpression","decoratedClass","ObjectExpression","decoratedObject","AssignmentExpression","has","right","CallExpression","arguments","callee","_default","exports","default"],"sources":["../src/transformer-legacy.ts"],"sourcesContent":["// Fork of https://github.com/loganfsmyth/babel-plugin-proposal-decorators-legacy\n\nimport { template, types as t, type PluginPass } from \"@babel/core\";\nimport type { NodePath, Visitor } from \"@babel/traverse\";\n\nconst buildClassDecorator = template.statement(`\n DECORATOR(CLASS_REF = INNER) || CLASS_REF;\n`) as (replacements: {\n DECORATOR: t.Expression;\n CLASS_REF: t.Identifier;\n INNER: t.Expression;\n}) => t.ExpressionStatement;\n\nconst buildClassPrototype = template(`\n CLASS_REF.prototype;\n`) as (replacements: { CLASS_REF: t.Identifier }) => t.ExpressionStatement;\n\nconst buildGetDescriptor = template(`\n Object.getOwnPropertyDescriptor(TARGET, PROPERTY);\n`) as (replacements: {\n TARGET: t.Expression;\n PROPERTY: t.Literal;\n}) => t.ExpressionStatement;\n\nconst buildGetObjectInitializer = template(`\n (TEMP = Object.getOwnPropertyDescriptor(TARGET, PROPERTY), (TEMP = TEMP ? TEMP.value : undefined), {\n enumerable: true,\n configurable: true,\n writable: true,\n initializer: function(){\n return TEMP;\n }\n })\n`) as (replacements: {\n TEMP: t.Identifier;\n TARGET: t.Expression;\n PROPERTY: t.Literal;\n}) => t.ExpressionStatement;\n\nconst WARNING_CALLS = new WeakSet();\n\n// legacy decorator does not support ClassAccessorProperty\ntype ClassDecoratableElement =\n | t.ClassMethod\n | t.ClassPrivateMethod\n | t.ClassProperty\n | t.ClassPrivateProperty;\n\n/**\n * If the decorator expressions are non-identifiers, hoist them to before the class so we can be sure\n * that they are evaluated in order.\n */\nfunction applyEnsureOrdering(\n path: NodePath<t.ClassExpression | t.ObjectExpression>,\n) {\n // TODO: This should probably also hoist computed properties.\n const decorators: t.Decorator[] = (\n path.isClass()\n ? [\n path,\n ...(path.get(\"body.body\") as NodePath<ClassDecoratableElement>[]),\n ]\n : path.get(\"properties\")\n ).reduce(\n (\n acc: t.Decorator[],\n prop: NodePath<\n t.ObjectMember | t.ClassExpression | ClassDecoratableElement\n >,\n ) => acc.concat(prop.node.decorators || []),\n [],\n );\n\n const identDecorators = decorators.filter(\n decorator => !t.isIdentifier(decorator.expression),\n );\n if (identDecorators.length === 0) return;\n\n return t.sequenceExpression(\n identDecorators\n .map((decorator): t.Expression => {\n const expression = decorator.expression;\n const id = (decorator.expression =\n path.scope.generateDeclaredUidIdentifier(\"dec\"));\n return t.assignmentExpression(\"=\", id, expression);\n })\n .concat([path.node]),\n );\n}\n\n/**\n * Given a class expression with class-level decorators, create a new expression\n * with the proper decorated behavior.\n */\nfunction applyClassDecorators(classPath: NodePath<t.ClassExpression>) {\n if (!hasClassDecorators(classPath.node)) return;\n\n const decorators = classPath.node.decorators || [];\n classPath.node.decorators = null;\n\n const name = classPath.scope.generateDeclaredUidIdentifier(\"class\");\n\n return decorators\n .map(dec => dec.expression)\n .reverse()\n .reduce(function (acc, decorator) {\n return buildClassDecorator({\n CLASS_REF: t.cloneNode(name),\n DECORATOR: t.cloneNode(decorator),\n INNER: acc,\n }).expression;\n }, classPath.node);\n}\n\nfunction hasClassDecorators(classNode: t.Class) {\n return !!(classNode.decorators && classNode.decorators.length);\n}\n\n/**\n * Given a class expression with method-level decorators, create a new expression\n * with the proper decorated behavior.\n */\nfunction applyMethodDecorators(\n path: NodePath<t.ClassExpression>,\n state: PluginPass,\n) {\n if (!hasMethodDecorators(path.node.body.body)) return;\n\n return applyTargetDecorators(\n path,\n state,\n // @ts-expect-error ClassAccessorProperty is not supported in legacy decorator\n path.node.body.body,\n );\n}\n\nfunction hasMethodDecorators(\n body: t.ClassBody[\"body\"] | t.ObjectExpression[\"properties\"],\n) {\n return body.some(\n node =>\n // @ts-expect-error decorators not in SpreadElement/StaticBlock\n node.decorators?.length,\n );\n}\n\n/**\n * Given an object expression with property decorators, create a new expression\n * with the proper decorated behavior.\n */\nfunction applyObjectDecorators(\n path: NodePath<t.ObjectExpression>,\n state: PluginPass,\n) {\n if (!hasMethodDecorators(path.node.properties)) return;\n\n return applyTargetDecorators(\n path,\n state,\n path.node.properties.filter(\n (prop): prop is t.ObjectMember => prop.type !== \"SpreadElement\",\n ),\n );\n}\n\n/**\n * A helper to pull out property decorators into a sequence expression.\n */\nfunction applyTargetDecorators(\n path: NodePath<t.ClassExpression | t.ObjectExpression>,\n state: PluginPass,\n decoratedProps: (t.ObjectMember | ClassDecoratableElement)[],\n) {\n const name = path.scope.generateDeclaredUidIdentifier(\n path.isClass() ? \"class\" : \"obj\",\n );\n\n const exprs = decoratedProps.reduce(function (acc, node) {\n let decorators: t.Decorator[] = [];\n if (node.decorators != null) {\n decorators = node.decorators;\n node.decorators = null;\n }\n\n if (decorators.length === 0) return acc;\n\n if (\n // @ts-expect-error computed is not in ClassPrivateProperty\n node.computed\n ) {\n throw path.buildCodeFrameError(\n \"Computed method/property decorators are not yet supported.\",\n );\n }\n\n const property: t.Literal = t.isLiteral(node.key)\n ? node.key\n : t.stringLiteral(\n // @ts-expect-error: should we handle ClassPrivateProperty?\n node.key.name,\n );\n\n const target =\n path.isClass() && !(node as ClassDecoratableElement).static\n ? buildClassPrototype({\n CLASS_REF: name,\n }).expression\n : name;\n\n if (t.isClassProperty(node, { static: false })) {\n const descriptor = path.scope.generateDeclaredUidIdentifier(\"descriptor\");\n\n const initializer = node.value\n ? t.functionExpression(\n null,\n [],\n t.blockStatement([t.returnStatement(node.value)]),\n )\n : t.nullLiteral();\n\n node.value = t.callExpression(\n state.addHelper(\"initializerWarningHelper\"),\n [descriptor, t.thisExpression()],\n );\n\n WARNING_CALLS.add(node.value);\n\n acc.push(\n t.assignmentExpression(\n \"=\",\n t.cloneNode(descriptor),\n t.callExpression(state.addHelper(\"applyDecoratedDescriptor\"), [\n t.cloneNode(target),\n t.cloneNode(property),\n t.arrayExpression(\n decorators.map(dec => t.cloneNode(dec.expression)),\n ),\n t.objectExpression([\n t.objectProperty(\n t.identifier(\"configurable\"),\n t.booleanLiteral(true),\n ),\n t.objectProperty(\n t.identifier(\"enumerable\"),\n t.booleanLiteral(true),\n ),\n t.objectProperty(\n t.identifier(\"writable\"),\n t.booleanLiteral(true),\n ),\n t.objectProperty(t.identifier(\"initializer\"), initializer),\n ]),\n ]),\n ),\n );\n } else {\n acc.push(\n t.callExpression(state.addHelper(\"applyDecoratedDescriptor\"), [\n t.cloneNode(target),\n t.cloneNode(property),\n t.arrayExpression(decorators.map(dec => t.cloneNode(dec.expression))),\n t.isObjectProperty(node) || t.isClassProperty(node, { static: true })\n ? buildGetObjectInitializer({\n TEMP: path.scope.generateDeclaredUidIdentifier(\"init\"),\n TARGET: t.cloneNode(target),\n PROPERTY: t.cloneNode(property),\n }).expression\n : buildGetDescriptor({\n TARGET: t.cloneNode(target),\n PROPERTY: t.cloneNode(property),\n }).expression,\n t.cloneNode(target),\n ]),\n );\n }\n\n return acc;\n }, []);\n\n return t.sequenceExpression([\n t.assignmentExpression(\"=\", t.cloneNode(name), path.node),\n t.sequenceExpression(exprs),\n t.cloneNode(name),\n ]);\n}\n\nfunction decoratedClassToExpression({ node, scope }: NodePath<t.Class>) {\n if (!hasClassDecorators(node) && !hasMethodDecorators(node.body.body)) {\n return;\n }\n\n const ref = node.id\n ? t.cloneNode(node.id)\n : scope.generateUidIdentifier(\"class\");\n\n return t.variableDeclaration(\"let\", [\n t.variableDeclarator(ref, t.toExpression(node)),\n ]);\n}\n\nconst visitor: Visitor<PluginPass> = {\n ExportDefaultDeclaration(path) {\n const decl = path.get(\"declaration\");\n if (!decl.isClassDeclaration()) return;\n\n const replacement = decoratedClassToExpression(decl);\n if (replacement) {\n const [varDeclPath] = path.replaceWithMultiple([\n replacement,\n t.exportNamedDeclaration(null, [\n t.exportSpecifier(\n // @ts-expect-error todo(flow->ts) might be add more specific return type for decoratedClassToExpression\n t.cloneNode(replacement.declarations[0].id),\n t.identifier(\"default\"),\n ),\n ]),\n ]);\n\n if (!decl.node.id) {\n path.scope.registerDeclaration(varDeclPath);\n }\n }\n },\n ClassDeclaration(path) {\n const replacement = decoratedClassToExpression(path);\n if (replacement) {\n const [newPath] = path.replaceWith(replacement);\n\n const decl = newPath.get(\"declarations.0\");\n const id = decl.node.id as t.Identifier;\n\n // TODO: Maybe add this logic to @babel/traverse\n const binding = path.scope.getOwnBinding(id.name);\n binding.identifier = id;\n binding.path = decl;\n }\n },\n ClassExpression(path, state) {\n // Create a replacement for the class node if there is one. We do one pass to replace classes with\n // class decorators, and a second pass to process method decorators.\n const decoratedClass =\n applyEnsureOrdering(path) ||\n applyClassDecorators(path) ||\n applyMethodDecorators(path, state);\n\n if (decoratedClass) path.replaceWith(decoratedClass);\n },\n ObjectExpression(path, state) {\n const decoratedObject =\n applyEnsureOrdering(path) || applyObjectDecorators(path, state);\n\n if (decoratedObject) path.replaceWith(decoratedObject);\n },\n\n AssignmentExpression(path, state) {\n if (!WARNING_CALLS.has(path.node.right)) return;\n\n path.replaceWith(\n t.callExpression(state.addHelper(\"initializerDefineProperty\"), [\n // @ts-expect-error todo(flow->ts) typesafe NodePath.get\n t.cloneNode(path.get(\"left.object\").node),\n t.stringLiteral(\n // @ts-expect-error todo(flow->ts) typesafe NodePath.get\n path.get(\"left.property\").node.name ||\n // @ts-expect-error todo(flow->ts) typesafe NodePath.get\n path.get(\"left.property\").node.value,\n ),\n // @ts-expect-error todo(flow->ts)\n t.cloneNode(path.get(\"right.arguments\")[0].node),\n // @ts-expect-error todo(flow->ts)\n t.cloneNode(path.get(\"right.arguments\")[1].node),\n ]),\n );\n },\n\n CallExpression(path, state) {\n if (path.node.arguments.length !== 3) return;\n if (!WARNING_CALLS.has(path.node.arguments[2])) return;\n\n // If the class properties plugin isn't enabled, this line will add an unused helper\n // to the code. It's not ideal, but it's ok since the configuration is not valid anyway.\n // @ts-expect-error todo(flow->ts) check that `callee` is Identifier\n if (path.node.callee.name !== state.addHelper(\"defineProperty\").name) {\n return;\n }\n\n path.replaceWith(\n t.callExpression(state.addHelper(\"initializerDefineProperty\"), [\n t.cloneNode(path.get(\"arguments\")[0].node),\n t.cloneNode(path.get(\"arguments\")[1].node),\n // @ts-expect-error todo(flow->ts)\n t.cloneNode(path.get(\"arguments.2.arguments\")[0].node),\n // @ts-expect-error todo(flow->ts)\n t.cloneNode(path.get(\"arguments.2.arguments\")[1].node),\n ]),\n );\n },\n};\n\nexport default visitor;\n"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAGA,MAAMC,mBAAmB,GAAGC,cAAQ,CAACC,SAAS,CAAE;AAChD;AACA,CAAC,CAI0B;AAE3B,MAAMC,mBAAmB,GAAG,IAAAF,cAAQ,EAAE;AACtC;AACA,CAAC,CAAyE;AAE1E,MAAMG,kBAAkB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ClB,aAAa,CAACyG,GAAG,CAACtG,IAAI,CAACQ,IAAI,CAACiG,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE;IAKhD,IAAIzG,IAAI,CAACQ,IAAI,CAACkG,MAAM,CAACjF,IAAI,KAAKS,KAAK,CAAC4B,SAAS,CAAC,gBAAgB,CAAC,CAACrC,IAAI,EAAE;MACpE;IACF;IAEAzB,IAAI,CAAC8F,WAAW,CACdlF,WAAC,CAACiD,cAAc,CAAC3B,KAAK,CAAC4B,SAAS,CAAC,2BAA2B,CAAC,EAAE,CAC7DlD,WAAC,CAACiB,SAAS,CAAC7B,IAAI,CAACG,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAACK,IAAI,CAAC,EAC1CI,WAAC,CAACiB,SAAS,CAAC7B,IAAI,CAACG,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAACK,IAAI,CAAC,EAE1CI,WAAC,CAACiB,SAAS,CAAC7B,IAAI,CAACG,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAACK,IAAI,CAAC,EAEtDI,WAAC,CAACiB,SAAS,CAAC7B,IAAI,CAACG,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAACK,IAAI,CAAC,CACvD,CAAC,CACH;EACH;AACF,CAAC;AAAC,IAAAmG,QAAA,GAEa1B,OAAO;AAAA2B,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babel/plugin-proposal-decorators",
|
|
3
|
-
"version": "7.21.4-esm.
|
|
3
|
+
"version": "7.21.4-esm.3",
|
|
4
4
|
"author": "The Babel Team (https://babel.dev/team)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,19 +20,19 @@
|
|
|
20
20
|
"decorators"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@babel/helper-create-class-features-plugin": "7.21.4-esm.
|
|
24
|
-
"@babel/helper-plugin-utils": "7.21.4-esm.
|
|
25
|
-
"@babel/helper-replace-supers": "7.21.4-esm.
|
|
26
|
-
"@babel/helper-split-export-declaration": "7.21.4-esm.
|
|
27
|
-
"@babel/plugin-syntax-decorators": "7.21.4-esm.
|
|
23
|
+
"@babel/helper-create-class-features-plugin": "7.21.4-esm.3",
|
|
24
|
+
"@babel/helper-plugin-utils": "7.21.4-esm.3",
|
|
25
|
+
"@babel/helper-replace-supers": "7.21.4-esm.3",
|
|
26
|
+
"@babel/helper-split-export-declaration": "7.21.4-esm.3",
|
|
27
|
+
"@babel/plugin-syntax-decorators": "7.21.4-esm.3"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@babel/core": "^7.0.0-0 || ^7.21.4-esm.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@babel/core": "7.21.4-esm.
|
|
34
|
-
"@babel/helper-plugin-test-runner": "7.21.4-esm.
|
|
35
|
-
"@babel/traverse": "7.21.4-esm.
|
|
33
|
+
"@babel/core": "7.21.4-esm.3",
|
|
34
|
+
"@babel/helper-plugin-test-runner": "7.21.4-esm.3",
|
|
35
|
+
"@babel/traverse": "7.21.4-esm.3",
|
|
36
36
|
"@types/charcodes": "^0.2.0",
|
|
37
37
|
"array.prototype.concat": "^1.0.2",
|
|
38
38
|
"babel-plugin-polyfill-es-shims": "^0.7.1",
|