You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
54 KiB

{"version":3,"file":"index.js","sources":["../src/util.ts","../src/index.ts"],"sourcesContent":["import { types as t } from \"@babel/core\";\nimport type { File } from \"@babel/core\";\nimport type { Scope, NodePath } from \"@babel/traverse\";\nimport type { TraversalAncestors } from \"@babel/types\";\n\nexport function unshiftForXStatementBody(\n statementPath: NodePath<t.ForXStatement>,\n newStatements: t.Statement[],\n) {\n statementPath.ensureBlock();\n const { scope, node } = statementPath;\n const bodyScopeBindings = statementPath.get(\"body\").scope.bindings;\n const hasShadowedBlockScopedBindings = Object.keys(bodyScopeBindings).some(\n name => scope.hasBinding(name),\n );\n\n if (hasShadowedBlockScopedBindings) {\n // handle shadowed variables referenced in computed keys:\n // var a = 0;for (const { #x: x, [a++]: y } of z) { const a = 1; }\n node.body = t.blockStatement([...newStatements, node.body]);\n } else {\n // @ts-ignore statementPath.ensureBlock() has been called, node.body is always a BlockStatement\n node.body.body.unshift(...newStatements);\n }\n}\n\n/**\n * Test if an ArrayPattern's elements contain any RestElements.\n */\n\nfunction hasArrayRest(pattern: t.ArrayPattern) {\n return pattern.elements.some(elem => t.isRestElement(elem));\n}\n\n/**\n * Test if an ObjectPattern's properties contain any RestElements.\n */\n\nfunction hasObjectRest(pattern: t.ObjectPattern) {\n return pattern.properties.some(prop => t.isRestElement(prop));\n}\n\ninterface UnpackableArrayExpression extends t.ArrayExpression {\n elements: (null | t.Expression)[];\n}\n\nconst STOP_TRAVERSAL = {};\n\ninterface ArrayUnpackVisitorState {\n deopt: boolean;\n bindings: Record<string, t.Identifier>;\n}\n\n// NOTE: This visitor is meant to be used via t.traverse\nconst arrayUnpackVisitor = (\n node: t.Node,\n ancestors: TraversalAncestors,\n state: ArrayUnpackVisitorState,\n) => {\n if (!ancestors.length) {\n // Top-level node: this is the array literal.\n return;\n }\n\n if (\n t.isIdentifier(node) &&\n t.isReferenced(node, ancestors[ancestors.length - 1].node) &&\n state.bindings[node.name]\n ) {\n state.deopt = true;\n throw STOP_TRAVERSAL;\n }\n};\n\nexport type DestructuringTransformerNode =\n | t.VariableDeclaration\n | t.ExpressionStatement\n | t.ReturnStatement;\n\ninterface DestructuringTransformerOption {\n blockHoist?: number;\n operator?: t.AssignmentExpression[\"operator\"];\n nodes?: DestructuringTransformerNode[];\n kind?: t.VariableDeclaration[\"kind\"];\n scope: Scope;\n arrayLikeIsIterable: boolean;\n iterableIsArray: boolean;\n objectRestNoSymbols: boolean;\n useBuiltIns: boolean;\n addHelper: File[\"addHelper\"];\n}\nexport class DestructuringTransformer {\n private blockHoist: number;\n private operator: t.AssignmentExpression[\"operator\"];\n arrayRefSet: Set<string>;\n private nodes: DestructuringTransformerNode[];\n private scope: Scope;\n private kind: t.VariableDeclaration[\"kind\"];\n private iterableIsArray: boolean;\n private arrayLikeIsIterable: boolean;\n private objectRestNoSymbols: boolean;\n private useBuiltIns: boolean;\n private addHelper: File[\"addHelper\"];\n constructor(opts: DestructuringTransformerOption) {\n this.blockHoist = opts.blockHoist;\n this.operator = opts.operator;\n this.arrayRefSet = new Set();\n this.nodes = opts.nodes || [];\n this.scope = opts.scope;\n this.kind = opts.kind;\n this.iterableIsArray = opts.iterableIsArray;\n this.arrayLikeIsIterable = opts.arrayLikeIsIterable;\n this.objectRestNoSymbols = opts.objectRestNoSymbols;\n this.useBuiltIns = opts.useBuiltIns;\n this.addHelper = opts.addHelper;\n }\n\n getExtendsHelper() {\n return this.useBuiltIns\n ? t.memberExpression(t.identifier(\"Object\"), t.identifier(\"assign\"))\n : this.addHelper(\"extends\");\n }\n\n buildVariableAssignment(\n id: t.AssignmentExpression[\"left\"],\n init: t.Expression,\n ) {\n let op = this.operator;\n if (t.isMemberExpression(id)) op = \"=\";\n\n let node: t.ExpressionStatement | t.VariableDeclaration;\n\n if (op) {\n node = t.expressionStatement(\n t.assignmentExpression(\n op,\n id,\n t.cloneNode(init) || this.scope.buildUndefinedNode(),\n ),\n );\n } else {\n let nodeInit: t.Expression;\n\n if (this.kind === \"const\" && init === null) {\n nodeInit = this.scope.buildUndefinedNode();\n } else {\n nodeInit = t.cloneNode(init);\n }\n\n node = t.variableDeclaration(this.kind, [\n t.variableDeclarator(id, nodeInit),\n ]);\n }\n\n //@ts-expect-error(todo): document block hoist property\n node._blockHoist = this.blockHoist;\n\n return node;\n }\n\n buildVariableDeclaration(id: t.Identifier, init: t.Expression) {\n const declar = t.variableDeclaration(\"var\", [\n t.variableDeclarator(t.cloneNode(id), t.cloneNode(init)),\n ]);\n // @ts-expect-error todo(flow->ts): avoid mutations\n declar._blockHoist = this.blockHoist;\n return declar;\n }\n\n push(id: t.LVal, _init: t.Expression | null) {\n const init = t.cloneNode(_init);\n if (t.isObjectPattern(id)) {\n this.pushObjectPattern(id, init);\n } else if (t.isArrayPattern(id)) {\n this.pushArrayPattern(id, init);\n } else if (t.isAssignmentPattern(id)) {\n this.pushAssignmentPattern(id, init);\n } else {\n this.nodes.push(this.buildVariableAssignment(id, init));\n }\n }\n\n toArray(node: t.Expression, count?: boolean | number) {\n if (\n this.iterableIsArray ||\n (t.isIdentifier(node) && this.arrayRefSet.has(node.name))\n ) {\n return node;\n } else {\n return this.scope.toArray(node, count, this.arrayLikeIsIterable);\n }\n }\n\n pushAssignmentPattern(\n { left, right }: t.AssignmentPattern,\n valueRef: t.Expression | null,\n ) {\n // handle array init hole\n // const [x = 42] = [,];\n // -> const x = 42;\n if (valueRef === null) {\n this.push(left, right);\n return;\n }\n\n // we need to assign the current value of the assignment to avoid evaluating\n // it more than once\n const tempId = this.scope.generateUidIdentifierBasedOnNode(valueRef);\n\n this.nodes.push(this.buildVariableDeclaration(tempId, valueRef));\n\n const tempConditional = t.conditionalExpression(\n t.binaryExpression(\n \"===\",\n t.cloneNode(tempId),\n this.scope.buildUndefinedNode(),\n ),\n right,\n t.cloneNode(tempId),\n );\n\n if (t.isPattern(left)) {\n let patternId;\n let node;\n\n if (this.kind === \"const\" || this.kind === \"let\") {\n patternId = this.scope.generateUidIdentifier(tempId.name);\n node = this.buildVariableDeclaration(patternId, tempConditional);\n } else {\n patternId = tempId;\n\n node = t.expressionStatement(\n t.assignmentExpression(\"=\", t.cloneNode(tempId), tempConditional),\n );\n }\n\n this.nodes.push(node);\n this.push(left, patternId);\n } else {\n this.nodes.push(this.buildVariableAssignment(left, tempConditional));\n }\n }\n\n pushObjectRest(\n pattern: t.ObjectPattern,\n objRef: t.Expression,\n spreadProp: t.RestElement,\n spreadPropIndex: number,\n ) {\n const value = buildObjectExcludingKeys(\n pattern.properties.slice(0, spreadPropIndex) as t.ObjectProperty[],\n objRef,\n this.scope,\n name => this.addHelper(name),\n this.objectRestNoSymbols,\n this.useBuiltIns,\n );\n this.nodes.push(this.buildVariableAssignment(spreadProp.argument, value));\n }\n\n pushObjectProperty(prop: t.ObjectProperty, propRef: t.Expression) {\n if (t.isLiteral(prop.key)) prop.computed = true;\n\n const pattern = prop.value as t.LVal;\n const objRef = t.memberExpression(\n t.cloneNode(propRef),\n prop.key,\n prop.computed,\n );\n\n if (t.isPattern(pattern)) {\n this.push(pattern, objRef);\n } else {\n this.nodes.push(this.buildVariableAssignment(pattern, objRef));\n }\n }\n\n pushObjectPattern(pattern: t.ObjectPattern, objRef: t.Expression | null) {\n // https://github.com/babel/babel/issues/681\n\n if (!pattern.properties.length || objRef === null) {\n this.nodes.push(\n t.expressionStatement(\n t.callExpression(\n this.addHelper(\"objectDestructuringEmpty\"),\n objRef !== null ? [objRef] : [],\n ),\n ),\n );\n return;\n }\n\n // if we have more than one properties in this pattern and the objectRef is a\n // member expression then we need to assign it to a temporary variable so it's\n // only evaluated once\n\n if (pattern.properties.length > 1 && !this.scope.isStatic(objRef)) {\n const temp = this.scope.generateUidIdentifierBasedOnNode(objRef);\n this.nodes.push(this.buildVariableDeclaration(temp, objRef));\n objRef = temp;\n }\n\n // Replace impure computed key expressions if we have a rest parameter\n if (hasObjectRest(pattern)) {\n let copiedPattern: t.ObjectPattern;\n for (let i = 0; i < pattern.properties.length; i++) {\n const prop = pattern.properties[i];\n if (t.isRestElement(prop)) {\n break;\n }\n const key = prop.key;\n if (prop.computed && !this.scope.isPure(key)) {\n const name = this.scope.generateUidIdentifierBasedOnNode(key);\n this.nodes.push(\n //@ts-expect-error PrivateName has been handled by destructuring-private\n this.buildVariableDeclaration(name, key),\n );\n if (!copiedPattern) {\n copiedPattern = pattern = {\n ...pattern,\n properties: pattern.properties.slice(),\n };\n }\n copiedPattern.properties[i] = {\n ...prop,\n key: name,\n };\n }\n }\n }\n //\n\n for (let i = 0; i < pattern.properties.length; i++) {\n const prop = pattern.properties[i];\n if (t.isRestElement(prop)) {\n this.pushObjectRest(pattern, objRef, prop, i);\n } else {\n this.pushObjectProperty(prop, objRef);\n }\n }\n }\n\n canUnpackArrayPattern(\n pattern: t.ArrayPattern,\n arr: t.Expression,\n ): arr is UnpackableArrayExpression {\n // not an array so there's no way we can deal with this\n if (!t.isArrayExpression(arr)) return false;\n\n // pattern has less elements than the array and doesn't have a rest so some\n // elements wont be evaluated\n if (pattern.elements.length > arr.elements.length) return;\n if (\n pattern.elements.length < arr.elements.length &&\n !hasArrayRest(pattern)\n ) {\n return false;\n }\n\n for (const elem of pattern.elements) {\n // deopt on holes\n if (!elem) return false;\n\n // deopt on member expressions as they may be included in the RHS\n if (t.isMemberExpression(elem)) return false;\n }\n\n for (const elem of arr.elements) {\n // deopt on spread elements\n if (t.isSpreadElement(elem)) return false;\n\n // deopt call expressions as they might change values of LHS variables\n if (t.isCallExpression(elem)) return false;\n\n // deopt on member expressions as they may be getter/setters and have side-effects\n if (t.isMemberExpression(elem)) return false;\n }\n\n // deopt on reference to left side identifiers\n const bindings = t.getBindingIdentifiers(pattern);\n const state: ArrayUnpackVisitorState = { deopt: false, bindings };\n\n try {\n t.traverse(arr, arrayUnpackVisitor, state);\n } catch (e) {\n if (e !== STOP_TRAVERSAL) throw e;\n }\n\n return !state.deopt;\n }\n\n pushUnpackedArrayPattern(\n pattern: t.ArrayPattern,\n arr: UnpackableArrayExpression,\n ) {\n for (let i = 0; i < pattern.elements.length; i++) {\n const elem = pattern.elements[i];\n if (t.isRestElement(elem)) {\n this.push(elem.argument, t.arrayExpression(arr.elements.slice(i)));\n } else {\n this.push(elem, arr.elements[i]);\n }\n }\n }\n\n pushArrayPattern(pattern: t.ArrayPattern, arrayRef: t.Expression | null) {\n if (arrayRef === null) {\n this.nodes.push(\n t.expressionStatement(\n t.callExpression(this.addHelper(\"objectDestructuringEmpty\"), []),\n ),\n );\n return;\n }\n if (!pattern.elements) return;\n\n // optimise basic array destructuring of an array expression\n //\n // we can't do this to a pattern of unequal size to it's right hand\n // array expression as then there will be values that wont be evaluated\n //\n // eg: let [a, b] = [1, 2];\n\n if (this.canUnpackArrayPattern(pattern, arrayRef)) {\n return this.pushUnpackedArrayPattern(pattern, arrayRef);\n }\n\n // if we have a rest then we need all the elements so don't tell\n // `scope.toArray` to only get a certain amount\n\n const count = !hasArrayRest(pattern) && pattern.elements.length;\n\n // so we need to ensure that the `arrayRef` is an array, `scope.toArray` will\n // return a locally bound identifier if it's been inferred to be an array,\n // otherwise it'll be a call to a helper that will ensure it's one\n\n const toArray = this.toArray(arrayRef, count);\n\n if (t.isIdentifier(toArray)) {\n // we've been given an identifier so it must have been inferred to be an\n // array\n arrayRef = toArray;\n } else {\n arrayRef = this.scope.generateUidIdentifierBasedOnNode(arrayRef);\n this.arrayRefSet.add(arrayRef.name);\n this.nodes.push(this.buildVariableDeclaration(arrayRef, toArray));\n }\n\n //\n\n for (let i = 0; i < pattern.elements.length; i++) {\n const elem = pattern.elements[i];\n\n // hole\n if (!elem) continue;\n\n let elemRef;\n\n if (t.isRestElement(elem)) {\n elemRef = this.toArray(arrayRef);\n elemRef = t.callExpression(\n t.memberExpression(elemRef, t.identifier(\"slice\")),\n [t.numericLiteral(i)],\n );\n\n // set the element to the rest element argument since we've dealt with it\n // being a rest already\n this.push(elem.argument, elemRef);\n } else {\n elemRef = t.memberExpression(arrayRef, t.numericLiteral(i), true);\n this.push(elem, elemRef);\n }\n }\n }\n\n init(pattern: t.LVal, ref: t.Expression) {\n // trying to destructure a value that we can't evaluate more than once so we\n // need to save it to a variable\n\n if (!t.isArrayExpression(ref) && !t.isMemberExpression(ref)) {\n const memo = this.scope.maybeGenerateMemoised(ref, true);\n if (memo) {\n this.nodes.push(this.buildVariableDeclaration(memo, t.cloneNode(ref)));\n ref = memo;\n }\n }\n\n //\n\n this.push(pattern, ref);\n\n return this.nodes;\n }\n}\n\ninterface ExcludingKey {\n key: t.Expression | t.PrivateName;\n computed: boolean;\n}\n\nexport function buildObjectExcludingKeys<T extends ExcludingKey>(\n excludedKeys: T[],\n objRef: t.Expression,\n scope: Scope,\n addHelper: File[\"addHelper\"],\n objectRestNoSymbols: boolean,\n useBuiltIns: boolean,\n): t.CallExpression {\n // get all the keys that appear in this object before the current spread\n\n const keys = [];\n let allLiteral = true;\n let hasTemplateLiteral = false;\n for (let i = 0; i < excludedKeys.length; i++) {\n const prop = excludedKeys[i];\n const key = prop.key;\n if (t.isIdentifier(key) && !prop.computed) {\n keys.push(t.stringLiteral(key.name));\n } else if (t.isTemplateLiteral(key)) {\n keys.push(t.cloneNode(key));\n hasTemplateLiteral = true;\n } else if (t.isLiteral(key)) {\n // @ts-expect-error todo(flow->ts) NullLiteral\n keys.push(t.stringLiteral(String(key.value)));\n } else if (t.isPrivateName(key)) {\n // private key is not enumerable\n } else {\n keys.push(t.cloneNode(key));\n allLiteral = false;\n }\n }\n\n let value;\n if (keys.length === 0) {\n const extendsHelper = useBuiltIns\n ? t.memberExpression(t.identifier(\"Object\"), t.identifier(\"assign\"))\n : addHelper(\"extends\");\n value = t.callExpression(extendsHelper, [\n t.objectExpression([]),\n t.cloneNode(objRef),\n ]);\n } else {\n let keyExpression: t.Expression = t.arrayExpression(keys);\n\n if (!allLiteral) {\n keyExpression = t.callExpression(\n t.memberExpression(keyExpression, t.identifier(\"map\")),\n [addHelper(\"toPropertyKey\")],\n );\n } else if (!hasTemplateLiteral && !t.isProgram(scope.block)) {\n // Hoist definition of excluded keys, so that it's not created each time.\n const programScope = scope.getProgramParent();\n const id = programScope.generateUidIdentifier(\"excluded\");\n\n programScope.push({\n id,\n init: keyExpression,\n kind: \"const\",\n });\n\n keyExpression = t.cloneNode(id);\n }\n\n value = t.callExpression(\n addHelper(`objectWithoutProperties${objectRestNoSymbols ? \"Loose\" : \"\"}`),\n [t.cloneNode(objRef), keyExpression],\n );\n }\n return value;\n}\n\nexport function convertVariableDeclaration(\n path: NodePath<t.VariableDeclaration>,\n addHelper: File[\"addHelper\"],\n arrayLikeIsIterable: boolean,\n iterableIsArray: boolean,\n objectRestNoSymbols: boolean,\n useBuiltIns: boolean,\n) {\n const { node, scope } = path;\n\n const nodeKind = node.kind;\n const nodeLoc = node.loc;\n const nodes = [];\n\n for (let i = 0; i < node.declarations.length; i++) {\n const declar = node.declarations[i];\n\n const patternId = declar.init;\n const pattern = declar.id;\n\n const destructuring: DestructuringTransformer =\n new DestructuringTransformer({\n // @ts-expect-error(todo): avoid internal properties access\n blockHoist: node._blockHoist,\n nodes: nodes,\n scope: scope,\n kind: node.kind,\n iterableIsArray,\n arrayLikeIsIterable,\n useBuiltIns,\n objectRestNoSymbols,\n addHelper,\n });\n\n if (t.isPattern(pattern)) {\n destructuring.init(pattern, patternId);\n\n if (+i !== node.declarations.length - 1) {\n // we aren't the last declarator so let's just make the\n // last transformed node inherit from us\n t.inherits(nodes[nodes.length - 1], declar);\n }\n } else {\n nodes.push(\n t.inherits(\n destructuring.buildVariableAssignment(pattern, patternId),\n declar,\n ),\n );\n }\n }\n\n let tail: t.VariableDeclaration | null = null;\n const nodesOut = [];\n for (const node of nodes) {\n if (t.isVariableDeclaration(node)) {\n if (tail !== null) {\n // Create a single compound declarations\n tail.declarations.push(...node.declarations);\n continue;\n } else {\n // Make sure the original node kind is used for each compound declaration\n node.kind = nodeKind;\n tail = node;\n }\n } else {\n tail = null;\n }\n // Propagate the original declaration node's location\n if (!node.loc) {\n node.loc = nodeLoc;\n }\n nodesOut.push(node);\n }\n\n if (nodesOut.length === 1) {\n path.replaceWith(nodesOut[0]);\n } else {\n path.replaceWithMultiple(nodesOut);\n }\n scope.crawl();\n}\n\nexport function convertAssignmentExpression(\n path: NodePath<t.AssignmentExpression>,\n addHelper: File[\"addHelper\"],\n arrayLikeIsIterable: boolean,\n iterableIsArray: boolean,\n objectRestNoSymbols: boolean,\n useBuiltIns: boolean,\n) {\n const { node, scope, parentPath } = path;\n\n const nodes: DestructuringTransformerNode[] = [];\n\n const destructuring = new DestructuringTransformer({\n operator: node.operator,\n scope: scope,\n nodes: nodes,\n arrayLikeIsIterable,\n iterableIsArray,\n objectRestNoSymbols,\n useBuiltIns,\n addHelper,\n });\n\n let ref: t.Identifier | void;\n if (\n (!parentPath.isExpressionStatement() &&\n !parentPath.isSequenceExpression()) ||\n path.isCompletionRecord()\n ) {\n ref = scope.generateUidIdentifierBasedOnNode(node.right, \"ref\");\n\n nodes.push(\n t.variableDeclaration(\"var\", [t.variableDeclarator(ref, node.right)]),\n );\n\n if (t.isArrayExpression(node.right)) {\n destructuring.arrayRefSet.add(ref.name);\n }\n }\n\n destructuring.init(node.left, ref || node.right);\n\n if (ref) {\n if (parentPath.isArrowFunctionExpression()) {\n path.replaceWith(t.blockStatement([]));\n nodes.push(t.returnStatement(t.cloneNode(ref)));\n } else {\n nodes.push(t.expressionStatement(t.cloneNode(ref)));\n }\n }\n\n path.replaceWithMultiple(nodes);\n scope.crawl();\n}\n","import { declare } from \"@babel/helper-plugin-utils\";\nimport { types as t } from \"@babel/core\";\nimport {\n DestructuringTransformer,\n convertVariableDeclaration,\n convertAssignmentExpression,\n unshiftForXStatementBody,\n type DestructuringTransformerNode,\n} from \"./util\";\nexport { buildObjectExcludingKeys, unshiftForXStatementBody } from \"./util\";\nimport type { NodePath } from \"@babel/traverse\";\n\n/**\n * Test if a VariableDeclaration's declarations contains any Patterns.\n */\n\nfunction variableDeclarationHasPattern(node: t.VariableDeclaration) {\n for (const declar of node.declarations) {\n if (t.isPattern(declar.id)) {\n return true;\n }\n }\n return false;\n}\n\nexport interface Options {\n allowArrayLike?: boolean;\n loose?: boolean;\n useBuiltIns?: boolean;\n}\n\nexport default declare((api, options: Options) => {\n api.assertVersion(7);\n\n const { useBuiltIns = false } = options;\n\n const iterableIsArray = (api.assumption(\"iterableIsArray\") ??\n options.loose ??\n false) as boolean;\n const arrayLikeIsIterable = (options.allowArrayLike ??\n api.assumption(\"arrayLikeIsIterable\") ??\n false) as boolean;\n const objectRestNoSymbols = (api.assumption(\"objectRestNoSymbols\") ??\n options.loose ??\n false) as boolean;\n\n return {\n name: \"transform-destructuring\",\n\n visitor: {\n ExportNamedDeclaration(path) {\n const declaration = path.get(\"declaration\");\n if (!declaration.isVariableDeclaration()) return;\n if (!variableDeclarationHasPattern(declaration.node)) return;\n\n const specifiers = [];\n\n for (const name of Object.keys(path.getOuterBindingIdentifiers())) {\n specifiers.push(\n t.exportSpecifier(t.identifier(name), t.identifier(name)),\n );\n }\n\n // Split the declaration and export list into two declarations so that the variable\n // declaration can be split up later without needing to worry about not being a\n // top-level statement.\n path.replaceWith(declaration.node);\n path.insertAfter(t.exportNamedDeclaration(null, specifiers));\n path.scope.crawl();\n },\n\n ForXStatement(path: NodePath<t.ForXStatement>) {\n const { node, scope } = path;\n const left = node.left;\n\n if (t.isPattern(left)) {\n // for ({ length: k } in { abc: 3 });\n\n const temp = scope.generateUidIdentifier(\"ref\");\n\n node.left = t.variableDeclaration(\"var\", [\n t.variableDeclarator(temp),\n ]);\n\n path.ensureBlock();\n const statementBody = path.node.body.body;\n const nodes = [];\n // todo: the completion of a for statement can only be observed from\n // a do block (or eval that we don't support),\n // but the new do-expression proposal plans to ban iteration ends in the\n // do block, maybe we can get rid of this\n if (statementBody.length === 0 && path.isCompletionRecord()) {\n nodes.unshift(t.expressionStatement(scope.buildUndefinedNode()));\n }\n\n nodes.unshift(\n t.expressionStatement(\n t.assignmentExpression(\"=\", left, t.cloneNode(temp)),\n ),\n );\n\n unshiftForXStatementBody(path, nodes);\n scope.crawl();\n return;\n }\n\n if (!t.isVariableDeclaration(left)) return;\n\n const pattern = left.declarations[0].id;\n if (!t.isPattern(pattern)) return;\n\n const key = scope.generateUidIdentifier(\"ref\");\n node.left = t.variableDeclaration(left.kind, [\n t.variableDeclarator(key, null),\n ]);\n\n const nodes: DestructuringTransformerNode[] = [];\n\n const destructuring = new DestructuringTransformer({\n kind: left.kind,\n scope: scope,\n nodes: nodes,\n arrayLikeIsIterable,\n iterableIsArray,\n objectRestNoSymbols,\n useBuiltIns,\n addHelper: name => this.addHelper(name),\n });\n\n destructuring.init(pattern, key);\n\n unshiftForXStatementBody(path, nodes);\n scope.crawl();\n },\n\n CatchClause({ node, scope }) {\n const pattern = node.param;\n if (!t.isPattern(pattern)) return;\n\n const ref = scope.generateUidIdentifier(\"ref\");\n node.param = ref;\n\n const nodes: DestructuringTransformerNode[] = [];\n\n const destructuring = new DestructuringTransformer({\n kind: \"let\",\n scope: scope,\n nodes: nodes,\n arrayLikeIsIterable,\n iterableIsArray,\n objectRestNoSymbols,\n useBuiltIns,\n addHelper: name => this.addHelper(name),\n });\n destructuring.init(pattern, ref);\n\n node.body.body = [...nodes, ...node.body.body];\n scope.crawl();\n },\n\n AssignmentExpression(path, state) {\n if (!t.isPattern(path.node.left)) return;\n convertAssignmentExpression(\n path,\n name => state.addHelper(name),\n arrayLikeIsIterable,\n iterableIsArray,\n objectRestNoSymbols,\n useBuiltIns,\n );\n },\n\n VariableDeclaration(path, state) {\n const { node, parent } = path;\n if (t.isForXStatement(parent)) return;\n if (!parent || !path.container) return; // i don't know why this is necessary - TODO\n if (!variableDeclarationHasPattern(node)) return;\n convertVariableDeclaration(\n path,\n name => state.addHelper(name),\n arrayLikeIsIterable,\n iterableIsArray,\n objectRestNoSymbols,\n useBuiltIns,\n );\n },\n },\n };\n});\n"],"names":["unshiftForXStatementBody","statementPath","newStatements","ensureBlock","scope","node","bodyScopeBindings","get","bindings","hasShadowedBlockScopedBindings","Object","keys","some","name","hasBinding","body","t","blockStatement","unshift","hasArrayRest","pattern","elements","elem","isRestElement","hasObjectRest","properties","prop","STOP_TRAVERSAL","arrayUnpackVisitor","ancestors","state","length","isIdentifier","isReferenced","deopt","DestructuringTransformer","constructor","opts","blockHoist","operator","arrayRefSet","nodes","kind","iterableIsArray","arrayLikeIsIterable","objectRestNoSymbols","useBuiltIns","addHelper","Set","getExtendsHelper","memberExpression","identifier","buildVariableAssignment","id","init","op","isMemberExpression","expressionStatement","assignmentExpression","cloneNode","buildUndefinedNode","nodeInit","variableDeclaration","variableDeclarator","_blockHoist","buildVariableDeclaration","declar","push","_init","isObjectPattern","pushObjectPattern","isArrayPattern","pushArrayPattern","isAssignmentPattern","pushAssignmentPattern","toArray","count","has","left","right","valueRef","tempId","generateUidIdentifierBasedOnNode","tempConditional","conditionalExpression","binaryExpression","isPattern","patternId","generateUidIdentifier","pushObjectRest","objRef","spreadProp","spreadPropIndex","value","buildObjectExcludingKeys","slice","argument","pushObjectProperty","propRef","isLiteral","key","computed","callExpression","isStatic","temp","copiedPattern","i","isPure","canUnpackArrayPattern","arr","isArrayExpression","isSpreadElement","isCallExpression","getBindingIdentifiers","traverse","e","pushUnpackedArrayPattern","arrayExpression","arrayRef","add","elemRef","numericLiteral","ref","memo","maybeGenerateMemoised","excludedKeys","allLiteral","hasTemplateLiteral","stringLiteral","isTemplateLiteral","String","isPrivateName","extendsHelper","objectExpression","keyExpression","isProgram","block","programScope","getProgramParent","convertVariableDeclaration","path","nodeKind","nodeLoc","loc","declarations","destructuring","inherits","tail","nodesOut","isVariableDeclaration","replaceWith","replaceWithMultiple","crawl","convertAssignmentExpression","parentPath","isExpressionStatement","isSequenceExpression","isCompletionRecord","isArrowFunctionExpression","returnStatement","variableDeclarationHasPattern","declare","api","options","assertVersion","assumption","loose","allowArrayLike","visitor","ExportNamedDeclaration","declaration","specifiers","getOuterBindingIdentifiers","exportSpecifier","insertAfter","exportNamedDeclaration","ForXStatement","statementBody","CatchClause","param","AssignmentExpression","VariableDeclaration","parent","isForXStatement","container"],"mappings":";;;;;;;AAKO,SAASA,wBAAT,CACLC,aADK,EAELC,aAFK,EAGL;AACAD,EAAAA,aAAa,CAACE,WAAd,EAAA,CAAA;EACA,MAAM;IAAEC,KAAF;AAASC,IAAAA,IAAAA;AAAT,GAAA,GAAkBJ,aAAxB,CAAA;EACA,MAAMK,iBAAiB,GAAGL,aAAa,CAACM,GAAd,CAAkB,MAAlB,CAAA,CAA0BH,KAA1B,CAAgCI,QAA1D,CAAA;AACA,EAAA,MAAMC,8BAA8B,GAAGC,MAAM,CAACC,IAAP,CAAYL,iBAAZ,CAA+BM,CAAAA,IAA/B,CACrCC,IAAI,IAAIT,KAAK,CAACU,UAAN,CAAiBD,IAAjB,CAD6B,CAAvC,CAAA;;AAIA,EAAA,IAAIJ,8BAAJ,EAAoC;AAGlCJ,IAAAA,IAAI,CAACU,IAAL,GAAYC,UAAC,CAACC,cAAF,CAAiB,CAAC,GAAGf,aAAJ,EAAmBG,IAAI,CAACU,IAAxB,CAAjB,CAAZ,CAAA;AACD,GAJD,MAIO;IAELV,IAAI,CAACU,IAAL,CAAUA,IAAV,CAAeG,OAAf,CAAuB,GAAGhB,aAA1B,CAAA,CAAA;AACD,GAAA;AACF,CAAA;;AAMD,SAASiB,YAAT,CAAsBC,OAAtB,EAA+C;AAC7C,EAAA,OAAOA,OAAO,CAACC,QAAR,CAAiBT,IAAjB,CAAsBU,IAAI,IAAIN,UAAC,CAACO,aAAF,CAAgBD,IAAhB,CAA9B,CAAP,CAAA;AACD,CAAA;;AAMD,SAASE,aAAT,CAAuBJ,OAAvB,EAAiD;AAC/C,EAAA,OAAOA,OAAO,CAACK,UAAR,CAAmBb,IAAnB,CAAwBc,IAAI,IAAIV,UAAC,CAACO,aAAF,CAAgBG,IAAhB,CAAhC,CAAP,CAAA;AACD,CAAA;;AAMD,MAAMC,cAAc,GAAG,EAAvB,CAAA;;A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