import { readFile, writeFile } from "node:fs/promises"; // Vite/Rollup can drop source-level module directives. Keep Next.js App Router // boundaries on all new entries, without touching any legacy dist files. const files = ["provider", "provider-legacy", "keycloak", "permission", "api", "query", "chakra", "next-pages-router", "next-app-router", "vite", "watermark", "update-checker", "remote-ui", "remote-ui-bi-image"]; for (const name of files) { const file = `dist/${name}.js`; const content = await readFile(file, "utf8"); if (!content.startsWith('"use client";')) { await writeFile(file, `"use client";\n${content}`); } }