( module: SourceModule, name: string, seen: Set<string> )
| 6124 | } |
| 6125 | |
| 6126 | private exportedDefinitionOf( |
| 6127 | module: SourceModule, |
| 6128 | name: string, |
| 6129 | seen: Set<string> |
| 6130 | ): [Node, SourceModule] | undefined { |
| 6131 | const key = `${module.id}\0${name}` |
| 6132 | if (seen.has(key)) return |
| 6133 | seen.add(key) |
| 6134 | const entry = module.scopes.exportsByName[name] |
| 6135 | if (entry?.kind === "reexport") { |
| 6136 | const target = this.packageModuleOf(entry.specifier, module) |
| 6137 | return target && this.exportedDefinitionOf(target, entry.name, seen) |
| 6138 | } |
| 6139 | const value = |
| 6140 | entry?.kind === "binding" ? entry.binding.id |
| 6141 | : entry?.kind === "expression" ? entry.node |
| 6142 | : entry ? undefined |
| 6143 | : commonExportOf(module, name) |
| 6144 | if (value) return this.definitionOf(value, module, seen) |
| 6145 | if (entry) return |
| 6146 | for (const specifier of module.scopes.starExports) { |
| 6147 | const target = this.packageModuleOf(specifier, module) |
| 6148 | const result = target && this.exportedDefinitionOf(target, name, seen) |
| 6149 | if (result) return result |
| 6150 | } |
| 6151 | } |
| 6152 | |
| 6153 | // a module of a package, which the build reads only for what its |
| 6154 | // functions may write |
no test coverage detected