Index `before`, write `after` over it, sync; return the graph and what a full index of `after` holds.
(before: Files, after: Files)
| 88 | |
| 89 | /** Index `before`, write `after` over it, sync; return the graph and what a full index of `after` holds. */ |
| 90 | async function syncEdit(before: Files, after: Files): Promise<{ root: string; graph: CodeGraph; full: string[] }> { |
| 91 | const root = tempRoot(); |
| 92 | write(root, before); |
| 93 | const graph = await index(root); |
| 94 | write(root, after); |
| 95 | await graph.sync(); |
| 96 | const fullRoot = tempRoot(); |
| 97 | write(fullRoot, { ...before, ...after }); |
| 98 | const full = stateOf(fullRoot, await index(fullRoot)); |
| 99 | return { root, graph, full }; |
| 100 | } |
| 101 | |
| 102 | const LIB = (members: string): string => |
| 103 | `function foo() { return 1; }\nfunction bar() { return 2; }\nexport function baz() { return 3; }\nexport const __testing = { ${members} };\n`; |