Skip to content

uniweb/runtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 

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:

import initRuntime from '@uniweb/runtime'

// Load foundation from URL
initRuntime('/foundation/foundation.js', {
  development: import.meta.env.DEV,
})

// Or with CSS
initRuntime({
  url: '/foundation/foundation.js',
  cssUrl: '/foundation/assets/style.css'
})

Static Bundling

Foundation imported directly and bundled with the site:

import * as Foundation from '@my-org/my-foundation'
import initRuntime from '@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.js
import { siteContentPlugin } from '@uniweb/build/site'
import { foundationDevPlugin } from '@uniweb/build/dev'

export default defineConfig({
  plugins: [
    siteContentPlugin({ sitePath: './', inject: true }),
    foundationDevPlugin({ path: '../foundation', serve: '/foundation' }),
  ]
})

Related Packages

License

Apache 2.0

About

Runtime orchestrator for Uniweb websites.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •