Bun is an incredibly fast JavaScript runtime, bundler, transpiler, and package manager — all in one.
Bun v1.1.2 fixes 4 bugs (addressing 44 👍 reactions). EBUSY on Windows in vite dev, next dev, and saving bun.lockb has been fixed. Bun Shell gets support for seq, yes, basename and dirname. A TypeScript parsing edgecase has been fixed. A bug causing 'unreachable code' errors has been fixed. fs.watch on Windows has been rewritten to improve performance and reliability.
Previous releases
v1.1.1
Bun v1.1.1 fixes 20 bugs (addressing 60 👍 reactions). Add subshell and positional argument support. Printed source code in errors no longer fill up your terminal. Upgrades JavaScriptCore, which includes performance improvements to RegExp, typed arrays, String indexOf and String replace. Error objects and JIT'd function calls use less memory. Fixes several bugs with bun install on Windows. Fixes a bug with Bun.serve() on Windows. Fixes a TOML parser bug impacting escape sequences and windows paths in .toml files.v1.1.0
Bundows. Windows support is here! Plus, JSON IPC Node <-> Bun.
To install Bun:
curl -fsSL https://bun.sh/install | bash
npm install -g bun
powershell -c "irm bun.sh/install.ps1|iex"
scoop install 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
Windows support improvements
Fixed: EBUSY
when saving bun.lockb
When adding dependencies to bun.lockb
, sometimes bun install
on Windows would throw an EBUSY
error. This was caused by keeping file handles open for too long and not requesting the correct permissions.
Windows permissions continues to be complicated.
Fixed: ENOENT
and EEXIST
error when extracting tarballs to cache on Windows
Sometimes packages failed to install on Windows due to a race condition where extracting the tarball for an npm package would fail with ENOENT
or EEXIST
errors. This error was mostly caused by requesting the wrong permissions when opening the directory to the new tarball. We've made the code more error-tolerant and now it will request the correct permissions.
Fixed: EBUSY
when using next dev
or vite dev
on Windows
A regression in v1.1.0 caused next dev
and vite dev
to throw an EBUSY
error when running on Windows. The main cause was a permissions issue. We were keeping a file handle open for the watched directory when we didn't need to.
We've updated our integration tests to catch this bug in the future.
Along the way, we've rewritten how fs.watch
works on Windows. fs.watch
will auto-deduplicate fileystem paths so if multiple watchers watch the same path, it will only use the resources of one of them. This should make fs.watch
faster, more reilable, and use less memory.
Fixed: bun install
unable to install tarballs with invalid file paths
Windows doesn't support charaacters like ?
, <
, >
, and more in file paths. Sometimes, npm packages have these characters in their file paths of the tarballs they publish. Bun was not handling that correctly. Now, bun install
behaves the same as npm install
on Windows and successfully installs the package but inserts a replacement character.
Fixed: CouldntReadCurrentDirectory
error
Bun was asking for too many permissions in directories, which could cause CouldntReadCurrentDirectory
errors to throw for non-Administrator accounts on Windows.
Rewrote fs.watch
on Windows
We rewrote the implementation of fs.watch
on Windows to be more reliable and faster.
It now de-duplicates file paths being watched internally, which reduces resource usage when using things like fs.watch in a glob.
Shell & bun run improvements
Support for seq
, yes
, basename
, and dirname
in Bun Shell
The GNU Coreutils commands seq
, yes
, basename
, and dirname
are now supported in Bun Shell, thanks to @nektro.
import { $ } from "bun";
await $`seq 0 3`;
// 0
// 1
// 2
// 3
await $`basename $1`; // hello.js
await $`dirname $1`; // foo
Fixed: Parsing bugs with *
in environment variables
A few parsing bugs have been fixed with *
in environment variables, thanks to @zackradisic.
A bug that could cause bun install
to hang for awhile has been fixed.
Bun install improvements
install --production
without a lockfile
You can now use bun install --production
and bun install --frozen-lockfile
without a lockfile. This is helpful for CI environments where you might not have checked in your bun.lockb
to git
. There was no real reason why this was banned previously, so we just removed the ban.
Fixed: Potential crash when downloading tarballs
A bug that could cause bun install
to crash when downloading tarballs has been fixed. This sometimes caused an "Unreachable code reached" error in Bun for Windows.
WebKit upgrade
We've upgraded WebKit yet again! And the incredible @Constellation & JSC team brings us new performance improvements and bug fixes.
5x faster { ...obj }
clone
In microbenchmarks, code like the following now runs 5x faster:
{ ...obj }
This optimization is specific to an empty object literal with a single ...
spread operator on another object.
❯ bun splat.mjs
cpu: Apple M1 Max
runtime: bun 1.1.2 (arm64-darwin)
benchmark time (avg) (min … max) p75 p99 p995
-------------------------------------------------- -----------------------------
{ ...obj } 20.33 ns/iter (18.38 ns … 92.75 ns) 20.08 ns 49.05 ns 53.68 ns
❯ bun-1.1.0 splat.mjs
cpu: Apple M1 Max
runtime: bun 1.1.0 (arm64-darwin)
benchmark time (avg) (min … max) p75 p99 p995
-------------------------------------------------- -----------------------------
{ ...obj } 105.38 ns/iter (100.83 ns … 188.37 ns) 103.29 ns 146.97 ns 149.57 ns
import { bench, run } from "mitata";
const obj = {
a: 1,
b: 2,
c: 3,
d: 4,
e: 5,
f: 6,
g: 7,
h: 8,
i: 9,
};
bench("{ ...obj }", () => {
return { ...obj };
});
await run();
Parser improvements
Fixed: TypeScript parsing edgecase
A bug caused Bun's parser to fail to parse the following TypeScript code:
var bar: Bar extends string | infer Bar extends string ? Bar : never;
var bar: Bar extends string & infer Bar extends string ? Bar : never;
This bug has been fixed, thanks to @dylan-conway.