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(handler)!: rename to initDevframe returning a DevframeInstance
The factory is named for the instance it initiates (define → init
pairing with defineDevframe), and the web-standard request handler is
reached as a property — initDevframe(def).handler — matching the
content.handler mounting model, so future capabilities extend the
instance object instead of overloading a handler-named factory.
- createHandler → initDevframe; CreateHandlerOptions → InitDevframeOptions
- DevframeHandler → DevframeInstance; fetch → handler
- diagnostics/docs updated (DF0053/DF0054 wording)
Copy file name to clipboardExpand all lines: docs/errors/DF0053.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,32 +2,32 @@
2
2
outline: deep
3
3
---
4
4
5
-
# DF0053: Memoized Handler Replaced
5
+
# DF0053: Memoized Instance Replaced
6
6
7
7
## Message
8
8
9
-
> createHandler("`{id}`") replaced the live handler memoized under key "`{key}`": its options changed since the previous call.
9
+
> initDevframe("`{id}`") replaced the live instance memoized under key "`{key}`": its options changed since the previous call.
10
10
11
11
## Cause
12
12
13
-
`createHandler` was called with a `key` that already maps to a live handler, but the option fingerprint differs from the memoized instance's. Dev servers that re-evaluate modules on the fly (Next.js, Nitro, SvelteKit HMR) re-run `createHandler` on every reload; the `key` memoization normally returns the live instance, but when the options genuinely changed the old instance — including its side-car WebSocket server — is closed and a fresh one starts.
13
+
`initDevframe` was called with a `key` that already maps to a live instance, but the option fingerprint differs from the memoized one's. Dev servers that re-evaluate modules on the fly (Next.js, Nitro, SvelteKit HMR) re-run `initDevframe` on every reload; the `key` memoization normally returns the live instance, but when the options genuinely changed the old instance — including its side-car WebSocket server — is closed and a fresh one starts.
This is informational when you edited the options on purpose — the replacement is the intended behavior. If it fires without an intentional change, make the options stable across reloads (module-level constants rather than values recomputed per evaluation), or give genuinely different handlers distinct keys.
29
+
This is informational when you edited the options on purpose — the replacement is the intended behavior. If it fires without an intentional change, make the options stable across reloads (module-level constants rather than values recomputed per evaluation), or give genuinely different instances distinct keys.
30
30
31
31
## Source
32
32
33
-
-[`packages/devframe/src/adapters/handler.ts`](https://github.com/devframes/devframe/blob/main/packages/devframe/src/adapters/handler.ts) — `createHandler` warns this before closing and replacing a memoized instance whose options fingerprint changed.
33
+
-[`packages/devframe/src/adapters/handler.ts`](https://github.com/devframes/devframe/blob/main/packages/devframe/src/adapters/handler.ts) — `initDevframe` warns this before closing and replacing a memoized instance whose options fingerprint changed.
Copy file name to clipboardExpand all lines: docs/errors/DF0054.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,32 +2,32 @@
2
2
outline: deep
3
3
---
4
4
5
-
# DF0054: connectionMeta() Before Handler Ready
5
+
# DF0054: connectionMeta() Before Instance Ready
6
6
7
7
## Message
8
8
9
-
> connectionMeta() was called before createHandler("`{id}`") finished initializing.
9
+
> connectionMeta() was called before initDevframe("`{id}`") finished initializing.
10
10
11
11
## Cause
12
12
13
-
`createHandler` is a synchronous factory that kicks off asynchronous initialization eagerly — running `def.setup`, binding the WebSocket tier, and mounting the routes. `connectionMeta()` describes the WebSocket binding, which only exists once that initialization completes; calling it earlier has nothing correct to return.
13
+
`initDevframe` is a synchronous factory that kicks off asynchronous initialization eagerly — running `def.setup`, binding the WebSocket tier, and mounting the routes. `connectionMeta()` describes the WebSocket binding, which only exists once that initialization completes; calling it earlier has nothing correct to return.
14
14
15
15
## Example
16
16
17
17
```ts
18
-
import { createHandler } from'devframe/handler'
18
+
import { initDevframe } from'devframe/handler'
19
19
20
-
consthandler=createHandler(def)
21
-
handler.connectionMeta() // ✗ throws DF0054 — init is still in flight
20
+
constdevtools=initDevframe(def)
21
+
devtools.connectionMeta() // ✗ throws DF0054 — init is still in flight
Await `handler.ready` (or any `handler.fetch` call — it awaits readiness internally) before reading `connectionMeta()`.
29
+
Await `instance.ready` (or any request through `instance.handler` — it awaits readiness internally) before reading `connectionMeta()`.
30
30
31
31
## Source
32
32
33
-
-[`packages/devframe/src/adapters/handler.ts`](https://github.com/devframes/devframe/blob/main/packages/devframe/src/adapters/handler.ts) — `createHandler`'s `connectionMeta()` throws this while initialization is still pending.
33
+
-[`packages/devframe/src/adapters/handler.ts`](https://github.com/devframes/devframe/blob/main/packages/devframe/src/adapters/handler.ts) — `initDevframe`'s `connectionMeta()` throws this while initialization is still pending.
0 commit comments