import { createHash } from "node:crypto"; import { readFileSync, statSync } from "node:fs"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; const root = dirname(dirname(fileURLToPath(import.meta.url))); const assets = join(root, "web", "apps", "ep-sample-tool", "assets"); const expected = [ "Technotype34_EP_series-Bold-CzOuNzV9.woff2", "bg_x2-Blvo_klN.png", "ep-133-factory-content-DRyE_DHC.pak", "favicon-CV1VhAGr.ico", "index-bjKAcMKp.js", "index-qny0Yi1N.css", "libsamplerate-C34FEted.wasm", "libsndfile---U-zQfO.wasm", "libtag-C1F3EvPd.wasm", "libtag_c-DP8IdmaO.wasm", "resample-BWif2rvd.wasm", ]; for (const name of expected) { const path = join(assets, name); const size = statSync(path).size; const digest = createHash("sha256").update(readFileSync(path)).digest("hex").slice(0, 12); console.log(`${digest} ${String(size).padStart(9)} ${name}`); } const bundle = readFileSync(join(assets, "index-bjKAcMKp.js"), "utf8"); for (const required of ["requestMIDIAccess", "ep-133-factory-content-DRyE_DHC.pak"]) { if (!bundle.includes(required)) throw new Error(`App bundle is missing ${required}`); } console.log("Offline asset set is complete.");