@page-engine/page-compiler
v0.4.0
Published
Deterministic Page Source to Runtime Manifest compiler for PageEngine.
Readme
@page-engine/page-compiler
Deterministic compiler from Page Source to Runtime Manifest for the PageEngine declarative front-end engine.
resolveStandalonePage resolves a Page Source against explicit immutable
inventories (widget contracts, renderers, service operations, runtime policy,
target runtime profile) and compileResolvedPage compiles the resolved input
into a page.runtime-manifest/v1. Compilation is deterministic: identical
inputs always produce byte-identical manifests (verified by the determinism
test suite in the monorepo).
- Pure: no DOM, network, filesystem, clock, or random source access.
- Depends only on
@page-engine/page-contracts. - Build-time fail-closed validation: schema violations, pointer violations, cross-page navigation targets, operator whitelists, and runtime policy gates all reject the compile rather than degrade.
Install
npm install @page-engine/page-compilerRequires Node >= 22.12. ESM only.
Minimal example
import { compileResolvedPage, resolveStandalonePage } from "@page-engine/page-compiler";
const resolved = resolveStandalonePage({ source, inventory });
if (!resolved.ok) throw new Error(JSON.stringify(resolved.diagnostics));
const compiled = compileResolvedPage(resolved.value);
if (!compiled.ok) throw new Error(JSON.stringify(compiled.diagnostics));
console.log(compiled.value.manifest);Most applications should use @page-engine/page-cli (which wraps this
compiler with file adapters and the standalone package builder) or
@page-engine/page-testkit (which wraps it for tests). Use this package
directly when you need programmatic compilation over already-loaded objects.
See the monorepo README and docs/ for Page Source and inventory schemas.
