Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Bun 2 min read Release mediumAdept

Bun v0.2.1

Bun.serve() gains built-in server-side WebSocket support powered by uWebSockets, with a server.upgrade(req) call that handles the Sec-WebSocket-Key check automatically. RegExp lookbehind assertions, needed by packages like Discord.js, now work through a fallback Oniguruma engine: the transpiler rewrites such regex literals into Bun.OnigurumaRegExp until JavaScriptCore supports them natively. Smaller changes include a Date header on HTTP responses, performance.timeOrigin, DOMJIT bindings for ServerWebSocket send/publish methods, and fixes for an HTTP memory leak, a buffered-response memory aliasing bug and WebSocket client pong handling.

Assumes: JavaScript runtimesWebSocket protocol basics

Related posts

  • Bun v0.6.3

    Bun mediumAdept

    Bun v0.6.3 adds the node:vm module for running code in controlled JavaScript contexts and fixes node:tls and node:http so socket.io and mongodb authentication work. bun test gains test.todo(), toBeCloseTo(), per-test timeouts and lifecycle hooks via --preload. The release fixes several bundler race conditions and minifier bugs, plus two fetch() memory leaks caused by strongly held Promise<Response> references. It also includes a breaking change: ServerWebSocket.publish() now excludes the sender by default, and WebSockets can deliver binary messages as Node Buffers.

  • Bun v1.4.1

    Bun mediumAdept

    Bun v1.4.1 fixes 202 issues and ships runtime, install and bundler improvements. JavaScriptCore now discards JIT code after idle periods, sharply cutting RSS (Next.js SSR 222 MB to 142 MB), and Bun.serve gains HTTP/2 on the same port via ALPN with large throughput gains over node:http2. Buffer read/write methods are JIT-inlined (up to 9x faster), AsyncLocalStorage avoids per-await allocations, Bun.write streams response bodies to disk, and WebSocket gets pause/resume for TCP backpressure. fetch now verifies TLS against the URL hostname rather than the Host header, closing an insecure default. bun build tree-shakes through `export * as` and dynamic import(), shrinking zod bundles by about 79%.

  • Bun v0.8.1

    Bun mediumAdept

    Bun v0.8.1 adds unix domain socket support to Bun.serve() via a new `unix` option and fixes a 2.8x request-body throughput regression from v0.8.0 (about 38.6k to 110k req/s). The regression came from microtasks not being drained after reading request bodies, which became unbalanced once v0.8.0 started draining HTTP-server microtasks per request. Other fixes cover reporting native memory for Headers, Blob and fetch() to the garbage collector, runtime inlining of statically failing require() calls that broke napi packages, a 24-byte metadata header leaking into inline sourcemaps under --inspect, stale package.json scripts in the binary lockfile, and node:http proxy URLs.

  • Bun v0.7.0

    Bun mediumAdept

    Bun v0.7.0 focuses on Node.js compatibility: it can now run `vite dev` (experimentally, via `bun --bun` to override the node shebang), supports Web `Worker` threads with `postMessage` and `structuredClone()`, and implements `AsyncLocalStorage` from `node:async_hooks` as a step toward Next.js support. Other additions include a `--smol` flag that shrinks and slows growth of the JavaScriptCore heap for memory-constrained environments, `bun test --bail`, `Bun.readableStreamToFormData()`, `serialize`/`deserialize` in `bun:jsc`, WebSocket ping/pong with `nodebuffer` as the default binaryType, and many `node:tls` TLSSocket methods. Fixes include a Response memory leak that cut peak memory in a benchmark from 292 MB to 49 MB, base64url hash output matching Node.js, and module resolution ordering for dual CJS/ESM packages like graphql.

  • Bun v0.2.2

    Bun mediumAdept

    Bun v0.2.2 adds a TCP/TLS socket API for clients and servers. It defines callbacks once per server rather than per socket, and a TCP echo server runs 24% faster than in Node. The release also implements WebCrypto, which lets libraries such as jose run, along with fs.createReadStream and better Node.js stream support, Bun.peek for synchronously reading already-settled promises, and an official Homebrew tap. Bug fixes include a transpiler fix for default-plus-named imports of builtin modules, now rewritten to import.meta.require, and several segfault fixes.

The quest for software engineering knowledge.

Look:
Layout: