{"draft":null,"from":29,"to":318,"files":[{"path":"server/scripts/capacity-patch-git-pump.mjs","added":31,"removed":0,"diff":"--- /dev/null\n+++ b/server/scripts/capacity-patch-git-pump.mjs\n@@ -0,0 +1,31 @@\n+import { createHash } from \"node:crypto\";\n+import { readFileSync, writeFileSync } from \"node:fs\";\n+import { join } from \"node:path\";\n+\n+const root = \"capacity-git-dependency-sandbox/node_modules/isomorphic-git\";\n+const inputs = {\n+\t\"index.js\": \"4e0e9ee5a21754ebd718864dba2705385fc8254ed0c9e0d4ff56c8a2ff6fccf8\",\n+\t\"index.cjs\": \"fe66bb236ed6d95bf720e646afc9fff1dbe3efbc441b194efde09b1b698cd583\",\n+};\n+const hash = (value) => createHash(\"sha256\").update(value).digest(\"hex\");\n+function once(source, before, after) {\n+\tif (source.split(before).length !== 2) throw Error(\"Git pump anchor mismatch\");\n+\treturn source.replace(before, after);\n+}\n+const outputs = [];\n+for (const [file, expected] of Object.entries(inputs)) {\n+\tlet source = readFileSync(join(root, file), \"utf8\");\n+\tif (hash(source) !== expected) throw Error(`Unrecognized pump input: ${file}`);\n+\tsource = once(\n+\t\tsource,\n+\t\t\"    const nextBit = async function () {\",\n+\t\t\"    const nextBit = async function () {\\n      while (true) {\",\n+\t);\n+\tsource = once(source, \"      if (line === null) return nextBit()\", \"      if (line === null) continue\");\n+\tsource = once(source, \"      return nextBit();\\n    };\", \"      }\\n    };\");\n+\toutputs.push({ file, source, sha256: hash(source) });\n+}\n+if (!process.argv.includes(\"--check\")) {\n+\tfor (const { file, source } of outputs) writeFileSync(join(root, file), source);\n+}\n+console.log(JSON.stringify(outputs.map(({ file, sha256 }) => ({ file, sha256 }))));"}],"unmatched":[]}