(host ModuleSpecifierGenerationHost, path string)
| 192 | } |
| 193 | |
| 194 | func tryGetAnyFileFromPath(host ModuleSpecifierGenerationHost, path string) bool { |
| 195 | // !!! TODO: shouldn't this use readdir instead of fileexists for perf? |
| 196 | // We check all js, `node` and `json` extensions in addition to TS, since node module resolution would also choose those over the directory |
| 197 | extGroups := tsoptions.GetSupportedExtensions( |
| 198 | &core.CompilerOptions{ |
| 199 | AllowJs: core.TSTrue, |
| 200 | }, |
| 201 | []tsoptions.FileExtensionInfo{ |
| 202 | { |
| 203 | Extension: "node", |
| 204 | IsMixedContent: false, |
| 205 | ScriptKind: core.ScriptKindExternal, |
| 206 | }, |
| 207 | { |
| 208 | Extension: "json", |
| 209 | IsMixedContent: false, |
| 210 | ScriptKind: core.ScriptKindJSON, |
| 211 | }, |
| 212 | }, |
| 213 | ) |
| 214 | for _, exts := range extGroups { |
| 215 | for _, e := range exts { |
| 216 | fullPath := path + e |
| 217 | if host.FileExists(tspath.GetNormalizedAbsolutePath(fullPath, host.GetCurrentDirectory())) { |
| 218 | return true |
| 219 | } |
| 220 | } |
| 221 | } |
| 222 | return false |
| 223 | } |
| 224 | |
| 225 | func getPathsRelativeToRootDirs(path string, rootDirs []string, useCaseSensitiveFileNames bool) []string { |
| 226 | var results []string |
no test coverage detected