Coralite v0.39.0 Released
Coralite version v0.39.0 has been released. This update focuses on enhancing developer experience and build performance by introducing incremental production builds and replacing standard JSON serialization with serialize-javascript for component hydration and plugin configurations.
Incremental Production Builds #
To reduce build times on large-scale applications, Coralite now supports incremental production builds. Instead of rebuilding the entire site on every run, the build system analyzes changes, preserves unchanged files in the output directory, and executes stale file cleanup at the end of the build process. The build manifest is preserved throughout the cleanup phase.
If a previously built page's output is missing from the disk, the build runner forces a rebuild for that page regardless of whether its source file has changed. A new --clean flag has also been added to support full rebuilds when necessary.
coralite-scripts build --clean
Rich Serialization with serialize-javascript #
Previously, component hydration data and plugin configurations were serialized using standard JSON.stringify. In v0.39.0, both systems transition to serialize-javascript. This allows plugin configurations within the ScriptManager to support non-JSON types such as regular expressions, dates, custom functions, maps, and sets.
Hydration data is now passed directly to the client-side runtime using an inline module script, which the CoraliteElement runtime consumes. This change expands the expressiveness of plugin configurations and local hydration states:
// Plugins can now configure complex non-JSON types
export default {
plugins: [
{
name: 'analytics-plugin',
client: {
config: {
filterPattern: /^\/api\//,
timestamp: new Date(),
onInit: () => console.log('Analytics loaded')
}
}
}
]
};
Breaking Changes #
- Strict server() Validation: To ensure serialization safety, functions are now strictly blocked in return values from
server()methods. A path-based error reporting system has been introduced to help developers identify where validation failures occur in their hydration data.
How to Upgrade #
To upgrade to the latest version, update your project dependencies:
npm install coralite@0.39.0
npm install coralite-scripts@0.39.0
