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 line
60 KiB
1 line
60 KiB
{"version":3,"file":"index.js","sources":["../src/util.ts","../src/index.ts"],"sourcesContent":["import { types as t, template } 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<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 (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<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: 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<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) || 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(\n id as t.Identifier | t.ArrayPattern | t.ObjectPattern,\n nodeInit,\n ),\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(\n this.buildVariableAssignment(\n id as t.AssignmentExpression[\"left\"],\n init,\n ),\n );\n }\n }\n\n toArray(node: t.Expression, count?: false | number) {\n if (\n this.iterableIsArray ||\n (t.isIdentifier(node) && this.arrayRefSet.has(node.name))\n ) {\n return node;\n } else {\n const { scope, arrayLikeIsIterable } = this;\n\n if (t.isIdentifier(node)) {\n const binding = scope.getBinding(node.name);\n if (binding?.constant && binding.path.isGenericType(\"Array\")) {\n return node;\n }\n }\n\n if (t.isArrayExpression(node)) {\n return node;\n }\n\n if (t.isIdentifier(node, { name: \"arguments\" })) {\n return template.expression.ast`\n Array.prototype.slice.call(${node})\n `;\n }\n\n let helperName;\n const args = [node];\n if (typeof count === \"number\") {\n args.push(t.numericLiteral(count));\n\n // Used in array-rest to create an array from a subset of an iterable.\n helperName = \"slicedToArray\";\n // TODO if (this.hub.isLoose(\"es6.forOf\")) helperName += \"-loose\";\n } else {\n // Used in array-rest to create an array\n helperName = \"toArray\";\n }\n\n if (arrayLikeIsIterable) {\n args.unshift(scope.path.hub.addHelper(helperName));\n helperName = \"maybeArrayLike\";\n }\n\n return t.callExpression(scope.path.hub.addHelper(helperName), args);\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.AssignmentExpression[\"left\"];\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<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.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<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 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<t.AssignmentExpression & { left: t.Pattern }>,\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<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 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<t.AssignmentExpression & { left: t.Pattern }>,\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","binding","getBinding","constant","path","isGenericType","isArrayExpression","template","expression","ast","helperName","args","numericLiteral","hub","callExpression","left","right","valueRef","tempId","generateUidIdentifierBasedOnNode","tempConditional","conditionalExpression","binaryExpression","isPattern","patternId","generateUidIdentifier","pushObjectRest","objRef","spreadProp","spreadPropIndex","value","buildObjectExcludingKeys","slice","pushObjectProperty","propRef","isLiteral","key","computed","isStatic","temp","copiedPattern","i","isPure","assign","canUnpackArrayPattern","arr","isSpreadElement","isCallExpression","getBindingIdentifiers","traverse","e","pushUnpackedArrayPattern","holeToUndefined","el","arrayExpression","map","arrayRef","add","elemRef","ref","memo","maybeGenerateMemoised","excludedKeys","allLiteral","hasTemplateLiteral","stringLiteral","isTemplateLiteral","String","isPrivateName","extendsHelper","objectExpression","sequenceExpression","keyExpression","isProgram","block","programScope","getProgramParent","convertVariableDeclaration","nodeKind","nodeLoc","loc","declarations","destructuring","inherits","tail","nodesOut","isVariableDeclaration","isExpressionStatement","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,CAACE,WAAW,EAAE,CAAA;EAC3B,MAAM;IAAEC,KAAK;AAAEV,IAAAA,IAAAA;AAAK,GAAC,GAAGO,aAAa,CAAA;EACrC,MAAMI,iBAAiB,GAAGJ,aAAa,CAACK,GAAG,CAAC,MAAM,CAAC,CAACF,KAAK,CAACG,QAAQ,CAAA;AAClE,EAAA,MAAMC,8BAA8B,GAAGC,MAAM,CAACC,IAAI,CAACL,iBAAiB,CAAC,CAACM,IAAI,CACxEC,IAAI,IAAIR,KAAK,CAACS,UAAU,CAACD,IAAI,CAC/B,CAAC,CAAA;AAED,EAAA,IAAIJ,8BAA8B,EAAE;AAGl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