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

Function isJsBareModuleRef

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

* A JS/TS `imports` reference to the module of an import named by one bare * segment — `'config'` in `import { DEFAULT_THEME_MODE } from 'config'` under * `"baseUrl": "src"`. Shaped like a package, it names a file only when * resolveImportPath finds one (the app's `baseUrl` or catch-all `paths`,

(ref: UnresolvedRef, context: ResolutionContext)

Source from the content-addressed store, hash-verified

2865 * binds locally is that binding, not the module, and resolves as one.
2866 */
2867function isJsBareModuleRef(ref: UnresolvedRef, context: ResolutionContext): boolean {
2868 if (ref.referenceKind !== 'imports' || !ESM_IMPORT_LANGUAGES.has(ref.language) || isJsPathSpecifier(ref.referenceName)) return false;
2869 const imports = context.getImportMappings(ref.filePath, ref.language);
2870 return imports.some((m) => m.source === ref.referenceName) && !imports.some((m) => m.localName === ref.referenceName);
2871}
2872
2873/**
2874 * The file a JS/TS module reference names, the way resolveViaImport reads it:

Callers 1

jsModuleFileFunction · 0.85

Calls 3

isJsPathSpecifierFunction · 0.85
hasMethod · 0.80
getImportMappingsMethod · 0.80

Tested by

no test coverage detected