(path: string, opts: ResolvePathOptions = {})
| 51 | * in which case the original input path will be returned. |
| 52 | */ |
| 53 | export async function resolvePath (path: string, opts: ResolvePathOptions = {}): Promise<string> { |
| 54 | const { type = 'file' } = opts |
| 55 | |
| 56 | const res = await _resolvePathGranularly(path, { ...opts, type }) |
| 57 | |
| 58 | if (res.type === type) { |
| 59 | return res.path |
| 60 | } |
| 61 | |
| 62 | // Return normalized input |
| 63 | return opts.fallbackToOriginal ? path : res.path |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Try to resolve first existing file in paths |
no test coverage detected
searching dependent graphs…