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

Function declaredEntries

src/resolution/workspace-packages.ts:796–800  ·  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

794 * its `main`-style fields.
795 */
796function 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. */
803function exportedTargets(exports: Map<string, string[]>, key: string): string[] {

Callers 1

workspaceImportTargetsFunction · 0.85

Calls 1

exportedTargetsFunction · 0.85

Tested by

no test coverage detected