* Map a dist declaration file path to its corresponding source file * @param distFilePath Absolute path to .d.ts file in dist * @returns Absolute path to source .ts file, or null if not found
(distFilePath: string)
| 22 | * @returns Absolute path to source .ts file, or null if not found |
| 23 | */ |
| 24 | public mapDistToSource(distFilePath: string): string | null { |
| 25 | // Check cache first |
| 26 | if (this.cachedMappings.has(distFilePath)) { |
| 27 | return this.cachedMappings.get(distFilePath)!; |
| 28 | } |
| 29 | |
| 30 | const result = this.findSourceFile(distFilePath); |
| 31 | |
| 32 | // Cache the result (even if null) |
| 33 | this.cachedMappings.set(distFilePath, result); |
| 34 | |
| 35 | if (result) { |
| 36 | logger.debug(`Mapped ${distFilePath} -> ${result}`); |
| 37 | } else { |
| 38 | logger.debug(`Could not map dist file to source: ${distFilePath}`); |
| 39 | } |
| 40 | |
| 41 | return result; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Find the source file corresponding to a dist declaration file |
no test coverage detected