(module: SourceModule, binding: Binding | undefined)
| 833 | } |
| 834 | |
| 835 | private keepBinding(module: SourceModule, binding: Binding | undefined) { |
| 836 | if (!binding || binding.scope !== module.scopes.root) return |
| 837 | if (binding.kind !== "import") { |
| 838 | this.keep(module, statementOf(binding.declaration)) |
| 839 | return |
| 840 | } |
| 841 | if (this.imports.has(binding)) return |
| 842 | this.imports.add(binding) |
| 843 | const specifier = binding.declaration |
| 844 | if (specifier.parent?.type !== "ImportDeclaration") return |
| 845 | const target = this.targetOf(specifier.parent.source.value, module) |
| 846 | if (!target) return |
| 847 | if (specifier.type === "ImportSpecifier") |
| 848 | this.keepExport(target, exportNameOf(specifier.imported)) |
| 849 | else if (specifier.type === "ImportDefaultSpecifier") |
| 850 | this.keepExport(target, "default") |
| 851 | else this.keepExports(target) |
| 852 | } |
| 853 | |
| 854 | // a generated module by its specifier, another as the bundler resolves it |
| 855 | private targetOf( |
no test coverage detected