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

Function declaredModuleFile

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

* The file that declares `specifier` as a module, for `ref`'s file (see * ./ambient-modules): the module, whatever file the specifier resolves to, * short of a module of the repository's own packages.

(specifier: string, ref: UnresolvedRef, context: ResolutionContext)

Source from the content-addressed store, hash-verified

3580 * short of a module of the repository's own packages.
3581 */
3582function declaredModuleFile(specifier: string, ref: UnresolvedRef, context: ResolutionContext): Node | undefined {
3583 if (!isBareModuleSpecifier(specifier, ref.language)) return undefined;
3584 const declaring = findAmbientModuleFile(specifier, ref.filePath, context);
3585 if (!declaring) return undefined;
3586 return isRepositoryModule(specifier, resolveImportPath(specifier, ref.filePath, ref.language, context), ref, context) ? undefined : declaring;
3587}
3588
3589/**
3590 * Reference kinds the extractor records by a qualified name's last part: a

Callers 2

jsModuleFileFunction · 0.85

Calls 4

findAmbientModuleFileFunction · 0.90
isBareModuleSpecifierFunction · 0.85
isRepositoryModuleFunction · 0.85
resolveImportPathFunction · 0.85

Tested by

no test coverage detected