Bun

Bun v1.0.28


Jarred Sumner ยท February 19, 2024

Bun is an incredibly fast JavaScript runtime, bundler, transpiler, and package manager โ€” all in one.

This release fixes 6 bugs (addressing 26 ๐Ÿ‘ reactions). Fixes bugs impacting Prisma and Astro, node:events, node:readline, and node:http2. Fixes a bug in Bun Shell involving stdin redirection and fixes bugs in bun:test with test.each and describe.only.

Previous releases

  • v1.0.27 fixes 72 bugs (addressing 192 ๐Ÿ‘ reactions), Bun Shell supports throwing on non-zero exit codes, stream Response bodies using async generators, improves reliability of fetch(), http2 client, Bun.Glob fixes. Fixes a regression with bun --watch on Linux. Improves Node.js compatibility
  • v1.0.26 fixes 30 bugs (addressing 60 ๐Ÿ‘ reactions), adds support for multi-statement queries in bun:sqlite, makes bun --watch more reliable in longer-running sessions, Bun.FileSystemRouter now supports more than 64 routes, fixes a bug with expect().toStrictEqual(), fixes 2 bugs with error.stack, improves Node.js compatibility
  • v1.0.25 fixes 4 bugs, adds vm.createScript. Fixes a crash in fs.readFile, a crash in Bun.file().text(), a crash in IPC, and a transpiler bug involving loose equals

To install Bun:

curl
npm
brew
docker
curl
curl -fsSL https://bun.sh/install | bash
npm
npm install -g bun
brew
brew tap oven-sh/bun
brew install bun
docker
docker pull oven/bun
docker run --rm --init --ulimit memlock=-1:-1 oven/bun

To upgrade Bun:

bun upgrade

Fixed: Crash when using Prisma

A crash when using Prisma with multiple simultaneous N-API calls from different modules has been fixed. This crash would reproduce when using Prisma and @napi-rs/canvas in the same microtask tick.

This crash was caused by an incorrect implementation of napi_create_reference. Previously, we assumed that only one napi reference would be associated with an individual object created from napi, but that assumption was incorrect. This led to a crash when creating a napi reference for the same object multiple times.

Thanks to @camero2734 for fixing this.

Fixed: Astro v4.4 throwing an error

In Bun v1.0.27, we fixed a bug where Astro v4.4 would render empty pages โ€“ but our fix was incomplete. An error would occur when multiple pages were being rendered simultaneosly.

This occurred because we made an incorrect assumption. We assumed that the [Symbol.asyncIterator] function could be called in pull of the ReadableStream, but Astro expected it to be called immediately. This bug manifested when multiple pages were being rendered simultaneously.

Thanks to @paperdave for fixing this.

Fixed: describe.only + nested describe/test

Previously, the test my test here would not run in the following code:

describe.only("outer", () => {
  describe("inner", () => {
    test("my test here", () => {
      expect(1).toBe(1);
    });
  });
});

The bug was that describe.only was not propagating to nested non-describe.only blocks. This has been fixed.

Fixed: --only flag with test.each

Previously, the test.each block would run in the following code:

describe.only("outer", () => {});

test.each([1, 2, 3])("my test %d here should never run!", () => {
  expect(1).toBe(1);
});

This was a bug! test.each should not have run. This bug has been fixed.

node:readline & node:events.on bugfixes

Thanks to @yschroe, this release includes 3 bugfixes for node:readline and node:events.on:

  • Fixes a bug in events.on which causes events to be skipped
  • Fixes readline does not read all line when looping with iterator
  • Fixes readline module yields wrong and incomplete values with a bad performance

node:http2 bugfix

Previously, passing a header that can only be one value (like Authorization) via an array of one element (like ['Bearer token']) would throw an error in node:http2. This has been fixed. Now it only throws if truly multiple values are passed in.

This bug impacted Firebase & Firestore. There are still bugs blocking Firebase & Firestore from being usable in Bun, but this gets us closer.

Bun Shell stdin redirect bugfix

Bun Shell was not handling stdin redirection to file paths correctly. Thanks to @zackradisic for fixing this.

Windows is not ready yet

We are still working on Windows. There's a big PR we aim to merge on Wednesday, which will get us closer.

Thanks to 8 contributors!

Full Changelog