import fs from "node:fs";
import path from "node:path";
import { gzipSync } from "node:zlib";
const dist = path.resolve("dist");
const html = fs.readFileSync(path.join(dist, "index.html"), "utf8");
const cssFile = fs
.readdirSync(path.join(dist, "assets"))
.find((name) => name.endsWith(".css"));
if (!cssFile) throw new Error("missing css asset");
const css = fs.readFileSync(path.join(dist, "assets", cssFile), "utf8");
const hand = fs.readFileSync("hand.css", "utf8");
const csp =
html.match(
/]+http-equiv="Content-Security-Policy"[^>]+content="([^"]+)"/,
)?.[1] ?? "";
const hasLink = /]+rel="stylesheet"/.test(html);
const hasInlineStyle = /