import { readFile, writeFile } from "node:fs/promises"; import path from "node:path"; import { fileURLToPath } from "node:url"; const root = path.resolve(import.meta.dirname, ".."); export async function generateLocaleEntry(publicRoot = path.join(root, "dist/public")) { const helper = await readFile(path.join(root, "src/locale-preference.mjs"), "utf8"); // Inline a classic script: negotiation runs before rendering or module fetches. const script = helper.replace(/^export /gm, "") + "\nenterDocs();"; const html = `