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

Function isJsBareModuleRef

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

3212 * binds locally is that binding, not the module, and resolves as one.
3213 */
3214function isJsBareModuleRef(ref: UnresolvedRef, context: ResolutionContext): boolean {
3215 if (ref.referenceKind !== 'imports' || !ESM_IMPORT_LANGUAGES.has(ref.language) || isJsPathSpecifier(ref.referenceName)) return false;
3216 const imports = context.getImportMappings(ref.filePath, ref.language);
3217 return importsFrom(imports, ref.referenceName).length > 0 && importsBoundTo(imports, ref.referenceName).length === 0;
3218}
3219
3220/**
3221 * The file a JS/TS module reference names, the way resolveViaImport reads it:

Callers 1

jsModuleFileFunction · 0.85

Calls 5

importsFromFunction · 0.90
importsBoundToFunction · 0.90
isJsPathSpecifierFunction · 0.85
hasMethod · 0.80
getImportMappingsMethod · 0.80

Tested by

no test coverage detected