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

Function declaredWorkspaceEntry

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

1868 * were read.
1869 */
1870function declaredWorkspaceEntry(targets: WorkspaceImportTargets, language: Language, context: ResolutionContext): string | null {
1871 for (const target of targets.declared) {
1872 const hit = indexedTarget(target, language, context) ?? builtSourceOf(target, targets.packageDir, language, context);
1873 if (hit) return hit;
1874 }
1875 return null;
1876}
1877
1878/** A read of the page a browser gives a script: `document.title`, `window.location`. */
1879const 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