| 210 | } |
| 211 | |
| 212 | function graphOf(dir) { |
| 213 | const dumped = spawnSync(node, [join(repo, 'scripts', 'dump-graph.mjs'), dir], { env, stdio: ['ignore', 'pipe', 'inherit'], maxBuffer: 2 ** 31 - 1 }); |
| 214 | if (dumped.status !== 0 || !dumped.stdout) throw new Error(`dump-graph.mjs failed for ${dir}`); |
| 215 | const counts = {}; |
| 216 | for (const [, section, count] of dumped.stdout.toString('utf8').matchAll(/^== (\w+) \((\d+)\)$/gm)) counts[section] = Number(count); |
| 217 | return { hash: sha('sha256', dumped.stdout).slice(0, 16), ...counts }; |
| 218 | } |
| 219 | |
| 220 | /** A budget that holds on a slower machine, kept as it is while the time stays well inside it. */ |
| 221 | function budgetFor(seconds, kept) { |