The graph of a fresh index of `files`, in a folder of its own.
(files: Files)
| 89 | |
| 90 | /** The graph of a fresh index of `files`, in a folder of its own. */ |
| 91 | async function freshGraph(files: Files): Promise<string[]> { |
| 92 | const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-jsx-forward-fresh-')); |
| 93 | try { |
| 94 | write(dir, Object.fromEntries(Object.entries(files).filter(([, text]) => text !== null))); |
| 95 | const fresh = await CodeGraph.init(dir, { index: true }); |
| 96 | try { |
| 97 | return graphOf(fresh); |
| 98 | } finally { |
| 99 | fresh.close(); |
| 100 | } |
| 101 | } finally { |
| 102 | fs.rmSync(dir, { recursive: true, force: true }); |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * Index `initial`, then write each step and sync after it — with `scoped`, a |