MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / declaredEntries

Function declaredEntries

src/resolution/workspace-packages.ts:797–801  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

795 * its `main`-style fields.
796 */
797function declaredEntries(entries: PackageEntries | undefined, subpath: string): string[] {
798 if (!entries) return [];
799 const exported = entries.exports ? exportedTargets(entries.exports, '.' + subpath) : [];
800 return subpath ? exported : [...new Set([...exported, ...(entries.main ?? [])])];
801}
802
803/** `exports`' targets for `key`: the exact key's, else the `*` pattern's with the longest prefix, its `*`s filled in. */
804function exportedTargets(exports: Map<string, string[]>, key: string): string[] {

Callers 1

workspaceImportTargetsFunction · 0.85

Calls 1

exportedTargetsFunction · 0.85

Tested by

no test coverage detected