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

Function dependents

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

Source from the content-addressed store, hash-verified

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