import { readFileSync } from "node:fs"; import { join } from "node:path"; // Sprite id → lucide-static icon, the icons the UI actually references (alphabetical by id). // Inlined as so pages stay zero-JS: . export const ICON_NAMES: Record = { "i-alert": "circle-alert", "i-arrow-left": "arrow-left", "i-bell": "bell", "i-box": "box", "i-cal": "calendar", "i-chart": "chart-no-axes-column", "i-check-circle": "circle-check", "i-chev": "chevron-right", "i-cols": "columns-3", "i-copy": "copy", "i-download": "download", "i-edit": "pencil", "i-gear": "settings", "i-globe": "globe", "i-grid": "layout-grid", "i-kebab": "ellipsis-vertical", "i-layers": "layers", "i-lock": "lock", "i-logout": "log-out", "i-mail": "mail", "i-menu": "menu", "i-plus": "plus", "i-search": "search", "i-shield": "shield", "i-sliders": "sliders-horizontal", "i-sort": "chevrons-up-down", "i-trash": "trash-2", "i-up": "chevron-up", "i-user": "user", "i-users": "users", "i-x": "x", }; // Drop lucide's license comment + wrapper, keep the drawing children (compacted). function inner(svg: string): string { const open = svg.indexOf(">", svg.indexOf("")).replace(/\s*\n\s*/g, "").trim(); } // Hidden sprite for the used icons, sourced from the pinned lucide-static. // Regenerates views/partials/icons.ejs; icons.test.ts asserts the committed file matches. export function buildIconSprite(iconsDir: string): string { const symbols = Object.entries(ICON_NAMES).map( ([id, name]) => ` ${inner(readFileSync(join(iconsDir, `${name}.svg`), "utf8"))}`, ); return [ "<%# Generated from lucide-static by src/icons.ts — regenerate on dep bump (guarded by icons.test.ts). %>", '", "", ].join("\n"); }