{"version":3,"names":["_cache","require","_index","_context","_removal","_t","_hoister","arrowFunctionExpression","assertExpression","assignmentExpression","blockStatement","callExpression","cloneNode","expressionStatement","isAssignmentExpression","isCallExpression","isExportNamedDeclaration","isExpression","isIdentifier","isSequenceExpression","isSuper","thisExpression","insertBefore","nodes_","_assertUnremoved","call","nodes","_verifyNodeList","parentPath","parent","isExpressionStatement","isLabeledStatement","isExportDefaultDeclaration","isDeclaration","isNodeType","isJSXElement","isForStatement","key","node","push","replaceExpressionWithStatements","Array","isArray","container","_containerInsertBefore","isStatementOrBlock","shouldInsertCurrentNode","expression","blockPath","replaceWith","unshiftContainer","Error","_containerInsert","from","updateSiblingKeys","length","paths","splice","i","_this$context","to","path","getSibling","context","queue","pushContext","contexts","_getQueueContexts","setScope","debug","maybeQueue","_containerInsertAfter","last","arr","isHiddenInSequenceExpression","expressions","isAlmostConstantAssignment","scope","left","blockScope","getBlockParent","hasOwnBinding","name","getOwnBinding","constantViolations","insertAfter","get","map","self","isPattern","unshift","callee","isPure","isMethod","computed","temp","generateDeclaredUidIdentifier","pushContainer","fromIndex","incrementBy","getCachedPaths","msg","type","NodePath","listKey","verifiedNodes","setContext","replaceWithMultiple","exports","hoist","hoister","PathHoister","run"],"sources":["../../src/path/modification.ts"],"sourcesContent":["// This file contains methods that modify the path/node in some ways.\n\nimport { getCachedPaths } from \"../cache.ts\";\nimport NodePath from \"./index.ts\";\nimport { _getQueueContexts, pushContext, setScope } from \"./context.ts\";\nimport { _assertUnremoved } from \"./removal.ts\";\nimport {\n arrowFunctionExpression,\n assertExpression,\n assignmentExpression,\n blockStatement,\n callExpression,\n cloneNode,\n expressionStatement,\n isAssignmentExpression,\n isCallExpression,\n isExportNamedDeclaration,\n isExpression,\n isIdentifier,\n isSequenceExpression,\n isSuper,\n thisExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type Scope from \"../scope/index.ts\";\nimport type {\n NodeList,\n NodeOrNodeList,\n NodeListType,\n NodePaths,\n} from \"./index.ts\";\n\n/**\n * Insert the provided nodes before the current one.\n */\n\nexport function insertBefore>(\n this: NodePath,\n nodes_: Nodes,\n): NodePaths {\n _assertUnremoved.call(this);\n\n const nodes = _verifyNodeList.call(this, nodes_);\n\n const { parentPath, parent } = this;\n\n if (\n parentPath.isExpressionStatement() ||\n parentPath.isLabeledStatement() ||\n // https://github.com/babel/babel/issues/15293\n // When Babel transforms `export class String { field }`, the class properties plugin will inject the defineProperty\n // helper, which depends on the builtins e.g. String, Number, Symbol, etc. To prevent them from being shadowed by local\n // exports, the helper injector replaces the named export into `class _String { field }; export { _String as String }`,\n // with `parentPath` here changed to the moved ClassDeclaration, causing rare inconsistency between `parent` and `parentPath`.\n // Here we retrieve the parent type from the `parent` property. This is a temporary fix and we should revisit when\n // helpers should get injected.\n isExportNamedDeclaration(parent) ||\n (parentPath.isExportDefaultDeclaration() && this.isDeclaration())\n ) {\n return parentPath.insertBefore(nodes as Nodes);\n } else if (\n (this.isNodeType(\"Expression\") && !this.isJSXElement()) ||\n (parentPath.isForStatement() && this.key === \"init\")\n ) {\n if (this.node) nodes.push(this.node);\n // @ts-expect-error todo(flow->ts): check that nodes is an array of statements\n return this.replaceExpressionWithStatements(nodes);\n } else if (Array.isArray(this.container)) {\n return _containerInsertBefore.call(this, nodes) as NodePaths;\n } else if (this.isStatementOrBlock()) {\n const node = this.node as t.Statement;\n const shouldInsertCurrentNode =\n node &&\n (!this.isExpressionStatement() ||\n (node as t.ExpressionStatement).expression != null);\n\n const [blockPath] = this.replaceWith(\n blockStatement(shouldInsertCurrentNode ? [node] : []),\n );\n return blockPath.unshiftContainer(\n \"body\",\n nodes as t.Statement[],\n ) as NodePaths;\n } else {\n throw new Error(\n \"We don't know what to do with this node type. \" +\n \"We were previously a Statement but we can't fit in here?\",\n );\n }\n}\n\nexport function _containerInsert>(\n this: NodePath,\n from: number,\n nodes: Nodes,\n): NodePaths {\n updateSiblingKeys.call(this, from, nodes.length);\n\n const paths: NodePath[] = [];\n\n // @ts-expect-error todo(flow->ts): this.container could be a NodePath\n this.container.splice(from, 0, ...nodes);\n for (let i = 0; i < nodes.length; i++) {\n const to = from + i;\n const path = this.getSibling(to);\n paths.push(path);\n\n if (this.context?.queue) {\n pushContext.call(path, this.context);\n }\n }\n\n const contexts = _getQueueContexts.call(this);\n\n for (const path of paths) {\n setScope.call(path);\n path.debug(\"Inserted.\");\n\n for (const context of contexts) {\n context.maybeQueue(path, true);\n }\n }\n\n return paths as NodePaths;\n}\n\nexport function _containerInsertBefore>(\n this: NodePath,\n nodes: Nodes,\n): NodePaths {\n return _containerInsert.call(\n this,\n this.key as number,\n nodes,\n ) as NodePaths;\n}\n\nexport function _containerInsertAfter>(\n this: NodePath,\n nodes: Nodes,\n): NodePaths {\n return _containerInsert.call(\n this,\n (this.key as number) + 1,\n nodes,\n ) as NodePaths;\n}\n\nconst last = (arr: T[]) => arr[arr.length - 1];\n\nfunction isHiddenInSequenceExpression(path: NodePath): boolean {\n return (\n isSequenceExpression(path.parent) &&\n (last(path.parent.expressions) !== path.node ||\n isHiddenInSequenceExpression(path.parentPath))\n );\n}\n\nfunction isAlmostConstantAssignment(\n node: t.Node,\n scope: Scope,\n): node is t.AssignmentExpression & { left: t.Identifier } {\n if (!isAssignmentExpression(node) || !isIdentifier(node.left)) {\n return false;\n }\n\n // Not every scope can contain variables. For example, we might be in\n // a ClassScope either in the ClassHeritage or in a computed key.\n const blockScope = scope.getBlockParent();\n\n // If the variable is defined in the current scope and only assigned here,\n // we can be sure that its value won't change.\n return (\n blockScope.hasOwnBinding(node.left.name) &&\n blockScope.getOwnBinding(node.left.name).constantViolations.length <= 1\n );\n}\n\n/**\n * Insert the provided nodes after the current one. When inserting nodes after an\n * expression, ensure that the completion record is correct by pushing the current node.\n */\n\nexport function insertAfter>(\n this: NodePath,\n nodes_: Nodes,\n): NodePaths {\n _assertUnremoved.call(this);\n\n if (this.isSequenceExpression()) {\n return last(this.get(\"expressions\")).insertAfter(nodes_);\n }\n\n const nodes = _verifyNodeList.call(this, nodes_);\n\n const { parentPath, parent } = this;\n if (\n parentPath.isExpressionStatement() ||\n parentPath.isLabeledStatement() ||\n // see insertBefore\n isExportNamedDeclaration(parent) ||\n (parentPath.isExportDefaultDeclaration() && this.isDeclaration())\n ) {\n return parentPath.insertAfter(\n nodes.map(node => {\n // Usually after an expression we can safely insert another expression:\n // A.insertAfter(B)\n // foo = A; -> foo = (A, B);\n // If A is an expression statement, it isn't safe anymore so we need to\n // convert B to an expression statement\n // A; -> A; B // No semicolon! It could break if followed by [!\n return isExpression(node) ? expressionStatement(node) : node;\n }),\n // todo: this cast is unsound, we wrap some expression nodes in expressionStatement but never unwrap them in the return values.\n ) as NodePaths;\n } else if (\n (this.isNodeType(\"Expression\") &&\n !this.isJSXElement() &&\n !parentPath.isJSXElement()) ||\n (parentPath.isForStatement() && this.key === \"init\")\n ) {\n const self = this as NodePath;\n if (self.node) {\n const node = self.node;\n let { scope } = this;\n\n if (scope.path.isPattern()) {\n assertExpression(node);\n\n self.replaceWith(callExpression(arrowFunctionExpression([], node), []));\n (self.get(\"callee.body\") as NodePath).insertAfter(nodes);\n // todo: this cast is unsound, we wrap nodes in the IIFE but never unwrap them in the return values.\n // consider just returning the insertAfter result.\n return [self] as NodePaths;\n }\n\n if (isHiddenInSequenceExpression(self)) {\n nodes.unshift(node);\n }\n // We need to preserve the value of this expression.\n else if (isCallExpression(node) && isSuper(node.callee)) {\n nodes.unshift(node);\n // `super(...)` always evaluates to `this`.\n nodes.push(thisExpression());\n } else if (isAlmostConstantAssignment(node, scope)) {\n nodes.unshift(node);\n nodes.push(cloneNode(node.left));\n } else if (scope.isPure(node, true)) {\n // Insert the nodes before rather than after; it's not observable.\n nodes.push(node);\n } else {\n // Inserting after the computed key of a method should insert the\n // temporary binding in the method's parent's scope.\n if (parentPath.isMethod({ computed: true, key: node })) {\n scope = scope.parent;\n }\n const temp = scope.generateDeclaredUidIdentifier();\n nodes.unshift(\n expressionStatement(\n // @ts-expect-error todo(flow->ts): This can be a variable\n // declaration in the \"init\" of a for statement, but that's\n // invalid here.\n assignmentExpression(\"=\", cloneNode(temp), node),\n ),\n );\n nodes.push(expressionStatement(cloneNode(temp)));\n }\n }\n // @ts-expect-error todo(flow->ts): check that nodes is an array of statements\n return this.replaceExpressionWithStatements(nodes);\n } else if (Array.isArray(this.container)) {\n return _containerInsertAfter.call(this, nodes) as NodePaths;\n } else if (this.isStatementOrBlock()) {\n const node = this.node as t.Statement;\n const shouldInsertCurrentNode =\n node &&\n (!this.isExpressionStatement() ||\n (node as t.ExpressionStatement).expression != null);\n\n const [blockPath] = this.replaceWith(\n blockStatement(shouldInsertCurrentNode ? [node] : []),\n );\n return blockPath.pushContainer(\n \"body\",\n nodes as t.Statement[],\n ) as NodePaths;\n } else {\n throw new Error(\n \"We don't know what to do with this node type. \" +\n \"We were previously a Statement but we can't fit in here?\",\n );\n }\n}\n\n/**\n * Update all sibling node paths after `fromIndex` by `incrementBy`.\n */\n\nexport function updateSiblingKeys(\n this: NodePath,\n fromIndex: number,\n incrementBy: number,\n) {\n if (!this.parent) return;\n\n const paths = getCachedPaths(this);\n if (!paths) return;\n\n for (const [, path] of paths) {\n if (\n typeof path.key === \"number\" &&\n path.container === this.container &&\n path.key >= fromIndex\n ) {\n path.key += incrementBy;\n }\n }\n}\n\nexport function _verifyNodeList(\n this: NodePath,\n nodes: N | N[],\n) {\n if (!nodes) {\n return [];\n }\n\n if (!Array.isArray(nodes)) {\n nodes = [nodes];\n }\n\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n let msg;\n\n if (!node) {\n msg = \"has falsy node\";\n } else if (typeof node !== \"object\") {\n msg = \"contains a non-object node\";\n } else if (!node.type) {\n msg = \"without a type\";\n } else if (node instanceof NodePath) {\n msg = \"has a NodePath when it expected a raw object\";\n }\n\n if (msg) {\n const type = Array.isArray(node) ? \"array\" : typeof node;\n throw new Error(\n `Node list ${msg} with the index of ${i} and type of ${type}`,\n );\n }\n }\n\n return nodes;\n}\n\ntype NodeKeyOfArrays = {\n [P in string & keyof N]-?: N[P] extends Array ? P : never;\n}[string & keyof N];\n\nexport function unshiftContainer<\n N extends t.Node,\n K extends NodeKeyOfArrays,\n Nodes extends NodeOrNodeList>,\n>(this: NodePath, listKey: K, nodes: Nodes): NodePaths {\n _assertUnremoved.call(this);\n\n const verifiedNodes = _verifyNodeList.call(this, nodes);\n\n // get the first path and insert our nodes before it, if it doesn't exist then it\n // doesn't matter, our nodes will be inserted anyway\n const container = (this.node as N)[listKey] as t.Node[];\n const path = NodePath.get({\n parentPath: this,\n parent: this.node,\n container,\n listKey,\n key: 0,\n }).setContext(this.context);\n\n return _containerInsertBefore.call(path, verifiedNodes) as NodePaths;\n}\n\nexport function pushContainer<\n N extends t.Node,\n K extends NodeKeyOfArrays,\n Nodes extends NodeOrNodeList>,\n>(this: NodePath, listKey: K, nodes: Nodes): NodePaths {\n _assertUnremoved.call(this);\n\n const verifiedNodes = _verifyNodeList.call(this, nodes);\n\n // get an invisible path that represents the last node + 1 and replace it with our\n // nodes, effectively inlining it\n\n const container = (this.node as N)[listKey] as t.Node[];\n const path = NodePath.get({\n parentPath: this,\n parent: this.node,\n container,\n listKey,\n key: container.length,\n }).setContext(this.context);\n\n return path.replaceWithMultiple(verifiedNodes) as NodePaths;\n}\n\nimport PathHoister from \"./lib/hoister.ts\" with { if: \"!process.env.BABEL_8_BREAKING && !USE_ESM\" };\nif (!process.env.BABEL_8_BREAKING && !USE_ESM) {\n /**\n * Hoist the current node to the highest scope possible and return a UID\n * referencing it.\n */\n // eslint-disable-next-line no-restricted-globals\n exports.hoist = function hoist(\n this: NodePath,\n scope: Scope = this.scope,\n ) {\n const hoister = new PathHoister(this, scope);\n return hoister.run();\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA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