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

Function declaredWorkspaceEntry

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

1559 * were read.
1560 */
1561function declaredWorkspaceEntry(targets: WorkspaceImportTargets, language: Language, context: ResolutionContext): string | null {
1562 for (const target of targets.declared) {
1563 const hit = indexedTarget(target, language, context) ?? builtSourceOf(target, targets.packageDir, language, context);
1564 if (hit) return hit;
1565 }
1566 return null;
1567}
1568
1569/** A read of the page a browser gives a script: `document.title`, `window.location`. */
1570const 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