import satori from 'satori'; import { Resvg } from '@resvg/resvg-js'; import { readFileSync } from 'node:fs'; import { join } from 'node:path'; interface OgImageProps { title: string; description?: string; engine?: string; } function loadFont(): ArrayBuffer { // In prod: dist/client/fonts/ In dev: public/fonts/ const candidates = [ join(process.cwd(), 'dist', 'client', 'fonts', 'Inter-SemiBold.ttf'), join(process.cwd(), 'public', 'fonts', 'Inter-SemiBold.ttf'), ]; for (const path of candidates) { try { return readFileSync(path).buffer as ArrayBuffer; } catch { // try next } } throw new Error('Inter-SemiBold.ttf not found'); } let fontData: ArrayBuffer | null = null; function getFont(): ArrayBuffer { if (!fontData) { try { fontData = loadFont(); } catch (err) { console.error('[og-renderer] Font load failed:', err); throw err; } } return fontData; } // Small waveform logo — a sine-like path rendered as SVG text function WaveformLogo() { return (