(file: string)
| 476 | const staticImports: string[] = [] |
| 477 | |
| 478 | const resolvePaths = (file: string) => { |
| 479 | if (!dir) { |
| 480 | const importPath = `/${relative(root, file)}` |
| 481 | let filePath = options.base |
| 482 | ? `${relative(posix.join(root, options.base), file)}` |
| 483 | : importPath |
| 484 | if ( |
| 485 | options.base && |
| 486 | !filePath.startsWith('./') && |
| 487 | !filePath.startsWith('../') |
| 488 | ) { |
| 489 | filePath = `./${filePath}` |
| 490 | } |
| 491 | return { filePath, importPath } |
| 492 | } |
| 493 | |
| 494 | let importPath = relative(dir, file) |
| 495 | if (!importPath.startsWith('./') && !importPath.startsWith('../')) { |
| 496 | importPath = `./${importPath}` |
| 497 | } |
| 498 | |
| 499 | let filePath: string |
| 500 | if (options.base) { |
| 501 | const resolvedBasePath = options.base[0] === '/' ? root : dir |
| 502 | filePath = relative( |
| 503 | posix.join(resolvedBasePath, options.base), |
| 504 | file, |
| 505 | ) |
| 506 | if (!filePath.startsWith('./') && !filePath.startsWith('../')) { |
| 507 | filePath = `./${filePath}` |
| 508 | } |
| 509 | } else if (isRelative) { |
| 510 | filePath = importPath |
| 511 | } else { |
| 512 | filePath = relative(root, file) |
| 513 | if (!filePath.startsWith('./') && !filePath.startsWith('../')) { |
| 514 | filePath = `/${filePath}` |
| 515 | } |
| 516 | } |
| 517 | |
| 518 | return { filePath, importPath } |
| 519 | } |
| 520 | |
| 521 | files.forEach((file, i) => { |
| 522 | const paths = resolvePaths(file) |
no outgoing calls
no test coverage detected