You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(hub): serve a definition's absolute-path page script automatically
Let a devframe declare its page script on `dock.clientScript.importFrom`
as an absolute filesystem path. The hub install path mounts the file's
directory under the devframe's mount base and rewrites `importFrom` to
the served URL, so mounting the a11y inspector by package name works on
every host with no per-host wiring.
The a11y inspector now declares its own page script, and the reference
hosts (hub-vite, hub-next, a11y-messages-playground) drop their manual
mount + `clientScript` recipes.
Closes#310
Copy file name to clipboardExpand all lines: docs/content/1.guide/17.client-context.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,12 +76,13 @@ A failed import retries on the next dock update.
76
76
77
77
### Shipping a client script
78
78
79
-
`importFrom` accepts two shapes:
79
+
`importFrom` accepts three shapes:
80
80
81
+
-**An absolute filesystem path** to a built, self-contained ES module — declared on the definition's `dock.clientScript`. The hub install path serves the file's directory under the devframe's mount base (`<base>__page-script/`) and rewrites `importFrom` to that served URL, so a definition names its own client script and mounting by package name works with no host wiring (this is how the [a11y inspector](/plugins/a11y) ships its page script).
81
82
-**A URL served by the host framework** — a self-contained ES module; works on every host framework.
82
83
-**A bare npm specifier** (`'vite-plugin-vue-tracer/client/vite-devtools'`) — resolved through the host framework.
83
84
84
-
For a URL, attach it via `ctx.install(myDevframe, { dock: { clientScript: { importFrom } } })`. Under Vite `/@fs/<absolute path>` serves it; other host frameworks mount the directory statically.
85
+
A definition declares its own by path on `dock: { clientScript: { importFrom } }`. Per-mount, attach a URL via `ctx.install(myDevframe, { dock: { clientScript: { importFrom } } })`; under Vite `/@fs/<absolute path>` serves it, and other host frameworks mount the directory statically.
Copy file name to clipboardExpand all lines: docs/content/5.plugins/4.a11y.md
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,15 @@ The page script and the panel talk over the [in-page channel](/guide/in-page-cha
31
31
32
32
## In a hub
33
33
34
-
The page script is the a11y dock's [client script](/guide/client-context): attach `a11yPageScriptBundlePath` as the dock's `clientScript` and the hub imports it into the page. It also mirrors each scan into the hub's messages feed — a summary plus one per rule:
34
+
The definition declares the page script as its dock [client script](/guide/client-context), so mounting by package name works everywhere with no extra wiring:
The hub serves the page-script bundle same-origin under the a11y mount base and rewrites the dock's `clientScript` to that URL; a client runtime (`createDevframeClientRuntime()`) then imports it into the host page. Each scan also mirrors into the hub's messages feed — a summary plus one per rule.
41
+
42
+
A host that mounts the module itself still can — for example, a Vite host serving it via `/@fs/` — by attaching `a11yPageScriptBundlePath` as the dock's `clientScript`:
Copy file name to clipboardExpand all lines: examples/hub-next/README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Open the printed URL. The dock rail on the left lists every mounted tool with it
20
20
21
21
Selecting a tool loads its SPA in the stage. The bottom drawer mirrors the hub's **Commands**, **Messages**, and **Terminals** subsystems, plus a button that dispatches a command through `hub:commands:execute`, and a **Transport** section showing which RPC transport the connection runs on (`websocket` or `sse`) with a segmented Auto / WS / SSE toggle - the choice rides a `?transport=` URL param and reconnects the whole client runtime on the pinned transport.
22
22
23
-
The A11y Inspector shows a live axe-core report of this hub's own page: the hub serves the devframe's page-script module (`a11yPageScriptBundlePath`) same-origin inside the hub namespace and attaches it as the a11y dock's `clientScript` (the `{ devframe, dock }` entry form); the hub client runtime - `createDevframeClientRuntime()` booted in `app/page.tsx` - imports it into the page, so the docked panel and the page script share the origin and tab their in-page channel handshakes across.
23
+
The A11y Inspector shows a live axe-core report of this hub's own page: the devframe declares its own page-script module as the a11y dock's `clientScript`, so the hub serves it same-origin inside the hub namespace and rewrites the entry to that URL with no host wiring; the hub client runtime - `createDevframeClientRuntime()` booted in `app/page.tsx` - imports it into the page, so the docked panel and the page script share the origin and tab their in-page channel handshakes across.
24
24
25
25
The **RPC & State Inspector** carries an **Instances** tab that lists every devframe dev server running on your machine. The hub registers itself in the shared registry (`~/.devframe/instances/`) on startup via `registerDevframeInstance()`, so it shows up as "this instance"; start another example (e.g. `pnpm --filter hub-vite dev`, or any `node bin.mjs` CLI example) in a second terminal and it appears there too, each linking to its own SPA.
26
26
@@ -57,7 +57,7 @@ The built-in devframes run node-side (child processes, the native `zigpty` PTY b
57
57
58
58
| File | Role |
59
59
|---|---|
60
-
|`src/client/devframe/next-devframe-hub.ts`| The Next host - one `initHub()` call: devframes (incl. the a11y page script as its dock's `clientScript`), hub RPCs, commands, the json-render dock + renderer manifest, instance-registry registration |
60
+
|`src/client/devframe/next-devframe-hub.ts`| The Next host - one `initHub()` call: devframes (the a11y page script rides along automatically as its dock's declared`clientScript`), hub RPCs, commands, the json-render dock + renderer manifest, instance-registry registration |
61
61
|`src/client/devframe/unrendered-dock.ts`| A dock type registered with no renderer on purpose - the missing-renderer fallback witness |
62
62
|`../demo-dock-client/`| The shared demo client script, consumed here as a statically-mounted self-contained bundle |
63
63
|`src/client/app/%5F_devframes/[[...path]]/route.ts`| The one catch-all - delegates every `/__devframes/*` request to the instance's `handler`|
Copy file name to clipboardExpand all lines: examples/hub-vite/README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Open the printed URL. The dock rail on the left lists every mounted tool with it
20
20
21
21
Selecting a tool loads its SPA in the stage. The bottom drawer mirrors the hub's **Commands**, **Messages**, and **Terminals** subsystems, plus a button that dispatches a command through `hub:commands:execute`, and a **Transport** section showing which RPC transport the connection runs on (`websocket` or `sse`) with a segmented Auto / WS / SSE toggle - the choice rides a `?transport=` URL param and reconnects the whole client runtime on the pinned transport.
22
22
23
-
The A11y Inspector shows a live axe-core report of this hub's own page. `vite.config.ts` attaches the devframe's page script as the a11y dock's `clientScript` (served via `/@fs/`), and the hub client runtime - `createDevframeClientRuntime()` booted in `src/client/main.ts` - imports it into the host page. Panel and page script share the Vite origin and tab their in-page channel handshakes across; hover a violation to ring the offending element in the hub UI.
23
+
The A11y Inspector shows a live axe-core report of this hub's own page. The devframe declares its own page script as the a11y dock's `clientScript`, so the hub serves it same-origin and the hub client runtime - `createDevframeClientRuntime()` booted in `src/client/main.ts` - imports it into the host page automatically (no wiring in `vite.config.ts`). Panel and page script share the Vite origin and tab their in-page channel handshakes across; hover a violation to ring the offending element in the hub UI.
24
24
25
25
The **RPC & State Inspector** carries an **Instances** tab that lists every devframe dev server running on your machine. The hub registers itself in the shared registry (`~/.devframe/instances/`) on startup via `registerDevframeInstance()`, so it shows up as "this instance"; start another example (`pnpm --filter a11y-messages-playground dev`, or any `node bin.mjs` CLI example) in a second terminal and it appears there too, each linking to its own SPA.
26
26
@@ -45,7 +45,7 @@ The dock UI is plain DOM in `src/client/`. To skin your own hub UI provider, rea
45
45
| File | Role |
46
46
|---|---|
47
47
|`src/vite-devframe-hub.ts`| The Vite host - one `initHub()` call mounted as connect middleware, plus instance-registry registration |
48
-
|`vite.config.ts`| Passes the built-in and demo devframes to the hub's `devframes` option; attaches the a11y page script as its dock's `clientScript`; composes the json-render frontend via `renderers`|
48
+
|`vite.config.ts`| Passes the built-in and demo devframes to the hub's `devframes` option (the a11y page script rides along automatically as its dock's declared `clientScript`); composes the json-render frontend via `renderers`|
49
49
|`src/unrendered-dock.ts`| A dock type registered with no renderer on purpose - the missing-renderer fallback witness |
50
50
|`../demo-dock-client/`| The shared demo client script, consumed here via bare specifier (`action: { importFrom: 'demo-dock-client' }`) |
51
51
|`src/client/main.ts`| The browser UI that consumes the hub protocol, including the interactive-OTP authorization view |
0 commit comments