Changelog

oven-sh/bun · · 38 commits

Bun ships routing, FFI, and socket fixes

A big day: directory routes and compile assets land, FFI switches to engine-native, and several network edge cases get hardened.

Bun.serve gets directory tree routes (robobun0c88489)

Bun.serve() can now mount a whole directory at a wildcard route via { dir: "..." }, serving static files with path cleanup, cache headers, range support, and index/redirect handling. This turns Bun into a much more capable built-in static file server and adds a new public route type to the API.

--compile gains --asset for embedded directories (robobunfec68b1)

Standalone binaries can now embed files and directory trees under import.meta.dir, and the runtime exposes them through node:fs and Bun.file(). That removes a major limitation for apps that enumerate their own static assets at startup, including adapters that expect a real directory layout inside the compiled executable.

bun:ffi switches to engine-native FFI (Jarred-Sumner01b81aa)

Bun reimplements dlopen, linkSymbols, CFunction, and JSCallback on top of JavaScriptCore’s native FFI, with hot calls compiling down to direct native calls. That’s a major performance and compatibility shift for FFI-heavy apps, and it also trims Bun’s dependence on the older TinyCC-based path.

WebSocket client now fires upgrade and unexpected-response (9d7f85e)

The bundled ws client finally implements the 'upgrade' and 'unexpected-response' events instead of warning and stubbing them out. This unblocks frameworks and tooling that rely on those hooks to complete fetch/dispatch flows and handle proxy or handshake outcomes correctly.

DNS connect-path interleaving fixes IPv6 blackhole stalls (robobun6c04f4b)

Bun’s resolver now interleaves address families per RFC 8305 instead of letting one family monopolize parallel connection attempts. That fixes a class of bun install hangs on dual-stack networks with broken IPv6 and directly addresses several long-standing DNS/connectivity bugs.

HTTP and fetch edge cases are tightened up

Several commits harden request/response behavior around real-world aborts and connection teardown: macOS mid-upload aborts now send FIN instead of leaving peers stuck, non-2xx responses now honor Connection: close, and fetch() body errors now mark streams disturbed and surface network failures as TypeError.

Other misc changes