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

Function defaultExportBindingNode

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

The declaration `export default NAME` names in this file (see FileExportIndex.defaultBinding).

(filePath: string, idx: FileExportIndex, context: ResolutionContext)

Source from the content-addressed store, hash-verified

165
166/** The declaration `export default NAME` names in this file (see FileExportIndex.defaultBinding). */
167function defaultExportBindingNode(filePath: string, idx: FileExportIndex, context: ResolutionContext): Node | undefined {
168 if (idx.defaultBinding === undefined) {
169 const bound = defaultExportBinding(filePath, context);
170 idx.defaultBinding =
171 bound === null
172 ? null
173 : (nodesInFileNamed(filePath, bound, context)
174 .filter((n) => DEFAULT_BINDING_KINDS.has(n.kind))
175 .sort((a, b) => a.startLine - b.startLine || a.startColumn - b.startColumn)[0] ?? null);
176 }
177 return idx.defaultBinding ?? undefined;
178}
179
180/** What this file exports as `name`: an exported declaration, else a local export clause's binding. */
181function exportedByName(filePath: string, idx: FileExportIndex, name: string, context: ResolutionContext): Node | undefined {

Callers 1

findExportedSymbolWalkFunction · 0.85

Calls 3

defaultExportBindingFunction · 0.85
nodesInFileNamedFunction · 0.85
hasMethod · 0.80

Tested by

no test coverage detected