#!/usr/bin/env node // the cloudflare adapter writes _headers during `vite build`, so this runs // after it and rewrites what it left. a node build has no such file: nothing to // do, and nothing to fail on import { existsSync, readFileSync, writeFileSync } from "node:fs"; import { hardenAssetHeaders } from "../src/lib/assetHeaders.ts"; const path = ".svelte-kit/cloudflare/_headers"; if (existsSync(path)) { const hardened = hardenAssetHeaders(readFileSync(path, "utf8")); writeFileSync(path, hardened); console.log("asset-headers: immutable misses now revalidate"); }