Bun v1.0.11

Jarred Sumner ยท November 8, 2023

Bun v1.0.11 fixes 5 bugs, adds Bun.semver, fixes a bug in bun install and fixes bugs impacting astro and @google-cloud/storage

Bun is an incredibly fast JavaScript runtime, bundler, transpiler, and package manager โ€” all in one. In case you missed it, here are some of the recent changes to Bun:

  • v1.0.0 - First stable release!
  • v1.0.1 - Named imports for .json and .toml files, fixes to bun install, node:path, and Buffer
  • v1.0.2 - Make --watch faster and lots of bug fixes
  • v1.0.3 - emitDecoratorMetadata and Nest.js support, fixes for private registries and more
  • v1.0.4 - server.requestIP, virtual modules in runtime plugins, and more
  • v1.0.5 - Fixed memory leak with fetch(), KeyObject support in node:crypto module, expect().toEqualIgnoringWhitespace in bun:test, and more
  • v1.0.6 - Fixes 3 bugs (addressing 85 ๐Ÿ‘ reactions), implements overrides & resolutions in package.json, and fixes regression impacting Docker usage with Bun
  • v1.0.7 - Fixes 59 bugs (addressing 78 ๐Ÿ‘ reactions), implements optional peer dependencies in bun install, and makes improvements to Node.js compatibility.
  • v1.0.8 - Fixes 138 bugs (addressing 257 ๐Ÿ‘ reactions), makes require() use 30% less memory, adds module mocking to bun test, fixes more bun install bugs
  • v1.0.9 - Fixes a glibc symbol version error, illegal instruction error, a Bun.spawn bug, an edgecase with peer dependency installs, and a JSX transpiler bugfix
  • v1.0.10 - Fixes 14 bugs (addressing 102 ๐Ÿ‘ reactions), node:http gets 14% faster, stability improvements to Bun for Linux ARM64, bun install bugfix, and node:http bugfixes

To install Bun:

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

To upgrade Bun:

bun upgrade

Bun.semver is a fast builtin SemVer parser

bun install's fast node-semver compatible parser is now available as a builtin Bun API: Bun.semver.

import { semver } from "bun";

semver.satisfies("1.0.0", "^1.0.0"); // true
semver.satisfies("1.0.0", "^2.0.0"); // false

const versions = ["2.1.0", "1.0.0", "1.0.1", "1.1.0", "2.0.0", "2.0.1"];
versions.sort(semver.compare); // ["1.0.0", "1.0.1", "1.1.0", "2.0.0", "2.0.1", "2.1.0"]

It's 20x faster than node-semver, and passes node-semver's test suite.

Fixed: Semver sorting bug with build tags

Previously, Bun was sorting semver versions incorrectly when build tags with multiple segments containing the . character were present. This has been fixed, thanks to @dylan-conway.

Fixed: = and v prefix in package.json versions

Previously, Bun only supported = and v prefixes in dependency versions, but not in package.json versions. This has been fixed, thanks to @dylan-conway.

Fixed: potential crash when printing exceptions

A crash that has been present since before Bun v0.1.0 has been fixed. When displaying the preview of the source code that caused an exception, sometimes Bun would crash. This has been fixed.

Fixed: TLS handshaking error-handling issue

A bug in Bun.serve that could cause Bun to eventually no longer respond to incoming requests with client-side certificates has been fixed, thanks to @cirospaciari.

A bug impacting @google-cloud/storage has been fixed

A Node.js compatibilty bug caused @google-cloud/storage to not work as expected.

With DEBUG="*", it would print a message like this:

  retry-request Current retry attempt: 1 +0ms
  retry-request Next retry delay: 2351 +221ms
  retry-request Current retry attempt: 2 +2s
  retry-request Next retry delay: 4143 +150ms
  retry-request Current retry attempt: 3 +4s
  retry-request Next retry delay: 8135 +185ms
  retry-request Current retry attempt: 4 +8s
TypeError: undefined is not an object

This has been fixed. It no longer errors, and it no longer erroneously retries (which would cause it to take a long time to fail).

A bug impacting Astro has been fixed

A Node.js compatibility bug caused astro dev to return "file not found" errors when using Bun in v1.0.10. This has been fixed. We will soon add an integration test that runs Astro to prevent this from happening again.

Full changelog: bun-v1.0.10...bun-v1.0.11