import fs from "node:fs"; const [manifestPath, wasmHash] = process.argv.slice(2); if (!manifestPath || !/^[a-f0-9]{64}$/.test(wasmHash ?? "")) { throw new Error("usage: update-engine-manifest.mjs "); } const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8")); const resource = manifest.wasm?.find((entry) => entry.id === "web-engine-bootstrap"); if (!resource) throw new Error("web-engine-bootstrap resource is missing from the engine manifest"); resource.sha256 = wasmHash; fs.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);