Skip to content

Repository files navigation

@uniweb/runtime

Minimal runtime for loading Uniweb foundations and orchestrating rendering.

Overview

This package provides the browser-side runtime for Uniweb sites. It loads foundations dynamically and renders content using React Router.

For Vite build plugins, see @uniweb/build.

Installation

npm install @uniweb/runtime

Usage

Runtime Loading

Initialize the runtime with a Foundation URL:

importinitRuntimefrom'@uniweb/runtime'// Load foundation from URLinitRuntime('/foundation/foundation.js',{development: import.meta.env.DEV,})// Or with CSSinitRuntime({url: '/foundation/foundation.js',cssUrl: '/foundation/assets/style.css'})

Static Bundling

Foundation imported directly and bundled with the site:

import*asFoundationfrom'@my-org/my-foundation'importinitRuntimefrom'@uniweb/runtime'initRuntime(Foundation)

API

initRuntime(source, options)

Initialize the runtime with a foundation.

source - One of:

  • URL string to foundation module
  • Object with { url, cssUrl }
  • Foundation module object (for static bundling)

options:

{development: false,// Enable dev mode (StrictMode, verbose errors)configData: null,// Site content (or reads from DOM)basename: undefined// React Router basename}

For core classes (Uniweb, Website, Block, etc.), import from @uniweb/core.

Architecture

@uniweb/runtime (browser)
│
├── Loads foundation dynamically
├── Creates Uniweb instance via @uniweb/core
└── Orchestrates React/Router rendering

Foundations should:

  • Import components from @uniweb/kit (bundled)
  • Mark @uniweb/core as external (provided by runtime)

Build Plugins

Vite plugins have moved to @uniweb/build:

// vite.config.jsimport{siteContentPlugin}from'@uniweb/build/site'import{foundationDevPlugin}from'@uniweb/build/dev'exportdefaultdefineConfig({plugins: [siteContentPlugin({sitePath: './',inject: true}),foundationDevPlugin({path: '../foundation',serve: '/foundation'}),]})

Related Packages

License

Apache 2.0

About

Runtime orchestrator for Uniweb websites.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages