@page-engine/page-standalone-host
v0.4.0
Published
Standalone browser host for PageEngine: package verification, lazy loading, and secure boot.
Readme
@page-engine/page-standalone-host
Standalone browser host for the PageEngine declarative front-end engine.
This is the package business applications install to run PageEngine pages:
it verifies Standalone Runtime Packages (pure Runtime Data Package
integrity — every digest checked before use), boots the trust anchor and
start page, lazily loads routes with per-file digest verification
(unloadable targets degrade to the start-page fallback with telemetry, no
retry), prefetches the mounted page's navigation closure, and mounts pages
through @page-engine/page-runtime-browser.
- Depends only on
@page-engine/page-contracts,@page-engine/page-runtime-core, and@page-engine/page-runtime-browser. - Integrity code is pure: no DOM, file, network, Compiler, Atlas, or Delivery capabilities.
- Pluggable ports: package fetch, navigation adapter (hash by default,
history
pushStateavailable), timers, and push-invalidation signals.
Install
npm install @page-engine/page-standalone-hostOptionally add a framework adapter for your renderers:
npm install @page-engine/renderer-adapter-react # React 18/19
npm install @page-engine/renderer-adapter-vue3 # Vue 3.4+Requires Node >= 22.12 for tooling; the host runs in the browser. ESM only.
Minimal example
import {
bootstrapStandalonePage, createBrowserNavigationAdapter, createSameOriginPackageFetchPort, type StandaloneHostDependencies,
} from "@page-engine/page-standalone-host";
const dependencies: StandaloneHostDependencies = {
packageBaseUrl: new URL("/dist/runtime/", location.href),
packageFetchPort: createSameOriginPackageFetchPort(),
rendererRegistry, // your trusted renderer modules (see the framework adapters)
queryGateway, // your read-only query gateway port
correlationIdFactory: () => crypto.randomUUID(),
navigationAdapter: createBrowserNavigationAdapter(window),
};
const handle = bootstrapStandalonePage({ root: document.querySelector("#page-engine-root")!, dependencies });
const result = await handle.ready;
if (!result.ok) console.error(result.diagnostics);Build the runtime package this host consumes with
@page-engine/page-cli's build-standalone command. See the monorepo
examples/security-standalone for a complete application.
