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

Function declaredModuleFile

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

3755 * short of a module of the repository's own packages.
3756 */
3757function declaredModuleFile(specifier: string, ref: UnresolvedRef, context: ResolutionContext): Node | undefined {
3758 if (!isBareModuleSpecifier(specifier, ref.language)) return undefined;
3759 const declaring = findAmbientModuleFile(specifier, ref.filePath, context);
3760 if (!declaring) return undefined;
3761 return isRepositoryModule(specifier, resolveImportPath(specifier, ref.filePath, ref.language, context), ref, context) ? undefined : declaring;
3762}
3763
3764/**
3765 * 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