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