Coralite v0.38.3 Released
Coralite v0.38.3 focuses on reinforcing the framework's core architectural guidelines, specifically surrounding the boundary between pages and components. This release aligns the framework's end-to-end test suite and developer documentation with the "Pages as Consumers" philosophy. Additionally, this version introduces lifecycle hook execution improvements, nested imperative component mounting fixes, and sitemap generation corrections for incremental builds.
Enforcing the 'Pages as Consumers' Architecture #
To discourage page-level scripting anti-patterns and ensure robust component boundary isolation, E2E tests and fixtures have undergone a comprehensive audit. Under the "Pages as Consumers" pattern, HTML pages act strictly as consumers of components, and components govern their internal DOM operations:
- Imperative scripts have been removed from HTML page fixtures, moving execution logic entirely into parent components.
- Manual DOM queries (such as
querySelectorandgetElementById) within components have been replaced by Coralite's built-inrefssystem. - Playwright E2E tests have been updated to use the namespaced
instanceId__refNametargeting pattern viagetByTestIdfor robust, scoped queries of component internals.
Lifecycle Hook and Imperative Flow Adjustments #
We have refined how lifecycle hooks and imperative HTML insertions are handled within the core rendering cycle:
- The
onBeforeComponentRenderhook execution has been moved before attribute mapping. This allows plugins to inject reactive data into the state target prior to mapping. - All
innerHTMLassignments are now wrapped withprocessHTMLto maintain consistent processing in imperative rendering paths. - Added new E2E tests specifically covering nested imperative components to guarantee correct mounting and interactivity.
Incremental Build and Hydration Fixes #
This release resolves several system issues and improves developer experience:
- Sitemap Plugin: Modified the sitemap generator to collect pages from the complete
app.pages.listcollection during theonAfterBuildhook. This ensures pages skipped by the incremental build system are still fully represented in the final sitemap output. - Hydration: Corrected the hydration sequence in
CoraliteElementto correctly handle attributes overwritten by the server. - Typings: Upgraded the
CoraliteModuleDefinitionsandCoraliteModuleDefinitiontype definitions to properly support thepageobject and other complex component state.
Documentation Updates #
To support these architectural best practices, our reference documentation has been updated:
- Updated
llms.txtwith new anti-patterns concerning the page-component boundary. - Added a "Respect the Component Boundary" section to the components guide.
- Introduced a "Pages as Consumers" section in core concepts.
- Enhanced the DOM management guide to highlight why direct DOM querying is fragile.
- Added a philosophy alert to the JavaScript guide advising against page-level scripts.
How to Upgrade #
To upgrade to the latest version, update your project dependencies:
npm install coralite@0.38.3
npm install coralite-scripts@0.38.3
