MCPcopy
hub / github.com/compodoc/compodoc / mapDistToSource

Method mapDistToSource

src/utils/source-path-mapper.util.ts:24–42  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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

Callers 3

processPublicApiMethod · 0.80

Calls 4

findSourceFileMethod · 0.95
setMethod · 0.80
getMethod · 0.45
debugMethod · 0.45

Tested by

no test coverage detected