Release

Coralite v0.38.0 Released

Coralite v0.38.0 introduces isomorphic contextual resolution for plugins, enforces the two-phase plugin pattern, optimizes imperative components with on-demand script loading, and implements site-wide bundling parity.

TD
Thomas David June 17, 2026

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:

  • Phase 1 (Global Initialization): Handles setup tasks and global mutations. Inter-plugin calls are restricted during this phase to avoid dependency deadlocks.
  • Phase 2 (Instance Resolver): Runs per component instance. Features namespaced plugin access with lazy-resolving proxies and caching to ensure instance factories are evaluated exactly once.

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

  • Removal of server.exports: Virtual module imports for plugins are no longer supported. Components must retrieve plugin APIs through the context object parameter in the server() and client() functions.
  • Deprecation of the setup Function: The setup configuration property has been removed from server and client plugin definitions. This initialization phase is now handled during Phase 1 of the plugin's context resolver.
  • Mandatory Two-Phase Plugins: Returning flat objects or single-phase resolvers from plugins is now disallowed. Plugins must strictly validate and return the Phase 1 and Phase 2 resolver structure.
  • Blocked Complex Attribute Types: Specifying Object or Array types directly inside the attributes block now throws a validation error.

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
TD

Thomas David

Creator of Coralite. Writing about the intersection of native web APIs, compiler design, and AI-assisted development.