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

Function moduleBindingsFirst

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

* `nodes` with the members of something else in their JS/TS file (an * object's method `d::f`) moved behind the module's own bindings. Extraction * marks such a member exported, so it can share a name with what an import, * export clause or default export means (#2945); it stays the last answer

(filePath: string, nodes: Node[])

Source from the content-addressed store, hash-verified

338 * because `const { f } = d` gives the binding `f` no node but `d::f`.
339 */
340function moduleBindingsFirst(filePath: string, nodes: Node[]): Node[] {
341 if (!JS_FAMILY_FILE.test(filePath)) return nodes;
342 const own = nodes.filter((n) => n.qualifiedName === n.name);
343 return own.length === nodes.length ? nodes : [...own, ...nodes.filter((n) => n.qualifiedName !== n.name)];
344}
345
346/** The file's nodes named `name`, in `getNodesInFile` order. */
347function nodesInFileNamed(filePath: string, name: string, context: ResolutionContext): Node[] {

Callers 3

statedDefaultExportFunction · 0.85
exportedByNameFunction · 0.85
findExportedSymbolWalkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected