diff options
Diffstat (limited to 'node_modules/@babel/helper-create-class-features-plugin')
13 files changed, 1016 insertions, 396 deletions
diff --git a/node_modules/@babel/helper-create-class-features-plugin/lib/decorators-2018-09.js.map b/node_modules/@babel/helper-create-class-features-plugin/lib/decorators-2018-09.js.map index 051a19b5..32173714 100644 --- a/node_modules/@babel/helper-create-class-features-plugin/lib/decorators-2018-09.js.map +++ b/node_modules/@babel/helper-create-class-features-plugin/lib/decorators-2018-09.js.map @@ -1 +1 @@ -{"version":3,"names":["_core","require","_helperReplaceSupers","_helperFunctionName","hasOwnDecorators","node","_node$decorators","decorators","length","hasDecorators","body","some","prop","key","value","t","objectProperty","identifier","method","objectMethod","blockStatement","takeDecorators","result","arrayExpression","map","decorator","expression","undefined","getKey","computed","isIdentifier","stringLiteral","name","String","extractElementDescriptor","file","classRef","superRef","path","isMethod","isClassMethod","isPrivate","buildCodeFrameError","type","scope","isTSDeclareMethod","ReplaceSupers","methodPath","objectRef","refToPreserve","replace","properties","kind","static","booleanLiteral","filter","Boolean","id","transformed","toExpression","push","nameFunction","isClassProperty","template","statements","ast","buildUndefinedNode","remove","objectExpression","addDecorateHelper","addHelper","buildDecoratedClass","ref","elements","initializeId","generateUidIdentifier","isDeclaration","isStrict","isInStrictMode","superClass","cloneNode","superId","generateUidIdentifierBasedOnNode","classDecorators","definitions","element","abstract","wrapperCall","nullLiteral","arguments","directives","directive","directiveLiteral","replacement","classPathDesc","statement","instanceNodes","wrapClass","replaceWith","get"],"sources":["../src/decorators-2018-09.ts"],"sourcesContent":["// TODO(Babel 8): Remove this file\n\nimport { types as t, template } from \"@babel/core\";\nimport type { File } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport ReplaceSupers from \"@babel/helper-replace-supers\";\nimport nameFunction from \"@babel/helper-function-name\";\n\ntype Decoratable = Extract<t.Node, { decorators?: t.Decorator[] | null }>;\n\nexport function hasOwnDecorators(node: t.Class | t.ClassBody[\"body\"][number]) {\n // @ts-expect-error: 'decorators' not in TSIndexSignature\n return !!node.decorators?.length;\n}\n\nexport function hasDecorators(node: t.Class) {\n return hasOwnDecorators(node) || node.body.body.some(hasOwnDecorators);\n}\n\nfunction prop(key: string, value?: t.Expression) {\n if (!value) return null;\n return t.objectProperty(t.identifier(key), value);\n}\n\nfunction method(key: string, body: t.Statement[]) {\n return t.objectMethod(\n \"method\",\n t.identifier(key),\n [],\n t.blockStatement(body),\n );\n}\n\nfunction takeDecorators(node: Decoratable) {\n let result: t.ArrayExpression | undefined;\n if (node.decorators && node.decorators.length > 0) {\n result = t.arrayExpression(\n node.decorators.map(decorator => decorator.expression),\n );\n }\n node.decorators = undefined;\n return result;\n}\n\ntype AcceptedElement = Exclude<ClassElement, t.TSIndexSignature>;\ntype SupportedElement = Exclude<\n AcceptedElement,\n | t.ClassPrivateMethod\n | t.ClassPrivateProperty\n | t.ClassAccessorProperty\n | t.StaticBlock\n>;\n\nfunction getKey(node: SupportedElement) {\n if (node.computed) {\n return node.key;\n } else if (t.isIdentifier(node.key)) {\n return t.stringLiteral(node.key.name);\n } else {\n return t.stringLiteral(\n String(\n // A non-identifier non-computed key\n (node.key as t.StringLiteral | t.NumericLiteral | t.BigIntLiteral)\n .value,\n ),\n );\n }\n}\n\nfunction extractElementDescriptor(\n file: File,\n classRef: t.Identifier,\n superRef: t.Identifier,\n path: NodePath<AcceptedElement>,\n) {\n const isMethod = path.isClassMethod();\n if (path.isPrivate()) {\n throw path.buildCodeFrameError(\n `Private ${\n isMethod ? \"methods\" : \"fields\"\n } in decorated classes are not supported yet.`,\n );\n }\n if (path.node.type === \"ClassAccessorProperty\") {\n throw path.buildCodeFrameError(\n `Accessor properties are not supported in 2018-09 decorator transform, please specify { \"version\": \"2021-12\" } instead.`,\n );\n }\n if (path.node.type === \"StaticBlock\") {\n throw path.buildCodeFrameError(\n `Static blocks are not supported in 2018-09 decorator transform, please specify { \"version\": \"2021-12\" } instead.`,\n );\n }\n\n const { node, scope } = path as NodePath<SupportedElement>;\n\n if (!path.isTSDeclareMethod()) {\n new ReplaceSupers({\n methodPath: path as NodePath<\n Exclude<SupportedElement, t.TSDeclareMethod>\n >,\n objectRef: classRef,\n superRef,\n file,\n refToPreserve: classRef,\n }).replace();\n }\n\n const properties: t.ObjectExpression[\"properties\"] = [\n prop(\"kind\", t.stringLiteral(t.isClassMethod(node) ? node.kind : \"field\")),\n prop(\"decorators\", takeDecorators(node as Decoratable)),\n prop(\"static\", node.static && t.booleanLiteral(true)),\n prop(\"key\", getKey(node)),\n ].filter(Boolean);\n\n if (t.isClassMethod(node)) {\n const id = node.computed\n ? null\n : (node.key as\n | t.Identifier\n | t.StringLiteral\n | t.NumericLiteral\n | t.BigIntLiteral);\n const transformed = t.toExpression(node);\n properties.push(\n prop(\n \"value\",\n nameFunction({ node: transformed, id, scope }) || transformed,\n ),\n );\n } else if (t.isClassProperty(node) && node.value) {\n properties.push(\n method(\"value\", template.statements.ast`return ${node.value}`),\n );\n } else {\n properties.push(prop(\"value\", scope.buildUndefinedNode()));\n }\n\n path.remove();\n\n return t.objectExpression(properties);\n}\n\nfunction addDecorateHelper(file: File) {\n return file.addHelper(\"decorate\");\n}\n\ntype ClassElement = t.Class[\"body\"][\"body\"][number];\ntype ClassElementPath = NodePath<ClassElement>;\n\nexport function buildDecoratedClass(\n ref: t.Identifier,\n path: NodePath<t.Class>,\n elements: ClassElementPath[],\n file: File,\n) {\n const { node, scope } = path;\n const initializeId = scope.generateUidIdentifier(\"initialize\");\n const isDeclaration = node.id && path.isDeclaration();\n const isStrict = path.isInStrictMode();\n const { superClass } = node;\n\n node.type = \"ClassDeclaration\";\n if (!node.id) node.id = t.cloneNode(ref);\n\n let superId: t.Identifier;\n if (superClass) {\n superId = scope.generateUidIdentifierBasedOnNode(node.superClass, \"super\");\n node.superClass = superId;\n }\n\n const classDecorators = takeDecorators(node);\n const definitions = t.arrayExpression(\n elements\n .filter(\n element =>\n // @ts-expect-error Ignore TypeScript's abstract methods (see #10514)\n !element.node.abstract && element.node.type !== \"TSIndexSignature\",\n )\n .map(path =>\n extractElementDescriptor(\n file,\n node.id,\n superId,\n // @ts-expect-error TS can not exclude TSIndexSignature\n path,\n ),\n ),\n );\n\n const wrapperCall = template.expression.ast`\n ${addDecorateHelper(file)}(\n ${classDecorators || t.nullLiteral()},\n function (${initializeId}, ${superClass ? t.cloneNode(superId) : null}) {\n ${node}\n return { F: ${t.cloneNode(node.id)}, d: ${definitions} };\n },\n ${superClass}\n )\n ` as t.CallExpression & { arguments: [unknown, t.FunctionExpression] };\n\n if (!isStrict) {\n wrapperCall.arguments[1].body.directives.push(\n t.directive(t.directiveLiteral(\"use strict\")),\n );\n }\n\n let replacement: t.Node = wrapperCall;\n let classPathDesc = \"arguments.1.body.body.0\";\n if (isDeclaration) {\n replacement = template.statement.ast`let ${ref} = ${wrapperCall}`;\n classPathDesc = \"declarations.0.init.\" + classPathDesc;\n }\n\n return {\n instanceNodes: [\n template.statement.ast`\n ${t.cloneNode(initializeId)}(this)\n ` as t.ExpressionStatement,\n ],\n wrapClass(path: NodePath<t.Class>) {\n path.replaceWith(replacement);\n return path.get(classPathDesc) as NodePath;\n },\n };\n}\n"],"mappings":";;;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AAIO,SAASG,gBAAgBA,CAACC,IAA2C,EAAE;EAAA,IAAAC,gBAAA;EAE5E,OAAO,CAAC,GAAAA,gBAAA,GAACD,IAAI,CAACE,UAAU,aAAfD,gBAAA,CAAiBE,MAAM;AAClC;AAEO,SAASC,aAAaA,CAACJ,IAAa,EAAE;EAC3C,OAAOD,gBAAgB,CAACC,IAAI,CAAC,IAAIA,IAAI,CAACK,IAAI,CAACA,IAAI,CAACC,IAAI,CAACP,gBAAgB,CAAC;AACxE;AAEA,SAASQ,IAAIA,CAACC,GAAW,EAAEC,KAAoB,EAAE;EAC/C,IAAI,CAACA,KAAK,EAAE,OAAO,IAAI;EAC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C4E,SAAS,CAAC5E,WAAC,CAAC6E,gBAAgB,CAAC,YAAY,CAAC,CAC9C,CAAC;EACH;EAEA,IAAIC,WAAmB,GAAGN,WAAW;EACrC,IAAIO,aAAa,GAAG,yBAAyB;EAC7C,IAAIlB,aAAa,EAAE;IACjBiB,WAAW,GAAG9B,cAAQ,CAACgC,SAAS,CAAC9B,GAAI,OAAMO,GAAI,MAAKe,WAAY,EAAC;IACjEO,aAAa,GAAG,sBAAsB,GAAGA,aAAa;EACxD;EAEA,OAAO;IACLE,aAAa,EAAE,CACbjC,cAAQ,CAACgC,SAAS,CAAC9B,GAAI;AAC7B,UAAUlD,WAAC,CAACiE,SAAS,CAACN,YAAY,CAAE;AACpC,OAAO,CACF;IACDuB,SAASA,CAAC3D,IAAuB,EAAE;MACjCA,IAAI,CAAC4D,WAAW,CAACL,WAAW,CAAC;MAC7B,OAAOvD,IAAI,CAAC6D,GAAG,CAACL,aAAa,CAAC;IAChC;EACF,CAAC;AACH"}
\ No newline at end of file +{"version":3,"names":["_core","require","_helperReplaceSupers","_helperFunctionName","hasOwnDecorators","node","_node$decorators","decorators","length","hasDecorators","body","some","prop","key","value","t","objectProperty","identifier","method","objectMethod","blockStatement","takeDecorators","result","arrayExpression","map","decorator","expression","undefined","getKey","computed","isIdentifier","stringLiteral","name","String","extractElementDescriptor","file","classRef","superRef","path","isMethod","isClassMethod","isPrivate","buildCodeFrameError","type","scope","isTSDeclareMethod","ReplaceSupers","methodPath","objectRef","refToPreserve","replace","properties","kind","static","booleanLiteral","filter","Boolean","id","transformed","toExpression","push","nameFunction","isClassProperty","template","statements","ast","buildUndefinedNode","remove","objectExpression","addDecorateHelper","addHelper","buildDecoratedClass","ref","elements","initializeId","generateUidIdentifier","isDeclaration","isStrict","isInStrictMode","superClass","cloneNode","superId","generateUidIdentifierBasedOnNode","classDecorators","definitions","element","abstract","wrapperCall","nullLiteral","arguments","directives","directive","directiveLiteral","replacement","classPathDesc","statement","instanceNodes","wrapClass","replaceWith","get"],"sources":["../src/decorators-2018-09.ts"],"sourcesContent":["// TODO(Babel 8): Remove this file\n\nimport { types as t, template } from \"@babel/core\";\nimport type { File } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport ReplaceSupers from \"@babel/helper-replace-supers\";\nimport nameFunction from \"@babel/helper-function-name\";\n\ntype Decoratable = Extract<t.Node, { decorators?: t.Decorator[] | null }>;\n\nexport function hasOwnDecorators(node: t.Class | t.ClassBody[\"body\"][number]) {\n // @ts-expect-error: 'decorators' not in TSIndexSignature\n return !!node.decorators?.length;\n}\n\nexport function hasDecorators(node: t.Class) {\n return hasOwnDecorators(node) || node.body.body.some(hasOwnDecorators);\n}\n\nfunction prop(key: string, value?: t.Expression) {\n if (!value) return null;\n return t.objectProperty(t.identifier(key), value);\n}\n\nfunction method(key: string, body: t.Statement[]) {\n return t.objectMethod(\n \"method\",\n t.identifier(key),\n [],\n t.blockStatement(body),\n );\n}\n\nfunction takeDecorators(node: Decoratable) {\n let result: t.ArrayExpression | undefined;\n if (node.decorators && node.decorators.length > 0) {\n result = t.arrayExpression(\n node.decorators.map(decorator => decorator.expression),\n );\n }\n node.decorators = undefined;\n return result;\n}\n\ntype AcceptedElement = Exclude<ClassElement, t.TSIndexSignature>;\ntype SupportedElement = Exclude<\n AcceptedElement,\n | t.ClassPrivateMethod\n | t.ClassPrivateProperty\n | t.ClassAccessorProperty\n | t.StaticBlock\n>;\n\nfunction getKey(node: SupportedElement) {\n if (node.computed) {\n return node.key;\n } else if (t.isIdentifier(node.key)) {\n return t.stringLiteral(node.key.name);\n } else {\n return t.stringLiteral(\n String(\n // A non-identifier non-computed key\n (node.key as t.StringLiteral | t.NumericLiteral | t.BigIntLiteral)\n .value,\n ),\n );\n }\n}\n\nfunction extractElementDescriptor(\n file: File,\n classRef: t.Identifier,\n superRef: t.Identifier,\n path: NodePath<AcceptedElement>,\n) {\n const isMethod = path.isClassMethod();\n if (path.isPrivate()) {\n throw path.buildCodeFrameError(\n `Private ${\n isMethod ? \"methods\" : \"fields\"\n } in decorated classes are not supported yet.`,\n );\n }\n if (path.node.type === \"ClassAccessorProperty\") {\n throw path.buildCodeFrameError(\n `Accessor properties are not supported in 2018-09 decorator transform, please specify { \"version\": \"2021-12\" } instead.`,\n );\n }\n if (path.node.type === \"StaticBlock\") {\n throw path.buildCodeFrameError(\n `Static blocks are not supported in 2018-09 decorator transform, please specify { \"version\": \"2021-12\" } instead.`,\n );\n }\n\n const { node, scope } = path as NodePath<SupportedElement>;\n\n if (!path.isTSDeclareMethod()) {\n new ReplaceSupers({\n methodPath: path as NodePath<\n Exclude<SupportedElement, t.TSDeclareMethod>\n >,\n objectRef: classRef,\n superRef,\n file,\n refToPreserve: classRef,\n }).replace();\n }\n\n const properties: t.ObjectExpression[\"properties\"] = [\n prop(\"kind\", t.stringLiteral(t.isClassMethod(node) ? node.kind : \"field\")),\n prop(\"decorators\", takeDecorators(node as Decoratable)),\n prop(\"static\", node.static && t.booleanLiteral(true)),\n prop(\"key\", getKey(node)),\n ].filter(Boolean);\n\n if (t.isClassMethod(node)) {\n const id = node.computed\n ? null\n : (node.key as\n | t.Identifier\n | t.StringLiteral\n | t.NumericLiteral\n | t.BigIntLiteral);\n const transformed = t.toExpression(node);\n properties.push(\n prop(\n \"value\",\n nameFunction({ node: transformed, id, scope }) || transformed,\n ),\n );\n } else if (t.isClassProperty(node) && node.value) {\n properties.push(\n method(\"value\", template.statements.ast`return ${node.value}`),\n );\n } else {\n properties.push(prop(\"value\", scope.buildUndefinedNode()));\n }\n\n path.remove();\n\n return t.objectExpression(properties);\n}\n\nfunction addDecorateHelper(file: File) {\n return file.addHelper(\"decorate\");\n}\n\ntype ClassElement = t.Class[\"body\"][\"body\"][number];\ntype ClassElementPath = NodePath<ClassElement>;\n\nexport function buildDecoratedClass(\n ref: t.Identifier,\n path: NodePath<t.Class>,\n elements: ClassElementPath[],\n file: File,\n) {\n const { node, scope } = path;\n const initializeId = scope.generateUidIdentifier(\"initialize\");\n const isDeclaration = node.id && path.isDeclaration();\n const isStrict = path.isInStrictMode();\n const { superClass } = node;\n\n node.type = \"ClassDeclaration\";\n if (!node.id) node.id = t.cloneNode(ref);\n\n let superId: t.Identifier;\n if (superClass) {\n superId = scope.generateUidIdentifierBasedOnNode(node.superClass, \"super\");\n node.superClass = superId;\n }\n\n const classDecorators = takeDecorators(node);\n const definitions = t.arrayExpression(\n elements\n .filter(\n element =>\n // @ts-expect-error Ignore TypeScript's abstract methods (see #10514)\n !element.node.abstract && element.node.type !== \"TSIndexSignature\",\n )\n .map(path =>\n extractElementDescriptor(\n file,\n node.id,\n superId,\n // @ts-expect-error TS can not exclude TSIndexSignature\n path,\n ),\n ),\n );\n\n const wrapperCall = template.expression.ast`\n ${addDecorateHelper(file)}(\n ${classDecorators || t.nullLiteral()},\n function (${initializeId}, ${superClass ? t.cloneNode(superId) : null}) {\n ${node}\n return { F: ${t.cloneNode(node.id)}, d: ${definitions} };\n },\n ${superClass}\n )\n ` as t.CallExpression & { arguments: [unknown, t.FunctionExpression] };\n\n if (!isStrict) {\n wrapperCall.arguments[1].body.directives.push(\n t.directive(t.directiveLiteral(\"use strict\")),\n );\n }\n\n let replacement: t.Node = wrapperCall;\n let classPathDesc = \"arguments.1.body.body.0\";\n if (isDeclaration) {\n replacement = template.statement.ast`let ${ref} = ${wrapperCall}`;\n classPathDesc = \"declarations.0.init.\" + classPathDesc;\n }\n\n return {\n instanceNodes: [\n template.statement.ast`\n ${t.cloneNode(initializeId)}(this)\n ` as t.ExpressionStatement,\n ],\n wrapClass(path: NodePath<t.Class>) {\n path.replaceWith(replacement);\n return path.get(classPathDesc) as NodePath;\n },\n };\n}\n"],"mappings":";;;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AAIO,SAASG,gBAAgBA,CAACC,IAA2C,EAAE;EAAA,IAAAC,gBAAA;EAE5E,OAAO,CAAC,GAAAA,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,SAAS,CAACC,OAAO,CAAC,GAAG,IAAK;AAC5E,UAAU5E,IAAK;AACf,sBAAsBU,WAAC,CAACiE,SAAS,CAAC3E,IAAI,CAACoD,EAAE,CAAE,QAAO2B,WAAY;AAC9D;AACA,QAAQL,UAAW;AACnB;AACA,GAAwE;EAEtE,IAAI,CAACF,QAAQ,EAAE;IACbU,WAAW,CAACE,SAAS,CAAC,CAAC,CAAC,CAAC/E,IAAI,CAACgF,UAAU,CAAC9B,IAAI,CAC3C7C,WAAC,CAAC4E,SAAS,CAAC5E,WAAC,CAAC6E,gBAAgB,CAAC,YAAY,CAAC,CAC9C,CAAC;EACH;EAEA,IAAIC,WAAmB,GAAGN,WAAW;EACrC,IAAIO,aAAa,GAAG,yBAAyB;EAC7C,IAAIlB,aAAa,EAAE;IACjBiB,WAAW,GAAG9B,cAAQ,CAACgC,SAAS,CAAC9B,GAAI,OAAMO,GAAI,MAAKe,WAAY,EAAC;IACjEO,aAAa,GAAG,sBAAsB,GAAGA,aAAa;EACxD;EAEA,OAAO;IACLE,aAAa,EAAE,CACbjC,cAAQ,CAACgC,SAAS,CAAC9B,GAAI;AAC7B,UAAUlD,WAAC,CAACiE,SAAS,CAACN,YAAY,CAAE;AACpC,OAAO,CACF;IACDuB,SAASA,CAAC3D,IAAuB,EAAE;MACjCA,IAAI,CAAC4D,WAAW,CAACL,WAAW,CAAC;MAC7B,OAAOvD,IAAI,CAAC6D,GAAG,CAACL,aAAa,CAAC;IAChC;EACF,CAAC;AACH","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/helper-create-class-features-plugin/lib/decorators.js b/node_modules/@babel/helper-create-class-features-plugin/lib/decorators.js index 2793f6ab..d131f29e 100644 --- a/node_modules/@babel/helper-create-class-features-plugin/lib/decorators.js +++ b/node_modules/@babel/helper-create-class-features-plugin/lib/decorators.js @@ -8,6 +8,8 @@ var _core = require("@babel/core"); var _helperReplaceSupers = require("@babel/helper-replace-supers"); var _helperSplitExportDeclaration = require("@babel/helper-split-export-declaration"); var _helperSkipTransparentExpressionWrappers = require("@babel/helper-skip-transparent-expression-wrappers"); +var _fields = require("./fields.js"); +var _misc = require("./misc.js"); function incrementId(id, idx = id.length - 1) { if (idx === -1) { id.unshift(65); @@ -50,12 +52,13 @@ function createLazyPrivateUidGeneratorForClass(classPath) { }; } function replaceClassWithVar(path, className) { + const id = path.node.id; + const scope = path.scope; if (path.type === "ClassDeclaration") { - const id = path.node.id; const className = id.name; - const varId = path.scope.generateUidIdentifierBasedOnNode(id); + const varId = scope.generateUidIdentifierBasedOnNode(id); const classId = _core.types.identifier(className); - path.scope.rename(className, varId.name); + scope.rename(className, varId.name); path.get("id").replaceWith(classId); return { id: _core.types.cloneNode(varId), @@ -63,12 +66,12 @@ function replaceClassWithVar(path, className) { }; } else { let varId; - if (path.node.id) { - className = path.node.id.name; - varId = path.scope.parent.generateDeclaredUidIdentifier(className); - path.scope.rename(className, varId.name); + if (id) { + className = id.name; + varId = generateLetUidIdentifier(scope.parent, className); + scope.rename(className, varId.name); } else { - varId = path.scope.parent.generateDeclaredUidIdentifier(typeof className === "string" ? className : "decorated_class"); + varId = generateLetUidIdentifier(scope.parent, typeof className === "string" ? className : "decorated_class"); } const newClassExpr = _core.types.classExpression(typeof className === "string" ? _core.types.identifier(className) : null, path.node.superClass, path.node.body); const [newPath] = path.replaceWith(_core.types.sequenceExpression([newClassExpr, varId])); @@ -85,26 +88,23 @@ function generateClassProperty(key, value, isStatic) { return _core.types.classProperty(key, value, undefined, undefined, isStatic); } } -function addProxyAccessorsFor(className, element, originalKey, targetKey, version, isComputed = false) { - const { - static: isStatic - } = element.node; - const thisArg = version === "2023-05" && isStatic ? className : _core.types.thisExpression(); +function addProxyAccessorsFor(className, element, getterKey, setterKey, targetKey, isComputed, isStatic, version) { + const thisArg = (version === "2023-11" || version === "2023-05") && isStatic ? className : _core.types.thisExpression(); const getterBody = _core.types.blockStatement([_core.types.returnStatement(_core.types.memberExpression(_core.types.cloneNode(thisArg), _core.types.cloneNode(targetKey)))]); const setterBody = _core.types.blockStatement([_core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.memberExpression(_core.types.cloneNode(thisArg), _core.types.cloneNode(targetKey)), _core.types.identifier("v")))]); let getter, setter; - if (originalKey.type === "PrivateName") { - getter = _core.types.classPrivateMethod("get", _core.types.cloneNode(originalKey), [], getterBody, isStatic); - setter = _core.types.classPrivateMethod("set", _core.types.cloneNode(originalKey), [_core.types.identifier("v")], setterBody, isStatic); + if (getterKey.type === "PrivateName") { + getter = _core.types.classPrivateMethod("get", getterKey, [], getterBody, isStatic); + setter = _core.types.classPrivateMethod("set", setterKey, [_core.types.identifier("v")], setterBody, isStatic); } else { - getter = _core.types.classMethod("get", _core.types.cloneNode(originalKey), [], getterBody, isComputed, isStatic); - setter = _core.types.classMethod("set", _core.types.cloneNode(originalKey), [_core.types.identifier("v")], setterBody, isComputed, isStatic); + getter = _core.types.classMethod("get", getterKey, [], getterBody, isComputed, isStatic); + setter = _core.types.classMethod("set", setterKey, [_core.types.identifier("v")], setterBody, isComputed, isStatic); } element.insertAfter(setter); element.insertAfter(getter); } function extractProxyAccessorsFor(targetKey, version) { - if (version !== "2023-05" && version !== "2023-01") { + if (version !== "2023-11" && version !== "2023-05" && version !== "2023-01") { return [_core.template.expression.ast` function () { return this.${_core.types.cloneNode(targetKey)}; @@ -121,6 +121,118 @@ function extractProxyAccessorsFor(targetKey, version) { (o, v) => o.${_core.types.cloneNode(targetKey)} = v `]; } +function getComputedKeyLastElement(path) { + path = (0, _helperSkipTransparentExpressionWrappers.skipTransparentExprWrappers)(path); + if (path.isSequenceExpression()) { + const expressions = path.get("expressions"); + return getComputedKeyLastElement(expressions[expressions.length - 1]); + } + return path; +} +function getComputedKeyMemoiser(path) { + const element = getComputedKeyLastElement(path); + if (element.isConstantExpression()) { + return _core.types.cloneNode(path.node); + } else if (element.isIdentifier() && path.scope.hasUid(element.node.name)) { + return _core.types.cloneNode(path.node); + } else if (element.isAssignmentExpression() && element.get("left").isIdentifier()) { + return _core.types.cloneNode(element.node.left); + } else { + throw new Error(`Internal Error: the computed key ${path.toString()} has not yet been memoised.`); + } +} +function prependExpressionsToComputedKey(expressions, fieldPath) { + const key = fieldPath.get("key"); + if (key.isSequenceExpression()) { + expressions.push(...key.node.expressions); + } else { + expressions.push(key.node); + } + key.replaceWith(maybeSequenceExpression(expressions)); +} +function appendExpressionsToComputedKey(expressions, fieldPath) { + const key = fieldPath.get("key"); + const completion = getComputedKeyLastElement(key); + if (completion.isConstantExpression()) { + prependExpressionsToComputedKey(expressions, fieldPath); + } else { + const scopeParent = key.scope.parent; + const maybeAssignment = (0, _misc.memoiseComputedKey)(completion.node, scopeParent, scopeParent.generateUid("computedKey")); + if (!maybeAssignment) { + prependExpressionsToComputedKey(expressions, fieldPath); + } else { + const expressionSequence = [...expressions, _core.types.cloneNode(maybeAssignment.left)]; + const completionParent = completion.parentPath; + if (completionParent.isSequenceExpression()) { + completionParent.pushContainer("expressions", expressionSequence); + } else { + completion.replaceWith(maybeSequenceExpression([_core.types.cloneNode(maybeAssignment), ...expressionSequence])); + } + } + } +} +function prependExpressionsToFieldInitializer(expressions, fieldPath) { + const initializer = fieldPath.get("value"); + if (initializer.node) { + expressions.push(initializer.node); + } else if (expressions.length > 0) { + expressions[expressions.length - 1] = _core.types.unaryExpression("void", expressions[expressions.length - 1]); + } + initializer.replaceWith(maybeSequenceExpression(expressions)); +} +function prependExpressionsToStaticBlock(expressions, blockPath) { + blockPath.unshiftContainer("body", _core.types.expressionStatement(maybeSequenceExpression(expressions))); +} +function prependExpressionsToConstructor(expressions, constructorPath) { + constructorPath.node.body.body.unshift(_core.types.expressionStatement(maybeSequenceExpression(expressions))); +} +function isProtoInitCallExpression(expression, protoInitCall) { + return _core.types.isCallExpression(expression) && _core.types.isIdentifier(expression.callee, { + name: protoInitCall.name + }); +} +function optimizeSuperCallAndExpressions(expressions, protoInitLocal) { + if (protoInitLocal) { + if (expressions.length >= 2 && isProtoInitCallExpression(expressions[1], protoInitLocal)) { + const mergedSuperCall = _core.types.callExpression(_core.types.cloneNode(protoInitLocal), [expressions[0]]); + expressions.splice(0, 2, mergedSuperCall); + } + if (expressions.length >= 2 && _core.types.isThisExpression(expressions[expressions.length - 1]) && isProtoInitCallExpression(expressions[expressions.length - 2], protoInitLocal)) { + expressions.splice(expressions.length - 1, 1); + } + } + return maybeSequenceExpression(expressions); +} +function insertExpressionsAfterSuperCallAndOptimize(expressions, constructorPath, protoInitLocal) { + constructorPath.traverse({ + CallExpression: { + exit(path) { + if (!path.get("callee").isSuper()) return; + const newNodes = [path.node, ...expressions.map(expr => _core.types.cloneNode(expr))]; + if (path.isCompletionRecord()) { + newNodes.push(_core.types.thisExpression()); + } + path.replaceWith(optimizeSuperCallAndExpressions(newNodes, protoInitLocal)); + path.skip(); + } + }, + ClassMethod(path) { + if (path.node.kind === "constructor") { + path.skip(); + } + } + }); +} +function createConstructorFromExpressions(expressions, isDerivedClass) { + const body = [_core.types.expressionStatement(maybeSequenceExpression(expressions))]; + if (isDerivedClass) { + body.unshift(_core.types.expressionStatement(_core.types.callExpression(_core.types.super(), [_core.types.spreadElement(_core.types.identifier("args"))]))); + } + return _core.types.classMethod("constructor", _core.types.identifier("constructor"), isDerivedClass ? [_core.types.restElement(_core.types.identifier("args"))] : [], _core.types.blockStatement(body)); +} +function createStaticBlockFromExpressions(expressions) { + return _core.types.staticBlock([_core.types.expressionStatement(maybeSequenceExpression(expressions))]); +} const FIELD = 0; const ACCESSOR = 1; const METHOD = 2; @@ -147,45 +259,37 @@ function getElementKind(element) { } } } -function isDecoratorInfo(info) { - return "decorators" in info; -} -function filteredOrderedDecoratorInfo(info) { - const filtered = info.filter(isDecoratorInfo); - return [...filtered.filter(el => el.isStatic && el.kind >= ACCESSOR && el.kind <= SETTER), ...filtered.filter(el => !el.isStatic && el.kind >= ACCESSOR && el.kind <= SETTER), ...filtered.filter(el => el.isStatic && el.kind === FIELD), ...filtered.filter(el => !el.isStatic && el.kind === FIELD)]; +function toSortedDecoratorInfo(info) { + return [...info.filter(el => el.isStatic && el.kind >= ACCESSOR && el.kind <= SETTER), ...info.filter(el => !el.isStatic && el.kind >= ACCESSOR && el.kind <= SETTER), ...info.filter(el => el.isStatic && el.kind === FIELD), ...info.filter(el => !el.isStatic && el.kind === FIELD)]; } function generateDecorationList(decorators, decoratorsThis, version) { const decsCount = decorators.length; - const hasOneThis = decoratorsThis.some(Boolean); + const haveOneThis = decoratorsThis.some(Boolean); const decs = []; for (let i = 0; i < decsCount; i++) { - if (version === "2023-05" && hasOneThis) { + if ((version === "2023-11" || version === "2023-05") && haveOneThis) { decs.push(decoratorsThis[i] || _core.types.unaryExpression("void", _core.types.numericLiteral(0))); } decs.push(decorators[i]); } return { - hasThis: hasOneThis, + haveThis: haveOneThis, decs }; } -function generateDecorationExprs(info, version) { - return _core.types.arrayExpression(filteredOrderedDecoratorInfo(info).map(el => { - const { - decs, - hasThis - } = generateDecorationList(el.decorators, el.decoratorsThis, version); +function generateDecorationExprs(decorationInfo, version) { + return _core.types.arrayExpression(decorationInfo.map(el => { let flag = el.kind; if (el.isStatic) { - flag += version === "2023-05" ? STATIC : STATIC_OLD_VERSION; + flag += version === "2023-11" || version === "2023-05" ? STATIC : STATIC_OLD_VERSION; } - if (hasThis) flag += DECORATORS_HAVE_THIS; - return _core.types.arrayExpression([decs.length === 1 ? decs[0] : _core.types.arrayExpression(decs), _core.types.numericLiteral(flag), el.name, ...(el.privateMethods || [])]); + if (el.decoratorsHaveThis) flag += DECORATORS_HAVE_THIS; + return _core.types.arrayExpression([el.decoratorsArray, _core.types.numericLiteral(flag), el.name, ...(el.privateMethods || [])]); })); } function extractElementLocalAssignments(decorationInfo) { const localIds = []; - for (const el of filteredOrderedDecoratorInfo(decorationInfo)) { + for (const el of decorationInfo) { const { locals } = el; @@ -197,12 +301,9 @@ function extractElementLocalAssignments(decorationInfo) { } return localIds; } -function addCallAccessorsFor(element, key, getId, setId) { - element.insertAfter(_core.types.classPrivateMethod("get", _core.types.cloneNode(key), [], _core.types.blockStatement([_core.types.returnStatement(_core.types.callExpression(_core.types.cloneNode(getId), [_core.types.thisExpression()]))]))); - element.insertAfter(_core.types.classPrivateMethod("set", _core.types.cloneNode(key), [_core.types.identifier("v")], _core.types.blockStatement([_core.types.expressionStatement(_core.types.callExpression(_core.types.cloneNode(setId), [_core.types.thisExpression(), _core.types.identifier("v")]))]))); -} -function isNotTsParameter(node) { - return node.type !== "TSParameterProperty"; +function addCallAccessorsFor(version, element, key, getId, setId, isStatic) { + element.insertAfter(_core.types.classPrivateMethod("get", _core.types.cloneNode(key), [], _core.types.blockStatement([_core.types.returnStatement(_core.types.callExpression(_core.types.cloneNode(getId), version === "2023-11" && isStatic ? [] : [_core.types.thisExpression()]))]), isStatic)); + element.insertAfter(_core.types.classPrivateMethod("set", _core.types.cloneNode(key), [_core.types.identifier("v")], _core.types.blockStatement([_core.types.expressionStatement(_core.types.callExpression(_core.types.cloneNode(setId), version === "2023-11" && isStatic ? [_core.types.identifier("v")] : [_core.types.thisExpression(), _core.types.identifier("v")]))]), isStatic)); } function movePrivateAccessor(element, key, methodLocalVar, isStatic) { let params; @@ -225,35 +326,141 @@ function isClassDecoratableElementPath(path) { function staticBlockToIIFE(block) { return _core.types.callExpression(_core.types.arrowFunctionExpression([], _core.types.blockStatement(block.body)), []); } +function staticBlockToFunctionClosure(block) { + return _core.types.functionExpression(null, [], _core.types.blockStatement(block.body)); +} +function fieldInitializerToClosure(value) { + return _core.types.functionExpression(null, [], _core.types.blockStatement([_core.types.returnStatement(value)])); +} function maybeSequenceExpression(exprs) { if (exprs.length === 0) return _core.types.unaryExpression("void", _core.types.numericLiteral(0)); if (exprs.length === 1) return exprs[0]; return _core.types.sequenceExpression(exprs); } +function createFunctionExpressionFromPrivateMethod(node) { + const { + params, + body, + generator: isGenerator, + async: isAsync + } = node; + return _core.types.functionExpression(undefined, params, body, isGenerator, isAsync); +} function createSetFunctionNameCall(state, className) { return _core.types.callExpression(state.addHelper("setFunctionName"), [_core.types.thisExpression(), className]); } function createToPropertyKeyCall(state, propertyKey) { return _core.types.callExpression(state.addHelper("toPropertyKey"), [propertyKey]); } -function transformClass(path, state, constantSuper, version, className, propertyVisitor) { +function createPrivateBrandCheckClosure(brandName) { + return _core.types.arrowFunctionExpression([_core.types.identifier("_")], _core.types.binaryExpression("in", _core.types.cloneNode(brandName), _core.types.identifier("_"))); +} +function usesPrivateField(expression) { + try { + _core.types.traverseFast(expression, node => { + if (_core.types.isPrivateName(node)) { + throw null; + } + }); + return false; + } catch (_unused) { + return true; + } +} +function convertToComputedKey(path) { + const { + node + } = path; + node.computed = true; + if (_core.types.isIdentifier(node.key)) { + node.key = _core.types.stringLiteral(node.key.name); + } +} +function hasInstancePrivateAccess(path, privateNames) { + let containsInstancePrivateAccess = false; + if (privateNames.length > 0) { + const privateNameVisitor = (0, _fields.privateNameVisitorFactory)({ + PrivateName(path, state) { + if (state.privateNamesMap.has(path.node.id.name)) { + containsInstancePrivateAccess = true; + path.stop(); + } + } + }); + const privateNamesMap = new Map(); + for (const name of privateNames) { + privateNamesMap.set(name, null); + } + path.traverse(privateNameVisitor, { + privateNamesMap: privateNamesMap + }); + } + return containsInstancePrivateAccess; +} +function checkPrivateMethodUpdateError(path, decoratedPrivateMethods) { + const privateNameVisitor = (0, _fields.privateNameVisitorFactory)({ + PrivateName(path, state) { + if (!state.privateNamesMap.has(path.node.id.name)) return; + const parentPath = path.parentPath; + const parentParentPath = parentPath.parentPath; + 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) { + throw path.buildCodeFrameError(`Decorated private methods are read-only, but "#${path.node.id.name}" is updated via this expression.`); + } + } + }); + const privateNamesMap = new Map(); + for (const name of decoratedPrivateMethods) { + privateNamesMap.set(name, null); + } + path.traverse(privateNameVisitor, { + privateNamesMap: privateNamesMap + }); +} +function transformClass(path, state, constantSuper, ignoreFunctionLength, className, propertyVisitor, version) { + var _path$node$id, _classDecorationsId; const body = path.get("body.body"); const classDecorators = path.node.decorators; let hasElementDecorators = false; + let hasComputedKeysSideEffects = false; + let elemDecsUseFnContext = false; const generateClassPrivateUid = createLazyPrivateUidGeneratorForClass(path); - const assignments = []; + const classAssignments = []; const scopeParent = path.scope.parent; - const memoiseExpression = (expression, hint) => { - const localEvaluatedId = scopeParent.generateDeclaredUidIdentifier(hint); + const memoiseExpression = (expression, hint, assignments) => { + const localEvaluatedId = generateLetUidIdentifier(scopeParent, hint); assignments.push(_core.types.assignmentExpression("=", localEvaluatedId, expression)); return _core.types.cloneNode(localEvaluatedId); }; + let protoInitLocal; + let staticInitLocal; + const classIdName = (_path$node$id = path.node.id) == null ? void 0 : _path$node$id.name; + const usesFunctionContextOrYieldAwait = expression => { + try { + _core.types.traverseFast(expression, node => { + if (_core.types.isThisExpression(node) || _core.types.isSuper(node) || _core.types.isYieldExpression(node) || _core.types.isAwaitExpression(node) || _core.types.isIdentifier(node, { + name: "arguments" + }) || classIdName && _core.types.isIdentifier(node, { + name: classIdName + }) || _core.types.isMetaProperty(node) && node.meta.name !== "import") { + throw null; + } + }); + return false; + } catch (_unused2) { + return true; + } + }; + const instancePrivateNames = []; for (const element of body) { if (!isClassDecoratableElementPath(element)) { continue; } - if (element.node.decorators && element.node.decorators.length > 0) { - switch (element.node.type) { + const elementNode = element.node; + if (!elementNode.static && _core.types.isPrivateName(elementNode.key)) { + instancePrivateNames.push(elementNode.key.id.name); + } + if (isDecorated(elementNode)) { + switch (elementNode.type) { case "ClassProperty": propertyVisitor.ClassProperty(element, state); break; @@ -262,70 +469,136 @@ function transformClass(path, state, constantSuper, version, className, property break; case "ClassAccessorProperty": propertyVisitor.ClassAccessorProperty(element, state); + if (version === "2023-11") { + break; + } + default: + if (elementNode.static) { + var _staticInitLocal; + (_staticInitLocal = staticInitLocal) != null ? _staticInitLocal : staticInitLocal = generateLetUidIdentifier(scopeParent, "initStatic"); + } else { + var _protoInitLocal; + (_protoInitLocal = protoInitLocal) != null ? _protoInitLocal : protoInitLocal = generateLetUidIdentifier(scopeParent, "initProto"); + } break; } hasElementDecorators = true; - } else if (element.node.type === "ClassAccessorProperty") { + elemDecsUseFnContext || (elemDecsUseFnContext = elementNode.decorators.some(usesFunctionContextOrYieldAwait)); + } else if (elementNode.type === "ClassAccessorProperty") { propertyVisitor.ClassAccessorProperty(element, state); const { key, value, static: isStatic, computed - } = element.node; + } = elementNode; const newId = generateClassPrivateUid(); const newField = generateClassProperty(newId, value, isStatic); const keyPath = element.get("key"); const [newPath] = element.replaceWith(newField); - addProxyAccessorsFor(path.node.id, newPath, computed && !keyPath.isConstantExpression() ? memoiseExpression(createToPropertyKeyCall(state, key), "computedKey") : key, newId, version, computed); + let getterKey, setterKey; + if (computed && !keyPath.isConstantExpression()) { + getterKey = (0, _misc.memoiseComputedKey)(createToPropertyKeyCall(state, key), scopeParent, scopeParent.generateUid("computedKey")); + setterKey = _core.types.cloneNode(getterKey.left); + } else { + getterKey = _core.types.cloneNode(key); + setterKey = _core.types.cloneNode(key); + } + addProxyAccessorsFor(path.node.id, newPath, getterKey, setterKey, newId, computed, isStatic, version); + } + if ("computed" in element.node && element.node.computed) { + hasComputedKeysSideEffects || (hasComputedKeysSideEffects = !scopeParent.isStatic(element.node.key)); } } if (!classDecorators && !hasElementDecorators) { - if (assignments.length > 0) { - path.insertBefore(assignments.map(expr => _core.types.expressionStatement(expr))); - path.scope.crawl(); - } return; } const elementDecoratorInfo = []; - let firstFieldPath; let constructorPath; - let requiresProtoInit = false; - let requiresStaticInit = false; const decoratedPrivateMethods = new Set(); - let protoInitLocal, staticInitLocal, classInitLocal, classIdLocal; - const decoratorsThis = new Map(); - const maybeExtractDecorator = decorator => { - const { - expression - } = decorator; - if (version === "2023-05" && _core.types.isMemberExpression(expression)) { + let classInitLocal, classIdLocal; + let decoratorReceiverId = null; + function handleDecoratorExpressions(expressions) { + let hasSideEffects = false; + let usesFnContext = false; + const decoratorsThis = []; + for (const expression of expressions) { let object; - if (_core.types.isSuper(expression.object) || _core.types.isThisExpression(expression.object)) { - object = memoiseExpression(_core.types.thisExpression(), "obj"); - } else if (!scopeParent.isStatic(expression.object)) { - object = memoiseExpression(expression.object, "obj"); - expression.object = object; - } else { - object = expression.object; + if ((version === "2023-11" || version === "2023-05") && _core.types.isMemberExpression(expression)) { + if (_core.types.isSuper(expression.object)) { + object = _core.types.thisExpression(); + } else if (scopeParent.isStatic(expression.object)) { + object = _core.types.cloneNode(expression.object); + } else { + var _decoratorReceiverId; + (_decoratorReceiverId = decoratorReceiverId) != null ? _decoratorReceiverId : decoratorReceiverId = generateLetUidIdentifier(scopeParent, "obj"); + object = _core.types.assignmentExpression("=", _core.types.cloneNode(decoratorReceiverId), expression.object); + expression.object = _core.types.cloneNode(decoratorReceiverId); + } } - decoratorsThis.set(decorator, _core.types.cloneNode(object)); - } - if (!scopeParent.isStatic(expression)) { - decorator.expression = memoiseExpression(expression, "dec"); + decoratorsThis.push(object); + hasSideEffects || (hasSideEffects = !scopeParent.isStatic(expression)); + usesFnContext || (usesFnContext = usesFunctionContextOrYieldAwait(expression)); } - }; + return { + hasSideEffects, + usesFnContext, + decoratorsThis + }; + } + const willExtractSomeElemDecs = hasComputedKeysSideEffects || elemDecsUseFnContext || version !== "2023-11"; let needsDeclaraionForClassBinding = false; + let classDecorationsFlag = 0; + let classDecorations = []; + let classDecorationsId; + let computedKeyAssignments = []; if (classDecorators) { - classInitLocal = scopeParent.generateDeclaredUidIdentifier("initClass"); + classInitLocal = generateLetUidIdentifier(scopeParent, "initClass"); needsDeclaraionForClassBinding = path.isClassDeclaration(); ({ id: classIdLocal, path } = replaceClassWithVar(path, className)); path.node.decorators = null; - for (const classDecorator of classDecorators) { - maybeExtractDecorator(classDecorator); + const decoratorExpressions = classDecorators.map(el => el.expression); + const classDecsUsePrivateName = decoratorExpressions.some(usesPrivateField); + const { + hasSideEffects, + decoratorsThis + } = handleDecoratorExpressions(decoratorExpressions); + const { + haveThis, + decs + } = generateDecorationList(decoratorExpressions, decoratorsThis, version); + classDecorationsFlag = haveThis ? 1 : 0; + classDecorations = decs; + if (hasSideEffects && willExtractSomeElemDecs || classDecsUsePrivateName) { + classDecorationsId = memoiseExpression(_core.types.arrayExpression(classDecorations), "classDecs", classAssignments); + } + if (!hasElementDecorators) { + for (const element of path.get("body.body")) { + const { + node + } = element; + const isComputed = "computed" in node && node.computed; + if (isComputed) { + if (element.isClassProperty({ + static: true + })) { + if (!element.get("key").isConstantExpression()) { + const key = node.key; + const maybeAssignment = (0, _misc.memoiseComputedKey)(key, scopeParent, scopeParent.generateUid("computedKey")); + if (maybeAssignment != null) { + node.key = _core.types.cloneNode(maybeAssignment.left); + computedKeyAssignments.push(maybeAssignment); + } + } + } else if (computedKeyAssignments.length > 0) { + prependExpressionsToComputedKey(computedKeyAssignments, element); + computedKeyAssignments = []; + } + } + } } } else { if (!path.node.id) { @@ -335,39 +608,74 @@ function transformClass(path, state, constantSuper, version, className, property } let lastInstancePrivateName; let needsInstancePrivateBrandCheck = false; + let fieldInitializerExpressions = []; + let staticFieldInitializerExpressions = []; if (hasElementDecorators) { + if (protoInitLocal) { + const protoInitCall = _core.types.callExpression(_core.types.cloneNode(protoInitLocal), [_core.types.thisExpression()]); + fieldInitializerExpressions.push(protoInitCall); + } for (const element of body) { if (!isClassDecoratableElementPath(element)) { + if (staticFieldInitializerExpressions.length > 0 && element.isStaticBlock()) { + prependExpressionsToStaticBlock(staticFieldInitializerExpressions, element); + staticFieldInitializerExpressions = []; + } continue; } const { node } = element; - const decorators = element.get("decorators"); - const hasDecorators = Array.isArray(decorators) && decorators.length > 0; + const decorators = node.decorators; + const hasDecorators = !!(decorators != null && decorators.length); + const isComputed = "computed" in node && node.computed; + let name = "computedKey"; + if (node.key.type === "PrivateName") { + name = node.key.id.name; + } else if (!isComputed && node.key.type === "Identifier") { + name = node.key.name; + } + let decoratorsArray; + let decoratorsHaveThis; if (hasDecorators) { - for (const decoratorPath of decorators) { - maybeExtractDecorator(decoratorPath.node); + const decoratorExpressions = decorators.map(d => d.expression); + const { + hasSideEffects, + usesFnContext, + decoratorsThis + } = handleDecoratorExpressions(decoratorExpressions); + const { + decs, + haveThis + } = generateDecorationList(decoratorExpressions, decoratorsThis, version); + decoratorsHaveThis = haveThis; + decoratorsArray = decs.length === 1 ? decs[0] : _core.types.arrayExpression(decs); + if (usesFnContext || hasSideEffects && willExtractSomeElemDecs) { + decoratorsArray = memoiseExpression(decoratorsArray, name + "Decs", computedKeyAssignments); } } - const isComputed = "computed" in element.node && element.node.computed === true; if (isComputed) { if (!element.get("key").isConstantExpression()) { - node.key = memoiseExpression(createToPropertyKeyCall(state, node.key), "computedKey"); + const key = node.key; + const maybeAssignment = (0, _misc.memoiseComputedKey)(hasDecorators ? createToPropertyKeyCall(state, key) : key, scopeParent, scopeParent.generateUid("computedKey")); + if (maybeAssignment != null) { + if (classDecorators && element.isClassProperty({ + static: true + })) { + node.key = _core.types.cloneNode(maybeAssignment.left); + computedKeyAssignments.push(maybeAssignment); + } else { + node.key = maybeAssignment; + } + } } } - const kind = getElementKind(element); const { - key + key, + static: isStatic } = node; const isPrivate = key.type === "PrivateName"; - const isStatic = !!element.node.static; - let name = "computedKey"; - if (isPrivate) { - name = key.id.name; - } else if (!isComputed && key.type === "Identifier") { - name = key.name; - } + const kind = getElementKind(element); if (isPrivate && !isStatic) { if (hasDecorators) { needsInstancePrivateBrandCheck = true; @@ -381,42 +689,55 @@ function transformClass(path, state, constantSuper, version, className, property })) { constructorPath = element; } + let locals; if (hasDecorators) { - let locals; let privateMethods; + let nameExpr; + if (isComputed) { + nameExpr = getComputedKeyMemoiser(element.get("key")); + } else if (key.type === "PrivateName") { + nameExpr = _core.types.stringLiteral(key.id.name); + } else if (key.type === "Identifier") { + nameExpr = _core.types.stringLiteral(key.name); + } else { + nameExpr = _core.types.cloneNode(key); + } if (kind === ACCESSOR) { const { value } = element.node; - const params = [_core.types.thisExpression()]; + const params = version === "2023-11" && isStatic ? [] : [_core.types.thisExpression()]; if (value) { params.push(_core.types.cloneNode(value)); } const newId = generateClassPrivateUid(); - const newFieldInitId = element.scope.parent.generateDeclaredUidIdentifier(`init_${name}`); + const newFieldInitId = generateLetUidIdentifier(scopeParent, `init_${name}`); const newValue = _core.types.callExpression(_core.types.cloneNode(newFieldInitId), params); const newField = generateClassProperty(newId, newValue, isStatic); const [newPath] = element.replaceWith(newField); if (isPrivate) { privateMethods = extractProxyAccessorsFor(newId, version); - const getId = newPath.scope.parent.generateDeclaredUidIdentifier(`get_${name}`); - const setId = newPath.scope.parent.generateDeclaredUidIdentifier(`set_${name}`); - addCallAccessorsFor(newPath, key, getId, setId); + const getId = generateLetUidIdentifier(scopeParent, `get_${name}`); + const setId = generateLetUidIdentifier(scopeParent, `set_${name}`); + addCallAccessorsFor(version, newPath, key, getId, setId, isStatic); locals = [newFieldInitId, getId, setId]; } else { - addProxyAccessorsFor(path.node.id, newPath, key, newId, version, isComputed); - locals = newFieldInitId; + addProxyAccessorsFor(path.node.id, newPath, _core.types.cloneNode(key), _core.types.isAssignmentExpression(key) ? _core.types.cloneNode(key.left) : _core.types.cloneNode(key), newId, isComputed, isStatic, version); + locals = [newFieldInitId]; } } else if (kind === FIELD) { - const initId = element.scope.parent.generateDeclaredUidIdentifier(`init_${name}`); + const initId = generateLetUidIdentifier(scopeParent, `init_${name}`); const valuePath = element.get("value"); - valuePath.replaceWith(_core.types.callExpression(_core.types.cloneNode(initId), [_core.types.thisExpression(), valuePath.node].filter(v => v))); - locals = initId; + const args = version === "2023-11" && isStatic ? [] : [_core.types.thisExpression()]; + if (valuePath.node) args.push(valuePath.node); + valuePath.replaceWith(_core.types.callExpression(_core.types.cloneNode(initId), args)); + locals = [initId]; if (isPrivate) { privateMethods = extractProxyAccessorsFor(key, version); } } else if (isPrivate) { - locals = element.scope.parent.generateDeclaredUidIdentifier(`call_${name}`); + const callId = generateLetUidIdentifier(scopeParent, `call_${name}`); + locals = [callId]; const replaceSupers = new _helperReplaceSupers.default({ constantSuper, methodPath: element, @@ -426,158 +747,181 @@ function transformClass(path, state, constantSuper, version, className, property refToPreserve: classIdLocal }); replaceSupers.replace(); - const { - params, - body, - async: isAsync - } = element.node; - privateMethods = [_core.types.functionExpression(undefined, params.filter(isNotTsParameter), body, isAsync)]; + privateMethods = [createFunctionExpressionFromPrivateMethod(element.node)]; if (kind === GETTER || kind === SETTER) { - movePrivateAccessor(element, _core.types.cloneNode(key), _core.types.cloneNode(locals), isStatic); + movePrivateAccessor(element, _core.types.cloneNode(key), _core.types.cloneNode(callId), isStatic); } else { const node = element.node; - path.node.body.body.unshift(_core.types.classPrivateProperty(key, _core.types.cloneNode(locals), [], node.static)); + path.node.body.body.unshift(_core.types.classPrivateProperty(key, _core.types.cloneNode(callId), [], node.static)); decoratedPrivateMethods.add(key.id.name); element.remove(); } } - let nameExpr; - if (isComputed) { - nameExpr = _core.types.cloneNode(key); - } else if (key.type === "PrivateName") { - nameExpr = _core.types.stringLiteral(key.id.name); - } else if (key.type === "Identifier") { - nameExpr = _core.types.stringLiteral(key.name); - } else { - nameExpr = _core.types.cloneNode(key); - } elementDecoratorInfo.push({ kind, - decorators: decorators.map(d => d.node.expression), - decoratorsThis: decorators.map(d => decoratorsThis.get(d.node)), + decoratorsArray, + decoratorsHaveThis, name: nameExpr, isStatic, privateMethods, locals }); - if (kind !== FIELD) { - if (isStatic) { - requiresStaticInit = true; - } else { - requiresProtoInit = true; - } - } if (element.node) { element.node.decorators = null; } - if (!firstFieldPath && !isStatic && (kind === FIELD || kind === ACCESSOR)) { - firstFieldPath = element; + } + if (isComputed && computedKeyAssignments.length > 0) { + if (classDecorators && element.isClassProperty({ + static: true + })) {} else { + prependExpressionsToComputedKey(computedKeyAssignments, kind === ACCESSOR ? element.getNextSibling() : element); + computedKeyAssignments = []; + } + } + if (fieldInitializerExpressions.length > 0 && !isStatic && (kind === FIELD || kind === ACCESSOR)) { + prependExpressionsToFieldInitializer(fieldInitializerExpressions, element); + fieldInitializerExpressions = []; + } + if (staticFieldInitializerExpressions.length > 0 && isStatic && (kind === FIELD || kind === ACCESSOR)) { + prependExpressionsToFieldInitializer(staticFieldInitializerExpressions, element); + staticFieldInitializerExpressions = []; + } + if (hasDecorators && version === "2023-11") { + if (kind === FIELD || kind === ACCESSOR) { + const initExtraId = generateLetUidIdentifier(scopeParent, `init_extra_${name}`); + locals.push(initExtraId); + const initExtraCall = _core.types.callExpression(_core.types.cloneNode(initExtraId), isStatic ? [] : [_core.types.thisExpression()]); + if (!isStatic) { + fieldInitializerExpressions.push(initExtraCall); + } else { + staticFieldInitializerExpressions.push(initExtraCall); + } } } } } - const elementDecorations = generateDecorationExprs(elementDecoratorInfo, version); - let classDecorationsFlag = 0; - let classDecorations = []; - if (classDecorators) { - const { - hasThis, - decs - } = generateDecorationList(classDecorators.map(el => el.expression), classDecorators.map(dec => decoratorsThis.get(dec)), version); - classDecorationsFlag = hasThis ? 1 : 0; - classDecorations = decs; + if (computedKeyAssignments.length > 0) { + const elements = path.get("body.body"); + let lastComputedElement; + for (let i = elements.length - 1; i >= 0; i--) { + const path = elements[i]; + const node = path.node; + if (node.computed) { + if (classDecorators && _core.types.isClassProperty(node, { + static: true + })) { + continue; + } + lastComputedElement = path; + break; + } + } + if (lastComputedElement != null) { + appendExpressionsToComputedKey(computedKeyAssignments, lastComputedElement); + computedKeyAssignments = []; + } else {} } - const elementLocals = extractElementLocalAssignments(elementDecoratorInfo); - if (requiresProtoInit) { - protoInitLocal = scopeParent.generateDeclaredUidIdentifier("initProto"); - elementLocals.push(protoInitLocal); - const protoInitCall = _core.types.callExpression(_core.types.cloneNode(protoInitLocal), [_core.types.thisExpression()]); - if (firstFieldPath) { - const value = firstFieldPath.get("value"); - const body = [protoInitCall]; - if (value.node) { - body.push(value.node); - } - value.replaceWith(_core.types.sequenceExpression(body)); - } else if (constructorPath) { - if (path.node.superClass) { - constructorPath.traverse({ - CallExpression: { - exit(path) { - if (!path.get("callee").isSuper()) return; - path.replaceWith(_core.types.callExpression(_core.types.cloneNode(protoInitLocal), [path.node])); - path.skip(); - } - }, - ClassMethod(path) { - if (path.node.kind === "constructor") { - path.skip(); - } - } - }); + if (fieldInitializerExpressions.length > 0) { + const isDerivedClass = !!path.node.superClass; + if (constructorPath) { + if (isDerivedClass) { + insertExpressionsAfterSuperCallAndOptimize(fieldInitializerExpressions, constructorPath, protoInitLocal); } else { - constructorPath.node.body.body.unshift(_core.types.expressionStatement(protoInitCall)); + prependExpressionsToConstructor(fieldInitializerExpressions, constructorPath); } } else { - const body = [_core.types.expressionStatement(protoInitCall)]; - if (path.node.superClass) { - body.unshift(_core.types.expressionStatement(_core.types.callExpression(_core.types.super(), [_core.types.spreadElement(_core.types.identifier("args"))]))); - } - path.node.body.body.unshift(_core.types.classMethod("constructor", _core.types.identifier("constructor"), [_core.types.restElement(_core.types.identifier("args"))], _core.types.blockStatement(body))); + path.node.body.body.unshift(createConstructorFromExpressions(fieldInitializerExpressions, isDerivedClass)); } + fieldInitializerExpressions = []; } - if (requiresStaticInit) { - staticInitLocal = scopeParent.generateDeclaredUidIdentifier("initStatic"); - elementLocals.push(staticInitLocal); + if (staticFieldInitializerExpressions.length > 0) { + path.node.body.body.push(createStaticBlockFromExpressions(staticFieldInitializerExpressions)); + staticFieldInitializerExpressions = []; } - if (decoratedPrivateMethods.size > 0) { - path.traverse({ - PrivateName(path) { - if (!decoratedPrivateMethods.has(path.node.id.name)) return; - const parentPath = path.parentPath; - const parentParentPath = parentPath.parentPath; - 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) { - throw path.buildCodeFrameError(`Decorated private methods are not updatable, but "#${path.node.id.name}" is updated via this expression.`); - } - } - }); + const sortedElementDecoratorInfo = toSortedDecoratorInfo(elementDecoratorInfo); + const elementDecorations = generateDecorationExprs(version === "2023-11" ? elementDecoratorInfo : sortedElementDecoratorInfo, version); + const elementLocals = extractElementLocalAssignments(sortedElementDecoratorInfo); + if (protoInitLocal) { + elementLocals.push(protoInitLocal); + } + if (staticInitLocal) { + elementLocals.push(staticInitLocal); } const classLocals = []; let classInitInjected = false; const classInitCall = classInitLocal && _core.types.callExpression(_core.types.cloneNode(classInitLocal), []); + let originalClassPath = path; const originalClass = path.node; + const staticClosures = []; if (classDecorators) { classLocals.push(classIdLocal, classInitLocal); const statics = []; - let staticBlocks = []; path.get("body.body").forEach(element => { if (element.isStaticBlock()) { - staticBlocks.push(element.node); + if (hasInstancePrivateAccess(element, instancePrivateNames)) { + const staticBlockClosureId = memoiseExpression(staticBlockToFunctionClosure(element.node), "staticBlock", staticClosures); + staticFieldInitializerExpressions.push(_core.types.callExpression(_core.types.memberExpression(staticBlockClosureId, _core.types.identifier("call")), [_core.types.thisExpression()])); + } else { + staticFieldInitializerExpressions.push(staticBlockToIIFE(element.node)); + } element.remove(); return; } - const isProperty = element.isClassProperty() || element.isClassPrivateProperty(); - if ((isProperty || element.isClassPrivateMethod()) && element.node.static) { - if (isProperty && staticBlocks.length > 0) { - const allValues = staticBlocks.map(staticBlockToIIFE); - if (element.node.value) allValues.push(element.node.value); - element.node.value = maybeSequenceExpression(allValues); - staticBlocks = []; + if ((element.isClassProperty() || element.isClassPrivateProperty()) && element.node.static) { + const valuePath = element.get("value"); + if (hasInstancePrivateAccess(valuePath, instancePrivateNames)) { + const fieldValueClosureId = memoiseExpression(fieldInitializerToClosure(valuePath.node), "fieldValue", staticClosures); + valuePath.replaceWith(_core.types.callExpression(_core.types.memberExpression(fieldValueClosureId, _core.types.identifier("call")), [_core.types.thisExpression()])); + } + if (staticFieldInitializerExpressions.length > 0) { + prependExpressionsToFieldInitializer(staticFieldInitializerExpressions, element); + staticFieldInitializerExpressions = []; + } + element.node.static = false; + statics.push(element.node); + element.remove(); + } else if (element.isClassPrivateMethod({ + static: true + })) { + if (hasInstancePrivateAccess(element, instancePrivateNames)) { + const replaceSupers = new _helperReplaceSupers.default({ + constantSuper, + methodPath: element, + objectRef: classIdLocal, + superRef: path.node.superClass, + file: state.file, + refToPreserve: classIdLocal + }); + replaceSupers.replace(); + const privateMethodDelegateId = memoiseExpression(createFunctionExpressionFromPrivateMethod(element.node), element.get("key.id").node.name, staticClosures); + if (ignoreFunctionLength) { + element.node.params = [_core.types.restElement(_core.types.identifier("arg"))]; + element.node.body = _core.types.blockStatement([_core.types.returnStatement(_core.types.callExpression(_core.types.memberExpression(privateMethodDelegateId, _core.types.identifier("apply")), [_core.types.thisExpression(), _core.types.identifier("arg")]))]); + } else { + element.node.params = element.node.params.map((p, i) => { + if (_core.types.isRestElement(p)) { + return _core.types.restElement(_core.types.identifier("arg")); + } else { + return _core.types.identifier("_" + i); + } + }); + element.node.body = _core.types.blockStatement([_core.types.returnStatement(_core.types.callExpression(_core.types.memberExpression(privateMethodDelegateId, _core.types.identifier("apply")), [_core.types.thisExpression(), _core.types.identifier("arguments")]))]); + } } element.node.static = false; statics.push(element.node); element.remove(); } }); - if (statics.length > 0 || staticBlocks.length > 0) { + if (statics.length > 0 || staticFieldInitializerExpressions.length > 0) { const staticsClass = _core.template.expression.ast` class extends ${state.addHelper("identity")} {} `; - staticsClass.body.body = [_core.types.staticBlock([_core.types.toStatement(originalClass, true) || _core.types.expressionStatement(originalClass)]), ...statics]; + staticsClass.body.body = [_core.types.classProperty(_core.types.toExpression(originalClass), undefined, undefined, undefined, true, true), ...statics]; const constructorBody = []; const newExpr = _core.types.newExpression(staticsClass, []); - if (staticBlocks.length > 0) { - constructorBody.push(...staticBlocks.map(staticBlockToIIFE)); + if (staticFieldInitializerExpressions.length > 0) { + constructorBody.push(...staticFieldInitializerExpressions); } if (classInitCall) { classInitInjected = true; @@ -585,11 +929,12 @@ function transformClass(path, state, constantSuper, version, className, property } if (constructorBody.length > 0) { constructorBody.unshift(_core.types.callExpression(_core.types.super(), [_core.types.cloneNode(classIdLocal)])); - staticsClass.body.body.push(_core.types.classMethod("constructor", _core.types.identifier("constructor"), [], _core.types.blockStatement([_core.types.expressionStatement(_core.types.sequenceExpression(constructorBody))]))); + staticsClass.body.body.push(createConstructorFromExpressions(constructorBody, false)); } else { newExpr.arguments.push(_core.types.cloneNode(classIdLocal)); } - path.replaceWith(newExpr); + const [newPath] = path.replaceWith(newExpr); + originalClassPath = newPath.get("callee").get("body").get("body.0.key"); } } if (!classInitInjected && classInitCall) { @@ -598,53 +943,100 @@ function transformClass(path, state, constantSuper, version, className, property let { superClass } = originalClass; - if (superClass && version === "2023-05") { + if (superClass && (version === "2023-11" || version === "2023-05")) { const id = path.scope.maybeGenerateMemoised(superClass); if (id) { originalClass.superClass = _core.types.assignmentExpression("=", id, superClass); superClass = id; } } - originalClass.body.body.unshift(_core.types.staticBlock([_core.types.expressionStatement(createLocalsAssignment(elementLocals, classLocals, elementDecorations, _core.types.arrayExpression(classDecorations), _core.types.numericLiteral(classDecorationsFlag), needsInstancePrivateBrandCheck ? lastInstancePrivateName : null, typeof className === "object" ? className : undefined, _core.types.cloneNode(superClass), state, version)), requiresStaticInit && _core.types.expressionStatement(_core.types.callExpression(_core.types.cloneNode(staticInitLocal), [_core.types.thisExpression()]))].filter(Boolean))); - path.insertBefore(assignments.map(expr => _core.types.expressionStatement(expr))); + const applyDecoratorWrapper = _core.types.staticBlock([]); + originalClass.body.body.unshift(applyDecoratorWrapper); + const applyDecsBody = applyDecoratorWrapper.body; + if (computedKeyAssignments.length > 0) { + const elements = originalClassPath.get("body.body"); + let firstPublicElement; + for (const path of elements) { + if ((path.isClassProperty() || path.isClassMethod()) && path.node.kind !== "constructor") { + firstPublicElement = path; + break; + } + } + if (firstPublicElement != null) { + convertToComputedKey(firstPublicElement); + prependExpressionsToComputedKey(computedKeyAssignments, firstPublicElement); + } else { + originalClass.body.body.unshift(_core.types.classProperty(_core.types.sequenceExpression([...computedKeyAssignments, _core.types.stringLiteral("_")]), undefined, undefined, undefined, true, true)); + applyDecsBody.push(_core.types.expressionStatement(_core.types.unaryExpression("delete", _core.types.memberExpression(_core.types.thisExpression(), _core.types.identifier("_"))))); + } + computedKeyAssignments = []; + } + applyDecsBody.push(_core.types.expressionStatement(createLocalsAssignment(elementLocals, classLocals, elementDecorations, (_classDecorationsId = classDecorationsId) != null ? _classDecorationsId : _core.types.arrayExpression(classDecorations), _core.types.numericLiteral(classDecorationsFlag), needsInstancePrivateBrandCheck ? lastInstancePrivateName : null, typeof className === "object" ? className : undefined, _core.types.cloneNode(superClass), state, version))); + if (staticInitLocal) { + applyDecsBody.push(_core.types.expressionStatement(_core.types.callExpression(_core.types.cloneNode(staticInitLocal), [_core.types.thisExpression()]))); + } + if (staticClosures.length > 0) { + applyDecsBody.push(...staticClosures.map(expr => _core.types.expressionStatement(expr))); + } + path.insertBefore(classAssignments.map(expr => _core.types.expressionStatement(expr))); if (needsDeclaraionForClassBinding) { - path.insertBefore(_core.types.variableDeclaration("let", [_core.types.variableDeclarator(_core.types.cloneNode(classIdLocal))])); + const classBindingInfo = scopeParent.getBinding(classIdLocal.name); + if (!classBindingInfo.constantViolations.length) { + path.insertBefore(_core.types.variableDeclaration("let", [_core.types.variableDeclarator(_core.types.cloneNode(classIdLocal))])); + } else { + const classOuterBindingDelegateLocal = scopeParent.generateUidIdentifier("t" + classIdLocal.name); + const classOuterBindingLocal = classIdLocal; + path.replaceWithMultiple([_core.types.variableDeclaration("let", [_core.types.variableDeclarator(_core.types.cloneNode(classOuterBindingLocal)), _core.types.variableDeclarator(classOuterBindingDelegateLocal)]), _core.types.blockStatement([_core.types.variableDeclaration("let", [_core.types.variableDeclarator(_core.types.cloneNode(classIdLocal))]), path.node, _core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.cloneNode(classOuterBindingDelegateLocal), _core.types.cloneNode(classIdLocal)))]), _core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.cloneNode(classOuterBindingLocal), _core.types.cloneNode(classOuterBindingDelegateLocal)))]); + } + } + if (decoratedPrivateMethods.size > 0) { + checkPrivateMethodUpdateError(path, decoratedPrivateMethods); } path.scope.crawl(); return path; } -function createLocalsAssignment(elementLocals, classLocals, elementDecorations, classDecorations, classDecorationsFlag, maybePrivateBranName, setClassName, superClass, state, version) { +function createLocalsAssignment(elementLocals, classLocals, elementDecorations, classDecorations, classDecorationsFlag, maybePrivateBrandName, setClassName, superClass, state, version) { let lhs, rhs; - const args = [setClassName ? createSetFunctionNameCall(state, setClassName) : _core.types.thisExpression(), elementDecorations, classDecorations]; + const args = [setClassName ? createSetFunctionNameCall(state, setClassName) : _core.types.thisExpression(), classDecorations, elementDecorations]; { + if (version !== "2023-11") { + args.splice(1, 2, elementDecorations, classDecorations); + } if (version === "2021-12" || version === "2022-03" && !state.availableHelper("applyDecs2203R")) { - const lhs = _core.types.arrayPattern([...elementLocals, ...classLocals]); - const rhs = _core.types.callExpression(state.addHelper(version === "2021-12" ? "applyDecs" : "applyDecs2203"), args); + lhs = _core.types.arrayPattern([...elementLocals, ...classLocals]); + rhs = _core.types.callExpression(state.addHelper(version === "2021-12" ? "applyDecs" : "applyDecs2203"), args); return _core.types.assignmentExpression("=", lhs, rhs); + } else if (version === "2022-03") { + rhs = _core.types.callExpression(state.addHelper("applyDecs2203R"), args); + } else if (version === "2023-01") { + if (maybePrivateBrandName) { + args.push(createPrivateBrandCheckClosure(maybePrivateBrandName)); + } + rhs = _core.types.callExpression(state.addHelper("applyDecs2301"), args); + } else if (version === "2023-05") { + if (maybePrivateBrandName || superClass || classDecorationsFlag.value !== 0) { + args.push(classDecorationsFlag); + } + if (maybePrivateBrandName) { + args.push(createPrivateBrandCheckClosure(maybePrivateBrandName)); + } else if (superClass) { + args.push(_core.types.unaryExpression("void", _core.types.numericLiteral(0))); + } + if (superClass) args.push(superClass); + rhs = _core.types.callExpression(state.addHelper("applyDecs2305"), args); } } - if (version === "2023-05") { - if (maybePrivateBranName || superClass || classDecorationsFlag.value !== 0) { + if (version === "2023-11") { + if (maybePrivateBrandName || superClass || classDecorationsFlag.value !== 0) { args.push(classDecorationsFlag); } - if (maybePrivateBranName) { - args.push(_core.template.expression.ast` - _ => ${_core.types.cloneNode(maybePrivateBranName)} in _ - `); + if (maybePrivateBrandName) { + args.push(createPrivateBrandCheckClosure(maybePrivateBrandName)); } else if (superClass) { args.push(_core.types.unaryExpression("void", _core.types.numericLiteral(0))); } if (superClass) args.push(superClass); - rhs = _core.types.callExpression(state.addHelper("applyDecs2305"), args); - } else if (version === "2023-01") { - if (maybePrivateBranName) { - args.push(_core.template.expression.ast` - _ => ${_core.types.cloneNode(maybePrivateBranName)} in _ - `); - } - rhs = _core.types.callExpression(state.addHelper("applyDecs2301"), args); - } else { - rhs = _core.types.callExpression(state.addHelper("applyDecs2203R"), args); + rhs = _core.types.callExpression(state.addHelper("applyDecs2311"), args); } if (elementLocals.length > 0) { if (classLocals.length > 0) { @@ -739,10 +1131,10 @@ function NamedEvaluationVisitoryFactory(isAnonymous, visitor) { }, ObjectExpression(path, state) { for (const propertyPath of path.get("properties")) { + if (!propertyPath.isObjectProperty()) continue; const { node } = propertyPath; - if (node.type !== "ObjectProperty") continue; const id = node.key; const initializer = (0, _helperSkipTransparentExpressionWrappers.skipTransparentExprWrappers)(propertyPath.get("value")); if (isAnonymous(initializer)) { @@ -822,15 +1214,23 @@ function isDecoratedAnonymousClassExpression(path) { id: null }) && shouldTransformClass(path.node); } +function generateLetUidIdentifier(scope, name) { + const id = scope.generateUidIdentifier(name); + scope.push({ + id, + kind: "let" + }); + return _core.types.cloneNode(id); +} function _default({ assertVersion, assumption }, { loose }, version, inherits) { - var _assumption; + var _assumption, _assumption2; { - if (version === "2023-05" || version === "2023-01") { + if (version === "2023-11" || version === "2023-05" || version === "2023-01") { assertVersion("^7.21.0"); } else if (version === "2021-12") { assertVersion("^7.16.0"); @@ -840,6 +1240,7 @@ function _default({ } const VISITED = new WeakSet(); const constantSuper = (_assumption = assumption("constantSuper")) != null ? _assumption : loose; + const ignoreFunctionLength = (_assumption2 = assumption("ignoreFunctionLength")) != null ? _assumption2 : loose; const namedEvaluationVisitor = NamedEvaluationVisitoryFactory(isDecoratedAnonymousClassExpression, visitClass); function visitClass(path, state, className) { var _className, _node$id; @@ -848,7 +1249,7 @@ function _default({ node } = path; (_className = className) != null ? _className : className = (_node$id = node.id) == null ? void 0 : _node$id.name; - const newPath = transformClass(path, state, constantSuper, version, className, namedEvaluationVisitor); + const newPath = transformClass(path, state, constantSuper, ignoreFunctionLength, className, namedEvaluationVisitor, version); if (newPath) { VISITED.add(newPath); return; diff --git a/node_modules/@babel/helper-create-class-features-plugin/lib/decorators.js.map b/node_modules/@babel/helper-create-class-features-plugin/lib/decorators.js.map index 51b546e0..50b12f99 100644 --- a/node_modules/@babel/helper-create-class-features-plugin/lib/decorators.js.map +++ b/node_modules/@babel/helper-create-class-features-plugin/lib/decorators.js.map @@ -1 +1 @@ -{"version":3,"names":["_core","require","_helperReplaceSupers","_helperSplitExportDeclaration","_helperSkipTransparentExpressionWrappers","incrementId","id","idx","length","unshift","current","createPrivateUidGeneratorForClass","classPath","currentPrivateId","privateNames","Set","traverse","PrivateName","path","add","node","name","reifiedId","String","fromCharCode","has","t","privateName","identifier","createLazyPrivateUidGeneratorForClass","generator","replaceClassWithVar","className","type","varId","scope","generateUidIdentifierBasedOnNode","classId","rename","get","replaceWith","cloneNode","parent","generateDeclaredUidIdentifier","newClassExpr","classExpression","superClass","body","newPath","sequenceExpression","generateClassProperty","key","value","isStatic","classPrivateProperty","undefined","classProperty","addProxyAccessorsFor","element","originalKey","targetKey","version","isComputed","static","thisArg","thisExpression","getterBody","blockStatement","returnStatement","memberExpression","setterBody","expressionStatement","assignmentExpression","getter","setter","classPrivateMethod","classMethod","insertAfter","extractProxyAccessorsFor","template","expression","ast","FIELD","ACCESSOR","METHOD","GETTER","SETTER","STATIC_OLD_VERSION","STATIC","DECORATORS_HAVE_THIS","getElementKind","kind","isDecoratorInfo","info","filteredOrderedDecoratorInfo","filtered","filter","el","generateDecorationList","decorators","decoratorsThis","decsCount","hasOneThis","some","Boolean","decs","i","push","unaryExpression","numericLiteral","hasThis","generateDecorationExprs","arrayExpression","map","flag","privateMethods","extractElementLocalAssignments","decorationInfo","localIds","locals","Array","isArray","addCallAccessorsFor","getId","setId","callExpression","isNotTsParameter","movePrivateAccessor","methodLocalVar","params","block","isClassDecoratableElementPath","staticBlockToIIFE","arrowFunctionExpression","maybeSequenceExpression","exprs","createSetFunctionNameCall","state","addHelper","createToPropertyKeyCall","propertyKey","transformClass","constantSuper","propertyVisitor","classDecorators","hasElementDecorators","generateClassPrivateUid","assignments","scopeParent","memoiseExpression","hint","localEvaluatedId","ClassProperty","ClassPrivateProperty","ClassAccessorProperty","computed","newId","newField","keyPath","isConstantExpression","insertBefore","expr","crawl","elementDecoratorInfo","firstFieldPath","constructorPath","requiresProtoInit","requiresStaticInit","decoratedPrivateMethods","protoInitLocal","staticInitLocal","classInitLocal","classIdLocal","Map","maybeExtractDecorator","decorator","isMemberExpression","object","isSuper","isThisExpression","set","needsDeclaraionForClassBinding","isClassDeclaration","classDecorator","generateUidIdentifier","lastInstancePrivateName","needsInstancePrivateBrandCheck","hasDecorators","decoratorPath","isPrivate","isClassPrivateProperty","isClassMethod","newFieldInitId","newValue","initId","valuePath","v","replaceSupers","ReplaceSupers","methodPath","objectRef","superRef","file","refToPreserve","replace","async","isAsync","functionExpression","remove","nameExpr","stringLiteral","d","elementDecorations","classDecorationsFlag","classDecorations","dec","elementLocals","protoInitCall","CallExpression","exit","skip","ClassMethod","super","spreadElement","restElement","size","parentPath","parentParentPath","left","buildCodeFrameError","classLocals","classInitInjected","classInitCall","originalClass","statics","staticBlocks","forEach","isStaticBlock","isProperty","isClassProperty","isClassPrivateMethod","allValues","staticsClass","staticBlock","toStatement","constructorBody","newExpr","newExpression","arguments","maybeGenerateMemoised","createLocalsAssignment","variableDeclaration","variableDeclarator","maybePrivateBranName","setClassName","lhs","rhs","args","availableHelper","arrayPattern","objectPattern","objectProperty","isProtoKey","isDecorated","shouldTransformElement","shouldTransformClass","NamedEvaluationVisitoryFactory","isAnonymous","visitor","handleComputedProperty","propertyPath","keyValue","ref","VariableDeclarator","initializer","skipTransparentExprWrappers","AssignmentExpression","operator","AssignmentPattern","ObjectExpression","isDecoratedAnonymousClassExpression","isClassExpression","_default","assertVersion","assumption","loose","inherits","_assumption","VISITED","WeakSet","namedEvaluationVisitor","visitClass","_className","_node$id","Object","assign","ExportDefaultDeclaration","declaration","updatedVarDeclarationPath","splitExportDeclaration","ExportNamedDeclaration","Class"],"sources":["../src/decorators.ts"],"sourcesContent":["import type { NodePath, Scope, Visitor } from \"@babel/traverse\";\nimport { types as t, template } from \"@babel/core\";\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 { skipTransparentExprWrappers } from \"@babel/helper-skip-transparent-expression-wrappers\";\n\ninterface Options {\n /** @deprecated use `constantSuper` assumption instead. Only supported in 2021-12 version. */\n loose?: boolean;\n}\n\ntype ClassDecoratableElement =\n | t.ClassMethod\n | t.ClassPrivateMethod\n | t.ClassProperty\n | t.ClassPrivateProperty\n | t.ClassAccessorProperty;\n\ntype ClassElement =\n | ClassDecoratableElement\n | t.TSDeclareMethod\n | t.TSIndexSignature\n | t.StaticBlock;\n\ntype DecoratorVersionKind = \"2023-05\" | \"2023-01\" | \"2022-03\" | \"2021-12\";\n\nfunction incrementId(id: number[], idx = id.length - 1): void {\n // If index is -1, id needs an additional character, unshift A\n if (idx === -1) {\n id.unshift(charCodes.uppercaseA);\n return;\n }\n\n const current = id[idx];\n\n if (current === charCodes.uppercaseZ) {\n // if current is Z, skip to a\n id[idx] = charCodes.lowercaseA;\n } else if (current === charCodes.lowercaseZ) {\n // if current is z, reset to A and carry the 1\n id[idx] = charCodes.uppercaseA;\n incrementId(id, idx - 1);\n } else {\n // else, increment by one\n id[idx] = current + 1;\n }\n}\n\n/**\n * Generates a new private name that is unique to the given class. This can be\n * used to create extra class fields and methods for the implementation, while\n * keeping the length of those names as small as possible. This is important for\n * minification purposes (though private names can generally be minified,\n * transpilations and polyfills cannot yet).\n */\nfunction createPrivateUidGeneratorForClass(\n classPath: NodePath<t.ClassDeclaration | t.ClassExpression>,\n): () => t.PrivateName {\n const currentPrivateId: number[] = [];\n const privateNames = new Set<string>();\n\n classPath.traverse({\n PrivateName(path) {\n privateNames.add(path.node.id.name);\n },\n });\n\n return (): t.PrivateName => {\n let reifiedId;\n do {\n incrementId(currentPrivateId);\n reifiedId = String.fromCharCode(...currentPrivateId);\n } while (privateNames.has(reifiedId));\n\n return t.privateName(t.identifier(reifiedId));\n };\n}\n\n/**\n * Wraps the above generator function so that it's run lazily the first time\n * it's actually required. Several types of decoration do not require this, so it\n * saves iterating the class elements an additional time and allocating the space\n * for the Sets of element names.\n */\nfunction createLazyPrivateUidGeneratorForClass(\n classPath: NodePath<t.ClassDeclaration | t.ClassExpression>,\n): () => t.PrivateName {\n let generator: () => t.PrivateName;\n\n return (): t.PrivateName => {\n if (!generator) {\n generator = createPrivateUidGeneratorForClass(classPath);\n }\n\n return generator();\n };\n}\n\n/**\n * Takes a class definition and the desired class name if anonymous and\n * replaces it with an equivalent class declaration (path) which is then\n * assigned to a local variable (id). This allows us to reassign the local variable with the\n * decorated version of the class. The class definition retains its original\n * name so that `toString` is not affected, other references to the class\n * are renamed instead.\n */\nfunction replaceClassWithVar(\n path: NodePath<t.ClassDeclaration | t.ClassExpression>,\n className: string | t.Identifier | t.StringLiteral | undefined,\n): {\n id: t.Identifier;\n path: NodePath<t.ClassDeclaration | t.ClassExpression>;\n} {\n if (path.type === \"ClassDeclaration\") {\n const id = path.node.id;\n const className = id.name;\n const varId = path.scope.generateUidIdentifierBasedOnNode(id);\n const classId = t.identifier(className);\n\n path.scope.rename(className, varId.name);\n\n path.get(\"id\").replaceWith(classId);\n\n return { id: t.cloneNode(varId), path };\n } else {\n let varId: t.Identifier;\n\n if (path.node.id) {\n className = path.node.id.name;\n varId = path.scope.parent.generateDeclaredUidIdentifier(className);\n path.scope.rename(className, varId.name);\n } else {\n varId = path.scope.parent.generateDeclaredUidIdentifier(\n typeof className === \"string\" ? className : \"decorated_class\",\n );\n }\n\n const newClassExpr = t.classExpression(\n typeof className === \"string\" ? t.identifier(className) : null,\n path.node.superClass,\n path.node.body,\n );\n\n const [newPath] = path.replaceWith(\n t.sequenceExpression([newClassExpr, varId]),\n );\n\n return {\n id: t.cloneNode(varId),\n path: newPath.get(\"expressions.0\") as NodePath<t.ClassExpression>,\n };\n }\n}\n\nfunction generateClassProperty(\n key: t.PrivateName | t.Identifier,\n value: t.Expression | undefined,\n isStatic: boolean,\n): t.ClassPrivateProperty | t.ClassProperty {\n if (key.type === \"PrivateName\") {\n return t.classPrivateProperty(key, value, undefined, isStatic);\n } else {\n return t.classProperty(key, value, undefined, undefined, isStatic);\n }\n}\n\nfunction addProxyAccessorsFor(\n className: t.Identifier,\n element: NodePath<ClassDecoratableElement>,\n originalKey: t.PrivateName | t.Expression,\n targetKey: t.PrivateName,\n version: DecoratorVersionKind,\n isComputed = false,\n): void {\n const { static: isStatic } = element.node;\n\n const thisArg =\n version === \"2023-05\" && isStatic ? className : t.thisExpression();\n\n const getterBody = t.blockStatement([\n t.returnStatement(\n t.memberExpression(t.cloneNode(thisArg), t.cloneNode(targetKey)),\n ),\n ]);\n\n const setterBody = t.blockStatement([\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.memberExpression(t.cloneNode(thisArg), t.cloneNode(targetKey)),\n t.identifier(\"v\"),\n ),\n ),\n ]);\n\n let getter: t.ClassMethod | t.ClassPrivateMethod,\n setter: t.ClassMethod | t.ClassPrivateMethod;\n\n if (originalKey.type === \"PrivateName\") {\n getter = t.classPrivateMethod(\n \"get\",\n t.cloneNode(originalKey),\n [],\n getterBody,\n isStatic,\n );\n setter = t.classPrivateMethod(\n \"set\",\n t.cloneNode(originalKey),\n [t.identifier(\"v\")],\n setterBody,\n isStatic,\n );\n } else {\n getter = t.classMethod(\n \"get\",\n t.cloneNode(originalKey),\n [],\n getterBody,\n isComputed,\n isStatic,\n );\n setter = t.classMethod(\n \"set\",\n t.cloneNode(originalKey),\n [t.identifier(\"v\")],\n setterBody,\n isComputed,\n isStatic,\n );\n }\n\n element.insertAfter(setter);\n element.insertAfter(getter);\n}\n\nfunction extractProxyAccessorsFor(\n targetKey: t.PrivateName,\n version: DecoratorVersionKind,\n): (t.FunctionExpression | t.ArrowFunctionExpression)[] {\n if (version !== \"2023-05\" && version !== \"2023-01\") {\n return [\n template.expression.ast`\n function () {\n return this.${t.cloneNode(targetKey)};\n }\n ` as t.FunctionExpression,\n template.expression.ast`\n function (value) {\n this.${t.cloneNode(targetKey)} = value;\n }\n ` as t.FunctionExpression,\n ];\n }\n return [\n template.expression.ast`\n o => o.${t.cloneNode(targetKey)}\n ` as t.ArrowFunctionExpression,\n template.expression.ast`\n (o, v) => o.${t.cloneNode(targetKey)} = v\n ` as t.ArrowFunctionExpression,\n ];\n}\n\n// 3 bits reserved to this (0-7)\nconst FIELD = 0;\nconst ACCESSOR = 1;\nconst METHOD = 2;\nconst GETTER = 3;\nconst SETTER = 4;\n\nconst STATIC_OLD_VERSION = 5; // Before 2023-05\nconst STATIC = 8; // 1 << 3\nconst DECORATORS_HAVE_THIS = 16; // 1 << 3\n\nfunction getElementKind(element: NodePath<ClassDecoratableElement>): number {\n switch (element.node.type) {\n case \"ClassProperty\":\n case \"ClassPrivateProperty\":\n return FIELD;\n case \"ClassAccessorProperty\":\n return ACCESSOR;\n case \"ClassMethod\":\n case \"ClassPrivateMethod\":\n if (element.node.kind === \"get\") {\n return GETTER;\n } else if (element.node.kind === \"set\") {\n return SETTER;\n } else {\n return METHOD;\n }\n }\n}\n\n// Information about the decorators applied to an element\ninterface DecoratorInfo {\n // The expressions of the decorators themselves\n decorators: t.Expression[];\n decoratorsThis: t.Expression[];\n\n // The kind of the decorated value, matches the kind value passed to applyDecs\n kind: number;\n\n // whether or not the field is static\n isStatic: boolean;\n\n // The name of the decorator\n name: t.StringLiteral | t.Expression;\n\n privateMethods:\n | (t.FunctionExpression | t.ArrowFunctionExpression)[]\n | undefined;\n\n // The names of local variables that will be used/returned from the decoration\n locals: t.Identifier | t.Identifier[] | undefined;\n}\n\n// Information about a computed property key. These must be evaluated\n// interspersed with decorator expressions, which is why they get added to the\n// array of DecoratorInfos later on.\ninterface ComputedPropInfo {\n localComputedNameId: t.Identifier;\n keyNode: t.Expression;\n}\n\nfunction isDecoratorInfo(\n info: DecoratorInfo | ComputedPropInfo,\n): info is DecoratorInfo {\n return \"decorators\" in info;\n}\n\nfunction filteredOrderedDecoratorInfo(\n info: (DecoratorInfo | ComputedPropInfo)[],\n): DecoratorInfo[] {\n const filtered = info.filter(isDecoratorInfo);\n\n return [\n ...filtered.filter(\n el => el.isStatic && el.kind >= ACCESSOR && el.kind <= SETTER,\n ),\n ...filtered.filter(\n el => !el.isStatic && el.kind >= ACCESSOR && el.kind <= SETTER,\n ),\n ...filtered.filter(el => el.isStatic && el.kind === FIELD),\n ...filtered.filter(el => !el.isStatic && el.kind === FIELD),\n ];\n}\n\nfunction generateDecorationList(\n decorators: t.Expression[],\n decoratorsThis: (t.Expression | null)[],\n version: DecoratorVersionKind,\n) {\n const decsCount = decorators.length;\n const hasOneThis = decoratorsThis.some(Boolean);\n const decs: t.Expression[] = [];\n for (let i = 0; i < decsCount; i++) {\n if (version === \"2023-05\" && hasOneThis) {\n decs.push(\n decoratorsThis[i] || t.unaryExpression(\"void\", t.numericLiteral(0)),\n );\n }\n decs.push(decorators[i]);\n }\n\n return { hasThis: hasOneThis, decs };\n}\n\nfunction generateDecorationExprs(\n info: (DecoratorInfo | ComputedPropInfo)[],\n version: DecoratorVersionKind,\n): t.ArrayExpression {\n return t.arrayExpression(\n filteredOrderedDecoratorInfo(info).map(el => {\n const { decs, hasThis } = generateDecorationList(\n el.decorators,\n el.decoratorsThis,\n version,\n );\n\n let flag = el.kind;\n if (el.isStatic) {\n flag += version === \"2023-05\" ? STATIC : STATIC_OLD_VERSION;\n }\n if (hasThis) flag += DECORATORS_HAVE_THIS;\n\n return t.arrayExpression([\n decs.length === 1 ? decs[0] : t.arrayExpression(decs),\n t.numericLiteral(flag),\n el.name,\n ...(el.privateMethods || []),\n ]);\n }),\n );\n}\n\nfunction extractElementLocalAssignments(\n decorationInfo: (DecoratorInfo | ComputedPropInfo)[],\n) {\n const localIds: t.Identifier[] = [];\n\n for (const el of filteredOrderedDecoratorInfo(decorationInfo)) {\n const { locals } = el;\n\n if (Array.isArray(locals)) {\n localIds.push(...locals);\n } else if (locals !== undefined) {\n localIds.push(locals);\n }\n }\n\n return localIds;\n}\n\nfunction addCallAccessorsFor(\n element: NodePath,\n key: t.PrivateName,\n getId: t.Identifier,\n setId: t.Identifier,\n) {\n element.insertAfter(\n t.classPrivateMethod(\n \"get\",\n t.cloneNode(key),\n [],\n t.blockStatement([\n t.returnStatement(\n t.callExpression(t.cloneNode(getId), [t.thisExpression()]),\n ),\n ]),\n ),\n );\n\n element.insertAfter(\n t.classPrivateMethod(\n \"set\",\n t.cloneNode(key),\n [t.identifier(\"v\")],\n t.blockStatement([\n t.expressionStatement(\n t.callExpression(t.cloneNode(setId), [\n t.thisExpression(),\n t.identifier(\"v\"),\n ]),\n ),\n ]),\n ),\n );\n}\n\nfunction isNotTsParameter(\n node: t.Identifier | t.Pattern | t.RestElement | t.TSParameterProperty,\n): node is t.Identifier | t.Pattern | t.RestElement {\n return node.type !== \"TSParameterProperty\";\n}\n\nfunction movePrivateAccessor(\n element: NodePath<t.ClassPrivateMethod>,\n key: t.PrivateName,\n methodLocalVar: t.Identifier,\n isStatic: boolean,\n) {\n let params: (t.Identifier | t.RestElement)[];\n let block: t.Statement[];\n\n if (element.node.kind === \"set\") {\n params = [t.identifier(\"v\")];\n block = [\n t.expressionStatement(\n t.callExpression(methodLocalVar, [\n t.thisExpression(),\n t.identifier(\"v\"),\n ]),\n ),\n ];\n } else {\n params = [];\n block = [\n t.returnStatement(t.callExpression(methodLocalVar, [t.thisExpression()])),\n ];\n }\n\n element.replaceWith(\n t.classPrivateMethod(\n element.node.kind,\n t.cloneNode(key),\n params,\n t.blockStatement(block),\n isStatic,\n ),\n );\n}\n\nfunction isClassDecoratableElementPath(\n path: NodePath<ClassElement>,\n): path is NodePath<ClassDecoratableElement> {\n const { type } = path;\n\n return (\n type !== \"TSDeclareMethod\" &&\n type !== \"TSIndexSignature\" &&\n type !== \"StaticBlock\"\n );\n}\n\nfunction staticBlockToIIFE(block: t.StaticBlock) {\n return t.callExpression(\n t.arrowFunctionExpression([], t.blockStatement(block.body)),\n [],\n );\n}\n\nfunction maybeSequenceExpression(exprs: t.Expression[]) {\n if (exprs.length === 0) return t.unaryExpression(\"void\", t.numericLiteral(0));\n if (exprs.length === 1) return exprs[0];\n return t.sequenceExpression(exprs);\n}\n\nfunction createSetFunctionNameCall(\n state: PluginPass,\n className: t.Identifier | t.StringLiteral,\n) {\n return t.callExpression(state.addHelper(\"setFunctionName\"), [\n t.thisExpression(),\n className,\n ]);\n}\n\nfunction createToPropertyKeyCall(state: PluginPass, propertyKey: t.Expression) {\n return t.callExpression(state.addHelper(\"toPropertyKey\"), [propertyKey]);\n}\n\nfunction transformClass(\n path: NodePath<t.ClassExpression | t.ClassDeclaration>,\n state: PluginPass,\n constantSuper: boolean,\n version: DecoratorVersionKind,\n className: string | t.Identifier | t.StringLiteral | undefined,\n propertyVisitor: Visitor<PluginPass>,\n): NodePath {\n const body = path.get(\"body.body\");\n\n const classDecorators = path.node.decorators;\n let hasElementDecorators = false;\n\n const generateClassPrivateUid = createLazyPrivateUidGeneratorForClass(path);\n\n const assignments: t.AssignmentExpression[] = [];\n const scopeParent: Scope = path.scope.parent;\n const memoiseExpression = (expression: t.Expression, hint: string) => {\n const localEvaluatedId = scopeParent.generateDeclaredUidIdentifier(hint);\n assignments.push(t.assignmentExpression(\"=\", localEvaluatedId, expression));\n return t.cloneNode(localEvaluatedId);\n };\n\n // Iterate over the class to see if we need to decorate it, and also to\n // transform simple auto accessors which are not decorated\n for (const element of body) {\n if (!isClassDecoratableElementPath(element)) {\n continue;\n }\n\n if (element.node.decorators && element.node.decorators.length > 0) {\n switch (element.node.type) {\n case \"ClassProperty\":\n // @ts-expect-error todo: propertyVisitor.ClassProperty should be callable. Improve typings.\n propertyVisitor.ClassProperty(\n element as NodePath<t.ClassProperty>,\n state,\n );\n break;\n case \"ClassPrivateProperty\":\n // @ts-expect-error todo: propertyVisitor.ClassPrivateProperty should be callable. Improve typings.\n propertyVisitor.ClassPrivateProperty(\n element as NodePath<t.ClassPrivateProperty>,\n state,\n );\n break;\n case \"ClassAccessorProperty\":\n // @ts-expect-error todo: propertyVisitor.ClassAccessorProperty should be callable. Improve typings.\n propertyVisitor.ClassAccessorProperty(\n element as NodePath<t.ClassAccessorProperty>,\n state,\n );\n break;\n }\n hasElementDecorators = true;\n } else if (element.node.type === \"ClassAccessorProperty\") {\n // @ts-expect-error todo: propertyVisitor.ClassAccessorProperty should be callable. Improve typings.\n propertyVisitor.ClassAccessorProperty(\n element as NodePath<t.ClassAccessorProperty>,\n state,\n );\n const { key, value, static: isStatic, computed } = element.node;\n\n const newId = generateClassPrivateUid();\n const newField = generateClassProperty(newId, value, isStatic);\n const keyPath = element.get(\"key\");\n const [newPath] = element.replaceWith(newField);\n\n addProxyAccessorsFor(\n path.node.id,\n newPath,\n computed && !keyPath.isConstantExpression()\n ? memoiseExpression(\n createToPropertyKeyCall(state, key as t.Expression),\n \"computedKey\",\n )\n : key,\n newId,\n version,\n computed,\n );\n }\n }\n\n if (!classDecorators && !hasElementDecorators) {\n // If nothing is decorated but we have assignments, it must be the memoised\n // computed keys of class accessors\n if (assignments.length > 0) {\n path.insertBefore(assignments.map(expr => t.expressionStatement(expr)));\n\n // Recrawl the scope to make sure new identifiers are properly synced\n path.scope.crawl();\n }\n // If nothing is decorated and no assignments inserted, return\n return;\n }\n\n const elementDecoratorInfo: (DecoratorInfo | ComputedPropInfo)[] = [];\n\n // The initializer of the first non-static field will be injected with the protoInit call\n let firstFieldPath:\n | NodePath<t.ClassProperty | t.ClassPrivateProperty>\n | undefined;\n let constructorPath: NodePath<t.ClassMethod> | undefined;\n let requiresProtoInit = false;\n let requiresStaticInit = false;\n const decoratedPrivateMethods = new Set<string>();\n\n let protoInitLocal: t.Identifier,\n staticInitLocal: t.Identifier,\n classInitLocal: t.Identifier,\n classIdLocal: t.Identifier;\n\n const decoratorsThis = new Map<t.Decorator, t.Expression>();\n const maybeExtractDecorator = (decorator: t.Decorator) => {\n const { expression } = decorator;\n if (version === \"2023-05\" && t.isMemberExpression(expression)) {\n let object;\n if (\n t.isSuper(expression.object) ||\n t.isThisExpression(expression.object)\n ) {\n object = memoiseExpression(t.thisExpression(), \"obj\");\n } else if (!scopeParent.isStatic(expression.object)) {\n object = memoiseExpression(expression.object, \"obj\");\n expression.object = object;\n } else {\n object = expression.object;\n }\n decoratorsThis.set(decorator, t.cloneNode(object));\n }\n if (!scopeParent.isStatic(expression)) {\n decorator.expression = memoiseExpression(expression, \"dec\");\n }\n };\n\n let needsDeclaraionForClassBinding = false;\n if (classDecorators) {\n classInitLocal = scopeParent.generateDeclaredUidIdentifier(\"initClass\");\n needsDeclaraionForClassBinding = path.isClassDeclaration();\n ({ id: classIdLocal, path } = replaceClassWithVar(path, className));\n\n path.node.decorators = null;\n\n for (const classDecorator of classDecorators) {\n maybeExtractDecorator(classDecorator);\n }\n } else {\n if (!path.node.id) {\n path.node.id = path.scope.generateUidIdentifier(\"Class\");\n }\n classIdLocal = t.cloneNode(path.node.id);\n }\n\n let lastInstancePrivateName: t.PrivateName;\n let needsInstancePrivateBrandCheck = false;\n\n if (hasElementDecorators) {\n for (const element of body) {\n if (!isClassDecoratableElementPath(element)) {\n continue;\n }\n\n const { node } = element;\n const decorators = element.get(\"decorators\");\n\n const hasDecorators = Array.isArray(decorators) && decorators.length > 0;\n\n if (hasDecorators) {\n for (const decoratorPath of decorators) {\n maybeExtractDecorator(decoratorPath.node);\n }\n }\n\n const isComputed =\n \"computed\" in element.node && element.node.computed === true;\n if (isComputed) {\n if (!element.get(\"key\").isConstantExpression()) {\n node.key = memoiseExpression(\n createToPropertyKeyCall(state, node.key as t.Expression),\n \"computedKey\",\n );\n }\n }\n\n const kind = getElementKind(element);\n const { key } = node;\n\n const isPrivate = key.type === \"PrivateName\";\n\n const isStatic = !!element.node.static;\n\n let name = \"computedKey\";\n\n if (isPrivate) {\n name = key.id.name;\n } else if (!isComputed && key.type === \"Identifier\") {\n name = key.name;\n }\n\n if (isPrivate && !isStatic) {\n if (hasDecorators) {\n needsInstancePrivateBrandCheck = true;\n }\n if (t.isClassPrivateProperty(node) || !lastInstancePrivateName) {\n lastInstancePrivateName = key;\n }\n }\n\n if (element.isClassMethod({ kind: \"constructor\" })) {\n constructorPath = element;\n }\n\n if (hasDecorators) {\n let locals: t.Identifier | t.Identifier[];\n let privateMethods: Array<\n t.FunctionExpression | t.ArrowFunctionExpression\n >;\n\n if (kind === ACCESSOR) {\n const { value } = element.node as t.ClassAccessorProperty;\n\n const params: t.Expression[] = [t.thisExpression()];\n\n if (value) {\n params.push(t.cloneNode(value));\n }\n\n const newId = generateClassPrivateUid();\n const newFieldInitId =\n element.scope.parent.generateDeclaredUidIdentifier(`init_${name}`);\n const newValue = t.callExpression(\n t.cloneNode(newFieldInitId),\n params,\n );\n\n const newField = generateClassProperty(newId, newValue, isStatic);\n const [newPath] = element.replaceWith(newField);\n\n if (isPrivate) {\n privateMethods = extractProxyAccessorsFor(newId, version);\n\n const getId = newPath.scope.parent.generateDeclaredUidIdentifier(\n `get_${name}`,\n );\n const setId = newPath.scope.parent.generateDeclaredUidIdentifier(\n `set_${name}`,\n );\n\n addCallAccessorsFor(newPath, key, getId, setId);\n\n locals = [newFieldInitId, getId, setId];\n } else {\n addProxyAccessorsFor(\n path.node.id,\n newPath,\n key,\n newId,\n version,\n isComputed,\n );\n locals = newFieldInitId;\n }\n } else if (kind === FIELD) {\n const initId = element.scope.parent.generateDeclaredUidIdentifier(\n `init_${name}`,\n );\n const valuePath = (\n element as NodePath<t.ClassProperty | t.ClassPrivateProperty>\n ).get(\"value\");\n\n valuePath.replaceWith(\n t.callExpression(\n t.cloneNode(initId),\n [t.thisExpression(), valuePath.node].filter(v => v),\n ),\n );\n\n locals = initId;\n\n if (isPrivate) {\n privateMethods = extractProxyAccessorsFor(key, version);\n }\n } else if (isPrivate) {\n locals = element.scope.parent.generateDeclaredUidIdentifier(\n `call_${name}`,\n );\n\n const replaceSupers = new ReplaceSupers({\n constantSuper,\n methodPath: element as NodePath<t.ClassPrivateMethod>,\n objectRef: classIdLocal,\n superRef: path.node.superClass,\n file: state.file,\n refToPreserve: classIdLocal,\n });\n\n replaceSupers.replace();\n\n const {\n params,\n body,\n async: isAsync,\n } = element.node as t.ClassPrivateMethod;\n\n privateMethods = [\n t.functionExpression(\n undefined,\n params.filter(isNotTsParameter),\n body,\n isAsync,\n ),\n ];\n\n if (kind === GETTER || kind === SETTER) {\n movePrivateAccessor(\n element as NodePath<t.ClassPrivateMethod>,\n t.cloneNode(key),\n t.cloneNode(locals),\n isStatic,\n );\n } else {\n const node = element.node as t.ClassPrivateMethod;\n\n // Unshift\n path.node.body.body.unshift(\n t.classPrivateProperty(key, t.cloneNode(locals), [], node.static),\n );\n\n decoratedPrivateMethods.add(key.id.name);\n\n element.remove();\n }\n }\n\n let nameExpr: t.Expression;\n\n if (isComputed) {\n nameExpr = t.cloneNode(key as t.Expression);\n } else if (key.type === \"PrivateName\") {\n nameExpr = t.stringLiteral(key.id.name);\n } else if (key.type === \"Identifier\") {\n nameExpr = t.stringLiteral(key.name);\n } else {\n nameExpr = t.cloneNode(key as t.Expression);\n }\n\n elementDecoratorInfo.push({\n kind,\n decorators: decorators.map(d => d.node.expression),\n decoratorsThis: decorators.map(d => decoratorsThis.get(d.node)),\n name: nameExpr,\n isStatic,\n privateMethods,\n locals,\n });\n\n if (kind !== FIELD) {\n if (isStatic) {\n requiresStaticInit = true;\n } else {\n requiresProtoInit = true;\n }\n }\n\n if (element.node) {\n element.node.decorators = null;\n }\n\n if (\n !firstFieldPath &&\n !isStatic &&\n (kind === FIELD || kind === ACCESSOR)\n ) {\n firstFieldPath = element as NodePath<\n t.ClassProperty | t.ClassPrivateProperty\n >;\n }\n }\n }\n }\n\n const elementDecorations = generateDecorationExprs(\n elementDecoratorInfo,\n version,\n );\n let classDecorationsFlag = 0;\n let classDecorations: t.Expression[] = [];\n if (classDecorators) {\n const { hasThis, decs } = generateDecorationList(\n classDecorators.map(el => el.expression),\n classDecorators.map(dec => decoratorsThis.get(dec)),\n version,\n );\n classDecorationsFlag = hasThis ? 1 : 0;\n classDecorations = decs;\n }\n\n const elementLocals: t.Identifier[] =\n extractElementLocalAssignments(elementDecoratorInfo);\n\n if (requiresProtoInit) {\n protoInitLocal = scopeParent.generateDeclaredUidIdentifier(\"initProto\");\n elementLocals.push(protoInitLocal);\n\n const protoInitCall = t.callExpression(t.cloneNode(protoInitLocal), [\n t.thisExpression(),\n ]);\n\n if (firstFieldPath) {\n const value = firstFieldPath.get(\"value\");\n const body: t.Expression[] = [protoInitCall];\n\n if (value.node) {\n body.push(value.node);\n }\n\n value.replaceWith(t.sequenceExpression(body));\n } else if (constructorPath) {\n if (path.node.superClass) {\n constructorPath.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 ClassMethod(path) {\n if (path.node.kind === \"constructor\") {\n path.skip();\n }\n },\n });\n } else {\n constructorPath.node.body.body.unshift(\n t.expressionStatement(protoInitCall),\n );\n }\n } else {\n const body: t.Statement[] = [t.expressionStatement(protoInitCall)];\n\n if (path.node.superClass) {\n body.unshift(\n t.expressionStatement(\n t.callExpression(t.super(), [\n t.spreadElement(t.identifier(\"args\")),\n ]),\n ),\n );\n }\n\n path.node.body.body.unshift(\n t.classMethod(\n \"constructor\",\n t.identifier(\"constructor\"),\n [t.restElement(t.identifier(\"args\"))],\n t.blockStatement(body),\n ),\n );\n }\n }\n\n if (requiresStaticInit) {\n staticInitLocal = scopeParent.generateDeclaredUidIdentifier(\"initStatic\");\n elementLocals.push(staticInitLocal);\n }\n\n if (decoratedPrivateMethods.size > 0) {\n path.traverse({\n PrivateName(path) {\n if (!decoratedPrivateMethods.has(path.node.id.name)) return;\n\n const parentPath = path.parentPath;\n const parentParentPath = parentPath.parentPath;\n\n if (\n // this.bar().#x = 123;\n (parentParentPath.node.type === \"AssignmentExpression\" &&\n parentParentPath.node.left === parentPath.node) ||\n // this.#x++;\n parentParentPath.node.type === \"UpdateExpression\" ||\n // ([...this.#x] = foo);\n parentParentPath.node.type === \"RestElement\" ||\n // ([this.#x] = foo);\n parentParentPath.node.type === \"ArrayPattern\" ||\n // ({ a: this.#x } = bar);\n (parentParentPath.node.type === \"ObjectProperty\" &&\n parentParentPath.node.value === parentPath.node &&\n parentParentPath.parentPath.type === \"ObjectPattern\") ||\n // for (this.#x of []);\n (parentParentPath.node.type === \"ForOfStatement\" &&\n parentParentPath.node.left === parentPath.node)\n ) {\n throw path.buildCodeFrameError(\n `Decorated private methods are not updatable, but \"#${path.node.id.name}\" is updated via this expression.`,\n );\n }\n },\n });\n }\n\n const classLocals: t.Identifier[] = [];\n let classInitInjected = false;\n const classInitCall =\n classInitLocal && t.callExpression(t.cloneNode(classInitLocal), []);\n\n const originalClass = path.node;\n\n if (classDecorators) {\n classLocals.push(classIdLocal, classInitLocal);\n const statics: (\n | t.ClassProperty\n | t.ClassPrivateProperty\n | t.ClassPrivateMethod\n )[] = [];\n let staticBlocks: t.StaticBlock[] = [];\n path.get(\"body.body\").forEach(element => {\n // Static blocks cannot be compiled to \"instance blocks\", but we can inline\n // them as IIFEs in the next property.\n if (element.isStaticBlock()) {\n staticBlocks.push(element.node);\n element.remove();\n return;\n }\n\n const isProperty =\n element.isClassProperty() || element.isClassPrivateProperty();\n\n if (\n (isProperty || element.isClassPrivateMethod()) &&\n element.node.static\n ) {\n if (isProperty && staticBlocks.length > 0) {\n const allValues: t.Expression[] = staticBlocks.map(staticBlockToIIFE);\n if (element.node.value) allValues.push(element.node.value);\n element.node.value = maybeSequenceExpression(allValues);\n staticBlocks = [];\n }\n\n element.node.static = false;\n statics.push(element.node);\n element.remove();\n }\n });\n\n if (statics.length > 0 || staticBlocks.length > 0) {\n const staticsClass = template.expression.ast`\n class extends ${state.addHelper(\"identity\")} {}\n ` as t.ClassExpression;\n staticsClass.body.body = [\n t.staticBlock([\n t.toStatement(originalClass, true) ||\n // If toStatement returns false, originalClass must be an anonymous ClassExpression,\n // because `export default @dec ...` has been handled in the export visitor before.\n t.expressionStatement(originalClass as t.ClassExpression),\n ]),\n ...statics,\n ];\n\n const constructorBody: t.Expression[] = [];\n\n const newExpr = t.newExpression(staticsClass, []);\n\n if (staticBlocks.length > 0) {\n constructorBody.push(...staticBlocks.map(staticBlockToIIFE));\n }\n if (classInitCall) {\n classInitInjected = true;\n constructorBody.push(classInitCall);\n }\n if (constructorBody.length > 0) {\n constructorBody.unshift(\n t.callExpression(t.super(), [t.cloneNode(classIdLocal)]),\n );\n\n staticsClass.body.body.push(\n t.classMethod(\n \"constructor\",\n t.identifier(\"constructor\"),\n [],\n t.blockStatement([\n t.expressionStatement(t.sequenceExpression(constructorBody)),\n ]),\n ),\n );\n } else {\n newExpr.arguments.push(t.cloneNode(classIdLocal));\n }\n\n path.replaceWith(newExpr);\n }\n }\n if (!classInitInjected && classInitCall) {\n path.node.body.body.push(\n t.staticBlock([t.expressionStatement(classInitCall)]),\n );\n }\n\n let { superClass } = originalClass;\n if (superClass && (process.env.BABEL_8_BREAKING || version === \"2023-05\")) {\n const id = path.scope.maybeGenerateMemoised(superClass);\n if (id) {\n originalClass.superClass = t.assignmentExpression(\"=\", id, superClass);\n superClass = id;\n }\n }\n\n originalClass.body.body.unshift(\n t.staticBlock(\n [\n t.expressionStatement(\n createLocalsAssignment(\n elementLocals,\n classLocals,\n elementDecorations,\n t.arrayExpression(classDecorations),\n t.numericLiteral(classDecorationsFlag),\n needsInstancePrivateBrandCheck ? lastInstancePrivateName : null,\n typeof className === \"object\" ? className : undefined,\n t.cloneNode(superClass),\n state,\n version,\n ),\n ),\n requiresStaticInit &&\n t.expressionStatement(\n t.callExpression(t.cloneNode(staticInitLocal), [\n t.thisExpression(),\n ]),\n ),\n ].filter(Boolean),\n ),\n );\n\n // When path is a ClassExpression, path.insertBefore will convert `path`\n // into a SequenceExpression\n path.insertBefore(assignments.map(expr => t.expressionStatement(expr)));\n\n if (needsDeclaraionForClassBinding) {\n path.insertBefore(\n t.variableDeclaration(\"let\", [\n t.variableDeclarator(t.cloneNode(classIdLocal)),\n ]),\n );\n }\n\n // Recrawl the scope to make sure new identifiers are properly synced\n path.scope.crawl();\n\n return path;\n}\n\nfunction createLocalsAssignment(\n elementLocals: t.Identifier[],\n classLocals: t.Identifier[],\n elementDecorations: t.ArrayExpression,\n classDecorations: t.ArrayExpression,\n classDecorationsFlag: t.NumericLiteral,\n maybePrivateBranName: t.PrivateName | null,\n setClassName: t.Identifier | t.StringLiteral | undefined,\n superClass: null | t.Expression,\n state: PluginPass,\n version: DecoratorVersionKind,\n) {\n let lhs, rhs;\n const args: t.Expression[] = [\n setClassName\n ? createSetFunctionNameCall(state, setClassName)\n : t.thisExpression(),\n elementDecorations,\n classDecorations,\n ];\n\n if (!process.env.BABEL_8_BREAKING) {\n if (\n version === \"2021-12\" ||\n (version === \"2022-03\" && !state.availableHelper(\"applyDecs2203R\"))\n ) {\n const lhs = t.arrayPattern([...elementLocals, ...classLocals]);\n const rhs = t.callExpression(\n state.addHelper(version === \"2021-12\" ? \"applyDecs\" : \"applyDecs2203\"),\n args,\n );\n return t.assignmentExpression(\"=\", lhs, rhs);\n }\n }\n\n if (process.env.BABEL_8_BREAKING || version === \"2023-05\") {\n if (\n maybePrivateBranName ||\n superClass ||\n classDecorationsFlag.value !== 0\n ) {\n args.push(classDecorationsFlag);\n }\n if (maybePrivateBranName) {\n args.push(\n template.expression.ast`\n _ => ${t.cloneNode(maybePrivateBranName)} in _\n ` as t.ArrowFunctionExpression,\n );\n } else if (superClass) {\n args.push(t.unaryExpression(\"void\", t.numericLiteral(0)));\n }\n if (superClass) args.push(superClass);\n rhs = t.callExpression(state.addHelper(\"applyDecs2305\"), args);\n } else if (version === \"2023-01\") {\n if (maybePrivateBranName) {\n args.push(\n template.expression.ast`\n _ => ${t.cloneNode(maybePrivateBranName)} in _\n ` as t.ArrowFunctionExpression,\n );\n }\n rhs = t.callExpression(state.addHelper(\"applyDecs2301\"), args);\n } else {\n rhs = t.callExpression(state.addHelper(\"applyDecs2203R\"), args);\n }\n // optimize `{ c: [classLocals] } = applyapplyDecs2203R(...)` to\n // `[classLocals] = applyapplyDecs2203R(...).c`\n if (elementLocals.length > 0) {\n if (classLocals.length > 0) {\n lhs = t.objectPattern([\n t.objectProperty(t.identifier(\"e\"), t.arrayPattern(elementLocals)),\n t.objectProperty(t.identifier(\"c\"), t.arrayPattern(classLocals)),\n ]);\n } else {\n lhs = t.arrayPattern(elementLocals);\n rhs = t.memberExpression(rhs, t.identifier(\"e\"), false, false);\n }\n } else {\n // invariant: classLocals.length > 0\n lhs = t.arrayPattern(classLocals);\n rhs = t.memberExpression(rhs, t.identifier(\"c\"), false, false);\n }\n\n return t.assignmentExpression(\"=\", lhs, rhs);\n}\n\nfunction isProtoKey(\n node: t.Identifier | t.StringLiteral | t.BigIntLiteral | t.NumericLiteral,\n) {\n return node.type === \"Identifier\"\n ? node.name === \"__proto__\"\n : node.value === \"__proto__\";\n}\n\nfunction isDecorated(node: t.Class | ClassDecoratableElement) {\n return node.decorators && node.decorators.length > 0;\n}\n\nfunction shouldTransformElement(node: ClassElement) {\n switch (node.type) {\n case \"ClassAccessorProperty\":\n return true;\n case \"ClassMethod\":\n case \"ClassProperty\":\n case \"ClassPrivateMethod\":\n case \"ClassPrivateProperty\":\n return isDecorated(node);\n default:\n return false;\n }\n}\n\nfunction shouldTransformClass(node: t.Class) {\n return isDecorated(node) || node.body.body.some(shouldTransformElement);\n}\n\n// Todo: unify name references logic with helper-function-name\nfunction NamedEvaluationVisitoryFactory(\n isAnonymous: (path: NodePath) => boolean,\n visitor: (\n path: NodePath,\n state: PluginPass,\n name:\n | string\n | t.Identifier\n | t.StringLiteral\n | t.NumericLiteral\n | t.BigIntLiteral,\n ) => void,\n) {\n function handleComputedProperty(\n propertyPath: NodePath<\n t.ObjectProperty | t.ClassProperty | t.ClassAccessorProperty\n >,\n key: t.Expression,\n state: PluginPass,\n ): t.StringLiteral | t.Identifier {\n switch (key.type) {\n case \"StringLiteral\":\n return t.stringLiteral(key.value);\n case \"NumericLiteral\":\n case \"BigIntLiteral\": {\n const keyValue = key.value + \"\";\n propertyPath.get(\"key\").replaceWith(t.stringLiteral(keyValue));\n return t.stringLiteral(keyValue);\n }\n default: {\n const ref = propertyPath.scope.maybeGenerateMemoised(key);\n propertyPath\n .get(\"key\")\n .replaceWith(\n t.assignmentExpression(\n \"=\",\n ref,\n createToPropertyKeyCall(state, key),\n ),\n );\n return t.cloneNode(ref);\n }\n }\n }\n return {\n VariableDeclarator(path, state) {\n const id = path.node.id;\n if (id.type === \"Identifier\") {\n const initializer = skipTransparentExprWrappers(path.get(\"init\"));\n if (isAnonymous(initializer)) {\n const name = id.name;\n visitor(initializer, state, name);\n }\n }\n },\n AssignmentExpression(path, state) {\n const id = path.node.left;\n if (id.type === \"Identifier\") {\n const initializer = skipTransparentExprWrappers(path.get(\"right\"));\n if (isAnonymous(initializer)) {\n switch (path.node.operator) {\n case \"=\":\n case \"&&=\":\n case \"||=\":\n case \"??=\":\n visitor(initializer, state, id.name);\n }\n }\n }\n },\n AssignmentPattern(path, state) {\n const id = path.node.left;\n if (id.type === \"Identifier\") {\n const initializer = skipTransparentExprWrappers(path.get(\"right\"));\n if (isAnonymous(initializer)) {\n const name = id.name;\n visitor(initializer, state, name);\n }\n }\n },\n // We listen on ObjectExpression so that we don't have to visit\n // the object properties under object patterns\n ObjectExpression(path, state) {\n for (const propertyPath of path.get(\"properties\")) {\n const { node } = propertyPath;\n if (node.type !== \"ObjectProperty\") continue;\n const id = node.key;\n const initializer = skipTransparentExprWrappers(\n propertyPath.get(\"value\"),\n );\n if (isAnonymous(initializer)) {\n if (!node.computed) {\n // 13.2.5.5 RS: PropertyDefinitionEvaluation\n if (!isProtoKey(id as t.StringLiteral | t.Identifier)) {\n if (id.type === \"Identifier\") {\n visitor(initializer, state, id.name);\n } else {\n const className = t.stringLiteral(\n (id as t.StringLiteral | t.NumericLiteral | t.BigIntLiteral)\n .value + \"\",\n );\n visitor(initializer, state, className);\n }\n }\n } else {\n const ref = handleComputedProperty(\n propertyPath as NodePath<t.ObjectProperty>,\n // The key of a computed object property must not be a private name\n id as t.Expression,\n state,\n );\n visitor(initializer, state, ref);\n }\n }\n }\n },\n ClassPrivateProperty(path, state) {\n const { node } = path;\n const initializer = skipTransparentExprWrappers(path.get(\"value\"));\n if (isAnonymous(initializer)) {\n const className = t.stringLiteral(\"#\" + node.key.id.name);\n visitor(initializer, state, className);\n }\n },\n ClassAccessorProperty(path, state) {\n const { node } = path;\n const id = node.key;\n const initializer = skipTransparentExprWrappers(path.get(\"value\"));\n if (isAnonymous(initializer)) {\n if (!node.computed) {\n if (id.type === \"Identifier\") {\n visitor(initializer, state, id.name);\n } else if (id.type === \"PrivateName\") {\n const className = t.stringLiteral(\"#\" + id.id.name);\n visitor(initializer, state, className);\n } else {\n const className = t.stringLiteral(\n (id as t.StringLiteral | t.NumericLiteral | t.BigIntLiteral)\n .value + \"\",\n );\n visitor(initializer, state, className);\n }\n } else {\n const ref = handleComputedProperty(\n path,\n // The key of a computed accessor property must not be a private name\n id as t.Expression,\n state,\n );\n visitor(initializer, state, ref);\n }\n }\n },\n ClassProperty(path, state) {\n const { node } = path;\n const id = node.key;\n const initializer = skipTransparentExprWrappers(path.get(\"value\"));\n if (isAnonymous(initializer)) {\n if (!node.computed) {\n if (id.type === \"Identifier\") {\n visitor(initializer, state, id.name);\n } else {\n const className = t.stringLiteral(\n (id as t.StringLiteral | t.NumericLiteral | t.BigIntLiteral)\n .value + \"\",\n );\n visitor(initializer, state, className);\n }\n } else {\n const ref = handleComputedProperty(path, id, state);\n visitor(initializer, state, ref);\n }\n }\n },\n } satisfies Visitor<PluginPass>;\n}\n\nfunction isDecoratedAnonymousClassExpression(path: NodePath) {\n return (\n path.isClassExpression({ id: null }) && shouldTransformClass(path.node)\n );\n}\n\nexport default function (\n { assertVersion, assumption }: PluginAPI,\n { loose }: Options,\n // TODO(Babel 8): Only keep 2023-05\n version: \"2023-05\" | \"2023-01\" | \"2022-03\" | \"2021-12\",\n inherits: PluginObject[\"inherits\"],\n): PluginObject {\n if (process.env.BABEL_8_BREAKING) {\n assertVersion(process.env.IS_PUBLISH ? PACKAGE_JSON.version : \"^7.21.0\");\n } else {\n if (version === \"2023-05\" || version === \"2023-01\") {\n assertVersion(\"^7.21.0\");\n } else if (version === \"2021-12\") {\n assertVersion(\"^7.16.0\");\n } else {\n assertVersion(\"^7.19.0\");\n }\n }\n\n const VISITED = new WeakSet<NodePath>();\n const constantSuper = assumption(\"constantSuper\") ?? loose;\n\n const namedEvaluationVisitor: Visitor<PluginPass> =\n NamedEvaluationVisitoryFactory(\n isDecoratedAnonymousClassExpression,\n visitClass,\n );\n\n function visitClass(\n path: NodePath<t.Class>,\n state: PluginPass,\n className: string | t.Identifier | t.StringLiteral | undefined,\n ) {\n if (VISITED.has(path)) return;\n const { node } = path;\n className ??= node.id?.name;\n const newPath = transformClass(\n path,\n state,\n constantSuper,\n version,\n className,\n namedEvaluationVisitor,\n );\n if (newPath) {\n VISITED.add(newPath);\n return;\n }\n VISITED.add(path);\n }\n\n return {\n name: \"proposal-decorators\",\n inherits: inherits,\n\n visitor: {\n ExportDefaultDeclaration(path, state) {\n const { declaration } = path.node;\n if (\n declaration?.type === \"ClassDeclaration\" &&\n // When compiling class decorators we need to replace the class\n // binding, so we must split it in two separate declarations.\n isDecorated(declaration)\n ) {\n const isAnonymous = !declaration.id;\n const updatedVarDeclarationPath = splitExportDeclaration(\n path,\n ) as unknown as NodePath<t.ClassDeclaration>;\n if (isAnonymous) {\n visitClass(\n updatedVarDeclarationPath,\n state,\n t.stringLiteral(\"default\"),\n );\n }\n }\n },\n ExportNamedDeclaration(path) {\n const { declaration } = path.node;\n if (\n declaration?.type === \"ClassDeclaration\" &&\n // When compiling class decorators we need to replace the class\n // binding, so we must split it in two separate declarations.\n isDecorated(declaration)\n ) {\n splitExportDeclaration(path);\n }\n },\n\n Class(path, state) {\n visitClass(path, state, undefined);\n },\n\n ...namedEvaluationVisitor,\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,6BAAA,GAAAF,OAAA;AAGA,IAAAG,wCAAA,GAAAH,OAAA;AAsBA,SAASI,WAAWA,CAACC,EAAY,EAAEC,GAAG,GAAGD,EAAE,CAACE,MAAM,GAAG,CAAC,EAAQ;EAE5D,IAAID,GAAG,KAAK,CAAC,CAAC,EAAE;IACdD,EAAE,CAACG,OAAO,GAAqB,CAAC;IAChC;EACF;EAEA,MAAMC,OAAO,GAAGJ,EAAE,CAACC,GAAG,CAAC;EAEvB,IAAIG,OAAO,OAAyB,EAAE;IAEpCJ,EAAE,CAACC,GAAG,CAAC,KAAuB;EAChC,CAAC,MAAM,IAAIG,OAAO,QAAyB,EAAE;IAE3CJ,EAAE,CAACC,GAAG,CAAC,KAA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,EAAE;UACnC,MAAMoS,yBAAyB,GAAG,IAAAC,qCAAsB,EACtDzR,IACF,CAA4C;UAC5C,IAAIyP,WAAW,EAAE;YACfwB,UAAU,CACRO,yBAAyB,EACzBjK,KAAK,EACL/G,WAAC,CAACwL,aAAa,CAAC,SAAS,CAC3B,CAAC;UACH;QACF;MACF,CAAC;MACD0F,sBAAsBA,CAAC1R,IAAI,EAAE;QAC3B,MAAM;UAAEuR;QAAY,CAAC,GAAGvR,IAAI,CAACE,IAAI;QACjC,IACE,CAAAqR,WAAW,oBAAXA,WAAW,CAAExQ,IAAI,MAAK,kBAAkB,IAGxCsO,WAAW,CAACkC,WAAW,CAAC,EACxB;UACA,IAAAE,qCAAsB,EAACzR,IAAI,CAAC;QAC9B;MACF,CAAC;MAED2R,KAAKA,CAAC3R,IAAI,EAAEuH,KAAK,EAAE;QACjB0J,UAAU,CAACjR,IAAI,EAAEuH,KAAK,EAAElF,SAAS,CAAC;MACpC;IAAC,GAEE2O,sBAAsB;EAE7B,CAAC;AACH"}
\ No newline at end of file +{"version":3,"names":["_core","require","_helperReplaceSupers","_helperSplitExportDeclaration","_helperSkipTransparentExpressionWrappers","_fields","_misc","incrementId","id","idx","length","unshift","current","createPrivateUidGeneratorForClass","classPath","currentPrivateId","privateNames","Set","traverse","PrivateName","path","add","node","name","reifiedId","String","fromCharCode","has","t","privateName","identifier","createLazyPrivateUidGeneratorForClass","generator","replaceClassWithVar","className","scope","type","varId","generateUidIdentifierBasedOnNode","classId","rename","get","replaceWith","cloneNode","generateLetUidIdentifier","parent","newClassExpr","classExpression","superClass","body","newPath","sequenceExpression","generateClassProperty","key","value","isStatic","classPrivateProperty","undefined","classProperty","addProxyAccessorsFor","element","getterKey","setterKey","targetKey","isComputed","version","thisArg","thisExpression","getterBody","blockStatement","returnStatement","memberExpression","setterBody","expressionStatement","assignmentExpression","getter","setter","classPrivateMethod","classMethod","insertAfter","extractProxyAccessorsFor","template","expression","ast","getComputedKeyLastElement","skipTransparentExprWrappers","isSequenceExpression","expressions","getComputedKeyMemoiser","isConstantExpression","isIdentifier","hasUid","isAssignmentExpression","left","Error","toString","prependExpressionsToComputedKey","fieldPath","push","maybeSequenceExpression","appendExpressionsToComputedKey","completion","scopeParent","maybeAssignment","memoiseComputedKey","generateUid","expressionSequence","completionParent","parentPath","pushContainer","prependExpressionsToFieldInitializer","initializer","unaryExpression","prependExpressionsToStaticBlock","blockPath","unshiftContainer","prependExpressionsToConstructor","constructorPath","isProtoInitCallExpression","protoInitCall","isCallExpression","callee","optimizeSuperCallAndExpressions","protoInitLocal","mergedSuperCall","callExpression","splice","isThisExpression","insertExpressionsAfterSuperCallAndOptimize","CallExpression","exit","isSuper","newNodes","map","expr","isCompletionRecord","skip","ClassMethod","kind","createConstructorFromExpressions","isDerivedClass","super","spreadElement","restElement","createStaticBlockFromExpressions","staticBlock","FIELD","ACCESSOR","METHOD","GETTER","SETTER","STATIC_OLD_VERSION","STATIC","DECORATORS_HAVE_THIS","getElementKind","toSortedDecoratorInfo","info","filter","el","generateDecorationList","decorators","decoratorsThis","decsCount","haveOneThis","some","Boolean","decs","i","numericLiteral","haveThis","generateDecorationExprs","decorationInfo","arrayExpression","flag","decoratorsHaveThis","decoratorsArray","privateMethods","extractElementLocalAssignments","localIds","locals","Array","isArray","addCallAccessorsFor","getId","setId","movePrivateAccessor","methodLocalVar","params","block","isClassDecoratableElementPath","staticBlockToIIFE","arrowFunctionExpression","staticBlockToFunctionClosure","functionExpression","fieldInitializerToClosure","exprs","createFunctionExpressionFromPrivateMethod","isGenerator","async","isAsync","createSetFunctionNameCall","state","addHelper","createToPropertyKeyCall","propertyKey","createPrivateBrandCheckClosure","brandName","binaryExpression","usesPrivateField","traverseFast","isPrivateName","_unused","convertToComputedKey","computed","stringLiteral","hasInstancePrivateAccess","containsInstancePrivateAccess","privateNameVisitor","privateNameVisitorFactory","privateNamesMap","stop","Map","set","checkPrivateMethodUpdateError","decoratedPrivateMethods","parentParentPath","buildCodeFrameError","transformClass","constantSuper","ignoreFunctionLength","propertyVisitor","_path$node$id","_classDecorationsId","classDecorators","hasElementDecorators","hasComputedKeysSideEffects","elemDecsUseFnContext","generateClassPrivateUid","classAssignments","memoiseExpression","hint","assignments","localEvaluatedId","staticInitLocal","classIdName","usesFunctionContextOrYieldAwait","isYieldExpression","isAwaitExpression","isMetaProperty","meta","_unused2","instancePrivateNames","elementNode","static","isDecorated","ClassProperty","ClassPrivateProperty","ClassAccessorProperty","_staticInitLocal","_protoInitLocal","newId","newField","keyPath","elementDecoratorInfo","classInitLocal","classIdLocal","decoratorReceiverId","handleDecoratorExpressions","hasSideEffects","usesFnContext","object","isMemberExpression","_decoratorReceiverId","willExtractSomeElemDecs","needsDeclaraionForClassBinding","classDecorationsFlag","classDecorations","classDecorationsId","computedKeyAssignments","isClassDeclaration","decoratorExpressions","classDecsUsePrivateName","isClassProperty","generateUidIdentifier","lastInstancePrivateName","needsInstancePrivateBrandCheck","fieldInitializerExpressions","staticFieldInitializerExpressions","isStaticBlock","hasDecorators","d","isPrivate","isClassPrivateProperty","isClassMethod","nameExpr","newFieldInitId","newValue","initId","valuePath","args","callId","replaceSupers","ReplaceSupers","methodPath","objectRef","superRef","file","refToPreserve","replace","remove","getNextSibling","initExtraId","initExtraCall","elements","lastComputedElement","sortedElementDecoratorInfo","elementDecorations","elementLocals","classLocals","classInitInjected","classInitCall","originalClassPath","originalClass","staticClosures","statics","forEach","staticBlockClosureId","fieldValueClosureId","isClassPrivateMethod","privateMethodDelegateId","p","isRestElement","staticsClass","toExpression","constructorBody","newExpr","newExpression","arguments","maybeGenerateMemoised","applyDecoratorWrapper","applyDecsBody","firstPublicElement","createLocalsAssignment","insertBefore","classBindingInfo","getBinding","constantViolations","variableDeclaration","variableDeclarator","classOuterBindingDelegateLocal","classOuterBindingLocal","replaceWithMultiple","size","crawl","maybePrivateBrandName","setClassName","lhs","rhs","availableHelper","arrayPattern","objectPattern","objectProperty","isProtoKey","shouldTransformElement","shouldTransformClass","NamedEvaluationVisitoryFactory","isAnonymous","visitor","handleComputedProperty","propertyPath","keyValue","ref","VariableDeclarator","AssignmentExpression","operator","AssignmentPattern","ObjectExpression","isObjectProperty","isDecoratedAnonymousClassExpression","isClassExpression","_default","assertVersion","assumption","loose","inherits","_assumption","_assumption2","VISITED","WeakSet","namedEvaluationVisitor","visitClass","_className","_node$id","Object","assign","ExportDefaultDeclaration","declaration","updatedVarDeclarationPath","splitExportDeclaration","ExportNamedDeclaration","Class"],"sources":["../src/decorators.ts"],"sourcesContent":["import type { NodePath, Scope, Visitor } from \"@babel/traverse\";\nimport { types as t, template } from \"@babel/core\";\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 { skipTransparentExprWrappers } from \"@babel/helper-skip-transparent-expression-wrappers\";\nimport {\n privateNameVisitorFactory,\n type PrivateNameVisitorState,\n} from \"./fields.ts\";\nimport { memoiseComputedKey } from \"./misc.ts\";\n\ninterface Options {\n /** @deprecated use `constantSuper` assumption instead. Only supported in 2021-12 version. */\n loose?: boolean;\n}\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 ClassElementCanHaveComputedKeys =\n | t.ClassMethod\n | t.ClassProperty\n | t.ClassAccessorProperty;\n\n// TODO(Babel 8): Only keep 2023-11\nexport type DecoratorVersionKind =\n | \"2023-11\"\n | \"2023-05\"\n | \"2023-01\"\n | \"2022-03\"\n | \"2021-12\";\n\nfunction incrementId(id: number[], idx = id.length - 1): void {\n // If index is -1, id needs an additional character, unshift A\n if (idx === -1) {\n id.unshift(charCodes.uppercaseA);\n return;\n }\n\n const current = id[idx];\n\n if (current === charCodes.uppercaseZ) {\n // if current is Z, skip to a\n id[idx] = charCodes.lowercaseA;\n } else if (current === charCodes.lowercaseZ) {\n // if current is z, reset to A and carry the 1\n id[idx] = charCodes.uppercaseA;\n incrementId(id, idx - 1);\n } else {\n // else, increment by one\n id[idx] = current + 1;\n }\n}\n\n/**\n * Generates a new private name that is unique to the given class. This can be\n * used to create extra class fields and methods for the implementation, while\n * keeping the length of those names as small as possible. This is important for\n * minification purposes (though private names can generally be minified,\n * transpilations and polyfills cannot yet).\n */\nfunction createPrivateUidGeneratorForClass(\n classPath: NodePath<t.ClassDeclaration | t.ClassExpression>,\n): () => t.PrivateName {\n const currentPrivateId: number[] = [];\n const privateNames = new Set<string>();\n\n classPath.traverse({\n PrivateName(path) {\n privateNames.add(path.node.id.name);\n },\n });\n\n return (): t.PrivateName => {\n let reifiedId;\n do {\n incrementId(currentPrivateId);\n reifiedId = String.fromCharCode(...currentPrivateId);\n } while (privateNames.has(reifiedId));\n\n return t.privateName(t.identifier(reifiedId));\n };\n}\n\n/**\n * Wraps the above generator function so that it's run lazily the first time\n * it's actually required. Several types of decoration do not require this, so it\n * saves iterating the class elements an additional time and allocating the space\n * for the Sets of element names.\n */\nfunction createLazyPrivateUidGeneratorForClass(\n classPath: NodePath<t.ClassDeclaration | t.ClassExpression>,\n): () => t.PrivateName {\n let generator: () => t.PrivateName;\n\n return (): t.PrivateName => {\n if (!generator) {\n generator = createPrivateUidGeneratorForClass(classPath);\n }\n\n return generator();\n };\n}\n\n/**\n * Takes a class definition and the desired class name if anonymous and\n * replaces it with an equivalent class declaration (path) which is then\n * assigned to a local variable (id). This allows us to reassign the local variable with the\n * decorated version of the class. The class definition retains its original\n * name so that `toString` is not affected, other references to the class\n * are renamed instead.\n */\nfunction replaceClassWithVar(\n path: NodePath<t.ClassDeclaration | t.ClassExpression>,\n className: string | t.Identifier | t.StringLiteral | undefined,\n): {\n id: t.Identifier;\n path: NodePath<t.ClassDeclaration | t.ClassExpression>;\n} {\n const id = path.node.id;\n const scope = path.scope;\n if (path.type === \"ClassDeclaration\") {\n const className = id.name;\n const varId = scope.generateUidIdentifierBasedOnNode(id);\n const classId = t.identifier(className);\n\n scope.rename(className, varId.name);\n\n path.get(\"id\").replaceWith(classId);\n\n return { id: t.cloneNode(varId), path };\n } else {\n let varId: t.Identifier;\n\n if (id) {\n className = id.name;\n varId = generateLetUidIdentifier(scope.parent, className);\n scope.rename(className, varId.name);\n } else {\n varId = generateLetUidIdentifier(\n scope.parent,\n typeof className === \"string\" ? className : \"decorated_class\",\n );\n }\n\n const newClassExpr = t.classExpression(\n typeof className === \"string\" ? t.identifier(className) : null,\n path.node.superClass,\n path.node.body,\n );\n\n const [newPath] = path.replaceWith(\n t.sequenceExpression([newClassExpr, varId]),\n );\n\n return {\n id: t.cloneNode(varId),\n path: newPath.get(\"expressions.0\") as NodePath<t.ClassExpression>,\n };\n }\n}\n\nfunction generateClassProperty(\n key: t.PrivateName | t.Identifier,\n value: t.Expression | undefined,\n isStatic: boolean,\n): t.ClassPrivateProperty | t.ClassProperty {\n if (key.type === \"PrivateName\") {\n return t.classPrivateProperty(key, value, undefined, isStatic);\n } else {\n return t.classProperty(key, value, undefined, undefined, isStatic);\n }\n}\n\nfunction addProxyAccessorsFor(\n className: t.Identifier,\n element: NodePath<ClassDecoratableElement>,\n getterKey: t.PrivateName | t.Expression,\n setterKey: t.PrivateName | t.Expression,\n targetKey: t.PrivateName,\n isComputed: boolean,\n isStatic: boolean,\n version: DecoratorVersionKind,\n): void {\n const thisArg =\n (version === \"2023-11\" ||\n (!process.env.BABEL_8_BREAKING && version === \"2023-05\")) &&\n isStatic\n ? className\n : t.thisExpression();\n\n const getterBody = t.blockStatement([\n t.returnStatement(\n t.memberExpression(t.cloneNode(thisArg), t.cloneNode(targetKey)),\n ),\n ]);\n\n const setterBody = t.blockStatement([\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.memberExpression(t.cloneNode(thisArg), t.cloneNode(targetKey)),\n t.identifier(\"v\"),\n ),\n ),\n ]);\n\n let getter: t.ClassMethod | t.ClassPrivateMethod,\n setter: t.ClassMethod | t.ClassPrivateMethod;\n\n if (getterKey.type === \"PrivateName\") {\n getter = t.classPrivateMethod(\"get\", getterKey, [], getterBody, isStatic);\n setter = t.classPrivateMethod(\n \"set\",\n setterKey as t.PrivateName,\n [t.identifier(\"v\")],\n setterBody,\n isStatic,\n );\n } else {\n getter = t.classMethod(\n \"get\",\n getterKey,\n [],\n getterBody,\n isComputed,\n isStatic,\n );\n setter = t.classMethod(\n \"set\",\n setterKey as t.Expression,\n [t.identifier(\"v\")],\n setterBody,\n isComputed,\n isStatic,\n );\n }\n\n element.insertAfter(setter);\n element.insertAfter(getter);\n}\n\nfunction extractProxyAccessorsFor(\n targetKey: t.PrivateName,\n version: DecoratorVersionKind,\n): (t.FunctionExpression | t.ArrowFunctionExpression)[] {\n if (version !== \"2023-11\" && version !== \"2023-05\" && version !== \"2023-01\") {\n return [\n template.expression.ast`\n function () {\n return this.${t.cloneNode(targetKey)};\n }\n ` as t.FunctionExpression,\n template.expression.ast`\n function (value) {\n this.${t.cloneNode(targetKey)} = value;\n }\n ` as t.FunctionExpression,\n ];\n }\n return [\n template.expression.ast`\n o => o.${t.cloneNode(targetKey)}\n ` as t.ArrowFunctionExpression,\n template.expression.ast`\n (o, v) => o.${t.cloneNode(targetKey)} = v\n ` as t.ArrowFunctionExpression,\n ];\n}\n\n/**\n * Get the last element for the given computed key path.\n *\n * This function unwraps transparent wrappers and gets the last item when\n * the key is a SequenceExpression.\n *\n * @param {NodePath<t.Expression>} path The key of a computed class element\n * @returns {NodePath<t.Expression>} The simple completion result\n */\nfunction getComputedKeyLastElement(\n path: NodePath<t.Expression>,\n): NodePath<t.Expression> {\n path = skipTransparentExprWrappers(path);\n if (path.isSequenceExpression()) {\n const expressions = path.get(\"expressions\");\n return getComputedKeyLastElement(expressions[expressions.length - 1]);\n }\n return path;\n}\n\n/**\n * Get a memoiser of the computed key path.\n *\n * This function does not mutate AST. If the computed key is not a constant\n * expression, this function must be called after the key has been memoised.\n *\n * @param {NodePath<t.Expression>} path The key of a computed class element.\n * @returns {t.Expression} A clone of key if key is a constant expression,\n * otherwise a memoiser identifier.\n */\nfunction getComputedKeyMemoiser(path: NodePath<t.Expression>): t.Expression {\n const element = getComputedKeyLastElement(path);\n if (element.isConstantExpression()) {\n return t.cloneNode(path.node);\n } else if (element.isIdentifier() && path.scope.hasUid(element.node.name)) {\n return t.cloneNode(path.node);\n } else if (\n element.isAssignmentExpression() &&\n element.get(\"left\").isIdentifier()\n ) {\n return t.cloneNode(element.node.left as t.Identifier);\n } else {\n throw new Error(\n `Internal Error: the computed key ${path.toString()} has not yet been memoised.`,\n );\n }\n}\n\n/**\n * Prepend expressions to the computed key of the given field path.\n *\n * If the computed key is a sequence expression, this function will unwrap\n * the sequence expression for optimal output size.\n *\n * @param {t.Expression[]} expressions\n * @param {(NodePath<\n * t.ClassMethod | t.ClassProperty | t.ClassAccessorProperty\n * >)} fieldPath\n */\nfunction prependExpressionsToComputedKey(\n expressions: t.Expression[],\n fieldPath: NodePath<\n t.ClassMethod | t.ClassProperty | t.ClassAccessorProperty\n >,\n) {\n const key = fieldPath.get(\"key\") as NodePath<t.Expression>;\n if (key.isSequenceExpression()) {\n expressions.push(...key.node.expressions);\n } else {\n expressions.push(key.node);\n }\n key.replaceWith(maybeSequenceExpression(expressions));\n}\n\n/**\n * Append expressions to the computed key of the given field path.\n *\n * If the computed key is a constant expression or uid reference, it\n * will prepend expressions before the comptued key. Otherwise it will\n * memoise the computed key to preserve its completion result.\n *\n * @param {t.Expression[]} expressions\n * @param {(NodePath<\n * t.ClassMethod | t.ClassProperty | t.ClassAccessorProperty\n * >)} fieldPath\n */\nfunction appendExpressionsToComputedKey(\n expressions: t.Expression[],\n fieldPath: NodePath<\n t.ClassMethod | t.ClassProperty | t.ClassAccessorProperty\n >,\n) {\n const key = fieldPath.get(\"key\") as NodePath<t.Expression>;\n const completion = getComputedKeyLastElement(key);\n if (completion.isConstantExpression()) {\n prependExpressionsToComputedKey(expressions, fieldPath);\n } else {\n const scopeParent = key.scope.parent;\n const maybeAssignment = memoiseComputedKey(\n completion.node,\n scopeParent,\n scopeParent.generateUid(\"computedKey\"),\n );\n if (!maybeAssignment) {\n // If the memoiseComputedKey returns undefined, the key is already a uid reference,\n // treat it as a constant expression and prepend expressions before it\n prependExpressionsToComputedKey(expressions, fieldPath);\n } else {\n const expressionSequence = [\n ...expressions,\n // preserve the completion result\n t.cloneNode(maybeAssignment.left),\n ];\n const completionParent = completion.parentPath;\n if (completionParent.isSequenceExpression()) {\n completionParent.pushContainer(\"expressions\", expressionSequence);\n } else {\n completion.replaceWith(\n maybeSequenceExpression([\n t.cloneNode(maybeAssignment),\n ...expressionSequence,\n ]),\n );\n }\n }\n }\n}\n\n/**\n * Prepend expressions to the field initializer. If the initializer is not defined,\n * this function will wrap the last expression within a `void` unary expression.\n *\n * @param {t.Expression[]} expressions\n * @param {(NodePath<\n * t.ClassProperty | t.ClassPrivateProperty | t.ClassAccessorProperty\n * >)} fieldPath\n */\nfunction prependExpressionsToFieldInitializer(\n expressions: t.Expression[],\n fieldPath: NodePath<\n t.ClassProperty | t.ClassPrivateProperty | t.ClassAccessorProperty\n >,\n) {\n const initializer = fieldPath.get(\"value\");\n if (initializer.node) {\n expressions.push(initializer.node);\n } else if (expressions.length > 0) {\n expressions[expressions.length - 1] = t.unaryExpression(\n \"void\",\n expressions[expressions.length - 1],\n );\n }\n initializer.replaceWith(maybeSequenceExpression(expressions));\n}\n\nfunction prependExpressionsToStaticBlock(\n expressions: t.Expression[],\n blockPath: NodePath<t.StaticBlock>,\n) {\n blockPath.unshiftContainer(\n \"body\",\n t.expressionStatement(maybeSequenceExpression(expressions)),\n );\n}\n\nfunction prependExpressionsToConstructor(\n expressions: t.Expression[],\n constructorPath: NodePath<t.ClassMethod>,\n) {\n constructorPath.node.body.body.unshift(\n t.expressionStatement(maybeSequenceExpression(expressions)),\n );\n}\n\nfunction isProtoInitCallExpression(\n expression: t.Expression,\n protoInitCall: t.Identifier,\n) {\n return (\n t.isCallExpression(expression) &&\n t.isIdentifier(expression.callee, { name: protoInitCall.name })\n );\n}\n\n/**\n * Optimize super call and its following expressions\n *\n * @param {t.Expression[]} expressions Mutated by this function. The first element must by a super call\n * @param {t.Identifier} protoInitLocal The generated protoInit id\n * @returns optimized expression\n */\nfunction optimizeSuperCallAndExpressions(\n expressions: t.Expression[],\n protoInitLocal: t.Identifier,\n) {\n if (protoInitLocal) {\n if (\n expressions.length >= 2 &&\n isProtoInitCallExpression(expressions[1], protoInitLocal)\n ) {\n // Merge `super(), protoInit(this)` into `protoInit(super())`\n const mergedSuperCall = t.callExpression(t.cloneNode(protoInitLocal), [\n expressions[0],\n ]);\n expressions.splice(0, 2, mergedSuperCall);\n }\n // Merge `protoInit(super()), this` into `protoInit(super())`\n if (\n expressions.length >= 2 &&\n t.isThisExpression(expressions[expressions.length - 1]) &&\n isProtoInitCallExpression(\n expressions[expressions.length - 2],\n protoInitLocal,\n )\n ) {\n expressions.splice(expressions.length - 1, 1);\n }\n }\n return maybeSequenceExpression(expressions);\n}\n\n/**\n * Insert expressions immediately after super() and optimize the output if possible.\n * This function will preserve the completion result using the trailing this expression.\n *\n * @param {t.Expression[]} expressions\n * @param {NodePath<t.ClassMethod>} constructorPath\n * @param {t.Identifier} protoInitLocal The generated protoInit id\n * @returns\n */\nfunction insertExpressionsAfterSuperCallAndOptimize(\n expressions: t.Expression[],\n constructorPath: NodePath<t.ClassMethod>,\n protoInitLocal: t.Identifier,\n) {\n constructorPath.traverse({\n CallExpression: {\n exit(path) {\n if (!path.get(\"callee\").isSuper()) return;\n const newNodes = [\n path.node,\n ...expressions.map(expr => t.cloneNode(expr)),\n ];\n // preserve completion result if super() is in an RHS or a return statement\n if (path.isCompletionRecord()) {\n newNodes.push(t.thisExpression());\n }\n path.replaceWith(\n optimizeSuperCallAndExpressions(newNodes, protoInitLocal),\n );\n\n path.skip();\n },\n },\n ClassMethod(path) {\n if (path.node.kind === \"constructor\") {\n path.skip();\n }\n },\n });\n}\n\n/**\n * Build a class constructor node from the given expressions. If the class is\n * derived, the constructor will call super() first to ensure that `this`\n * in the expressions work as expected.\n *\n * @param {t.Expression[]} expressions\n * @param {boolean} isDerivedClass\n * @returns The class constructor node\n */\nfunction createConstructorFromExpressions(\n expressions: t.Expression[],\n isDerivedClass: boolean,\n) {\n const body: t.Statement[] = [\n t.expressionStatement(maybeSequenceExpression(expressions)),\n ];\n if (isDerivedClass) {\n body.unshift(\n t.expressionStatement(\n t.callExpression(t.super(), [t.spreadElement(t.identifier(\"args\"))]),\n ),\n );\n }\n return t.classMethod(\n \"constructor\",\n t.identifier(\"constructor\"),\n isDerivedClass ? [t.restElement(t.identifier(\"args\"))] : [],\n t.blockStatement(body),\n );\n}\n\nfunction createStaticBlockFromExpressions(expressions: t.Expression[]) {\n return t.staticBlock([\n t.expressionStatement(maybeSequenceExpression(expressions)),\n ]);\n}\n\n// 3 bits reserved to this (0-7)\nconst FIELD = 0;\nconst ACCESSOR = 1;\nconst METHOD = 2;\nconst GETTER = 3;\nconst SETTER = 4;\n\nconst STATIC_OLD_VERSION = 5; // Before 2023-05\nconst STATIC = 8; // 1 << 3\nconst DECORATORS_HAVE_THIS = 16; // 1 << 4\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 // An array of applied decorators or a memoised identifier\n decoratorsArray: t.Identifier | t.ArrayExpression | t.Expression;\n decoratorsHaveThis: boolean;\n\n // The kind of the decorated value, matches the kind value passed to applyDecs\n kind: number;\n\n // whether or not the field is static\n isStatic: boolean;\n\n // The name of the decorator\n name: t.StringLiteral | t.Expression;\n\n privateMethods:\n | (t.FunctionExpression | t.ArrowFunctionExpression)[]\n | undefined;\n\n // The names of local variables that will be used/returned from the decoration\n locals: t.Identifier | t.Identifier[] | undefined;\n}\n\n/**\n * Sort decoration info in the application order:\n * - static non-fields\n * - instance non-fields\n * - static fields\n * - instance fields\n *\n * @param {DecoratorInfo[]} info\n * @returns {DecoratorInfo[]} Sorted decoration info\n */\nfunction toSortedDecoratorInfo(info: DecoratorInfo[]): DecoratorInfo[] {\n return [\n ...info.filter(\n el => el.isStatic && el.kind >= ACCESSOR && el.kind <= SETTER,\n ),\n ...info.filter(\n el => !el.isStatic && el.kind >= ACCESSOR && el.kind <= SETTER,\n ),\n ...info.filter(el => el.isStatic && el.kind === FIELD),\n ...info.filter(el => !el.isStatic && el.kind === FIELD),\n ];\n}\n\ntype GenerateDecorationListResult = {\n // The zipped decorators array that will be passed to generateDecorationExprs\n decs: t.Expression[];\n // Whether there are non-empty decorator this values\n haveThis: boolean;\n};\n/**\n * Zip decorators and decorator this values into an array\n *\n * @param {t.Expression[]} decorators\n * @param {((t.Expression | undefined)[])} decoratorsThis decorator this values\n * @param {DecoratorVersionKind} version\n * @returns {GenerateDecorationListResult}\n */\nfunction generateDecorationList(\n decorators: t.Expression[],\n decoratorsThis: (t.Expression | undefined)[],\n version: DecoratorVersionKind,\n): GenerateDecorationListResult {\n const decsCount = decorators.length;\n const haveOneThis = decoratorsThis.some(Boolean);\n const decs: t.Expression[] = [];\n for (let i = 0; i < decsCount; i++) {\n if (\n (version === \"2023-11\" ||\n (!process.env.BABEL_8_BREAKING && version === \"2023-05\")) &&\n haveOneThis\n ) {\n decs.push(\n decoratorsThis[i] || t.unaryExpression(\"void\", t.numericLiteral(0)),\n );\n }\n decs.push(decorators[i]);\n }\n\n return { haveThis: haveOneThis, decs };\n}\n\nfunction generateDecorationExprs(\n decorationInfo: DecoratorInfo[],\n version: DecoratorVersionKind,\n): t.ArrayExpression {\n return t.arrayExpression(\n decorationInfo.map(el => {\n let flag = el.kind;\n if (el.isStatic) {\n flag +=\n version === \"2023-11\" ||\n (!process.env.BABEL_8_BREAKING && version === \"2023-05\")\n ? STATIC\n : STATIC_OLD_VERSION;\n }\n if (el.decoratorsHaveThis) flag += DECORATORS_HAVE_THIS;\n\n return t.arrayExpression([\n el.decoratorsArray,\n t.numericLiteral(flag),\n el.name,\n ...(el.privateMethods || []),\n ]);\n }),\n );\n}\n\nfunction extractElementLocalAssignments(decorationInfo: DecoratorInfo[]) {\n const localIds: t.Identifier[] = [];\n\n for (const el of 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 version: DecoratorVersionKind,\n element: NodePath,\n key: t.PrivateName,\n getId: t.Identifier,\n setId: t.Identifier,\n isStatic: boolean,\n) {\n element.insertAfter(\n t.classPrivateMethod(\n \"get\",\n t.cloneNode(key),\n [],\n t.blockStatement([\n t.returnStatement(\n t.callExpression(\n t.cloneNode(getId),\n (process.env.BABEL_8_BREAKING || version === \"2023-11\") && isStatic\n ? []\n : [t.thisExpression()],\n ),\n ),\n ]),\n isStatic,\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(\n t.cloneNode(setId),\n (process.env.BABEL_8_BREAKING || version === \"2023-11\") && isStatic\n ? [t.identifier(\"v\")]\n : [t.thisExpression(), t.identifier(\"v\")],\n ),\n ),\n ]),\n isStatic,\n ),\n );\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 staticBlockToFunctionClosure(block: t.StaticBlock) {\n return t.functionExpression(null, [], t.blockStatement(block.body));\n}\n\nfunction fieldInitializerToClosure(value: t.Expression) {\n return t.functionExpression(\n null,\n [],\n t.blockStatement([t.returnStatement(value)]),\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\n/**\n * Create FunctionExpression from a ClassPrivateMethod.\n * The returned FunctionExpression node takes ownership of the private method's body and params.\n *\n * @param {t.ClassPrivateMethod} node\n * @returns\n */\nfunction createFunctionExpressionFromPrivateMethod(node: t.ClassPrivateMethod) {\n const { params, body, generator: isGenerator, async: isAsync } = node;\n return t.functionExpression(\n undefined,\n // @ts-expect-error todo: Improve typings: TSParameterProperty is only allowed in constructor\n params,\n body,\n isGenerator,\n isAsync,\n );\n}\n\nfunction createSetFunctionNameCall(\n state: PluginPass,\n className: t.Identifier | t.StringLiteral,\n) {\n return t.callExpression(state.addHelper(\"setFunctionName\"), [\n t.thisExpression(),\n className,\n ]);\n}\n\nfunction createToPropertyKeyCall(state: PluginPass, propertyKey: t.Expression) {\n return t.callExpression(state.addHelper(\"toPropertyKey\"), [propertyKey]);\n}\n\nfunction createPrivateBrandCheckClosure(brandName: t.PrivateName) {\n return t.arrowFunctionExpression(\n [t.identifier(\"_\")],\n t.binaryExpression(\"in\", t.cloneNode(brandName), t.identifier(\"_\")),\n );\n}\n\nfunction usesPrivateField(expression: t.Node) {\n try {\n t.traverseFast(expression, node => {\n if (t.isPrivateName(node)) {\n // TODO: Add early return support to t.traverseFast\n throw null;\n }\n });\n return false;\n } catch {\n return true;\n }\n}\n\n/**\n * Convert a non-computed class element to its equivalent computed form.\n *\n * This function is to provide a decorator evaluation storage from non-computed\n * class elements.\n *\n * @param {(NodePath<t.ClassProperty | t.ClassMethod>)} path A non-computed class property or method\n */\nfunction convertToComputedKey(path: NodePath<t.ClassProperty | t.ClassMethod>) {\n const { node } = path;\n node.computed = true;\n if (t.isIdentifier(node.key)) {\n node.key = t.stringLiteral(node.key.name);\n }\n}\n\nfunction hasInstancePrivateAccess(path: NodePath, privateNames: string[]) {\n let containsInstancePrivateAccess = false;\n if (privateNames.length > 0) {\n const privateNameVisitor = privateNameVisitorFactory<\n PrivateNameVisitorState<null>,\n null\n >({\n PrivateName(path, state) {\n if (state.privateNamesMap.has(path.node.id.name)) {\n containsInstancePrivateAccess = true;\n path.stop();\n }\n },\n });\n const privateNamesMap = new Map<string, null>();\n for (const name of privateNames) {\n privateNamesMap.set(name, null);\n }\n path.traverse(privateNameVisitor, {\n privateNamesMap: privateNamesMap,\n });\n }\n return containsInstancePrivateAccess;\n}\n\nfunction checkPrivateMethodUpdateError(\n path: NodePath<t.Class>,\n decoratedPrivateMethods: Set<string>,\n) {\n const privateNameVisitor = privateNameVisitorFactory<\n PrivateNameVisitorState<null>,\n null\n >({\n PrivateName(path, state) {\n if (!state.privateNamesMap.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 read-only, but \"#${path.node.id.name}\" is updated via this expression.`,\n );\n }\n },\n });\n const privateNamesMap = new Map<string, null>();\n for (const name of decoratedPrivateMethods) {\n privateNamesMap.set(name, null);\n }\n path.traverse(privateNameVisitor, {\n privateNamesMap: privateNamesMap,\n });\n}\n\nfunction transformClass(\n path: NodePath<t.Class>,\n state: PluginPass,\n constantSuper: boolean,\n ignoreFunctionLength: boolean,\n className: string | t.Identifier | t.StringLiteral | undefined,\n propertyVisitor: Visitor<PluginPass>,\n version: DecoratorVersionKind,\n): NodePath {\n const body = path.get(\"body.body\");\n\n const classDecorators = path.node.decorators;\n let hasElementDecorators = false;\n let hasComputedKeysSideEffects = false;\n let elemDecsUseFnContext = false;\n\n const generateClassPrivateUid = createLazyPrivateUidGeneratorForClass(path);\n\n const classAssignments: t.AssignmentExpression[] = [];\n const scopeParent: Scope = path.scope.parent;\n const memoiseExpression = (\n expression: t.Expression,\n hint: string,\n assignments: t.AssignmentExpression[],\n ) => {\n const localEvaluatedId = generateLetUidIdentifier(scopeParent, hint);\n assignments.push(t.assignmentExpression(\"=\", localEvaluatedId, expression));\n return t.cloneNode(localEvaluatedId);\n };\n\n let protoInitLocal: t.Identifier;\n let staticInitLocal: t.Identifier;\n const classIdName = path.node.id?.name;\n // Check if the expression does not reference function-specific\n // context or the given identifier name.\n // `true` means \"maybe\" and `false` means \"no\".\n const usesFunctionContextOrYieldAwait = (expression: t.Node) => {\n try {\n t.traverseFast(expression, node => {\n if (\n t.isThisExpression(node) ||\n t.isSuper(node) ||\n t.isYieldExpression(node) ||\n t.isAwaitExpression(node) ||\n t.isIdentifier(node, { name: \"arguments\" }) ||\n (classIdName && t.isIdentifier(node, { name: classIdName })) ||\n (t.isMetaProperty(node) && node.meta.name !== \"import\")\n ) {\n // TODO: Add early return support to t.traverseFast\n throw null;\n }\n });\n return false;\n } catch {\n return true;\n }\n };\n\n const instancePrivateNames: string[] = [];\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, and handle inferred\n // class name when the initializer of the class field is a class expression\n for (const element of body) {\n if (!isClassDecoratableElementPath(element)) {\n continue;\n }\n\n const elementNode = element.node;\n\n if (!elementNode.static && t.isPrivateName(elementNode.key)) {\n instancePrivateNames.push(elementNode.key.id.name);\n }\n\n if (isDecorated(elementNode)) {\n switch (elementNode.type) {\n case \"ClassProperty\":\n // @ts-expect-error todo: propertyVisitor.ClassProperty should be callable. Improve typings.\n propertyVisitor.ClassProperty(\n element as NodePath<t.ClassProperty>,\n state,\n );\n break;\n case \"ClassPrivateProperty\":\n // @ts-expect-error todo: propertyVisitor.ClassPrivateProperty should be callable. Improve typings.\n propertyVisitor.ClassPrivateProperty(\n element as NodePath<t.ClassPrivateProperty>,\n state,\n );\n break;\n case \"ClassAccessorProperty\":\n // @ts-expect-error todo: propertyVisitor.ClassAccessorProperty should be callable. Improve typings.\n propertyVisitor.ClassAccessorProperty(\n element as NodePath<t.ClassAccessorProperty>,\n state,\n );\n if (version === \"2023-11\") {\n break;\n }\n /* fallthrough */\n default:\n if (elementNode.static) {\n staticInitLocal ??= generateLetUidIdentifier(\n scopeParent,\n \"initStatic\",\n );\n } else {\n protoInitLocal ??= generateLetUidIdentifier(\n scopeParent,\n \"initProto\",\n );\n }\n break;\n }\n hasElementDecorators = true;\n elemDecsUseFnContext ||= elementNode.decorators.some(\n usesFunctionContextOrYieldAwait,\n );\n } else if (elementNode.type === \"ClassAccessorProperty\") {\n // @ts-expect-error todo: propertyVisitor.ClassAccessorProperty should be callable. Improve typings.\n propertyVisitor.ClassAccessorProperty(\n element as NodePath<t.ClassAccessorProperty>,\n state,\n );\n const { key, value, static: isStatic, computed } = elementNode;\n\n const newId = generateClassPrivateUid();\n const newField = generateClassProperty(newId, value, isStatic);\n const keyPath = element.get(\"key\");\n const [newPath] = element.replaceWith(newField);\n\n let getterKey, setterKey;\n if (computed && !keyPath.isConstantExpression()) {\n getterKey = memoiseComputedKey(\n createToPropertyKeyCall(state, key as t.Expression),\n scopeParent,\n scopeParent.generateUid(\"computedKey\"),\n )!;\n setterKey = t.cloneNode(getterKey.left as t.Identifier);\n } else {\n getterKey = t.cloneNode(key);\n setterKey = t.cloneNode(key);\n }\n\n addProxyAccessorsFor(\n path.node.id,\n newPath,\n getterKey,\n setterKey,\n newId,\n computed,\n isStatic,\n version,\n );\n }\n\n if (\"computed\" in element.node && element.node.computed) {\n hasComputedKeysSideEffects ||= !scopeParent.isStatic(element.node.key);\n }\n }\n\n if (!classDecorators && !hasElementDecorators) {\n // If nothing is decorated and no assignments inserted, return\n return;\n }\n\n const elementDecoratorInfo: DecoratorInfo[] = [];\n\n let constructorPath: NodePath<t.ClassMethod> | undefined;\n const decoratedPrivateMethods = new Set<string>();\n\n let classInitLocal: t.Identifier, classIdLocal: t.Identifier;\n let decoratorReceiverId: t.Identifier | null = null;\n\n // Memoise the this value `a.b` of decorator member expressions `@a.b.dec`,\n type HandleDecoratorExpressionsResult = {\n // whether the whole decorator list requires memoisation\n hasSideEffects: boolean;\n usesFnContext: boolean;\n // the this value of each decorator if applicable\n decoratorsThis: (t.Expression | undefined)[];\n };\n function handleDecoratorExpressions(\n expressions: t.Expression[],\n ): HandleDecoratorExpressionsResult {\n let hasSideEffects = false;\n let usesFnContext = false;\n const decoratorsThis: (t.Expression | null)[] = [];\n for (const expression of expressions) {\n let object;\n if (\n (version === \"2023-11\" ||\n (!process.env.BABEL_8_BREAKING && version === \"2023-05\")) &&\n t.isMemberExpression(expression)\n ) {\n if (t.isSuper(expression.object)) {\n object = t.thisExpression();\n } else if (scopeParent.isStatic(expression.object)) {\n object = t.cloneNode(expression.object);\n } else {\n decoratorReceiverId ??= generateLetUidIdentifier(scopeParent, \"obj\");\n object = t.assignmentExpression(\n \"=\",\n t.cloneNode(decoratorReceiverId),\n expression.object,\n );\n expression.object = t.cloneNode(decoratorReceiverId);\n }\n }\n decoratorsThis.push(object);\n hasSideEffects ||= !scopeParent.isStatic(expression);\n usesFnContext ||= usesFunctionContextOrYieldAwait(expression);\n }\n return { hasSideEffects, usesFnContext, decoratorsThis };\n }\n\n const willExtractSomeElemDecs =\n hasComputedKeysSideEffects ||\n (process.env.BABEL_8_BREAKING\n ? elemDecsUseFnContext\n : elemDecsUseFnContext || version !== \"2023-11\");\n\n let needsDeclaraionForClassBinding = false;\n let classDecorationsFlag = 0;\n let classDecorations: t.Expression[] = [];\n let classDecorationsId: t.Identifier;\n let computedKeyAssignments: t.AssignmentExpression[] = [];\n if (classDecorators) {\n classInitLocal = generateLetUidIdentifier(scopeParent, \"initClass\");\n needsDeclaraionForClassBinding = path.isClassDeclaration();\n ({ id: classIdLocal, path } = replaceClassWithVar(path, className));\n\n path.node.decorators = null;\n\n const decoratorExpressions = classDecorators.map(el => el.expression);\n const classDecsUsePrivateName = decoratorExpressions.some(usesPrivateField);\n const { hasSideEffects, decoratorsThis } =\n handleDecoratorExpressions(decoratorExpressions);\n\n const { haveThis, decs } = generateDecorationList(\n decoratorExpressions,\n decoratorsThis,\n version,\n );\n classDecorationsFlag = haveThis ? 1 : 0;\n classDecorations = decs;\n\n if (\n (hasSideEffects && willExtractSomeElemDecs) ||\n classDecsUsePrivateName\n ) {\n classDecorationsId = memoiseExpression(\n t.arrayExpression(classDecorations),\n \"classDecs\",\n classAssignments,\n );\n }\n\n if (!hasElementDecorators) {\n // Sync body paths as non-decorated computed accessors have been transpiled\n // to getter-setter pairs.\n for (const element of path.get(\"body.body\")) {\n const { node } = element;\n const isComputed = \"computed\" in node && node.computed;\n if (isComputed) {\n if (element.isClassProperty({ static: true })) {\n if (!element.get(\"key\").isConstantExpression()) {\n const key = (node as t.ClassProperty).key;\n const maybeAssignment = memoiseComputedKey(\n key,\n scopeParent,\n scopeParent.generateUid(\"computedKey\"),\n );\n if (maybeAssignment != null) {\n // If it is a static computed field within a decorated class, we move the computed key\n // into `computedKeyAssignments` which will be then moved into the non-static class,\n // to ensure that the evaluation order and private environment are correct\n node.key = t.cloneNode(maybeAssignment.left);\n computedKeyAssignments.push(maybeAssignment);\n }\n }\n } else if (computedKeyAssignments.length > 0) {\n prependExpressionsToComputedKey(\n computedKeyAssignments,\n element as NodePath<ClassElementCanHaveComputedKeys>,\n );\n computedKeyAssignments = [];\n }\n }\n }\n }\n } else {\n if (!path.node.id) {\n path.node.id = path.scope.generateUidIdentifier(\"Class\");\n }\n classIdLocal = t.cloneNode(path.node.id);\n }\n\n let lastInstancePrivateName: t.PrivateName;\n let needsInstancePrivateBrandCheck = false;\n\n let fieldInitializerExpressions = [];\n let staticFieldInitializerExpressions: t.Expression[] = [];\n\n if (hasElementDecorators) {\n if (protoInitLocal) {\n const protoInitCall = t.callExpression(t.cloneNode(protoInitLocal), [\n t.thisExpression(),\n ]);\n fieldInitializerExpressions.push(protoInitCall);\n }\n for (const element of body) {\n if (!isClassDecoratableElementPath(element)) {\n if (\n staticFieldInitializerExpressions.length > 0 &&\n element.isStaticBlock()\n ) {\n prependExpressionsToStaticBlock(\n staticFieldInitializerExpressions,\n element,\n );\n staticFieldInitializerExpressions = [];\n }\n continue;\n }\n\n const { node } = element;\n const decorators = node.decorators;\n\n const hasDecorators = !!decorators?.length;\n\n const isComputed = \"computed\" in node && node.computed;\n\n let name = \"computedKey\";\n\n if (node.key.type === \"PrivateName\") {\n name = node.key.id.name;\n } else if (!isComputed && node.key.type === \"Identifier\") {\n name = node.key.name;\n }\n let decoratorsArray: t.Identifier | t.ArrayExpression | t.Expression;\n let decoratorsHaveThis;\n\n if (hasDecorators) {\n const decoratorExpressions = decorators.map(d => d.expression);\n const { hasSideEffects, usesFnContext, decoratorsThis } =\n handleDecoratorExpressions(decoratorExpressions);\n const { decs, haveThis } = generateDecorationList(\n decoratorExpressions,\n decoratorsThis,\n version,\n );\n decoratorsHaveThis = haveThis;\n decoratorsArray = decs.length === 1 ? decs[0] : t.arrayExpression(decs);\n if (usesFnContext || (hasSideEffects && willExtractSomeElemDecs)) {\n decoratorsArray = memoiseExpression(\n decoratorsArray,\n name + \"Decs\",\n computedKeyAssignments,\n );\n }\n }\n\n if (isComputed) {\n if (!element.get(\"key\").isConstantExpression()) {\n const key = node.key as t.Expression;\n const maybeAssignment = memoiseComputedKey(\n hasDecorators ? createToPropertyKeyCall(state, key) : key,\n scopeParent,\n scopeParent.generateUid(\"computedKey\"),\n );\n if (maybeAssignment != null) {\n // If it is a static computed field within a decorated class, we move the computed key\n // into `computedKeyAssignments` which will be then moved into the non-static class,\n // to ensure that the evaluation order and private environment are correct\n if (classDecorators && element.isClassProperty({ static: true })) {\n node.key = t.cloneNode(maybeAssignment.left);\n computedKeyAssignments.push(maybeAssignment);\n } else {\n node.key = maybeAssignment;\n }\n }\n }\n }\n\n const { key, static: isStatic } = node;\n\n const isPrivate = key.type === \"PrivateName\";\n\n const kind = getElementKind(element);\n\n if (isPrivate && !isStatic) {\n if (hasDecorators) {\n needsInstancePrivateBrandCheck = true;\n }\n if (t.isClassPrivateProperty(node) || !lastInstancePrivateName) {\n lastInstancePrivateName = key;\n }\n }\n\n if (element.isClassMethod({ kind: \"constructor\" })) {\n constructorPath = element;\n }\n\n let locals: t.Identifier[];\n if (hasDecorators) {\n let privateMethods: Array<\n t.FunctionExpression | t.ArrowFunctionExpression\n >;\n\n let nameExpr: t.Expression;\n\n if (isComputed) {\n nameExpr = getComputedKeyMemoiser(\n element.get(\"key\") as NodePath<t.Expression>,\n );\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 if (kind === ACCESSOR) {\n const { value } = element.node as t.ClassAccessorProperty;\n\n const params: t.Expression[] =\n (process.env.BABEL_8_BREAKING || version === \"2023-11\") && isStatic\n ? []\n : [t.thisExpression()];\n\n if (value) {\n params.push(t.cloneNode(value));\n }\n\n const newId = generateClassPrivateUid();\n const newFieldInitId = generateLetUidIdentifier(\n scopeParent,\n `init_${name}`,\n );\n const newValue = t.callExpression(\n t.cloneNode(newFieldInitId),\n params,\n );\n\n const newField = generateClassProperty(newId, newValue, isStatic);\n const [newPath] = element.replaceWith(newField);\n\n if (isPrivate) {\n privateMethods = extractProxyAccessorsFor(newId, version);\n\n const getId = generateLetUidIdentifier(scopeParent, `get_${name}`);\n const setId = generateLetUidIdentifier(scopeParent, `set_${name}`);\n\n addCallAccessorsFor(version, newPath, key, getId, setId, isStatic);\n\n locals = [newFieldInitId, getId, setId];\n } else {\n addProxyAccessorsFor(\n path.node.id,\n newPath,\n t.cloneNode(key),\n t.isAssignmentExpression(key)\n ? t.cloneNode(key.left as t.Identifier)\n : t.cloneNode(key),\n newId,\n isComputed,\n isStatic,\n version,\n );\n locals = [newFieldInitId];\n }\n } else if (kind === FIELD) {\n const initId = generateLetUidIdentifier(scopeParent, `init_${name}`);\n const valuePath = (\n element as NodePath<t.ClassProperty | t.ClassPrivateProperty>\n ).get(\"value\");\n\n const args: t.Expression[] =\n (process.env.BABEL_8_BREAKING || version === \"2023-11\") && isStatic\n ? []\n : [t.thisExpression()];\n if (valuePath.node) args.push(valuePath.node);\n\n valuePath.replaceWith(t.callExpression(t.cloneNode(initId), args));\n\n locals = [initId];\n\n if (isPrivate) {\n privateMethods = extractProxyAccessorsFor(key, version);\n }\n } else if (isPrivate) {\n const callId = generateLetUidIdentifier(scopeParent, `call_${name}`);\n locals = [callId];\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 privateMethods = [\n createFunctionExpressionFromPrivateMethod(\n element.node as t.ClassPrivateMethod,\n ),\n ];\n\n if (kind === GETTER || kind === SETTER) {\n movePrivateAccessor(\n element as NodePath<t.ClassPrivateMethod>,\n t.cloneNode(key),\n t.cloneNode(callId),\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(callId), [], node.static),\n );\n\n decoratedPrivateMethods.add(key.id.name);\n\n element.remove();\n }\n }\n\n elementDecoratorInfo.push({\n kind,\n decoratorsArray,\n decoratorsHaveThis,\n name: nameExpr,\n isStatic,\n privateMethods,\n locals,\n });\n\n if (element.node) {\n element.node.decorators = null;\n }\n }\n\n if (isComputed && computedKeyAssignments.length > 0) {\n if (classDecorators && element.isClassProperty({ static: true })) {\n // If the class is decorated, we don't insert computedKeyAssignments here\n // because any non-static computed elements defined after it will be moved\n // into the non-static class, so they will be evaluated before the key of\n // this field. At this momemnt, its key must be either a constant expression\n // or a uid reference which has been assigned _within_ the non-static class.\n } else {\n prependExpressionsToComputedKey(\n computedKeyAssignments,\n (kind === ACCESSOR\n ? element.getNextSibling() // the transpiled getter of the accessor property\n : element) as NodePath<ClassElementCanHaveComputedKeys>,\n );\n computedKeyAssignments = [];\n }\n }\n\n if (\n fieldInitializerExpressions.length > 0 &&\n !isStatic &&\n (kind === FIELD || kind === ACCESSOR)\n ) {\n prependExpressionsToFieldInitializer(\n fieldInitializerExpressions,\n element as NodePath<t.ClassProperty | t.ClassPrivateProperty>,\n );\n fieldInitializerExpressions = [];\n }\n\n if (\n staticFieldInitializerExpressions.length > 0 &&\n isStatic &&\n (kind === FIELD || kind === ACCESSOR)\n ) {\n prependExpressionsToFieldInitializer(\n staticFieldInitializerExpressions,\n element as NodePath<t.ClassProperty | t.ClassPrivateProperty>,\n );\n staticFieldInitializerExpressions = [];\n }\n\n if (hasDecorators && version === \"2023-11\") {\n if (kind === FIELD || kind === ACCESSOR) {\n const initExtraId = generateLetUidIdentifier(\n scopeParent,\n `init_extra_${name}`,\n );\n locals.push(initExtraId);\n const initExtraCall = t.callExpression(\n t.cloneNode(initExtraId),\n isStatic ? [] : [t.thisExpression()],\n );\n if (!isStatic) {\n fieldInitializerExpressions.push(initExtraCall);\n } else {\n staticFieldInitializerExpressions.push(initExtraCall);\n }\n }\n }\n }\n }\n\n if (computedKeyAssignments.length > 0) {\n const elements = path.get(\"body.body\");\n let lastComputedElement: NodePath<ClassElementCanHaveComputedKeys>;\n for (let i = elements.length - 1; i >= 0; i--) {\n const path = elements[i];\n const node = path.node as ClassElementCanHaveComputedKeys;\n if (node.computed) {\n if (classDecorators && t.isClassProperty(node, { static: true })) {\n continue;\n }\n lastComputedElement = path as NodePath<ClassElementCanHaveComputedKeys>;\n break;\n }\n }\n if (lastComputedElement != null) {\n appendExpressionsToComputedKey(\n computedKeyAssignments,\n lastComputedElement,\n );\n computedKeyAssignments = [];\n } else {\n // If there is no computed key, we will try to convert the first non-computed\n // class element into a computed key and insert assignments there. This will\n // be done after we handle the class elements split when the class is decorated.\n }\n }\n\n if (fieldInitializerExpressions.length > 0) {\n const isDerivedClass = !!path.node.superClass;\n if (constructorPath) {\n if (isDerivedClass) {\n insertExpressionsAfterSuperCallAndOptimize(\n fieldInitializerExpressions,\n constructorPath,\n protoInitLocal,\n );\n } else {\n prependExpressionsToConstructor(\n fieldInitializerExpressions,\n constructorPath,\n );\n }\n } else {\n path.node.body.body.unshift(\n createConstructorFromExpressions(\n fieldInitializerExpressions,\n isDerivedClass,\n ),\n );\n }\n fieldInitializerExpressions = [];\n }\n\n if (staticFieldInitializerExpressions.length > 0) {\n path.node.body.body.push(\n createStaticBlockFromExpressions(staticFieldInitializerExpressions),\n );\n staticFieldInitializerExpressions = [];\n }\n\n const sortedElementDecoratorInfo =\n toSortedDecoratorInfo(elementDecoratorInfo);\n\n const elementDecorations = generateDecorationExprs(\n process.env.BABEL_8_BREAKING || version === \"2023-11\"\n ? elementDecoratorInfo\n : sortedElementDecoratorInfo,\n version,\n );\n\n const elementLocals: t.Identifier[] = extractElementLocalAssignments(\n sortedElementDecoratorInfo,\n );\n\n if (protoInitLocal) {\n elementLocals.push(protoInitLocal);\n }\n\n if (staticInitLocal) {\n elementLocals.push(staticInitLocal);\n }\n\n const classLocals: t.Identifier[] = [];\n let classInitInjected = false;\n const classInitCall =\n classInitLocal && t.callExpression(t.cloneNode(classInitLocal), []);\n\n let originalClassPath = path;\n const originalClass = path.node;\n\n const staticClosures: t.AssignmentExpression[] = [];\n if (classDecorators) {\n classLocals.push(classIdLocal, classInitLocal);\n const statics: (\n | t.ClassProperty\n | t.ClassPrivateProperty\n | t.ClassPrivateMethod\n )[] = [];\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 if (hasInstancePrivateAccess(element, instancePrivateNames)) {\n const staticBlockClosureId = memoiseExpression(\n staticBlockToFunctionClosure(element.node),\n \"staticBlock\",\n staticClosures,\n );\n staticFieldInitializerExpressions.push(\n t.callExpression(\n t.memberExpression(staticBlockClosureId, t.identifier(\"call\")),\n [t.thisExpression()],\n ),\n );\n } else {\n staticFieldInitializerExpressions.push(\n staticBlockToIIFE(element.node),\n );\n }\n element.remove();\n return;\n }\n\n if (\n (element.isClassProperty() || element.isClassPrivateProperty()) &&\n element.node.static\n ) {\n const valuePath = (\n element as NodePath<t.ClassProperty | t.ClassPrivateProperty>\n ).get(\"value\");\n if (hasInstancePrivateAccess(valuePath, instancePrivateNames)) {\n const fieldValueClosureId = memoiseExpression(\n fieldInitializerToClosure(valuePath.node),\n \"fieldValue\",\n staticClosures,\n );\n valuePath.replaceWith(\n t.callExpression(\n t.memberExpression(fieldValueClosureId, t.identifier(\"call\")),\n [t.thisExpression()],\n ),\n );\n }\n if (staticFieldInitializerExpressions.length > 0) {\n prependExpressionsToFieldInitializer(\n staticFieldInitializerExpressions,\n element,\n );\n staticFieldInitializerExpressions = [];\n }\n element.node.static = false;\n statics.push(element.node);\n element.remove();\n } else if (element.isClassPrivateMethod({ static: true })) {\n // At this moment the element must not have decorators, so any private name\n // within the element must come from either params or body\n if (hasInstancePrivateAccess(element, instancePrivateNames)) {\n const replaceSupers = new ReplaceSupers({\n constantSuper,\n methodPath: element,\n objectRef: classIdLocal,\n superRef: path.node.superClass,\n file: state.file,\n refToPreserve: classIdLocal,\n });\n\n replaceSupers.replace();\n\n const privateMethodDelegateId = memoiseExpression(\n createFunctionExpressionFromPrivateMethod(element.node),\n element.get(\"key.id\").node.name,\n staticClosures,\n );\n\n if (ignoreFunctionLength) {\n element.node.params = [t.restElement(t.identifier(\"arg\"))];\n element.node.body = t.blockStatement([\n t.returnStatement(\n t.callExpression(\n t.memberExpression(\n privateMethodDelegateId,\n t.identifier(\"apply\"),\n ),\n [t.thisExpression(), t.identifier(\"arg\")],\n ),\n ),\n ]);\n } else {\n element.node.params = element.node.params.map((p, i) => {\n if (t.isRestElement(p)) {\n return t.restElement(t.identifier(\"arg\"));\n } else {\n return t.identifier(\"_\" + i);\n }\n });\n element.node.body = t.blockStatement([\n t.returnStatement(\n t.callExpression(\n t.memberExpression(\n privateMethodDelegateId,\n t.identifier(\"apply\"),\n ),\n [t.thisExpression(), t.identifier(\"arguments\")],\n ),\n ),\n ]);\n }\n }\n element.node.static = false;\n statics.push(element.node);\n element.remove();\n }\n });\n\n if (statics.length > 0 || staticFieldInitializerExpressions.length > 0) {\n const staticsClass = template.expression.ast`\n class extends ${state.addHelper(\"identity\")} {}\n ` as t.ClassExpression;\n staticsClass.body.body = [\n // Insert the original class to a computed key of the wrapper so that\n // 1) they share the same function context with the wrapper class\n // 2) the memoisation of static computed field is evaluated before they\n // are referenced in the wrapper class keys\n // Note that any static elements of the wrapper class can not be accessed\n // in the user land, so we don't have to remove the temporary class field.\n t.classProperty(\n t.toExpression(originalClass),\n undefined,\n undefined,\n undefined,\n /* computed */ true,\n /* static */ true,\n ),\n ...statics,\n ];\n\n const constructorBody: t.Expression[] = [];\n\n const newExpr = t.newExpression(staticsClass, []);\n\n if (staticFieldInitializerExpressions.length > 0) {\n constructorBody.push(...staticFieldInitializerExpressions);\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 // set isDerivedClass to false as we have already prepended super call\n staticsClass.body.body.push(\n createConstructorFromExpressions(\n constructorBody,\n /* isDerivedClass */ false,\n ),\n );\n } else {\n newExpr.arguments.push(t.cloneNode(classIdLocal));\n }\n\n const [newPath] = path.replaceWith(newExpr);\n\n // update originalClassPath according to the new AST\n originalClassPath = (\n newPath.get(\"callee\").get(\"body\") as NodePath<t.Class>\n ).get(\"body.0.key\");\n }\n }\n if (!classInitInjected && classInitCall) {\n path.node.body.body.push(\n t.staticBlock([t.expressionStatement(classInitCall)]),\n );\n }\n\n let { superClass } = originalClass;\n if (\n superClass &&\n (process.env.BABEL_8_BREAKING ||\n version === \"2023-11\" ||\n version === \"2023-05\")\n ) {\n const id = path.scope.maybeGenerateMemoised(superClass);\n if (id) {\n originalClass.superClass = t.assignmentExpression(\"=\", id, superClass);\n superClass = id;\n }\n }\n\n const applyDecoratorWrapper = t.staticBlock([]);\n originalClass.body.body.unshift(applyDecoratorWrapper);\n const applyDecsBody = applyDecoratorWrapper.body;\n if (computedKeyAssignments.length > 0) {\n const elements = originalClassPath.get(\"body.body\");\n let firstPublicElement: NodePath<t.ClassProperty | t.ClassMethod>;\n for (const path of elements) {\n if (\n (path.isClassProperty() || path.isClassMethod()) &&\n (path.node as t.ClassMethod).kind !== \"constructor\"\n ) {\n firstPublicElement = path;\n break;\n }\n }\n if (firstPublicElement != null) {\n // Convert its key to a computed one to host the decorator evaluations.\n convertToComputedKey(firstPublicElement);\n prependExpressionsToComputedKey(\n computedKeyAssignments,\n firstPublicElement,\n );\n } else {\n // When there is no public class elements, we inject a temporary computed\n // field whose key will host the decorator evaluations. The field will be\n // deleted immediately after it is defiend.\n originalClass.body.body.unshift(\n t.classProperty(\n t.sequenceExpression([\n ...computedKeyAssignments,\n t.stringLiteral(\"_\"),\n ]),\n undefined,\n undefined,\n undefined,\n /* computed */ true,\n /* static */ true,\n ),\n );\n applyDecsBody.push(\n t.expressionStatement(\n t.unaryExpression(\n \"delete\",\n t.memberExpression(t.thisExpression(), t.identifier(\"_\")),\n ),\n ),\n );\n }\n computedKeyAssignments = [];\n }\n\n applyDecsBody.push(\n t.expressionStatement(\n createLocalsAssignment(\n elementLocals,\n classLocals,\n elementDecorations,\n classDecorationsId ?? t.arrayExpression(classDecorations),\n t.numericLiteral(classDecorationsFlag),\n needsInstancePrivateBrandCheck ? lastInstancePrivateName : null,\n typeof className === \"object\" ? className : undefined,\n t.cloneNode(superClass),\n state,\n version,\n ),\n ),\n );\n if (staticInitLocal) {\n applyDecsBody.push(\n t.expressionStatement(\n t.callExpression(t.cloneNode(staticInitLocal), [t.thisExpression()]),\n ),\n );\n }\n if (staticClosures.length > 0) {\n applyDecsBody.push(\n ...staticClosures.map(expr => t.expressionStatement(expr)),\n );\n }\n\n // When path is a ClassExpression, path.insertBefore will convert `path`\n // into a SequenceExpression\n path.insertBefore(classAssignments.map(expr => t.expressionStatement(expr)));\n\n if (needsDeclaraionForClassBinding) {\n const classBindingInfo = scopeParent.getBinding(classIdLocal.name);\n if (!classBindingInfo.constantViolations.length) {\n // optimization: reuse the inner class binding if the outer class binding is not mutated\n path.insertBefore(\n t.variableDeclaration(\"let\", [\n t.variableDeclarator(t.cloneNode(classIdLocal)),\n ]),\n );\n } else {\n const classOuterBindingDelegateLocal = scopeParent.generateUidIdentifier(\n \"t\" + classIdLocal.name,\n );\n const classOuterBindingLocal = classIdLocal;\n path.replaceWithMultiple([\n t.variableDeclaration(\"let\", [\n t.variableDeclarator(t.cloneNode(classOuterBindingLocal)),\n t.variableDeclarator(classOuterBindingDelegateLocal),\n ]),\n t.blockStatement([\n t.variableDeclaration(\"let\", [\n t.variableDeclarator(t.cloneNode(classIdLocal)),\n ]),\n // needsDeclaraionForClassBinding is true ↔ node is a class declaration\n path.node as t.ClassDeclaration,\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.cloneNode(classOuterBindingDelegateLocal),\n t.cloneNode(classIdLocal),\n ),\n ),\n ]),\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.cloneNode(classOuterBindingLocal),\n t.cloneNode(classOuterBindingDelegateLocal),\n ),\n ),\n ]);\n }\n }\n\n if (decoratedPrivateMethods.size > 0) {\n checkPrivateMethodUpdateError(path, decoratedPrivateMethods);\n }\n\n // Recrawl the scope to make sure new identifiers are properly synced\n path.scope.crawl();\n\n return path;\n}\n\nfunction createLocalsAssignment(\n elementLocals: t.Identifier[],\n classLocals: t.Identifier[],\n elementDecorations: t.ArrayExpression | t.Identifier,\n classDecorations: t.ArrayExpression | t.Identifier,\n classDecorationsFlag: t.NumericLiteral,\n maybePrivateBrandName: t.PrivateName | null,\n setClassName: t.Identifier | t.StringLiteral | undefined,\n superClass: null | t.Expression,\n state: PluginPass,\n version: DecoratorVersionKind,\n) {\n let lhs, rhs;\n const args: t.Expression[] = [\n setClassName\n ? createSetFunctionNameCall(state, setClassName)\n : t.thisExpression(),\n classDecorations,\n elementDecorations,\n ];\n\n if (!process.env.BABEL_8_BREAKING) {\n if (version !== \"2023-11\") {\n args.splice(1, 2, elementDecorations, classDecorations);\n }\n if (\n version === \"2021-12\" ||\n (version === \"2022-03\" && !state.availableHelper(\"applyDecs2203R\"))\n ) {\n lhs = t.arrayPattern([...elementLocals, ...classLocals]);\n rhs = t.callExpression(\n state.addHelper(version === \"2021-12\" ? \"applyDecs\" : \"applyDecs2203\"),\n args,\n );\n return t.assignmentExpression(\"=\", lhs, rhs);\n } else if (version === \"2022-03\") {\n rhs = t.callExpression(state.addHelper(\"applyDecs2203R\"), args);\n } else if (version === \"2023-01\") {\n if (maybePrivateBrandName) {\n args.push(createPrivateBrandCheckClosure(maybePrivateBrandName));\n }\n rhs = t.callExpression(state.addHelper(\"applyDecs2301\"), args);\n } else if (version === \"2023-05\") {\n if (\n maybePrivateBrandName ||\n superClass ||\n classDecorationsFlag.value !== 0\n ) {\n args.push(classDecorationsFlag);\n }\n if (maybePrivateBrandName) {\n args.push(createPrivateBrandCheckClosure(maybePrivateBrandName));\n } else if (superClass) {\n args.push(t.unaryExpression(\"void\", t.numericLiteral(0)));\n }\n if (superClass) args.push(superClass);\n rhs = t.callExpression(state.addHelper(\"applyDecs2305\"), args);\n }\n }\n if (process.env.BABEL_8_BREAKING || version === \"2023-11\") {\n if (\n maybePrivateBrandName ||\n superClass ||\n classDecorationsFlag.value !== 0\n ) {\n args.push(classDecorationsFlag);\n }\n if (maybePrivateBrandName) {\n args.push(createPrivateBrandCheckClosure(maybePrivateBrandName));\n } else if (superClass) {\n args.push(t.unaryExpression(\"void\", t.numericLiteral(0)));\n }\n if (superClass) args.push(superClass);\n rhs = t.callExpression(state.addHelper(\"applyDecs2311\"), args);\n }\n\n // optimize `{ c: [classLocals] } = applyDecsHelper(...)` to\n // `[classLocals] = applyDecsHelper(...).c`\n if (elementLocals.length > 0) {\n if (classLocals.length > 0) {\n lhs = t.objectPattern([\n t.objectProperty(t.identifier(\"e\"), t.arrayPattern(elementLocals)),\n t.objectProperty(t.identifier(\"c\"), t.arrayPattern(classLocals)),\n ]);\n } else {\n lhs = t.arrayPattern(elementLocals);\n rhs = t.memberExpression(rhs, t.identifier(\"e\"), false, false);\n }\n } else {\n // invariant: classLocals.length > 0\n lhs = t.arrayPattern(classLocals);\n rhs = t.memberExpression(rhs, t.identifier(\"c\"), false, false);\n }\n\n return t.assignmentExpression(\"=\", lhs, rhs);\n}\n\nfunction isProtoKey(\n node: t.Identifier | t.StringLiteral | t.BigIntLiteral | t.NumericLiteral,\n) {\n return node.type === \"Identifier\"\n ? node.name === \"__proto__\"\n : node.value === \"__proto__\";\n}\n\nfunction isDecorated(node: t.Class | ClassDecoratableElement) {\n return node.decorators && node.decorators.length > 0;\n}\n\nfunction shouldTransformElement(node: ClassElement) {\n switch (node.type) {\n case \"ClassAccessorProperty\":\n return true;\n case \"ClassMethod\":\n case \"ClassProperty\":\n case \"ClassPrivateMethod\":\n case \"ClassPrivateProperty\":\n return isDecorated(node);\n default:\n return false;\n }\n}\n\nfunction shouldTransformClass(node: t.Class) {\n return isDecorated(node) || node.body.body.some(shouldTransformElement);\n}\n\n// Todo: unify name references logic with helper-function-name\nfunction NamedEvaluationVisitoryFactory(\n isAnonymous: (path: NodePath) => boolean,\n visitor: (\n path: NodePath,\n state: PluginPass,\n name:\n | string\n | t.Identifier\n | t.StringLiteral\n | t.NumericLiteral\n | t.BigIntLiteral,\n ) => void,\n) {\n function handleComputedProperty(\n propertyPath: NodePath<\n t.ObjectProperty | t.ClassProperty | t.ClassAccessorProperty\n >,\n key: t.Expression,\n state: PluginPass,\n ): t.StringLiteral | t.Identifier {\n switch (key.type) {\n case \"StringLiteral\":\n return t.stringLiteral(key.value);\n case \"NumericLiteral\":\n case \"BigIntLiteral\": {\n const keyValue = key.value + \"\";\n propertyPath.get(\"key\").replaceWith(t.stringLiteral(keyValue));\n return t.stringLiteral(keyValue);\n }\n default: {\n const ref = propertyPath.scope.maybeGenerateMemoised(key);\n propertyPath\n .get(\"key\")\n .replaceWith(\n t.assignmentExpression(\n \"=\",\n ref,\n createToPropertyKeyCall(state, key),\n ),\n );\n return t.cloneNode(ref);\n }\n }\n }\n return {\n VariableDeclarator(path, state) {\n const id = path.node.id;\n if (id.type === \"Identifier\") {\n const initializer = skipTransparentExprWrappers(path.get(\"init\"));\n if (isAnonymous(initializer)) {\n const name = id.name;\n visitor(initializer, state, name);\n }\n }\n },\n AssignmentExpression(path, state) {\n const id = path.node.left;\n if (id.type === \"Identifier\") {\n const initializer = skipTransparentExprWrappers(path.get(\"right\"));\n if (isAnonymous(initializer)) {\n switch (path.node.operator) {\n case \"=\":\n case \"&&=\":\n case \"||=\":\n case \"??=\":\n visitor(initializer, state, id.name);\n }\n }\n }\n },\n AssignmentPattern(path, state) {\n const id = path.node.left;\n if (id.type === \"Identifier\") {\n const initializer = skipTransparentExprWrappers(path.get(\"right\"));\n if (isAnonymous(initializer)) {\n const name = id.name;\n visitor(initializer, state, name);\n }\n }\n },\n // We listen on ObjectExpression so that we don't have to visit\n // the object properties under object patterns\n ObjectExpression(path, state) {\n for (const propertyPath of path.get(\"properties\")) {\n if (!propertyPath.isObjectProperty()) continue;\n const { node } = propertyPath;\n const id = node.key;\n const initializer = skipTransparentExprWrappers(\n propertyPath.get(\"value\") as NodePath<t.Expression>,\n );\n if (isAnonymous(initializer)) {\n if (!node.computed) {\n // 13.2.5.5 RS: PropertyDefinitionEvaluation\n if (!isProtoKey(id as t.StringLiteral | t.Identifier)) {\n if (id.type === \"Identifier\") {\n visitor(initializer, state, id.name);\n } else {\n const className = t.stringLiteral(\n (id as t.StringLiteral | t.NumericLiteral | t.BigIntLiteral)\n .value + \"\",\n );\n visitor(initializer, state, className);\n }\n }\n } else {\n const ref = handleComputedProperty(\n propertyPath,\n // The key of a computed object property must not be a private name\n id as t.Expression,\n state,\n );\n visitor(initializer, state, ref);\n }\n }\n }\n },\n ClassPrivateProperty(path, state) {\n const { node } = path;\n const initializer = skipTransparentExprWrappers(path.get(\"value\"));\n if (isAnonymous(initializer)) {\n const className = t.stringLiteral(\"#\" + node.key.id.name);\n visitor(initializer, state, className);\n }\n },\n ClassAccessorProperty(path, state) {\n const { node } = path;\n const id = node.key;\n const initializer = skipTransparentExprWrappers(path.get(\"value\"));\n if (isAnonymous(initializer)) {\n if (!node.computed) {\n if (id.type === \"Identifier\") {\n visitor(initializer, state, id.name);\n } else if (id.type === \"PrivateName\") {\n const className = t.stringLiteral(\"#\" + id.id.name);\n visitor(initializer, state, className);\n } else {\n const className = t.stringLiteral(\n (id as t.StringLiteral | t.NumericLiteral | t.BigIntLiteral)\n .value + \"\",\n );\n visitor(initializer, state, className);\n }\n } else {\n const ref = handleComputedProperty(\n path,\n // The key of a computed accessor property must not be a private name\n id as t.Expression,\n state,\n );\n visitor(initializer, state, ref);\n }\n }\n },\n ClassProperty(path, state) {\n const { node } = path;\n const id = node.key;\n const initializer = skipTransparentExprWrappers(path.get(\"value\"));\n if (isAnonymous(initializer)) {\n if (!node.computed) {\n if (id.type === \"Identifier\") {\n visitor(initializer, state, id.name);\n } else {\n const className = t.stringLiteral(\n (id as t.StringLiteral | t.NumericLiteral | t.BigIntLiteral)\n .value + \"\",\n );\n visitor(initializer, state, className);\n }\n } else {\n const ref = handleComputedProperty(path, id, state);\n visitor(initializer, state, ref);\n }\n }\n },\n } satisfies Visitor<PluginPass>;\n}\n\nfunction isDecoratedAnonymousClassExpression(path: NodePath) {\n return (\n path.isClassExpression({ id: null }) && shouldTransformClass(path.node)\n );\n}\n\nfunction generateLetUidIdentifier(scope: Scope, name: string) {\n const id = scope.generateUidIdentifier(name);\n scope.push({ id, kind: \"let\" });\n return t.cloneNode(id);\n}\n\nexport default function (\n { assertVersion, assumption }: PluginAPI,\n { loose }: Options,\n version: DecoratorVersionKind,\n inherits: PluginObject[\"inherits\"],\n): PluginObject {\n if (process.env.BABEL_8_BREAKING) {\n assertVersion(REQUIRED_VERSION(\"^7.21.0\"));\n } else {\n if (\n version === \"2023-11\" ||\n version === \"2023-05\" ||\n version === \"2023-01\"\n ) {\n assertVersion(REQUIRED_VERSION(\"^7.21.0\"));\n } else if (version === \"2021-12\") {\n assertVersion(REQUIRED_VERSION(\"^7.16.0\"));\n } else {\n assertVersion(REQUIRED_VERSION(\"^7.19.0\"));\n }\n }\n\n const VISITED = new WeakSet<NodePath>();\n const constantSuper = assumption(\"constantSuper\") ?? loose;\n const ignoreFunctionLength = assumption(\"ignoreFunctionLength\") ?? loose;\n\n const namedEvaluationVisitor: Visitor<PluginPass> =\n NamedEvaluationVisitoryFactory(\n isDecoratedAnonymousClassExpression,\n visitClass,\n );\n\n function visitClass(\n path: NodePath<t.Class>,\n state: PluginPass,\n className: string | t.Identifier | t.StringLiteral | undefined,\n ) {\n if (VISITED.has(path)) return;\n const { node } = path;\n className ??= node.id?.name;\n const newPath = transformClass(\n path,\n state,\n constantSuper,\n ignoreFunctionLength,\n className,\n namedEvaluationVisitor,\n version,\n );\n if (newPath) {\n VISITED.add(newPath);\n return;\n }\n VISITED.add(path);\n }\n\n return {\n name: \"proposal-decorators\",\n inherits: inherits,\n\n visitor: {\n ExportDefaultDeclaration(path, state) {\n const { declaration } = path.node;\n if (\n declaration?.type === \"ClassDeclaration\" &&\n // When compiling class decorators we need to replace the class\n // binding, so we must split it in two separate declarations.\n isDecorated(declaration)\n ) {\n const isAnonymous = !declaration.id;\n const updatedVarDeclarationPath = splitExportDeclaration(\n path,\n ) as unknown as NodePath<t.ClassDeclaration>;\n if (isAnonymous) {\n visitClass(\n updatedVarDeclarationPath,\n state,\n t.stringLiteral(\"default\"),\n );\n }\n }\n },\n ExportNamedDeclaration(path) {\n const { declaration } = path.node;\n if (\n declaration?.type === \"ClassDeclaration\" &&\n // When compiling class decorators we need to replace the class\n // binding, so we must split it in two separate declarations.\n isDecorated(declaration)\n ) {\n splitExportDeclaration(path);\n }\n },\n\n Class(path, state) {\n visitClass(path, state, undefined);\n },\n\n ...namedEvaluationVisitor,\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,6BAAA,GAAAF,OAAA;AAGA,IAAAG,wCAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAIA,IAAAK,KAAA,GAAAL,OAAA;AAiCA,SAASM,WAAWA,CAACC,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;UACH;QACF;MACF,CAAC;MACDyL,sBAAsBA,CAAC3X,IAAI,EAAE;QAC3B,MAAM;UAAEwX;QAAY,CAAC,GAAGxX,IAAI,CAACE,IAAI;QACjC,IACE,CAAAsX,WAAW,oBAAXA,WAAW,CAAExW,IAAI,MAAK,kBAAkB,IAGxC0N,WAAW,CAAC8I,WAAW,CAAC,EACxB;UACA,IAAAE,qCAAsB,EAAC1X,IAAI,CAAC;QAC9B;MACF,CAAC;MAED4X,KAAKA,CAAC5X,IAAI,EAAEqL,KAAK,EAAE;QACjB6L,UAAU,CAAClX,IAAI,EAAEqL,KAAK,EAAEhJ,SAAS,CAAC;MACpC;IAAC,GAEE4U,sBAAsB;EAE7B,CAAC;AACH","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/helper-create-class-features-plugin/lib/features.js b/node_modules/@babel/helper-create-class-features-plugin/lib/features.js index a4ad9ff8..5cc919c6 100644 --- a/node_modules/@babel/helper-create-class-features-plugin/lib/features.js +++ b/node_modules/@babel/helper-create-class-features-plugin/lib/features.js @@ -47,7 +47,7 @@ function enableFeature(file, feature, loose) { } const loose = isLoose(file, mask); if (resolvedLoose === !loose) { - throw new Error("'loose' mode configuration must be the same for @babel/plugin-transform-class-properties, " + "@babel/plugin-transform-private-methods and " + "@babel/plugin-transform-private-property-in-object (when they are enabled)."); + throw new Error("'loose' mode configuration must be the same for @babel/plugin-transform-class-properties, " + "@babel/plugin-transform-private-methods and " + "@babel/plugin-transform-private-property-in-object (when they are enabled)." + "\n\n" + getBabelShowConfigForHint(file)); } else { resolvedLoose = loose; { @@ -59,11 +59,26 @@ function enableFeature(file, feature, loose) { for (const [mask, name] of featuresSameLoose) { if (hasFeature(file, mask) && isLoose(file, mask) !== resolvedLoose) { setLoose(file, mask, resolvedLoose); - console.warn(`Though the "loose" option was set to "${!resolvedLoose}" in your @babel/preset-env ` + `config, it will not be used for ${name} since the "loose" mode option was set to ` + `"${resolvedLoose}" for ${higherPriorityPluginName}.\nThe "loose" option must be the ` + `same for @babel/plugin-transform-class-properties, @babel/plugin-transform-private-methods ` + `and @babel/plugin-transform-private-property-in-object (when they are enabled): you can ` + `silence this warning by explicitly adding\n` + `\t["${name}", { "loose": ${resolvedLoose} }]\n` + `to the "plugins" section of your Babel config.`); + console.warn(`Though the "loose" option was set to "${!resolvedLoose}" in your @babel/preset-env ` + `config, it will not be used for ${name} since the "loose" mode option was set to ` + `"${resolvedLoose}" for ${higherPriorityPluginName}.\nThe "loose" option must be the ` + `same for @babel/plugin-transform-class-properties, @babel/plugin-transform-private-methods ` + `and @babel/plugin-transform-private-property-in-object (when they are enabled): you can ` + `silence this warning by explicitly adding\n` + `\t["${name}", { "loose": ${resolvedLoose} }]\n` + `to the "plugins" section of your Babel config.` + "\n\n" + getBabelShowConfigForHint(file)); } } } } +function getBabelShowConfigForHint(file) { + let { + filename + } = file.opts; + if (!filename || filename === "unknown") { + filename = "[name of the input file]"; + } + return `\ +If you already set the same 'loose' mode for these plugins in your config, it's possible that they \ +are enabled multiple times with different options. +You can re-run Babel with the BABEL_SHOW_CONFIG_FOR environment variable to show the loaded \ +configuration: +\tnpx cross-env BABEL_SHOW_CONFIG_FOR=${filename} <your build command> +See https://babeljs.io/docs/configuration#print-effective-configs for more info.`; +} function hasFeature(file, feature) { return !!(file.get(featuresKey) & feature); } diff --git a/node_modules/@babel/helper-create-class-features-plugin/lib/features.js.map b/node_modules/@babel/helper-create-class-features-plugin/lib/features.js.map index 00384e70..71b6986e 100644 --- a/node_modules/@babel/helper-create-class-features-plugin/lib/features.js.map +++ b/node_modules/@babel/helper-create-class-features-plugin/lib/features.js.map @@ -1 +1 @@ -{"version":3,"names":["_decorators","require","FEATURES","exports","Object","freeze","fields","privateMethods","decorators","privateIn","staticBlocks","featuresSameLoose","Map","featuresKey","looseKey","looseLowPriorityKey","canIgnoreLoose","file","feature","get","enableFeature","loose","hasFeature","set","setLoose","resolvedLoose","mask","name","isLoose","Error","higherPriorityPluginName","undefined","console","warn","shouldTransform","path","decoratorPath","publicFieldPath","privateFieldPath","privateMethodPath","staticBlockPath","hasOwnDecorators","node","el","isClassProperty","isClassPrivateProperty","isClassPrivateMethod","isStaticBlock","buildCodeFrameError"],"sources":["../src/features.ts"],"sourcesContent":["import type { File, types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport { hasOwnDecorators } from \"./decorators-2018-09.ts\";\n\nexport const FEATURES = Object.freeze({\n //classes: 1 << 0,\n fields: 1 << 1,\n privateMethods: 1 << 2,\n decorators: 1 << 3,\n privateIn: 1 << 4,\n staticBlocks: 1 << 5,\n});\n\nconst featuresSameLoose = new Map([\n [FEATURES.fields, \"@babel/plugin-transform-class-properties\"],\n [FEATURES.privateMethods, \"@babel/plugin-transform-private-methods\"],\n [FEATURES.privateIn, \"@babel/plugin-transform-private-property-in-object\"],\n]);\n\n// We can't use a symbol because this needs to always be the same, even if\n// this package isn't deduped by npm. e.g.\n// - node_modules/\n// - @babel/plugin-class-features\n// - @babel/plugin-proposal-decorators\n// - node_modules\n// - @babel-plugin-class-features\nconst featuresKey = \"@babel/plugin-class-features/featuresKey\";\nconst looseKey = \"@babel/plugin-class-features/looseKey\";\n\nif (!process.env.BABEL_8_BREAKING) {\n // See https://github.com/babel/babel/issues/11622.\n // Since preset-env sets loose for the fields and private methods plugins, it can\n // cause conflicts with the loose mode set by an explicit plugin in the config.\n // To solve this problem, we ignore preset-env's loose mode if another plugin\n // explicitly sets it\n // The code to handle this logic doesn't check that \"low priority loose\" is always\n // the same. However, it is only set by the preset and not directly by users:\n // unless someone _wants_ to break it, it shouldn't be a problem.\n // eslint-disable-next-line no-var\n var looseLowPriorityKey =\n \"@babel/plugin-class-features/looseLowPriorityKey/#__internal__@babel/preset-env__please-overwrite-loose-instead-of-throwing\";\n}\n\nif (!process.env.BABEL_8_BREAKING) {\n // eslint-disable-next-line no-var\n var canIgnoreLoose = function (file: File, feature: number) {\n return !!(file.get(looseLowPriorityKey) & feature);\n };\n}\n\nexport function enableFeature(file: File, feature: number, loose: boolean) {\n // We can't blindly enable the feature because, if it was already set,\n // \"loose\" can't be changed, so that\n // @babel/plugin-class-properties { loose: true }\n // @babel/plugin-class-properties { loose: false }\n // is transformed in loose mode.\n // We only enabled the feature if it was previously disabled.\n if (process.env.BABEL_8_BREAKING) {\n if (!hasFeature(file, feature)) {\n file.set(featuresKey, file.get(featuresKey) | feature);\n setLoose(file, feature, loose);\n }\n } else if (!hasFeature(file, feature) || canIgnoreLoose(file, feature)) {\n file.set(featuresKey, file.get(featuresKey) | feature);\n if (\n // @ts-expect-error comparing loose with internal private magic string\n loose ===\n \"#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error\"\n ) {\n setLoose(file, feature, true);\n file.set(looseLowPriorityKey, file.get(looseLowPriorityKey) | feature);\n } else if (\n // @ts-expect-error comparing loose with internal private magic string\n loose ===\n \"#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error\"\n ) {\n setLoose(file, feature, false);\n file.set(looseLowPriorityKey, file.get(looseLowPriorityKey) | feature);\n } else {\n setLoose(file, feature, loose);\n }\n }\n\n let resolvedLoose: boolean | undefined;\n for (const [mask, name] of featuresSameLoose) {\n if (!hasFeature(file, mask)) continue;\n if (!process.env.BABEL_8_BREAKING) {\n if (canIgnoreLoose(file, mask)) continue;\n }\n\n const loose = isLoose(file, mask);\n\n if (resolvedLoose === !loose) {\n throw new Error(\n \"'loose' mode configuration must be the same for @babel/plugin-transform-class-properties, \" +\n \"@babel/plugin-transform-private-methods and \" +\n \"@babel/plugin-transform-private-property-in-object (when they are enabled).\",\n );\n } else {\n resolvedLoose = loose;\n\n if (!process.env.BABEL_8_BREAKING) {\n // eslint-disable-next-line no-var\n var higherPriorityPluginName = name;\n }\n }\n }\n\n if (!process.env.BABEL_8_BREAKING && resolvedLoose !== undefined) {\n for (const [mask, name] of featuresSameLoose) {\n if (hasFeature(file, mask) && isLoose(file, mask) !== resolvedLoose) {\n setLoose(file, mask, resolvedLoose);\n console.warn(\n `Though the \"loose\" option was set to \"${!resolvedLoose}\" in your @babel/preset-env ` +\n `config, it will not be used for ${name} since the \"loose\" mode option was set to ` +\n `\"${resolvedLoose}\" for ${higherPriorityPluginName}.\\nThe \"loose\" option must be the ` +\n `same for @babel/plugin-transform-class-properties, @babel/plugin-transform-private-methods ` +\n `and @babel/plugin-transform-private-property-in-object (when they are enabled): you can ` +\n `silence this warning by explicitly adding\\n` +\n `\\t[\"${name}\", { \"loose\": ${resolvedLoose} }]\\n` +\n `to the \"plugins\" section of your Babel config.`,\n );\n }\n }\n }\n}\n\nfunction hasFeature(file: File, feature: number) {\n return !!(file.get(featuresKey) & feature);\n}\n\nexport function isLoose(file: File, feature: number) {\n return !!(file.get(looseKey) & feature);\n}\n\nfunction setLoose(file: File, feature: number, loose: boolean) {\n if (loose) file.set(looseKey, file.get(looseKey) | feature);\n else file.set(looseKey, file.get(looseKey) & ~feature);\n\n if (!process.env.BABEL_8_BREAKING) {\n file.set(looseLowPriorityKey, file.get(looseLowPriorityKey) & ~feature);\n }\n}\n\nexport function shouldTransform(path: NodePath<t.Class>, file: File): boolean {\n let decoratorPath: NodePath<t.Decorator> | null = null;\n let publicFieldPath: NodePath<t.ClassProperty> | null = null;\n let privateFieldPath: NodePath<t.ClassPrivateProperty> | null = null;\n let privateMethodPath: NodePath<t.ClassPrivateMethod> | null = null;\n let staticBlockPath: NodePath<t.StaticBlock> | null = null;\n\n if (hasOwnDecorators(path.node)) {\n decoratorPath = path.get(\"decorators.0\");\n }\n for (const el of path.get(\"body.body\")) {\n if (!decoratorPath && hasOwnDecorators(el.node)) {\n decoratorPath = el.get(\"decorators.0\");\n }\n if (!publicFieldPath && el.isClassProperty()) {\n publicFieldPath = el;\n }\n if (!privateFieldPath && el.isClassPrivateProperty()) {\n privateFieldPath = el;\n }\n // NOTE: path.isClassPrivateMethod() it isn't supported in <7.2.0\n if (!privateMethodPath && el.isClassPrivateMethod?.()) {\n privateMethodPath = el;\n }\n if (!staticBlockPath && el.isStaticBlock?.()) {\n staticBlockPath = el;\n }\n }\n\n if (decoratorPath && privateFieldPath) {\n throw privateFieldPath.buildCodeFrameError(\n \"Private fields in decorated classes are not supported yet.\",\n );\n }\n if (decoratorPath && privateMethodPath) {\n throw privateMethodPath.buildCodeFrameError(\n \"Private methods in decorated classes are not supported yet.\",\n );\n }\n\n if (decoratorPath && !hasFeature(file, FEATURES.decorators)) {\n throw path.buildCodeFrameError(\n \"Decorators are not enabled.\" +\n \"\\nIf you are using \" +\n '[\"@babel/plugin-proposal-decorators\", { \"version\": \"legacy\" }], ' +\n 'make sure it comes *before* \"@babel/plugin-transform-class-properties\" ' +\n \"and enable loose mode, like so:\\n\" +\n '\\t[\"@babel/plugin-proposal-decorators\", { \"version\": \"legacy\" }]\\n' +\n '\\t[\"@babel/plugin-transform-class-properties\", { \"loose\": true }]',\n );\n }\n\n if (privateMethodPath && !hasFeature(file, FEATURES.privateMethods)) {\n throw privateMethodPath.buildCodeFrameError(\n \"Class private methods are not enabled. \" +\n \"Please add `@babel/plugin-transform-private-methods` to your configuration.\",\n );\n }\n\n if (\n (publicFieldPath || privateFieldPath) &&\n !hasFeature(file, FEATURES.fields) &&\n // We want to allow enabling the private-methods plugin even without enabling\n // the class-properties plugin. Class fields will still be compiled in classes\n // that contain private methods.\n // This is already allowed with the other various class features plugins, but\n // it's because they can fallback to a transform separated from this helper.\n !hasFeature(file, FEATURES.privateMethods)\n ) {\n throw path.buildCodeFrameError(\n \"Class fields are not enabled. \" +\n \"Please add `@babel/plugin-transform-class-properties` to your configuration.\",\n );\n }\n\n if (staticBlockPath && !hasFeature(file, FEATURES.staticBlocks)) {\n throw path.buildCodeFrameError(\n \"Static class blocks are not enabled. \" +\n \"Please add `@babel/plugin-transform-class-static-block` to your configuration.\",\n );\n }\n\n if (decoratorPath || privateMethodPath || staticBlockPath) {\n // If one of those feature is used we know that its transform is\n // enabled, otherwise the previous checks throw.\n return true;\n }\n if (\n (publicFieldPath || privateFieldP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I,CAACjB,UAAU,CAACL,IAAI,EAAEf,QAAQ,CAACK,cAAc,CAAC,EAAE;IACnE,MAAMgC,iBAAiB,CAACS,mBAAmB,CACzC,yCAAyC,GACvC,6EACJ,CAAC;EACH;EAEA,IACE,CAACX,eAAe,IAAIC,gBAAgB,KACpC,CAAChB,UAAU,CAACL,IAAI,EAAEf,QAAQ,CAACI,MAAM,CAAC,IAMlC,CAACgB,UAAU,CAACL,IAAI,EAAEf,QAAQ,CAACK,cAAc,CAAC,EAC1C;IACA,MAAM4B,IAAI,CAACa,mBAAmB,CAC5B,gCAAgC,GAC9B,8EACJ,CAAC;EACH;EAEA,IAAIR,eAAe,IAAI,CAAClB,UAAU,CAACL,IAAI,EAAEf,QAAQ,CAACQ,YAAY,CAAC,EAAE;IAC/D,MAAMyB,IAAI,CAACa,mBAAmB,CAC5B,uCAAuC,GACrC,gFACJ,CAAC;EACH;EAEA,IAAIZ,aAAa,IAAIG,iBAAiB,IAAIC,eAAe,EAAE;IAGzD,OAAO,IAAI;EACb;EACA,IACE,CAACH,eAAe,IAAIC,gBAAgB,KACpChB,UAAU,CAACL,IAAI,EAAEf,QAAQ,CAACI,MAAM,CAAC,EACjC;IACA,OAAO,IAAI;EACb;EAEA,OAAO,KAAK;AACd"}
\ No newline at end of file +{"version":3,"names":["_decorators","require","FEATURES","exports","Object","freeze","fields","privateMethods","decorators","privateIn","staticBlocks","featuresSameLoose","Map","featuresKey","looseKey","looseLowPriorityKey","canIgnoreLoose","file","feature","get","enableFeature","loose","hasFeature","set","setLoose","resolvedLoose","mask","name","isLoose","Error","getBabelShowConfigForHint","higherPriorityPluginName","undefined","console","warn","filename","opts","shouldTransform","path","decoratorPath","publicFieldPath","privateFieldPath","privateMethodPath","staticBlockPath","hasOwnDecorators","node","el","isClassProperty","isClassPrivateProperty","isClassPrivateMethod","isStaticBlock","buildCodeFrameError"],"sources":["../src/features.ts"],"sourcesContent":["import type { File, types as t } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport { hasOwnDecorators } from \"./decorators-2018-09.ts\";\n\nexport const FEATURES = Object.freeze({\n //classes: 1 << 0,\n fields: 1 << 1,\n privateMethods: 1 << 2,\n decorators: 1 << 3,\n privateIn: 1 << 4,\n staticBlocks: 1 << 5,\n});\n\nconst featuresSameLoose = new Map([\n [FEATURES.fields, \"@babel/plugin-transform-class-properties\"],\n [FEATURES.privateMethods, \"@babel/plugin-transform-private-methods\"],\n [FEATURES.privateIn, \"@babel/plugin-transform-private-property-in-object\"],\n]);\n\n// We can't use a symbol because this needs to always be the same, even if\n// this package isn't deduped by npm. e.g.\n// - node_modules/\n// - @babel/plugin-class-features\n// - @babel/plugin-proposal-decorators\n// - node_modules\n// - @babel-plugin-class-features\nconst featuresKey = \"@babel/plugin-class-features/featuresKey\";\nconst looseKey = \"@babel/plugin-class-features/looseKey\";\n\nif (!process.env.BABEL_8_BREAKING) {\n // See https://github.com/babel/babel/issues/11622.\n // Since preset-env sets loose for the fields and private methods plugins, it can\n // cause conflicts with the loose mode set by an explicit plugin in the config.\n // To solve this problem, we ignore preset-env's loose mode if another plugin\n // explicitly sets it\n // The code to handle this logic doesn't check that \"low priority loose\" is always\n // the same. However, it is only set by the preset and not directly by users:\n // unless someone _wants_ to break it, it shouldn't be a problem.\n // eslint-disable-next-line no-var\n var looseLowPriorityKey =\n \"@babel/plugin-class-features/looseLowPriorityKey/#__internal__@babel/preset-env__please-overwrite-loose-instead-of-throwing\";\n}\n\nif (!process.env.BABEL_8_BREAKING) {\n // eslint-disable-next-line no-var\n var canIgnoreLoose = function (file: File, feature: number) {\n return !!(file.get(looseLowPriorityKey) & feature);\n };\n}\n\nexport function enableFeature(file: File, feature: number, loose: boolean) {\n // We can't blindly enable the feature because, if it was already set,\n // \"loose\" can't be changed, so that\n // @babel/plugin-class-properties { loose: true }\n // @babel/plugin-class-properties { loose: false }\n // is transformed in loose mode.\n // We only enabled the feature if it was previously disabled.\n if (process.env.BABEL_8_BREAKING) {\n if (!hasFeature(file, feature)) {\n file.set(featuresKey, file.get(featuresKey) | feature);\n setLoose(file, feature, loose);\n }\n } else if (!hasFeature(file, feature) || canIgnoreLoose(file, feature)) {\n file.set(featuresKey, file.get(featuresKey) | feature);\n if (\n // @ts-expect-error comparing loose with internal private magic string\n loose ===\n \"#__internal__@babel/preset-env__prefer-true-but-false-is-ok-if-it-prevents-an-error\"\n ) {\n setLoose(file, feature, true);\n file.set(looseLowPriorityKey, file.get(looseLowPriorityKey) | feature);\n } else if (\n // @ts-expect-error comparing loose with internal private magic string\n loose ===\n \"#__internal__@babel/preset-env__prefer-false-but-true-is-ok-if-it-prevents-an-error\"\n ) {\n setLoose(file, feature, false);\n file.set(looseLowPriorityKey, file.get(looseLowPriorityKey) | feature);\n } else {\n setLoose(file, feature, loose);\n }\n }\n\n let resolvedLoose: boolean | undefined;\n for (const [mask, name] of featuresSameLoose) {\n if (!hasFeature(file, mask)) continue;\n if (!process.env.BABEL_8_BREAKING) {\n if (canIgnoreLoose(file, mask)) continue;\n }\n\n const loose = isLoose(file, mask);\n\n if (resolvedLoose === !loose) {\n throw new Error(\n \"'loose' mode configuration must be the same for @babel/plugin-transform-class-properties, \" +\n \"@babel/plugin-transform-private-methods and \" +\n \"@babel/plugin-transform-private-property-in-object (when they are enabled).\" +\n \"\\n\\n\" +\n getBabelShowConfigForHint(file),\n );\n } else {\n resolvedLoose = loose;\n\n if (!process.env.BABEL_8_BREAKING) {\n // eslint-disable-next-line no-var\n var higherPriorityPluginName = name;\n }\n }\n }\n\n if (!process.env.BABEL_8_BREAKING && resolvedLoose !== undefined) {\n for (const [mask, name] of featuresSameLoose) {\n if (hasFeature(file, mask) && isLoose(file, mask) !== resolvedLoose) {\n setLoose(file, mask, resolvedLoose);\n console.warn(\n `Though the \"loose\" option was set to \"${!resolvedLoose}\" in your @babel/preset-env ` +\n `config, it will not be used for ${name} since the \"loose\" mode option was set to ` +\n `\"${resolvedLoose}\" for ${higherPriorityPluginName}.\\nThe \"loose\" option must be the ` +\n `same for @babel/plugin-transform-class-properties, @babel/plugin-transform-private-methods ` +\n `and @babel/plugin-transform-private-property-in-object (when they are enabled): you can ` +\n `silence this warning by explicitly adding\\n` +\n `\\t[\"${name}\", { \"loose\": ${resolvedLoose} }]\\n` +\n `to the \"plugins\" section of your Babel config.` +\n \"\\n\\n\" +\n getBabelShowConfigForHint(file),\n );\n }\n }\n }\n}\n\nfunction getBabelShowConfigForHint(file: File) {\n let { filename } = file.opts;\n if (!filename || filename === \"unknown\") {\n filename = \"[name of the input file]\";\n }\n return `\\\nIf you already set the same 'loose' mode for these plugins in your config, it's possible that they \\\nare enabled multiple times with different options.\nYou can re-run Babel with the BABEL_SHOW_CONFIG_FOR environment variable to show the loaded \\\nconfiguration:\n\\tnpx cross-env BABEL_SHOW_CONFIG_FOR=${filename} <your build command>\nSee https://babeljs.io/docs/configuration#print-effective-configs for more info.`;\n}\n\nfunction hasFeature(file: File, feature: number) {\n return !!(file.get(featuresKey) & feature);\n}\n\nexport function isLoose(file: File, feature: number) {\n return !!(file.get(looseKey) & feature);\n}\n\nfunction setLoose(file: File, feature: number, loose: boolean) {\n if (loose) file.set(looseKey, file.get(looseKey) | feature);\n else file.set(looseKey, file.get(looseKey) & ~feature);\n\n if (!process.env.BABEL_8_BREAKING) {\n file.set(looseLowPriorityKey, file.get(looseLowPriorityKey) & ~feature);\n }\n}\n\nexport function shouldTransform(path: NodePath<t.Class>, file: File): boolean {\n let decoratorPath: NodePath<t.Decorator> | null = null;\n let publicFieldPath: NodePath<t.ClassProperty> | null = null;\n let privateFieldPath: NodePath<t.ClassPrivateProperty> | null = null;\n let privateMethodPath: NodePath<t.ClassPrivateMethod> | null = null;\n let staticBlockPath: NodePath<t.StaticBlock> | null = null;\n\n if (hasOwnDecorators(path.node)) {\n decoratorPath = path.get(\"decorators.0\");\n }\n for (const el of path.get(\"body.body\")) {\n if (!decoratorPath && hasOwnDecorators(el.node)) {\n decoratorPath = el.get(\"decorators.0\");\n }\n if (!publicFieldPath && el.isClassProperty()) {\n publicFieldPath = el;\n }\n if (!privateFieldPath && el.isClassPrivateProperty()) {\n privateFieldPath = el;\n }\n // NOTE: path.isClassPrivateMethod() it isn't supported in <7.2.0\n if (!privateMethodPath && el.isClassPrivateMethod?.()) {\n privateMethodPath = el;\n }\n if (!staticBlockPath && el.isStaticBlock?.()) {\n staticBlockPath = el;\n }\n }\n\n if (decoratorPath && privateFieldPath) {\n throw privateFieldPath.buildCodeFrameError(\n \"Private fields in decorated classes are not supported yet.\",\n );\n }\n if (decoratorPath && privateMethodPath) {\n throw privateMethodPath.buildCodeFrameError(\n \"Private methods in decorated classes are not supported yet.\",\n );\n }\n\n if (decoratorPath && !hasFeature(file, FEATURES.decorators)) {\n throw path.buildCodeFrameError(\n \"Decorators are not enabled.\" +\n \"\\nIf you are using \" +\n '[\"@babel/plugin-proposal-decorators\", { \"version\": \"legacy\" }], ' +\n 'make sure it comes *before* \"@babel/plugin-transform-class-properties\" ' +\n \"and enable loose mode, like so:\\n\" +\n '\\t[\"@babel/plugin-proposal-decorators\", { \"version\": \"legacy\" }]\\n' +\n '\\t[\"@babel/plugin-transform-class-properties\", { \"loose\": true }]',\n );\n }\n\n if (privateMethodPath && !hasFeature(file, FEATURES.privateMethods)) {\n throw privateMethodPath.buildCodeFrameError(\n \"Class private methods are not enabled. \" +\n \"Please add `@babel/plugin-transform-private-methods` to your configuration.\",\n );\n }\n\n if (\n (publicFieldPath || privateFieldPath) &&\n !hasFeature(file, FEATURES.fields) &&\n // We want to allow enabling the private-methods plugin even without enabling\n // the class-properties plugin. Class fields will still be compiled in classes\n // that contain private methods.\n // This is already allowed with the other various class features plugins, but\n // it's because they can fallback to a transform separated from this helper.\n !hasFeature(file, FEATURES.privateMethods)\n ) {\n throw path.buildCodeFrameError(\n \"Class fields are not enabled. \" +\n \"Please add `@babel/plugin-transform-class-properties` to your configuration.\",\n );\n }\n\n if (staticBlockPath && !hasFeature(file, FEATURES.staticBlocks)) {\n throw path.buildCodeFrameError(\n \"Static class blocks are not enabled. \" +\n \"Please add `@babel/plugin-transform-class-static-block` to your configuration.\",\n );\n }\n\n if (decoratorPath || privateMethodPath || staticBlockPath) {\n // If one of those feature is used we know that its transform is\n // enabled, otherwise the previous checks throw.\n return true;\n }\n if (\n (publicFieldPath || privateFieldPath) &&\n hasFeature(file, FEATURES.fields)\n ) {\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;AAEA,IAAAA,WAAA,GAAAC,OAAA;AAEO,MAAMC,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAGE,MAAM,CAACC,MAAM,CAAC;EAEpCC,MAAM,EAAE,CAAC,IAAI,CAAC;EACdC,cAAc,EAAE,CAAC,IAAI,CAAC;EACtBC,UAAU,EAAE,CAAC,IAAI,CAAC;EAClBC,SAAS,EAAE,CAAC,IAAI,CAAC;EACjBC,YAAY,EAAE,CAAC,IAAI;AACrB,CAAC,CAAC;AAEF,MAAMC,iBAAiB,GAAG,IAAIC,GAAG,CAAC,CAChC,CAACV,QAAQ,CAACI,MAAM,EAAE,0CAA0C,CAAC,EAC7D,CAACJ,QAAQ,CAACK,cAAc,EAAE,yCAAyC,CAAC,EACpE,CAACL,QAAQ,CAACO,SAAS,EAAE,oDAAoD,CAAC,CAC3E,CAAC;AASF,MAAMI,WAAW,GAAG,0CAA0C;AAC9D,MAAMC,QAAQ,GAAG,uCAAuC;AAErB;EAUjC,IAAIC,mBAAmB,GACrB,6HAA6H;AACjI;AAEmC;EAEjC,IAAIC,cAAc,GAAG,SAAAA,CAAUC,IAAU,EAAEC,OAAe,EAAE;IAC1D,OAAO,CAAC,EAAED,IAAI,CAACE,GAAG,CAACJ,mBAAmB,CAAC,GAAGG,OAAO,CAAC;EACpD,CAAC;AACH;AAEO,SAASE,aAAaA,CAACH,IAAU,EAAEC,OAAe,EAAEG,KAAc,EAAE;EAYlE,IAAI,CAACC,UAAU,CAACL,IAAI,EAAEC,OAAO,CAAC,IAAIF,cAAc,CAACC,IAAI,EAAE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nB,UAAU,CAACL,IAAI,EAAEf,QAAQ,CAACI,MAAM,CAAC,EACjC;IACA,OAAO,IAAI;EACb;EAEA,OAAO,KAAK;AACd","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/helper-create-class-features-plugin/lib/fields.js b/node_modules/@babel/helper-create-class-features-plugin/lib/fields.js index 981cf0b3..66022633 100644 --- a/node_modules/@babel/helper-create-class-features-plugin/lib/fields.js +++ b/node_modules/@babel/helper-create-class-features-plugin/lib/fields.js @@ -7,6 +7,7 @@ exports.buildCheckInRHS = buildCheckInRHS; exports.buildFieldsInitNodes = buildFieldsInitNodes; exports.buildPrivateNamesMap = buildPrivateNamesMap; exports.buildPrivateNamesNodes = buildPrivateNamesNodes; +exports.privateNameVisitorFactory = privateNameVisitorFactory; exports.transformPrivateNamesUsage = transformPrivateNamesUsage; var _core = require("@babel/core"); var _helperReplaceSupers = require("@babel/helper-replace-supers"); @@ -16,23 +17,70 @@ var _helperOptimiseCallExpression = require("@babel/helper-optimise-call-express var _helperAnnotateAsPure = require("@babel/helper-annotate-as-pure"); var _helperSkipTransparentExpressionWrappers = require("@babel/helper-skip-transparent-expression-wrappers"); var ts = require("./typescript.js"); -function buildPrivateNamesMap(props) { +{ + var newHelpers = file => { + ; + return file.availableHelper("classPrivateFieldGet2"); + }; +} +function buildPrivateNamesMap(className, privateFieldsAsSymbolsOrProperties, props, file) { const privateNamesMap = new Map(); + let classBrandId; for (const prop of props) { if (prop.isPrivate()) { const { name } = prop.node.key.id; - const update = privateNamesMap.has(name) ? privateNamesMap.get(name) : { - id: prop.scope.generateUidIdentifier(name), - static: prop.node.static, - method: !prop.isProperty() - }; + let update = privateNamesMap.get(name); + if (!update) { + const isMethod = !prop.isProperty(); + const isStatic = prop.node.static; + let initAdded = false; + let id; + if (!privateFieldsAsSymbolsOrProperties && newHelpers(file) && isMethod && !isStatic) { + var _classBrandId; + initAdded = !!classBrandId; + (_classBrandId = classBrandId) != null ? _classBrandId : classBrandId = prop.scope.generateUidIdentifier(`${className}_brand`); + id = classBrandId; + } else { + id = prop.scope.generateUidIdentifier(name); + } + update = { + id, + static: isStatic, + method: isMethod, + initAdded + }; + privateNamesMap.set(name, update); + } if (prop.isClassPrivateMethod()) { if (prop.node.kind === "get") { - update.getId = prop.scope.generateUidIdentifier(`get_${name}`); + const { + body + } = prop.node.body; + let $; + if (body.length === 1 && _core.types.isReturnStatement($ = body[0]) && _core.types.isCallExpression($ = $.argument) && $.arguments.length === 1 && _core.types.isThisExpression($.arguments[0]) && _core.types.isIdentifier($ = $.callee)) { + update.getId = _core.types.cloneNode($); + update.getterDeclared = true; + } else { + update.getId = prop.scope.generateUidIdentifier(`get_${name}`); + } } else if (prop.node.kind === "set") { - update.setId = prop.scope.generateUidIdentifier(`set_${name}`); + const { + params + } = prop.node; + const { + body + } = prop.node.body; + let $; + if (body.length === 1 && _core.types.isExpressionStatement($ = body[0]) && _core.types.isCallExpression($ = $.expression) && $.arguments.length === 2 && _core.types.isThisExpression($.arguments[0]) && _core.types.isIdentifier($.arguments[1], { + name: params[0].name + }) && _core.types.isIdentifier($ = $.callee)) { + update.setId = _core.types.cloneNode($); + update.setterDeclared = true; + } else { + update.setId = prop.scope.generateUidIdentifier(`set_${name}`); + } } else if (prop.node.kind === "method") { update.methodId = prop.scope.generateUidIdentifier(name); } @@ -44,6 +92,7 @@ function buildPrivateNamesMap(props) { } function buildPrivateNamesNodes(privateNamesMap, privateFieldsAsProperties, privateFieldsAsSymbols, state) { const initNodes = []; + const injectedIds = new Set(); for (const [name, value] of privateNamesMap) { const { static: isStatic, @@ -51,7 +100,7 @@ function buildPrivateNamesNodes(privateNamesMap, privateFieldsAsProperties, priv getId, setId } = value; - const isAccessor = getId || setId; + const isGetterOrSetter = getId || setId; const id = _core.types.cloneNode(value.id); let init; if (privateFieldsAsProperties) { @@ -59,10 +108,14 @@ function buildPrivateNamesNodes(privateNamesMap, privateFieldsAsProperties, priv } else if (privateFieldsAsSymbols) { init = _core.types.callExpression(_core.types.identifier("Symbol"), [_core.types.stringLiteral(name)]); } else if (!isStatic) { - init = _core.types.newExpression(_core.types.identifier(!isMethod || isAccessor ? "WeakMap" : "WeakSet"), []); + if (injectedIds.has(id.name)) continue; + injectedIds.add(id.name); + init = _core.types.newExpression(_core.types.identifier(isMethod && (!isGetterOrSetter || newHelpers(state)) ? "WeakSet" : "WeakMap"), []); } if (init) { - (0, _helperAnnotateAsPure.default)(init); + if (!privateFieldsAsSymbols) { + (0, _helperAnnotateAsPure.default)(init); + } initNodes.push(_core.template.statement.ast`var ${id} = ${init}`); } } @@ -180,6 +233,20 @@ const privateInVisitor = privateNameVisitorFactory({ path.replaceWith(_core.template.expression.ast`${_core.types.cloneNode(id)}.has(${buildCheckInRHS(right, file)})`); } }); +function readOnlyError(file, name) { + return _core.types.callExpression(file.addHelper("readOnlyError"), [_core.types.stringLiteral(`#${name}`)]); +} +function writeOnlyError(file, name) { + if (!file.availableHelper("writeOnlyError")) { + console.warn(`@babel/helpers is outdated, update it to silence this warning.`); + return _core.types.buildUndefinedNode(); + } + return _core.types.callExpression(file.addHelper("writeOnlyError"), [_core.types.stringLiteral(`#${name}`)]); +} +function buildStaticPrivateFieldAccess(expr, noUninitializedPrivateFieldAccess) { + if (noUninitializedPrivateFieldAccess) return expr; + return _core.types.memberExpression(expr, _core.types.identifier("_")); +} const privateNameHandlerSpec = { memoise(member, count) { const { @@ -208,7 +275,8 @@ const privateNameHandlerSpec = { classRef, privateNamesMap, file, - innerBinding + innerBinding, + noUninitializedPrivateFieldAccess } = this; const { name @@ -221,23 +289,52 @@ const privateNameHandlerSpec = { getId, setId } = privateNamesMap.get(name); - const isAccessor = getId || setId; + const isGetterOrSetter = getId || setId; if (isStatic) { - const helperName = isMethod && !isAccessor ? "classStaticPrivateMethodGet" : "classStaticPrivateFieldSpecGet"; unshadow(classRef.name, member.scope, innerBinding); - return _core.types.callExpression(file.addHelper(helperName), [this.receiver(member), _core.types.cloneNode(classRef), _core.types.cloneNode(id)]); + if (!newHelpers(file)) { + const helperName = isMethod && !isGetterOrSetter ? "classStaticPrivateMethodGet" : "classStaticPrivateFieldSpecGet"; + return _core.types.callExpression(file.addHelper(helperName), [this.receiver(member), _core.types.cloneNode(classRef), _core.types.cloneNode(id)]); + } + const receiver = this.receiver(member); + const skipCheck = _core.types.isIdentifier(receiver) && receiver.name === classRef.name; + if (!isMethod) { + if (skipCheck) { + return buildStaticPrivateFieldAccess(_core.types.cloneNode(id), noUninitializedPrivateFieldAccess); + } + return buildStaticPrivateFieldAccess(_core.types.callExpression(file.addHelper("assertClassBrand"), [_core.types.cloneNode(classRef), receiver, _core.types.cloneNode(id)]), noUninitializedPrivateFieldAccess); + } + if (getId) { + if (skipCheck) { + return _core.types.callExpression(_core.types.cloneNode(getId), [receiver]); + } + return _core.types.callExpression(file.addHelper("classPrivateGetter"), [_core.types.cloneNode(classRef), receiver, _core.types.cloneNode(getId)]); + } + if (setId) { + const err = _core.types.buildUndefinedNode(); + if (skipCheck) return err; + return _core.types.sequenceExpression([_core.types.callExpression(file.addHelper("assertClassBrand"), [_core.types.cloneNode(classRef), receiver]), err]); + } + if (skipCheck) return _core.types.cloneNode(id); + return _core.types.callExpression(file.addHelper("assertClassBrand"), [_core.types.cloneNode(classRef), receiver, _core.types.cloneNode(id)]); } if (isMethod) { - if (isAccessor) { - if (!getId && setId) { - if (file.availableHelper("writeOnlyError")) { - return _core.types.sequenceExpression([this.receiver(member), _core.types.callExpression(file.addHelper("writeOnlyError"), [_core.types.stringLiteral(`#${name}`)])]); - } - console.warn(`@babel/helpers is outdated, update it to silence this warning.`); + if (isGetterOrSetter) { + if (!getId) { + return _core.types.sequenceExpression([this.receiver(member), writeOnlyError(file, name)]); } - return _core.types.callExpression(file.addHelper("classPrivateFieldGet"), [this.receiver(member), _core.types.cloneNode(id)]); + if (!newHelpers(file)) { + return _core.types.callExpression(file.addHelper("classPrivateFieldGet"), [this.receiver(member), _core.types.cloneNode(id)]); + } + return _core.types.callExpression(file.addHelper("classPrivateGetter"), [_core.types.cloneNode(id), this.receiver(member), _core.types.cloneNode(getId)]); + } + if (!newHelpers(file)) { + return _core.types.callExpression(file.addHelper("classPrivateMethodGet"), [this.receiver(member), _core.types.cloneNode(id), _core.types.cloneNode(methodId)]); } - return _core.types.callExpression(file.addHelper("classPrivateMethodGet"), [this.receiver(member), _core.types.cloneNode(id), _core.types.cloneNode(methodId)]); + return _core.types.callExpression(file.addHelper("assertClassBrand"), [_core.types.cloneNode(id), this.receiver(member), _core.types.cloneNode(methodId)]); + } + if (newHelpers(file)) { + return _core.types.callExpression(file.addHelper("classPrivateFieldGet2"), [_core.types.cloneNode(id), this.receiver(member)]); } return _core.types.callExpression(file.addHelper("classPrivateFieldGet"), [this.receiver(member), _core.types.cloneNode(id)]); }, @@ -249,7 +346,8 @@ const privateNameHandlerSpec = { const { classRef, privateNamesMap, - file + file, + noUninitializedPrivateFieldAccess } = this; const { name @@ -261,16 +359,38 @@ const privateNameHandlerSpec = { setId, getId } = privateNamesMap.get(name); - const isAccessor = getId || setId; + const isGetterOrSetter = getId || setId; if (isStatic) { - const helperName = isMethod && !isAccessor ? "classStaticPrivateMethodSet" : "classStaticPrivateFieldSpecSet"; - return _core.types.callExpression(file.addHelper(helperName), [this.receiver(member), _core.types.cloneNode(classRef), _core.types.cloneNode(id), value]); + if (!newHelpers(file)) { + const helperName = isMethod && !isGetterOrSetter ? "classStaticPrivateMethodSet" : "classStaticPrivateFieldSpecSet"; + return _core.types.callExpression(file.addHelper(helperName), [this.receiver(member), _core.types.cloneNode(classRef), _core.types.cloneNode(id), value]); + } + const receiver = this.receiver(member); + const skipCheck = _core.types.isIdentifier(receiver) && receiver.name === classRef.name; + if (isMethod && !setId) { + const err = readOnlyError(file, name); + if (skipCheck) return _core.types.sequenceExpression([value, err]); + return _core.types.sequenceExpression([value, _core.types.callExpression(file.addHelper("assertClassBrand"), [_core.types.cloneNode(classRef), receiver]), readOnlyError(file, name)]); + } + if (setId) { + if (skipCheck) { + return _core.types.callExpression(_core.types.cloneNode(setId), [receiver, value]); + } + return _core.types.callExpression(file.addHelper("classPrivateSetter"), [_core.types.cloneNode(classRef), _core.types.cloneNode(setId), receiver, value]); + } + return _core.types.assignmentExpression("=", buildStaticPrivateFieldAccess(_core.types.cloneNode(id), noUninitializedPrivateFieldAccess), skipCheck ? value : _core.types.callExpression(file.addHelper("assertClassBrand"), [_core.types.cloneNode(classRef), receiver, value])); } if (isMethod) { if (setId) { - return _core.types.callExpression(file.addHelper("classPrivateFieldSet"), [this.receiver(member), _core.types.cloneNode(id), value]); + if (!newHelpers(file)) { + return _core.types.callExpression(file.addHelper("classPrivateFieldSet"), [this.receiver(member), _core.types.cloneNode(id), value]); + } + return _core.types.callExpression(file.addHelper("classPrivateSetter"), [_core.types.cloneNode(id), _core.types.cloneNode(setId), this.receiver(member), value]); } - return _core.types.sequenceExpression([this.receiver(member), value, _core.types.callExpression(file.addHelper("readOnlyError"), [_core.types.stringLiteral(`#${name}`)])]); + return _core.types.sequenceExpression([this.receiver(member), value, readOnlyError(file, name)]); + } + if (newHelpers(file)) { + return _core.types.callExpression(file.addHelper("classPrivateFieldSet2"), [_core.types.cloneNode(id), this.receiver(member), value]); } return _core.types.callExpression(file.addHelper("classPrivateFieldSet"), [this.receiver(member), _core.types.cloneNode(id), value]); }, @@ -278,24 +398,56 @@ const privateNameHandlerSpec = { const { classRef, privateNamesMap, - file + file, + noUninitializedPrivateFieldAccess } = this; const { name } = member.node.property.id; const { id, - static: isStatic + static: isStatic, + method: isMethod, + setId } = privateNamesMap.get(name); - if (isStatic) { - try { - var helper = file.addHelper("classStaticPrivateFieldDestructureSet"); - } catch (_unused) { - throw new Error("Babel can not transpile `[C.#p] = [0]` with @babel/helpers < 7.13.10, \n" + "please update @babel/helpers to the latest version."); + if (!newHelpers(file)) { + if (isStatic) { + try { + var helper = file.addHelper("classStaticPrivateFieldDestructureSet"); + } catch (_unused) { + throw new Error("Babel can not transpile `[C.#p] = [0]` with @babel/helpers < 7.13.10, \n" + "please update @babel/helpers to the latest version."); + } + return _core.types.memberExpression(_core.types.callExpression(helper, [this.receiver(member), _core.types.cloneNode(classRef), _core.types.cloneNode(id)]), _core.types.identifier("value")); + } + return _core.types.memberExpression(_core.types.callExpression(file.addHelper("classPrivateFieldDestructureSet"), [this.receiver(member), _core.types.cloneNode(id)]), _core.types.identifier("value")); + } + if (isMethod && !setId) { + return _core.types.memberExpression(_core.types.sequenceExpression([member.node.object, readOnlyError(file, name)]), _core.types.identifier("_")); + } + if (isStatic && !isMethod) { + const getCall = this.get(member); + if (!noUninitializedPrivateFieldAccess || !_core.types.isCallExpression(getCall)) { + return getCall; } - return _core.types.memberExpression(_core.types.callExpression(helper, [this.receiver(member), _core.types.cloneNode(classRef), _core.types.cloneNode(id)]), _core.types.identifier("value")); + const ref = getCall.arguments.pop(); + getCall.arguments.push(_core.template.expression.ast`(_) => ${ref} = _`); + return _core.types.memberExpression(_core.types.callExpression(file.addHelper("toSetter"), [getCall]), _core.types.identifier("_")); + } + const setCall = this.set(member, _core.types.identifier("_")); + if (!_core.types.isCallExpression(setCall) || !_core.types.isIdentifier(setCall.arguments[setCall.arguments.length - 1], { + name: "_" + })) { + throw member.buildCodeFrameError("Internal Babel error while compiling this code. This is a Babel bug. " + "Please report it at https://github.com/babel/babel/issues."); } - return _core.types.memberExpression(_core.types.callExpression(file.addHelper("classPrivateFieldDestructureSet"), [this.receiver(member), _core.types.cloneNode(id)]), _core.types.identifier("value")); + let args; + if (_core.types.isMemberExpression(setCall.callee, { + computed: false + }) && _core.types.isIdentifier(setCall.callee.property) && setCall.callee.property.name === "call") { + args = [setCall.callee.object, _core.types.arrayExpression(setCall.arguments.slice(1, -1)), setCall.arguments[0]]; + } else { + args = [setCall.callee, _core.types.arrayExpression(setCall.arguments.slice(0, -1))]; + } + return _core.types.memberExpression(_core.types.callExpression(file.addHelper("toSetter"), args), _core.types.identifier("_")); }, call(member, args) { this.memoise(member, 1); @@ -351,6 +503,7 @@ const privateNameHandlerLoose = { }; function transformPrivateNamesUsage(ref, path, privateNamesMap, { privateFieldsAsProperties, + noUninitializedPrivateFieldAccess, noDocumentAll, innerBinding }, state) { @@ -363,6 +516,7 @@ function transformPrivateNamesUsage(ref, path, privateNamesMap, { file: state }, handler, { noDocumentAll, + noUninitializedPrivateFieldAccess, innerBinding })); body.traverse(privateInVisitor, { @@ -403,48 +557,50 @@ function buildPrivateInstanceFieldInitSpec(ref, prop, privateNamesMap, state) { } } const helper = state.addHelper("classPrivateFieldInitSpec"); - return inheritPropComments(_core.template.statement.ast`${helper}( - ${_core.types.thisExpression()}, - ${_core.types.cloneNode(id)}, - { - writable: true, - value: ${value} - }, - )`, prop); + return inheritPropComments(_core.types.expressionStatement(_core.types.callExpression(helper, [_core.types.thisExpression(), _core.types.cloneNode(id), newHelpers(state) ? value : _core.template.expression.ast`{ writable: true, value: ${value} }`])), prop); } -function buildPrivateStaticFieldInitSpec(prop, privateNamesMap) { +function buildPrivateStaticFieldInitSpec(prop, privateNamesMap, noUninitializedPrivateFieldAccess) { const privateName = privateNamesMap.get(prop.node.key.id.name); - const { - id, - getId, - setId, - initAdded - } = privateName; - const isAccessor = getId || setId; - if (!prop.isProperty() && (initAdded || !isAccessor)) return; - if (isAccessor) { - privateNamesMap.set(prop.node.key.id.name, Object.assign({}, privateName, { - initAdded: true - })); + const value = noUninitializedPrivateFieldAccess ? prop.node.value : _core.template.expression.ast`{ + _: ${prop.node.value || _core.types.buildUndefinedNode()} + }`; + return inheritPropComments(_core.types.variableDeclaration("var", [_core.types.variableDeclarator(_core.types.cloneNode(privateName.id), value)]), prop); +} +{ + var buildPrivateStaticFieldInitSpecOld = function (prop, privateNamesMap) { + const privateName = privateNamesMap.get(prop.node.key.id.name); + const { + id, + getId, + setId, + initAdded + } = privateName; + const isGetterOrSetter = getId || setId; + if (!prop.isProperty() && (initAdded || !isGetterOrSetter)) return; + if (isGetterOrSetter) { + privateNamesMap.set(prop.node.key.id.name, Object.assign({}, privateName, { + initAdded: true + })); + return inheritPropComments(_core.template.statement.ast` + var ${_core.types.cloneNode(id)} = { + // configurable is false by default + // enumerable is false by default + // writable is false by default + get: ${getId ? getId.name : prop.scope.buildUndefinedNode()}, + set: ${setId ? setId.name : prop.scope.buildUndefinedNode()} + } + `, prop); + } + const value = prop.node.value || prop.scope.buildUndefinedNode(); return inheritPropComments(_core.template.statement.ast` var ${_core.types.cloneNode(id)} = { // configurable is false by default // enumerable is false by default - // writable is false by default - get: ${getId ? getId.name : prop.scope.buildUndefinedNode()}, - set: ${setId ? setId.name : prop.scope.buildUndefinedNode()} - } + writable: true, + value: ${value} + }; `, prop); - } - const value = prop.node.value || prop.scope.buildUndefinedNode(); - return inheritPropComments(_core.template.statement.ast` - var ${_core.types.cloneNode(id)} = { - // configurable is false by default - // enumerable is false by default - writable: true, - value: ${value} - }; - `, prop); + }; } function buildPrivateMethodInitLoose(ref, prop, privateNamesMap) { const privateName = privateNamesMap.get(prop.node.key.id.name); @@ -466,8 +622,8 @@ function buildPrivateMethodInitLoose(ref, prop, privateNamesMap) { }); `, prop); } - const isAccessor = getId || setId; - if (isAccessor) { + const isGetterOrSetter = getId || setId; + if (isGetterOrSetter) { privateNamesMap.set(prop.node.key.id.name, Object.assign({}, privateName, { initAdded: true })); @@ -484,15 +640,12 @@ function buildPrivateMethodInitLoose(ref, prop, privateNamesMap) { } function buildPrivateInstanceMethodInitSpec(ref, prop, privateNamesMap, state) { const privateName = privateNamesMap.get(prop.node.key.id.name); - const { - getId, - setId, - initAdded - } = privateName; - if (initAdded) return; - const isAccessor = getId || setId; - if (isAccessor) { - return buildPrivateAccessorInitialization(ref, prop, privateNamesMap, state); + if (privateName.initAdded) return; + if (!newHelpers(state)) { + const isGetterOrSetter = privateName.getId || privateName.setId; + if (isGetterOrSetter) { + return buildPrivateAccessorInitialization(ref, prop, privateNamesMap, state); + } } return buildPrivateInstanceMethodInitialization(ref, prop, privateNamesMap, state); } @@ -568,8 +721,8 @@ function buildPrivateStaticMethodInitLoose(ref, prop, state, privateNamesMap) { initAdded } = privateName; if (initAdded) return; - const isAccessor = getId || setId; - if (isAccessor) { + const isGetterOrSetter = getId || setId; + if (isGetterOrSetter) { privateNamesMap.set(prop.node.key.id.name, Object.assign({}, privateName, { initAdded: true })); @@ -592,7 +745,7 @@ function buildPrivateStaticMethodInitLoose(ref, prop, state, privateNamesMap) { }); `, prop); } -function buildPrivateMethodDeclaration(prop, privateNamesMap, privateFieldsAsProperties = false) { +function buildPrivateMethodDeclaration(file, prop, privateNamesMap, privateFieldsAsSymbolsOrProperties = false) { const privateName = privateNamesMap.get(prop.node.key.id.name); const { id, @@ -609,25 +762,58 @@ function buildPrivateMethodDeclaration(prop, privateNamesMap, privateFieldsAsPro generator, async } = prop.node; - const isGetter = getId && !getterDeclared && params.length === 0; - const isSetter = setId && !setterDeclared && params.length > 0; + const isGetter = getId && params.length === 0; + const isSetter = setId && params.length > 0; + if (isGetter && getterDeclared || isSetter && setterDeclared) { + privateNamesMap.set(prop.node.key.id.name, Object.assign({}, privateName, { + initAdded: true + })); + return null; + } + if (newHelpers(file) && (isGetter || isSetter) && !privateFieldsAsSymbolsOrProperties) { + const scope = prop.get("body").scope; + const thisArg = scope.generateUidIdentifier("this"); + const state = { + thisRef: thisArg, + argumentsPath: [] + }; + prop.traverse(thisContextVisitor, state); + if (state.argumentsPath.length) { + const argumentsId = scope.generateUidIdentifier("arguments"); + scope.push({ + id: argumentsId, + init: _core.template.expression.ast`[].slice.call(arguments, 1)` + }); + for (const path of state.argumentsPath) { + path.replaceWith(_core.types.cloneNode(argumentsId)); + } + } + params.unshift(_core.types.cloneNode(thisArg)); + } let declId = methodId; if (isGetter) { privateNamesMap.set(prop.node.key.id.name, Object.assign({}, privateName, { - getterDeclared: true + getterDeclared: true, + initAdded: true })); declId = getId; } else if (isSetter) { privateNamesMap.set(prop.node.key.id.name, Object.assign({}, privateName, { - setterDeclared: true + setterDeclared: true, + initAdded: true })); declId = setId; - } else if (isStatic && !privateFieldsAsProperties) { + } else if (isStatic && !privateFieldsAsSymbolsOrProperties) { declId = id; } return inheritPropComments(_core.types.functionDeclaration(_core.types.cloneNode(declId), params, body, generator, async), prop); } const thisContextVisitor = _core.traverse.visitors.merge([{ + Identifier(path, state) { + if (state.argumentsPath && path.node.name === "arguments") { + state.argumentsPath.push(path); + } + }, UnaryExpression(path) { const { node @@ -641,7 +827,7 @@ const thisContextVisitor = _core.traverse.visitors.merge([{ }, ThisExpression(path, state) { state.needsClassRef = true; - path.replaceWith(_core.types.cloneNode(state.classRef)); + path.replaceWith(_core.types.cloneNode(state.thisRef)); }, MetaProperty(path) { const { @@ -657,21 +843,21 @@ const innerReferencesVisitor = { ReferencedIdentifier(path, state) { if (path.scope.bindingIdentifierEquals(path.node.name, state.innerBinding)) { state.needsClassRef = true; - path.node.name = state.classRef.name; + path.node.name = state.thisRef.name; } } }; function replaceThisContext(path, ref, innerBindingRef) { - var _state$classRef; + var _state$thisRef; const state = { - classRef: ref, + thisRef: ref, needsClassRef: false, innerBinding: innerBindingRef }; if (!path.isMethod()) { path.traverse(thisContextVisitor, state); } - if (innerBindingRef != null && (_state$classRef = state.classRef) != null && _state$classRef.name && state.classRef.name !== innerBindingRef.name) { + if (innerBindingRef != null && (_state$thisRef = state.thisRef) != null && _state$thisRef.name && state.thisRef.name !== innerBindingRef.name) { path.traverse(innerReferencesVisitor, state); } return state.needsClassRef; @@ -693,7 +879,7 @@ function inheritPropComments(node, prop) { _core.types.inheritInnerComments(node, prop.node); return node; } -function buildFieldsInitNodes(ref, superRef, props, privateNamesMap, file, setPublicClassFields, privateFieldsAsProperties, constantSuper, innerBindingRef) { +function buildFieldsInitNodes(ref, superRef, props, privateNamesMap, file, setPublicClassFields, privateFieldsAsSymbolsOrProperties, noUninitializedPrivateFieldAccess, constantSuper, innerBindingRef) { var _ref, _ref2; let classRefFlags = 0; let injectSuperRef; @@ -707,7 +893,7 @@ function buildFieldsInitNodes(ref, superRef, props, privateNamesMap, file, setPu (_injectSuperRef = injectSuperRef) != null ? _injectSuperRef : injectSuperRef = props[0].scope.generateUidIdentifierBasedOnNode(superRef); return injectSuperRef; }; - const classRefForInnerBinding = (_ref = ref) != null ? _ref : props[0].scope.generateUidIdentifier("class"); + const classRefForInnerBinding = (_ref = ref) != null ? _ref : props[0].scope.generateUidIdentifier((innerBindingRef == null ? void 0 : innerBindingRef.name) || "Class"); (_ref2 = ref) != null ? _ref2 : ref = _core.types.cloneNode(innerBindingRef); for (const prop of props) { prop.isClassProperty() && ts.assertFieldTransformed(prop); @@ -752,11 +938,15 @@ function buildFieldsInitNodes(ref, superRef, props, privateNamesMap, file, setPu } break; } - case isStatic && isPrivate && isField && privateFieldsAsProperties: + case isStatic && isPrivate && isField && privateFieldsAsSymbolsOrProperties: staticNodes.push(buildPrivateFieldInitLoose(_core.types.cloneNode(ref), prop, privateNamesMap)); break; - case isStatic && isPrivate && isField && !privateFieldsAsProperties: - staticNodes.push(buildPrivateStaticFieldInitSpec(prop, privateNamesMap)); + case isStatic && isPrivate && isField && !privateFieldsAsSymbolsOrProperties: + if (!newHelpers(file)) { + staticNodes.push(buildPrivateStaticFieldInitSpecOld(prop, privateNamesMap)); + } else { + staticNodes.push(buildPrivateStaticFieldInitSpec(prop, privateNamesMap, noUninitializedPrivateFieldAccess)); + } break; case isStatic && isPublic && isField && setPublicClassFields: if (!isNameOrLength(prop.node)) { @@ -766,27 +956,29 @@ function buildFieldsInitNodes(ref, superRef, props, privateNamesMap, file, setPu case isStatic && isPublic && isField && !setPublicClassFields: staticNodes.push(buildPublicFieldInitSpec(_core.types.cloneNode(ref), prop, file)); break; - case isInstance && isPrivate && isField && privateFieldsAsProperties: + case isInstance && isPrivate && isField && privateFieldsAsSymbolsOrProperties: instanceNodes.push(buildPrivateFieldInitLoose(_core.types.thisExpression(), prop, privateNamesMap)); break; - case isInstance && isPrivate && isField && !privateFieldsAsProperties: + case isInstance && isPrivate && isField && !privateFieldsAsSymbolsOrProperties: instanceNodes.push(buildPrivateInstanceFieldInitSpec(_core.types.thisExpression(), prop, privateNamesMap, file)); break; - case isInstance && isPrivate && isMethod && privateFieldsAsProperties: + case isInstance && isPrivate && isMethod && privateFieldsAsSymbolsOrProperties: instanceNodes.unshift(buildPrivateMethodInitLoose(_core.types.thisExpression(), prop, privateNamesMap)); - pureStaticNodes.push(buildPrivateMethodDeclaration(prop, privateNamesMap, privateFieldsAsProperties)); + pureStaticNodes.push(buildPrivateMethodDeclaration(file, prop, privateNamesMap, privateFieldsAsSymbolsOrProperties)); break; - case isInstance && isPrivate && isMethod && !privateFieldsAsProperties: + case isInstance && isPrivate && isMethod && !privateFieldsAsSymbolsOrProperties: instanceNodes.unshift(buildPrivateInstanceMethodInitSpec(_core.types.thisExpression(), prop, privateNamesMap, file)); - pureStaticNodes.push(buildPrivateMethodDeclaration(prop, privateNamesMap, privateFieldsAsProperties)); + pureStaticNodes.push(buildPrivateMethodDeclaration(file, prop, privateNamesMap, privateFieldsAsSymbolsOrProperties)); break; - case isStatic && isPrivate && isMethod && !privateFieldsAsProperties: - staticNodes.unshift(buildPrivateStaticFieldInitSpec(prop, privateNamesMap)); - pureStaticNodes.push(buildPrivateMethodDeclaration(prop, privateNamesMap, privateFieldsAsProperties)); + case isStatic && isPrivate && isMethod && !privateFieldsAsSymbolsOrProperties: + if (!newHelpers(file)) { + staticNodes.unshift(buildPrivateStaticFieldInitSpecOld(prop, privateNamesMap)); + } + pureStaticNodes.push(buildPrivateMethodDeclaration(file, prop, privateNamesMap, privateFieldsAsSymbolsOrProperties)); break; - case isStatic && isPrivate && isMethod && privateFieldsAsProperties: + case isStatic && isPrivate && isMethod && privateFieldsAsSymbolsOrProperties: staticNodes.unshift(buildPrivateStaticMethodInitLoose(_core.types.cloneNode(ref), prop, file, privateNamesMap)); - pureStaticNodes.push(buildPrivateMethodDeclaration(prop, privateNamesMap, privateFieldsAsProperties)); + pureStaticNodes.push(buildPrivateMethodDeclaration(file, prop, privateNamesMap, privateFieldsAsSymbolsOrProperties)); break; case isInstance && isPublic && isField && setPublicClassFields: instanceNodes.push(buildPublicFieldInitLoose(_core.types.thisExpression(), prop)); diff --git a/node_modules/@babel/helper-create-class-features-plugin/lib/fields.js.map b/node_modules/@babel/helper-create-class-features-plugin/lib/fields.js.map index e7ba1b2e..16129443 100644 --- a/node_modules/@babel/helper-create-class-features-plugin/lib/fields.js.map +++ b/node_modules/@babel/helper-create-class-features-plugin/lib/fields.js.map @@ -1 +1 @@ -{"version":3,"names":["_core","require","_helperReplaceSupers","_helperEnvironmentVisitor","_helperMemberExpressionToFunctions","_helperOptimiseCallExpression","_helperAnnotateAsPure","_helperSkipTransparentExpressionWrappers","ts","buildPrivateNamesMap","props","privateNamesMap","Map","prop","isPrivate","name","node","key","id","update","has","get","scope","generateUidIdentifier","static","method","isProperty","isClassPrivateMethod","kind","getId","setId","methodId","set","buildPrivateNamesNodes","privateFieldsAsProperties","privateFieldsAsSymbols","state","initNodes","value","isStatic","isMethod","isAccessor","t","cloneNode","init","callExpression","addHelper","stringLiteral","identifier","newExpression","annotateAsPure","push","template","statement","ast","privateNameVisitorFactory","visitor","nestedVisitor","traverse","visitors","merge","Object","assign","environmentVisitor","privateNameVisitor","Class","path","body","visiblePrivateNames","redeclared","delete","length","skipKey","PrivateName","noDocumentAll","parentPath","isMemberExpression","property","isOptionalMemberExpression","includes","handle","unshadow","innerBinding","_scope","hasBinding","bindingIdentifierEquals","rename","parent","buildCheckInRHS","rhs","file","inRHSIsObject","availableHelper","privateInVisitor","BinaryExpression","operator","left","right","isPrivateName","classRef","replaceWith","expression","privateNameHandlerSpec","memoise","member","count","object","memo","maybeGenerateMemoised","memoiser","receiver","helperName","sequenceExpression","console","warn","boundGet","memberExpression","destructureSet","helper","_unused","Error","call","args","optimiseCall","optionalCall","privateNameHandlerLoose","BASE","REF","PROP","simpleSet","optionalCallExpression","transformPrivateNamesUsage","ref","size","handler","memberExpressionToFunctions","buildPrivateFieldInitLoose","buildUndefinedNode","inheritPropComments","buildPrivateInstanceFieldInitSpec","thisExpression","buildPrivateStaticFieldInitSpec","privateName","initAdded","buildPrivateMethodInitLoose","buildPrivateInstanceMethodInitSpec","buildPrivateAccessorInitialization","buildPrivateInstanceMethodInitialization","buildPublicFieldInitLoose","computed","expressionStatement","assignmentExpression","isLiteral","buildPublicFieldInitSpec","buildPrivateStaticMethodInitLoose","buildPrivateMethodDeclaration","getterDeclared","setterDeclared","params","generator","async","isGetter","isSetter","declId","functionDeclaration","thisContextVisitor","UnaryExpression","argument","skipTransparentExprWrapperNodes","isThisExpression","booleanLiteral","ThisExpression","needsClassRef","MetaProperty","meta","innerReferencesVisitor","ReferencedIdentifier","replaceThisContext","innerBindingRef","_state$classRef","isNameOrLength","type","inheritLeadingComments","inheritInnerComments","buildFieldsInitNodes","superRef","setPublicClassFields","constantSuper","_ref","_ref2","classRefFlags","injectSuperRef","staticNodes","instanceNodes","lastInstanceNodeReturnsThis","pureStaticNodes","classBindingNode","getSuperRef","isIdentifier","_injectSuperRef","generateUidIdentifierBasedOnNode","classRefForInnerBinding","isClassProperty","assertFieldTransformed","isStaticBlock","isInstance","isPublic","isField","ReplaceSupers","methodPath","refToPreserve","getObjectRef","replace","replaced","blockBody","isExpressionStatement","inheritsComments","unshift","filter","Boolean","wrapClass","leadingComments","remove","superClass","isClassExpression"],"sources":["../src/fields.ts"],"sourcesContent":["import { template, traverse, types as t } from \"@babel/core\";\nimport type { File } from \"@babel/core\";\nimport type { NodePath, Visitor, Scope } from \"@babel/traverse\";\nimport ReplaceSupers from \"@babel/helper-replace-supers\";\nimport environmentVisitor from \"@babel/helper-environment-visitor\";\nimport memberExpressionToFunctions from \"@babel/helper-member-expression-to-functions\";\nimport type {\n Handler,\n HandlerState,\n} from \"@babel/helper-member-expression-to-functions\";\nimport optimiseCall from \"@babel/helper-optimise-call-expression\";\nimport annotateAsPure from \"@babel/helper-annotate-as-pure\";\nimport { skipTransparentExprWrapperNodes } from \"@babel/helper-skip-transparent-expression-wrappers\";\n\nimport * as ts from \"./typescript.ts\";\n\ninterface PrivateNameMetadata {\n id: t.Identifier;\n static: boolean;\n method: boolean;\n getId?: t.Identifier;\n setId?: t.Identifier;\n methodId?: t.Identifier;\n initAdded?: boolean;\n getterDeclared?: boolean;\n setterDeclared?: boolean;\n}\n\ntype PrivateNamesMap = Map<string, PrivateNameMetadata>;\n\nexport function buildPrivateNamesMap(props: PropPath[]) {\n const privateNamesMap: PrivateNamesMap = new Map();\n for (const prop of props) {\n if (prop.isPrivate()) {\n const { name } = prop.node.key.id;\n const update: PrivateNameMetadata = privateNamesMap.has(name)\n ? privateNamesMap.get(name)\n : {\n id: prop.scope.generateUidIdentifier(name),\n static: prop.node.static,\n method: !prop.isProperty(),\n };\n if (prop.isClassPrivateMethod()) {\n if (prop.node.kind === \"get\") {\n update.getId = prop.scope.generateUidIdentifier(`get_${name}`);\n } else if (prop.node.kind === \"set\") {\n update.setId = prop.scope.generateUidIdentifier(`set_${name}`);\n } else if (prop.node.kind === \"method\") {\n update.methodId = prop.scope.generateUidIdentifier(name);\n }\n }\n privateNamesMap.set(name, update);\n }\n }\n return privateNamesMap;\n}\n\nexport function buildPrivateNamesNodes(\n privateNamesMap: PrivateNamesMap,\n privateFieldsAsProperties: boolean,\n privateFieldsAsSymbols: boolean,\n state: File,\n) {\n const initNodes: t.Statement[] = [];\n\n for (const [name, value] of privateNamesMap) {\n // - When the privateFieldsAsProperties assumption is enabled,\n // both static and instance fields are transpiled using a\n // secret non-enumerable property. Hence, we also need to generate that\n // key (using the classPrivateFieldLooseKey helper).\n // - When the privateFieldsAsSymbols assumption is enabled,\n // both static and instance fields are transpiled using a\n // unique Symbol to define a non-enumerable property.\n // - In spec mode, only instance fields need a \"private name\" initializer\n // because static fields are directly assigned to a variable in the\n // buildPrivateStaticFieldInitSpec function.\n const { static: isStatic, method: isMethod, getId, setId } = value;\n const isAccessor = getId || setId;\n const id = t.cloneNode(value.id);\n\n let init: t.Expression;\n\n if (privateFieldsAsProperties) {\n init = t.callExpression(state.addHelper(\"classPrivateFieldLooseKey\"), [\n t.stringLiteral(name),\n ]);\n } else if (privateFieldsAsSymbols) {\n init = t.callExpression(t.identifier(\"Symbol\"), [t.stringLiteral(name)]);\n } else if (!isStatic) {\n init = t.newExpression(\n t.identifier(!isMethod || isAccessor ? \"WeakMap\" : \"WeakSet\"),\n [],\n );\n }\n\n if (init) {\n annotateAsPure(init);\n initNodes.push(template.statement.ast`var ${id} = ${init}`);\n }\n }\n\n return initNodes;\n}\n\ninterface PrivateNameVisitorState {\n privateNamesMap: PrivateNamesMap;\n privateFieldsAsProperties: boolean;\n redeclared?: string[];\n}\n\n// Traverses the class scope, handling private name references. If an inner\n// class redeclares the same private name, it will hand off traversal to the\n// restricted visitor (which doesn't traverse the inner class's inner scope).\nfunction privateNameVisitorFactory<S>(\n visitor: Visitor<PrivateNameVisitorState & S>,\n) {\n // Traverses the outer portion of a class, without touching the class's inner\n // scope, for private names.\n const nestedVisitor = traverse.visitors.merge([\n {\n ...visitor,\n },\n environmentVisitor,\n ]);\n\n const privateNameVisitor: Visitor<PrivateNameVisitorState & S> = {\n ...visitor,\n\n Class(path) {\n const { privateNamesMap } = this;\n const body = path.get(\"body.body\");\n\n const visiblePrivateNames = new Map(privateNamesMap);\n const redeclared = [];\n for (const prop of body) {\n if (!prop.isPrivate()) continue;\n const { name } = prop.node.key.id;\n visiblePrivateNames.delete(name);\n redeclared.push(name);\n }\n\n // If the class doesn't redeclare any private fields, we can continue with\n // our overall traversal.\n if (!redeclared.length) {\n return;\n }\n\n // This class redeclares some private field. We need to process the outer\n // environment with access to all the outer privates, then we can process\n // the inner environment with only the still-visible outer privates.\n path.get(\"body\").traverse(nestedVisitor, {\n ...this,\n redeclared,\n });\n path.traverse(privateNameVisitor, {\n ...this,\n privateNamesMap: visiblePrivateNames,\n });\n\n // We'll eventually hit this class node again with the overall Class\n // Features visitor, which'll process the redeclared privates.\n path.skipKey(\"body\");\n },\n };\n\n return privateNameVisitor;\n}\n\ninterface PrivateNameState {\n privateNamesMap: PrivateNamesMap;\n classRef: t.Identifier;\n file: File;\n noDocumentAll: boolean;\n innerBinding?: t.Identifier;\n}\n\nconst privateNameVisitor = privateNameVisitorFactory<\n HandlerState<PrivateNameState> & PrivateNameState\n>({\n PrivateName(path, { noDocumentAll }) {\n const { privateNamesMap, redeclared } = this;\n const { node, parentPath } = path;\n\n if (\n !parentPath.isMemberExpression({ property: node }) &&\n !parentPath.isOptionalMemberExpression({ property: node })\n ) {\n return;\n }\n const { name } = node.id;\n if (!privateNamesMap.has(name)) return;\n if (redeclared && redeclared.includes(name)) return;\n\n this.handle(parentPath, noDocumentAll);\n },\n});\n\n// rename all bindings that shadows innerBinding\nfunction unshadow(\n name: string,\n scope: Scope,\n innerBinding: t.Identifier | undefined,\n) {\n // in some cases, scope.getBinding(name) === undefined\n // so we check hasBinding to avoid keeping looping\n // see: https://github.com/babel/babel/pull/13656#discussion_r686030715\n while (\n scope?.hasBinding(name) &&\n !scope.bindingIdentifierEquals(name, innerBinding)\n ) {\n scope.rename(name);\n scope = scope.parent;\n }\n}\n\nexport function buildCheckInRHS(\n rhs: t.Expression,\n file: File,\n inRHSIsObject?: boolean,\n) {\n if (inRHSIsObject || !file.availableHelper?.(\"checkInRHS\")) return rhs;\n return t.callExpression(file.addHelper(\"checkInRHS\"), [rhs]);\n}\n\nconst privateInVisitor = privateNameVisitorFactory<{\n classRef: t.Identifier;\n file: File;\n innerBinding?: t.Identifier;\n}>({\n BinaryExpression(path, { file }) {\n const { operator, left, right } = path.node;\n if (operator !== \"in\") return;\n if (!t.isPrivateName(left)) return;\n\n const { privateFieldsAsProperties, privateNamesMap, redeclared } = this;\n\n const { name } = left.id;\n\n if (!privateNamesMap.has(name)) return;\n if (redeclared && redeclared.includes(name)) return;\n\n // if there are any local variable shadowing classRef, unshadow it\n // see #12960\n unshadow(this.classRef.name, path.scope, this.innerBinding);\n\n if (privateFieldsAsProperties) {\n const { id } = privateNamesMap.get(name);\n path.replaceWith(template.expression.ast`\n Object.prototype.hasOwnProperty.call(${buildCheckInRHS(\n right,\n file,\n )}, ${t.cloneNode(id)})\n `);\n return;\n }\n\n const { id, static: isStatic } = privateNamesMap.get(name);\n\n if (isStatic) {\n path.replaceWith(\n template.expression.ast`${buildCheckInRHS(\n right,\n file,\n )} === ${t.cloneNode(this.classRef)}`,\n );\n return;\n }\n\n path.replaceWith(\n template.expression.ast`${t.cloneNode(id)}.has(${buildCheckInRHS(\n right,\n file,\n )})`,\n );\n },\n});\n\ninterface Receiver {\n receiver(\n this: HandlerState<PrivateNameState> & PrivateNameState,\n member: NodePath<t.MemberExpression | t.OptionalMemberExpression>,\n ): t.Expression;\n}\n\nconst privateNameHandlerSpec: Handler<PrivateNameState & Receiver> & Receiver =\n {\n memoise(member, count) {\n const { scope } = member;\n const { object } = member.node as { object: t.Expression };\n\n const memo = scope.maybeGenerateMemoised(object);\n if (!memo) {\n return;\n }\n\n this.memoiser.set(object, memo, count);\n },\n\n receiver(member) {\n const { object } = member.node as { object: t.Expression };\n\n if (this.memoiser.has(object)) {\n return t.cloneNode(this.memoiser.get(object));\n }\n\n return t.cloneNode(object);\n },\n\n get(member) {\n const { classRef, privateNamesMap, file, innerBinding } = this;\n const { name } = (member.node.property as t.PrivateName).id;\n const {\n id,\n static: isStatic,\n method: isMethod,\n methodId,\n getId,\n setId,\n } = privateNamesMap.get(name);\n const isAccessor = getId || setId;\n\n if (isStatic) {\n // NOTE: This package has a peerDependency on @babel/core@^7.0.0, but these\n // helpers have been introduced in @babel/helpers@7.1.0.\n const helperName =\n isMethod && !isAccessor\n ? \"classStaticPrivateMethodGet\"\n : \"classStaticPrivateFieldSpecGet\";\n\n // if there are any local variable shadowing classRef, unshadow it\n // see #12960\n unshadow(classRef.name, member.scope, innerBinding);\n\n return t.callExpression(file.addHelper(helperName), [\n this.receiver(member),\n t.cloneNode(classRef),\n t.cloneNode(id),\n ]);\n }\n\n if (isMethod) {\n if (isAccessor) {\n if (!getId && setId) {\n if (file.availableHelper(\"writeOnlyError\")) {\n return t.sequenceExpression([\n this.receiver(member),\n t.callExpression(file.addHelper(\"writeOnlyError\"), [\n t.stringLiteral(`#${name}`),\n ]),\n ]);\n }\n console.warn(\n `@babel/helpers is outdated, update it to silence this warning.`,\n );\n }\n return t.callExpression(file.addHelper(\"classPrivateFieldGet\"), [\n this.receiver(member),\n t.cloneNode(id),\n ]);\n }\n return t.callExpression(file.addHelper(\"classPrivateMethodGet\"), [\n this.receiver(member),\n t.cloneNode(id),\n t.cloneNode(methodId),\n ]);\n }\n return t.callExpression(file.addHelper(\"classPrivateFieldGet\"), [\n this.receiver(member),\n t.cloneNode(id),\n ]);\n },\n\n boundGet(member) {\n this.memoise(member, 1);\n\n return t.callExpression(\n t.memberExpression(this.get(member), t.identifier(\"bind\")),\n [this.receiver(member)],\n );\n },\n\n set(member, value) {\n const { classRef, privateNamesMap, file } = this;\n const { name } = (member.node.property as t.PrivateName).id;\n const {\n id,\n static: isStatic,\n method: isMethod,\n setId,\n getId,\n } = privateNamesMap.get(name);\n const isAccessor = getId || setId;\n\n if (isStatic) {\n const helperName =\n isMethod && !isAccessor\n ? \"classStaticPrivateMethodSet\"\n : \"classStaticPrivateFieldSpecSet\";\n\n return t.callExpression(file.addHelper(helperName), [\n this.receiver(member),\n t.cloneNode(classRef),\n t.cloneNode(id),\n value,\n ]);\n }\n if (isMethod) {\n if (setId) {\n return t.callExpression(file.addHelper(\"classPrivateFieldSet\"), [\n this.receiver(member),\n t.cloneNode(id),\n value,\n ]);\n }\n return t.sequenceExpression([\n this.receiver(member),\n value,\n t.callExpression(file.addHelper(\"readOnlyError\"), [\n t.stringLiteral(`#${name}`),\n ]),\n ]);\n }\n return t.callExpression(file.addHelper(\"classPrivateFieldSet\"), [\n this.receiver(member),\n t.cloneNode(id),\n value,\n ]);\n },\n\n destructureSet(member) {\n const { classRef, privateNamesMap, file } = this;\n const { name } = (member.node.property as t.PrivateName).id;\n const { id, static: isStatic } = privateNamesMap.get(name);\n if (isStatic) {\n try {\n // classStaticPrivateFieldDestructureSet was introduced in 7.13.10\n // eslint-disable-next-line no-var\n var helper = file.addHelper(\"classStaticPrivateFieldDestructureSet\");\n } catch {\n throw new Error(\n \"Babel can not transpile `[C.#p] = [0]` with @babel/helpers < 7.13.10, \\n\" +\n \"please update @babel/helpers to the latest version.\",\n );\n }\n return t.memberExpression(\n t.callExpression(helper, [\n this.receiver(member),\n t.cloneNode(classRef),\n t.cloneNode(id),\n ]),\n t.identifier(\"value\"),\n );\n }\n\n return t.memberExpression(\n t.callExpression(file.addHelper(\"classPrivateFieldDestructureSet\"), [\n this.receiver(member),\n t.cloneNode(id),\n ]),\n t.identifier(\"value\"),\n );\n },\n\n call(member, args: (t.Expression | t.SpreadElement)[]) {\n // The first access (the get) should do the memo assignment.\n this.memoise(member, 1);\n\n return optimiseCall(this.get(member), this.receiver(member), args, false);\n },\n\n optionalCall(member, args: (t.Expression | t.SpreadElement)[]) {\n this.memoise(member, 1);\n\n return optimiseCall(this.get(member), this.receiver(member), args, true);\n },\n\n delete() {\n throw new Error(\n \"Internal Babel error: deleting private elements is a parsing error.\",\n );\n },\n };\n\nconst privateNameHandlerLoose: Handler<PrivateNameState> = {\n get(member) {\n const { privateNamesMap, file } = this;\n const { object } = member.node;\n const { name } = (member.node.property as t.PrivateName).id;\n\n return template.expression`BASE(REF, PROP)[PROP]`({\n BASE: file.addHelper(\"classPrivateFieldLooseBase\"),\n REF: t.cloneNode(object),\n PROP: t.cloneNode(privateNamesMap.get(name).id),\n });\n },\n\n set() {\n // noop\n throw new Error(\"private name handler with loose = true don't need set()\");\n },\n\n boundGet(member) {\n return t.callExpression(\n t.memberExpression(this.get(member), t.identifier(\"bind\")),\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n [t.cloneNode(member.node.object as t.Expression)],\n );\n },\n\n simpleSet(member) {\n return this.get(member);\n },\n\n destructureSet(member) {\n return this.get(member);\n },\n\n call(member, args) {\n return t.callExpression(this.get(member), args);\n },\n\n optionalCall(member, args) {\n return t.optionalCallExpression(this.get(member), args, true);\n },\n\n delete() {\n throw new Error(\n \"Internal Babel error: deleting private elements is a parsing error.\",\n );\n },\n};\n\nexport function transformPrivateNamesUsage(\n ref: t.Identifier,\n path: NodePath<t.Class>,\n privateNamesMap: PrivateNamesMap,\n {\n privateFieldsAsProperties,\n noDocumentAll,\n innerBinding,\n }: {\n privateFieldsAsProperties: boolean;\n noDocumentAll: boolean;\n innerBinding: t.Identifier;\n },\n state: File,\n) {\n if (!privateNamesMap.size) return;\n\n const body = path.get(\"body\");\n const handler = privateFieldsAsProperties\n ? privateNameHandlerLoose\n : privateNameHandlerSpec;\n\n memberExpressionToFunctions<PrivateNameState>(body, privateNameVisitor, {\n privateNamesMap,\n classRef: ref,\n file: state,\n ...handler,\n noDocumentAll,\n innerBinding,\n });\n body.traverse(privateInVisitor, {\n privateNamesMap,\n classRef: ref,\n file: state,\n privateFieldsAsProperties,\n innerBinding,\n });\n}\n\nfunction buildPrivateFieldInitLoose(\n ref: t.Expression,\n prop: NodePath<t.ClassPrivateProperty>,\n privateNamesMap: PrivateNamesMap,\n) {\n const { id } = privateNamesMap.get(prop.node.key.id.name);\n const value = prop.node.value || prop.scope.buildUndefinedNode();\n\n return inheritPropComments(\n template.statement.ast`\n Object.defineProperty(${ref}, ${t.cloneNode(id)}, {\n // configurable is false by default\n // enumerable is false by default\n writable: true,\n value: ${value}\n });\n ` as t.ExpressionStatement,\n prop,\n );\n}\n\nfunction buildPrivateInstanceFieldInitSpec(\n ref: t.Expression,\n prop: NodePath<t.ClassPrivateProperty>,\n privateNamesMap: PrivateNamesMap,\n state: File,\n) {\n const { id } = privateNamesMap.get(prop.node.key.id.name);\n const value = prop.node.value || prop.scope.buildUndefinedNode();\n\n if (!process.env.BABEL_8_BREAKING) {\n if (!state.availableHelper(\"classPrivateFieldInitSpec\")) {\n return inheritPropComments(\n template.statement.ast`${t.cloneNode(id)}.set(${ref}, {\n // configurable is always false for private elements\n // enumerable is always false for private elements\n writable: true,\n value: ${value},\n })` as t.ExpressionStatement,\n prop,\n );\n }\n }\n\n const helper = state.addHelper(\"classPrivateFieldInitSpec\");\n return inheritPropComments(\n template.statement.ast`${helper}(\n ${t.thisExpression()},\n ${t.cloneNode(id)},\n {\n writable: true,\n value: ${value}\n },\n )` as t.ExpressionStatement,\n prop,\n );\n}\n\nfunction buildPrivateStaticFieldInitSpec(\n prop: NodePath<t.ClassPrivateProperty>,\n privateNamesMap: PrivateNamesMap,\n) {\n const privateName = privateNamesMap.get(prop.node.key.id.name);\n const { id, getId, setId, initAdded } = privateName;\n const isAccessor = getId || setId;\n\n if (!prop.isProperty() && (initAdded || !isAccessor)) return;\n\n if (isAccessor) {\n privateNamesMap.set(prop.node.key.id.name, {\n ...privateName,\n initAdded: true,\n });\n\n return inheritPropComments(\n template.statement.ast`\n var ${t.cloneNode(id)} = {\n // configurable is false by default\n // enumerable is false by default\n // writable is false by default\n get: ${getId ? getId.name : prop.scope.buildUndefinedNode()},\n set: ${setId ? setId.name : prop.scope.buildUndefinedNode()}\n }\n `,\n prop,\n );\n }\n\n const value = prop.node.value || prop.scope.buildUndefinedNode();\n return inheritPropComments(\n template.statement.ast`\n var ${t.cloneNode(id)} = {\n // configurable is false by default\n // enumerable is false by default\n writable: true,\n value: ${value}\n };\n `,\n prop,\n );\n}\n\nfunction buildPrivateMethodInitLoose(\n ref: t.Expression,\n prop: NodePath<t.ClassPrivateMethod>,\n privateNamesMap: PrivateNamesMap,\n) {\n const privateName = privateNamesMap.get(prop.node.key.id.name);\n const { methodId, id, getId, setId, initAdded } = privateName;\n if (initAdded) return;\n\n if (methodId) {\n return inheritPropComments(\n template.statement.ast`\n Object.defineProperty(${ref}, ${id}, {\n // configurable is false by default\n // enumerable is false by default\n // writable is false by default\n value: ${methodId.name}\n });\n ` as t.ExpressionStatement,\n prop,\n );\n }\n const isAccessor = getId || setId;\n if (isAccessor) {\n privateNamesMap.set(prop.node.key.id.name, {\n ...privateName,\n initAdded: true,\n });\n\n return inheritPropComments(\n template.statement.ast`\n Object.defineProperty(${ref}, ${id}, {\n // configurable is false by default\n // enumerable is false by default\n // writable is false by default\n get: ${getId ? getId.name : prop.scope.buildUndefinedNode()},\n set: ${setId ? setId.name : prop.scope.buildUndefinedNode()}\n });\n ` as t.ExpressionStatement,\n prop,\n );\n }\n}\n\nfunction buildPrivateInstanceMethodInitSpec(\n ref: t.Expression,\n prop: NodePath<t.ClassPrivateMethod>,\n privateNamesMap: PrivateNamesMap,\n state: File,\n) {\n const privateName = privateNamesMap.get(prop.node.key.id.name);\n const { getId, setId, initAdded } = privateName;\n\n if (initAdded) return;\n\n const isAccessor = getId || setId;\n if (isAccessor) {\n return buildPrivateAccessorInitialization(\n ref,\n prop,\n privateNamesMap,\n state,\n );\n }\n\n return buildPrivateInstanceMethodInitialization(\n ref,\n prop,\n privateNamesMap,\n state,\n );\n}\n\nfunction buildPrivateAccessorInitialization(\n ref: t.Expression,\n prop: NodePath<t.ClassPrivateMethod>,\n privateNamesMap: PrivateNamesMap,\n state: File,\n) {\n const privateName = privateNamesMap.get(prop.node.key.id.name);\n const { id, getId, setId } = privateName;\n\n privateNamesMap.set(prop.node.key.id.name, {\n ...privateName,\n initAdded: true,\n });\n\n if (!process.env.BABEL_8_BREAKING) {\n if (!state.availableHelper(\"classPrivateFieldInitSpec\")) {\n return inheritPropComments(\n template.statement.ast`\n ${id}.set(${ref}, {\n get: ${getId ? getId.name : prop.scope.buildUndefinedNode()},\n set: ${setId ? setId.name : prop.scope.buildUndefinedNode()}\n });\n ` as t.ExpressionStatement,\n prop,\n );\n }\n }\n\n const helper = state.addHelper(\"classPrivateFieldInitSpec\");\n return inheritPropComments(\n template.statement.ast`${helper}(\n ${t.thisExpression()},\n ${t.cloneNode(id)},\n {\n get: ${getId ? getId.name : prop.scope.buildUndefinedNode()},\n set: ${setId ? setId.name : prop.scope.buildUndefinedNode()}\n },\n )` as t.ExpressionStatement,\n prop,\n );\n}\n\nfunction buildPrivateInstanceMethodInitialization(\n ref: t.Expression,\n prop: NodePath<t.ClassPrivateMethod>,\n privateNamesMap: PrivateNamesMap,\n state: File,\n) {\n const privateName = privateNamesMap.get(prop.node.key.id.name);\n const { id } = privateName;\n\n if (!process.env.BABEL_8_BREAKING) {\n if (!state.availableHelper(\"classPrivateMethodInitSpec\")) {\n return inheritPropComments(\n template.statement.ast`${id}.add(${ref})` as t.ExpressionStatement,\n prop,\n );\n }\n }\n\n const helper = state.addHelper(\"classPrivateMethodInitSpec\");\n return inheritPropComments(\n template.statement.ast`${helper}(\n ${t.thisExpression()},\n ${t.cloneNode(id)}\n )` as t.ExpressionStatement,\n prop,\n );\n}\n\nfunction buildPublicFieldInitLoose(\n ref: t.Expression,\n prop: NodePath<t.ClassProperty>,\n) {\n const { key, computed } = prop.node;\n const value = prop.node.value || prop.scope.buildUndefinedNode();\n\n return inheritPropComments(\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.memberExpression(ref, key, computed || t.isLiteral(key)),\n value,\n ),\n ),\n prop,\n );\n}\n\nfunction buildPublicFieldInitSpec(\n ref: t.Expression,\n prop: NodePath<t.ClassProperty>,\n state: File,\n) {\n const { key, computed } = prop.node;\n const value = prop.node.value || prop.scope.buildUndefinedNode();\n\n return inheritPropComments(\n t.expressionStatement(\n t.callExpression(state.addHelper(\"defineProperty\"), [\n ref,\n computed || t.isLiteral(key)\n ? key\n : t.stringLiteral((key as t.Identifier).name),\n value,\n ]),\n ),\n prop,\n );\n}\n\nfunction buildPrivateStaticMethodInitLoose(\n ref: t.Expression,\n prop: NodePath<t.ClassPrivateMethod>,\n state: File,\n privateNamesMap: PrivateNamesMap,\n) {\n const privateName = privateNamesMap.get(prop.node.key.id.name);\n const { id, methodId, getId, setId, initAdded } = privateName;\n\n if (initAdded) return;\n\n const isAccessor = getId || setId;\n if (isAccessor) {\n privateNamesMap.set(prop.node.key.id.name, {\n ...privateName,\n initAdded: true,\n });\n\n return inheritPropComments(\n template.statement.ast`\n Object.defineProperty(${ref}, ${id}, {\n // configurable is false by default\n // enumerable is false by default\n // writable is false by default\n get: ${getId ? getId.name : prop.scope.buildUndefinedNode()},\n set: ${setId ? setId.name : prop.scope.buildUndefinedNode()}\n })\n `,\n prop,\n );\n }\n\n return inheritPropComments(\n template.statement.ast`\n Object.defineProperty(${ref}, ${id}, {\n // configurable is false by default\n // enumerable is false by default\n // writable is false by default\n value: ${methodId.name}\n });\n `,\n prop,\n );\n}\n\nfunction buildPrivateMethodDeclaration(\n prop: NodePath<t.ClassPrivateMethod>,\n privateNamesMap: PrivateNamesMap,\n privateFieldsAsProperties = false,\n) {\n const privateName = privateNamesMap.get(prop.node.key.id.name);\n const {\n id,\n methodId,\n getId,\n setId,\n getterDeclared,\n setterDeclared,\n static: isStatic,\n } = privateName;\n const { params, body, generator, async } = prop.node;\n const isGetter = getId && !getterDeclared && params.length === 0;\n const isSetter = setId && !setterDeclared && params.length > 0;\n\n let declId = methodId;\n\n if (isGetter) {\n privateNamesMap.set(prop.node.key.id.name, {\n ...privateName,\n getterDeclared: true,\n });\n declId = getId;\n } else if (isSetter) {\n privateNamesMap.set(prop.node.key.id.name, {\n ...privateName,\n setterDeclared: true,\n });\n declId = setId;\n } else if (isStatic && !privateFieldsAsProperties) {\n declId = id;\n }\n\n return inheritPropComments(\n t.functionDeclaration(\n t.cloneNode(declId),\n // @ts-expect-error params for ClassMethod has TSParameterProperty\n params,\n body,\n generator,\n async,\n ),\n prop,\n );\n}\n\ntype ReplaceThisState = {\n classRef: t.Identifier;\n needsClassRef: boolean;\n innerBinding: t.Identifier | null;\n};\n\ntype ReplaceInnerBindingReferenceState = ReplaceThisState;\n\nconst thisContextVisitor = traverse.visitors.merge<ReplaceThisState>([\n {\n UnaryExpression(path) {\n // Replace `delete this` with `true`\n const { node } = path;\n if (node.operator === \"delete\") {\n const argument = skipTransparentExprWrapperNodes(node.argument);\n if (t.isThisExpression(argument)) {\n path.replaceWith(t.booleanLiteral(true));\n }\n }\n },\n ThisExpression(path, state) {\n state.needsClassRef = true;\n path.replaceWith(t.cloneNode(state.classRef));\n },\n MetaProperty(path) {\n const { node, scope } = path;\n // if there are `new.target` in static field\n // we should replace it with `undefined`\n if (node.meta.name === \"new\" && node.property.name === \"target\") {\n path.replaceWith(scope.buildUndefinedNode());\n }\n },\n },\n environmentVisitor,\n]);\n\nconst innerReferencesVisitor: Visitor<ReplaceInnerBindingReferenceState> = {\n ReferencedIdentifier(path, state) {\n if (\n path.scope.bindingIdentifierEquals(path.node.name, state.innerBinding)\n ) {\n state.needsClassRef = true;\n path.node.name = state.classRef.name;\n }\n },\n};\n\nfunction replaceThisContext(\n path: PropPath,\n ref: t.Identifier,\n innerBindingRef: t.Identifier | null,\n) {\n const state: ReplaceThisState = {\n classRef: ref,\n needsClassRef: false,\n innerBinding: innerBindingRef,\n };\n if (!path.isMethod()) {\n // replace `this` in property initializers and static blocks\n path.traverse(thisContextVisitor, state);\n }\n\n // todo: use innerBinding.referencePaths to avoid full traversal\n if (\n innerBindingRef != null &&\n state.classRef?.name &&\n state.classRef.name !== innerBindingRef.name\n ) {\n path.traverse(innerReferencesVisitor, state);\n }\n\n return state.needsClassRef;\n}\n\nexport type PropNode =\n | t.ClassProperty\n | t.ClassPrivateMethod\n | t.ClassPrivateProperty\n | t.StaticBlock;\nexport type PropPath = NodePath<PropNode>;\n\nfunction isNameOrLength({ key, computed }: t.ClassProperty) {\n if (key.type === \"Identifier\") {\n return !computed && (key.name === \"name\" || key.name === \"length\");\n }\n if (key.type === \"StringLiteral\") {\n return key.value === \"name\" || key.value === \"length\";\n }\n return false;\n}\n\n/**\n * Inherit comments from class members. This is a reduced version of\n * t.inheritsComments: the trailing comments are not inherited because\n * for most class members except the last one, their trailing comments are\n * the next sibling's leading comments.\n *\n * @template T transformed class member type\n * @param {T} node transformed class member\n * @param {PropPath} prop class member\n * @returns transformed class member type with comments inherited\n */\nfunction inheritPropComments<T extends t.Node>(node: T, prop: PropPath) {\n t.inheritLeadingComments(node, prop.node);\n t.inheritInnerComments(node, prop.node);\n return node;\n}\n\n/**\n * ClassRefFlag records the requirement of the class binding reference.\n *\n * @enum {number}\n */\nconst enum ClassRefFlag {\n None,\n /**\n * When this flag is enabled, the binding reference can be the class id,\n * if exists, or the uid identifier generated for class expression. The\n * reference is safe to be consumed by [[Define]].\n */\n ForDefine = 1 << 0,\n /**\n * When this flag is enabled, the reference must be a uid, because the outer\n * class binding can be mutated by user codes.\n * E.g.\n * class C { static p = C }; const oldC = C; C = null; oldC.p;\n * we must memoize class `C` before defining the property `p`.\n */\n ForInnerBinding = 1 << 1,\n}\n\nexport function buildFieldsInitNodes(\n ref: t.Identifier | null,\n superRef: t.Expression | undefined,\n props: PropPath[],\n privateNamesMap: PrivateNamesMap,\n file: File,\n setPublicClassFields: boolean,\n privateFieldsAsProperties: boolean,\n constantSuper: boolean,\n innerBindingRef: t.Identifier | null,\n) {\n let classRefFlags = ClassRefFlag.None;\n let injectSuperRef: t.Identifier;\n const staticNodes: t.Statement[] = [];\n const instanceNodes: t.ExpressionStatement[] = [];\n let lastInstanceNodeReturnsThis = false;\n // These nodes are pure and can be moved to the closest statement position\n const pureStaticNodes: t.FunctionDeclaration[] = [];\n let classBindingNode: t.ExpressionStatement | null = null;\n\n const getSuperRef = t.isIdentifier(superRef)\n ? () => superRef\n : () => {\n injectSuperRef ??=\n props[0].scope.generateUidIdentifierBasedOnNode(superRef);\n return injectSuperRef;\n };\n\n const classRefForInnerBinding =\n ref ?? props[0].scope.generateUidIdentifier(\"class\");\n ref ??= t.cloneNode(innerBindingRef);\n\n for (const prop of props) {\n prop.isClassProperty() && ts.assertFieldTransformed(prop);\n\n // @ts-expect-error: TS doesn't infer that prop.node is not a StaticBlock\n const isStatic = !t.isStaticBlock?.(prop.node) && prop.node.static;\n const isInstance = !isStatic;\n const isPrivate = prop.isPrivate();\n const isPublic = !isPrivate;\n const isField = prop.isProperty();\n const isMethod = !isField;\n const isStaticBlock = prop.isStaticBlock?.();\n\n if (isStatic) classRefFlags |= ClassRefFlag.ForDefine;\n\n if (isStatic || (isMethod && isPrivate) || isStaticBlock) {\n new ReplaceSupers({\n methodPath: prop,\n constantSuper,\n file: file,\n refToPreserve: innerBindingRef,\n getSuperRef,\n getObjectRef() {\n classRefFlags |= ClassRefFlag.ForInnerBinding;\n if (isStatic || isStaticBlock) {\n return classRefForInnerBinding;\n } else {\n return t.memberExpression(\n classRefForInnerBinding,\n t.identifier(\"prototype\"),\n );\n }\n },\n }).replace();\n\n const replaced = replaceThisContext(\n prop,\n classRefForInnerBinding,\n innerBindingRef,\n );\n if (replaced) {\n classRefFlags |= ClassRefFlag.ForInnerBinding;\n }\n }\n\n lastInstanceNodeReturnsThis = false;\n\n // TODO(ts): there are so many `ts-expect-error` inside cases since\n // ts can not infer type from pre-computed values (or a case test)\n // even change `isStaticBlock` to `t.isStaticBlock(prop)` will not make prop\n // a `NodePath<t.StaticBlock>`\n // this maybe a bug for ts\n switch (true) {\n case isStaticBlock: {\n const blockBody = (prop.node as t.StaticBlock).body;\n // We special-case the single expression case to avoid the iife, since\n // it's common.\n if (blockBody.length === 1 && t.isExpressionStatement(blockBody[0])) {\n staticNodes.push(inheritPropComments(blockBody[0], prop));\n } else {\n staticNodes.push(\n t.inheritsComments(\n template.statement.ast`(() => { ${blockBody} })()`,\n prop.node,\n ),\n );\n }\n break;\n }\n case isStatic && isPrivate && isField && privateFieldsAsProperties:\n staticNodes.push(\n buildPrivateFieldInitLoose(t.cloneNode(ref), prop, privateNamesMap),\n );\n break;\n case isStatic && isPrivate && isField && !privateFieldsAsProperties:\n staticNodes.push(\n buildPrivateStaticFieldInitSpec(prop, privateNamesMap),\n );\n break;\n case isStatic && isPublic && isField && setPublicClassFields:\n // Functions always have non-writable .name and .length properties,\n // so we must always use [[Define]] for them.\n // It might still be possible to a computed static fields whose resulting\n // key is \"name\" or \"length\", but the assumption is telling us that it's\n // not going to happen.\n // @ts-expect-error checked in switch\n if (!isNameOrLength(prop.node)) {\n // @ts-expect-error checked in switch\n staticNodes.push(buildPublicFieldInitLoose(t.cloneNode(ref), prop));\n break;\n }\n // falls through\n case isStatic && isPublic && isField && !setPublicClassFields:\n staticNodes.push(\n // @ts-expect-error checked in switch\n buildPublicFieldInitSpec(t.cloneNode(ref), prop, file),\n );\n break;\n case isInstance && isPrivate && isField && privateFieldsAsProperties:\n instanceNodes.push(\n buildPrivateFieldInitLoose(t.thisExpression(), prop, privateNamesMap),\n );\n break;\n case isInstance && isPrivate && isField && !privateFieldsAsProperties:\n instanceNodes.push(\n buildPrivateInstanceFieldInitSpec(\n t.thisExpression(),\n prop,\n privateNamesMap,\n file,\n ),\n );\n break;\n case isInstance && isPrivate && isMethod && privateFieldsAsProperties:\n instanceNodes.unshift(\n buildPrivateMethodInitLoose(\n t.thisExpression(),\n // @ts-expect-error checked in switch\n prop,\n privateNamesMap,\n ),\n );\n pureStaticNodes.push(\n buildPrivateMethodDeclaration(\n // @ts-expect-error checked in switch\n prop,\n privateNamesMap,\n privateFieldsAsProperties,\n ),\n );\n break;\n case isInstance && isPrivate && isMethod && !privateFieldsAsProperties:\n instanceNodes.unshift(\n buildPrivateInstanceMethodInitSpec(\n t.thisExpression(),\n // @ts-expect-error checked in switch\n prop,\n privateNamesMap,\n file,\n ),\n );\n pureStaticNodes.push(\n buildPrivateMethodDeclaration(\n // @ts-expect-error checked in switch\n prop,\n privateNamesMap,\n privateFieldsAsProperties,\n ),\n );\n break;\n case isStatic && isPrivate && isMethod && !privateFieldsAsProperties:\n staticNodes.unshift(\n // @ts-expect-error checked in switch\n buildPrivateStaticFieldInitSpec(prop, privateNamesMap),\n );\n pureStaticNodes.push(\n buildPrivateMethodDeclaration(\n // @ts-expect-error checked in switch\n prop,\n privateNamesMap,\n privateFieldsAsProperties,\n ),\n );\n break;\n case isStatic && isPrivate && isMethod && privateFieldsAsProperties:\n staticNodes.unshift(\n buildPrivateStaticMethodInitLoose(\n t.cloneNode(ref),\n // @ts-expect-error checked in switch\n prop,\n file,\n privateNamesMap,\n ),\n );\n pureStaticNodes.push(\n buildPrivateMethodDeclaration(\n // @ts-expect-error checked in switch\n prop,\n privateNamesMap,\n privateFieldsAsProperties,\n ),\n );\n break;\n case isInstance && isPublic && isField && setPublicClassFields:\n // @ts-expect-error checked in switch\n instanceNodes.push(buildPublicFieldInitLoose(t.thisExpression(), prop));\n break;\n case isInstance && isPublic && isField && !setPublicClassFields:\n lastInstanceNodeReturnsThis = true;\n instanceNodes.push(\n // @ts-expect-error checked in switch\n buildPublicFieldInitSpec(t.thisExpression(), prop, file),\n );\n break;\n default:\n throw new Error(\"Unreachable.\");\n }\n }\n\n if (classRefFlags & ClassRefFlag.ForInnerBinding && innerBindingRef != null) {\n classBindingNode = t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.cloneNode(classRefForInnerBinding),\n t.cloneNode(innerBindingRef),\n ),\n );\n }\n\n return {\n staticNodes: staticNodes.filter(Boolean),\n instanceNodes: instanceNodes.filter(Boolean),\n lastInstanceNodeReturnsThis,\n pureStaticNodes: pureStaticNodes.filter(Boolean),\n classBindingNode,\n wrapClass(path: NodePath<t.Class>) {\n for (const prop of props) {\n // Delete leading comments so that they don't get attached as\n // trailing comments of the previous sibling.\n // When transforming props, we explicitly attach their leading\n // comments to the transformed node with `inheritPropComments`\n // above.\n prop.node.leadingComments = null;\n prop.remove();\n }\n\n if (injectSuperRef) {\n path.scope.push({ id: t.cloneNode(injectSuperRef) });\n path.set(\n \"superClass\",\n t.assignmentExpression(\"=\", injectSuperRef, path.node.superClass),\n );\n }\n\n if (classRefFlags !== ClassRefFlag.None) {\n if (path.isClassExpression()) {\n path.scope.push({ id: ref });\n path.replaceWith(\n t.assignmentExpression(\"=\", t.cloneNode(ref), path.node),\n );\n } else {\n if (innerBindingRef == null) {\n // export anonymous class declaration\n path.node.id = ref;\n }\n if (classBindingNode != null) {\n path.scope.push({ id: classRefForInnerBinding });\n }\n }\n }\n\n return path;\n },\n };\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAG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B,EAAE;QACvC,IAAI5H,IAAI,CAAC8J,iBAAiB,CAAC,CAAC,EAAE;UAC5B9J,IAAI,CAAC5C,KAAK,CAAC6B,IAAI,CAAC;YAAEjC,EAAE,EAAEkH;UAAI,CAAC,CAAC;UAC5BlE,IAAI,CAACkC,WAAW,CACd1D,WAAC,CAAC6G,oBAAoB,CAAC,GAAG,EAAE7G,WAAC,CAACC,SAAS,CAACyF,GAAG,CAAC,EAAElE,IAAI,CAAClD,IAAI,CACzD,CAAC;QACH,CAAC,MAAM;UACL,IAAIkK,eAAe,IAAI,IAAI,EAAE;YAE3BhH,IAAI,CAAClD,IAAI,CAACE,EAAE,GAAGkH,GAAG;UACpB;UACA,IAAIgE,gBAAgB,IAAI,IAAI,EAAE;YAC5BlI,IAAI,CAAC5C,KAAK,CAAC6B,IAAI,CAAC;cAAEjC,EAAE,EAAEuL;YAAwB,CAAC,CAAC;UAClD;QACF;MACF;MAEA,OAAOvI,IAAI;IACb;EACF,CAAC;AACH"}
\ No newline at end of file +{"version":3,"names":["_core","require","_helperReplaceSupers","_helperEnvironmentVisitor","_helperMemberExpressionToFunctions","_helperOptimiseCallExpression","_helperAnnotateAsPure","_helperSkipTransparentExpressionWrappers","ts","newHelpers","file","availableHelper","buildPrivateNamesMap","className","privateFieldsAsSymbolsOrProperties","props","privateNamesMap","Map","classBrandId","prop","isPrivate","name","node","key","id","update","get","isMethod","isProperty","isStatic","static","initAdded","_classBrandId","scope","generateUidIdentifier","method","set","isClassPrivateMethod","kind","body","$","length","t","isReturnStatement","isCallExpression","argument","arguments","isThisExpression","isIdentifier","callee","getId","cloneNode","getterDeclared","params","isExpressionStatement","expression","setId","setterDeclared","methodId","buildPrivateNamesNodes","privateFieldsAsProperties","privateFieldsAsSymbols","state","initNodes","injectedIds","Set","value","isGetterOrSetter","init","callExpression","addHelper","stringLiteral","identifier","has","add","newExpression","annotateAsPure","push","template","statement","ast","privateNameVisitorFactory","visitor","nestedVisitor","traverse","visitors","merge","Object","assign","environmentVisitor","privateNameVisitor","Class","path","visiblePrivateNames","redeclared","delete","skipKey","PrivateName","noDocumentAll","parentPath","isMemberExpression","property","isOptionalMemberExpression","includes","handle","unshadow","innerBinding","_scope","hasBinding","bindingIdentifierEquals","rename","parent","buildCheckInRHS","rhs","inRHSIsObject","privateInVisitor","BinaryExpression","operator","left","right","isPrivateName","classRef","replaceWith","readOnlyError","writeOnlyError","console","warn","buildUndefinedNode","buildStaticPrivateFieldAccess","expr","noUninitializedPrivateFieldAccess","memberExpression","privateNameHandlerSpec","memoise","member","count","object","memo","maybeGenerateMemoised","memoiser","receiver","helperName","skipCheck","err","sequenceExpression","boundGet","assignmentExpression","destructureSet","helper","_unused","Error","getCall","ref","pop","setCall","buildCodeFrameError","args","computed","arrayExpression","slice","call","optimiseCall","optionalCall","privateNameHandlerLoose","BASE","REF","PROP","simpleSet","optionalCallExpression","transformPrivateNamesUsage","size","handler","memberExpressionToFunctions","buildPrivateFieldInitLoose","inheritPropComments","buildPrivateInstanceFieldInitSpec","expressionStatement","thisExpression","buildPrivateStaticFieldInitSpec","privateName","variableDeclaration","variableDeclarator","buildPrivateStaticFieldInitSpecOld","buildPrivateMethodInitLoose","buildPrivateInstanceMethodInitSpec","buildPrivateAccessorInitialization","buildPrivateInstanceMethodInitialization","buildPublicFieldInitLoose","isLiteral","buildPublicFieldInitSpec","buildPrivateStaticMethodInitLoose","buildPrivateMethodDeclaration","generator","async","isGetter","isSetter","thisArg","thisRef","argumentsPath","thisContextVisitor","argumentsId","unshift","declId","functionDeclaration","Identifier","UnaryExpression","skipTransparentExprWrapperNodes","booleanLiteral","ThisExpression","needsClassRef","MetaProperty","meta","innerReferencesVisitor","ReferencedIdentifier","replaceThisContext","innerBindingRef","_state$thisRef","isNameOrLength","type","inheritLeadingComments","inheritInnerComments","buildFieldsInitNodes","superRef","setPublicClassFields","constantSuper","_ref","_ref2","classRefFlags","injectSuperRef","staticNodes","instanceNodes","lastInstanceNodeReturnsThis","pureStaticNodes","classBindingNode","getSuperRef","_injectSuperRef","generateUidIdentifierBasedOnNode","classRefForInnerBinding","isClassProperty","assertFieldTransformed","isStaticBlock","isInstance","isPublic","isField","ReplaceSupers","methodPath","refToPreserve","getObjectRef","replace","replaced","blockBody","inheritsComments","filter","Boolean","wrapClass","leadingComments","remove","superClass","isClassExpression"],"sources":["../src/fields.ts"],"sourcesContent":["import { template, traverse, types as t } from \"@babel/core\";\nimport type { File } from \"@babel/core\";\nimport type { NodePath, Visitor, Scope } from \"@babel/traverse\";\nimport ReplaceSupers from \"@babel/helper-replace-supers\";\nimport environmentVisitor from \"@babel/helper-environment-visitor\";\nimport memberExpressionToFunctions from \"@babel/helper-member-expression-to-functions\";\nimport type {\n Handler,\n HandlerState,\n} from \"@babel/helper-member-expression-to-functions\";\nimport optimiseCall from \"@babel/helper-optimise-call-expression\";\nimport annotateAsPure from \"@babel/helper-annotate-as-pure\";\nimport { skipTransparentExprWrapperNodes } from \"@babel/helper-skip-transparent-expression-wrappers\";\n\nimport * as ts from \"./typescript.ts\";\n\ninterface PrivateNameMetadata {\n id: t.Identifier;\n static: boolean;\n method: boolean;\n getId?: t.Identifier;\n setId?: t.Identifier;\n methodId?: t.Identifier;\n initAdded?: boolean;\n getterDeclared?: boolean;\n setterDeclared?: boolean;\n}\n\ntype PrivateNamesMapGeneric<V> = Map<string, V>;\n\ntype PrivateNamesMap = PrivateNamesMapGeneric<PrivateNameMetadata>;\n\nif (!process.env.BABEL_8_BREAKING) {\n // eslint-disable-next-line no-var\n var newHelpers = (file: File) => {\n if (!process.env.IS_PUBLISH) {\n const { comments } = file.ast;\n // This is needed for the test in\n // babel-plugin-transform-class-properties/test/fixtures/regression/old-helpers\n if (comments?.some(c => c.value.includes(\"@force-old-private-helpers\"))) {\n return false;\n }\n }\n return file.availableHelper(\"classPrivateFieldGet2\");\n };\n}\n\nexport function buildPrivateNamesMap(\n className: string,\n privateFieldsAsSymbolsOrProperties: boolean,\n props: PropPath[],\n file: File,\n) {\n const privateNamesMap: PrivateNamesMap = new Map();\n let classBrandId: t.Identifier;\n for (const prop of props) {\n if (prop.isPrivate()) {\n const { name } = prop.node.key.id;\n let update: PrivateNameMetadata = privateNamesMap.get(name);\n if (!update) {\n const isMethod = !prop.isProperty();\n const isStatic = prop.node.static;\n let initAdded = false;\n let id: t.Identifier;\n if (\n !privateFieldsAsSymbolsOrProperties &&\n (process.env.BABEL_8_BREAKING || newHelpers(file)) &&\n isMethod &&\n !isStatic\n ) {\n initAdded = !!classBrandId;\n classBrandId ??= prop.scope.generateUidIdentifier(\n `${className}_brand`,\n );\n id = classBrandId;\n } else {\n id = prop.scope.generateUidIdentifier(name);\n }\n update = { id, static: isStatic, method: isMethod, initAdded };\n privateNamesMap.set(name, update);\n }\n if (prop.isClassPrivateMethod()) {\n if (prop.node.kind === \"get\") {\n const { body } = prop.node.body;\n let $: t.Node;\n if (\n // If we have\n // get #foo() { return _some_fn(this); }\n // we can use _some_fn directly.\n body.length === 1 &&\n t.isReturnStatement(($ = body[0])) &&\n t.isCallExpression(($ = $.argument)) &&\n $.arguments.length === 1 &&\n t.isThisExpression($.arguments[0]) &&\n t.isIdentifier(($ = $.callee))\n ) {\n update.getId = t.cloneNode($);\n update.getterDeclared = true;\n } else {\n update.getId = prop.scope.generateUidIdentifier(`get_${name}`);\n }\n } else if (prop.node.kind === \"set\") {\n const { params } = prop.node;\n const { body } = prop.node.body;\n let $: t.Node;\n if (\n // If we have\n // set #foo(val) { _some_fn(this, val); }\n // we can use _some_fn directly.\n body.length === 1 &&\n t.isExpressionStatement(($ = body[0])) &&\n t.isCallExpression(($ = $.expression)) &&\n $.arguments.length === 2 &&\n t.isThisExpression($.arguments[0]) &&\n t.isIdentifier($.arguments[1], {\n name: (params[0] as t.Identifier).name,\n }) &&\n t.isIdentifier(($ = $.callee))\n ) {\n update.setId = t.cloneNode($);\n update.setterDeclared = true;\n } else {\n update.setId = prop.scope.generateUidIdentifier(`set_${name}`);\n }\n } else if (prop.node.kind === \"method\") {\n update.methodId = prop.scope.generateUidIdentifier(name);\n }\n }\n privateNamesMap.set(name, update);\n }\n }\n return privateNamesMap;\n}\n\nexport function buildPrivateNamesNodes(\n privateNamesMap: PrivateNamesMap,\n privateFieldsAsProperties: boolean,\n privateFieldsAsSymbols: boolean,\n state: File,\n) {\n const initNodes: t.Statement[] = [];\n\n const injectedIds = new Set<string>();\n\n for (const [name, value] of privateNamesMap) {\n // - When the privateFieldsAsProperties assumption is enabled,\n // both static and instance fields are transpiled using a\n // secret non-enumerable property. Hence, we also need to generate that\n // key (using the classPrivateFieldLooseKey helper).\n // - When the privateFieldsAsSymbols assumption is enabled,\n // both static and instance fields are transpiled using a\n // unique Symbol to define a non-enumerable property.\n // - In spec mode, only instance fields need a \"private name\" initializer\n // because static fields are directly assigned to a variable in the\n // buildPrivateStaticFieldInitSpec function.\n const { static: isStatic, method: isMethod, getId, setId } = value;\n const isGetterOrSetter = getId || setId;\n const id = t.cloneNode(value.id);\n\n let init: t.Expression;\n\n if (privateFieldsAsProperties) {\n init = t.callExpression(state.addHelper(\"classPrivateFieldLooseKey\"), [\n t.stringLiteral(name),\n ]);\n } else if (privateFieldsAsSymbols) {\n init = t.callExpression(t.identifier(\"Symbol\"), [t.stringLiteral(name)]);\n } else if (!isStatic) {\n if (injectedIds.has(id.name)) continue;\n injectedIds.add(id.name);\n\n init = t.newExpression(\n t.identifier(\n isMethod &&\n (process.env.BABEL_8_BREAKING ||\n !isGetterOrSetter ||\n newHelpers(state))\n ? \"WeakSet\"\n : \"WeakMap\",\n ),\n [],\n );\n }\n\n if (init) {\n if (!privateFieldsAsSymbols) {\n annotateAsPure(init);\n }\n initNodes.push(template.statement.ast`var ${id} = ${init}`);\n }\n }\n\n return initNodes;\n}\n\nexport interface PrivateNameVisitorState<V> {\n privateNamesMap: PrivateNamesMapGeneric<V>;\n redeclared?: string[];\n}\n\n// Traverses the class scope, handling private name references. If an inner\n// class redeclares the same private name, it will hand off traversal to the\n// restricted visitor (which doesn't traverse the inner class's inner scope).\nexport function privateNameVisitorFactory<S, V>(\n visitor: Visitor<PrivateNameVisitorState<V & PrivateNameMetadata> & S>,\n) {\n // Traverses the outer portion of a class, without touching the class's inner\n // scope, for private names.\n const nestedVisitor = traverse.visitors.merge([\n { ...visitor },\n environmentVisitor,\n ]);\n\n const privateNameVisitor: Visitor<\n PrivateNameVisitorState<V & PrivateNameMetadata> & S\n > = {\n ...visitor,\n\n Class(path) {\n const { privateNamesMap } = this;\n const body = path.get(\"body.body\");\n\n const visiblePrivateNames = new Map(privateNamesMap);\n const redeclared = [];\n for (const prop of body) {\n if (!prop.isPrivate()) continue;\n const { name } = prop.node.key.id;\n visiblePrivateNames.delete(name);\n redeclared.push(name);\n }\n\n // If the class doesn't redeclare any private fields, we can continue with\n // our overall traversal.\n if (!redeclared.length) {\n return;\n }\n\n // This class redeclares some private field. We need to process the outer\n // environment with access to all the outer privates, then we can process\n // the inner environment with only the still-visible outer privates.\n path.get(\"body\").traverse(nestedVisitor, {\n ...this,\n redeclared,\n });\n path.traverse(privateNameVisitor, {\n ...this,\n privateNamesMap: visiblePrivateNames,\n });\n\n // We'll eventually hit this class node again with the overall Class\n // Features visitor, which'll process the redeclared privates.\n path.skipKey(\"body\");\n },\n };\n\n return privateNameVisitor;\n}\n\ninterface PrivateNameState {\n privateNamesMap: PrivateNamesMap;\n classRef: t.Identifier;\n file: File;\n noDocumentAll: boolean;\n noUninitializedPrivateFieldAccess: boolean;\n innerBinding?: t.Identifier;\n}\n\nconst privateNameVisitor = privateNameVisitorFactory<\n HandlerState<PrivateNameState> & PrivateNameState,\n PrivateNameMetadata\n>({\n PrivateName(path, { noDocumentAll }) {\n const { privateNamesMap, redeclared } = this;\n const { node, parentPath } = path;\n\n if (\n !parentPath.isMemberExpression({ property: node }) &&\n !parentPath.isOptionalMemberExpression({ property: node })\n ) {\n return;\n }\n const { name } = node.id;\n if (!privateNamesMap.has(name)) return;\n if (redeclared && redeclared.includes(name)) return;\n\n this.handle(parentPath, noDocumentAll);\n },\n});\n\n// rename all bindings that shadows innerBinding\nfunction unshadow(\n name: string,\n scope: Scope,\n innerBinding: t.Identifier | undefined,\n) {\n // in some cases, scope.getBinding(name) === undefined\n // so we check hasBinding to avoid keeping looping\n // see: https://github.com/babel/babel/pull/13656#discussion_r686030715\n while (\n scope?.hasBinding(name) &&\n !scope.bindingIdentifierEquals(name, innerBinding)\n ) {\n scope.rename(name);\n scope = scope.parent;\n }\n}\n\nexport function buildCheckInRHS(\n rhs: t.Expression,\n file: File,\n inRHSIsObject?: boolean,\n) {\n if (inRHSIsObject || !file.availableHelper?.(\"checkInRHS\")) return rhs;\n return t.callExpression(file.addHelper(\"checkInRHS\"), [rhs]);\n}\n\nconst privateInVisitor = privateNameVisitorFactory<\n {\n classRef: t.Identifier;\n file: File;\n innerBinding?: t.Identifier;\n privateFieldsAsProperties: boolean;\n },\n PrivateNameMetadata\n>({\n BinaryExpression(path, { file }) {\n const { operator, left, right } = path.node;\n if (operator !== \"in\") return;\n if (!t.isPrivateName(left)) return;\n\n const { privateFieldsAsProperties, privateNamesMap, redeclared } = this;\n\n const { name } = left.id;\n\n if (!privateNamesMap.has(name)) return;\n if (redeclared && redeclared.includes(name)) return;\n\n // if there are any local variable shadowing classRef, unshadow it\n // see #12960\n unshadow(this.classRef.name, path.scope, this.innerBinding);\n\n if (privateFieldsAsProperties) {\n const { id } = privateNamesMap.get(name);\n path.replaceWith(template.expression.ast`\n Object.prototype.hasOwnProperty.call(${buildCheckInRHS(\n right,\n file,\n )}, ${t.cloneNode(id)})\n `);\n return;\n }\n\n const { id, static: isStatic } = privateNamesMap.get(name);\n\n if (isStatic) {\n path.replaceWith(\n template.expression.ast`${buildCheckInRHS(\n right,\n file,\n )} === ${t.cloneNode(this.classRef)}`,\n );\n return;\n }\n\n path.replaceWith(\n template.expression.ast`${t.cloneNode(id)}.has(${buildCheckInRHS(\n right,\n file,\n )})`,\n );\n },\n});\n\ninterface Receiver {\n receiver(\n this: HandlerState<PrivateNameState> & PrivateNameState,\n member: NodePath<t.MemberExpression | t.OptionalMemberExpression>,\n ): t.Expression;\n}\n\nfunction readOnlyError(file: File, name: string) {\n return t.callExpression(file.addHelper(\"readOnlyError\"), [\n t.stringLiteral(`#${name}`),\n ]);\n}\n\nfunction writeOnlyError(file: File, name: string) {\n if (\n !process.env.BABEL_8_BREAKING &&\n !file.availableHelper(\"writeOnlyError\")\n ) {\n console.warn(\n `@babel/helpers is outdated, update it to silence this warning.`,\n );\n return t.buildUndefinedNode();\n }\n return t.callExpression(file.addHelper(\"writeOnlyError\"), [\n t.stringLiteral(`#${name}`),\n ]);\n}\n\nfunction buildStaticPrivateFieldAccess<N extends t.Expression>(\n expr: N,\n noUninitializedPrivateFieldAccess: boolean,\n) {\n if (noUninitializedPrivateFieldAccess) return expr;\n return t.memberExpression(expr, t.identifier(\"_\"));\n}\n\nconst privateNameHandlerSpec: Handler<PrivateNameState & Receiver> & Receiver =\n {\n memoise(member, count) {\n const { scope } = member;\n const { object } = member.node as { object: t.Expression };\n\n const memo = scope.maybeGenerateMemoised(object);\n if (!memo) {\n return;\n }\n\n this.memoiser.set(object, memo, count);\n },\n\n receiver(member) {\n const { object } = member.node as { object: t.Expression };\n\n if (this.memoiser.has(object)) {\n return t.cloneNode(this.memoiser.get(object));\n }\n\n return t.cloneNode(object);\n },\n\n get(member) {\n const {\n classRef,\n privateNamesMap,\n file,\n innerBinding,\n noUninitializedPrivateFieldAccess,\n } = this;\n const { name } = (member.node.property as t.PrivateName).id;\n const {\n id,\n static: isStatic,\n method: isMethod,\n methodId,\n getId,\n setId,\n } = privateNamesMap.get(name);\n const isGetterOrSetter = getId || setId;\n\n if (isStatic) {\n // if there are any local variable shadowing classRef, unshadow it\n // see #12960\n unshadow(classRef.name, member.scope, innerBinding);\n\n if (!process.env.BABEL_8_BREAKING && !newHelpers(file)) {\n // NOTE: This package has a peerDependency on @babel/core@^7.0.0, but these\n // helpers have been introduced in @babel/helpers@7.1.0.\n const helperName =\n isMethod && !isGetterOrSetter\n ? \"classStaticPrivateMethodGet\"\n : \"classStaticPrivateFieldSpecGet\";\n\n return t.callExpression(file.addHelper(helperName), [\n this.receiver(member),\n t.cloneNode(classRef),\n t.cloneNode(id),\n ]);\n }\n\n const receiver = this.receiver(member);\n const skipCheck =\n t.isIdentifier(receiver) && receiver.name === classRef.name;\n\n if (!isMethod) {\n if (skipCheck) {\n return buildStaticPrivateFieldAccess(\n t.cloneNode(id),\n noUninitializedPrivateFieldAccess,\n );\n }\n\n return buildStaticPrivateFieldAccess(\n t.callExpression(file.addHelper(\"assertClassBrand\"), [\n t.cloneNode(classRef),\n receiver,\n t.cloneNode(id),\n ]),\n noUninitializedPrivateFieldAccess,\n );\n }\n\n if (getId) {\n if (skipCheck) {\n return t.callExpression(t.cloneNode(getId), [receiver]);\n }\n return t.callExpression(file.addHelper(\"classPrivateGetter\"), [\n t.cloneNode(classRef),\n receiver,\n t.cloneNode(getId),\n ]);\n }\n\n if (setId) {\n const err = t.buildUndefinedNode(); // TODO: writeOnlyError(file, name)\n if (skipCheck) return err;\n return t.sequenceExpression([\n t.callExpression(file.addHelper(\"assertClassBrand\"), [\n t.cloneNode(classRef),\n receiver,\n ]),\n err,\n ]);\n }\n\n if (skipCheck) return t.cloneNode(id);\n return t.callExpression(file.addHelper(\"assertClassBrand\"), [\n t.cloneNode(classRef),\n receiver,\n t.cloneNode(id),\n ]);\n }\n\n if (isMethod) {\n if (isGetterOrSetter) {\n if (!getId) {\n return t.sequenceExpression([\n this.receiver(member),\n writeOnlyError(file, name),\n ]);\n }\n if (!process.env.BABEL_8_BREAKING && !newHelpers(file)) {\n return t.callExpression(file.addHelper(\"classPrivateFieldGet\"), [\n this.receiver(member),\n t.cloneNode(id),\n ]);\n }\n return t.callExpression(file.addHelper(\"classPrivateGetter\"), [\n t.cloneNode(id),\n this.receiver(member),\n t.cloneNode(getId),\n ]);\n }\n if (!process.env.BABEL_8_BREAKING && !newHelpers(file)) {\n return t.callExpression(file.addHelper(\"classPrivateMethodGet\"), [\n this.receiver(member),\n t.cloneNode(id),\n t.cloneNode(methodId),\n ]);\n }\n return t.callExpression(file.addHelper(\"assertClassBrand\"), [\n t.cloneNode(id),\n this.receiver(member),\n t.cloneNode(methodId),\n ]);\n }\n if (process.env.BABEL_8_BREAKING || newHelpers(file)) {\n return t.callExpression(file.addHelper(\"classPrivateFieldGet2\"), [\n t.cloneNode(id),\n this.receiver(member),\n ]);\n }\n\n return t.callExpression(file.addHelper(\"classPrivateFieldGet\"), [\n this.receiver(member),\n t.cloneNode(id),\n ]);\n },\n\n boundGet(member) {\n this.memoise(member, 1);\n\n return t.callExpression(\n t.memberExpression(this.get(member), t.identifier(\"bind\")),\n [this.receiver(member)],\n );\n },\n\n set(member, value) {\n const {\n classRef,\n privateNamesMap,\n file,\n noUninitializedPrivateFieldAccess,\n } = this;\n const { name } = (member.node.property as t.PrivateName).id;\n const {\n id,\n static: isStatic,\n method: isMethod,\n setId,\n getId,\n } = privateNamesMap.get(name);\n const isGetterOrSetter = getId || setId;\n\n if (isStatic) {\n if (!process.env.BABEL_8_BREAKING && !newHelpers(file)) {\n const helperName =\n isMethod && !isGetterOrSetter\n ? \"classStaticPrivateMethodSet\"\n : \"classStaticPrivateFieldSpecSet\";\n\n return t.callExpression(file.addHelper(helperName), [\n this.receiver(member),\n t.cloneNode(classRef),\n t.cloneNode(id),\n value,\n ]);\n }\n\n const receiver = this.receiver(member);\n const skipCheck =\n t.isIdentifier(receiver) && receiver.name === classRef.name;\n\n if (isMethod && !setId) {\n const err = readOnlyError(file, name);\n if (skipCheck) return t.sequenceExpression([value, err]);\n return t.sequenceExpression([\n value,\n t.callExpression(file.addHelper(\"assertClassBrand\"), [\n t.cloneNode(classRef),\n receiver,\n ]),\n readOnlyError(file, name),\n ]);\n }\n\n if (setId) {\n if (skipCheck) {\n return t.callExpression(t.cloneNode(setId), [receiver, value]);\n }\n return t.callExpression(file.addHelper(\"classPrivateSetter\"), [\n t.cloneNode(classRef),\n t.cloneNode(setId),\n receiver,\n value,\n ]);\n }\n return t.assignmentExpression(\n \"=\",\n buildStaticPrivateFieldAccess(\n t.cloneNode(id),\n noUninitializedPrivateFieldAccess,\n ),\n skipCheck\n ? value\n : t.callExpression(file.addHelper(\"assertClassBrand\"), [\n t.cloneNode(classRef),\n receiver,\n value,\n ]),\n );\n }\n if (isMethod) {\n if (setId) {\n if (!process.env.BABEL_8_BREAKING && !newHelpers(file)) {\n return t.callExpression(file.addHelper(\"classPrivateFieldSet\"), [\n this.receiver(member),\n t.cloneNode(id),\n value,\n ]);\n }\n return t.callExpression(file.addHelper(\"classPrivateSetter\"), [\n t.cloneNode(id),\n t.cloneNode(setId),\n this.receiver(member),\n value,\n ]);\n }\n return t.sequenceExpression([\n this.receiver(member),\n value,\n readOnlyError(file, name),\n ]);\n }\n\n if (process.env.BABEL_8_BREAKING || newHelpers(file)) {\n return t.callExpression(file.addHelper(\"classPrivateFieldSet2\"), [\n t.cloneNode(id),\n this.receiver(member),\n value,\n ]);\n }\n\n return t.callExpression(file.addHelper(\"classPrivateFieldSet\"), [\n this.receiver(member),\n t.cloneNode(id),\n value,\n ]);\n },\n\n destructureSet(member) {\n const {\n classRef,\n privateNamesMap,\n file,\n noUninitializedPrivateFieldAccess,\n } = this;\n const { name } = (member.node.property as t.PrivateName).id;\n const {\n id,\n static: isStatic,\n method: isMethod,\n setId,\n } = privateNamesMap.get(name);\n\n if (!process.env.BABEL_8_BREAKING && !newHelpers(file)) {\n if (isStatic) {\n try {\n // classStaticPrivateFieldDestructureSet was introduced in 7.13.10\n // eslint-disable-next-line no-var\n var helper = file.addHelper(\n \"classStaticPrivateFieldDestructureSet\",\n );\n } catch {\n throw new Error(\n \"Babel can not transpile `[C.#p] = [0]` with @babel/helpers < 7.13.10, \\n\" +\n \"please update @babel/helpers to the latest version.\",\n );\n }\n return t.memberExpression(\n t.callExpression(helper, [\n this.receiver(member),\n t.cloneNode(classRef),\n t.cloneNode(id),\n ]),\n t.identifier(\"value\"),\n );\n }\n\n return t.memberExpression(\n t.callExpression(file.addHelper(\"classPrivateFieldDestructureSet\"), [\n this.receiver(member),\n t.cloneNode(id),\n ]),\n t.identifier(\"value\"),\n );\n }\n\n if (isMethod && !setId) {\n return t.memberExpression(\n t.sequenceExpression([\n // @ts-ignore(Babel 7 vs Babel 8) member.node.object is not t.Super\n member.node.object,\n readOnlyError(file, name),\n ]),\n t.identifier(\"_\"),\n );\n }\n\n if (isStatic && !isMethod) {\n const getCall = this.get(member);\n if (\n !noUninitializedPrivateFieldAccess ||\n !t.isCallExpression(getCall)\n ) {\n return getCall;\n }\n const ref = getCall.arguments.pop();\n getCall.arguments.push(template.expression.ast`(_) => ${ref} = _`);\n return t.memberExpression(\n t.callExpression(file.addHelper(\"toSetter\"), [getCall]),\n t.identifier(\"_\"),\n );\n }\n\n const setCall = this.set(member, t.identifier(\"_\"));\n if (\n !t.isCallExpression(setCall) ||\n !t.isIdentifier(setCall.arguments[setCall.arguments.length - 1], {\n name: \"_\",\n })\n ) {\n throw member.buildCodeFrameError(\n \"Internal Babel error while compiling this code. This is a Babel bug. \" +\n \"Please report it at https://github.com/babel/babel/issues.\",\n );\n }\n\n // someHelper(foo, bar, _) -> someHelper, [foo, bar]\n // aFn.call(foo, bar, _) -> aFn, [bar], foo\n let args: t.Expression[];\n if (\n t.isMemberExpression(setCall.callee, { computed: false }) &&\n t.isIdentifier(setCall.callee.property) &&\n setCall.callee.property.name === \"call\"\n ) {\n args = [\n // @ts-ignore(Babel 7 vs Babel 8) member.node.object is not t.Super\n setCall.callee.object,\n t.arrayExpression(\n // Remove '_'\n (setCall.arguments as t.Expression[]).slice(1, -1),\n ),\n setCall.arguments[0] as t.Expression,\n ];\n } else {\n args = [\n setCall.callee as t.Expression,\n t.arrayExpression(\n // Remove '_'\n (setCall.arguments as t.Expression[]).slice(0, -1),\n ),\n ];\n }\n\n return t.memberExpression(\n t.callExpression(file.addHelper(\"toSetter\"), args),\n t.identifier(\"_\"),\n );\n },\n\n call(member, args: (t.Expression | t.SpreadElement)[]) {\n // The first access (the get) should do the memo assignment.\n this.memoise(member, 1);\n\n return optimiseCall(this.get(member), this.receiver(member), args, false);\n },\n\n optionalCall(member, args: (t.Expression | t.SpreadElement)[]) {\n this.memoise(member, 1);\n\n return optimiseCall(this.get(member), this.receiver(member), args, true);\n },\n\n delete() {\n throw new Error(\n \"Internal Babel error: deleting private elements is a parsing error.\",\n );\n },\n };\n\nconst privateNameHandlerLoose: Handler<PrivateNameState> = {\n get(member) {\n const { privateNamesMap, file } = this;\n const { object } = member.node;\n const { name } = (member.node.property as t.PrivateName).id;\n\n return template.expression`BASE(REF, PROP)[PROP]`({\n BASE: file.addHelper(\"classPrivateFieldLooseBase\"),\n REF: t.cloneNode(object),\n PROP: t.cloneNode(privateNamesMap.get(name).id),\n });\n },\n\n set() {\n // noop\n throw new Error(\"private name handler with loose = true don't need set()\");\n },\n\n boundGet(member) {\n return t.callExpression(\n t.memberExpression(this.get(member), t.identifier(\"bind\")),\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n [t.cloneNode(member.node.object as t.Expression)],\n );\n },\n\n simpleSet(member) {\n return this.get(member);\n },\n\n destructureSet(member) {\n return this.get(member);\n },\n\n call(member, args) {\n return t.callExpression(this.get(member), args);\n },\n\n optionalCall(member, args) {\n return t.optionalCallExpression(this.get(member), args, true);\n },\n\n delete() {\n throw new Error(\n \"Internal Babel error: deleting private elements is a parsing error.\",\n );\n },\n};\n\nexport function transformPrivateNamesUsage(\n ref: t.Identifier,\n path: NodePath<t.Class>,\n privateNamesMap: PrivateNamesMap,\n {\n privateFieldsAsProperties,\n noUninitializedPrivateFieldAccess,\n noDocumentAll,\n innerBinding,\n }: {\n privateFieldsAsProperties: boolean;\n noUninitializedPrivateFieldAccess: boolean;\n noDocumentAll: boolean;\n innerBinding: t.Identifier;\n },\n state: File,\n) {\n if (!privateNamesMap.size) return;\n\n const body = path.get(\"body\");\n const handler = privateFieldsAsProperties\n ? privateNameHandlerLoose\n : privateNameHandlerSpec;\n\n memberExpressionToFunctions<PrivateNameState>(body, privateNameVisitor, {\n privateNamesMap,\n classRef: ref,\n file: state,\n ...handler,\n noDocumentAll,\n noUninitializedPrivateFieldAccess,\n innerBinding,\n });\n body.traverse(privateInVisitor, {\n privateNamesMap,\n classRef: ref,\n file: state,\n privateFieldsAsProperties,\n innerBinding,\n });\n}\n\nfunction buildPrivateFieldInitLoose(\n ref: t.Expression,\n prop: NodePath<t.ClassPrivateProperty>,\n privateNamesMap: PrivateNamesMap,\n) {\n const { id } = privateNamesMap.get(prop.node.key.id.name);\n const value = prop.node.value || prop.scope.buildUndefinedNode();\n\n return inheritPropComments(\n template.statement.ast`\n Object.defineProperty(${ref}, ${t.cloneNode(id)}, {\n // configurable is false by default\n // enumerable is false by default\n writable: true,\n value: ${value}\n });\n ` as t.ExpressionStatement,\n prop,\n );\n}\n\nfunction buildPrivateInstanceFieldInitSpec(\n ref: t.Expression,\n prop: NodePath<t.ClassPrivateProperty>,\n privateNamesMap: PrivateNamesMap,\n state: File,\n) {\n const { id } = privateNamesMap.get(prop.node.key.id.name);\n const value = prop.node.value || prop.scope.buildUndefinedNode();\n\n if (!process.env.BABEL_8_BREAKING) {\n if (!state.availableHelper(\"classPrivateFieldInitSpec\")) {\n return inheritPropComments(\n template.statement.ast`${t.cloneNode(id)}.set(${ref}, {\n // configurable is always false for private elements\n // enumerable is always false for private elements\n writable: true,\n value: ${value},\n })` as t.ExpressionStatement,\n prop,\n );\n }\n }\n\n const helper = state.addHelper(\"classPrivateFieldInitSpec\");\n return inheritPropComments(\n t.expressionStatement(\n t.callExpression(helper, [\n t.thisExpression(),\n t.cloneNode(id),\n process.env.BABEL_8_BREAKING || newHelpers(state)\n ? value\n : template.expression.ast`{ writable: true, value: ${value} }`,\n ]),\n ),\n prop,\n );\n}\n\nfunction buildPrivateStaticFieldInitSpec(\n prop: NodePath<t.ClassPrivateProperty>,\n privateNamesMap: PrivateNamesMap,\n noUninitializedPrivateFieldAccess: boolean,\n) {\n const privateName = privateNamesMap.get(prop.node.key.id.name);\n\n const value = noUninitializedPrivateFieldAccess\n ? prop.node.value\n : template.expression.ast`{\n _: ${prop.node.value || t.buildUndefinedNode()}\n }`;\n\n return inheritPropComments(\n t.variableDeclaration(\"var\", [\n t.variableDeclarator(t.cloneNode(privateName.id), value),\n ]),\n prop,\n );\n}\n\nif (!process.env.BABEL_8_BREAKING) {\n // eslint-disable-next-line no-var\n var buildPrivateStaticFieldInitSpecOld = function (\n prop: NodePath<t.ClassPrivateProperty>,\n privateNamesMap: PrivateNamesMap,\n ) {\n const privateName = privateNamesMap.get(prop.node.key.id.name);\n const { id, getId, setId, initAdded } = privateName;\n const isGetterOrSetter = getId || setId;\n\n if (!prop.isProperty() && (initAdded || !isGetterOrSetter)) return;\n\n if (isGetterOrSetter) {\n privateNamesMap.set(prop.node.key.id.name, {\n ...privateName,\n initAdded: true,\n });\n\n return inheritPropComments(\n template.statement.ast`\n var ${t.cloneNode(id)} = {\n // configurable is false by default\n // enumerable is false by default\n // writable is false by default\n get: ${getId ? getId.name : prop.scope.buildUndefinedNode()},\n set: ${setId ? setId.name : prop.scope.buildUndefinedNode()}\n }\n `,\n prop,\n );\n }\n\n const value = prop.node.value || prop.scope.buildUndefinedNode();\n return inheritPropComments(\n template.statement.ast`\n var ${t.cloneNode(id)} = {\n // configurable is false by default\n // enumerable is false by default\n writable: true,\n value: ${value}\n };\n `,\n prop,\n );\n };\n}\n\nfunction buildPrivateMethodInitLoose(\n ref: t.Expression,\n prop: NodePath<t.ClassPrivateMethod>,\n privateNamesMap: PrivateNamesMap,\n) {\n const privateName = privateNamesMap.get(prop.node.key.id.name);\n const { methodId, id, getId, setId, initAdded } = privateName;\n if (initAdded) return;\n\n if (methodId) {\n return inheritPropComments(\n template.statement.ast`\n Object.defineProperty(${ref}, ${id}, {\n // configurable is false by default\n // enumerable is false by default\n // writable is false by default\n value: ${methodId.name}\n });\n ` as t.ExpressionStatement,\n prop,\n );\n }\n const isGetterOrSetter = getId || setId;\n if (isGetterOrSetter) {\n privateNamesMap.set(prop.node.key.id.name, {\n ...privateName,\n initAdded: true,\n });\n\n return inheritPropComments(\n template.statement.ast`\n Object.defineProperty(${ref}, ${id}, {\n // configurable is false by default\n // enumerable is false by default\n // writable is false by default\n get: ${getId ? getId.name : prop.scope.buildUndefinedNode()},\n set: ${setId ? setId.name : prop.scope.buildUndefinedNode()}\n });\n ` as t.ExpressionStatement,\n prop,\n );\n }\n}\n\nfunction buildPrivateInstanceMethodInitSpec(\n ref: t.Expression,\n prop: NodePath<t.ClassPrivateMethod>,\n privateNamesMap: PrivateNamesMap,\n state: File,\n) {\n const privateName = privateNamesMap.get(prop.node.key.id.name);\n\n if (privateName.initAdded) return;\n\n if (!process.env.BABEL_8_BREAKING && !newHelpers(state)) {\n const isGetterOrSetter = privateName.getId || privateName.setId;\n if (isGetterOrSetter) {\n return buildPrivateAccessorInitialization(\n ref,\n prop,\n privateNamesMap,\n state,\n );\n }\n }\n\n return buildPrivateInstanceMethodInitialization(\n ref,\n prop,\n privateNamesMap,\n state,\n );\n}\n\nfunction buildPrivateAccessorInitialization(\n ref: t.Expression,\n prop: NodePath<t.ClassPrivateMethod>,\n privateNamesMap: PrivateNamesMap,\n state: File,\n) {\n const privateName = privateNamesMap.get(prop.node.key.id.name);\n const { id, getId, setId } = privateName;\n\n privateNamesMap.set(prop.node.key.id.name, {\n ...privateName,\n initAdded: true,\n });\n\n if (!process.env.BABEL_8_BREAKING) {\n if (!state.availableHelper(\"classPrivateFieldInitSpec\")) {\n return inheritPropComments(\n template.statement.ast`\n ${id}.set(${ref}, {\n get: ${getId ? getId.name : prop.scope.buildUndefinedNode()},\n set: ${setId ? setId.name : prop.scope.buildUndefinedNode()}\n });\n ` as t.ExpressionStatement,\n prop,\n );\n }\n }\n\n const helper = state.addHelper(\"classPrivateFieldInitSpec\");\n return inheritPropComments(\n template.statement.ast`${helper}(\n ${t.thisExpression()},\n ${t.cloneNode(id)},\n {\n get: ${getId ? getId.name : prop.scope.buildUndefinedNode()},\n set: ${setId ? setId.name : prop.scope.buildUndefinedNode()}\n },\n )` as t.ExpressionStatement,\n prop,\n );\n}\n\nfunction buildPrivateInstanceMethodInitialization(\n ref: t.Expression,\n prop: NodePath<t.ClassPrivateMethod>,\n privateNamesMap: PrivateNamesMap,\n state: File,\n) {\n const privateName = privateNamesMap.get(prop.node.key.id.name);\n const { id } = privateName;\n\n if (!process.env.BABEL_8_BREAKING) {\n if (!state.availableHelper(\"classPrivateMethodInitSpec\")) {\n return inheritPropComments(\n template.statement.ast`${id}.add(${ref})` as t.ExpressionStatement,\n prop,\n );\n }\n }\n\n const helper = state.addHelper(\"classPrivateMethodInitSpec\");\n return inheritPropComments(\n template.statement.ast`${helper}(\n ${t.thisExpression()},\n ${t.cloneNode(id)}\n )` as t.ExpressionStatement,\n prop,\n );\n}\n\nfunction buildPublicFieldInitLoose(\n ref: t.Expression,\n prop: NodePath<t.ClassProperty>,\n) {\n const { key, computed } = prop.node;\n const value = prop.node.value || prop.scope.buildUndefinedNode();\n\n return inheritPropComments(\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.memberExpression(ref, key, computed || t.isLiteral(key)),\n value,\n ),\n ),\n prop,\n );\n}\n\nfunction buildPublicFieldInitSpec(\n ref: t.Expression,\n prop: NodePath<t.ClassProperty>,\n state: File,\n) {\n const { key, computed } = prop.node;\n const value = prop.node.value || prop.scope.buildUndefinedNode();\n\n return inheritPropComments(\n t.expressionStatement(\n t.callExpression(state.addHelper(\"defineProperty\"), [\n ref,\n computed || t.isLiteral(key)\n ? key\n : t.stringLiteral((key as t.Identifier).name),\n value,\n ]),\n ),\n prop,\n );\n}\n\nfunction buildPrivateStaticMethodInitLoose(\n ref: t.Expression,\n prop: NodePath<t.ClassPrivateMethod>,\n state: File,\n privateNamesMap: PrivateNamesMap,\n) {\n const privateName = privateNamesMap.get(prop.node.key.id.name);\n const { id, methodId, getId, setId, initAdded } = privateName;\n\n if (initAdded) return;\n\n const isGetterOrSetter = getId || setId;\n if (isGetterOrSetter) {\n privateNamesMap.set(prop.node.key.id.name, {\n ...privateName,\n initAdded: true,\n });\n\n return inheritPropComments(\n template.statement.ast`\n Object.defineProperty(${ref}, ${id}, {\n // configurable is false by default\n // enumerable is false by default\n // writable is false by default\n get: ${getId ? getId.name : prop.scope.buildUndefinedNode()},\n set: ${setId ? setId.name : prop.scope.buildUndefinedNode()}\n })\n `,\n prop,\n );\n }\n\n return inheritPropComments(\n template.statement.ast`\n Object.defineProperty(${ref}, ${id}, {\n // configurable is false by default\n // enumerable is false by default\n // writable is false by default\n value: ${methodId.name}\n });\n `,\n prop,\n );\n}\n\nfunction buildPrivateMethodDeclaration(\n file: File,\n prop: NodePath<t.ClassPrivateMethod>,\n privateNamesMap: PrivateNamesMap,\n privateFieldsAsSymbolsOrProperties = false,\n) {\n const privateName = privateNamesMap.get(prop.node.key.id.name);\n const {\n id,\n methodId,\n getId,\n setId,\n getterDeclared,\n setterDeclared,\n static: isStatic,\n } = privateName;\n const { params, body, generator, async } = prop.node;\n const isGetter = getId && params.length === 0;\n const isSetter = setId && params.length > 0;\n\n if ((isGetter && getterDeclared) || (isSetter && setterDeclared)) {\n privateNamesMap.set(prop.node.key.id.name, {\n ...privateName,\n initAdded: true,\n });\n return null;\n }\n\n if (\n (process.env.BABEL_8_BREAKING || newHelpers(file)) &&\n (isGetter || isSetter) &&\n !privateFieldsAsSymbolsOrProperties\n ) {\n const scope = prop.get(\"body\").scope;\n const thisArg = scope.generateUidIdentifier(\"this\");\n const state: ReplaceThisState = {\n thisRef: thisArg,\n argumentsPath: [],\n };\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n prop.traverse(thisContextVisitor, state);\n if (state.argumentsPath.length) {\n const argumentsId = scope.generateUidIdentifier(\"arguments\");\n scope.push({\n id: argumentsId,\n init: template.expression.ast`[].slice.call(arguments, 1)`,\n });\n for (const path of state.argumentsPath) {\n path.replaceWith(t.cloneNode(argumentsId));\n }\n }\n\n params.unshift(t.cloneNode(thisArg));\n }\n\n let declId = methodId;\n\n if (isGetter) {\n privateNamesMap.set(prop.node.key.id.name, {\n ...privateName,\n getterDeclared: true,\n initAdded: true,\n });\n declId = getId;\n } else if (isSetter) {\n privateNamesMap.set(prop.node.key.id.name, {\n ...privateName,\n setterDeclared: true,\n initAdded: true,\n });\n declId = setId;\n } else if (isStatic && !privateFieldsAsSymbolsOrProperties) {\n declId = id;\n }\n\n return inheritPropComments(\n t.functionDeclaration(\n t.cloneNode(declId),\n // @ts-expect-error params for ClassMethod has TSParameterProperty\n params,\n body,\n generator,\n async,\n ),\n prop,\n );\n}\n\ntype ReplaceThisState = {\n thisRef: t.Identifier;\n needsClassRef?: boolean;\n innerBinding?: t.Identifier | null;\n argumentsPath?: NodePath<t.Identifier>[];\n};\n\ntype ReplaceInnerBindingReferenceState = ReplaceThisState;\n\nconst thisContextVisitor = traverse.visitors.merge<ReplaceThisState>([\n {\n Identifier(path, state) {\n if (state.argumentsPath && path.node.name === \"arguments\") {\n state.argumentsPath.push(path);\n }\n },\n UnaryExpression(path) {\n // Replace `delete this` with `true`\n const { node } = path;\n if (node.operator === \"delete\") {\n const argument = skipTransparentExprWrapperNodes(node.argument);\n if (t.isThisExpression(argument)) {\n path.replaceWith(t.booleanLiteral(true));\n }\n }\n },\n ThisExpression(path, state) {\n state.needsClassRef = true;\n path.replaceWith(t.cloneNode(state.thisRef));\n },\n MetaProperty(path) {\n const { node, scope } = path;\n // if there are `new.target` in static field\n // we should replace it with `undefined`\n if (node.meta.name === \"new\" && node.property.name === \"target\") {\n path.replaceWith(scope.buildUndefinedNode());\n }\n },\n },\n environmentVisitor,\n]);\n\nconst innerReferencesVisitor: Visitor<ReplaceInnerBindingReferenceState> = {\n ReferencedIdentifier(path, state) {\n if (\n path.scope.bindingIdentifierEquals(path.node.name, state.innerBinding)\n ) {\n state.needsClassRef = true;\n path.node.name = state.thisRef.name;\n }\n },\n};\n\nfunction replaceThisContext(\n path: PropPath,\n ref: t.Identifier,\n innerBindingRef: t.Identifier | null,\n) {\n const state: ReplaceThisState = {\n thisRef: ref,\n needsClassRef: false,\n innerBinding: innerBindingRef,\n };\n if (!path.isMethod()) {\n // replace `this` in property initializers and static blocks\n path.traverse(thisContextVisitor, state);\n }\n\n // todo: use innerBinding.referencePaths to avoid full traversal\n if (\n innerBindingRef != null &&\n state.thisRef?.name &&\n state.thisRef.name !== innerBindingRef.name\n ) {\n path.traverse(innerReferencesVisitor, state);\n }\n\n return state.needsClassRef;\n}\n\nexport type PropNode =\n | t.ClassProperty\n | t.ClassPrivateMethod\n | t.ClassPrivateProperty\n | t.StaticBlock;\nexport type PropPath = NodePath<PropNode>;\n\nfunction isNameOrLength({ key, computed }: t.ClassProperty) {\n if (key.type === \"Identifier\") {\n return !computed && (key.name === \"name\" || key.name === \"length\");\n }\n if (key.type === \"StringLiteral\") {\n return key.value === \"name\" || key.value === \"length\";\n }\n return false;\n}\n\n/**\n * Inherit comments from class members. This is a reduced version of\n * t.inheritsComments: the trailing comments are not inherited because\n * for most class members except the last one, their trailing comments are\n * the next sibling's leading comments.\n *\n * @template T transformed class member type\n * @param {T} node transformed class member\n * @param {PropPath} prop class member\n * @returns transformed class member type with comments inherited\n */\nfunction inheritPropComments<T extends t.Node>(node: T, prop: PropPath) {\n t.inheritLeadingComments(node, prop.node);\n t.inheritInnerComments(node, prop.node);\n return node;\n}\n\n/**\n * ClassRefFlag records the requirement of the class binding reference.\n *\n * @enum {number}\n */\nconst enum ClassRefFlag {\n None,\n /**\n * When this flag is enabled, the binding reference can be the class id,\n * if exists, or the uid identifier generated for class expression. The\n * reference is safe to be consumed by [[Define]].\n */\n ForDefine = 1 << 0,\n /**\n * When this flag is enabled, the reference must be a uid, because the outer\n * class binding can be mutated by user codes.\n * E.g.\n * class C { static p = C }; const oldC = C; C = null; oldC.p;\n * we must memoize class `C` before defining the property `p`.\n */\n ForInnerBinding = 1 << 1,\n}\n\nexport function buildFieldsInitNodes(\n ref: t.Identifier | null,\n superRef: t.Expression | undefined,\n props: PropPath[],\n privateNamesMap: PrivateNamesMap,\n file: File,\n setPublicClassFields: boolean,\n privateFieldsAsSymbolsOrProperties: boolean,\n noUninitializedPrivateFieldAccess: boolean,\n constantSuper: boolean,\n innerBindingRef: t.Identifier | null,\n) {\n let classRefFlags = ClassRefFlag.None;\n let injectSuperRef: t.Identifier;\n const staticNodes: t.Statement[] = [];\n const instanceNodes: t.ExpressionStatement[] = [];\n let lastInstanceNodeReturnsThis = false;\n // These nodes are pure and can be moved to the closest statement position\n const pureStaticNodes: t.FunctionDeclaration[] = [];\n let classBindingNode: t.ExpressionStatement | null = null;\n\n const getSuperRef = t.isIdentifier(superRef)\n ? () => superRef\n : () => {\n injectSuperRef ??=\n props[0].scope.generateUidIdentifierBasedOnNode(superRef);\n return injectSuperRef;\n };\n\n const classRefForInnerBinding =\n ref ??\n props[0].scope.generateUidIdentifier(innerBindingRef?.name || \"Class\");\n ref ??= t.cloneNode(innerBindingRef);\n\n for (const prop of props) {\n prop.isClassProperty() && ts.assertFieldTransformed(prop);\n\n // @ts-expect-error: TS doesn't infer that prop.node is not a StaticBlock\n const isStatic = !t.isStaticBlock?.(prop.node) && prop.node.static;\n const isInstance = !isStatic;\n const isPrivate = prop.isPrivate();\n const isPublic = !isPrivate;\n const isField = prop.isProperty();\n const isMethod = !isField;\n const isStaticBlock = prop.isStaticBlock?.();\n\n if (isStatic) classRefFlags |= ClassRefFlag.ForDefine;\n\n if (isStatic || (isMethod && isPrivate) || isStaticBlock) {\n new ReplaceSupers({\n methodPath: prop,\n constantSuper,\n file: file,\n refToPreserve: innerBindingRef,\n getSuperRef,\n getObjectRef() {\n classRefFlags |= ClassRefFlag.ForInnerBinding;\n if (isStatic || isStaticBlock) {\n return classRefForInnerBinding;\n } else {\n return t.memberExpression(\n classRefForInnerBinding,\n t.identifier(\"prototype\"),\n );\n }\n },\n }).replace();\n\n const replaced = replaceThisContext(\n prop,\n classRefForInnerBinding,\n innerBindingRef,\n );\n if (replaced) {\n classRefFlags |= ClassRefFlag.ForInnerBinding;\n }\n }\n\n lastInstanceNodeReturnsThis = false;\n\n // TODO(ts): there are so many `ts-expect-error` inside cases since\n // ts can not infer type from pre-computed values (or a case test)\n // even change `isStaticBlock` to `t.isStaticBlock(prop)` will not make prop\n // a `NodePath<t.StaticBlock>`\n // this maybe a bug for ts\n switch (true) {\n case isStaticBlock: {\n const blockBody = prop.node.body;\n // We special-case the single expression case to avoid the iife, since\n // it's common.\n if (blockBody.length === 1 && t.isExpressionStatement(blockBody[0])) {\n staticNodes.push(inheritPropComments(blockBody[0], prop));\n } else {\n staticNodes.push(\n t.inheritsComments(\n template.statement.ast`(() => { ${blockBody} })()`,\n prop.node,\n ),\n );\n }\n break;\n }\n case isStatic &&\n isPrivate &&\n isField &&\n privateFieldsAsSymbolsOrProperties:\n staticNodes.push(\n buildPrivateFieldInitLoose(t.cloneNode(ref), prop, privateNamesMap),\n );\n break;\n case isStatic &&\n isPrivate &&\n isField &&\n !privateFieldsAsSymbolsOrProperties:\n if (!process.env.BABEL_8_BREAKING && !newHelpers(file)) {\n staticNodes.push(\n buildPrivateStaticFieldInitSpecOld(prop, privateNamesMap),\n );\n } else {\n staticNodes.push(\n buildPrivateStaticFieldInitSpec(\n prop,\n privateNamesMap,\n noUninitializedPrivateFieldAccess,\n ),\n );\n }\n break;\n case isStatic && isPublic && isField && setPublicClassFields:\n // Functions always have non-writable .name and .length properties,\n // so we must always use [[Define]] for them.\n // It might still be possible to a computed static fields whose resulting\n // key is \"name\" or \"length\", but the assumption is telling us that it's\n // not going to happen.\n if (!isNameOrLength(prop.node)) {\n staticNodes.push(buildPublicFieldInitLoose(t.cloneNode(ref), prop));\n break;\n }\n // falls through\n case isStatic && isPublic && isField && !setPublicClassFields:\n staticNodes.push(\n buildPublicFieldInitSpec(t.cloneNode(ref), prop, file),\n );\n break;\n case isInstance &&\n isPrivate &&\n isField &&\n privateFieldsAsSymbolsOrProperties:\n instanceNodes.push(\n buildPrivateFieldInitLoose(t.thisExpression(), prop, privateNamesMap),\n );\n break;\n case isInstance &&\n isPrivate &&\n isField &&\n !privateFieldsAsSymbolsOrProperties:\n instanceNodes.push(\n buildPrivateInstanceFieldInitSpec(\n t.thisExpression(),\n prop,\n privateNamesMap,\n file,\n ),\n );\n break;\n case isInstance &&\n isPrivate &&\n isMethod &&\n privateFieldsAsSymbolsOrProperties:\n instanceNodes.unshift(\n buildPrivateMethodInitLoose(\n t.thisExpression(),\n prop,\n privateNamesMap,\n ),\n );\n pureStaticNodes.push(\n buildPrivateMethodDeclaration(\n file,\n prop,\n privateNamesMap,\n privateFieldsAsSymbolsOrProperties,\n ),\n );\n break;\n case isInstance &&\n isPrivate &&\n isMethod &&\n !privateFieldsAsSymbolsOrProperties:\n instanceNodes.unshift(\n buildPrivateInstanceMethodInitSpec(\n t.thisExpression(),\n prop,\n privateNamesMap,\n file,\n ),\n );\n pureStaticNodes.push(\n buildPrivateMethodDeclaration(\n file,\n prop,\n privateNamesMap,\n privateFieldsAsSymbolsOrProperties,\n ),\n );\n break;\n case isStatic &&\n isPrivate &&\n isMethod &&\n !privateFieldsAsSymbolsOrProperties:\n if (!process.env.BABEL_8_BREAKING && !newHelpers(file)) {\n staticNodes.unshift(\n // @ts-expect-error checked in switch\n buildPrivateStaticFieldInitSpecOld(prop, privateNamesMap),\n );\n }\n pureStaticNodes.push(\n buildPrivateMethodDeclaration(\n file,\n prop,\n privateNamesMap,\n privateFieldsAsSymbolsOrProperties,\n ),\n );\n break;\n case isStatic &&\n isPrivate &&\n isMethod &&\n privateFieldsAsSymbolsOrProperties:\n staticNodes.unshift(\n buildPrivateStaticMethodInitLoose(\n t.cloneNode(ref),\n prop,\n file,\n privateNamesMap,\n ),\n );\n pureStaticNodes.push(\n buildPrivateMethodDeclaration(\n file,\n prop,\n privateNamesMap,\n privateFieldsAsSymbolsOrProperties,\n ),\n );\n break;\n case isInstance && isPublic && isField && setPublicClassFields:\n instanceNodes.push(buildPublicFieldInitLoose(t.thisExpression(), prop));\n break;\n case isInstance && isPublic && isField && !setPublicClassFields:\n lastInstanceNodeReturnsThis = true;\n instanceNodes.push(\n buildPublicFieldInitSpec(t.thisExpression(), prop, file),\n );\n break;\n default:\n throw new Error(\"Unreachable.\");\n }\n }\n\n if (classRefFlags & ClassRefFlag.ForInnerBinding && innerBindingRef != null) {\n classBindingNode = t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.cloneNode(classRefForInnerBinding),\n t.cloneNode(innerBindingRef),\n ),\n );\n }\n\n return {\n staticNodes: staticNodes.filter(Boolean),\n instanceNodes: instanceNodes.filter(Boolean),\n lastInstanceNodeReturnsThis,\n pureStaticNodes: pureStaticNodes.filter(Boolean),\n classBindingNode,\n wrapClass(path: NodePath<t.Class>) {\n for (const prop of props) {\n // Delete leading comments so that they don't get attached as\n // trailing comments of the previous sibling.\n // When transforming props, we explicitly attach their leading\n // comments to the transformed node with `inheritPropComments`\n // above.\n prop.node.leadingComments = null;\n prop.remove();\n }\n\n if (injectSuperRef) {\n path.scope.push({ id: t.cloneNode(injectSuperRef) });\n path.set(\n \"superClass\",\n t.assignmentExpression(\"=\", injectSuperRef, path.node.superClass),\n );\n }\n\n if (classRefFlags !== ClassRefFlag.None) {\n if (path.isClassExpression()) {\n path.scope.push({ id: ref });\n path.replaceWith(\n t.assignmentExpression(\"=\", t.cloneNode(ref), path.node),\n );\n } else {\n if (innerBindingRef == null) {\n // export anonymous class declaration\n path.node.id = ref;\n }\n if (classBindingNode != null) {\n path.scope.push({ id: classRefForInnerBinding });\n }\n }\n }\n\n return path;\n },\n };\n}\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,yBAAA,GAAAF,OAAA;AACA,IAAAG,kCAAA,GAAAH,OAAA;AAKA,IAAAI,6BAAA,GAAAJ,OAAA;AACA,IAAAK,qBAAA,GAAAL,OAAA;AACA,IAAAM,wCAAA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,EAAE;UAC5BtK,IAAI,CAAC3D,KAAK,CAAC4C,IAAI,CAAC;YAAErD,EAAE,EAAEgI;UAAI,CAAC,CAAC;UAC5B5D,IAAI,CAAC8B,WAAW,CACdhF,WAAC,CAACwG,oBAAoB,CAAC,GAAG,EAAExG,WAAC,CAACS,SAAS,CAACqG,GAAG,CAAC,EAAE5D,IAAI,CAACtE,IAAI,CACzD,CAAC;QACH,CAAC,MAAM;UACL,IAAIiM,eAAe,IAAI,IAAI,EAAE;YAE3B3H,IAAI,CAACtE,IAAI,CAACE,EAAE,GAAGgI,GAAG;UACpB;UACA,IAAIiF,gBAAgB,IAAI,IAAI,EAAE;YAC5B7I,IAAI,CAAC3D,KAAK,CAAC4C,IAAI,CAAC;cAAErD,EAAE,EAAEqN;YAAwB,CAAC,CAAC;UAClD;QACF;MACF;MAEA,OAAOjJ,IAAI;IACb;EACF,CAAC;AACH","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/helper-create-class-features-plugin/lib/index.js b/node_modules/@babel/helper-create-class-features-plugin/lib/index.js index 5100f585..5a91fcac 100644 --- a/node_modules/@babel/helper-create-class-features-plugin/lib/index.js +++ b/node_modules/@babel/helper-create-class-features-plugin/lib/index.js @@ -48,9 +48,10 @@ function createClassFeaturePlugin({ inherits, decoratorVersion }) { + var _api$assumption; if (feature & _features.FEATURES.decorators) { { - if (decoratorVersion === "2021-12" || decoratorVersion === "2022-03" || decoratorVersion === "2023-01" || decoratorVersion === "2023-05") { + if (decoratorVersion === "2023-11" || decoratorVersion === "2023-05" || decoratorVersion === "2023-01" || decoratorVersion === "2022-03" || decoratorVersion === "2021-12") { return (0, _decorators.default)(api, { loose }, decoratorVersion, inherits); @@ -66,6 +67,7 @@ function createClassFeaturePlugin({ const setPublicClassFields = api.assumption("setPublicClassFields"); const privateFieldsAsSymbols = api.assumption("privateFieldsAsSymbols"); const privateFieldsAsProperties = api.assumption("privateFieldsAsProperties"); + const noUninitializedPrivateFieldAccess = (_api$assumption = api.assumption("noUninitializedPrivateFieldAccess")) != null ? _api$assumption : false; const constantSuper = api.assumption("constantSuper"); const noDocumentAll = api.assumption("noDocumentAll"); if (privateFieldsAsProperties && privateFieldsAsSymbols) { @@ -95,12 +97,12 @@ function createClassFeaturePlugin({ (0, _features.enableFeature)(file, feature, loose); { if (typeof file.get(versionKey) === "number") { - file.set(versionKey, "7.23.7"); + file.set(versionKey, "7.24.5"); return; } } - if (!file.get(versionKey) || _semver.lt(file.get(versionKey), "7.23.7")) { - file.set(versionKey, "7.23.7"); + if (!file.get(versionKey) || _semver.lt(file.get(versionKey), "7.24.5")) { + file.set(versionKey, "7.24.5"); } }, visitor: { @@ -108,7 +110,7 @@ function createClassFeaturePlugin({ file }) { var _ref; - if (file.get(versionKey) !== "7.23.7") return; + if (file.get(versionKey) !== "7.24.5") return; if (!(0, _features.shouldTransform)(path, file)) return; const pathIsClassDeclaration = path.isClassDeclaration(); if (pathIsClassDeclaration) (0, _typescript.assertFieldTransformed)(path); @@ -167,13 +169,14 @@ function createClassFeaturePlugin({ let ref; if (!innerBinding || !pathIsClassDeclaration) { (0, _helperFunctionName.default)(path); - ref = path.scope.generateUidIdentifier("class"); + ref = path.scope.generateUidIdentifier((innerBinding == null ? void 0 : innerBinding.name) || "Class"); } const classRefForDefine = (_ref = ref) != null ? _ref : _core.types.cloneNode(innerBinding); - const privateNamesMap = (0, _fields.buildPrivateNamesMap)(props); + const privateNamesMap = (0, _fields.buildPrivateNamesMap)(classRefForDefine.name, privateFieldsAsSymbolsOrProperties != null ? privateFieldsAsSymbolsOrProperties : loose, props, file); const privateNamesNodes = (0, _fields.buildPrivateNamesNodes)(privateNamesMap, privateFieldsAsProperties != null ? privateFieldsAsProperties : loose, privateFieldsAsSymbols != null ? privateFieldsAsSymbols : false, file); (0, _fields.transformPrivateNamesUsage)(classRefForDefine, path, privateNamesMap, { privateFieldsAsProperties: privateFieldsAsSymbolsOrProperties != null ? privateFieldsAsSymbolsOrProperties : loose, + noUninitializedPrivateFieldAccess, noDocumentAll, innerBinding }, file); @@ -194,7 +197,7 @@ function createClassFeaturePlugin({ lastInstanceNodeReturnsThis, classBindingNode, wrapClass - } = (0, _fields.buildFieldsInitNodes)(ref, path.node.superClass, props, privateNamesMap, file, setPublicClassFields != null ? setPublicClassFields : loose, privateFieldsAsSymbolsOrProperties != null ? privateFieldsAsSymbolsOrProperties : loose, constantSuper != null ? constantSuper : loose, innerBinding)); + } = (0, _fields.buildFieldsInitNodes)(ref, path.node.superClass, props, privateNamesMap, file, setPublicClassFields != null ? setPublicClassFields : loose, privateFieldsAsSymbolsOrProperties != null ? privateFieldsAsSymbolsOrProperties : loose, noUninitializedPrivateFieldAccess, constantSuper != null ? constantSuper : loose, innerBinding)); } } if (instanceNodes.length > 0) { @@ -224,7 +227,7 @@ function createClassFeaturePlugin({ file }) { { - if (file.get(versionKey) !== "7.23.7") return; + if (file.get(versionKey) !== "7.24.5") return; const decl = path.get("declaration"); if (decl.isClassDeclaration() && (0, _decorators2.hasDecorators)(decl.node)) { if (decl.node.id) { diff --git a/node_modules/@babel/helper-create-class-features-plugin/lib/index.js.map b/node_modules/@babel/helper-create-class-features-plugin/lib/index.js.map index 94881ba7..ffabd2d6 100644 --- a/node_modules/@babel/helper-create-class-features-plugin/lib/index.js.map +++ b/node_modules/@babel/helper-create-class-features-plugin/lib/index.js.map @@ -1 +1 @@ -{"version":3,"names":["_core","require","_helperFunctionName","_helperSplitExportDeclaration","_decorators","_semver","_fields","_decorators2","_misc","_features","_typescript","versionKey","createClassFeaturePlugin","name","feature","loose","manipulateOptions","api","inherits","decoratorVersion","FEATURES","decorators","createDecoratorTransform","_api","assumption","setPublicClassFields","privateFieldsAsSymbols","privateFieldsAsProperties","constantSuper","noDocumentAll","Error","privateFieldsAsSymbolsOrProperties","explicit","undefined","push","length","console","warn","join","pre","file","enableFeature","get","set","semver","lt","visitor","Class","path","_ref","shouldTransform","pathIsClassDeclaration","isClassDeclaration","assertFieldTransformed","isLoose","constructor","isDecorated","hasDecorators","node","props","elements","computedPaths","privateNames","Set","body","isClassProperty","isClassMethod","computed","isPrivate","key","id","getName","setName","isClassPrivateMethod","kind","has","buildCodeFrameError","add","isProperty","isStaticBlock","innerBinding","ref","nameFunction","scope","generateUidIdentifier","classRefForDefine","t","cloneNode","privateNamesMap","buildPrivateNamesMap","privateNamesNodes","buildPrivateNamesNodes","transformPrivateNamesUsage","keysNodes","staticNodes","instanceNodes","lastInstanceNodeReturnsThis","pureStaticNodes","classBindingNode","wrapClass","buildDecoratedClass","extractComputedKeys","buildFieldsInitNodes","superClass","injectInitialization","referenceVisitor","state","prop","static","traverse","wrappedPath","insertBefore","insertAfter","find","parent","isStatement","isDeclaration","ExportDefaultDeclaration","decl","splitExportDeclaration","type"],"sources":["../src/index.ts"],"sourcesContent":["import { types as t } from \"@babel/core\";\nimport type { PluginAPI, PluginObject } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport nameFunction from \"@babel/helper-function-name\";\nimport splitExportDeclaration from \"@babel/helper-split-export-declaration\";\nimport createDecoratorTransform from \"./decorators.ts\";\n\nimport semver from \"semver\";\n\nimport {\n buildPrivateNamesNodes,\n buildPrivateNamesMap,\n transformPrivateNamesUsage,\n buildFieldsInitNodes,\n buildCheckInRHS,\n} from \"./fields.ts\";\nimport type { PropPath } from \"./fields.ts\";\nimport { buildDecoratedClass, hasDecorators } from \"./decorators-2018-09.ts\";\nimport { injectInitialization, extractComputedKeys } from \"./misc.ts\";\nimport {\n enableFeature,\n FEATURES,\n isLoose,\n shouldTransform,\n} from \"./features.ts\";\nimport { assertFieldTransformed } from \"./typescript.ts\";\n\nexport { FEATURES, enableFeature, injectInitialization, buildCheckInRHS };\n\nconst versionKey = \"@babel/plugin-class-features/version\";\n\ninterface Options {\n name: string;\n feature: number;\n loose?: boolean;\n inherits?: PluginObject[\"inherits\"];\n manipulateOptions?: PluginObject[\"manipulateOptions\"];\n api?: PluginAPI;\n decoratorVersion?: \"2023-05\" | \"2023-01\" | \"2022-03\" | \"2021-12\" | \"2018-09\";\n}\n\nexport function createClassFeaturePlugin({\n name,\n feature,\n loose,\n manipulateOptions,\n api,\n inherits,\n decoratorVersion,\n}: Options): PluginObject {\n if (feature & FEATURES.decorators) {\n if (process.env.BABEL_8_BREAKING) {\n return createDecoratorTransform(api, { loose }, \"2023-05\", inherits);\n } else {\n if (\n decoratorVersion === \"2021-12\" ||\n decoratorVersion === \"2022-03\" ||\n decoratorVersion === \"2023-01\" ||\n decoratorVersion === \"2023-05\"\n ) {\n return createDecoratorTransform(\n api,\n { loose },\n decoratorVersion,\n inherits,\n );\n }\n }\n }\n if (!process.env.BABEL_8_BREAKING) {\n api ??= { assumption: () => void 0 as any } as any;\n }\n const setPublicClassFields = api.assumption(\"setPublicClassFields\");\n const privateFieldsAsSymbols = api.assumption(\"privateFieldsAsSymbols\");\n const privateFieldsAsProperties = api.assumption(\"privateFieldsAsProperties\");\n const constantSuper = api.assumption(\"constantSuper\");\n const noDocumentAll = api.assumption(\"noDocumentAll\");\n\n if (privateFieldsAsProperties && privateFieldsAsSymbols) {\n throw new Error(\n `Cannot enable both the \"privateFieldsAsProperties\" and ` +\n `\"privateFieldsAsSymbols\" assumptions as the same time.`,\n );\n }\n const privateFieldsAsSymbolsOrProperties =\n privateFieldsAsProperties || privateFieldsAsSymbols;\n\n if (loose === true) {\n type AssumptionName = Parameters<PluginAPI[\"assumption\"]>[0];\n const explicit: `\"${AssumptionName}\"`[] = [];\n\n if (setPublicClassFields !== undefined) {\n explicit.push(`\"setPublicClassFields\"`);\n }\n if (privateFieldsAsProperties !== undefined) {\n explicit.push(`\"privateFieldsAsProperties\"`);\n }\n if (privateFieldsAsSymbols !== undefined) {\n explicit.push(`\"privateFieldsAsSymbols\"`);\n }\n if (explicit.length !== 0) {\n console.warn(\n `[${name}]: You are using the \"loose: true\" option and you are` +\n ` explicitly setting a value for the ${explicit.join(\" and \")}` +\n ` assumption${explicit.length > 1 ? \"s\" : \"\"}. The \"loose\" option` +\n ` can cause incompatibilities with the other class features` +\n ` plugins, so it's recommended that you replace it with the` +\n ` following top-level option:\\n` +\n `\\t\"assumptions\": {\\n` +\n `\\t\\t\"setPublicClassFields\": true,\\n` +\n `\\t\\t\"privateFieldsAsSymbols\": true\\n` +\n `\\t}`,\n );\n }\n }\n\n return {\n name,\n manipulateOptions,\n inherits,\n\n pre(file) {\n enableFeature(file, feature, loose);\n\n if (!process.env.BABEL_8_BREAKING) {\n // Until 7.21.4, we used to encode the version as a number.\n // If file.get(versionKey) is a number, it has thus been\n // set by an older version of this plugin.\n if (typeof file.get(versionKey) === \"number\") {\n file.set(versionKey, PACKAGE_JSON.version);\n return;\n }\n }\n if (\n !file.get(versionKey) ||\n semver.lt(file.get(versionKey), PACKAGE_JSON.version)\n ) {\n file.set(versionKey, PACKAGE_JSON.version);\n }\n },\n\n visitor: {\n Class(path, { file }) {\n if (file.get(versionKey) !== PACKAGE_JSON.version) return;\n\n if (!shouldTransform(path, file)) return;\n\n const pathIsClassDeclaration = path.isClassDeclaration();\n\n if (pathIsClassDeclaration) assertFieldTransformed(path);\n\n const loose = isLoose(file, feature);\n\n let constructor: NodePath<t.ClassMethod>;\n const isDecorated = hasDecorators(path.node);\n const props: PropPath[] = [];\n const elements = [];\n const computedPaths: NodePath<t.ClassProperty | t.ClassMethod>[] = [];\n const privateNames = new Set<string>();\n const body = path.get(\"body\");\n\n for (const path of body.get(\"body\")) {\n if (\n // check path.node.computed is enough, but ts will complain\n (path.isClassProperty() || path.isClassMethod()) &&\n path.node.computed\n ) {\n computedPaths.push(path);\n }\n\n if (path.isPrivate()) {\n const { name } = path.node.key.id;\n const getName = `get ${name}`;\n const setName = `set ${name}`;\n\n if (path.isClassPrivateMethod()) {\n if (path.node.kind === \"get\") {\n if (\n privateNames.has(getName) ||\n (privateNames.has(name) && !privateNames.has(setName))\n ) {\n throw path.buildCodeFrameError(\"Duplicate private field\");\n }\n privateNames.add(getName).add(name);\n } else if (path.node.kind === \"set\") {\n if (\n privateNames.has(setName) ||\n (privateNames.has(name) && !privateNames.has(getName))\n ) {\n throw path.buildCodeFrameError(\"Duplicate private field\");\n }\n privateNames.add(setName).add(name);\n }\n } else {\n if (\n (privateNames.has(name) &&\n !privateNames.has(getName) &&\n !privateNames.has(setName)) ||\n (privateNames.has(name) &&\n (privateNames.has(getName) || privateNames.has(setName)))\n ) {\n throw path.buildCodeFrameError(\"Duplicate private field\");\n }\n\n privateNames.add(name);\n }\n }\n\n if (path.isClassMethod({ kind: \"constructor\" })) {\n constructor = path;\n } else {\n elements.push(path);\n if (\n path.isProperty() ||\n path.isPrivate() ||\n path.isStaticBlock?.()\n ) {\n props.push(path as PropPath);\n }\n }\n }\n\n if (process.env.BABEL_8_BREAKING) {\n if (!props.length) return;\n } else {\n if (!props.length && !isDecorated) return;\n }\n\n const innerBinding = path.node.id;\n let ref: t.Identifier | null;\n if (!innerBinding || !pathIsClassDeclaration) {\n nameFunction(path);\n ref = path.scope.generateUidIdentifier(\"class\");\n }\n const classRefForDefine = ref ?? t.cloneNode(innerBinding);\n\n // NODE: These three functions don't support decorators yet,\n // but verifyUsedFeatures throws if there are both\n // decorators and private fields.\n const privateNamesMap = buildPrivateNamesMap(props);\n const privateNamesNodes = buildPrivateNamesNodes(\n privateNamesMap,\n privateFieldsAsProperties ?? loose,\n privateFieldsAsSymbols ?? false,\n file,\n );\n\n transformPrivateNamesUsage(\n classRefForDefine,\n path,\n privateNamesMap,\n {\n privateFieldsAsProperties:\n privateFieldsAsSymbolsOrProperties ?? loose,\n noDocumentAll,\n innerBinding,\n },\n file,\n );\n\n let keysNodes: t.Statement[],\n staticNodes: t.Statement[],\n instanceNodes: t.ExpressionStatement[],\n lastInstanceNodeReturnsThis: boolean,\n pureStaticNodes: t.FunctionDeclaration[],\n classBindingNode: t.Statement | null,\n wrapClass: (path: NodePath<t.Class>) => NodePath;\n\n if (!process.env.BABEL_8_BREAKING) {\n if (isDecorated) {\n staticNodes = pureStaticNodes = keysNodes = [];\n ({ instanceNodes, wrapClass } = buildDecoratedClass(\n classRefForDefine,\n path,\n elements,\n file,\n ));\n } else {\n keysNodes = extractComputedKeys(path, computedPaths, file);\n ({\n staticNodes,\n pureStaticNodes,\n instanceNodes,\n lastInstanceNodeReturnsThis,\n classBindingNode,\n wrapClass,\n } = buildFieldsInitNodes(\n ref,\n path.node.superClass,\n props,\n privateNamesMap,\n file,\n setPublicClassFields ?? loose,\n privateFieldsAsSymbolsOrProperties ?? loose,\n constantSuper ?? loose,\n innerBinding,\n ));\n }\n } else {\n keysNodes = extractComputedKeys(path, computedPaths, file);\n ({\n staticNodes,\n pureStaticNodes,\n instanceNodes,\n lastInstanceNodeReturnsThis,\n classBindingNode,\n wrapClass,\n } = buildFieldsInitNodes(\n ref,\n path.node.superClass,\n props,\n privateNamesMap,\n file,\n setPublicClassFields ?? loose,\n privateFieldsAsSymbolsOrProperties ?? loose,\n constantSuper ?? loose,\n innerBinding,\n ));\n }\n\n if (instanceNodes.length > 0) {\n injectInitialization(\n path,\n constructor,\n instanceNodes,\n (referenceVisitor, state) => {\n if (!process.env.BABEL_8_BREAKING) {\n if (isDecorated) return;\n }\n for (const prop of props) {\n // @ts-expect-error: TS doesn't infer that prop.node is not a StaticBlock\n if (t.isStaticBlock?.(prop.node) || prop.node.static) continue;\n prop.traverse(referenceVisitor, state);\n }\n },\n lastInstanceNodeReturnsThis,\n );\n }\n\n // rename to make ts happy\n const wrappedPath = wrapClass(path);\n wrappedPath.insertBefore([...privateNamesNodes, ...keysNodes]);\n if (staticNodes.length > 0) {\n wrappedPath.insertAfter(staticNodes);\n }\n if (pureStaticNodes.length > 0) {\n wrappedPath\n .find(parent => parent.isStatement() || parent.isDeclaration())\n .insertAfter(pureStaticNodes);\n }\n if (classBindingNode != null && pathIsClassDeclaration) {\n wrappedPath.insertAfter(classBindingNode);\n }\n },\n\n ExportDefaultDeclaration(path, { file }) {\n if (!process.env.BABEL_8_BREAKING) {\n if (file.get(versionKey) !== PACKAGE_JSON.version) return;\n\n const decl = path.get(\"declaration\");\n\n if (decl.isClassDeclaration() && hasDecorators(decl.node)) {\n if (decl.node.id) {\n // export default class Foo {}\n // -->\n // class Foo {} export { Foo as default }\n splitExportDeclaration(path);\n } else {\n // @ts-expect-error Anonymous class declarations can be\n // transformed as if they were expressions\n decl.node.type = \"ClassExpression\";\n }\n }\n }\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,6BAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,OAAA,GAAAL,OAAA;AAQA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAMA,IAAAS,WAAA,GAAAT,OAAA;AAIA,MAAMU,UAAU,GAAG,sCAAsC;AAYlD,SAASC,wBAAwBA,CAAC;EACvCC,IAAI;EACJC,OAAO;EACPC,KAAK;EACLC,iBAAiB;EACjBC,GAAG;EACHC,QAAQ;EACRC;AACO,CAAC,EAAgB;EACxB,IAAIL,OAAO,GAAGM,kBAAQ,CAACC,UAAU,EAAE;IAG1B;MACL,IACEF,gBAAgB,KAAK,SAAS,IAC9BA,gBAAgB,KAAK,SAAS,IAC9BA,gBAAgB,KAAK,SAAS,IAC9BA,gBAAgB,KAAK,SAAS,EAC9B;QACA,OAAO,IAAAG,mBAAwB,EAC7BL,GAAG,EACH;UAAEF;QAAM,CAAC,EACTI,gBAAgB,EAChBD,QACF,CAAC;MACH;IACF;EACF;EACmC;IAAA,IAAAK,IAAA;IACjC,CAAAA,IAAA,GAAAN,GAAG,YAAAM,IAAA,GAAHN,GAAG,GAAK;MAAEO,UAAU,EAAEA,CAAA,KAAM,KAAK;IAAS,CAAC;EAC7C;EACA,MAAMC,oBAAoB,GAAG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UAEnD,MAAM2G,IAAI,GAAGtE,IAAI,CAACN,GAAG,CAAC,aAAa,CAAC;UAEpC,IAAI4E,IAAI,CAAClE,kBAAkB,CAAC,CAAC,IAAI,IAAAK,0BAAa,EAAC6D,IAAI,CAAC5D,IAAI,CAAC,EAAE;YACzD,IAAI4D,IAAI,CAAC5D,IAAI,CAACY,EAAE,EAAE;cAIhB,IAAAiD,qCAAsB,EAACvE,IAAI,CAAC;YAC9B,CAAC,MAAM;cAGLsE,IAAI,CAAC5D,IAAI,CAAC8D,IAAI,GAAG,iBAAiB;YACpC;UACF;QACF;MACF;IACF;EACF,CAAC;AACH"}
\ No newline at end of file +{"version":3,"names":["_core","require","_helperFunctionName","_helperSplitExportDeclaration","_decorators","_semver","_fields","_decorators2","_misc","_features","_typescript","versionKey","createClassFeaturePlugin","name","feature","loose","manipulateOptions","api","inherits","decoratorVersion","_api$assumption","FEATURES","decorators","createDecoratorTransform","_api","assumption","setPublicClassFields","privateFieldsAsSymbols","privateFieldsAsProperties","noUninitializedPrivateFieldAccess","constantSuper","noDocumentAll","Error","privateFieldsAsSymbolsOrProperties","explicit","undefined","push","length","console","warn","join","pre","file","enableFeature","get","set","semver","lt","visitor","Class","path","_ref","shouldTransform","pathIsClassDeclaration","isClassDeclaration","assertFieldTransformed","isLoose","constructor","isDecorated","hasDecorators","node","props","elements","computedPaths","privateNames","Set","body","isClassProperty","isClassMethod","computed","isPrivate","key","id","getName","setName","isClassPrivateMethod","kind","has","buildCodeFrameError","add","isProperty","isStaticBlock","innerBinding","ref","nameFunction","scope","generateUidIdentifier","classRefForDefine","t","cloneNode","privateNamesMap","buildPrivateNamesMap","privateNamesNodes","buildPrivateNamesNodes","transformPrivateNamesUsage","keysNodes","staticNodes","instanceNodes","lastInstanceNodeReturnsThis","pureStaticNodes","classBindingNode","wrapClass","buildDecoratedClass","extractComputedKeys","buildFieldsInitNodes","superClass","injectInitialization","referenceVisitor","state","prop","static","traverse","wrappedPath","insertBefore","insertAfter","find","parent","isStatement","isDeclaration","ExportDefaultDeclaration","decl","splitExportDeclaration","type"],"sources":["../src/index.ts"],"sourcesContent":["import { types as t } from \"@babel/core\";\nimport type { PluginAPI, PluginObject } from \"@babel/core\";\nimport type { NodePath } from \"@babel/traverse\";\nimport nameFunction from \"@babel/helper-function-name\";\nimport splitExportDeclaration from \"@babel/helper-split-export-declaration\";\nimport createDecoratorTransform from \"./decorators.ts\";\nimport type { DecoratorVersionKind } from \"./decorators.ts\";\n\nimport semver from \"semver\";\n\nimport {\n buildPrivateNamesNodes,\n buildPrivateNamesMap,\n transformPrivateNamesUsage,\n buildFieldsInitNodes,\n buildCheckInRHS,\n} from \"./fields.ts\";\nimport type { PropPath } from \"./fields.ts\";\nimport { buildDecoratedClass, hasDecorators } from \"./decorators-2018-09.ts\";\nimport { injectInitialization, extractComputedKeys } from \"./misc.ts\";\nimport {\n enableFeature,\n FEATURES,\n isLoose,\n shouldTransform,\n} from \"./features.ts\";\nimport { assertFieldTransformed } from \"./typescript.ts\";\n\nexport { FEATURES, enableFeature, injectInitialization, buildCheckInRHS };\n\nconst versionKey = \"@babel/plugin-class-features/version\";\n\ninterface Options {\n name: string;\n feature: number;\n loose?: boolean;\n inherits?: PluginObject[\"inherits\"];\n manipulateOptions?: PluginObject[\"manipulateOptions\"];\n api?: PluginAPI;\n decoratorVersion?: DecoratorVersionKind | \"2018-09\";\n}\n\nexport function createClassFeaturePlugin({\n name,\n feature,\n loose,\n manipulateOptions,\n api,\n inherits,\n decoratorVersion,\n}: Options): PluginObject {\n if (feature & FEATURES.decorators) {\n if (process.env.BABEL_8_BREAKING) {\n return createDecoratorTransform(api, { loose }, \"2023-11\", inherits);\n } else {\n if (\n decoratorVersion === \"2023-11\" ||\n decoratorVersion === \"2023-05\" ||\n decoratorVersion === \"2023-01\" ||\n decoratorVersion === \"2022-03\" ||\n decoratorVersion === \"2021-12\"\n ) {\n return createDecoratorTransform(\n api,\n { loose },\n decoratorVersion,\n inherits,\n );\n }\n }\n }\n if (!process.env.BABEL_8_BREAKING) {\n api ??= { assumption: () => void 0 as any } as any;\n }\n const setPublicClassFields = api.assumption(\"setPublicClassFields\");\n const privateFieldsAsSymbols = api.assumption(\"privateFieldsAsSymbols\");\n const privateFieldsAsProperties = api.assumption(\"privateFieldsAsProperties\");\n const noUninitializedPrivateFieldAccess =\n api.assumption(\"noUninitializedPrivateFieldAccess\") ?? false;\n const constantSuper = api.assumption(\"constantSuper\");\n const noDocumentAll = api.assumption(\"noDocumentAll\");\n\n if (privateFieldsAsProperties && privateFieldsAsSymbols) {\n throw new Error(\n `Cannot enable both the \"privateFieldsAsProperties\" and ` +\n `\"privateFieldsAsSymbols\" assumptions as the same time.`,\n );\n }\n const privateFieldsAsSymbolsOrProperties =\n privateFieldsAsProperties || privateFieldsAsSymbols;\n\n if (loose === true) {\n type AssumptionName = Parameters<PluginAPI[\"assumption\"]>[0];\n const explicit: `\"${AssumptionName}\"`[] = [];\n\n if (setPublicClassFields !== undefined) {\n explicit.push(`\"setPublicClassFields\"`);\n }\n if (privateFieldsAsProperties !== undefined) {\n explicit.push(`\"privateFieldsAsProperties\"`);\n }\n if (privateFieldsAsSymbols !== undefined) {\n explicit.push(`\"privateFieldsAsSymbols\"`);\n }\n if (explicit.length !== 0) {\n console.warn(\n `[${name}]: You are using the \"loose: true\" option and you are` +\n ` explicitly setting a value for the ${explicit.join(\" and \")}` +\n ` assumption${explicit.length > 1 ? \"s\" : \"\"}. The \"loose\" option` +\n ` can cause incompatibilities with the other class features` +\n ` plugins, so it's recommended that you replace it with the` +\n ` following top-level option:\\n` +\n `\\t\"assumptions\": {\\n` +\n `\\t\\t\"setPublicClassFields\": true,\\n` +\n `\\t\\t\"privateFieldsAsSymbols\": true\\n` +\n `\\t}`,\n );\n }\n }\n\n return {\n name,\n manipulateOptions,\n inherits,\n\n pre(file) {\n enableFeature(file, feature, loose);\n\n if (!process.env.BABEL_8_BREAKING) {\n // Until 7.21.4, we used to encode the version as a number.\n // If file.get(versionKey) is a number, it has thus been\n // set by an older version of this plugin.\n if (typeof file.get(versionKey) === \"number\") {\n file.set(versionKey, PACKAGE_JSON.version);\n return;\n }\n }\n if (\n !file.get(versionKey) ||\n semver.lt(file.get(versionKey), PACKAGE_JSON.version)\n ) {\n file.set(versionKey, PACKAGE_JSON.version);\n }\n },\n\n visitor: {\n Class(path, { file }) {\n if (file.get(versionKey) !== PACKAGE_JSON.version) return;\n\n if (!shouldTransform(path, file)) return;\n\n const pathIsClassDeclaration = path.isClassDeclaration();\n\n if (pathIsClassDeclaration) assertFieldTransformed(path);\n\n const loose = isLoose(file, feature);\n\n let constructor: NodePath<t.ClassMethod>;\n const isDecorated = hasDecorators(path.node);\n const props: PropPath[] = [];\n const elements = [];\n const computedPaths: NodePath<t.ClassProperty | t.ClassMethod>[] = [];\n const privateNames = new Set<string>();\n const body = path.get(\"body\");\n\n for (const path of body.get(\"body\")) {\n if (\n // check path.node.computed is enough, but ts will complain\n (path.isClassProperty() || path.isClassMethod()) &&\n path.node.computed\n ) {\n computedPaths.push(path);\n }\n\n if (path.isPrivate()) {\n const { name } = path.node.key.id;\n const getName = `get ${name}`;\n const setName = `set ${name}`;\n\n if (path.isClassPrivateMethod()) {\n if (path.node.kind === \"get\") {\n if (\n privateNames.has(getName) ||\n (privateNames.has(name) && !privateNames.has(setName))\n ) {\n throw path.buildCodeFrameError(\"Duplicate private field\");\n }\n privateNames.add(getName).add(name);\n } else if (path.node.kind === \"set\") {\n if (\n privateNames.has(setName) ||\n (privateNames.has(name) && !privateNames.has(getName))\n ) {\n throw path.buildCodeFrameError(\"Duplicate private field\");\n }\n privateNames.add(setName).add(name);\n }\n } else {\n if (\n (privateNames.has(name) &&\n !privateNames.has(getName) &&\n !privateNames.has(setName)) ||\n (privateNames.has(name) &&\n (privateNames.has(getName) || privateNames.has(setName)))\n ) {\n throw path.buildCodeFrameError(\"Duplicate private field\");\n }\n\n privateNames.add(name);\n }\n }\n\n if (path.isClassMethod({ kind: \"constructor\" })) {\n constructor = path;\n } else {\n elements.push(path);\n if (\n path.isProperty() ||\n path.isPrivate() ||\n path.isStaticBlock?.()\n ) {\n props.push(path as PropPath);\n }\n }\n }\n\n if (process.env.BABEL_8_BREAKING) {\n if (!props.length) return;\n } else {\n if (!props.length && !isDecorated) return;\n }\n\n const innerBinding = path.node.id;\n let ref: t.Identifier | null;\n if (!innerBinding || !pathIsClassDeclaration) {\n nameFunction(path as NodePath<t.ClassExpression>);\n ref = path.scope.generateUidIdentifier(innerBinding?.name || \"Class\");\n }\n const classRefForDefine = ref ?? t.cloneNode(innerBinding);\n\n const privateNamesMap = buildPrivateNamesMap(\n classRefForDefine.name,\n privateFieldsAsSymbolsOrProperties ?? loose,\n props,\n file,\n );\n const privateNamesNodes = buildPrivateNamesNodes(\n privateNamesMap,\n privateFieldsAsProperties ?? loose,\n privateFieldsAsSymbols ?? false,\n file,\n );\n\n transformPrivateNamesUsage(\n classRefForDefine,\n path,\n privateNamesMap,\n {\n privateFieldsAsProperties:\n privateFieldsAsSymbolsOrProperties ?? loose,\n noUninitializedPrivateFieldAccess,\n noDocumentAll,\n innerBinding,\n },\n file,\n );\n\n let keysNodes: t.Statement[],\n staticNodes: t.Statement[],\n instanceNodes: t.ExpressionStatement[],\n lastInstanceNodeReturnsThis: boolean,\n pureStaticNodes: t.FunctionDeclaration[],\n classBindingNode: t.Statement | null,\n wrapClass: (path: NodePath<t.Class>) => NodePath;\n\n if (!process.env.BABEL_8_BREAKING) {\n if (isDecorated) {\n staticNodes = pureStaticNodes = keysNodes = [];\n ({ instanceNodes, wrapClass } = buildDecoratedClass(\n classRefForDefine,\n path,\n elements,\n file,\n ));\n } else {\n keysNodes = extractComputedKeys(path, computedPaths, file);\n ({\n staticNodes,\n pureStaticNodes,\n instanceNodes,\n lastInstanceNodeReturnsThis,\n classBindingNode,\n wrapClass,\n } = buildFieldsInitNodes(\n ref,\n path.node.superClass,\n props,\n privateNamesMap,\n file,\n setPublicClassFields ?? loose,\n privateFieldsAsSymbolsOrProperties ?? loose,\n noUninitializedPrivateFieldAccess,\n constantSuper ?? loose,\n innerBinding,\n ));\n }\n } else {\n keysNodes = extractComputedKeys(path, computedPaths, file);\n ({\n staticNodes,\n pureStaticNodes,\n instanceNodes,\n lastInstanceNodeReturnsThis,\n classBindingNode,\n wrapClass,\n } = buildFieldsInitNodes(\n ref,\n path.node.superClass,\n props,\n privateNamesMap,\n file,\n setPublicClassFields ?? loose,\n privateFieldsAsSymbolsOrProperties ?? loose,\n noUninitializedPrivateFieldAccess,\n constantSuper ?? loose,\n innerBinding,\n ));\n }\n\n if (instanceNodes.length > 0) {\n injectInitialization(\n path,\n constructor,\n instanceNodes,\n (referenceVisitor, state) => {\n if (!process.env.BABEL_8_BREAKING) {\n if (isDecorated) return;\n }\n for (const prop of props) {\n // @ts-expect-error: TS doesn't infer that prop.node is not a StaticBlock\n if (t.isStaticBlock?.(prop.node) || prop.node.static) continue;\n prop.traverse(referenceVisitor, state);\n }\n },\n lastInstanceNodeReturnsThis,\n );\n }\n\n // rename to make ts happy\n const wrappedPath = wrapClass(path);\n wrappedPath.insertBefore([...privateNamesNodes, ...keysNodes]);\n if (staticNodes.length > 0) {\n wrappedPath.insertAfter(staticNodes);\n }\n if (pureStaticNodes.length > 0) {\n wrappedPath\n .find(parent => parent.isStatement() || parent.isDeclaration())\n .insertAfter(pureStaticNodes);\n }\n if (classBindingNode != null && pathIsClassDeclaration) {\n wrappedPath.insertAfter(classBindingNode);\n }\n },\n\n ExportDefaultDeclaration(path, { file }) {\n if (!process.env.BABEL_8_BREAKING) {\n if (file.get(versionKey) !== PACKAGE_JSON.version) return;\n\n const decl = path.get(\"declaration\");\n\n if (decl.isClassDeclaration() && hasDecorators(decl.node)) {\n if (decl.node.id) {\n // export default class Foo {}\n // -->\n // class Foo {} export { Foo as default }\n splitExportDeclaration(path);\n } else {\n // @ts-expect-error Anonymous class declarations can be\n // transformed as if they were expressions\n decl.node.type = \"ClassExpression\";\n }\n }\n }\n },\n },\n };\n}\n"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,EAAE;QAAER;MAAK,CAAC,EAAE;QACJ;UACjC,IAAIA,IAAI,CAACE,GAAG,CAACjC,UAAU,CAAC,aAAyB,EAAE;UAEnD,MAAM6G,IAAI,GAAGtE,IAAI,CAACN,GAAG,CAAC,aAAa,CAAC;UAEpC,IAAI4E,IAAI,CAAClE,kBAAkB,CAAC,CAAC,IAAI,IAAAK,0BAAa,EAAC6D,IAAI,CAAC5D,IAAI,CAAC,EAAE;YACzD,IAAI4D,IAAI,CAAC5D,IAAI,CAACY,EAAE,EAAE;cAIhB,IAAAiD,qCAAsB,EAACvE,IAAI,CAAC;YAC9B,CAAC,MAAM;cAGLsE,IAAI,CAAC5D,IAAI,CAAC8D,IAAI,GAAG,iBAAiB;YACpC;UACF;QACF;MACF;IACF;EACF,CAAC;AACH","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/helper-create-class-features-plugin/lib/misc.js b/node_modules/@babel/helper-create-class-features-plugin/lib/misc.js index 27b5a844..f11864b6 100644 --- a/node_modules/@babel/helper-create-class-features-plugin/lib/misc.js +++ b/node_modules/@babel/helper-create-class-features-plugin/lib/misc.js @@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.extractComputedKeys = extractComputedKeys; exports.injectInitialization = injectInitialization; +exports.memoiseComputedKey = memoiseComputedKey; var _core = require("@babel/core"); var _helperEnvironmentVisitor = require("@babel/helper-environment-visitor"); const findBareSupers = _core.traverse.visitors.merge([{ @@ -82,10 +83,32 @@ function injectInitialization(path, constructor, nodes, renamer, lastReturnsThis constructor.get("body").unshiftContainer("body", nodes); } } +function memoiseComputedKey(keyNode, scope, hint) { + const isUidReference = _core.types.isIdentifier(keyNode) && scope.hasUid(keyNode.name); + if (isUidReference) { + return; + } + const isMemoiseAssignment = _core.types.isAssignmentExpression(keyNode, { + operator: "=" + }) && _core.types.isIdentifier(keyNode.left) && scope.hasUid(keyNode.left.name); + if (isMemoiseAssignment) { + return _core.types.cloneNode(keyNode); + } else { + const ident = _core.types.identifier(hint); + scope.push({ + id: ident, + kind: "let" + }); + return _core.types.assignmentExpression("=", _core.types.cloneNode(ident), keyNode); + } +} function extractComputedKeys(path, computedPaths, file) { + const { + scope + } = path; const declarations = []; const state = { - classBinding: path.node.id && path.scope.getBinding(path.node.id.name), + classBinding: path.node.id && scope.getBinding(path.node.id.name), file }; for (const computedPath of computedPaths) { @@ -97,24 +120,10 @@ function extractComputedKeys(path, computedPaths, file) { } const computedNode = computedPath.node; if (!computedKey.isConstantExpression()) { - const scope = path.scope; - const isUidReference = _core.types.isIdentifier(computedKey.node) && scope.hasUid(computedKey.node.name); - const isMemoiseAssignment = computedKey.isAssignmentExpression({ - operator: "=" - }) && _core.types.isIdentifier(computedKey.node.left) && scope.hasUid(computedKey.node.left.name); - if (isUidReference) { - continue; - } else if (isMemoiseAssignment) { - declarations.push(_core.types.expressionStatement(_core.types.cloneNode(computedNode.key))); - computedNode.key = _core.types.cloneNode(computedNode.key.left); - } else { - const ident = path.scope.generateUidIdentifierBasedOnNode(computedNode.key); - scope.push({ - id: ident, - kind: "let" - }); - declarations.push(_core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.cloneNode(ident), computedNode.key))); - computedNode.key = _core.types.cloneNode(ident); + const assignment = memoiseComputedKey(computedKey.node, scope, scope.generateUidBasedOnNode(computedKey.node)); + if (assignment) { + declarations.push(_core.types.expressionStatement(assignment)); + computedNode.key = _core.types.cloneNode(assignment.left); } } } diff --git a/node_modules/@babel/helper-create-class-features-plugin/lib/misc.js.map b/node_modules/@babel/helper-create-class-features-plugin/lib/misc.js.map index 6f89dbdd..525af273 100644 --- a/node_modules/@babel/helper-create-class-features-plugin/lib/misc.js.map +++ b/node_modules/@babel/helper-create-class-features-plugin/lib/misc.js.map @@ -1 +1 @@ -{"version":3,"names":["_core","require","_helperEnvironmentVisitor","findBareSupers","traverse","visitors","merge","Super","path","node","parentPath","isCallExpression","callee","push","environmentVisitor","referenceVisitor","TSTypeAnnotation|TypeAnnotation","skip","ReferencedIdentifier","scope","hasOwnBinding","name","rename","handleClassTDZ","state","classBinding","getBinding","classNameTDZError","file","addHelper","throwNode","t","callExpression","stringLiteral","replaceWith","sequenceExpression","classFieldDefinitionEvaluationTDZVisitor","injectInitialization","constructor","nodes","renamer","lastReturnsThis","length","isDerived","superClass","newConstructor","classMethod","identifier","blockStatement","params","restElement","body","template","statement","ast","get","unshiftContainer","bareSupers","isFirst","bareSuper","map","n","cloneNode","isExpressionStatement","allNodes","toExpression","thisExpression","insertAfter","extractComputedKeys","computedPaths","declarations","id","computedPath","computedKey","isReferencedIdentifier","computedNode","isConstantExpression","isUidReference","isIdentifier","hasUid","isMemoiseAssignment","isAssignmentExpression","operator","left","expressionStatement","key","ident","generateUidIdentifierBasedOnNode","kind","assignmentExpression"],"sources":["../src/misc.ts"],"sourcesContent":["import { template, traverse, types as t } from \"@babel/core\";\nimport type { File } from \"@babel/core\";\nimport type { NodePath, Scope, Visitor, Binding } from \"@babel/traverse\";\nimport environmentVisitor from \"@babel/helper-environment-visitor\";\n\nconst findBareSupers = traverse.visitors.merge<NodePath<t.CallExpression>[]>([\n {\n Super(path) {\n const { node, parentPath } = path;\n if (parentPath.isCallExpression({ callee: node })) {\n this.push(parentPath);\n }\n },\n },\n environmentVisitor,\n]);\n\nconst referenceVisitor: Visitor<{ scope: Scope }> = {\n \"TSTypeAnnotation|TypeAnnotation\"(\n path: NodePath<t.TSTypeAnnotation | t.TypeAnnotation>,\n ) {\n path.skip();\n },\n\n ReferencedIdentifier(path: NodePath<t.Identifier>, { scope }) {\n if (scope.hasOwnBinding(path.node.name)) {\n scope.rename(path.node.name);\n path.skip();\n }\n },\n};\n\ntype HandleClassTDZState = {\n classBinding: Binding;\n file: File;\n};\n\nfunction handleClassTDZ(\n path: NodePath<t.Identifier>,\n state: HandleClassTDZState,\n) {\n if (\n state.classBinding &&\n state.classBinding === path.scope.getBinding(path.node.name)\n ) {\n const classNameTDZError = state.file.addHelper(\"classNameTDZError\");\n const throwNode = t.callExpression(classNameTDZError, [\n t.stringLiteral(path.node.name),\n ]);\n\n path.replaceWith(t.sequenceExpression([throwNode, path.node]));\n path.skip();\n }\n}\n\nconst classFieldDefinitionEvaluationTDZVisitor: Visitor<HandleClassTDZState> = {\n ReferencedIdentifier: handleClassTDZ,\n};\n\ninterface RenamerState {\n scope: Scope;\n}\n\nexport function injectInitialization(\n path: NodePath<t.Class>,\n constructor: NodePath<t.ClassMethod> | undefined,\n nodes: t.ExpressionStatement[],\n renamer?: (visitor: Visitor<RenamerState>, state: RenamerState) => void,\n lastReturnsThis?: boolean,\n) {\n if (!nodes.length) return;\n\n const isDerived = !!path.node.superClass;\n\n if (!constructor) {\n const newConstructor = t.classMethod(\n \"constructor\",\n t.identifier(\"constructor\"),\n [],\n t.blockStatement([]),\n );\n\n if (isDerived) {\n newConstructor.params = [t.restElement(t.identifier(\"args\"))];\n newConstructor.body.body.push(template.statement.ast`super(...args)`);\n }\n\n [constructor] = path\n .get(\"body\")\n .unshiftContainer(\"body\", newConstructor) as NodePath<t.ClassMethod>[];\n }\n\n if (renamer) {\n renamer(referenceVisitor, { scope: constructor.scope });\n }\n\n if (isDerived) {\n const bareSupers: NodePath<t.CallExpression>[] = [];\n constructor.traverse(findBareSupers, bareSupers);\n let isFirst = true;\n for (const bareSuper of bareSupers) {\n if (isFirst) {\n isFirst = false;\n } else {\n nodes = nodes.map(n => t.cloneNode(n));\n }\n if (!bareSuper.parentPath.isExpressionStatement()) {\n const allNodes: t.Expression[] = [\n bareSuper.node,\n ...nodes.map(n => t.toExpression(n)),\n ];\n if (!lastReturnsThis) allNodes.push(t.thisExpression());\n bareSuper.replaceWith(t.sequenceExpression(allNodes));\n } else {\n bareSuper.insertAfter(nodes);\n }\n }\n } else {\n constructor.get(\"body\").unshiftContainer(\"body\", nodes);\n }\n}\n\nexport function extractComputedKeys(\n path: NodePath<t.Class>,\n computedPaths: NodePath<t.ClassProperty | t.ClassMethod>[],\n file: File,\n) {\n const declarations: t.ExpressionStatement[] = [];\n const state = {\n classBinding: path.node.id && path.scope.getBinding(path.node.id.name),\n file,\n };\n for (const computedPath of computedPaths) {\n const computedKey = computedPath.get(\"key\");\n if (computedKey.isReferencedIdentifier()) {\n handleClassTDZ(computedKey, state);\n } else {\n computedKey.traverse(classFieldDefinitionEvaluationTDZVisitor, state);\n }\n\n const computedNode = computedPath.node;\n // Make sure computed property names are only evaluated once (upon class definition)\n // and in the right order in combination with static properties\n if (!computedKey.isConstantExpression()) {\n const scope = path.scope;\n const isUidReference =\n t.isIdentifier(computedKey.node) && scope.hasUid(computedKey.node.name);\n const isMemoiseAssignment =\n computedKey.isAssignmentExpression({ operator: \"=\" }) &&\n t.isIdentifier(computedKey.node.left) &&\n scope.hasUid(computedKey.node.left.name);\n if (isUidReference) {\n continue;\n } else if (isMemoiseAssignment) {\n declarations.push(t.expressionStatement(t.cloneNode(computedNode.key)));\n computedNode.key = t.cloneNode(\n (computedNode.key as t.AssignmentExpression).left as t.Identifier,\n );\n } else {\n const ident = path.scope.generateUidIdentifierBasedOnNode(\n computedNode.key,\n );\n // Declaring in the same block scope\n // Ref: https://github.com/babel/babel/pull/10029/files#diff-fbbdd83e7a9c998721c1484529c2ce92\n scope.push({\n id: ident,\n kind: \"let\",\n });\n declarations.push(\n t.expressionStatement(\n t.assignmentExpression(\"=\", t.cloneNode(ident), computedNode.key),\n ),\n );\n computedNode.key = t.cloneNode(ident);\n }\n }\n }\n\n return declarations;\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,yBAAA,GAAAD,OAAA;AAEA,MAAME,cAAc,GAAGC,cAAQ,CAACC,QAAQ,CAACC,KAAK,CAA+B,CAC3E;EACEC,KAAKA,CAACC,IAAI,EAAE;IACV,MAAM;MAAEC,IAAI;MAAEC;IAAW,CAAC,GAAGF,IAAI;IACjC,IAAIE,UAAU,CAACC,gBAAgB,CAAC;MAAEC,MAAM,EAAEH;IAAK,CAAC,CAAC,EAAE;MACjD,IA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IACF;EACF;EAEA,OAAOhB,YAAY;AACrB"}
\ No newline at end of file +{"version":3,"names":["_core","require","_helperEnvironmentVisitor","findBareSupers","traverse","visitors","merge","Super","path","node","parentPath","isCallExpression","callee","push","environmentVisitor","referenceVisitor","TSTypeAnnotation|TypeAnnotation","skip","ReferencedIdentifier","scope","hasOwnBinding","name","rename","handleClassTDZ","state","classBinding","getBinding","classNameTDZError","file","addHelper","throwNode","t","callExpression","stringLiteral","replaceWith","sequenceExpression","classFieldDefinitionEvaluationTDZVisitor","injectInitialization","constructor","nodes","renamer","lastReturnsThis","length","isDerived","superClass","newConstructor","classMethod","identifier","blockStatement","params","restElement","body","template","statement","ast","get","unshiftContainer","bareSupers","isFirst","bareSuper","map","n","cloneNode","isExpressionStatement","allNodes","toExpression","thisExpression","insertAfter","memoiseComputedKey","keyNode","hint","isUidReference","isIdentifier","hasUid","isMemoiseAssignment","isAssignmentExpression","operator","left","ident","id","kind","assignmentExpression","extractComputedKeys","computedPaths","declarations","computedPath","computedKey","isReferencedIdentifier","computedNode","isConstantExpression","assignment","generateUidBasedOnNode","expressionStatement","key"],"sources":["../src/misc.ts"],"sourcesContent":["import { template, traverse, types as t } from \"@babel/core\";\nimport type { File } from \"@babel/core\";\nimport type { NodePath, Scope, Visitor, Binding } from \"@babel/traverse\";\nimport environmentVisitor from \"@babel/helper-environment-visitor\";\n\nconst findBareSupers = traverse.visitors.merge<NodePath<t.CallExpression>[]>([\n {\n Super(path) {\n const { node, parentPath } = path;\n if (parentPath.isCallExpression({ callee: node })) {\n this.push(parentPath);\n }\n },\n },\n environmentVisitor,\n]);\n\nconst referenceVisitor: Visitor<{ scope: Scope }> = {\n \"TSTypeAnnotation|TypeAnnotation\"(\n path: NodePath<t.TSTypeAnnotation | t.TypeAnnotation>,\n ) {\n path.skip();\n },\n\n ReferencedIdentifier(path: NodePath<t.Identifier>, { scope }) {\n if (scope.hasOwnBinding(path.node.name)) {\n scope.rename(path.node.name);\n path.skip();\n }\n },\n};\n\ntype HandleClassTDZState = {\n classBinding: Binding;\n file: File;\n};\n\nfunction handleClassTDZ(\n path: NodePath<t.Identifier>,\n state: HandleClassTDZState,\n) {\n if (\n state.classBinding &&\n state.classBinding === path.scope.getBinding(path.node.name)\n ) {\n const classNameTDZError = state.file.addHelper(\"classNameTDZError\");\n const throwNode = t.callExpression(classNameTDZError, [\n t.stringLiteral(path.node.name),\n ]);\n\n path.replaceWith(t.sequenceExpression([throwNode, path.node]));\n path.skip();\n }\n}\n\nconst classFieldDefinitionEvaluationTDZVisitor: Visitor<HandleClassTDZState> = {\n ReferencedIdentifier: handleClassTDZ,\n};\n\ninterface RenamerState {\n scope: Scope;\n}\n\nexport function injectInitialization(\n path: NodePath<t.Class>,\n constructor: NodePath<t.ClassMethod> | undefined,\n nodes: t.ExpressionStatement[],\n renamer?: (visitor: Visitor<RenamerState>, state: RenamerState) => void,\n lastReturnsThis?: boolean,\n) {\n if (!nodes.length) return;\n\n const isDerived = !!path.node.superClass;\n\n if (!constructor) {\n const newConstructor = t.classMethod(\n \"constructor\",\n t.identifier(\"constructor\"),\n [],\n t.blockStatement([]),\n );\n\n if (isDerived) {\n newConstructor.params = [t.restElement(t.identifier(\"args\"))];\n newConstructor.body.body.push(template.statement.ast`super(...args)`);\n }\n\n [constructor] = path\n .get(\"body\")\n .unshiftContainer(\"body\", newConstructor) as NodePath<t.ClassMethod>[];\n }\n\n if (renamer) {\n renamer(referenceVisitor, { scope: constructor.scope });\n }\n\n if (isDerived) {\n const bareSupers: NodePath<t.CallExpression>[] = [];\n constructor.traverse(findBareSupers, bareSupers);\n let isFirst = true;\n for (const bareSuper of bareSupers) {\n if (isFirst) {\n isFirst = false;\n } else {\n nodes = nodes.map(n => t.cloneNode(n));\n }\n if (!bareSuper.parentPath.isExpressionStatement()) {\n const allNodes: t.Expression[] = [\n bareSuper.node,\n ...nodes.map(n => t.toExpression(n)),\n ];\n if (!lastReturnsThis) allNodes.push(t.thisExpression());\n bareSuper.replaceWith(t.sequenceExpression(allNodes));\n } else {\n bareSuper.insertAfter(nodes);\n }\n }\n } else {\n constructor.get(\"body\").unshiftContainer(\"body\", nodes);\n }\n}\n\ntype ComputedKeyAssignmentExpression = t.AssignmentExpression & {\n left: t.Identifier;\n};\n\n/**\n * Try to memoise a computed key.\n * It returns undefined when the computed key is an uid reference, otherwise\n * an assignment expression `memoiserId = computed key`\n * @export\n * @param {t.Expression} keyNode Computed key\n * @param {Scope} scope The scope where memoiser id should be registered\n * @param {string} hint The memoiser id hint\n * @returns {(ComputedKeyAssignmentExpression | undefined)}\n */\nexport function memoiseComputedKey(\n keyNode: t.Expression,\n scope: Scope,\n hint: string,\n): ComputedKeyAssignmentExpression | undefined {\n const isUidReference = t.isIdentifier(keyNode) && scope.hasUid(keyNode.name);\n if (isUidReference) {\n return;\n }\n const isMemoiseAssignment =\n t.isAssignmentExpression(keyNode, { operator: \"=\" }) &&\n t.isIdentifier(keyNode.left) &&\n scope.hasUid(keyNode.left.name);\n if (isMemoiseAssignment) {\n return t.cloneNode(keyNode as ComputedKeyAssignmentExpression);\n } else {\n const ident = t.identifier(hint);\n // Declaring in the same block scope\n // Ref: https://github.com/babel/babel/pull/10029/files#diff-fbbdd83e7a9c998721c1484529c2ce92\n scope.push({\n id: ident,\n kind: \"let\",\n });\n return t.assignmentExpression(\n \"=\",\n t.cloneNode(ident),\n keyNode,\n ) as ComputedKeyAssignmentExpression;\n }\n}\n\nexport function extractComputedKeys(\n path: NodePath<t.Class>,\n computedPaths: NodePath<t.ClassProperty | t.ClassMethod>[],\n file: File,\n) {\n const { scope } = path;\n const declarations: t.ExpressionStatement[] = [];\n const state = {\n classBinding: path.node.id && scope.getBinding(path.node.id.name),\n file,\n };\n for (const computedPath of computedPaths) {\n const computedKey = computedPath.get(\"key\");\n if (computedKey.isReferencedIdentifier()) {\n handleClassTDZ(computedKey, state);\n } else {\n computedKey.traverse(classFieldDefinitionEvaluationTDZVisitor, state);\n }\n\n const computedNode = computedPath.node;\n // Make sure computed property names are only evaluated once (upon class definition)\n // and in the right order in combination with static properties\n if (!computedKey.isConstantExpression()) {\n const assignment = memoiseComputedKey(\n computedKey.node,\n scope,\n scope.generateUidBasedOnNode(computedKey.node),\n );\n if (assignment) {\n declarations.push(t.expressionStatement(assignment));\n computedNode.key = t.cloneNode(assignment.left);\n }\n }\n }\n\n return declarations;\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,yBAAA,GAAAD,OAAA;AAEA,MAAME,cAAc,GAAGC,cAAQ,CAACC,QAAQ,CAACC,KAAK,CAA+B,CAC3E;EACEC,KAAKA,CAACC,IAAI,EAAE;IACV,MAAM;MAAEC,IAAI;MAAEC;IAAW,CAAC,GAAGF,IAAI;IACjC,IAAIE,UAAU,CAACC,gBAAgB,CAAC;MAAEC,MAAM,EAAEH;IAAK,CAAC,CAAC,EAAE;MACjD,IAAI,CAACI,IAAI,CAACH,UAAU,CAAC;IACvB;EACF;AACF,CAAC,EACDI,iCAAkB,CACnB,CAAC;AAEF,MAAMC,gBAA2C,GAAG;EAClD,iCAAiCC,CAC/BR,IAAqD,EACrD;IACAA,IAAI,CAACS,IAAI,CAAC,CAAC;EACb,CAAC;EAEDC,oBAAoBA,CAACV,IAA4B,EAAE;IAAEW;EAAM,CAAC,EAAE;IAC5D,IAAIA,KAAK,CAACC,aAAa,CAACZ,IAAI,CAACC,IAAI,CAACY,IAAI,CAAC,EAAE;MACvCF,KAAK,CAACG,MAAM,CAACd,IAAI,CAACC,IAAI,CAACY,IAAI,CAAC;MAC5Bb,IAAI,CAACS,IAAI,CAAC,CAAC;IACb;EACF;AACF,CAAC;AAOD,SAASM,cAAcA,CACrBf,IAA4B,EAC5BgB,KAA0B,EAC1B;EACA,IACEA,KAAK,CAACC,YAAY,IAClBD,KAAK,CAACC,YAAY,KAAKjB,IAAI,CAACW,KAAK,CAACO,UAAU,CAAClB,IAAI,CAACC,IAAI,CAACY,IAAI,CAAC,EAC5D;IACA,MAAM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WAAW,EAAE9D,KAAK,CAAC;IACpC,CAAC,MAAM;MACL8D,WAAW,CAAClF,QAAQ,CAACgC,wCAAwC,EAAEZ,KAAK,CAAC;IACvE;IAEA,MAAMgE,YAAY,GAAGH,YAAY,CAAC5E,IAAI;IAGtC,IAAI,CAAC6E,WAAW,CAACG,oBAAoB,CAAC,CAAC,EAAE;MACvC,MAAMC,UAAU,GAAGtB,kBAAkB,CACnCkB,WAAW,CAAC7E,IAAI,EAChBU,KAAK,EACLA,KAAK,CAACwE,sBAAsB,CAACL,WAAW,CAAC7E,IAAI,CAC/C,CAAC;MACD,IAAIiF,UAAU,EAAE;QACdN,YAAY,CAACvE,IAAI,CAACkB,WAAC,CAAC6D,mBAAmB,CAACF,UAAU,CAAC,CAAC;QACpDF,YAAY,CAACK,GAAG,GAAG9D,WAAC,CAAC+B,SAAS,CAAC4B,UAAU,CAACb,IAAI,CAAC;MACjD;IACF;EACF;EAEA,OAAOO,YAAY;AACrB","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/helper-create-class-features-plugin/lib/typescript.js.map b/node_modules/@babel/helper-create-class-features-plugin/lib/typescript.js.map index f8bda420..970f1022 100644 --- a/node_modules/@babel/helper-create-class-features-plugin/lib/typescript.js.map +++ b/node_modules/@babel/helper-create-class-features-plugin/lib/typescript.js.map @@ -1 +1 @@ -{"version":3,"names":["assertFieldTransformed","path","node","declare","buildCodeFrameError"],"sources":["../src/typescript.ts"],"sourcesContent":["import type { NodePath } from \"@babel/traverse\";\nimport type * as t from \"@babel/types\";\n\nexport function assertFieldTransformed(\n path: NodePath<t.ClassProperty | t.ClassDeclaration>,\n) {\n if (\n path.node.declare ||\n (process.env.BABEL_8_BREAKING\n ? path.isClassProperty({ definite: true })\n : false)\n ) {\n throw path.buildCodeFrameError(\n `TypeScript 'declare' fields must first be transformed by ` +\n `@babel/plugin-transform-typescript.\\n` +\n `If you have already enabled that plugin (or '@babel/preset-typescript'), make sure ` +\n `that it runs before any plugin related to additional class features:\\n` +\n ` - @babel/plugin-transform-class-properties\\n` +\n ` - @babel/plugin-transform-private-methods\\n` +\n ` - @babel/plugin-proposal-decorators`,\n );\n }\n}\n"],"mappings":";;;;;;AAGO,SAASA,sBAAsBA,CACpCC,IAAoD,EACpD;EACA,IACEA,IAAI,CAACC,IAAI,CAACC,OAAO,IAGb,KAAM,EACV;IACA,MAAMF,IAAI,CAACG,mBAAmB,CAC3B,2DAA0D,GACxD,uCAAsC,GACtC,qFAAoF,GACpF,wEAAuE,GACvE,+CAA8C,GAC9C,8CAA6C,GAC7C,sCACL,CAAC;EACH;AACF"}
\ No newline at end of file +{"version":3,"names":["assertFieldTransformed","path","node","declare","buildCodeFrameError"],"sources":["../src/typescript.ts"],"sourcesContent":["import type { NodePath } from \"@babel/traverse\";\nimport type * as t from \"@babel/types\";\n\nexport function assertFieldTransformed(\n path: NodePath<t.ClassProperty | t.ClassDeclaration>,\n) {\n if (\n path.node.declare ||\n (process.env.BABEL_8_BREAKING\n ? path.isClassProperty({ definite: true })\n : false)\n ) {\n throw path.buildCodeFrameError(\n `TypeScript 'declare' fields must first be transformed by ` +\n `@babel/plugin-transform-typescript.\\n` +\n `If you have already enabled that plugin (or '@babel/preset-typescript'), make sure ` +\n `that it runs before any plugin related to additional class features:\\n` +\n ` - @babel/plugin-transform-class-properties\\n` +\n ` - @babel/plugin-transform-private-methods\\n` +\n ` - @babel/plugin-proposal-decorators`,\n );\n }\n}\n"],"mappings":";;;;;;AAGO,SAASA,sBAAsBA,CACpCC,IAAoD,EACpD;EACA,IACEA,IAAI,CAACC,IAAI,CAACC,OAAO,IAGb,KAAM,EACV;IACA,MAAMF,IAAI,CAACG,mBAAmB,CAC3B,2DAA0D,GACxD,uCAAsC,GACtC,qFAAoF,GACpF,wEAAuE,GACvE,+CAA8C,GAC9C,8CAA6C,GAC7C,sCACL,CAAC;EACH;AACF","ignoreList":[]}
\ No newline at end of file diff --git a/node_modules/@babel/helper-create-class-features-plugin/package.json b/node_modules/@babel/helper-create-class-features-plugin/package.json index b2f0fdfb..7ad07eb1 100644 --- a/node_modules/@babel/helper-create-class-features-plugin/package.json +++ b/node_modules/@babel/helper-create-class-features-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-create-class-features-plugin", - "version": "7.23.7", + "version": "7.24.5", "author": "The Babel Team (https://babel.dev/team)", "license": "MIT", "description": "Compile class public and private fields, private methods and decorators to ES6", @@ -21,20 +21,20 @@ "@babel/helper-annotate-as-pure": "^7.22.5", "@babel/helper-environment-visitor": "^7.22.20", "@babel/helper-function-name": "^7.23.0", - "@babel/helper-member-expression-to-functions": "^7.23.0", + "@babel/helper-member-expression-to-functions": "^7.24.5", "@babel/helper-optimise-call-expression": "^7.22.5", - "@babel/helper-replace-supers": "^7.22.20", + "@babel/helper-replace-supers": "^7.24.1", "@babel/helper-skip-transparent-expression-wrappers": "^7.22.5", - "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/helper-split-export-declaration": "^7.24.5", "semver": "^6.3.1" }, "peerDependencies": { "@babel/core": "^7.0.0" }, "devDependencies": { - "@babel/core": "^7.23.7", - "@babel/helper-plugin-test-runner": "^7.22.5", - "@babel/preset-env": "^7.23.7", + "@babel/core": "^7.24.5", + "@babel/helper-plugin-test-runner": "^7.24.1", + "@babel/preset-env": "^7.24.5", "@types/charcodes": "^0.2.0", "charcodes": "^0.2.0" }, |
