Coralite v0.20 Released
I am thrilled to announce the release of Coralite v0.20.1 and Coralite Scripts v0.20.0! This major update focuses on significantly improving build performance, simplifying the development environment, and introducing powerful new APIs for metadata and DOM manipulation.
Major Performance Improvements #
Build times and page generation have been majorly improved in this release. The core compilation process now parallelizes custom element creation, especially for asynchronous operations. In benchmarks, this resulted in a dramatic speedup (up to 10x faster for complex component trees), reducing build times from seconds to milliseconds.
Additionally, the development server now features in-memory page caching. This means subsequent requests to unchanged pages are served instantly, and multi-page builds are handled more efficiently, making the developer experience smoother and faster.
New Metadata Plugin #
Managing page metadata is now easier than ever with the new built-in Metadata Plugin. This plugin automatically extracts <meta> tags from your HTML head sections and component slots, making them available as variables in your templates.
Metadata variables are now prefixed with meta_ to avoid conflicts and provide a consistent naming convention. For example:
<meta name="author" content="Thomas"></meta>
<meta name="description" content="A great post"></meta>
<p>Author: {{ meta_author }}</p>
<p>Description: {{ meta_description }}</p>
Enhanced DOM API #
This release includes a refactored internal DOM node creation logic designed for greater robustness and type safety. It also introduces the new factory functions createCoraliteElement and createCoraliteTextNode, which provide a standardized approach for programmatically creating nodes in plugins and scripts.
The new coralite.build API replaces the older compilation methods, offering better error handling and a callback overload for more flexible build scripts.
Simplified Environment Setup #
The system no longer depends on any experimental Node.js flags! You can now run Coralite without the --experimental-vm-modules flag, simplifying your package.json scripts and CI/CD pipelines.
Bug Fixes & Improvements #
This release also includes numerous bug fixes and quality-of-life improvements:
- Collection Updates: Fixed an issue where
setItemwould not return the updated item correctly. - Custom Elements: Removed noisy console warnings for invalid custom element tag names.
- Slots: Default slot values now display correctly when the slot content is empty.
- Attributes: Fixed an issue where empty attributes could unexpectedly remove newlines in the output.
- Dependencies: Runtime dependencies have been correctly moved from
devDependenciestodependenciesfor better stability.
How to Upgrade #
To upgrade to the latest version, update your project dependencies:
npm install coralite@0.20.1
npm install coralite-scripts@0.20.0
Check out the full changelog on Codeberg for a complete list of changes.
