Attempt to resolve any path associated with the alias to a file or directory index
( from: string, alias: string, realPaths: TsPaths, parentFile: string )
| 160 | // TODO support resource loaders like 'url:@alias/my.svg' |
| 161 | /** Attempt to resolve any path associated with the alias to a file or directory index */ |
| 162 | function attemptResolveArray( |
| 163 | from: string, |
| 164 | alias: string, |
| 165 | realPaths: TsPaths, |
| 166 | parentFile: string |
| 167 | ) { |
| 168 | for (const option of realPaths) { |
| 169 | const absoluteBaseFile = resolve( |
| 170 | from.replace(trimStar(alias), trimStar(option)) |
| 171 | ) |
| 172 | |
| 173 | const importExt = extname(absoluteBaseFile) |
| 174 | |
| 175 | if (importExt.length > 0 && relevantExtSet.has(importExt as any)) { |
| 176 | return absoluteBaseFile |
| 177 | } |
| 178 | |
| 179 | const parentExt = extname(parentFile) |
| 180 | |
| 181 | const checkingExts = [ |
| 182 | parentExt, |
| 183 | ...relevantExtList.filter((ext) => ext !== parentExt) |
| 184 | ] |
| 185 | |
| 186 | const mod = findModule(absoluteBaseFile, checkingExts) |
| 187 | |
| 188 | if (mod !== null) { |
| 189 | return mod |
| 190 | } |
| 191 | } |
| 192 | return null |
| 193 | } |
| 194 | |
| 195 | type TSConfig = { compilerOptions: CompilerOptions; filePath: string } |
| 196 |
no test coverage detected
searching dependent graphs…