Coralite v0.38.6 Released
Coralite v0.38.6 has been released. This update resolves a key issue with imperatively created components, ensuring that getters referenced as template tokens render correctly instead of rendering as empty strings. It also introduces several stability enhancements to component metadata extraction and attribute parsing.
Fixing Imperative Getters as Template Tokens #
In previous versions, getters utilized as template tokens within imperatively initialized components could fail to resolve, resulting in empty strings. To fix this, we have enhanced the metadata extraction pipeline:
- Static Fallback Extraction: We introduced a static extraction fallback in
_safeRegisterforgetters,attributes, andslotsfrom component scripts. This ensures component metadata is correctly captured even if runtime evaluation is bypassed or fails. - Unified Property Extraction: Property extraction has been streamlined by removing the redundant
findAndExtractPropertiesfunction and improvingextractComponentPropertyto reliably extract static properties from anydefineComponentdeclaration. - Serialization in ScriptManager:
ScriptManagerhas been updated to normalize and serialize getters correctly for inclusion in client-side bundles.
The following example displays a component definition using getters that now resolve correctly as template tokens:
import { defineComponent } from 'coralite';
export default defineComponent({
properties: {
firstName: String,
lastName: String
},
getters: {
fullName() {
return `${this.firstName} ${this.lastName}`;
}
},
template: `<div>Welcome, {{ fullName }}!</div>`
});
Attribute Parsing Improvements #
We corrected attribute parsing in createComponentDefinition to properly support shorthand type definitions. This adjustment prevents unexpected crashes during base evaluation when processing component definitions with shorthand attributes.
The changes have been thoroughly validated with new end-to-end (E2E) test cases and verified via visual screenshot assertions.
How to Upgrade #
To upgrade to the latest version, update your project dependencies:
npm install coralite@0.38.6
npm install coralite-scripts@0.38.6
