Package portable headless runtime with independent Node and browser consumers
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
# Headless Canvas: portable ESM preview
|
||||
|
||||
Build from the Endoleap checkout with `npm run build:headless`. The generated
|
||||
`.headless-dist` directory is a private package; nothing is published to a registry.
|
||||
Copy it elsewhere, or use `npm pack --offline --ignore-scripts` inside that directory.
|
||||
|
||||
Public exports:
|
||||
|
||||
| Import | Responsibility |
|
||||
| --- | --- |
|
||||
| `@endoleap/headless-canvas` or `/core` | Document, registry, capabilities, transactions, history, sessions, geometry and queries |
|
||||
| `/runtime` | Project/Workspace/Host, storage and service port types, recovery, scoped loader and compute/display pools |
|
||||
| `/service` | Foundry protocol codecs and transport adapters; credentials remain in the host |
|
||||
| `/browser` | Explicit IndexedDB/Web Locks and module Worker adapters |
|
||||
|
||||
The portable entries have no React, Next, React Flow or other runtime package
|
||||
dependency. They use standard platform APIs such as AbortController, Blob, URL,
|
||||
TextEncoder and Web Crypto. The sample runs on Node 22+. Browser adapters require
|
||||
their browser APIs; importing `/runtime` does not import the browser adapter.
|
||||
|
||||
Run `node consumer.mjs` inside the generated package. It uses a custom counter
|
||||
component, rejects an atomic invalid transaction, commits edits, undoes/redoes,
|
||||
cancels a gesture preview, deep-copies through the runtime, and reopens the engine.
|
||||
The storage and protocol-2 transport are in-memory examples. Reopening demonstrates
|
||||
the codec and host contract, not cross-process crash durability or a deployed server.
|
||||
|
||||
`npm run test:headless:package` builds, packs/unpacks into an isolated directory,
|
||||
blocks framework imports and browser-only globals, runs the sample, checks Node
|
||||
TypeScript consumers without the DOM library, and exercises compiled browser adapters
|
||||
and module Worker URLs in isolated Chromium. The browser checks load the emitted JS
|
||||
directly, without TypeScript stripping or a Next bundler.
|
||||
|
||||
This preview does not yet package the React renderer/bindings. Their legacy
|
||||
projection DTO types still require an explicit adapter boundary. No registry
|
||||
publication, release support promise, server deployment or full-goal completion is
|
||||
implied by this local package.
|
||||
Reference in New Issue
Block a user