import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { initLayoutEngine, isInitialized } from '../src/index.js'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const fontsDir = path.resolve(__dirname, '..', '..', '..', 'infra', 'fonts'); export async function ensureEngineReady(): Promise { if (isInitialized()) return; await initLayoutEngine({ fonts: [ { family: 'Inter', weight: 400, path: 'file://' + path.join(fontsDir, 'Inter-Regular.ttf') }, { family: 'Inter', weight: 700, path: 'file://' + path.join(fontsDir, 'Inter-Bold.ttf') } ] }); }