* The targets a package's manifest declares for `subpath` (`''` or * `/widgets`), best first: its `exports` entry, then, for the package root, * its `main`-style fields.
(entries: PackageEntries | undefined, subpath: string)
| 794 | * its `main`-style fields. |
| 795 | */ |
| 796 | function declaredEntries(entries: PackageEntries | undefined, subpath: string): string[] { |
| 797 | if (!entries) return []; |
| 798 | const exported = entries.exports ? exportedTargets(entries.exports, '.' + subpath) : []; |
| 799 | return subpath ? exported : [...new Set([...exported, ...(entries.main ?? [])])]; |
| 800 | } |
| 801 | |
| 802 | /** `exports`' targets for `key`: the exact key's, else the `*` pattern's with the longest prefix, its `*`s filled in. */ |
| 803 | function exportedTargets(exports: Map<string, string[]>, key: string): string[] { |
no test coverage detected