( dir: string, fileNames: string[], )
| 407 | } |
| 408 | |
| 409 | export function lookupFile( |
| 410 | dir: string, |
| 411 | fileNames: string[], |
| 412 | ): string | undefined { |
| 413 | while (dir) { |
| 414 | for (const fileName of fileNames) { |
| 415 | const fullPath = path.join(dir, fileName) |
| 416 | if (tryStatSync(fullPath)?.isFile()) return fullPath |
| 417 | } |
| 418 | const parentDir = path.dirname(dir) |
| 419 | if (parentDir === dir) return |
| 420 | |
| 421 | dir = parentDir |
| 422 | } |
| 423 | } |
| 424 | |
| 425 | export function isFilePathESM( |
| 426 | filePath: string, |
no test coverage detected