supercat666's picture
fixed igv
1df763a
raw
history blame
75.9 kB
{"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 PrivateNamesMapGeneric<V> = Map<string, V>;\n\ntype PrivateNamesMap = PrivateNamesMapGeneric<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\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> & 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 // @ts-expect-error: TS2590: Expression produces a union type that is too complex to represent.\n const privateNameVisitor: Visitor<\n PrivateNameVisitorState<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 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\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 ??\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 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;AAGA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,yBAAA,GAAA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