* The source files a package's build output may be built from, * extension-less, most literal first: the build folder mirrored under * `src/` (vite's `dist/node/index.js` → `src/node/index`), then without a * format subfolder (`dist/esm/index.mjs`, `dist/types/index.d.ts` → * `src/index`). The c
(target: string, packageDir: string)
| 1623 | * build folder. |
| 1624 | */ |
| 1625 | function builtSourcesOf(target: string, packageDir: string): string[] { |
| 1626 | const prefix = packageDir === '' ? '' : packageDir + '/'; |
| 1627 | if (!target.startsWith(prefix)) return []; |
| 1628 | const inPackage = target.slice(prefix.length); |
| 1629 | const root = BUILD_ROOT.exec(inPackage); |
| 1630 | if (!root) return []; |
| 1631 | const mirrored = inPackage.slice(root[0].length); |
| 1632 | const format = BUILD_FORMAT.exec(mirrored); |
| 1633 | const stems = [mirrored, ...(format ? [mirrored.slice(format[0].length)] : [])] |
| 1634 | .map((rest) => rest.replace(EMITTED_EXTENSION, '')) |
| 1635 | .filter((stem) => stem !== '' && !stem.startsWith('src/')); |
| 1636 | return [...new Set(stems)].map((stem) => `${prefix}src/${stem}`); |
| 1637 | } |
| 1638 | |
| 1639 | /** |
| 1640 | * A bare specifier `isExternalImport` takes for a package, resolved through |
no test coverage detected