Bun

Bun v1.1.38


Jarred Sumner ยท November 29, 2024

We're hiring systems engineers in San Francisco to build the future of JavaScript!

This release fixes 7 bugs (addressing 14 ๐Ÿ‘), a debugger bug causing Bun to hang in VSCode terminal, a crash in postgres npm package, a TypeScript minification bug, console.log improvements, updated SQLite and c-ares, adds reusePort option to Bun.listen and node:net, fixes a bug in Bun.FileSystemRouter.reload(), fixes rare crash in fetch(), and fixes an assertion failure when re-assigning global modules in --print or --eval.

To install Bun

curl
npm
powershell
scoop
brew
docker
curl
curl -fsSL https://bun.sh/install | bash
npm
npm install -g bun
powershell
powershell -c "irm bun.sh/install.ps1|iex"
scoop
scoop install 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: Debugger causing Bun to hang in VSCode terminal

A regression introduced in Bun v1.1.37 caused older versions of Bun to hang when run from the VSCode terminal in certain cases. This has been fixed.

Fixed: Crash impacting postgres npm package

When using the postgres npm package, a crash could occur after upgrading from a TCP to a TLS socket when an application error occurred.

This has been fixed, thanks to @cirospaciari.

Fixed: allowHalfOpen & exclusive being set to true incorrectly

An arguments validation regression introduced in Bun v1.1.34 caused allowHalfOpen to be set to true when false was passed. This has been fixed, thanks to @cirospaciari.

This impacted node:net and Bun.listen.

console.log improvements

reusePort option in Bun.listen

The reusePort option has been added to Bun.listen and node:net. This is consistent with the behavior in Bun.serve.

Fixed: Bun.FileSystemRouter.reload() missing new directory contents

A cache invalidation issue caused reload() in Bun.FileSystemRouter to miss new directory contents. This has been fixed, thanks to @Kapsonfire-DE.

Fixed: Module resolution cache invalidation bug on Windows

A module resolution cache invalidation bug was causing incorrect behavior on Windows. This has been fixed, thanks to @Kapsonfire-DE.

Fixed: File descriptor limit exceeded on musl

When Bun used the prlimit libc function on musl to ask how many file descriptors Bun can open, musl often lied and said Bun could only open 1024 file descriptors or so.

Now, we don't trust the result of prlimit function to tell us when the number is relatively low, and attempt to ask for a number greater than the reported limit.

Updated SQLite from 3.45 -> 3.47

The version of SQLite bun:sqlite embeds on Linux and Windows has been updated from 3.45 to 3.47.

Release notes from the SQLite team can be found here:

In Bun's repo, we've also setup auto-updating of native dependencies like sqlite, libarchive, etc to minimize delays for future updates.

Fixed: Rare crash in fetch()

A difficult to trigger crash in fetch() has been fixed, thanks to @cirospaciari

Fixed: Re-assigning global modules in --print or --eval

When using --print or --eval, an assertion failure could occur when re-assigning global modules.

For example, the following code would trigger an assertion failure:

// like in node, --print and --eval make a number of modules available globally.
const fs = require("node:fs");

Fixed: TypeScript minification bug

The following code was minified incorrectly:

export class Foo {
  constructor(public name: string) {}
}

Before:

class o{c;constructor(c){this.name=c}}export{o as Foo};

After:

class o{name;constructor(c){this.name=c}}export{o as Foo};

We were incorrectly minifying the property name on the class instance, causing issues with Object.keys and other similar functions.

This has been fixed, thanks to @heimskr.

Thanks to 11 contributors!