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

Function declaredWorkspaceEntry

src/resolution/import-resolver.ts:1624–1630  ·  view source on GitHub ↗

* The file a package's declared entry for an import lands on (#2502): the * first declared target, in order (`exports` by condition, then the root's * `main`-style fields), that the index holds, or that is build output the * index lacks (`dist/index.js`), read as the source it is built from * (`

(targets: WorkspaceImportTargets, language: Language, context: ResolutionContext)

Source from the content-addressed store, hash-verified

1622 * were read.
1623 */
1624function declaredWorkspaceEntry(targets: WorkspaceImportTargets, language: Language, context: ResolutionContext): string | null {
1625 for (const target of targets.declared) {
1626 const hit = indexedTarget(target, language, context) ?? builtSourceOf(target, targets.packageDir, language, context);
1627 if (hit) return hit;
1628 }
1629 return null;
1630}
1631
1632/** A read of the page a browser gives a script: `document.title`, `window.location`. */
1633const BROWSER_GLOBAL_READ = /(?<![\w$.])(?:document|window)\s*[.[]/;

Callers 1

resolveAliasedImportFunction · 0.85

Calls 2

indexedTargetFunction · 0.85
builtSourceOfFunction · 0.85

Tested by

no test coverage detected