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
{{ message }}
Repository navigation
Commit 58d7c12
Browse filesBrowse the repository at this point in the historyBrowse files
fix: green up hub-hono-minimal typecheck and rewrite the 0.9 migration guide
The `unit-test / lint` CI job runs `pnpm typecheck`; `hub-hono-minimal` had a
latent, cache-masked failure (unresolved `Bun` global in the Bun entry and a
hono `ServerType` vs `node:http` `Server` mismatch). Type the Bun entry's slice
locally instead of pulling `@types/bun`, and narrow the hono server cast.
Revise `docs/guide/migration-0.9.md` end to end so it describes the final 0.9
surface: `startHttpAndWs` and `mountDevframe` are now documented as removed
(in favor of `createDevServer`/`initDevframe`/`initHub` and `ctx.install`), the
new opt-in `register` flag is covered, and the internals-move table reflects
`StartedServer` (not `startHttpAndWs`) relocating to `devframe/internal`.
A host that stands up its own server composes from `devframe/internal` — `createH3DevframeHost` for the node `DevframeHost`, `createContextRpcServer` + `devframe/rpc/transports/*` to bind a transport — plus `devframe/node`'s `createHostContext` and `devframe/node/hub-internals`. This is the path `@devframes/hub`'s `initHub` takes (in later releases `startHttpAndWs` was removed in favor of `initDevframe` / `initHub`). A custom host advertises itself with `registerDevframeInstance`, and a devtool enumerates running instances with `listLiveDevframeInstances`. Application code should prefer the adapters and `devframe/initiate`.
155
+
A host that stands up its own server composes from `devframe/internal` — `createH3DevframeHost` for the node `DevframeHost`, `createContextRpcServer` + `devframe/rpc/transports/*` to bind a transport — plus `devframe/node`'s `createHostContext` and `devframe/node/hub-internals`. This is the path `@devframes/hub`'s `initHub` takes. A custom host advertises itself with `registerDevframeInstance` (or the new `register` flag, below), and a devtool enumerates running instances with `listLiveDevframeInstances`. Application code should prefer the adapters and `devframe/initiate`.
156
+
157
+
## `startHttpAndWs` is removed
158
+
159
+
The low-level "listen on a port + attach the WS transport" primitive is gone. `createDevServer`, `initDevframe`, and `initHub` own that binding internally now, resolving the transport from their own `server` / `ws` options — so the common paths never touch it. `StartHttpAndWsOptions` is removed with it; `StartedServer` stays (it is still `createDevServer`'s return handle, re-exported from `devframe/internal`).
160
+
161
+
| 0.8.x | 0.9 |
162
+
|---|---|
163
+
|`startHttpAndWs({ context, port, ... })` for a standalone tool |`createDevServer(def, { port, ... })`|
A host that genuinely binds its own transport — a bare RPC socket, or a server it wires itself — composes the two public primitives `startHttpAndWs` used underneath: `createContextRpcServer` (`devframe/internal`) for the session/auth wiring, and a transport from `devframe/rpc/transports/*`.
167
+
168
+
```ts
169
+
// 0.9 — bind the RPC socket onto a server you own
## `@devframes/hub`'s `mountDevframe` is removed — use `ctx.install`
181
+
182
+
The free `mountDevframe(ctx, def, options)` function is replaced by an `install` method on the hub context. `MountDevframeOptions` is renamed `InstallDevframeOptions`. `initHub`'s declarative `devframes` list runs the same install path under the hood, so most hosts never call it directly.
183
+
184
+
| 0.8.x | 0.9 |
185
+
|---|---|
186
+
|`import { mountDevframe } from '@devframes/hub/node'`| removed — call `ctx.install`|
Calling `attach` / `handleUpgrade` on an instance that already owns a transport reports [`DF0055`](/errors/DF0055), and on the advertise-only `ws.url` tier [`DF0056`](/errors/DF0056).
187
236
237
+
## `initDevframe` / `initHub` can register themselves
238
+
239
+
An in-process host used to call `registerDevframeInstance` by hand to appear in the global instance registry (`~/.devframe/instances/`, read by `devframe connect` and the inspect plugin's Instances tab). Both factories now take an opt-in `register` flag that does it for them: a dynamic import that writes the record once the public origin resolves and removes it on `close()`. `createDevServer` registers this way automatically.
240
+
241
+
| 0.8.x | 0.9 |
242
+
|---|---|
243
+
| manual `registerDevframeInstance({ pid, port, origin, … })` + `unregister()` on every close path |`initHub({ base, register: true })` / `initDevframe(def, { base, register: true })`|
244
+
245
+
Pass an object to override individual record fields — `register: { id, name, rootDir }`. `registerDevframeInstance` / `listLiveDevframeInstances` remain on `devframe/internal` for hosts that drive the registry directly.
246
+
188
247
## The `key` option is removed; memoize on `globalThis`
189
248
190
249
`initDevframe` and `initHub` no longer memoize instances under a `key` (and the `DF0053` / `DF8001` replacement diagnostics are gone with it). A host that re-evaluates its modules in dev owns the memo, which makes the lifecycle visible at the call site:
@@ -227,3 +286,5 @@ Bun.serve({
227
286
```
228
287
229
288
`examples/hub-hono-minimal` ships this wiring in [`src/bun.ts`](https://github.com/devframes/devframe/blob/main/examples/hub-hono-minimal/src/bun.ts), next to the Node entry's `hub.attach(server)`.
0 commit comments