Repository navigation
v0.6.2
Added
@tetsujs/core:serve(app, { stop: false })leaves the server running for the caller, andrequest.stop()stops it. A server started inbeforeAllneeds both: Bun runs anafterAllregistered inside a hook as soon as the hook returns, so the oneserve()registers stopped it before the first test (#72).- Every package's README links its page on the site, the same page as Markdown, and
llms-full.txt, the whole documentation in one file, and says that the type definitions document every option. The core's pointed atllms.txt, which is only the index (#75).
Fixed
@tetsujs/sse: a stream with a keep-alive — everysse()by default, astream()given one — sets its request's idle timeout to the interval and ten seconds more once it is read (#71). Bun closes a connection that sends nothing for 10 seconds by default, and a quiet feed was cut before its first heartbeat at 15. The stream's timeout replaces the server's even where that one is longer, or0, and one the handler set itself, such as theserver.timeout(req, 0)of Bun's own guide; a generator that wants another sets its own. A quiet feed now stays open, so one withoutuntilholds a stopping server for its whole grace period: end it ondraining. On a unix socket, where Bun ignores a request's timeout, the heartbeat has to stay under 8 seconds.@tetsujs/sse: aheartbeatMs, or a keep-alive'severyMs, that isNaN,Infinity, a negative, over 2³¹ − 1 or not a number at all is refused with aTypeErrorwhere the stream is made. Read as none, aNaNheartbeat — whatNumber()of an unset variable gives — let Bun close every quiet feed, andInfinitymade a timer beat every millisecond. A string, read from JSON say, used to pass as the number it spelled.@tetsujs/core: a serverserve()started says what stopped it — its ownafterAll,request.stop()orstopServers()— when a request, a client orrequest.urlreaches it afterwards. One started inbeforeAllfailed every request with a bareConnectionRefused.@tetsujs/core: intestCtx(),ctx.server.timeout()does nothing instead of throwing, since a unit test has no connection to time out. A handler that sets a timeout, or returns a stream with a keep-alive, can be called and read directly.@tetsujs/lifecycle,@tetsujs/sse: the examples ofstoppinganddrainingare written in the order an application can be: the route, then the server, thenonShutdownSignals(server), with the handler reading the signal when a request comes in. They took the signal from a server the routes had to exist before (#73).@tetsujs/sse:sse()sendsx-accel-buffering: no. nginx, which buffers a proxied response by default, held the events until its buffer filled or the stream ended, so a live feed behind it looked dead while the server was sending (#79).
Full Changelog: v0.6.1...v0.6.2