Coralite v0.28.2 Released
Coralite v0.28.2 is now available. This release introduces a static assets plugin to handle binary dependencies like WebAssembly, refactors client-side script execution parameters, updates the DOM generation behavior for the Refs plugin, and refines programmatic APIs.
Static Assets Plugin for Binary Dependencies #
To support components that rely on compiled assets, we have introduced staticAssetPlugin. The plugin copies binary dependencies (such as .wasm files) from package directories directly into the build output folder during compilation.
Unified Client-Side Script Context #
We have refined the JSDoc comments and TypeScript definitions to clearly differentiate between server-side setup functions and client-side script execution within Coralite modules. In addition, the signature of the client-side script callback has been updated to accept a unified context object instead of separate values and refs parameters. This context includes a helpers property to expose plugin helper methods within scripts.
import { defineComponent } from 'coralite';
export default defineComponent({
setup(props) {
// Runs on the server during rendering
return { userId: props.id };
},
script(context) {
// Runs on the client
const { values, refs, helpers } = context;
console.log('Client-side script initialized with values:', values);
}
});
Internal Options for Coralite Save Method #
The Coralite.prototype.save method has been refactored to read configuration options internally. The builder now checks this.options.output and throws an error if it is missing. This eliminates the need to pass arguments directly to the save function, simplifying CLI usage and test scripts.
import Coralite from 'coralite';
const coralite = new Coralite({
output: './dist'
});
// No arguments required; output path is read from initialization options
await coralite.save();
Refs Plugin Output and Testing Patterns #
To improve browser delivery, the Refs plugin now removes ref attributes from the final DOM output during SSR builds in favor of auto-generated IDs. If you are targeting these components in end-to-end testing suites like Playwright or Cypress, avoid using [ref="name"] selectors. Instead, target elements using the structured ID pattern:
<component-id>__<ref-name>-<instance-index>
</instance-index></ref-name></component-id>
Breaking Changes #
- Unified Script Parameters: The client-side
scriptfunction now receives a single context object rather than separatevaluesandrefsarguments. Existing scripts must be updated to use the new unified parameter format. - Coralite Save Signature:
Coralite.prototype.save()now requires the output directory to be specified when initializing the Coralite instance. Callingsavewithout configuration options pre-defined will throw an error. - SSR Ref Attribute Removal:
refattributes are no longer emitted in the final DOM output. External testing suites must select elements via generated IDs rather thanrefselectors.
How to Upgrade #
To upgrade to the latest version, update your project dependencies:
npm install coralite@0.28.2
npm install coralite-scripts@0.28.2
