4.2 KiB
4.2 KiB
Changelog
All notable changes to @green-tea/core are documented here.
The format follows Keep a Changelog.
green-tea uses calendar versioning: YY.MM.PATCH.
Unreleased
Added
app.fetch(request): Promise<Response>— a Web-Standards handler so the same app runs HTTP and SSE on Deno/Bun/edge runtimes via the Fetch API (WebSocket and mesh remain Node-only).- Deno adapter (
@green-tea/core/deno):serveDeno(app)runs HTTP + SSE + WebSocket on Deno. app.upgrade(request, socket): neutral WebSocket entry point for non-Node runtimes, built on a sharedWsSocketcapability. WebSocket logic is now runtime-agnostic (src/http/ws-core.ts).
Changed
- App-scope providers now boot exactly once (memoized): a second
app.listen()call no longer re-runs provider factories or their side effects. WsOpenCtx.req(available in@Ws/@Ssehandlers) is now a neutralWsRequest({ url, headers, protocol, ip }) instead of the Nodehttp.IncomingMessage, so it works the same across Node and Deno. Node-only fields such asreq.socket/req.rawHeadersare no longer available onctx.req; usectx.protocol/ctx.ip/ctx.query/ctx.headersinstead — all still provided.
26.7.0-beta.0 - 2026-07-07
First public beta, published under the npm beta dist-tag. The API may still
change before the stable release.
Added
- Transport security — native TLS termination (https/wss), CORS with a
guarded preflight and credentials-safe origins, secure-by-default response
headers (nosniff, X-Frame-Options, Referrer-Policy, HSTS-when-secure), and
proxy-aware
trustProxyexposingctx.protocol/ctx.ip. - Input validation —
@body/@query/@param/@headersaccept any Standard Schema (zod / valibot / arktype); the parsed value is passed to the handler, invalid input returns422with per-field issues. Core stays dependency-free. - Body parsing — JSON and
application/x-www-form-urlencodedout of the box;multipart/form-datafile uploads (@body()→{ fields, files }) via the optionalbusboypeer dependency (a multipart request without it returns501), with a configurable repeated-field policy (bodyDuplicates, per-route overridable) and amaxPartsDoS bound. - Routing —
:name*catch-all params, specificity-based precedence (static ▸:param▸ catch-all, independent of registration order), and405 Method Not Allowedwith anAllowheader when a path exists under a different method. - Argument decorators —
@needs/@ctx/@param/@query/@body/@headers/@inbound/ @abort, plus@header('name')as a singular alias of@headers. - Streams — SSE / ndjson / WebSocket duplex over a multicast
AsyncIterablechannel, with backpressure and cleanup;roomsbroadcast hubs. - Graph introspection —
app.explain(route),app.graph(),app.toMermaid()/toDOT(), and an opt-inGET /__graph__dev endpoint. - Operational hardening — request body/size limits (
413), request and keep-alive timeouts, andapp.close()graceful shutdown (drains in-flight requests, closes live streams and mesh links). - Visible degradation — optional providers that fail at boot are
summarized on
listen()and queryable viaapp.degraded(), instead of a silent warning. - Testing ergonomics —
createApp({ overrides })swaps any provider/step by token in one line. - Mesh (alpha, walking skeleton) —
teapot/teacupdistributed dependency injection over a secret-gated WebSocket control channel. Gated behindexperimental: true;createAppthrows ifmeshis configured without it. - Packaging — dual ESM + CommonJS builds behind an
exportsmap, with matching type declarations; one runtime dependency (reflect-metadata),wsandbusboyoptional peers. - Benchmarks — reproducible
npm run benchharness vs Express 5, Fastify 5, NestJS, and rawhttp; results in BENCHMARKS.md.