* Find the source file corresponding to a dist declaration file
(distFilePath: string)
| 45 | * Find the source file corresponding to a dist declaration file |
| 46 | */ |
| 47 | private findSourceFile(distFilePath: string): string | null { |
| 48 | // Get the relative path from dist root |
| 49 | const relativePath = path.relative(this.distPath, distFilePath); |
| 50 | |
| 51 | // Remove .d.ts extension, leaving .ts |
| 52 | const withoutDTs = relativePath.replace(/\.d\.ts$/, '.ts'); |
| 53 | |
| 54 | // Try common patterns |
| 55 | const patterns = this.generateSourcePatterns(withoutDTs); |
| 56 | |
| 57 | for (const pattern of patterns) { |
| 58 | const fullPath = path.join(this.sourceRoot, pattern); |
| 59 | if (fs.existsSync(fullPath)) { |
| 60 | return fullPath; |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | return null; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Generate possible source file path patterns |
no test coverage detected