{"version":3,"file":"index.js","sources":["../src/util.ts","../src/index.ts"],"sourcesContent":["import type { NodePath } from \"@babel/traverse\";\n\n/**\n * Test if a NodePath will be cast to boolean when evaluated.\n *\n * @example\n * // returns true\n * const nodePathAQDotB = NodePath(\"if (a?.#b) {}\").get(\"test\"); // a?.#b\n * willPathCastToBoolean(nodePathAQDotB)\n * @example\n * // returns false\n * willPathCastToBoolean(NodePath(\"a?.#b\"))\n * @todo Respect transparent expression wrappers\n * @see {@link packages/babel-plugin-proposal-optional-chaining/src/util.js}\n * @param {NodePath} path\n * @returns {boolean}\n */\nexport function willPathCastToBoolean(path: NodePath): boolean {\n const maybeWrapped = path;\n const { node, parentPath } = maybeWrapped;\n if (parentPath.isLogicalExpression()) {\n const { operator, right } = parentPath.node;\n if (\n operator === \"&&\" ||\n operator === \"||\" ||\n (operator === \"??\" && node === right)\n ) {\n return willPathCastToBoolean(parentPath);\n }\n }\n if (parentPath.isSequenceExpression()) {\n const { expressions } = parentPath.node;\n if (expressions[expressions.length - 1] === node) {\n return willPathCastToBoolean(parentPath);\n } else {\n // if it is in the middle of a sequence expression, we don't\n // care the return value so just cast to boolean for smaller\n // output\n return true;\n }\n }\n return (\n parentPath.isConditional({ test: node }) ||\n parentPath.isUnaryExpression({ operator: \"!\" }) ||\n parentPath.isLoop({ test: node })\n );\n}\n","import type { NodePath, Visitor } from \"@babel/traverse\";\nimport * as t from \"@babel/types\";\nimport { willPathCastToBoolean } from \"./util\";\n\nclass AssignmentMemoiser {\n private _map: WeakMap<t.Expression, { count: number; value: t.LVal }>;\n constructor() {\n this._map = new WeakMap();\n }\n\n has(key: t.Expression) {\n return this._map.has(key);\n }\n\n get(key: t.Expression) {\n if (!this.has(key)) return;\n\n const record = this._map.get(key);\n const { value } = record;\n\n record.count--;\n if (record.count === 0) {\n // The `count` access is the outermost function call (hopefully), so it\n // does the assignment.\n return t.assignmentExpression(\"=\", value, key);\n }\n return value;\n }\n\n set(key: t.Expression, value: t.LVal, count: number) {\n return this._map.set(key, { count, value });\n }\n}\n\nfunction toNonOptional(\n path: NodePath<t.Expression>,\n base: t.Expression,\n): t.Expression {\n const { node } = path;\n if (t.isOptionalMemberExpression(node)) {\n return t.memberExpression(base, node.property, node.computed);\n }\n\n if (path.isOptionalCallExpression()) {\n const callee = path.get(\"callee\");\n if (path.node.optional && callee.isOptionalMemberExpression()) {\n const { object } = callee.node;\n const context = path.scope.maybeGenerateMemoised(object) || object;\n callee\n .get(\"object\")\n .replaceWith(t.assignmentExpression(\"=\", context as t.LVal, object));\n\n return t.callExpression(t.memberExpression(base, t.identifier(\"call\")), [\n context,\n ...path.node.arguments,\n ]);\n }\n\n return t.callExpression(base, path.node.arguments);\n }\n\n return path.node;\n}\n\n// Determines if the current path is in a detached tree. This can happen when\n// we are iterating on a path, and replace an ancestor with a new node. Babel\n// doesn't always stop traversing the old node tree, and that can cause\n// inconsistencies.\nfunction isInDetachedTree(path: NodePath) {\n while (path) {\n if (path.isProgram()) break;\n\n const { parentPath, container, listKey } = path;\n const parentNode = parentPath.node;\n if (listKey) {\n if (container !== parentNode[listKey]) return true;\n } else {\n if (container !== parentNode) return true;\n }\n\n path = parentPath;\n }\n\n return false;\n}\n\ntype Member = NodePath<t.OptionalMemberExpression | t.MemberExpression>;\n\nconst handle = {\n memoise() {\n // noop.\n },\n\n handle(this: HandlerState, member: Member, noDocumentAll: boolean) {\n const { node, parent, parentPath, scope } = member;\n\n if (member.isOptionalMemberExpression()) {\n // Transforming optional chaining requires we replace ancestors.\n if (isInDetachedTree(member)) return;\n\n // We're looking for the end of _this_ optional chain, which is actually\n // the \"rightmost\" property access of the chain. This is because\n // everything up to that property access is \"optional\".\n //\n // Let's take the case of `FOO?.BAR.baz?.qux`, with `FOO?.BAR` being our\n // member. The \"end\" to most users would be `qux` property access.\n // Everything up to it could be skipped if it `FOO` were nullish. But\n // actually, we can consider the `baz` access to be the end. So we're\n // looking for the nearest optional chain that is `optional: true`.\n const endPath = member.find(({ node, parent }) => {\n if (t.isOptionalMemberExpression(parent)) {\n // We need to check `parent.object` since we could be inside the\n // computed expression of a `bad?.[FOO?.BAR]`. In this case, the\n // endPath is the `FOO?.BAR` member itself.\n return parent.optional || parent.object !== node;\n }\n if (t.isOptionalCallExpression(parent)) {\n // Checking `parent.callee` since we could be in the arguments, eg\n // `bad?.(FOO?.BAR)`.\n // Also skip `FOO?.BAR` in `FOO?.BAR?.()` since we need to transform the optional call to ensure proper this\n return (\n // In FOO?.#BAR?.(), endPath points the optional call expression so we skip FOO?.#BAR\n (node !== member.node && parent.optional) || parent.callee !== node\n );\n }\n return true;\n }) as NodePath<t.OptionalMemberExpression>;\n\n // Replace `function (a, x = a.b?.#c) {}` to `function (a, x = (() => a.b?.#c)() ){}`\n // so the temporary variable can be injected in correct scope\n // This can be further optimized to avoid unecessary IIFE\n if (scope.path.isPattern()) {\n endPath.replaceWith(\n // The injected member will be queued and eventually transformed when visited\n t.callExpression(t.arrowFunctionExpression([], endPath.node), []),\n );\n return;\n }\n\n const willEndPathCastToBoolean = willPathCastToBoolean(endPath);\n\n const rootParentPath = endPath.parentPath;\n if (\n rootParentPath.isUpdateExpression({ argument: node }) ||\n rootParentPath.isAssignmentExpression({ left: node })\n ) {\n throw member.buildCodeFrameError(`can't handle assignment`);\n }\n const isDeleteOperation = rootParentPath.isUnaryExpression({\n operator: \"delete\",\n });\n if (\n isDeleteOperation &&\n endPath.isOptionalMemberExpression() &&\n endPath.get(\"property\").isPrivateName()\n ) {\n // @babel/parser will throw error on `delete obj?.#x`.\n // This error serves as fallback when `delete obj?.#x` is constructed from babel types\n throw member.buildCodeFrameError(\n `can't delete a private class element`,\n );\n }\n\n // Now, we're looking for the start of this optional chain, which is\n // optional to the left of this member.\n //\n // Let's take the case of `foo?.bar?.baz.QUX?.BAM`, with `QUX?.BAM` being\n // our member. The \"start\" to most users would be `foo` object access.\n // But actually, we can consider the `bar` access to be the start. So\n // we're looking for the nearest optional chain that is `optional: true`,\n // which is guaranteed to be somewhere in the object/callee tree.\n let startingOptional: NodePath<t.Expression> = member;\n for (;;) {\n if (startingOptional.isOptionalMemberExpression()) {\n if (startingOptional.node.optional) break;\n startingOptional = startingOptional.get(\"object\");\n continue;\n } else if (startingOptional.isOptionalCallExpression()) {\n if (startingOptional.node.optional) break;\n startingOptional = startingOptional.get(\"callee\");\n continue;\n }\n // prevent infinite loop: unreachable if the AST is well-formed\n throw new Error(\n `Internal error: unexpected ${startingOptional.node.type}`,\n );\n }\n\n const startingProp = startingOptional.isOptionalMemberExpression()\n ? \"object\"\n : \"callee\";\n const startingNode = startingOptional.node[startingProp];\n const baseNeedsMemoised = scope.maybeGenerateMemoised(startingNode);\n const baseRef = baseNeedsMemoised ?? startingNode;\n\n // Compute parentIsOptionalCall before `startingOptional` is replaced\n // as `node` may refer to `startingOptional.node` before replaced.\n const parentIsOptionalCall = parentPath.isOptionalCallExpression({\n callee: node,\n });\n // here we use a function to wrap `parentIsOptionalCall` to get type\n // for parent, do not use it anywhere else\n // See https://github.com/microsoft/TypeScript/issues/10421\n const isOptionalCall = (\n parent: t.Node,\n ): parent is t.OptionalCallExpression => parentIsOptionalCall;\n // if parentIsCall is true, it implies that node.extra.parenthesized is always true\n const parentIsCall = parentPath.isCallExpression({ callee: node });\n startingOptional.replaceWith(toNonOptional(startingOptional, baseRef));\n if (isOptionalCall(parent)) {\n if (parent.optional) {\n parentPath.replaceWith(this.optionalCall(member, parent.arguments));\n } else {\n parentPath.replaceWith(this.call(member, parent.arguments));\n }\n } else if (parentIsCall) {\n // `(a?.#b)()` to `(a == null ? void 0 : a.#b.bind(a))()`\n member.replaceWith(this.boundGet(member));\n } else {\n member.replaceWith(this.get(member));\n }\n\n let regular: t.Expression = member.node;\n for (let current: NodePath = member; current !== endPath; ) {\n const parentPath = current.parentPath as NodePath<t.Expression>;\n // skip transforming `Foo.#BAR?.call(FOO)`\n if (\n parentPath === endPath &&\n isOptionalCall(parent) &&\n parent.optional\n ) {\n regular = parentPath.node;\n break;\n }\n regular = toNonOptional(parentPath, regular);\n current = parentPath;\n }\n\n let context: t.Identifier;\n const endParentPath = endPath.parentPath as NodePath<t.Expression>;\n if (\n t.isMemberExpression(regular) &&\n endParentPath.isOptionalCallExpression({\n callee: endPath.node,\n optional: true,\n })\n ) {\n const { object } = regular;\n context = member.scope.maybeGenerateMemoised(object);\n if (context) {\n regular.object = t.assignmentExpression(\"=\", context, object);\n }\n }\n\n let replacementPath: NodePath = endPath;\n if (isDeleteOperation) {\n replacementPath = endParentPath;\n regular = endParentPath.node;\n }\n\n const baseMemoised = baseNeedsMemoised\n ? t.assignmentExpression(\n \"=\",\n t.cloneNode(baseRef),\n t.cloneNode(startingNode),\n )\n : t.cloneNode(baseRef);\n\n if (willEndPathCastToBoolean) {\n let nonNullishCheck;\n if (noDocumentAll) {\n nonNullishCheck = t.binaryExpression(\n \"!=\",\n baseMemoised,\n t.nullLiteral(),\n );\n } else {\n nonNullishCheck = t.logicalExpression(\n \"&&\",\n t.binaryExpression(\"!==\", baseMemoised, t.nullLiteral()),\n t.binaryExpression(\n \"!==\",\n t.cloneNode(baseRef),\n scope.buildUndefinedNode(),\n ),\n );\n }\n replacementPath.replaceWith(\n t.logicalExpression(\"&&\", nonNullishCheck, regular),\n );\n } else {\n let nullishCheck;\n if (noDocumentAll) {\n nullishCheck = t.binaryExpression(\n \"==\",\n baseMemoised,\n t.nullLiteral(),\n );\n } else {\n nullishCheck = t.logicalExpression(\n \"||\",\n t.binaryExpression(\"===\", baseMemoised, t.nullLiteral()),\n t.binaryExpression(\n \"===\",\n t.cloneNode(baseRef),\n scope.buildUndefinedNode(),\n ),\n );\n }\n\n replacementPath.replaceWith(\n t.conditionalExpression(\n nullishCheck,\n isDeleteOperation\n ? t.booleanLiteral(true)\n : scope.buildUndefinedNode(),\n regular,\n ),\n );\n }\n\n // context and isDeleteOperation can not be both truthy\n if (context) {\n const endParent = endParentPath.node as t.OptionalCallExpression;\n endParentPath.replaceWith(\n t.optionalCallExpression(\n t.optionalMemberExpression(\n endParent.callee,\n t.identifier(\"call\"),\n false,\n true,\n ),\n [t.cloneNode(context), ...endParent.arguments],\n false,\n ),\n );\n }\n\n return;\n }\n\n // MEMBER++ -> _set(MEMBER, (_ref = (+_get(MEMBER))) + 1), _ref\n // ++MEMBER -> _set(MEMBER, (+_get(MEMBER)) + 1)\n if (t.isUpdateExpression(parent, { argument: node })) {\n if (this.simpleSet) {\n member.replaceWith(this.simpleSet(member));\n return;\n }\n\n const { operator, prefix } = parent;\n\n // Give the state handler a chance to memoise the member, since we'll\n // reference it twice. The second access (the set) should do the memo\n // assignment.\n this.memoise(member, 2);\n\n const value = t.binaryExpression(\n operator[0] as \"+\" | \"-\",\n t.unaryExpression(\"+\", this.get(member)),\n t.numericLiteral(1),\n );\n\n if (prefix) {\n parentPath.replaceWith(this.set(member, value));\n } else {\n const { scope } = member;\n const ref = scope.generateUidIdentifierBasedOnNode(node);\n scope.push({ id: ref });\n\n value.left = t.assignmentExpression(\n \"=\",\n t.cloneNode(ref),\n // @ts-expect-error todo(flow->ts) value.left is possibly PrivateName, which is not usable here\n value.left,\n );\n\n parentPath.replaceWith(\n t.sequenceExpression([this.set(member, value), t.cloneNode(ref)]),\n );\n }\n return;\n }\n\n // MEMBER = VALUE -> _set(MEMBER, VALUE)\n // MEMBER += VALUE -> _set(MEMBER, _get(MEMBER) + VALUE)\n // MEMBER ??= VALUE -> _get(MEMBER) ?? _set(MEMBER, VALUE)\n if (parentPath.isAssignmentExpression({ left: node })) {\n if (this.simpleSet) {\n member.replaceWith(this.simpleSet(member));\n return;\n }\n\n const { operator, right: value } = parentPath.node;\n\n if (operator === \"=\") {\n parentPath.replaceWith(this.set(member, value));\n } else {\n const operatorTrunc = operator.slice(0, -1);\n if (t.LOGICAL_OPERATORS.includes(operatorTrunc)) {\n // Give the state handler a chance to memoise the member, since we'll\n // reference it twice. The first access (the get) should do the memo\n // assignment.\n this.memoise(member, 1);\n parentPath.replaceWith(\n t.logicalExpression(\n operatorTrunc as t.LogicalExpression[\"operator\"],\n this.get(member),\n this.set(member, value),\n ),\n );\n } else {\n // Here, the second access (the set) is evaluated first.\n this.memoise(member, 2);\n parentPath.replaceWith(\n this.set(\n member,\n t.binaryExpression(\n operatorTrunc as t.BinaryExpression[\"operator\"],\n this.get(member),\n value,\n ),\n ),\n );\n }\n }\n return;\n }\n\n // MEMBER(ARGS) -> _call(MEMBER, ARGS)\n if (parentPath.isCallExpression({ callee: node })) {\n parentPath.replaceWith(this.call(member, parentPath.node.arguments));\n return;\n }\n\n // MEMBER?.(ARGS) -> _optionalCall(MEMBER, ARGS)\n if (parentPath.isOptionalCallExpression({ callee: node })) {\n // Replace `function (a, x = a.b.#c?.()) {}` to `function (a, x = (() => a.b.#c?.())() ){}`\n // so the temporary variable can be injected in correct scope\n // This can be further optimized to avoid unecessary IIFE\n if (scope.path.isPattern()) {\n parentPath.replaceWith(\n // The injected member will be queued and eventually transformed when visited\n t.callExpression(t.arrowFunctionExpression([], parentPath.node), []),\n );\n return;\n }\n parentPath.replaceWith(\n this.optionalCall(member, parentPath.node.arguments),\n );\n return;\n }\n\n // for (MEMBER of ARR)\n // for (MEMBER in ARR)\n // { KEY: MEMBER } = OBJ -> { KEY: _destructureSet(MEMBER) } = OBJ\n // { KEY: MEMBER = _VALUE } = OBJ -> { KEY: _destructureSet(MEMBER) = _VALUE } = OBJ\n // {...MEMBER} -> {..._destructureSet(MEMBER)}\n //\n // [MEMBER] = ARR -> [_destructureSet(MEMBER)] = ARR\n // [MEMBER = _VALUE] = ARR -> [_destructureSet(MEMBER) = _VALUE] = ARR\n // [...MEMBER] -> [..._destructureSet(MEMBER)]\n if (\n // for (MEMBER of ARR)\n // for (MEMBER in ARR)\n parentPath.isForXStatement({ left: node }) ||\n // { KEY: MEMBER } = OBJ\n (parentPath.isObjectProperty({ value: node }) &&\n parentPath.parentPath.isObjectPattern()) ||\n // { KEY: MEMBER = _VALUE } = OBJ\n (parentPath.isAssignmentPattern({ left: node }) &&\n parentPath.parentPath.isObjectProperty({ value: parent }) &&\n parentPath.parentPath.parentPath.isObjectPattern()) ||\n // [MEMBER] = ARR\n parentPath.isArrayPattern() ||\n // [MEMBER = _VALUE] = ARR\n (parentPath.isAssignmentPattern({ left: node }) &&\n parentPath.parentPath.isArrayPattern()) ||\n // {...MEMBER}\n // [...MEMBER]\n parentPath.isRestElement()\n ) {\n member.replaceWith(this.destructureSet(member));\n return;\n }\n\n if (parentPath.isTaggedTemplateExpression()) {\n // MEMBER -> _get(MEMBER).bind(this)\n member.replaceWith(this.boundGet(member));\n } else {\n // MEMBER -> _get(MEMBER)\n member.replaceWith(this.get(member));\n }\n },\n};\n\nexport interface Handler<State> {\n memoise?(\n this: HandlerState<State> & State,\n member: Member,\n count: number,\n ): void;\n destructureSet(\n this: HandlerState<State> & State,\n member: Member,\n ): t.Expression;\n boundGet(this: HandlerState<State> & State, member: Member): t.Expression;\n simpleSet?(this: HandlerState<State> & State, member: Member): t.Expression;\n get(this: HandlerState<State> & State, member: Member): t.Expression;\n set(\n this: HandlerState<State> & State,\n member: Member,\n value: t.Expression,\n ): t.Expression;\n call(\n this: HandlerState<State> & State,\n member: Member,\n args: t.CallExpression[\"arguments\"],\n ): t.Expression;\n optionalCall(\n this: HandlerState<State> & State,\n member: Member,\n args: t.OptionalCallExpression[\"arguments\"],\n ): t.Expression;\n}\n\nexport interface HandlerState<State = {}> extends Handler<State> {\n handle(\n this: HandlerState<State> & State,\n member: Member,\n noDocumentAll: boolean,\n ): void;\n memoiser: AssignmentMemoiser;\n}\n\n// We do not provide a default traversal visitor\n// Instead, caller passes one, and must call `state.handle` on the members\n// it wishes to be transformed.\n// Additionally, the caller must pass in a state object with at least\n// get, set, and call methods.\n// Optionally, a memoise method may be defined on the state, which will be\n// called when the member is a self-referential update.\nexport default function memberExpressionToFunctions<CustomState = {}>(\n path: NodePath,\n visitor: Visitor<HandlerState<CustomState>>,\n state: Handler<CustomState> & CustomState,\n) {\n path.traverse(visitor, {\n ...handle,\n ...state,\n memoiser: new AssignmentMemoiser(),\n });\n}\n"],"names":["willPathCastToBoolean","path","maybeWrapped","node","parentPath","isLogicalExpression","operator","right","isSequenceExpression","expressions","length","isConditional","test","isUnaryExpression","isLoop","AssignmentMemoiser","constructor","_map","WeakMap","has","key","get","record","value","count","t","assignmentExpression","set","toNonOptional","base","isOptionalMemberExpression","memberExpression","property","computed","isOptionalCallExpression","callee","optional","object","context","scope","maybeGenerateMemoised","replaceWith","callExpression","identifier","arguments","isInDetachedTree","isProgram","container","listKey","parentNode","handle","memoise","member","noDocumentAll","parent","endPath","find","isPattern","arrowFunctionExpression","willEndPathCastToBoolean","rootParentPath","isUpdateExpression","argument","isAssignmentExpression","left","buildCodeFrameError","isDeleteOperation","isPrivateName","startingOptional","Error","type","startingProp","startingNode","baseNeedsMemoised","baseRef","parentIsOptionalCall","isOptionalCall","parentIsCall","isCallExpression","optionalCall","call","boundGet","regular","current","endParentPath","isMemberExpression","replacementPath","baseMemoised","cloneNode","nonNullishCheck","binaryExpression","nullLiteral","logicalExpression","buildUndefinedNode","nullishCheck","conditionalExpression","booleanLiteral","endParent","optionalCallExpression","optionalMemberExpression","simpleSet","prefix","unaryExpression","numericLiteral","ref","generateUidIdentifierBasedOnNode","push","id","sequenceExpression","operatorTrunc","slice","LOGICAL_OPERATORS","includes","isForXStatement","isObjectProperty","isObjectPattern","isAssignmentPattern","isArrayPattern","isRestElement","destructureSet","isTaggedTemplateExpression","memberExpressionToFunctions","visitor","state","traverse","memoiser"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,SAASA,qBAAT,CAA+BC,IAA/B,EAAwD;AAC7D,QAAMC,YAAY,GAAGD,IAArB;AACA,QAAM;AAAEE,IAAAA,IAAF;AAAQC,IAAAA;AAAR,MAAuBF,YAA7B;;AACA,MAAIE,UAAU,CAACC,mBAAX,EAAJ,EAAsC;AACpC,UAAM;AAAEC,MAAAA,QAAF;AAAYC,MAAAA;AAAZ,QAAsBH,UAAU,CAACD,IAAvC;;AACA,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