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

Function index

__tests__/js-resolution-work.test.ts:36–45  ·  view source on GitHub ↗
(files: Record<string, string>)

Source from the content-addressed store, hash-verified

34 });
35
36 async function index(files: Record<string, string>): Promise<CodeGraph> {
37 tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-js-work-'));
38 for (const [file, content] of Object.entries(files)) {
39 fs.mkdirSync(path.dirname(path.join(tmpDir, file)), { recursive: true });
40 fs.writeFileSync(path.join(tmpDir, file), content);
41 }
42 cg = CodeGraph.initSync(tmpDir);
43 await cg.indexAll();
44 return cg;
45 }
46
47 /** How often a non-empty start of `text` was stripped as `lang`. */
48 const strips = (lang: string, text: string) => vi.mocked(stripCommentsForRegex).mock.calls

Callers 1

Calls 3

initSyncMethod · 0.80
joinMethod · 0.45
indexAllMethod · 0.45

Tested by

no test coverage detected