Skip to content

Commit 54e374d

Browse files
committed
docs(migration): cover @devframes/vite extraction + dev-spa/hub split
Document the 0.9 framework-adapter changes in the migration guide: the Vite bridge moving from `devframe/helpers/vite` to `@devframes/vite` (with `viteDevBridge` → `devframeVite`/`devframeVitePlugin`/ `devframeViteBridge` and the flattened bridge options), the `@devframes/nuxt` and `@devframes/next` `/dev-spa` split (and the throwing bare root), and the new `/hub` scope for mounting a hub inside a tool. This PR was created with the help of an agent.
1 parent 36cdc84 commit 54e374d

1 file changed

Lines changed: 91 additions & 0 deletions

File tree

‎docs/guide/migration-0.9.md‎

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ Every entry below has a drop-in replacement. At a glance:
3131
| `mountDevframe` | `ctx.install` |
3232
| `DEFAULT_CATEGORIES_ORDER` re-exports | `@devframes/hub/constants` |
3333

34+
**Framework adapters (`@devframes/vite` / `@devframes/nuxt` / `@devframes/next`)**
35+
36+
Each splits into two scoped subpaths — `.../dev-spa` (author one devframe's SPA) and `.../hub` (mount a whole `@devframes/hub`) — and the bare package root throws with a pointer to both.
37+
38+
| Removed / moved | Replacement |
39+
|---|---|
40+
| `devframe/helpers/vite` (`viteDevBridge`) | `@devframes/vite/dev-spa` (`devframeVite` / `devframeVitePlugin` / `devframeViteBridge`) |
41+
| `@devframes/nuxt` (bare module) | `@devframes/nuxt/dev-spa` |
42+
| `@devframes/next` root (`withDevframe`, `createDevframeNextHandler`) | `@devframes/next/dev-spa` |
43+
| `@devframes/next/client` | `@devframes/next/dev-spa/client` |
44+
| mount a hub inside a tool | `@devframes/{vite,nuxt,next}/hub` (+ `/hub/client`) |
45+
3446
## `devframe/adapters/cli` is removed
3547

3648
The CLI adapter was renamed to `cac` in 0.7. The `devframe/adapters/cli` entry - `createCli`, `CreateCliOptions`, and `CliHandle` - is now gone. Import from `devframe/adapters/cac` instead:
@@ -235,3 +247,82 @@ await ctx.install(myDevframe)
235247
// 0.9
236248
import { DEFAULT_CATEGORIES_ORDER } from '@devframes/hub/constants'
237249
```
250+
251+
## The Vite bridge moves to `@devframes/vite`
252+
253+
`devframe/helpers/vite` is now its own package, `@devframes/vite` — so it can depend on `vite` directly (its plugins are typed against Vite's real `Plugin` / `ViteDevServer`) while `devframe` core stays free of a Vite dependency. It also splits into two scoped subpaths, and the single `viteDevBridge` becomes three purpose-named plugins on `@devframes/vite/dev-spa`:
254+
255+
| 0.8.x | 0.9 |
256+
|---|---|
257+
| `import { viteDevBridge } from 'devframe/helpers/vite'` | `import { devframeVite } from '@devframes/vite/dev-spa'` |
258+
| `viteDevBridge(def)` (static mount) | `devframeVitePlugin(def)` |
259+
| `viteDevBridge(def, { devMiddleware: true })` (RPC bridge) | `devframeViteBridge(def)` |
260+
| `viteDevBridge(def, { devMiddleware: { port, host, flags } })` | `devframeViteBridge(def, { port, host, flags })` |
261+
262+
The `devMiddleware` boolean/object option is gone: `devframeVitePlugin` is always the static mount, `devframeViteBridge` is always the RPC bridge, and their bridge options are flattened to the top level (`port`, `host`, `flags`, `auth`, `mcp`). `devframeVite(def, { bridge })` is a convenience wrapper that picks between the two.
263+
264+
```ts
265+
// 0.8.x
266+
import { viteDevBridge } from 'devframe/helpers/vite'
267+
268+
export default defineConfig({
269+
plugins: [viteDevBridge(devframe, { devMiddleware: true })],
270+
})
271+
```
272+
273+
```ts
274+
// 0.9
275+
import { devframeViteBridge } from '@devframes/vite/dev-spa'
276+
277+
export default defineConfig({
278+
plugins: [devframeViteBridge(devframe)],
279+
})
280+
```
281+
282+
`@devframes/vite` (and `@devframes/nuxt` / `@devframes/next`) take `@devframes/hub` and `@devframes/hub-ui` as **optional** peers — only the `/hub` scope needs them. Install `vite` as a peer as before. See [`@devframes/vite`](/helpers/vite-bridge) for the full reference.
283+
284+
## `@devframes/nuxt` and `@devframes/next` split into `/dev-spa` and `/hub`
285+
286+
Both packages now serve their single-devframe surface from a `.../dev-spa` subpath, and the bare package root throws with a pointer to the two scopes.
287+
288+
Nuxt — register the module by its subpath:
289+
290+
```ts
291+
// 0.8.x [nuxt.config.ts]
292+
export default defineNuxtConfig({ modules: ['@devframes/nuxt'] })
293+
294+
// 0.9 [nuxt.config.ts]
295+
export default defineNuxtConfig({ modules: ['@devframes/nuxt/dev-spa'] })
296+
```
297+
298+
Next — the config/handler helpers and the React client move down a level:
299+
300+
| 0.8.x | 0.9 |
301+
|---|---|
302+
| `import { withDevframe } from '@devframes/next'` | `import { withDevframe } from '@devframes/next/dev-spa'` |
303+
| `import { createDevframeNextHandler } from '@devframes/next'` | `import { createDevframeNextHandler } from '@devframes/next/dev-spa'` |
304+
| `import { RpcProvider, useRpc } from '@devframes/next/client'` | `import { RpcProvider, useRpc } from '@devframes/next/dev-spa/client'` |
305+
306+
## Mounting a hub: the new `/hub` scope
307+
308+
Standing up a whole `@devframes/hub` (many integrations) inside a tool now has a first-class home instead of hand-rolled `initHub` glue: `@devframes/vite/hub`, `@devframes/nuxt/hub`, and `@devframes/next/hub`. Each wraps `initHub`, defaults the UI slot to `@devframes/hub-ui`'s `createUi()` (override with `ui`, or `ui: false` for a headless hub you drive with the matching `/hub/client` helper), and mounts everything under one namespace.
309+
310+
```ts
311+
// Vite
312+
import { viteDevframeHub } from '@devframes/vite/hub'
313+
314+
export default defineConfig({ plugins: [viteDevframeHub({ devframes: [] })] })
315+
```
316+
317+
```ts
318+
// Next — app/__devframes/[[...path]]/route.ts
319+
import { nextDevframeHub } from '@devframes/next/hub'
320+
321+
export const runtime = 'nodejs'
322+
const hub = nextDevframeHub({ devframes: [] })
323+
export const GET = (req: Request) => hub.handler(req)
324+
export const POST = (req: Request) => hub.handler(req)
325+
export const DELETE = (req: Request) => hub.handler(req)
326+
```
327+
328+
Vite and Nuxt already have native hub viewers, so `@devframes/vite/hub` and `@devframes/nuxt/hub` print a one-time recommendation to prefer [Vite DevTools](https://devtools.vite.dev) / [Nuxt DevTools](https://devtools.nuxt.com) (silence with `{ quiet: true }`); `@devframes/next/hub` has no native counterpart and stays quiet. See [`@devframes/vite`](/helpers/vite-bridge#mounting-a-hub), [`@devframes/nuxt`](/helpers/nuxt#mounting-a-hub), and [`@devframes/next`](/helpers/next#mounting-a-hub).

0 commit comments

Comments
 (0)