@babel/plugin-proposal-decorators 7.20.7 → 7.20.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js
CHANGED
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["declare","api","options","assertVersion","legacy","version","name","inherits","syntaxDecorators","visitor","legacyVisitor","transformer2022_03","createClassFeaturePlugin","feature","FEATURES","decorators"],"sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable @babel/development/plugin-name */\n\nimport { declare } from \"@babel/helper-plugin-utils\";\nimport syntaxDecorators from \"@babel/plugin-syntax-decorators\";\nimport {\n createClassFeaturePlugin,\n FEATURES,\n} from \"@babel/helper-create-class-features-plugin\";\nimport legacyVisitor from \"./transformer-legacy\";\nimport transformer2022_03 from \"./transformer-2022-03\";\nimport type { Options as SyntaxOptions } from \"@babel/plugin-syntax-decorators\";\n\ninterface Options extends SyntaxOptions {\n /** @depreated 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 (version === \"2021-12\" || version === \"2022-03\") {\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' or '2022-03'.\",\n );\n }\n});\n"],"mappings":";;;;;;AAEA;AACA;AACA;AAIA;AACA;AAAuD,eAUxC,IAAAA,0BAAO,EAAC,CAACC,GAAG,EAAEC,OAAgB,KAAK;EAChDD,GAAG,CAACE,aAAa,CAAC,CAAC,CAAC
|
|
1
|
+
{"version":3,"names":["declare","api","options","assertVersion","legacy","version","name","inherits","syntaxDecorators","visitor","legacyVisitor","transformer2022_03","createClassFeaturePlugin","feature","FEATURES","decorators"],"sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable @babel/development/plugin-name */\n\nimport { declare } from \"@babel/helper-plugin-utils\";\nimport syntaxDecorators from \"@babel/plugin-syntax-decorators\";\nimport {\n createClassFeaturePlugin,\n FEATURES,\n} from \"@babel/helper-create-class-features-plugin\";\nimport legacyVisitor from \"./transformer-legacy\";\nimport transformer2022_03 from \"./transformer-2022-03\";\nimport type { Options as SyntaxOptions } from \"@babel/plugin-syntax-decorators\";\n\ninterface Options extends SyntaxOptions {\n /** @depreated 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 (version === \"2021-12\" || version === \"2022-03\") {\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' or '2022-03'.\",\n );\n }\n});\n"],"mappings":";;;;;;AAEA;AACA;AACA;AAIA;AACA;AAAuD,eAUxC,IAAAA,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,IAAIL,OAAO,KAAK,SAAS,IAAIA,OAAO,KAAK,SAAS,EAAE;IACzD,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;AAAA"}
|
|
@@ -23,7 +23,6 @@ function incrementId(id, idx = id.length - 1) {
|
|
|
23
23
|
id[idx] = current + 1;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
|
|
27
26
|
function createPrivateUidGeneratorForClass(classPath) {
|
|
28
27
|
const currentPrivateId = [];
|
|
29
28
|
const privateNames = new Set();
|
|
@@ -41,7 +40,6 @@ function createPrivateUidGeneratorForClass(classPath) {
|
|
|
41
40
|
return _core.types.privateName(_core.types.identifier(reifiedId));
|
|
42
41
|
};
|
|
43
42
|
}
|
|
44
|
-
|
|
45
43
|
function createLazyPrivateUidGeneratorForClass(classPath) {
|
|
46
44
|
let generator;
|
|
47
45
|
return () => {
|
|
@@ -51,7 +49,6 @@ function createLazyPrivateUidGeneratorForClass(classPath) {
|
|
|
51
49
|
return generator();
|
|
52
50
|
};
|
|
53
51
|
}
|
|
54
|
-
|
|
55
52
|
function replaceClassWithVar(path) {
|
|
56
53
|
if (path.type === "ClassDeclaration") {
|
|
57
54
|
const varId = path.scope.generateUidIdentifierBasedOnNode(path.node.id);
|
|
@@ -129,7 +126,6 @@ function getElementKind(element) {
|
|
|
129
126
|
}
|
|
130
127
|
}
|
|
131
128
|
}
|
|
132
|
-
|
|
133
129
|
function isDecoratorInfo(info) {
|
|
134
130
|
return "decorators" in info;
|
|
135
131
|
}
|
|
@@ -205,7 +201,6 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
205
201
|
const classDecorators = path.node.decorators;
|
|
206
202
|
let hasElementDecorators = false;
|
|
207
203
|
const generateClassPrivateUid = createLazyPrivateUidGeneratorForClass(path);
|
|
208
|
-
|
|
209
204
|
for (const element of body) {
|
|
210
205
|
if (!isClassDecoratableElementPath(element)) {
|
|
211
206
|
continue;
|
|
@@ -226,16 +221,14 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
226
221
|
addProxyAccessorsFor(newPath, key, newId, computed);
|
|
227
222
|
}
|
|
228
223
|
}
|
|
229
|
-
|
|
230
224
|
if (!classDecorators && !hasElementDecorators) return;
|
|
231
225
|
const elementDecoratorInfo = [];
|
|
232
|
-
|
|
233
226
|
let firstFieldPath;
|
|
234
227
|
let constructorPath;
|
|
235
228
|
let requiresProtoInit = false;
|
|
236
229
|
let requiresStaticInit = false;
|
|
237
230
|
const decoratedPrivateMethods = new Set();
|
|
238
|
-
let protoInitLocal, staticInitLocal, classInitLocal,
|
|
231
|
+
let protoInitLocal, staticInitLocal, classInitLocal, classIdLocal;
|
|
239
232
|
const assignments = [];
|
|
240
233
|
const scopeParent = path.scope.parent;
|
|
241
234
|
const memoiseExpression = (expression, hint) => {
|
|
@@ -245,9 +238,9 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
245
238
|
};
|
|
246
239
|
if (classDecorators) {
|
|
247
240
|
classInitLocal = scopeParent.generateDeclaredUidIdentifier("initClass");
|
|
248
|
-
const [
|
|
241
|
+
const [classId, classPath] = replaceClassWithVar(path);
|
|
249
242
|
path = classPath;
|
|
250
|
-
|
|
243
|
+
classIdLocal = classId;
|
|
251
244
|
path.node.decorators = null;
|
|
252
245
|
for (const classDecorator of classDecorators) {
|
|
253
246
|
if (!scopeParent.isStatic(classDecorator.expression)) {
|
|
@@ -258,7 +251,7 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
258
251
|
if (!path.node.id) {
|
|
259
252
|
path.node.id = path.scope.generateUidIdentifier("Class");
|
|
260
253
|
}
|
|
261
|
-
|
|
254
|
+
classIdLocal = _core.types.cloneNode(path.node.id);
|
|
262
255
|
}
|
|
263
256
|
if (hasElementDecorators) {
|
|
264
257
|
for (const element of body) {
|
|
@@ -339,10 +332,10 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
339
332
|
const replaceSupers = new _helperReplaceSupers.default({
|
|
340
333
|
constantSuper,
|
|
341
334
|
methodPath: element,
|
|
342
|
-
objectRef:
|
|
335
|
+
objectRef: classIdLocal,
|
|
343
336
|
superRef: path.node.superClass,
|
|
344
337
|
file: state.file,
|
|
345
|
-
refToPreserve:
|
|
338
|
+
refToPreserve: classIdLocal
|
|
346
339
|
});
|
|
347
340
|
replaceSupers.replace();
|
|
348
341
|
const {
|
|
@@ -355,7 +348,6 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
355
348
|
movePrivateAccessor(element, _core.types.cloneNode(key), _core.types.cloneNode(locals), isStatic);
|
|
356
349
|
} else {
|
|
357
350
|
const node = element.node;
|
|
358
|
-
|
|
359
351
|
path.node.body.body.unshift(_core.types.classPrivateProperty(key, _core.types.cloneNode(locals), [], node.static));
|
|
360
352
|
decoratedPrivateMethods.add(key.id.name);
|
|
361
353
|
element.remove();
|
|
@@ -397,10 +389,10 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
397
389
|
}
|
|
398
390
|
const elementDecorations = generateDecorationExprs(elementDecoratorInfo);
|
|
399
391
|
const classDecorations = _core.types.arrayExpression((classDecorators || []).map(d => d.expression));
|
|
400
|
-
const
|
|
392
|
+
const elementLocals = extractElementLocalAssignments(elementDecoratorInfo);
|
|
401
393
|
if (requiresProtoInit) {
|
|
402
394
|
protoInitLocal = scopeParent.generateDeclaredUidIdentifier("initProto");
|
|
403
|
-
|
|
395
|
+
elementLocals.push(protoInitLocal);
|
|
404
396
|
const protoInitCall = _core.types.callExpression(_core.types.cloneNode(protoInitLocal), [_core.types.thisExpression()]);
|
|
405
397
|
if (firstFieldPath) {
|
|
406
398
|
const value = firstFieldPath.get("value");
|
|
@@ -433,7 +425,7 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
433
425
|
}
|
|
434
426
|
if (requiresStaticInit) {
|
|
435
427
|
staticInitLocal = scopeParent.generateDeclaredUidIdentifier("initStatic");
|
|
436
|
-
|
|
428
|
+
elementLocals.push(staticInitLocal);
|
|
437
429
|
}
|
|
438
430
|
if (decoratedPrivateMethods.size > 0) {
|
|
439
431
|
path.traverse({
|
|
@@ -441,23 +433,18 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
441
433
|
if (!decoratedPrivateMethods.has(path.node.id.name)) return;
|
|
442
434
|
const parentPath = path.parentPath;
|
|
443
435
|
const parentParentPath = parentPath.parentPath;
|
|
444
|
-
if (
|
|
445
|
-
parentParentPath.node.type === "AssignmentExpression" && parentParentPath.node.left === parentPath.node ||
|
|
446
|
-
parentParentPath.node.type === "UpdateExpression" ||
|
|
447
|
-
parentParentPath.node.type === "RestElement" ||
|
|
448
|
-
parentParentPath.node.type === "ArrayPattern" ||
|
|
449
|
-
parentParentPath.node.type === "ObjectProperty" && parentParentPath.node.value === parentPath.node && parentParentPath.parentPath.type === "ObjectPattern" ||
|
|
450
|
-
parentParentPath.node.type === "ForOfStatement" && parentParentPath.node.left === parentPath.node) {
|
|
436
|
+
if (parentParentPath.node.type === "AssignmentExpression" && parentParentPath.node.left === parentPath.node || parentParentPath.node.type === "UpdateExpression" || parentParentPath.node.type === "RestElement" || parentParentPath.node.type === "ArrayPattern" || parentParentPath.node.type === "ObjectProperty" && parentParentPath.node.value === parentPath.node && parentParentPath.parentPath.type === "ObjectPattern" || parentParentPath.node.type === "ForOfStatement" && parentParentPath.node.left === parentPath.node) {
|
|
451
437
|
throw path.buildCodeFrameError(`Decorated private methods are not updatable, but "#${path.node.id.name}" is updated via this expression.`);
|
|
452
438
|
}
|
|
453
439
|
}
|
|
454
440
|
});
|
|
455
441
|
}
|
|
442
|
+
const classLocals = [];
|
|
456
443
|
let classInitInjected = false;
|
|
457
444
|
const classInitCall = classInitLocal && _core.types.callExpression(_core.types.cloneNode(classInitLocal), []);
|
|
458
445
|
const originalClass = path.node;
|
|
459
446
|
if (classDecorators) {
|
|
460
|
-
|
|
447
|
+
classLocals.push(classIdLocal, classInitLocal);
|
|
461
448
|
const statics = [];
|
|
462
449
|
let staticBlocks = [];
|
|
463
450
|
path.get("body.body").forEach(element => {
|
|
@@ -483,8 +470,7 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
483
470
|
const staticsClass = _core.template.expression.ast`
|
|
484
471
|
class extends ${state.addHelper("identity")} {}
|
|
485
472
|
`;
|
|
486
|
-
staticsClass.body.body = [_core.types.staticBlock([_core.types.toStatement(originalClass, true) ||
|
|
487
|
-
_core.types.expressionStatement(originalClass)]), ...statics];
|
|
473
|
+
staticsClass.body.body = [_core.types.staticBlock([_core.types.toStatement(originalClass, true) || _core.types.expressionStatement(originalClass)]), ...statics];
|
|
488
474
|
const constructorBody = [];
|
|
489
475
|
const newExpr = _core.types.newExpression(staticsClass, []);
|
|
490
476
|
if (staticBlocks.length > 0) {
|
|
@@ -495,10 +481,10 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
495
481
|
constructorBody.push(classInitCall);
|
|
496
482
|
}
|
|
497
483
|
if (constructorBody.length > 0) {
|
|
498
|
-
constructorBody.unshift(_core.types.callExpression(_core.types.super(), [_core.types.cloneNode(
|
|
484
|
+
constructorBody.unshift(_core.types.callExpression(_core.types.super(), [_core.types.cloneNode(classIdLocal)]));
|
|
499
485
|
staticsClass.body.body.push(_core.types.classMethod("constructor", _core.types.identifier("constructor"), [], _core.types.blockStatement([_core.types.expressionStatement(_core.types.sequenceExpression(constructorBody))])));
|
|
500
486
|
} else {
|
|
501
|
-
newExpr.arguments.push(_core.types.cloneNode(
|
|
487
|
+
newExpr.arguments.push(_core.types.cloneNode(classIdLocal));
|
|
502
488
|
}
|
|
503
489
|
path.replaceWith(newExpr);
|
|
504
490
|
}
|
|
@@ -506,13 +492,32 @@ function transformClass(path, state, constantSuper, version) {
|
|
|
506
492
|
if (!classInitInjected && classInitCall) {
|
|
507
493
|
path.node.body.body.push(_core.types.staticBlock([_core.types.expressionStatement(classInitCall)]));
|
|
508
494
|
}
|
|
509
|
-
originalClass.body.body.unshift(_core.types.staticBlock([_core.types.expressionStatement(
|
|
510
|
-
|
|
495
|
+
originalClass.body.body.unshift(_core.types.staticBlock([_core.types.expressionStatement(createLocalsAssignment(elementLocals, classLocals, elementDecorations, classDecorations, state, version)), requiresStaticInit && _core.types.expressionStatement(_core.types.callExpression(_core.types.cloneNode(staticInitLocal), [_core.types.thisExpression()]))].filter(Boolean)));
|
|
511
496
|
path.insertBefore(assignments.map(expr => _core.types.expressionStatement(expr)));
|
|
512
|
-
|
|
513
497
|
path.scope.crawl();
|
|
514
498
|
return path;
|
|
515
499
|
}
|
|
500
|
+
function createLocalsAssignment(elementLocals, classLocals, elementDecorations, classDecorations, state, version) {
|
|
501
|
+
let lhs, rhs;
|
|
502
|
+
if (version === "2021-12" || version === "2022-03" && !state.availableHelper("applyDecs2203R")) {
|
|
503
|
+
lhs = _core.types.arrayPattern([...elementLocals, ...classLocals]);
|
|
504
|
+
rhs = _core.types.callExpression(state.addHelper(version === "2021-12" ? "applyDecs" : "applyDecs2203"), [_core.types.thisExpression(), elementDecorations, classDecorations]);
|
|
505
|
+
} else {
|
|
506
|
+
rhs = _core.types.callExpression(state.addHelper("applyDecs2203R"), [_core.types.thisExpression(), elementDecorations, classDecorations]);
|
|
507
|
+
if (elementLocals.length > 0) {
|
|
508
|
+
if (classLocals.length > 0) {
|
|
509
|
+
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))]);
|
|
510
|
+
} else {
|
|
511
|
+
lhs = _core.types.arrayPattern(elementLocals);
|
|
512
|
+
rhs = _core.types.memberExpression(rhs, _core.types.identifier("e"), false, false);
|
|
513
|
+
}
|
|
514
|
+
} else {
|
|
515
|
+
lhs = _core.types.arrayPattern(classLocals);
|
|
516
|
+
rhs = _core.types.memberExpression(rhs, _core.types.identifier("c"), false, false);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
return _core.types.assignmentExpression("=", lhs, rhs);
|
|
520
|
+
}
|
|
516
521
|
function _default({
|
|
517
522
|
assertVersion,
|
|
518
523
|
assumption
|
|
@@ -532,8 +537,7 @@ function _default({
|
|
|
532
537
|
const {
|
|
533
538
|
declaration
|
|
534
539
|
} = path.node;
|
|
535
|
-
if ((declaration == null ? void 0 : declaration.type) === "ClassDeclaration" &&
|
|
536
|
-
((_declaration$decorato = declaration.decorators) == null ? void 0 : _declaration$decorato.length) > 0) {
|
|
540
|
+
if ((declaration == null ? void 0 : declaration.type) === "ClassDeclaration" && ((_declaration$decorato = declaration.decorators) == null ? void 0 : _declaration$decorato.length) > 0) {
|
|
537
541
|
(0, _helperSplitExportDeclaration.default)(path);
|
|
538
542
|
}
|
|
539
543
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["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","functionExpression","FIELD","ACCESSOR","METHOD","GETTER","SETTER","STATIC","getElementKind","kind","isDecoratorInfo","info","filteredOrderedDecoratorInfo","filtered","filter","el","generateDecorationExprs","arrayExpression","map","decs","decorators","decInfo","numericLiteral","privateMethods","Array","isArray","push","extractElementLocalAssignments","decorationInfo","localIds","locals","addCallAccessorsFor","getId","setId","callExpression","isNotTsParameter","movePrivateAccessor","methodLocalVar","params","block","isClassDecoratableElementPath","staticBlockToIIFE","arrowFunctionExpression","maybeSequenceExpression","exprs","unaryExpression","transformClass","state","constantSuper","version","classDecorators","hasElementDecorators","generateClassPrivateUid","computed","newId","valueNode","newField","elementDecoratorInfo","firstFieldPath","constructorPath","requiresProtoInit","requiresStaticInit","decoratedPrivateMethods","protoInitLocal","staticInitLocal","classInitLocal","classLocal","assignments","scopeParent","memoiseExpression","expression","hint","localEvaluatedId","localId","classDecorator","generateUidIdentifier","hasDecorators","decoratorPath","isPrivate","isClassMethod","newFieldInitId","newValue","initId","valuePath","v","replaceSupers","ReplaceSupers","methodPath","objectRef","superRef","file","refToPreserve","replace","async","isAsync","remove","nameExpr","stringLiteral","d","elementDecorations","classDecorations","protoInitCall","CallExpression","exit","isSuper","skip","super","spreadElement","restElement","size","parentParentPath","left","buildCodeFrameError","classInitInjected","classInitCall","originalClass","statics","staticBlocks","forEach","isStaticBlock","isProperty","isClassProperty","isClassPrivateProperty","isClassPrivateMethod","allValues","staticsClass","template","ast","addHelper","staticBlock","toStatement","constructorBody","newExpr","newExpression","arguments","arrayPattern","Boolean","expr","crawl","assertVersion","assumption","loose","VISITED","WeakSet","inherits","syntaxDecorators","visitor","declaration","splitExportDeclaration","Class"],"sources":["../src/transformer-2022-03.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\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): t.FunctionExpression[] {\n return [\n t.functionExpression(\n undefined,\n [],\n t.blockStatement([\n t.returnStatement(\n t.memberExpression(t.thisExpression(), t.cloneNode(targetKey)),\n ),\n ]),\n ),\n t.functionExpression(\n undefined,\n [t.identifier(\"value\")],\n t.blockStatement([\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.memberExpression(t.thisExpression(), t.cloneNode(targetKey)),\n t.identifier(\"value\"),\n ),\n ),\n ]),\n ),\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: t.FunctionExpression | t.FunctionExpression[] | 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 const decInfo = [decs, t.numericLiteral(kind), el.name];\n\n const { privateMethods } = el;\n\n if (Array.isArray(privateMethods)) {\n decInfo.push(...privateMethods);\n } else if (privateMethods) {\n decInfo.push(privateMethods);\n }\n\n return t.arrayExpression(decInfo);\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: \"2022-03\" | \"2021-12\",\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 classLocal: 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 [localId, classPath] = replaceClassWithVar(path);\n path = classPath;\n classLocal = localId;\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 classLocal = t.cloneNode(path.node.id);\n }\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 (element.isClassMethod({ kind: \"constructor\" })) {\n constructorPath = element;\n }\n\n if (hasDecorators) {\n let locals: t.Identifier | t.Identifier[];\n let privateMethods: t.FunctionExpression | t.FunctionExpression[];\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);\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);\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: classLocal,\n superRef: path.node.superClass,\n file: state.file,\n refToPreserve: classLocal,\n });\n\n replaceSupers.replace();\n\n const {\n params,\n body,\n async: isAsync,\n } = element.node as t.ClassPrivateMethod;\n\n privateMethods = t.functionExpression(\n undefined,\n params.filter(isNotTsParameter),\n body,\n isAsync,\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 locals: t.Identifier[] =\n extractElementLocalAssignments(elementDecoratorInfo);\n\n if (requiresProtoInit) {\n protoInitLocal = scopeParent.generateDeclaredUidIdentifier(\"initProto\");\n locals.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 locals.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 let classInitInjected = false;\n const classInitCall =\n classInitLocal && t.callExpression(t.cloneNode(classInitLocal), []);\n\n const originalClass = path.node;\n\n if (classDecorators) {\n locals.push(classLocal, 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(classLocal)]),\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(classLocal));\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 t.assignmentExpression(\n \"=\",\n t.arrayPattern(locals),\n t.callExpression(\n state.addHelper(\n version === \"2021-12\" ? \"applyDecs\" : \"applyDecs2203\",\n ),\n [t.thisExpression(), elementDecorations, classDecorations],\n ),\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\nexport default function (\n { assertVersion, assumption }: PluginAPI,\n { loose }: Options,\n version: \"2022-03\" | \"2021-12\",\n): PluginObject {\n assertVersion(version === \"2021-12\" ? \"^7.16.0\" : \"^7.19.0\");\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;AACA;AACA;AACA;AAkBA,SAASA,WAAW,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,iCAAiC,CACxCC,SAA2D,EACtC;EACrB,MAAMC,gBAA0B,GAAG,EAAE;EACrC,MAAMC,YAAY,GAAG,IAAIC,GAAG,EAAU;EAEtCH,SAAS,CAACI,QAAQ,CAAC;IACjBC,WAAW,CAACC,IA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,IAAI,EAAE6G,KAAK,EAAE;QACjB,IAAI+F,OAAO,CAACrM,GAAG,CAACP,IAAI,CAAC,EAAE;QAEvB,MAAMkC,OAAO,GAAG0E,cAAc,CAAC5G,IAAI,EAAE6G,KAAK,EAAEC,aAAa,EAAEC,OAAO,CAAC;QACnE,IAAI7E,OAAO,EAAE0K,OAAO,CAAC3M,GAAG,CAACiC,OAAO,CAAC;MACnC;IACF;EACF,CAAC;AACH"}
|
|
1
|
+
{"version":3,"names":["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","functionExpression","FIELD","ACCESSOR","METHOD","GETTER","SETTER","STATIC","getElementKind","kind","isDecoratorInfo","info","filteredOrderedDecoratorInfo","filtered","filter","el","generateDecorationExprs","arrayExpression","map","decs","decorators","decInfo","numericLiteral","privateMethods","Array","isArray","push","extractElementLocalAssignments","decorationInfo","localIds","locals","addCallAccessorsFor","getId","setId","callExpression","isNotTsParameter","movePrivateAccessor","methodLocalVar","params","block","isClassDecoratableElementPath","staticBlockToIIFE","arrowFunctionExpression","maybeSequenceExpression","exprs","unaryExpression","transformClass","state","constantSuper","version","classDecorators","hasElementDecorators","generateClassPrivateUid","computed","newId","valueNode","newField","elementDecoratorInfo","firstFieldPath","constructorPath","requiresProtoInit","requiresStaticInit","decoratedPrivateMethods","protoInitLocal","staticInitLocal","classInitLocal","classIdLocal","assignments","scopeParent","memoiseExpression","expression","hint","localEvaluatedId","classDecorator","generateUidIdentifier","hasDecorators","decoratorPath","isPrivate","isClassMethod","newFieldInitId","newValue","initId","valuePath","v","replaceSupers","ReplaceSupers","methodPath","objectRef","superRef","file","refToPreserve","replace","async","isAsync","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","isClassPrivateProperty","isClassPrivateMethod","allValues","staticsClass","template","ast","addHelper","staticBlock","toStatement","constructorBody","newExpr","newExpression","arguments","createLocalsAssignment","Boolean","expr","crawl","lhs","rhs","availableHelper","arrayPattern","objectPattern","objectProperty","assertVersion","assumption","loose","VISITED","WeakSet","inherits","syntaxDecorators","visitor","declaration","splitExportDeclaration","Class"],"sources":["../src/transformer-2022-03.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 = \"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): t.FunctionExpression[] {\n return [\n t.functionExpression(\n undefined,\n [],\n t.blockStatement([\n t.returnStatement(\n t.memberExpression(t.thisExpression(), t.cloneNode(targetKey)),\n ),\n ]),\n ),\n t.functionExpression(\n undefined,\n [t.identifier(\"value\")],\n t.blockStatement([\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.memberExpression(t.thisExpression(), t.cloneNode(targetKey)),\n t.identifier(\"value\"),\n ),\n ),\n ]),\n ),\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: t.FunctionExpression | t.FunctionExpression[] | 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 const decInfo = [decs, t.numericLiteral(kind), el.name];\n\n const { privateMethods } = el;\n\n if (Array.isArray(privateMethods)) {\n decInfo.push(...privateMethods);\n } else if (privateMethods) {\n decInfo.push(privateMethods);\n }\n\n return t.arrayExpression(decInfo);\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 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 (element.isClassMethod({ kind: \"constructor\" })) {\n constructorPath = element;\n }\n\n if (hasDecorators) {\n let locals: t.Identifier | t.Identifier[];\n let privateMethods: t.FunctionExpression | t.FunctionExpression[];\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);\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);\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 = t.functionExpression(\n undefined,\n params.filter(isNotTsParameter),\n body,\n isAsync,\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 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 state: PluginPass,\n version: DecoratorVersionKind,\n) {\n let lhs, rhs;\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 [t.thisExpression(), elementDecorations, classDecorations],\n );\n } else {\n rhs = t.callExpression(state.addHelper(\"applyDecs2203R\"), [\n t.thisExpression(),\n elementDecorations,\n classDecorations,\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: \"2022-03\" | \"2021-12\",\n): PluginObject {\n assertVersion(version === \"2021-12\" ? \"^7.16.0\" : \"^7.19.0\");\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;AACA;AACA;AACA;AAoBA,SAASA,WAAW,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;AAS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AMtG,aAAa,kBAAGmG,UAAU,CAAC,eAAe,CAAC,0BAAIC,KAAK;EAE1D,OAAO;IACL/M,IAAI,EAAE,qBAAqB;IAC3BkN,QAAQ,EAAEC,+BAAgB;IAE1BC,OAAO,EAAE;MACP,iDAAiD,CAC/CvN,IAAqE,EACrE;QAAA;QACA,MAAM;UAAEwN;QAAY,CAAC,GAAGxN,IAAI,CAACE,IAAI;QACjC,IACE,CAAAsN,WAAW,oBAAXA,WAAW,CAAE1M,IAAI,MAAK,kBAAkB,IAGxC,0BAAA0M,WAAW,CAACtI,UAAU,qBAAtB,sBAAwB5F,MAAM,IAAG,CAAC,EAClC;UACA,IAAAmO,qCAAsB,EAACzN,IAAI,CAAC;QAC9B;MACF,CAAC;MAED0N,KAAK,CAAC1N,IAAI,EAAE6G,KAAK,EAAE;QACjB,IAAIsG,OAAO,CAAC5M,GAAG,CAACP,IAAI,CAAC,EAAE;QAEvB,MAAMkC,OAAO,GAAG0E,cAAc,CAAC5G,IAAI,EAAE6G,KAAK,EAAEC,aAAa,EAAEC,OAAO,CAAC;QACnE,IAAI7E,OAAO,EAAEiL,OAAO,CAAClN,GAAG,CAACiC,OAAO,CAAC;MACnC;IACF;EACF,CAAC;AACH"}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _core = require("@babel/core");
|
|
8
|
-
|
|
9
8
|
const buildClassDecorator = _core.template.statement(`
|
|
10
9
|
DECORATOR(CLASS_REF = INNER) || CLASS_REF;
|
|
11
10
|
`);
|
|
@@ -26,7 +25,6 @@ const buildGetObjectInitializer = (0, _core.template)(`
|
|
|
26
25
|
})
|
|
27
26
|
`);
|
|
28
27
|
const WARNING_CALLS = new WeakSet();
|
|
29
|
-
|
|
30
28
|
function applyEnsureOrdering(path) {
|
|
31
29
|
const decorators = (path.isClass() ? [path, ...path.get("body.body")] : path.get("properties")).reduce((acc, prop) => acc.concat(prop.node.decorators || []), []);
|
|
32
30
|
const identDecorators = decorators.filter(decorator => !_core.types.isIdentifier(decorator.expression));
|
|
@@ -37,7 +35,6 @@ function applyEnsureOrdering(path) {
|
|
|
37
35
|
return _core.types.assignmentExpression("=", id, expression);
|
|
38
36
|
}).concat([path.node]));
|
|
39
37
|
}
|
|
40
|
-
|
|
41
38
|
function applyClassDecorators(classPath) {
|
|
42
39
|
if (!hasClassDecorators(classPath.node)) return;
|
|
43
40
|
const decorators = classPath.node.decorators || [];
|
|
@@ -54,11 +51,9 @@ function applyClassDecorators(classPath) {
|
|
|
54
51
|
function hasClassDecorators(classNode) {
|
|
55
52
|
return !!(classNode.decorators && classNode.decorators.length);
|
|
56
53
|
}
|
|
57
|
-
|
|
58
54
|
function applyMethodDecorators(path, state) {
|
|
59
55
|
if (!hasMethodDecorators(path.node.body.body)) return;
|
|
60
|
-
return applyTargetDecorators(path, state,
|
|
61
|
-
path.node.body.body);
|
|
56
|
+
return applyTargetDecorators(path, state, path.node.body.body);
|
|
62
57
|
}
|
|
63
58
|
function hasMethodDecorators(body) {
|
|
64
59
|
return body.some(node => {
|
|
@@ -66,12 +61,10 @@ function hasMethodDecorators(body) {
|
|
|
66
61
|
return (_node$decorators = node.decorators) == null ? void 0 : _node$decorators.length;
|
|
67
62
|
});
|
|
68
63
|
}
|
|
69
|
-
|
|
70
64
|
function applyObjectDecorators(path, state) {
|
|
71
65
|
if (!hasMethodDecorators(path.node.properties)) return;
|
|
72
66
|
return applyTargetDecorators(path, state, path.node.properties.filter(prop => prop.type !== "SpreadElement"));
|
|
73
67
|
}
|
|
74
|
-
|
|
75
68
|
function applyTargetDecorators(path, state, decoratedProps) {
|
|
76
69
|
const name = path.scope.generateDeclaredUidIdentifier(path.isClass() ? "class" : "obj");
|
|
77
70
|
const exprs = decoratedProps.reduce(function (acc, node) {
|
|
@@ -81,12 +74,10 @@ function applyTargetDecorators(path, state, decoratedProps) {
|
|
|
81
74
|
node.decorators = null;
|
|
82
75
|
}
|
|
83
76
|
if (decorators.length === 0) return acc;
|
|
84
|
-
if (
|
|
85
|
-
node.computed) {
|
|
77
|
+
if (node.computed) {
|
|
86
78
|
throw path.buildCodeFrameError("Computed method/property decorators are not yet supported.");
|
|
87
79
|
}
|
|
88
|
-
const property = _core.types.isLiteral(node.key) ? node.key : _core.types.stringLiteral(
|
|
89
|
-
node.key.name);
|
|
80
|
+
const property = _core.types.isLiteral(node.key) ? node.key : _core.types.stringLiteral(node.key.name);
|
|
90
81
|
const target = path.isClass() && !node.static ? buildClassPrototype({
|
|
91
82
|
CLASS_REF: name
|
|
92
83
|
}).expression : name;
|
|
@@ -130,8 +121,7 @@ const visitor = {
|
|
|
130
121
|
if (!decl.isClassDeclaration()) return;
|
|
131
122
|
const replacement = decoratedClassToExpression(decl);
|
|
132
123
|
if (replacement) {
|
|
133
|
-
const [varDeclPath] = path.replaceWithMultiple([replacement, _core.types.exportNamedDeclaration(null, [_core.types.exportSpecifier(
|
|
134
|
-
_core.types.cloneNode(replacement.declarations[0].id), _core.types.identifier("default"))])]);
|
|
124
|
+
const [varDeclPath] = path.replaceWithMultiple([replacement, _core.types.exportNamedDeclaration(null, [_core.types.exportSpecifier(_core.types.cloneNode(replacement.declarations[0].id), _core.types.identifier("default"))])]);
|
|
135
125
|
if (!decl.node.id) {
|
|
136
126
|
path.scope.registerDeclaration(varDeclPath);
|
|
137
127
|
}
|
|
@@ -143,7 +133,6 @@ const visitor = {
|
|
|
143
133
|
const [newPath] = path.replaceWith(replacement);
|
|
144
134
|
const decl = newPath.get("declarations.0");
|
|
145
135
|
const id = decl.node.id;
|
|
146
|
-
|
|
147
136
|
const binding = path.scope.getOwnBinding(id.name);
|
|
148
137
|
binding.identifier = id;
|
|
149
138
|
binding.path = decl;
|
|
@@ -159,23 +148,15 @@ const visitor = {
|
|
|
159
148
|
},
|
|
160
149
|
AssignmentExpression(path, state) {
|
|
161
150
|
if (!WARNING_CALLS.has(path.node.right)) return;
|
|
162
|
-
path.replaceWith(_core.types.callExpression(state.addHelper("initializerDefineProperty"), [
|
|
163
|
-
_core.types.cloneNode(path.get("left.object").node), _core.types.stringLiteral(
|
|
164
|
-
path.get("left.property").node.name ||
|
|
165
|
-
path.get("left.property").node.value),
|
|
166
|
-
_core.types.cloneNode(path.get("right.arguments")[0].node),
|
|
167
|
-
_core.types.cloneNode(path.get("right.arguments")[1].node)]));
|
|
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)]));
|
|
168
152
|
},
|
|
169
153
|
CallExpression(path, state) {
|
|
170
154
|
if (path.node.arguments.length !== 3) return;
|
|
171
155
|
if (!WARNING_CALLS.has(path.node.arguments[2])) return;
|
|
172
|
-
|
|
173
156
|
if (path.node.callee.name !== state.addHelper("defineProperty").name) {
|
|
174
157
|
return;
|
|
175
158
|
}
|
|
176
|
-
path.replaceWith(_core.types.callExpression(state.addHelper("initializerDefineProperty"), [_core.types.cloneNode(path.get("arguments")[0].node), _core.types.cloneNode(path.get("arguments")[1].node),
|
|
177
|
-
_core.types.cloneNode(path.get("arguments.2.arguments")[0].node),
|
|
178
|
-
_core.types.cloneNode(path.get("arguments.2.arguments")[1].node)]));
|
|
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)]));
|
|
179
160
|
}
|
|
180
161
|
};
|
|
181
162
|
var _default = visitor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["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","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;;AAGA,MAAMA,mBAAmB,GAAGC,cAAQ,CAACC,SAAS,CAAE;AAChD;AACA,CAAC,CAI0B;AAE3B,MAAMC,mBAAmB,GAAG,IAAAF,cAAQ,EAAE;AACtC;AACA,CAAC,CAAyE;AAE1E,MAAMG,kBAAkB,GAAG,IAAAH,cAAQ,EAAE;AACrC;AACA,CAAC,CAG0B;AAE3B,MAAMI,yBAAyB,GAAG,IAAAJ,cAAQ,EAAE;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAI0B;AAE3B,MAAMK,aAAa,GAAG,IAAIC,OAAO,EAAE;;A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6F,WAAW,CACdjF,WAAC,CAACgD,cAAc,CAAC1B,KAAK,CAAC2B,SAAS,CAAC,2BAA2B,CAAC,EAAE,CAC7DjD,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;IAE1CI,WAAC,CAACiB,SAAS,CAAC7B,IAAI,CAACG,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAACK,IAAI,CAAC;IAEtDI,WAAC,CAACiB,SAAS,CAAC7B,IAAI,CAACG,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAACK,IAAI,CAAC,CACvD,CAAC,CACH;EACH;AACF,CAAC;AAAC,eAEawE,OAAO;AAAA"}
|
|
1
|
+
{"version":3,"names":["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","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;AAGA,MAAMA,mBAAmB,GAAGC,cAAQ,CAACC,SAAS,CAAE;AAChD;AACA,CAAC,CAI0B;AAE3B,MAAMC,mBAAmB,GAAG,IAAAF,cAAQ,EAAE;AACtC;AACA,CAAC,CAAyE;AAE1E,MAAMG,kBAAkB,GAAG,IAAAH,cAAQ,EAAE;AACrC;AACA,CAAC,CAG0B;AAE3B,MAAMI,yBAAyB,GAAG,IAAAJ,cAAQ,EAAE;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAI0B;AAE3B,MAAMK,aAAa,GAAG,IAAIC,OAAO,EAAE;AAanC,SAASC,mBAAmB,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,CAACC,WAAC,CAACC,YAAY,CAACF,SAAS,CAACG,UAAU,CAAC,CACnD;EACD,IAAIL,eAAe,CAACM,MAAM,KAAK,CAAC,EAAE;EAEl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AAC,CACH;EACH;AACF,CAAC;AAAC,eAEawE,OAAO;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babel/plugin-proposal-decorators",
|
|
3
|
-
"version": "7.20.
|
|
3
|
+
"version": "7.20.13",
|
|
4
4
|
"author": "The Babel Team (https://babel.dev/team)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"decorators"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@babel/helper-create-class-features-plugin": "^7.20.
|
|
23
|
+
"@babel/helper-create-class-features-plugin": "^7.20.12",
|
|
24
24
|
"@babel/helper-plugin-utils": "^7.20.2",
|
|
25
25
|
"@babel/helper-replace-supers": "^7.20.7",
|
|
26
26
|
"@babel/helper-split-export-declaration": "^7.18.6",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"@babel/core": "^7.0.0-0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@babel/core": "^7.20.
|
|
33
|
+
"@babel/core": "^7.20.12",
|
|
34
34
|
"@babel/helper-plugin-test-runner": "^7.18.6",
|
|
35
|
-
"@babel/traverse": "^7.20.
|
|
35
|
+
"@babel/traverse": "^7.20.13",
|
|
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",
|