Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
Bot releases are hidden (Show)
Published by Jarred-Sumner over 1 year ago
Read Bun v0.6.4's release notes on Bun's blog
To install:
curl https://bun.sh/install | bash
# or you can use npm
# npm install -g bun
To upgrade:
bun upgrade
getHeader()
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/3007
tls
module by @cirospaciari in https://github.com/oven-sh/bun/pull/3012
Bun.connect()
types by @paperdave in https://github.com/oven-sh/bun/pull/3013
process.env.TZ
and Bun.env.TZ
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/3018
exports
can be printed as an identifier by @dylan-conway in https://github.com/oven-sh/bun/pull/3032
bun init
and document partial support for node:vm
by @paperdave in https://github.com/oven-sh/bun/pull/3014
bun test --timeout
by @Electroid in https://github.com/oven-sh/bun/pull/3040
require.cache
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/3045
jsxImportSource
, jsxFactory
, and jsxFragmentFactory
by @dylan-conway in https://github.com/oven-sh/bun/pull/3057
.env.test
, set NODE_ENV=test in bun test
, load .env.{test,production,development}.local
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/3037
with { type: "macro"}
in bun build
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/3059
.bin
linking by @alexlamsl in https://github.com/oven-sh/bun/pull/3067
Headers
& URLSearchParams
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/3081
expect().toBeEmpty()
by @Electroid in https://github.com/oven-sh/bun/pull/3060
Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.6.3...bun-v0.6.4
Published by Jarred-Sumner over 1 year ago
Read Bun v0.6.3's release notes on Bun's blog
To install:
curl https://bun.sh/install | bash
# or you can use npm
# npm install -g bun
To upgrade:
bun upgrade
expect.toBeCloseTo
by @blackmann in https://github.com/oven-sh/bun/pull/2870
node:vm
by @silversquirl in https://github.com/oven-sh/bun/pull/2785
node_allocator
for sourcemap joiner by @dylan-conway in https://github.com/oven-sh/bun/pull/2953
node-fetch
polyfill better by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/2962
--compile
tests by @paperdave in https://github.com/oven-sh/bun/pull/2901
bun:test
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/2969
test.todo
by @blackmann in https://github.com/oven-sh/bun/pull/2961
fetch(url)
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/2989
Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.6.2...bun-v0.6.3
Published by Jarred-Sumner over 1 year ago
This is a couple bugfixes to the bundler & minifier and performance improvements to JavaScript thanks to JavaScriptCore team members @Constellation and @shvaikalesh
Read Bun v0.6.2's release notes on Bun's blog
To install:
curl https://bun.sh/install | bash
# or you can use npm
# npm install -g bun
To upgrade:
bun upgrade
Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.6.1...bun-v0.6.2
Published by Jarred-Sumner over 1 year ago
This is a bugfix release for bun build --compile
Read Bun v0.6.0's release notes on Bun's blog
To install:
curl https://bun.sh/install | bash
# or you can use npm
# npm install -g bun
To upgrade:
bun upgrade
Published by Jarred-Sumner over 1 year ago
Read Bun v0.6.0's release notes on Bun's blog
To install:
curl https://bun.sh/install | bash
# or you can use npm
# npm install -g bun
To upgrade:
bun upgrade
import.meta.main
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/2556
deepEquals
with array holes and accessors by @dylan-conway in https://github.com/oven-sh/bun/pull/2557
bun test
with preload scripts by @jakeboone02 in https://github.com/oven-sh/bun/pull/2566
typecheck
by @colinhacks in https://github.com/oven-sh/bun/pull/2572
Subprocess
from Bun.spawn()
options by @paperdave in https://github.com/oven-sh/bun/pull/1501
Subprocess
from Bun.spawn()
options, part 2 by @paperdave in https://github.com/oven-sh/bun/pull/2573
toEqual
when the second array has extra array holes by @dylan-conway in https://github.com/oven-sh/bun/pull/2580
constants
from fs/promises
by @paperdave in https://github.com/oven-sh/bun/pull/2567
FileBlob
-> BunFile
, add BunFile.lastModified
by @colinhacks in https://github.com/oven-sh/bun/pull/2581
promises.readfile
by @privatenumber in https://github.com/oven-sh/bun/pull/2630
node:crypto
createHash
by @paperdave in https://github.com/oven-sh/bun/pull/2652
@jsx
, @jsxRuntime
, @jsxImportSource
, and @jsxFragment
pragmas by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/2655
.txt
files as strings by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/2660
with
keyword by @dylan-conway in https://github.com/oven-sh/bun/pull/2680
node:events
in javascript by @paperdave in https://github.com/oven-sh/bun/pull/2604
make setup
by @alexlamsl in https://github.com/oven-sh/bun/pull/2693
tsconfig.json
to bun-types
by @colinhacks in https://github.com/oven-sh/bun/pull/2587
typescript.md
by @colinhacks in https://github.com/oven-sh/bun/pull/2590
Bun.build
more reliable by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/2718
Bun.build
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/2720
bun add
on non-aliased dependency by @alexlamsl in https://github.com/oven-sh/bun/pull/2728
make setup
by @alexlamsl in https://github.com/oven-sh/bun/pull/2731
onResolve
plugins in Bun.build()
, support multiple onLoad and onResolve plugins by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/2739
file
loader in Bun.build
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/2745
super()
is not merged with adjacent statements by @dylan-conway in https://github.com/oven-sh/bun/pull/2757
naming
string by @colinhacks in https://github.com/oven-sh/bun/pull/2767
devDependencies
of local folders by @alexlamsl in https://github.com/oven-sh/bun/pull/2781
Bun.build()
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/2824
define
and loaders
by @paperdave in https://github.com/oven-sh/bun/pull/2805
wrapWithHasContainer
by @paperdave in https://github.com/oven-sh/bun/pull/2832
WebAssemblyInstance
and WebAssemblyGCObject
js types by @dylan-conway in https://github.com/oven-sh/bun/pull/2835
bun add
from root folder when call within workspaces by @alexlamsl in https://github.com/oven-sh/bun/pull/2841
describe.skip
by @blackmann in https://github.com/oven-sh/bun/pull/2836
Bun.build
return type by @paperdave in https://github.com/oven-sh/bun/pull/2833
initialOptions
by @paperdave in https://github.com/oven-sh/bun/pull/2861
root
bundle option by @dylan-conway in https://github.com/oven-sh/bun/pull/2859
req.url
set incorrectly by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/2881
debugId
suffix by @paperdave in https://github.com/oven-sh/bun/pull/2890
Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.5.9...bun-v0.6.0
Published by Jarred-Sumner over 1 year ago
Read Bun v0.5.9's release notes on Bun's blog
To install:
curl https://bun.sh/install | bash
# or you can use npm
# npm install -g bun
To upgrade:
bun upgrade
CONTRIBUTING.md
by @bnzone in https://github.com/oven-sh/bun/pull/2446
bun --watch
and bun test --watch
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/2500
make bindings
by @dylan-conway in https://github.com/oven-sh/bun/pull/2510
Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.5.8...bun-v0.5.9
Published by Jarred-Sumner over 1 year ago
Read Bun v0.5.8's release notes on Bun's blog
To install:
curl https://bun.sh/install | bash
# or you can use npm
# npm install -g bun
To upgrade:
bun upgrade
bun.copy()
over std.mem.copy()
by @alexlamsl in https://github.com/oven-sh/bun/pull/2152
compiler_rt
needed by @ThatOneBro in https://github.com/oven-sh/bun/pull/2159
os.cpus
for Darwin (OS X) by @jwhear in https://github.com/oven-sh/bun/pull/2115
compiler_rt
linking failure on x86_64
by @alexlamsl in https://github.com/oven-sh/bun/pull/2163
developing.md
by @charliermarsh in https://github.com/oven-sh/bun/pull/2166
modules.md
by @charliermarsh in https://github.com/oven-sh/bun/pull/2167
.serialize
typo by @Sheraff in https://github.com/oven-sh/bun/pull/2178
bun pm ls
by @alexlamsl in https://github.com/oven-sh/bun/pull/2192
node:http
compatibility by @ThatOneBro in https://github.com/oven-sh/bun/pull/2184
globalThis.reloadCount++;
to globalThis.count++;
by @cunzaizhuyi in https://github.com/oven-sh/bun/pull/2198
stdout
to file by @alexlamsl in https://github.com/oven-sh/bun/pull/2202
sqliteDb.run(' ')
throwing not an error
by @ThatOneBro in https://github.com/oven-sh/bun/pull/2226
preload
support (like node -r
except in a config file) by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/2231
-D
, --dev
flags for bun install by @jwhear in https://github.com/oven-sh/bun/pull/2240
URL
objs to http.request
(#2253) by @ThatOneBro in https://github.com/oven-sh/bun/pull/2258
http.request()
GET/HEAD w/ body by @ThatOneBro in https://github.com/oven-sh/bun/pull/2262
JSCInitialize
by @ThatOneBro in https://github.com/oven-sh/bun/pull/2265
Bun.sleepSync
to actually use milliseconds by @jwhear in https://github.com/oven-sh/bun/pull/2242
fs/promises
types. Migrate fs.test.js
to TypeScript. by @colinhacks in https://github.com/oven-sh/bun/pull/2279
node:http
by @colinhacks in https://github.com/oven-sh/bun/pull/2284
latest
tagged version if in range by @alexlamsl in https://github.com/oven-sh/bun/pull/2302
expect().toThrow(/pattern/)
by @alexlamsl in https://github.com/oven-sh/bun/pull/2314
Blob
error messages on Linux by @alexlamsl in https://github.com/oven-sh/bun/pull/2315
tty.WriteStream
methods to process.{stdout, stderr}
by @ThatOneBro in https://github.com/oven-sh/bun/pull/2320
bun test
on macOS in GitHub Actions by @alexlamsl in https://github.com/oven-sh/bun/pull/2322
crypto.scryptSync
by @dylan-conway in https://github.com/oven-sh/bun/pull/2331
Buffer
compatibility with Node.js by @alexlamsl in https://github.com/oven-sh/bun/pull/2341
bun test
after macOS builds by @alexlamsl in https://github.com/oven-sh/bun/pull/2343
Blob.prototype.type
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/2340
<Component />
by @bushuai in https://github.com/oven-sh/bun/pull/2347
StringPrototypeSlice
by @ThatOneBro in https://github.com/oven-sh/bun/pull/2352
require.resolve
with an empty options object #2370 by @paperdave in https://github.com/oven-sh/bun/pull/2371
toMatchSnapshot()
by @dylan-conway in https://github.com/oven-sh/bun/pull/2294
bun.lockb
by @alexlamsl in https://github.com/oven-sh/bun/pull/2397
Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.5.7...bun-v0.5.8
Published by Jarred-Sumner over 1 year ago
Read Bun v0.5.7's release notes on Bun's blog
To install:
curl https://bun.sh/install | bash
# or you can use npm
# npm install -g bun
To upgrade:
bun upgrade
peerDependencies
by @alexlamsl in https://github.com/oven-sh/bun/pull/2039
toUTF16Alloc
for bindgen by @ThatOneBro in https://github.com/oven-sh/bun/pull/2042
napi-fatal-exception
by @ThatOneBro in https://github.com/oven-sh/bun/pull/2054
git://github.com/
dependencies by @alexlamsl in https://github.com/oven-sh/bun/pull/2059
FormData
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/2051
napi_get_value_bigint_words
by @ThatOneBro in https://github.com/oven-sh/bun/pull/2061
fs.ReadStream
and fs.WriteStream
by @ThatOneBro in https://github.com/oven-sh/bun/pull/1798
package.json
validation by @alexlamsl in https://github.com/oven-sh/bun/pull/2074
.bin
scripts correctly by @alexlamsl in https://github.com/oven-sh/bun/pull/2076
machine
for Linux by @jwhear in https://github.com/oven-sh/bun/pull/2088
"workspaces"."packages": string[]
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/2086
bun add
of packages with capital letters by @alexlamsl in https://github.com/oven-sh/bun/pull/2095
bun.logger
instead of bun.Output
by @alexlamsl in https://github.com/oven-sh/bun/pull/2099
bun.lockb
s by @alexlamsl in https://github.com/oven-sh/bun/pull/2101
os.machine()
by @sno2 in https://github.com/oven-sh/bun/pull/1378
bunx --bun
to README
by @ThatOneBro in https://github.com/oven-sh/bun/pull/2114
git
dependencies by @alexlamsl in https://github.com/oven-sh/bun/pull/2124
undici.request
by @ThatOneBro in https://github.com/oven-sh/bun/pull/2136
bun link
by @alexlamsl in https://github.com/oven-sh/bun/pull/2147
Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.5.6...bun-v0.5.7
Published by Jarred-Sumner over 1 year ago
Read Bun v0.5.6's release notes on Bun's blog
This release is a follow up to Bun v0.5
To install:
curl https://bun.sh/install | bash
# or you can use npm
# npm install -g bun
To upgrade:
bun upgrade
latest
tagged version by default by @alexlamsl in https://github.com/oven-sh/bun/pull/2016
Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.5.5...bun-v0.5.6
Published by Jarred-Sumner over 1 year ago
Read Bun v0.5.5's release notes on Bun's blog
This release is a follow up to Bun v0.5
To install:
curl https://bun.sh/install | bash
# or you can use npm
# npm install -g bun
To upgrade:
bun upgrade
http.request
by @ThatOneBro in https://github.com/oven-sh/bun/pull/1959
Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.5.4...bun-v0.5.5
Published by Jarred-Sumner over 1 year ago
This fixes a couple bugs from Bun v0.5.2. Otherwise, it's the same as Bun v0.5.2
Read Bun v0.5.2's release notes on Bun's blog
This release is a follow up to Bun v0.5 and Bun v0.5.1
To install:
curl https://bun.sh/install | bash
# or you can use npm
# npm install -g bun
To upgrade:
bun upgrade
^
& ~
expressions correctly by @alexlamsl in https://github.com/oven-sh/bun/pull/1854
npm install bun
by @Electroid in https://github.com/oven-sh/bun/pull/1874
bun link
of scoped packages by @alexlamsl in https://github.com/oven-sh/bun/pull/1892
toSliceClone
by @dylan-conway in https://github.com/oven-sh/bun/pull/1917
bun add
package specifiers by @alexlamsl in https://github.com/oven-sh/bun/pull/1924
git+https://github.com/
as GitHub URLs by @alexlamsl in https://github.com/oven-sh/bun/pull/1926
bun run
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/1929
assert()
crash by @alexlamsl in https://github.com/oven-sh/bun/pull/1941
Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.5.1...bun-v0.5.2
Published by Jarred-Sumner over 1 year ago
This fixes a bug we missed in Bun v0.5.2. Otherwise, it's the same as Bun v0.5.2
Read Bun v0.5.2's release notes on Bun's blog
This release is a follow up to Bun v0.5 and Bun v0.5.1
To install:
curl https://bun.sh/install | bash
# or you can use npm
# npm install -g bun
To upgrade:
bun upgrade
^
& ~
expressions correctly by @alexlamsl in https://github.com/oven-sh/bun/pull/1854
npm install bun
by @Electroid in https://github.com/oven-sh/bun/pull/1874
bun link
of scoped packages by @alexlamsl in https://github.com/oven-sh/bun/pull/1892
toSliceClone
by @dylan-conway in https://github.com/oven-sh/bun/pull/1917
bun add
package specifiers by @alexlamsl in https://github.com/oven-sh/bun/pull/1924
git+https://github.com/
as GitHub URLs by @alexlamsl in https://github.com/oven-sh/bun/pull/1926
bun run
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/1929
assert()
crash by @alexlamsl in https://github.com/oven-sh/bun/pull/1941
Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.5.1...bun-v0.5.2
Published by Jarred-Sumner over 1 year ago
Read Bun v0.5.2's release notes on Bun's blog
This release is a follow up to Bun v0.5 and Bun v0.5.1
To install:
curl https://bun.sh/install | bash
# or you can use npm
# npm install -g bun
To upgrade:
bun upgrade
^
& ~
expressions correctly by @alexlamsl in https://github.com/oven-sh/bun/pull/1854
npm install bun
by @Electroid in https://github.com/oven-sh/bun/pull/1874
bun link
of scoped packages by @alexlamsl in https://github.com/oven-sh/bun/pull/1892
toSliceClone
by @dylan-conway in https://github.com/oven-sh/bun/pull/1917
bun add
package specifiers by @alexlamsl in https://github.com/oven-sh/bun/pull/1924
git+https://github.com/
as GitHub URLs by @alexlamsl in https://github.com/oven-sh/bun/pull/1926
bun run
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/1929
assert()
crash by @alexlamsl in https://github.com/oven-sh/bun/pull/1941
Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.5.1...bun-v0.5.2
Published by Jarred-Sumner over 1 year ago
This release is a follow up to Bun v0.5
To install:
curl https://bun.sh/install | bash
To upgrade:
bun upgrade
Read Bun v0.5.1's release notes on Bun's blog
bun-types
release by @colinhacks in https://github.com/oven-sh/bun/pull/1836
fs.rmdir
& friends by @alexlamsl in https://github.com/oven-sh/bun/pull/1838
Lockfile
tree cloning by @alexlamsl in https://github.com/oven-sh/bun/pull/1845
alias_map
correctly by @alexlamsl in https://github.com/oven-sh/bun/pull/1847
String.from()
by @alexlamsl in https://github.com/oven-sh/bun/pull/1850
super
before generated code by @dylan-conway in https://github.com/oven-sh/bun/pull/1856
Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.5.0...bun-v0.5.1
Published by Jarred-Sumner almost 2 years ago
To install:
curl https://bun.sh/install | bash
To upgrade:
bun upgrade
Read Bun v0.5.0's release notes on Bun's blog
auth-type
by @alexlamsl in https://github.com/oven-sh/bun/pull/1667
206 Partial Content
only for partial response by @alexlamsl in https://github.com/oven-sh/bun/pull/1670
Promise
handling by @alexlamsl in https://github.com/oven-sh/bun/pull/1697
net.Socket
by @alexlamsl in https://github.com/oven-sh/bun/pull/1701
resolve()
in test by @alexlamsl in https://github.com/oven-sh/bun/pull/1707
connectError
by @alexlamsl in https://github.com/oven-sh/bun/pull/1705
Readable
in some cases by @alexlamsl in https://github.com/oven-sh/bun/pull/1708
new Buffer
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/1717
expect().toThrow()
by @alexlamsl in https://github.com/oven-sh/bun/pull/1727
.toThrow()
compatibility with Jest by @alexlamsl in https://github.com/oven-sh/bun/pull/1728
onConnectError()
error propagation by @alexlamsl in https://github.com/oven-sh/bun/pull/1730
finalize()
by @alexlamsl in https://github.com/oven-sh/bun/pull/1731
strings.hasPrefixComptime()
by @alexlamsl in https://github.com/oven-sh/bun/pull/1755
browser
field when targeting Bun's runtime by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/1763
consume()
by @dylan-conway in https://github.com/oven-sh/bun/pull/1785
Server.reload()
by @alexlamsl in https://github.com/oven-sh/bun/pull/1801
readline
, tls
, net
by @colinhacks in https://github.com/oven-sh/bun/pull/1817
HTTPS_PROXY
, HTTP_PROXY
, and NO_PROXY
#1440 by @cirospaciari in https://github.com/oven-sh/bun/pull/1814
Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.4.0...bun-v0.5.0
Published by Jarred-Sumner almost 2 years ago
To install:
curl https://bun.sh/install | bash
To upgrade:
bun upgrade
Read Bun v0.4.0's release notes on Bun's blog
__require
collision from linking by @dylan-conway in https://github.com/oven-sh/bun/pull/1585
bun
command to Zsh by @colinhacks in https://github.com/oven-sh/bun/pull/1593
process.stdin.on()
correctly by @alexlamsl in https://github.com/oven-sh/bun/pull/1603
process.stdin
work under TTY by @alexlamsl in https://github.com/oven-sh/bun/pull/1611
bun pm ls
for printing lockfiles by @dylan-conway in https://github.com/oven-sh/bun/pull/1612
process.stdin
by @alexlamsl in https://github.com/oven-sh/bun/pull/1621
stdin.on("readable")
by @alexlamsl in https://github.com/oven-sh/bun/pull/1626
bunx
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/1634
bun install
dependency resolution by @alexlamsl in https://github.com/oven-sh/bun/pull/1643
Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.3.0...bun-v0.4.0
Published by Jarred-Sumner almost 2 years ago
Read Bun v0.3.0's release notes on Bun's blog
To install:
curl -fsSL https://bun.sh/install | bash
To upgrade:
bun upgrade
There were a lot of changes! Here's the complete list:
a9aa3e7
, 1cce9da
, 9090f06
process.release
- 901c4f5
RegExp
- 5398ed5
, #1537
, #1528
, 74e87b5
fs.stat()
- f9f169b
process.stdout
and process.stderr
from being closed - 8519ff0
Blob.size
to report Infinity
for non-files - d5c81b7
exitCode
from spawn()
- 30e1fe1
export = value
in TypeScript - 1cb5a73
spawn()
not being killed when parent process is killed - 1f174b9
port
was not a number - e5b2e3c
done
callback to support async functions in bun:test
- c00359a
process.nextTick()
- fd26d2e
, 2eb19a9
console.log(Request)
showing an empty url
- cb41d77
AbortSignal.timeout()
- fe4f39f
imports
in package.json - a3dc33c
f408749
process.env
- a6cadce
Response.arrayBuffer()
would return a Uint8Array
- de9a2b9
signalCode
for Bun.spawn()
- 0617896
Content-Range
header when serving a file - 0617896d
bin
when using bun link
- 0642cf3
console.log()
- c65c320
d68f44d
console.log()
with an emoji - 3cb462a
localhost
- d90a638
Request.url
not showing the value from the Host
header - da25733
HTMLRewriter
where text
was not properly cloned - a85826
, 904716f
WebSocket
open event - c52ebd9
-
before a pre-release identifier (e.g. 1.0.0beta
) - 5f5ef81
Bun.spawn()
and node:child_process
- #1496
write()
on Linux - a78b6f9
fs.rmdir()
- 92b7660
#1510
@
in the URL of fetch()
- 6c01a11
/
in the URL of fetch()
- 4f22c39
console.log()
- b0c89ba
node:http.createServer()
- bf6b174
FileSink.ref()
and FileSink.unref()
- d1a4f4f
console.timeLog()
- f677919
fs.createWriteStream()
- #1433
#1445
bun:ffi
- 81033c5
threadsafe
using bun:ffi
- 006a2f3
WebCrypto
issues and crashes - #1448
, #1450
Bun.which()
not handling absolute paths - d6520cd
fetch()
- #1460
bun:test
- 370d9c
#1256
TextDecoder
20% faster for small inputs - 160466
os.EOL
- 8b0a3c7
Buffer.toString("base64")
sometimes being incorrect - af39313
bun install
- 2c4777
satisfies
- 565996
WebSocketServer.publish()
when invoked outside an event handler - 8753c48
#1502
bun:sqlite
truncating numbers to int32 instead of int52 - ce6fc86
949d715
bun:sqlite
not properly handing latin1 characters - c65c320
fetch()
- 5854d39
fetch()
redirects loosing the port
- f8d9a8b
fetch()
response body - b230e7a
Published by Jarred-Sumner almost 2 years ago
To upgrade:
bun upgrade
To install:
curl https://bun.sh/install | bash
TLDR:
fs.createReadStream
works nowBun.peek
Bun now has support for TCP clients and servers. You can use it to implement database clients, game servers, or anything else that needs to use TCP instead of HTTP.
A TCP echo server runs 24% faster in Bun compared to Node:
This API is designed to be fast. Instead of promises or assigning callbacks for each socket, like the Node.js EventEmitter or the standard WebSocket API, callbacks are defined once for optimal performance and better code readability.
import { listen } from "bun";
listen({
hostname: "localhost",
port: 8080,
socket: {
open(socket) {},
data(socket, data) {
console.log(data instanceof Uint8Array); // true
},
drain(socket) {},
close(socket) {},
error(socket, error) {},
},
});
import { connect } from "bun";
connect({
hostname: "localhost",
port: 8080,
socket: {
data(socket, data) {
console.log("Received:", data);
},
},
});
There is also support for:
You can read more about TCP sockets in the README.
This API is very new and I imagine there are still some bugs to fix. Please file issues about any bugs you run into!
Bun has a special transform for importing builtin modules which converts them from asynchronous ESM imports into synchronous ESM import.meta.require
. A transpiler bug when default
was imported in these builtin Bun modules along with other named imports caused a runtime error:
// this code would break
import fs, {writeFileSync} from 'fs';
// but this code worked
import * as fs from 'fs';
The bug was due to how Bun's transpiler rewrote those imports. In this case, default
is equivalent to the namespace object (only for these builtin modules which may not actually point to JavaScript source code)
Now, Bun transpiles the above into:
var fs = import.meta.require("node:fs");
// note: live bindings are not preserved
var {writeFileSync} = fs;
When an import fails to resolve at build time, Bun throws a ResolveError
. ResolveError
includes a position
object that exposes detailed line & column information about where the file was originally imported.
There was a bug where Bun would crash if you attempted to access the position
object when it came from an await import
which imported another file that failed to resolve
File A:
import { expect, it, describe } from "bun:test";
describe("ResolveError", () => {
it("position object does not segfault", async () => {
try {
await import("./file-b");
} catch (e) {
expect(Bun.inspect(e.position).length > 0).toBe(true);
}
});
});
file-b.js
:
import "./does-not-exist.js";
This bug has been fixed.
Error handling logic for new Response(Bun.file(fileDescriptorAsANumber))
when used with the HTTP server expected it to be used with file paths instead of file descriptor numbers, causing a crash. Thanks to @sno2 for the fix.
export default {
// This would crash due to incorrect error handling logic
fetch(req) { return new Response(Bun.file(123)); }
}
An edgecase involving hex-escaped RegExp literals with lookbehinds caused our Oniguruma polyfill from v0.2.1 to throw an error. This was fixed thanks to @dylan-conway
More bug fixes:
ReadableStream.prototype.tee
function did not work when used with "direct"
streams 360a007f160b6935140dc75003a503059ff23976error
handler in Bun.serve
@zhiyuang in https://github.com/oven-sh/bun/pull/1387
Bun.peek
Sometimes you have code that is async
, but you know it is not actually async
. The new peek
function will allow you to read a promise's result without await or .then, but only if the promise has already fulfilled or rejected.
import { peek } from "bun";
const promise = Promise.resolve("immediate");
const result = peek(promise); // no await!
console.log(result); // "immediate"
It is useful for performance-sensitive code where you want to reduce the number of extra microticks. It's an advanced API and you (probably) shouldn't use it unless you know what you're doing.
You can read more about peek
in the README.
In addition to new APIs, we continue to make progress towards Node.js compatibility. Bun now supports fs.createReadStream
and has generally improved support for Node.js streams.
import { createReadStream } from "node:fs";
// Reads the first 100 bytes of a file
const reader = createReadStream("example.txt", {
encoding: "utf-8",
start: 0,
end: 100,
});
reader.on("data", (chunk) => {
console.log(chunk);
});
The standard WebCrypto API is now implemented, thanks to the many contributors at WebKit.
WebCrypto is a low-level API, so we only recommend using it when you know a little more than a thing or two about cryptography. However, there are popular libraries that depend on WebCrypto that you can now use with Bun.
Here's an example using a package that depends on WebCrypto: jose
by @panva.
const jwt = await new jose.SignJWT({ 'urn:example:claim': true })
.setProtectedHeader({ alg: 'ES256' })
.setIssuedAt()
.setIssuer('urn:example:issuer')
.setAudience('urn:example:audience')
.setExpirationTime('2h')
.sign(privateKey)
console.log(jwt)
You can now install or upgrade Bun with our official Homebrew tap.
brew tap oven-sh/bun
brew install bun
You can also install a specific version.
brew install [email protected]
You can also upgrade with either brew
or bun
.
brew upgrade bun
bun upgrade # still works
$BUN_INSTALL
and $XDG_CACHE_HOME
to $HOME
. by @lgarron in https://github.com/oven-sh/bun/pull/1351
var
usages by @sno2 in https://github.com/oven-sh/bun/pull/1364
new Response(null)
from segfaulting by @sno2 in https://github.com/oven-sh/bun/pull/1383
Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.2.1...bun-v0.2.2
Published by Jarred-Sumner about 2 years ago
To upgrade:
bun upgrade
To install:
curl https://bun.sh/install | bash
Run the install script (you can run it multiple times):
curl https://bun.sh/install | bash
Bun.serve()
now has builtin support for websockets on the server
Bun.serve({
websocket: {
message(ws, message) {
ws.send(message);
},
},
fetch(req, server) {
// Upgrade to a ServerWebSocket if we can
// This automatically checks for the `Sec-WebSocket-Key` header
// meaning you don't have to check headers, you can just call `upgrade()`
if (server.upgrade(req))
// When upgrading, we return undefined since we don't want to send a Response
return;
return new Response("Regular HTTP response");
},
});
For more information about using websockets with Bun.serve()
, see the readme
For a chat room on Linux:
To reproduce this benchmark on your own computer, go here
Bun's server-side websockets are powered by uWebSockets.
To address #314, Bun now includes a fallback RegExp implementation that uses the Oniguruma regex engine. Thanks to @dylan-conway!
RegExp lookbehind assertions are used by popular npm packages like Discord.js
When a RegExp literal with a lookbehind is used inside Bun's runtime, Bun's transpiler now automatically replaces it with a Bun.OnigurumaRegExp
. This API isn't intended to be used outside of the transpiler and will be removed once JavaScriptCore lands native support.
When run inside Bun's JavaScript runtime, this input:
export default /\d+(?=%)/;
Transpiles to:
export default (new globalThis.Bun.OnigurumaRegExp("\\d+(?=%)"));
The RegExp polyfill is largely based on JavaScriptCore's own JSC::RegExp
bindings.
Date
header in HTTP responsesperformance.timeOrigin
has been implementedprocess.argv
was returning an empty array when bun started without arguments other than the script, like bun foo.js
(thanks to @dylan-conway for the fix)WebSocket
client would sometimes put the WebSocket
in an error state https://github.com/oven-sh/bun/commit/c6fe82018aeda88a3337a5355313de7db68ef827
WebSocket
client would not keep the process open - #1335WebSocket
implementation due to adding server-side WebSocketsServerWebSocket
object for publishText
, publishBinary
, sendText
and sendBinary
functions)Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.2.0...bun-v0.2.1
Published by Jarred-Sumner about 2 years ago
To upgrade:
bun upgrade
To install:
curl https://bun.sh/install | bash
Run the install script (you can run it multiple times):
curl https://bun.sh/install | bash
New:
bun --hot
brings hot reloading & zero-downtime restarts to Bun's JavaScript runtimeBun.spawn
and Bun.spawnSync
(process spawning API)Request.body
- incoming HTTP request body streaming with ReadableStream
Bun.serve
(HTTP server) and fetch()
(HTTP client)setTimeout
and setInterval
for better performance and reliabilityBun.serve
and anything using Response
objects"imports"
in package.json ("#foo"
imports) works now https://github.com/oven-sh/bun/commit/21770eb0f31a43b3d6127ab957e271d029d6bc1b
"bun:test"
gets ~300x faster when using http server, websockets, etc https://github.com/oven-sh/bun/commit/524e48a81dfc6106ffcdd07b6fd035000b03146c
Bun.file(path).writer()
new Blob(["hello world"])
is now 75x faster in Bun than Node - https://github.com/oven-sh/bun/commit/2c1926993bc4d94f9e7bc4d171217a707efd385c
Breaking:
bun run
and bun
CLI arguments parsing has been changed so that anything after bun run <file-or-script>
or bun <file>
is passed through verbatim. This fixes a number of bugs with CLI argument parsing in both bun as a runtime and when used as a package.json "scripts"
runner.# before, server.js wouldn't see the --port argument
bun run server.js --port 3000
process.version
now reports a fake Node.js version instead of Bun's version. This is for compatibility with many npm packages that check for Node.js version to enable/disable features. To get Bun's version, use Bun.version
or process.versions.bun
.
Bun.serve().hostname
should return the hostname instead of the origin. This is a breaking change because it affects how URLs may be printed if you were using this getter before. https://github.com/oven-sh/bun/commit/e15fb6b9b220510df049e782d4f2f6eb3150d069
bun --hot
: hot reloads on the serverbun --hot
lets you see code changes immediately, without restarting your server. Unlike popular file watchers like nodemon, bun --hot
preserves some of the state of your app, meaning in-flight HTTP requests don't get interrupted.
To use it with Bun's HTTP server (automatic):
server.ts
(vanilla JavaScript works too)
// The global object is preserved across code reloads
// You can use it to store state, for now until Bun implements import.meta.hot.
const reloadCount = globalThis.reloadCount || 0;
globalThis.reloadCount = reloadCount + 1;
export default {
fetch(req: Request) {
return new Response(`Code reloaded ${reloadCount} times`, {
headers: { "content-type": "text/plain" },
});
},
};
Then, run:
bun --hot server.ts
You can also use bun run
:
bun run --hot server.ts
For more information, see bun --hot
section in Bun's readme.
Bun.spawn
spawn processes in BunBun.spawn
efficiently spawns a new process in Bun.
import { spawn } from "bun";
const { stdout } = await spawn(["echo", "hello world"]);
console.log(
await new Response(
// stdout is a ReadableStream
stdout
).text()
); // "hello world"
Bun.spawn
is flexible. stdin
can be a Response
, Blob
, Request
, ArrayBuffer
, ArrayBufferView
, Bun.file
, "pipe"
or number
.
import { spawn } from "bun";
const { stdout } = spawn({
cmd: ["esbuild"],
// using fetch()
stdin: await fetch(
"https://raw.githubusercontent.com/oven-sh/bun/main/examples/hashing.js"
),
});
const text = await new Response(
// stdout is a ReadableStream here
stdout
).text();
console.log(text.slice(0, 128), "..."); // const input = "hel...
stdout
and stderr
return ReadableStream
s when "pipe"
is used.
ReadableStream
This fixes https://github.com/oven-sh/bun/issues/530
You can read Request
& Response
objects bodies as a ReadableStream now
ReadableStream
now supports async iteratorsThis works now:
const body = new Response(["hello"]).body;
const chunks = [];
for await (const chunk of body) {
chunks.push(chunk);
}
Previously, you had to call getReader()
like this:
const reader = body.getReader();
const chunks = [];
while (true) {
const { done, value } = await reader.read();
if (done) {
break;
}
chunks.push(value);
}
Bun.serve
now supports streaming request bodies. This is useful for large file uploads.
import { serve } from "bun";
serve({
async fetch(req) {
// body is a ReadableStream
const body: ReadableStream = req.body;
const id = `upload.${Date.now()}.txt`;
const writer = Bun.file(id).writer();
for await (const chunk of body) {
writer.write(chunk);
}
const wrote = await writer.close();
return Response.json({ wrote, id, type: req.headers.get("Content-Type") });
},
});
"imports"
support in package.json
This release adds support for the imports
field in package.json
Bun wasn't correctly reporting memory usage for Request
, Response
, and Blob
objects to JavaScriptCore, causing the garbage collector to be unaware of how much memory was really in use for http responses/requests.
An event loop bug in bun:test
caused the process the idle for awhile. Now bun's own http server tests run > 10x faster.
ReadableStream
bun:sqlite
Fix crash in Database.deserializeMore changes:
Bun.which(bin)
: find the path to a commandprocess
now extends EventEmitter
bun:test
output. now it includes "expect calls"bun:test
print test failures at the bottom - https://github.com/oven-sh/bun/commit/c57b32fa0cdeaf7f1490bd6af9c5248a92c71ea0
navigator.userAgent
and navigator.hardwareConcurrency
are now globalsrequire("tty").isatty
works nowrequire("fs").rm
works nowconsole.count
and console.countReset
- https://github.com/oven-sh/bun/commit/4060afb7c70dd3ba037bd23c813c22032e2dabe5fetch()
use 82% less memory (9.8 KB -> 1.8 KB)Bun.version
reports Bun's version numberBun.revision
reports the git commit SHA used at the time Bun was compiledbody
to Response
and Request
by @Jarred-Sumner in https://github.com/oven-sh/bun/pull/1255
Full Changelog: https://github.com/oven-sh/bun/compare/bun-v0.1.13...bun-v0.2.0