Documentation
¶
Overview ¶
Package web embeds the browser assets: the client SDK (web/sdk/) served at /__backyard/backyard.{js,mjs,d.ts} on every host and the hub UI (web/hub/). The files are complete and standalone so the Cloudflare Worker can serve identical bytes; the server prepends the per-request preamble (SPEC §2.1).
The SDK source of truth is web/sdk/src/core.js; web/sdk/build.mjs generates backyard.js (classic script) and backyard.mjs (ES module) from it, and both outputs are committed. After editing core.js run:
node web/sdk/build.mjs cd web && npm test
npm test (Node 22, no dependencies) checks that the builds are in sync and runs the SDK, hub and docs unit tests. With playwright-core and Chromium (PLAYWRIGHT_CORE=…/playwright-core/index.mjs) it also runs the real-browser tests against web/test/stubserver.mjs, and web/test/e2e.test.mjs deploys a site through the hub of a real server and exercises the SDK end to end: with BACKYARD_E2E_SERVE=go it builds and starts this checkout's Go server itself (npm run test:e2e:go), with BACKYARD_E2E_URL (plus BACKYARD_E2E_TOKEN when deploys need a token) it uses a running server (Go or the Cloudflare Worker).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Hub ¶
Hub returns the hub UI files (index.html at the root, plus assets). The server serves them at "/" on the hub host; "/docs" serves docs.html.
func SDKClassic ¶
func SDKClassic() []byte
SDKClassic returns backyard.js (classic script defining window.backyard). The returned slice is shared: callers must not modify it.
Types ¶
This section is empty.