Coralite v0.31.7 Released

Coralite v0.31.7 is now available. This release focuses on API consistency, type safety enhancements, and fixing relative path resolution for component-level client imports. Key updates include the standardization of the plugin definition API, removal of legacy properties deprecated by the transition away from Shadow DOM, and robust relative resolution for component imports in the esbuild pipeline.

Standardizing Plugin Definitions with definePlugin #

To align with the established defineComponent convention, the core plugin definition function has been renamed from createPlugin to definePlugin. All core exports, documentation, CLI scaffold templates, and built-in plugins (such as static-assets, refs, metadata, and define-component) have been updated to use the new convention. Redirects have also been set up on the documentation website to point legacy references to the new pages.

Usage of the new API remains functionally identical, requiring only a change in the imported function name:

javascript
Code copied!
  import { definePlugin } from 'coralite';
  
  export default definePlugin({
    name: 'custom-logger',
    setup(context) {
      console.log('Plugin initialized');
    }
  });

Shadow DOM Deprecation Cleanup & Improved Types #

In line with the deprecation of Shadow DOM usage within the framework, the obsolete root property has been removed from CoraliteScriptContent and the main coralite.js context. The refs plugin has been updated to query the global document instead of the removed root context. Additionally, type definitions in script.js have been refined, and the slots property in ScriptContent is now correctly typed as CoraliteModuleSlotFunction, improving editor completion and compile-time checks.

Resolving Relative Imports in Components #

Previously, relative paths defined in the client.imports array of a component were resolved against the active terminal current working directory (process.cwd()). In v0.31.7, the internal component bundler has been updated to resolve relative imports (e.g. ./my-lib.js) against the directory containing the component file. This ensures predictable building behavior regardless of where the developer runs CLI commands.

Breaking Changes #

How to Upgrade #

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

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

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!