standalone: ship the headless engine as one bundleable ESM file

A no-build static site couldn't vendor BitGate the way it vendors a single
dependency: bare @bitgate/* specifiers don't resolve in a browser, and the
headless path spans two packages (the evaluator in core, the kind-1985 label
codec in nostr). The widget bundle solved this for the DOM path only.

Add @bitgate/standalone (packages/standalone): an entry re-exporting core +
nostr, esbuilt into a single self-contained dist/bitgate.js (~44 KB). It's
the same canonical code the npm packages ship, with specifiers inlined, and
dependency-free -- @bitgate/verify's @noble deps are intentionally not pulled
in, so the bundle carries no third-party code. Wired into `npm run build` via
build:standalone.

Verified: no bare imports in the output (self-contained), and a smoke test
composes a full label -> decision flow from the single entry. README Packages
table and headless section document it.

Addresses the "standalone ESM single-file" item of the Tessera integration
feedback (docs/TODO.md).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BXQCvJPA6sVSQ5j8uBd9bB
This commit is contained in:
thePR0M3TH3ANandClaude Opus 4.8 committed 2026-08-11 20:40:04 -04:00
1 parent 7eb4064556
commit 088e3cdabe
7 files changed
+169 -4

No files matched your search

+6
View File
@@ -49,6 +49,7 @@ equivalent to following the operator's seed list.
| `@bitgate/verify` | Optional NIP-01 signature verification, so the core stays dependency-free. |
| `@bitgate/testing` | Conformance harness. |
| `@bitgate/widget` | Drop-in custom elements: viewer controls and a moderator console. |
| `@bitgate/standalone` | The headless engine + Nostr codecs bundled into one self-contained ESM file for no-build static sites. |
| `@bitgate/bitvid-compat` | Reference application profile for the characterization corpus. |
## Quick start — a static page
@@ -155,6 +156,11 @@ checkout while `visibility` still shows the listing with a warning — something
is a runnable end-to-end walkthrough (`node examples/headless-quickstart.mjs`);
[docs/labels.md](docs/labels.md) covers the NIP-32 wire format and interop.
No bundler? `npm run build:standalone` produces `packages/standalone/dist/bitgate.js`
— the engine and the Nostr codecs above in one self-contained, dependency-free
ESM file. Self-host it and `import { evaluateTarget, decodeLabels } from "./bitgate.js"`;
everything in this section works from that single file.
## Extending to a new application
Write an adapter saying what your object is in governance terms, and a policy