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

Function edgesFrom

__tests__/dynamic-import-binding.test.ts:98–108  ·  view source on GitHub ↗

`file:line name` of every edge of `kinds` leaving `file`.

(file: string, kinds: string[])

Source from the content-addressed store, hash-verified

96
97/** `file:line name` of every edge of `kinds` leaving `file`. */
98function edgesFrom(file: string, kinds: string[]): string[] {
99 const out: string[] = [];
100 for (const node of cg.getNodesInFile(file)) {
101 for (const e of cg.getOutgoingEdges(node.id)) {
102 if (!kinds.includes(e.kind)) continue;
103 const target = cg.getNode(e.target)!;
104 out.push(`${e.line} ${target.filePath}:${target.name}`);
105 }
106 }
107 return out;
108}
109
110describe('a name a dynamic import binds from outside the project (#2491)', () => {
111 it("never links to a same-named project function: vite's `await import('node:http')`", () => {

Callers 1

Calls 4

getNodeMethod · 0.80
pushMethod · 0.80
getNodesInFileMethod · 0.65
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected