Coralite v0.31.5 Released
Coralite v0.31.5 improves build stability with esbuild serialization fixes, deep cloning of default values, and introduces hydration hooks for robust end-to-end testing.
Coralite v0.31.5 has been released. This update addresses critical build-time serialization issues when handling shorthand ES6 methods and deeply nested default values, while improving the reliability of client-side integration tests with a new hydration readiness promise.
Deep Cloning & ES6 Shorthand Serialization
To prevent unwanted mutations and instances being dropped during builds, we now recursively clone arrays and objects in normalizeObjectFunctions using a WeakMap. Additionally, we refined normalizeFunction's regex matching to strip function names (e.g., generating function( instead of function name() to prevent keyword validation errors in esbuild. This ensures serialize-javascript successfully outputs literals for functions defined with spacing, such as languageLinks ({.
In addition, the declarative component initialization pipeline in _generatePages has been updated to merge module.default.defaultValues with execution context values, ensuring component tokens and helper methods generated inside setup() correctly persist to the client.
E2E Hydration Hook Stability
To prevent race conditions during end-to-end tests, we have added and documented a new window.__coralite_ready__ global promise. This mechanism signals when client-side hydration has completed and all component definitions and scripts are fully registered. Test frameworks can safely await this promise immediately following page navigation.
// Example: Awaiting client hydration in Playwright or Puppeteer
await page.goto('/docs');
await page.evaluate(() => window.__coralite_ready__);
Extending with createPlugin
We have updated the developer documentation (llms.txt) to include a comprehensive expansion of Section 4, detailing how to extend the framework's build and runtime lifecycles via the createPlugin API.
How to Upgrade
To upgrade to the latest version, update your project dependencies:
npm install coralite@0.31.5
npm install coralite-scripts@0.31.5