(module: SourceModule, name: string)
| 811 | } |
| 812 | |
| 813 | private keepExport(module: SourceModule, name: string): void { |
| 814 | const key = `${module.id}\0${name}` |
| 815 | if (this.exports.has(key)) return |
| 816 | this.exports.add(key) |
| 817 | const entry = module.scopes.exportsByName[name] |
| 818 | if (entry?.kind === "binding") |
| 819 | return this.keepBinding(module, entry.binding) |
| 820 | if (entry?.kind === "reexport" || entry?.kind === "namespace") { |
| 821 | const target = this.targetOf(entry.specifier, module) |
| 822 | if (!target) return |
| 823 | return entry.kind === "reexport" ? |
| 824 | this.keepExport(target, entry.name) |
| 825 | : this.keepExports(target) |
| 826 | } |
| 827 | if (entry) return this.keep(module, statementOf(entry.node)) |
| 828 | if (name === "default") return |
| 829 | for (const specifier of module.scopes.starExports) { |
| 830 | const target = this.targetOf(specifier, module) |
| 831 | if (target) this.keepExport(target, name) |
| 832 | } |
| 833 | } |
| 834 | |
| 835 | private keepBinding(module: SourceModule, binding: Binding | undefined) { |
| 836 | if (!binding || binding.scope !== module.scopes.root) return |
no test coverage detected