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

Function declaredWorkspaceEntry

src/resolution/import-resolver.ts:1622–1628  ·  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

1620 * were read.
1621 */
1622function declaredWorkspaceEntry(targets: WorkspaceImportTargets, language: Language, context: ResolutionContext): string | null {
1623 for (const target of targets.declared) {
1624 const hit = indexedTarget(target, language, context) ?? builtSourceOf(target, targets.packageDir, language, context);
1625 if (hit) return hit;
1626 }
1627 return null;
1628}
1629
1630/** A read of the page a browser gives a script: `document.title`, `window.location`. */
1631const 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