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

Function moduleBindingsFirst

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

322 * because `const { f } = d` gives the binding `f` no node but `d::f`.
323 */
324function moduleBindingsFirst(filePath: string, nodes: Node[]): Node[] {
325 if (!JS_FAMILY_FILE.test(filePath)) return nodes;
326 const own = nodes.filter((n) => n.qualifiedName === n.name);
327 return own.length === nodes.length ? nodes : [...own, ...nodes.filter((n) => n.qualifiedName !== n.name)];
328}
329
330/** The file's nodes named `name`, in `getNodesInFile` order. */
331function 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