( importPath: string, fromFile: string, language: Language, context: ResolutionContext )
| 430 | } |
| 431 | |
| 432 | export function resolveImportPath( |
| 433 | importPath: string, |
| 434 | fromFile: string, |
| 435 | language: Language, |
| 436 | context: ResolutionContext |
| 437 | ): string | null { |
| 438 | let memo = importPathMemos.get(context); |
| 439 | if (!memo) { |
| 440 | memo = new Map(); |
| 441 | importPathMemos.set(context, memo); |
| 442 | } |
| 443 | const key = `${language}\0${fromFile}\0${importPath}`; |
| 444 | const hit = memo.get(key); |
| 445 | if (hit !== undefined || memo.has(key)) return hit ?? null; |
| 446 | const resolved = resolveImportPathUncached(importPath, fromFile, language, context); |
| 447 | memo.set(key, resolved); |
| 448 | return resolved; |
| 449 | } |
| 450 | |
| 451 | function resolveImportPathUncached( |
| 452 | importPath: string, |
no test coverage detected