Coralite v0.38.0 Released

Coralite v0.38.0 is now available. This release delivers major enhancements to the plugin system, transitioning component data access to isomorphic contextual resolution, optimizing script delivery for imperatively created components, and aligning development and production bundling strategies. These updates improve performance and developer productivity while establishing cleaner state and hydration boundaries.

Isomorphic Contextual Resolution for Plugins #

We are migrating away from static virtual module property injection (previously server.exports) in favor of contextual resolution via a unified context object. This object is supplied symmetrically to both the server() and client() blocks of a component. This transition guarantees location transparency across server-side rendering (SSR) and client-side hydration, enabling components to consume plugin APIs under a single contract.

javascript
Code copied!
  defineComponent({
    server(context) {
      // Access namespaced plugin APIs injected directly into the context
      const translations = context.i18n.getTranslations();
      return { translations };
    },
    client(context) {
      // Symmetrical context access on the client
      const translations = context.i18n.getTranslations();
      console.log('Hydrated with:', translations, 'Instance ID:', context.instanceId);
    }
  });

Enforced Two-Phase Resolver Pattern #

To support contextual resolution, all Coralite plugins must now follow a strict two-phase resolver pattern. This separates global singleton behavior from individual component instance logic, ensuring safe inter-plugin communication and dependency resolution:

On-Demand Script Loading for Imperative Components #

Previously, imperatively created components (such as those generated via document.createElement) required their script bundles to be eagerly loaded in the browser. In v0.38.0, we have introduced an AST-driven compiler interceptor that replaces hyphenated document.createElement calls with a globally injected createCoraliteElement shim. At runtime, this proxy synchronously returns an un-upgraded element and asynchronously fetches the component's script on-demand, reducing initial bundle sizes and page load times.

Site-Wide Bundling and Environment Parity #

To minimize differences between development and production environments, the development server now uses a site-wide bundling strategy. Leveraging esbuild's persistent context API, the renderer performs fast, atomic incremental rebuilds when file changes are detected. On the production side, we have consolidated virtual modules under the coralite-virtual: namespace and transitioned to single-pass bundling to produce stable chunk hashes for better browser caching.

Component State and API Refinements #

The component model has been refined to transition from the "Four Pillars" to the "Five Pillars" of state by introducing the slots block in component definitions. Additionally, to avoid serialization mismatches, passing raw Object or Array types in the attributes block is now blocked. Developers should pass structured data via contextual resolvers or serialized JSON attributes instead.

Breaking Changes #

How to Upgrade #

To upgrade to the latest version, update your project dependencies:

bash
Code copied!
  npm install coralite@0.38.0
bash
Code copied!
  npm install coralite-scripts@0.38.0

Related posts

More blog posts

Start Building with Coralite!

Use the scaffolding script to get jump started into your next project with Coralite

Copied commandline!