(filePath: string)
| 83 | * Determine the language for syntax highlighting based on file path |
| 84 | */ |
| 85 | export function getLanguageFromPath(filePath: string): string { |
| 86 | const filename = filePath.split('/').pop() || '' |
| 87 | |
| 88 | // Check for exact filename match first |
| 89 | if (FILENAME_MAP[filename]) { |
| 90 | return FILENAME_MAP[filename] |
| 91 | } |
| 92 | |
| 93 | // Then check extension |
| 94 | const ext = filename.split('.').pop()?.toLowerCase() || '' |
| 95 | return EXTENSION_MAP[ext] || 'text' |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * Check if a module specifier is an npm package (not a relative/absolute path or Node built-in) |
no outgoing calls
no test coverage detected