Skip to content

Latest commit

 

History

History
65 lines (53 loc) · 6.83 KB

File metadata and controls

65 lines (53 loc) · 6.83 KB

Node adapter API decisions for 0.5.0

The root now names its supported contracts explicitly: 16 → 13 entrypoint/name pairs (13 → 10 at the root, all three MCP contracts retained). No deprecated aliases remain. Package versions and dependency ranges remain on 0.4.x until the coordinated candidate is frozen; this document describes the intended 0.5 break.

Entrypoints

Export key Decision Consumer contract
. KEEP Node HTTP adapters and their configuration/lifecycle contracts.
./mcp KEEP Optional Node stdio transport, isolated from HTTP imports.
./package.json KEEP Tooling reads package identity and supported runtime/exports.

Complete named export inventory

Entrypoint Name Decision Reason or migration
root CLIENT_ADDRESS_HEADER KEEP Destroyer reads the adapter-written peer identity; applications need this key to distinguish the TCP peer from untrusted forwarded headers.
root createNodeHandler KEEP Vite integrates the fetch application with its existing Node/Connect listener.
root listen KEEP API-only and MCP examples own the HTTP server and its shutdown.
root serve KEEP CLI full-stack/SSR templates, examples and Destroyer serve assets plus application shutdown.
root NodeHandler KEEP Consumers type a Node/Connect handler, including its optional error callback.
root NodeHandlerOptions KEEP Integrators name the trusted URL/host configuration passed to createNodeHandler.
root ListenOptions KEEP Applications share typed binding, timeout, abort and WebSocket configuration.
root ListeningServer KEEP Applications name the listening handle returned by listen and use native HTTP lifecycle operations.
root ServeOptions KEEP Applications share typed static-asset and process-signal configuration for serve.
root ServedApplication KEEP Applications store the returned URL and idempotent application shutdown handle.
root normalizeClientAddress REMOVE Internal normalization of socket peers has no external imports. Read request.headers.get(CLIENT_ADDRESS_HEADER) for adapter-supplied identity; normalize unrelated addresses in their owning layer.
root ConnectNext REMOVE Redundant nested handler type with no consumers. Use NonNullable<Parameters<NodeHandler>[2]>.
root NodeWebSocketOptions REMOVE Redundant nested configuration with no consumers. Derive the object member of ListenOptions["websocket"] as shown below.
mcp connectMcpStdio KEEP The MCP example bridges a server to stdin/stdout without an HTTP listener.
mcp McpStdioOptions KEEP Embedders supply typed dependencies, streams, authentication, cancellation and framing bounds.
mcp McpStdioConnection KEEP Embedders own explicit close() and await closed independently of process exit.
type WebSocketOptions = Exclude<ListenOptions["websocket"], boolean | undefined>;

The nested names remain implementation declarations where needed, but are not importable package contracts. There is no deep-import replacement.

Consumer audit and migration

The release's TypeScript 6 compiler inventory and source searches cover sibling packages, CLI templates, examples, Destroyer, docs and tests. The three removed names have no external source imports; only Node's internal address tests use the normalizer directly. The authored website has no import of those names. Its 0.4 API snapshot still lists them and must be regenerated for the final candidate.

Node's own router tests and README now import createRouter from @askrjs/server/router; README response helpers come from @askrjs/server/http. The README's obsolete routes array has been replaced by an actual router. serve uses its private content-type parser for its HTML cache policy instead of probing the Server HTTP namespace for an implementation helper. Mixed-case media types with parameters are exercised by the packed real-HTTP check.

Package verification

npm run check includes a normal install of the actual tarball, exact export-key and declaration-name inventories, all three removed-import failures, fourteen private-path failures, strict TypeScript 6.0.2 and 7.0.2 checks with Node 24 types, and real HTTP/MCP requests. No forced peer installation is used. Both type replacements above are compiled in that installed consumer.