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

Function dependents

__tests__/extraction.test.ts:7314–7320  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

7312
7313 /** The files of everything that calls or references the named function. */
7314 const dependents = async (name: string): Promise<string[]> => {
7315 cg = CodeGraph.initSync(tempDir);
7316 await cg.indexAll();
7317 const target = cg.getNodesByKind('function').find((n) => n.name === name);
7318 expect(target, name).toBeDefined();
7319 return [...cg.getImpactRadius(target!.id, 1).nodes.values()].map((n) => n.filePath ?? '').filter((p) => !p.endsWith('.js') && !p.endsWith('.ts'));
7320 };
7321
7322 it('links what a view\'s inline script calls to the JavaScript that defines it', async () => {
7323 fs.writeFileSync(path.join(tempDir, 'site.js'), 'export function showToast(msg) { return msg; }\n');

Callers 1

extraction.test.tsFile · 0.85

Calls 5

initSyncMethod · 0.80
mapMethod · 0.80
getNodesByKindMethod · 0.65
indexAllMethod · 0.45
getImpactRadiusMethod · 0.45

Tested by

no test coverage detected