{"version":3,"file":"index.js","sources":["../src/util.ts","../src/index.ts"],"sourcesContent":["import { types as t } from \"@babel/core\";\nimport type { File, Scope, NodePath } from \"@babel/core\";\n\nfunction isPureVoid(node: t.Node) {\n return (\n t.isUnaryExpression(node) &&\n node.operator === \"void\" &&\n t.isPureish(node.argument)\n );\n}\n\nexport function unshiftForXStatementBody(\n statementPath: NodePath,\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 (node.body as t.BlockStatement).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;\n}\n\n// NOTE: This visitor is meant to be used via t.traverse\nconst arrayUnpackVisitor = (\n node: t.Node,\n ancestors: t.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 // eslint-disable-next-line @typescript-eslint/only-throw-error\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;\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) || t.isOptionalMemberExpression(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\" || this.kind === \"using\") && 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 as t.LVal, 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 with void 0. This also happens when\n // the value was originally a hole.\n // const [x = 42] = [void 0,];\n // -> const x = 42;\n if (isPureVoid(valueRef)) {\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 (\n this.kind === \"const\" ||\n this.kind === \"let\" ||\n this.kind === \"using\"\n ) {\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) {\n // https://github.com/babel/babel/issues/681\n\n if (!pattern.properties.length) {\n this.nodes.push(\n t.expressionStatement(\n t.callExpression(\n this.addHelper(\"objectDestructuringEmpty\"),\n isPureVoid(objRef) ? [] : [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 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 won't 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 const holeToUndefined = (el: t.Expression) =>\n el ?? this.scope.buildUndefinedNode();\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(\n elem.argument,\n t.arrayExpression(arr.elements.slice(i).map(holeToUndefined)),\n );\n } else {\n this.push(elem, holeToUndefined(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 won't be evaluated\n //\n // eg: let [a, b] = [1, 2];\n\n if (this.canUnpackArrayPattern(pattern, arrayRef)) {\n this.pushUnpackedArrayPattern(pattern, arrayRef);\n return;\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 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 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(\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.sequenceExpression([\n t.callExpression(addHelper(\"objectDestructuringEmpty\"), [\n t.cloneNode(objRef),\n ]),\n t.cloneNode(objRef),\n ]),\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,\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 let 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 (\n nodesOut.length === 2 &&\n t.isVariableDeclaration(nodesOut[0]) &&\n t.isExpressionStatement(nodesOut[1]) &&\n t.isCallExpression(nodesOut[1].expression) &&\n nodesOut[0].declarations.length === 1\n ) {\n // This can only happen when we generate this code:\n // var _ref = DESTRUCTURED_VALUE;\n // babelHelpers.objectDestructuringEmpty(_ref);\n // Since pushing those two statements to the for loop .init will require an IIFE,\n // we can optimize them to\n // babelHelpers.objectDestructuringEmpty(DESTRUCTURED_VALUE);\n const expr = nodesOut[1].expression;\n expr.arguments = [nodesOut[0].declarations[0].init];\n nodesOut = [expr];\n } else {\n // We must keep nodes all are expressions or statements, so `replaceWithMultiple` can work.\n if (\n t.isForStatement(path.parent, { init: node }) &&\n !nodesOut.some(v => t.isVariableDeclaration(v))\n ) {\n for (let i = 0; i < nodesOut.length; i++) {\n const node: t.Node = nodesOut[i];\n if (t.isExpressionStatement(node)) {\n nodesOut[i] = node.expression;\n }\n }\n }\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,\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, type NodePath } from \"@babel/core\";\nimport {\n DestructuringTransformer,\n convertVariableDeclaration,\n convertAssignmentExpression,\n unshiftForXStatementBody,\n type DestructuringTransformerNode,\n} from \"./util.ts\";\nexport { buildObjectExcludingKeys, unshiftForXStatementBody } from \"./util.ts\";\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(REQUIRED_VERSION(7));\n\n const { useBuiltIns = false } = options;\n\n const iterableIsArray =\n api.assumption(\"iterableIsArray\") ?? options.loose ?? false;\n const arrayLikeIsIterable =\n options.allowArrayLike ?? api.assumption(\"arrayLikeIsIterable\") ?? false;\n const objectRestNoSymbols =\n api.assumption(\"objectRestNoSymbols\") ?? options.loose ?? false;\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) {\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 as t.BlockStatement).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 as NodePath,\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":["isPureVoid","node","t","isUnaryExpression","operator","isPureish","argument","unshiftForXStatementBody","statementPath","newStatements","ensureBlock","scope","bodyScopeBindings","get","bindings","hasShadowedBlockScopedBindings","Object","keys","some","name","hasBinding","body","blockStatement","unshift","hasArrayRest","pattern","elements","elem","isRestElement","hasObjectRest","properties","prop","STOP_TRAVERSAL","arrayUnpackVisitor","ancestors","state","length","isIdentifier","isReferenced","deopt","DestructuringTransformer","constructor","opts","blockHoist","arrayRefSet","nodes","kind","iterableIsArray","arrayLikeIsIterable","objectRestNoSymbols","useBuiltIns","addHelper","Set","getExtendsHelper","memberExpression","identifier","buildVariableAssignment","id","init","op","isMemberExpression","isOptionalMemberExpression","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","pushObjectProperty","propRef","isLiteral","key","computed","callExpression","isStatic","temp","copiedPattern","i","isPure","assign","canUnpackArrayPattern","arr","isArrayExpression","isSpreadElement","isCallExpression","getBindingIdentifiers","traverse","e","pushUnpackedArrayPattern","holeToUndefined","el","arrayExpression","map","arrayRef","add","elemRef","numericLiteral","ref","memo","maybeGenerateMemoised","excludedKeys","allLiteral","hasTemplateLiteral","stringLiteral","isTemplateLiteral","String","isPrivateName","extendsHelper","objectExpression","sequenceExpression","keyExpression","isProgram","block","programScope","getProgramParent","convertVariableDeclaration","path","nodeKind","nodeLoc","loc","declarations","destructuring","inherits","tail","nodesOut","isVariableDeclaration","isExpressionStatement","expression","expr","arguments","isForStatement","parent","v","replaceWith","replaceWithMultiple","crawl","convertAssignmentExpression","parentPath","isSequenceExpression","isCompletionRecord","isArrowFunctionExpression","returnStatement","variableDeclarationHasPattern","declare","api","options","_ref","_api$assumption","_ref2","_options$allowArrayLi","_ref3","_api$assumption2","assertVersion","assumption","loose","allowArrayLike","visitor","ExportNamedDeclaration","declaration","specifiers","getOuterBindingIdentifiers","exportSpecifier","insertAfter","exportNamedDeclaration","ForXStatement","statementBody","CatchClause","param","AssignmentExpression","VariableDeclaration","isForXStatement","container"],"mappings":";;;;;;;AAGA,SAASA,UAAUA,CAACC,IAAY,EAAE;EAChC,OACEC,UAAC,CAACC,iBAAiB,CAACF,IAAI,CAAC,IACzBA,IAAI,CAACG,QAAQ,KAAK,MAAM,IACxBF,UAAC,CAACG,SAAS,CAACJ,IAAI,CAACK,QAAQ,CAAC,CAAA;AAE9B,CAAA;AAEO,SAASC,wBAAwBA,CACtCC,aAAwC,EACxCC,aAA4B,EAC5B;EACAD,aAAa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