Bun v1.1.16 is here! This release fixes 41 bugs (addressing 221 👍). lcov code coverage reports in bun test, Install dependencies from private git repositories including Gitlab and Bitbucket.Buffer.from(string, "base64")
gets 6x - 30x faster on large input. Bug fixes tobun patch
,bun install
, N-APi addons, transpiler bugfixes and Node.js compatibility improvements.
We're hiringsystems engineers in San Francisco to build the future of JavaScript!
v1.1.14
fixes 63 bugs (addressing 519 👍). Patch node_modules withbun patch
. ORM-less object mapping inbun:sqlite
. Log allfetch()
calls as acurl
command. Node.js compatibility improvements. bun install bugfixes,bun:sqlite
bugfixes, Windows bugfixes. And more.v1.1.10
fixes 20 bugs. 2x faster uncached bun install on Windows.fetch()
uses up to 2.8x less memory. Several bugfixes to bun install, sourcemaps, Windows reliability improvements and Node.js compatibility improvementsv1.1.0
Bundows. Windows support is here!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
bun upgrade
When usingbun test --coverage
, coverage reports can be exported to the standard lcov format using--coverage-reporter lcov
buntest --coverage --coverage-reporter lcov
By default this outputs acoverage/lcov.info
file. The coverage directory can be changed with--coverage-dir
To always enable coverage reporting, two new options have been added tobunfig.toml
:
[test]# always enable coveragecoverage=true# newcoverageReporter= ["text","lcov"]# default ["text"]coverageDir="./path-to-folder"# default "coverage"
Thanks to@exoego for implementing this.
bun install now supports authenticating via ssh to install dependencies from private git repositories. These are cloned using your git SSH key viagit clone
.
bun i git@github.com:paperclover/secret-utilities.git
installed secret-utilities@git+ssh://git@github.com:paperclover/secret-utilities.git#5a7279074f22e98d64507cb5149633c73897395f1 package installed [904.00ms]
This makesbun install
easier to use when working with private repositories from Gitlab, Bitbucket, or other git hosting services. GitHub repositories were sometimes impacted by this issue, but less frequently.
Thanks to@Eckhardt-D for implementing this!
Buffer.from(string, "base64")
gets 6x-30x faster on large inputBy changing our base64 decoding implementation to usingsimdutf, usingBuffer.from(string, "base64")
is much faster, especially on large input:
In the next version of Bun
— Jarred Sumner (@jarredsumner)June 19, 2024
Buffer.from(str, "base64") gets 6x - 30x faster on large input, thanks to@lemire's simdutfpic.twitter.com/iFgI0Vv3sQ
bun build
To tell browser devtools where to find sourcemaps, tooling inserts a//# sourceMappingURL=
comment at the end of files.
Previously, Bun didn't expose a way to link to external, non-inline sourcemaps via this comment.
You can now use--sourcemap=linked
to tell Bun to insert a//# sourceMappingURL=
comment at the end of the bundled file, linking to the external sourcemap.
bun build src/app.tsx --outdir ./dist --sourcemap=linked --minify
This will produce the directorydist
withapp.js
andapp.js.map
, and the comment//# sourceMappingURL=app.js.map
to load the sourcemap for debugging.
Thanks to@paperclover for implementing this.
console.log
now prints non-indexed properties on arraysBun now shows prints non-indexed properties on arrays, for example:
const arr= ['a','b','c'];arr['five']=5;console.log(arr);
bun non-indexed-properties.ts
[ "a", "b", "c", five: 5 ]
error
event now includes amessage
When a WebSocket connection fails, the error event now includes amessage
property with a more detailed error message.
const ws=newWebSocket("ws://localhost:8080");ws.addEventListener("error", (error)=> { console.log(error.message);});// The message previously only was in the "close" event:ws.addEventListener("close", (close)=> { console.log(close);});
This prints the following error message:
WebSocket connection to'ws://localhost:8080/' failed: Failed to connect
Instead of only including relevant information in theclose
event, theerror
event on connection failure now includes amessage
property with an error message.
When a WebSocket fails to connect, it emits both theerror
andclose
events.
const ws=newWebSocket("ws://localhost:8080");ws.addEventListener("error", (error)=> {// Connection error emitted});ws.addEventListener("close", ()=> {// Connection did not fully open, but it is still closed});
Previously, printingconsole.log(error)
from a WebSocket connection error would sometimes cause a crash. The code incorrectly assumed that anErrorEvent
always contained a non-nullerror
. This has been fixed, and our test coverage has been improved to cover this edge case.
A bug affecting Bun Shell andbun run
when run in a directory with non-ascii characters has been fixed thanks to@dylan-conway.
An enum with non-ascii keys would get mangled. This has been fixed.
enumX { a, b, ç,}console.log(X);
An assertion failure would occur when using an experimental TypeScript decorator on an abstract property. This has been fixed, thanks to@forcefieldsovereign.
A crash that would occur when a file contained a Zero Width Joiner (ZWJ) or Zero Width Non-Joiner (ZWNJ) character inside of a property name has been fixed.
module.mock
An edge case with usingmodule.mock
on modules that previously failed to load causing a crash has been fixed thanks to@paperclover.
process.execArgv
process.execArgv
lets you return arguments passed to the Bun runtime, in comparison to the program arguments inprocess.argv
. In certain cases, non-runtime parameters were mistakenly included. Thanks to@paperclover for fixing this.
Before, installing the package@laihoe/demoparser2
would fail due to an optional dependency on a package that was never published to NPM. Bun now matchesnpm
's behavior by simply ignoring these missing packages, since they are declared as optional dependencies.
Thanks to@dylan-conway
module.exports
A bug where Bun incorrectly handled N-API modules that re-assignedmodule.exports
has been fixed.
Previously, Bun would ignore the return value of the module, causing the module to not be loaded correctly. This has been fixed, and Bun now correctly loads N-API modules that re-assignmodule.exports
. This waas most noticable whenmodule.exports
was assigned to a function.
Along the way, we've also fixed a potential crash when loading N-API modules that take a long time to initialize.
bun:sqlite
'schanges
field always 0 in statement.run()A bug in prepared statements causeddb.prepare(...).run(...)
to return 0 in certain cases instead of the number of changes from the statement.db.run(...)
was not affected.
bun patch
in workspace packagesBugs related tobun patch --commit
diffing files in nestednode_modules
directories causing patch failures have been fixed.
Thanks to@zackradisic
In#9965, Bun was upgraded to use the latest release of the Zig compiler. This makes Bun easier to contribute to, as there are a handful of language server, build system, and overall code quality improvements.
Bug fixes within the Zig standard library have fixed some bugs in Bun; most notably the Windowsfix for handling WTF-16 (a looser version of UTF-16) within paths and environment. This fixes some rare edge cases where the errorInvalidUTF8
was reported with very little context. Thanks to@squeek502.
One important build system improvement for the team and contributors is the ability to ensure that all platforms (Linux, Mac, and Windows) compile successfully without having to wait for CI to finish running. Contributors can now test-compile the code for all targets withbun run zig-check
in the Bun repository.