Coralite v0.34.0 Released

Coralite v0.34.0 introduces a major redesign of the core component definition and state management APIs. This release transitions the framework to the Flat Options API, replacing properties with a unified reactive state object. It also adds robust build-time error reporting and improves client runtime performance and safety.

The Flat Options API and Unified State #

This release deprecates the properties-based state management model in favor of the new Flat Options API. Component configurations now follow a strict structure: { attributes, data, getters, slots, script }. This unifies state, attributes, and getters under a single reactive state proxy.

Attributes support build-time validation and primitive coercion (Number, Boolean, and String). A dedicated data() block defines the boundary for server-to-client data serialization. During build, code stripping automatically removes the data() method and any Node.js imports from the client bundle to minimize payload sizes.

javascript
Code copied!
  defineComponent({
    attributes: {
      userId: String,
      initialCount: {
        type: Number,
        default: 0
      }
    },
    data() {
      return {
        clicks: 0
      };
    },
    getters: {
      totalClicks(state) {
        return state.initialCount + state.clicks;
      }
    },
    script({ state, refs }) {
      // Client-side interactions
      state.clicks++;
    }
  });

Read-Only Getters and Dual-Proxy Reactivity #

To enforce unidirectional data flow, getters now enforce strictly read-only access to state. The core engine implements this with a dual-proxy system: a reactive proxy on the client and a read-only proxy during server evaluation.

Additionally, async getters now receive an AbortSignal. This provides built-in async race protection, enabling the runtime to discard stale requests if a newer state transition begins before the previous promise resolves.

Improved Error Reporting with CoraliteError #

To simplify debugging, the new CoraliteError class captures comprehensive component context during build failures. The class automatically wraps evaluation errors in _evaluateProduction and _evaluateDevelopment, providing detailed context including:

This information is processed and logged by displayError within coralite-scripts to help pinpoint build issues quickly.

Breaking Changes #

How to Upgrade #

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

bash
Code copied!
  npm install coralite@0.34.0
bash
Code copied!
  npm install coralite-scripts@0.34.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!