* 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)
| 1684 | * build folder. |
| 1685 | */ |
| 1686 | function builtSourcesOf(target: string, packageDir: string): string[] { |
| 1687 | const prefix = packageDir === '' ? '' : packageDir + '/'; |
| 1688 | if (!target.startsWith(prefix)) return []; |
| 1689 | const inPackage = target.slice(prefix.length); |
| 1690 | const root = BUILD_ROOT.exec(inPackage); |
| 1691 | if (!root) return []; |
| 1692 | const mirrored = inPackage.slice(root[0].length); |
| 1693 | const format = BUILD_FORMAT.exec(mirrored); |
| 1694 | const stems = [mirrored, ...(format ? [mirrored.slice(format[0].length)] : [])] |
| 1695 | .map((rest) => rest.replace(EMITTED_EXTENSION, '')) |
| 1696 | .filter((stem) => stem !== '' && !stem.startsWith('src/')); |
| 1697 | return [...new Set(stems)].map((stem) => `${prefix}src/${stem}`); |
| 1698 | } |
| 1699 | |
| 1700 | /** |
| 1701 | * A bare specifier `isExternalImport` takes for a package, resolved through |
no test coverage detected