* Get index file extensions to try for directory imports.
(sourceFile: string)
| 105 | * Get index file extensions to try for directory imports. |
| 106 | */ |
| 107 | function getIndexExtensions(sourceFile: string): string[] { |
| 108 | const ext = sourceFile.split('.').slice(1).join('.') |
| 109 | |
| 110 | if (ext === 'd.ts' || ext === 'd.mts' || ext === 'd.cts') { |
| 111 | return ['index.d.ts', 'index.d.mts', 'index.d.cts', 'index.ts', 'index.js'] |
| 112 | } |
| 113 | |
| 114 | if (ext === 'mts' || ext === 'mjs') { |
| 115 | return ['index.mts', 'index.mjs', 'index.ts', 'index.js'] |
| 116 | } |
| 117 | |
| 118 | if (ext === 'cts' || ext === 'cjs') { |
| 119 | return ['index.cts', 'index.cjs', 'index.ts', 'index.js'] |
| 120 | } |
| 121 | |
| 122 | if (ext === 'ts' || ext === 'tsx') { |
| 123 | return ['index.ts', 'index.tsx', 'index.js', 'index.jsx'] |
| 124 | } |
| 125 | |
| 126 | return ['index.js', 'index.ts', 'index.mjs', 'index.cjs'] |
| 127 | } |
| 128 | |
| 129 | export interface ResolvedImport { |
| 130 | /** The resolved file path (relative to package root) */ |
no outgoing calls
no test coverage detected