| | |
| | | exported |
| | | }; |
| | | programPath.traverse(rewriteBindingInitVisitor, rewriteBindingInitVisitorState); |
| | | (0, _helperSimpleAccess.default)(programPath, new Set([...Array.from(imported.keys()), ...Array.from(exported.keys())])); |
| | | (0, _helperSimpleAccess.default)(programPath, new Set([...Array.from(imported.keys()), ...Array.from(exported.keys())]), false); |
| | | const rewriteReferencesVisitorState = { |
| | | seen: new WeakSet(), |
| | | metadata, |
| | |
| | | } |
| | | }, |
| | | |
| | | UpdateExpression(path) { |
| | | const { |
| | | scope, |
| | | seen, |
| | | imported, |
| | | exported, |
| | | requeueInParent, |
| | | buildImportReference |
| | | } = this; |
| | | if (seen.has(path.node)) return; |
| | | seen.add(path.node); |
| | | const arg = path.get("argument"); |
| | | if (arg.isMemberExpression()) return; |
| | | const update = path.node; |
| | | |
| | | if (arg.isIdentifier()) { |
| | | const localName = arg.node.name; |
| | | |
| | | if (scope.getBinding(localName) !== path.scope.getBinding(localName)) { |
| | | return; |
| | | } |
| | | |
| | | const exportedNames = exported.get(localName); |
| | | const importData = imported.get(localName); |
| | | |
| | | if ((exportedNames == null ? void 0 : exportedNames.length) > 0 || importData) { |
| | | if (importData) { |
| | | path.replaceWith(assignmentExpression(update.operator[0] + "=", buildImportReference(importData, arg.node), buildImportThrow(localName))); |
| | | } else if (update.prefix) { |
| | | path.replaceWith(buildBindingExportAssignmentExpression(this.metadata, exportedNames, cloneNode(update))); |
| | | } else { |
| | | const ref = scope.generateDeclaredUidIdentifier(localName); |
| | | path.replaceWith(sequenceExpression([assignmentExpression("=", cloneNode(ref), cloneNode(update)), buildBindingExportAssignmentExpression(this.metadata, exportedNames, identifier(localName)), cloneNode(ref)])); |
| | | } |
| | | } |
| | | } |
| | | |
| | | requeueInParent(path); |
| | | path.skip(); |
| | | }, |
| | | |
| | | AssignmentExpression: { |
| | | exit(path) { |
| | | const { |