The file that declares the namespace a module exports as `name`, through its re-exports, and the name it declares it under.
( file: string, name: string, language: Language, context: ResolutionContext, depth = 0, )
| 3159 | |
| 3160 | /** The file that declares the namespace a module exports as `name`, through its re-exports, and the name it declares it under. */ |
| 3161 | function namespaceDeclaringFile( |
| 3162 | file: string, |
| 3163 | name: string, |
| 3164 | language: Language, |
| 3165 | context: ResolutionContext, |
| 3166 | depth = 0, |
| 3167 | ): { file: string; name: string } | undefined { |
| 3168 | if (depth > REEXPORT_MAX_DEPTH) return undefined; |
| 3169 | if (namespaceBlocks(file, context).some((b) => b.path === name || b.path.startsWith(`${name}.`))) return { file, name }; |
| 3170 | for (const rex of context.getReExports?.(file, language) ?? []) { |
| 3171 | if (rex.kind !== 'wildcard' && !(rex.kind === 'named' && rex.exportedName === name)) continue; |
| 3172 | const next = resolveImportPath(rex.source, file, language, context); |
| 3173 | const found = next ? namespaceDeclaringFile(next, rex.kind === 'named' ? rex.originalName : name, language, context, depth + 1) : undefined; |
| 3174 | if (found) return found; |
| 3175 | } |
| 3176 | return undefined; |
| 3177 | } |
| 3178 | |
| 3179 | export function resolveViaImport( |
| 3180 | ref: UnresolvedRef, |
no test coverage detected