Skip to content

Commit 2da4c91

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/assets-plugin
# Conflicts: # pnpm-lock.yaml # turbo.json # vitest.config.ts
2 parents fcbb286 + 64236ac commit 2da4c91

123 files changed

Lines changed: 1617 additions & 824 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
**`devframe`** is the framework-neutral container for one devtool integration, portable across viewers. Build a single tool (its RPC, its SPA, its diagnostics, its CLI/build/spa/embedded outputs) without caring how it'll be displayed. A devframe app runs standalone (CLI, static deploy, embedded SPA) just as well as it mounts inside a hub.
66

7-
**`@devframes/hub`** is the framework-neutral hub layer that sits on top of devframe and provides the multi-integration orchestration (docks, terminals, messages, commands). It does not ship UI — implementers (e.g. `@vitejs/devtools-kit`) provide their own UI on top of the hub's RPC + shared-state protocol. It does ship a **headless client runtime** (`createDevframeClientHost()` from `@devframes/hub/client`): booted in the host page, it assembles the shared `DevframeClientContext` (panel, docks, commands, when) and imports each dock entry's client script (`action` / `custom-render` / iframe `clientScript`) into that page — how a plugin like the a11y inspector runs code inside the page being inspected. See `examples/minimal-vite-devframe-hub/` for a working ~120-line Vite host demonstrating the protocol end to end.
7+
**`@devframes/hub`** is the framework-neutral hub layer that sits on top of devframe and provides the multi-integration orchestration (docks, terminals, messages, commands). It does not ship UI — implementers (e.g. `@vitejs/devtools-kit`) provide their own UI on top of the hub's RPC + shared-state protocol. It does ship a **headless client runtime** (`createDevframeClientHost()` from `@devframes/hub/client`): booted in the host page, it assembles the shared `DevframeClientContext` (panel, docks, commands, when) and imports each dock entry's client script (`action` / `custom-render` / iframe `clientScript`) into that page — how a plugin like the a11y inspector runs code inside the page being inspected. See `examples/vite-devframe-hub/` for a working ~120-line Vite host demonstrating the protocol end to end.
88

99
## Stack & Structure
1010

alias.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,16 @@ export const alias = {
4646
'@devframes/hub': r('hub/src/index.ts'),
4747
'@devframes/nuxt/runtime/plugin.client': r('nuxt/src/runtime/plugin.client.ts'),
4848
'@devframes/nuxt': r('nuxt/src/index.ts'),
49+
'@devframes/next/client': r('next/src/client.tsx'),
50+
'@devframes/next': r('next/src/index.ts'),
4951
'@devframes/json-render/core': r('json-render/src/core.ts'),
5052
'@devframes/json-render/hub': r('json-render/src/hub.ts'),
5153
'@devframes/json-render/node': r('json-render/src/node/index.ts'),
5254
'@devframes/json-render': r('json-render/src/index.ts'),
5355
'@devframes/json-render-ui/components': r('json-render-ui/src/components/index.ts'),
5456
'@devframes/json-render-ui/spa': r('json-render-ui/src/spa.ts'),
5557
'@devframes/json-render-ui': r('json-render-ui/src/index.ts'),
56-
'minimal-json-render/dashboard': fileURLToPath(new URL('./examples/minimal-json-render/src/dashboard.ts', import.meta.url)),
58+
'json-render/dashboard': fileURLToPath(new URL('./examples/json-render/src/dashboard.ts', import.meta.url)),
5759
'@devframes/plugin-code-server/client': p('code-server/src/client/index.ts'),
5860
'@devframes/plugin-code-server/node': p('code-server/src/node/index.ts'),
5961
'@devframes/plugin-code-server/constants': p('code-server/src/constants.ts'),
@@ -71,6 +73,7 @@ export const alias = {
7173
'@devframes/plugin-terminals': p('terminals/src/index.ts'),
7274
'@devframes/plugin-git': p('git/src/index.ts'),
7375
'devframe/recipes/interactive-auth': r('devframe/src/recipes/interactive-auth.ts'),
76+
'devframe/recipes/common-rpc-functions': r('devframe/src/recipes/common-rpc-functions.ts'),
7477
'devframe/recipes/open-helpers': r('devframe/src/recipes/open-helpers.ts'),
7578
'devframe/client': r('devframe/src/client/index.ts'),
7679
'devframe': r('devframe/src'),

docs/.vitepress/config.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ function helpersItems(prefix: string) {
5555
{ text: 'Utilities', link: `${prefix}/helpers/utilities` },
5656
{ text: 'Vite Bridge', link: `${prefix}/helpers/vite-bridge` },
5757
{ text: 'Nuxt Module', link: `${prefix}/helpers/nuxt` },
58-
{ text: 'Open Helpers', link: `${prefix}/helpers/open-helpers` },
58+
{ text: 'Next Helper', link: `${prefix}/helpers/next` },
59+
{ text: 'Common RPC Functions', link: `${prefix}/helpers/common-rpc-functions` },
5960
{ text: 'Interactive Auth', link: `${prefix}/helpers/interactive-auth` },
6061
] satisfies DefaultTheme.NavItemWithLink[]
6162
}
@@ -79,11 +80,11 @@ function examplesItems(prefix: string) {
7980
{ text: 'Overview', link: `${prefix}/examples/` },
8081
{ text: 'Built with Devframe', link: `${prefix}/examples/built-with` },
8182
{ text: 'files-inspector', link: `${prefix}/examples/files-inspector` },
82-
{ text: 'minimal-json-render', link: `${prefix}/examples/minimal-json-render` },
83+
{ text: 'json-render', link: `${prefix}/examples/json-render` },
8384
{ text: 'streaming-chat', link: `${prefix}/examples/streaming-chat` },
8485
{ text: 'next-runtime-snapshot', link: `${prefix}/examples/next-runtime-snapshot` },
85-
{ text: 'minimal-vite-devframe-hub', link: `${prefix}/examples/minimal-vite-devframe-hub` },
86-
{ text: 'minimal-next-devframe-hub', link: `${prefix}/examples/minimal-next-devframe-hub` },
86+
{ text: 'vite-devframe-hub', link: `${prefix}/examples/vite-devframe-hub` },
87+
{ text: 'next-devframe-hub', link: `${prefix}/examples/next-devframe-hub` },
8788
] satisfies DefaultTheme.NavItemWithLink[]
8889
}
8990

