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

Function write

__tests__/dynamic-import-binding.test.ts:143–146  ·  view source on GitHub ↗
(rel: string, content: string)

Source from the content-addressed store, hash-verified

141 it('drops the name match when the import appears and restores it when it goes', async () => {
142 const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-dynamic-import-sync-'));
143 const write = (rel: string, content: string): void => {
144 fs.mkdirSync(path.dirname(path.join(dir, rel)), { recursive: true });
145 fs.writeFileSync(path.join(dir, rel), content);
146 };
147 const plain = 'export async function a(p: string) {\n return readFile(p);\n}\n';
148 const dynamic = "export async function a(p: string) {\n const { readFile } = await import('node:fs/promises');\n return readFile(p);\n}\n";
149 write('src/io.ts', 'export function readFile(p: string): string { return p; }\n');

Callers 1

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected