(rootPath: string, chunk: IndexedChunk)
| 38 | } |
| 39 | |
| 40 | function getUsageFile(rootPath: string, chunk: IndexedChunk): string { |
| 41 | if (typeof chunk.relativePath === 'string' && chunk.relativePath.trim()) { |
| 42 | return chunk.relativePath.replace(/\\/g, '/'); |
| 43 | } |
| 44 | |
| 45 | if (typeof chunk.filePath === 'string' && chunk.filePath.trim()) { |
| 46 | const relativePath = path.relative(rootPath, chunk.filePath); |
| 47 | if (!relativePath || relativePath.startsWith('..')) { |
| 48 | return path.basename(chunk.filePath); |
| 49 | } |
| 50 | return relativePath.replace(/\\/g, '/'); |
| 51 | } |
| 52 | |
| 53 | return 'unknown'; |
| 54 | } |
| 55 | |
| 56 | function buildPreview(content: string, lineOffset: number): string { |
| 57 | const lines = content.split('\n'); |
no outgoing calls
no test coverage detected