@@ -114,17 +115,21 @@ export function devframeSidebar(prefix = ''): DefaultTheme.SidebarItem[] {
114115

115116
export function devframeNav(prefix = ''): DefaultTheme.NavItem[] {
116117
return [
117-
{ text: 'Guide', items: guideItems(prefix) },
118-
{ text: 'Adapters', items: adaptersItems(prefix) },
119118
{
120-
text: 'Resources',
119+
text: 'Guide',
120+
items: [
121+
...guideItems(prefix),
122+
{ text: 'Examples', items: examplesItems(prefix) },
123+
],
124+
},
125+
{
126+
text: 'Adapters',
121127
items: [
122-
{ text: 'Examples', link: `${prefix}/examples/` },
123-
{ text: 'Built with Devframe', link: `${prefix}/examples/built-with` },
128+
...adaptersItems(prefix),
124129
{ text: 'Helpers', items: helpersItems(prefix) },
125-
{ text: 'Plugins', items: pluginsItems(prefix) },
126130
],
127131
},
132+
{ text: 'Plugins', items: pluginsItems(prefix) },
128133
{ text: 'Errors', link: `${prefix}/errors/` },
129134
{
130135
text: `v${pkg.version}`,

docs/examples/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ End-to-end examples that exercise the full adapter surface, each a runnable app
99
| Example | UI framework | What it shows |
1010
|---------|--------------|---------------|
1111
| [files-inspector](./files-inspector) | Preact | Lists files in the cwd via RPC; exercises the CLI dev / build / spa surfaces. |
12-
| [minimal-json-render](./minimal-json-render) | Vue | A server-authored JSON-render view rendered by `@devframes/json-render-ui`, with live state and an action bridge. |
12+
| [json-render](./json-render) | Vue | A server-authored JSON-render view rendered by `@devframes/json-render-ui`, with live state and an action bridge. |
1313
| [streaming-chat](./streaming-chat) | Preact | Streams synthetic chat tokens server → client, with history kept in shared state. |
1414
| [next-runtime-snapshot](./next-runtime-snapshot) | React (Next.js) | A Next.js App Router SPA over RPC, surfacing the host Node runtime. |
15-
| [minimal-vite-devframe-hub](./minimal-vite-devframe-hub) | Vanilla TypeScript (Vite) | A ~120-line Vite host wiring `@devframes/hub` end to end. |
16-
| [minimal-next-devframe-hub](./minimal-next-devframe-hub) | React (Next.js) | The same hub protocol, hosted from a Next.js route handler. |
15+
| [vite-devframe-hub](./vite-devframe-hub) | Vanilla TypeScript (Vite) | A ~120-line Vite host wiring `@devframes/hub` end to end. |
16+
| [next-devframe-hub](./next-devframe-hub) | React (Next.js) | The same hub protocol, hosted from a Next.js route handler. |
1717

1818
## Run any example
1919

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
outline: deep
33
---
44

5-
# minimal-json-render
5+
# json-render
66

77
A standalone devframe that serves a **JSON-render view**: the server authors an
88
`@json-render/core` spec once, and the prebuilt `@devframes/json-render-ui` SPA
99
renders it — the app ships no client build of its own.
1010

11-
Package: `minimal-json-render` · frontend: **prebuilt `@devframes/json-render-ui/spa`**
11+
Package: `json-render` · frontend: **prebuilt `@devframes/json-render-ui/spa`**
1212

1313
## What it shows
1414

@@ -29,12 +29,12 @@ Package: `minimal-json-render` · frontend: **prebuilt `@devframes/json-render-u
2929
## Run it
3030

3131
```sh
32-
pnpm --filter minimal-json-render dev # CLI dev server (live RPC)
33-
pnpm --filter minimal-json-render cli:build # static deploy → dist/static
32+
pnpm --filter json-render dev # CLI dev server (live RPC)
33+
pnpm --filter json-render cli:build # static deploy → dist/static
3434
```
3535

36-
The dev server serves the SPA at `/__minimal-json-render/`.
36+
The dev server serves the SPA at `/__json-render/`.
3737

3838
## Source
3939

40-
[`examples/minimal-json-render`](https://github.com/devframes/devframe/tree/main/examples/minimal-json-render)
40+
[`examples/json-render`](https://github.com/devframes/devframe/tree/main/examples/json-render)

docs/examples/minimal-next-devframe-hub.md renamed to docs/examples/next-devframe-hub.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
outline: deep
33
---
44

5-
# minimal-next-devframe-hub
5+
# next-devframe-hub
66

7-
The same hub protocol as the [Vite host](./minimal-vite-devframe-hub), hosted from a **Next.js** App Router app. It wires [`@devframes/hub`](/guide/hub) by lazily starting a side-car RPC / WebSocket server from a Node route handler — proof that the hub is host-runtime-agnostic.
7+
The same hub protocol as the [Vite host](./vite-devframe-hub), hosted from a **Next.js** App Router app. It wires [`@devframes/hub`](/guide/hub) by lazily starting a side-car RPC / WebSocket server from a Node route handler — proof that the hub is host-runtime-agnostic.
88

9-
Package: `minimal-next-devframe-hub` · framework: **React (Next.js)**
9+
Package: `next-devframe-hub` · framework: **React (Next.js)**
1010

1111
## What it proves
1212

1313
- `createHubContext()` boots a hub without any Vite-specific code path.
14-
- A `DevframeHost` implementation plugs the Next host specifics into the hub uniformly.
14+
- The [`@devframes/next`](/helpers/next) bridge supplies the `DevframeHost` and a single `fetch` handler both route handlers delegate to — serving every mounted SPA and its connection meta through devframe's own static handler.
1515
- `mountDevframe(ctx, def)` registers any `DevframeDefinition` as a dock.
1616
- The built-in `hub:commands:execute` RPC dispatches any registered server command, regardless of how the host was constructed.
1717
- The browser-side `connectDevframe({ baseURL: '/__hub/' })` discovers the WS endpoint via the Next route handler at `/__hub/__connection.json`, which starts the singleton host on demand.
@@ -22,11 +22,15 @@ Package: `minimal-next-devframe-hub` · framework: **React (Next.js)**
2222

2323
```sh
2424
pnpm install
25-
pnpm --filter minimal-next-devframe-hub dev
25+
pnpm --filter next-devframe-hub dev
2626
```
2727

2828
Open the printed URL to see the docks, commands, messages, and terminals lists, plus a button that dispatches a sample command through `hub:commands:execute`.
2929

30+
## See also
31+
32+
- [Next Helper](/helpers/next) — the `@devframes/next` host bridge this example runs on
33+
3034
## Source
3135

32-
[`examples/minimal-next-devframe-hub`](https://github.com/devframes/devframe/tree/main/examples/minimal-next-devframe-hub)
36+
[`examples/next-devframe-hub`](https://github.com/devframes/devframe/tree/main/examples/next-devframe-hub)

docs/examples/streaming-chat.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Package: `streaming-chat-example` · framework: **Preact + Vite**
1010

1111
## What it shows
1212

13-
- A scoped context (`ctx.scope('devframe-streaming-chat')`) auto-namespaces every id.
13+
- A scoped context (`ctx.scope('example:streaming-chat')`) auto-namespaces every id.
1414
- `my.rpc.streaming.create('tokens', …)` registers a streaming channel for low-latency token rendering.
1515
- `my.rpc.sharedState('history', …)` keeps the message log on the server; each `send` appends a user + assistant pair atomically.
1616
- The producer streams tokens live, then commits the joined content back to shared state when done — so refreshes and new clients see the finished message immediately.

docs/examples/minimal-vite-devframe-hub.md renamed to docs/examples/vite-devframe-hub.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
outline: deep
33
---
44

5-
# minimal-vite-devframe-hub
5+
# vite-devframe-hub
66

77
A protocol-witness host: roughly 120 lines of Vite plugin code that wire [`@devframes/hub`](/guide/hub) into a Vite dev server. The browser UI is plain **vanilla TypeScript**, so nothing distracts from the hub protocol itself. Every framework's hub host follows the same shape.
88

9-
Package: `minimal-vite-devframe-hub` · framework: **Vanilla TypeScript (Vite)**
9+
Package: `vite-devframe-hub` · framework: **Vanilla TypeScript (Vite)**
1010

1111
## What it proves
1212

@@ -22,11 +22,11 @@ Package: `minimal-vite-devframe-hub` · framework: **Vanilla TypeScript (Vite)**
2222

2323
```sh
2424
pnpm install
25-
pnpm --filter minimal-vite-devframe-hub dev
25+
pnpm --filter vite-devframe-hub dev
2626
```
2727

2828
Open the printed URL to see the docks, commands, messages, and terminals lists the hub exposes, plus a button that dispatches a sample command through `hub:commands:execute`.
2929

3030
## Source
3131

32-
[`examples/minimal-vite-devframe-hub`](https://github.com/devframes/devframe/tree/main/examples/minimal-vite-devframe-hub)
32+
[`examples/vite-devframe-hub`](https://github.com/devframes/devframe/tree/main/examples/vite-devframe-hub)

docs/guide/client-context.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,4 +186,4 @@ state.domElements.iframe = iframeEl
186186
state.events.emit('dom:iframe:mounted', iframeEl)
187187
```
188188

189-
That announcement is what the adapter attaches to. Both minimal hubs wire this end to end — see the "Tabbed Tool" in [`examples/minimal-vite-devframe-hub`](https://github.com/devframes/devframe/tree/main/examples/minimal-vite-devframe-hub) and [`examples/minimal-next-devframe-hub`](https://github.com/devframes/devframe/tree/main/examples/minimal-next-devframe-hub), including the SPA's `postMessage` shim.
189+
That announcement is what the adapter attaches to. Both minimal hubs wire this end to end — see the "Tabbed Tool" in [`examples/vite-devframe-hub`](https://github.com/devframes/devframe/tree/main/examples/vite-devframe-hub) and [`examples/next-devframe-hub`](https://github.com/devframes/devframe/tree/main/examples/next-devframe-hub), including the SPA's `postMessage` shim.

docs/guide/hub.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Each mounted SPA is served at `/__<id>/` and references its assets relatively (`
152152
export default { skipTrailingSlashRedirect: true }
153153
```
154154

155-
[`examples/minimal-next-devframe-hub/`](https://github.com/devframes/devframe/tree/main/examples/minimal-next-devframe-hub) is a working Next.js App Router host that mounts the built-in plugins this way.
155+
[`examples/next-devframe-hub/`](https://github.com/devframes/devframe/tree/main/examples/next-devframe-hub) is a working Next.js App Router host that mounts the built-in plugins this way.
156156

157157
### Duplicate devframes
158158

@@ -260,8 +260,8 @@ The hub also ships a headless browser runtime, `createDevframeClientHost()` from
260260

261261
Two minimal, copyable hubs mount every built-in plugin (git, terminals, code-server, inspect, a11y) behind an icon dock — the same shape [vite-devtools](https://github.com/vitejs/devtools) wears as the full Vite viewer, shrunk to the smallest thing you can build your own viewer from:
262262

263-
- [`examples/minimal-vite-devframe-hub/`](https://github.com/devframes/devframe/tree/main/examples/minimal-vite-devframe-hub) — a ~120-line Vite plugin host with a vanilla DOM UI.
264-
- [`examples/minimal-next-devframe-hub/`](https://github.com/devframes/devframe/tree/main/examples/minimal-next-devframe-hub) — the same protocol hosted from a Next.js App Router app.
263+
- [`examples/vite-devframe-hub/`](https://github.com/devframes/devframe/tree/main/examples/vite-devframe-hub) — a ~120-line Vite plugin host with a vanilla DOM UI.
264+
- [`examples/next-devframe-hub/`](https://github.com/devframes/devframe/tree/main/examples/next-devframe-hub) — the same protocol hosted from a Next.js App Router app.
265265

266266
Both also mount a "Tabbed Tool" that demonstrates [shared-iframe soft navigation](./client-context#shared-iframe-soft-navigation) — one SPA whose tabs surface as separate docks sharing a single iframe.
267267

0 commit comments

Comments
 (0)