The graph of a fresh index of `files`, in a folder of its own.
(files: Files)
| 119 | |
| 120 | /** The graph of a fresh index of `files`, in a folder of its own. */ |
| 121 | async function freshGraph(files: Files): Promise<string[]> { |
| 122 | const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-lazy-route-fresh-')); |
| 123 | try { |
| 124 | write(dir, Object.fromEntries(Object.entries(files).filter(([, text]) => text !== null))); |
| 125 | const fresh = await CodeGraph.init(dir, { index: true }); |
| 126 | try { |
| 127 | return graphOf(fresh); |
| 128 | } finally { |
| 129 | fresh.close(); |
| 130 | } |
| 131 | } finally { |
| 132 | fs.rmSync(dir, { recursive: true, force: true }); |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * Index `initial`, then write each step and sync after it — with `scoped`, a |