Bun bun-v0.0.68stable Released Jan 23, 2022
Impact Score: 5/10

bun v0.0.68

Source available โ€” automated, not human-reviewed

Component: bun ยท Channel: stable. Automated analysis, not a compatibility certification. How this works.

Analysis updated: 2026-11-01.

Compatibility not verified โ€” check source notes
๐Ÿ“„ .MD
โšก Executive Summary (TL;DR)

Bun bun-v0.0.68. Source highlight: This release is mostly focused on bun.js, bun's JavaScript runtime environment. Fixes to `bun install` will be part of the next release, but the infrastructure work from this release will help with `bun install` in the next release.

Who Does This Impact? (Role-Based Analysis)

๐Ÿ’ป Software Engineers & Devs

Check the source notes against the package and APIs you use before upgrading.

๐Ÿ“Š Product & Engineering Leads

Use the documented changes to assess relevance to your product; release frequency alone is not a quality measure.

โš™๏ธ DevOps & Security

Verify the target version, runtime requirements and rollback procedure in the official documentation.

๐Ÿ”ง Bug Fixes & Patches (3)

  • If bun exits due to running out of file descriptors, bun will print some platform-specific instructions explaining how to fix it.
  • Fixed a couple regressions that caused bun to start up slower, now it's back to about 3.5ms on macOS aarch64 and 0.5ms on linux amd64
  • Fixed a bug in the upgrade checker that would sometimes cause bun to crash, typically after about 30 seconds
๐Ÿ“„ View Raw Release Notes (Original Developer Log)
To upgrade: ```bash bun upgrade ``` # bun v0.0.68 This release is mostly focused on bun.js, bun's JavaScript runtime environment. Fixes to `bun install` will be part of the next release, but the infrastructure work from this release will help with `bun install` in the next release. TLDR: - `Bun.Transpiler` lets you run Bun's JS/TSX transpiler programmatically from bun.js - bun.js natively implements Node.js' fs module (sync functions), and its fast - bun.js has more support for the Node.js `process` object ### `Bun.Transpiler` - API access to Bun ```js const bun = new Bun.Transpiler({ loader: "tsx", // set default loader }); // logs transpiled code without resolving imports console.log(bun.transformSync("export default <div />")); // return list of imports & exports without resolving imports or printing code const { imports, exports } = bun.scan(` import { Component } from "react"; export const foo: boolean = true; `); console.log({ exports, imports }); ``` `Bun.Transpiler` exposes part of Bun's JavaScript & TypeScript transpiler from native code to JavaScript, and it's fast. End-to-end, transpiling [this JSX file](https://github.com/Jarred-Sumner/bun/blob/main/src/test/fixtures/simple.jsx) inside JavaScript via `Bun.Transpiler` runs: - 8x faster than swc - 15x faster than esbuild - 40x faster than babel ![image](https://user-images.githubusercontent.com/709451/150664970-fde3f2c7-cdcc-4856-a445-4e44e52f8034.png) [See benchmark code](https://github.com/Jarred-Sumner/bun/blob/main/bench/snippets/transpiler.mjs) `Bun.Transpiler` supports JavaScript plugins with AST access via macros. Macros are not entirely done yet, but simple ones work. There will be docs on this. `Bun.Transpiler` is builtin to bun.js, there's nothing extra to import or install. Eventually there will be a WASM build for some of this, but not sure when However, a transpiler API is not very useful without a way to read/write files to disk. ## Node.js `fs` module implementation ```ts // This works in bun.js now import {readFileSync} from 'fs'; // require("fs") also works in both .mjs files and .js/.cjs files require("fs").writeFileSync("foo.txt", "bar!") // you can also use the node: namespace if you want import {readlinkSync} from 'node:fs'; ``` You can now use most of the sync functions from [Node.js' `fs` module](https://nodejs.org/api/fs.html) inside bun.js. These are implemented from scratch in Zig & exposed to JS. `Buffer` & streams are not implemented yet, but you can pass a `Uint8Array` or `ArrayBuffer` where Node accepts a `Buffer`. The async versions of the functions will come in a future release (this already was a lot of stuff for one release), but generally sync outperforms async for local file access. `fs.realpathSync` is about 7x faster in bun.js (50,000 iterations) ![image](https://user-images.githubusercontent.com/709451/150666667-e94b5cd1-754f-467c-a2b2-4e501714df21.png) `fs.existsSync` runs about 30% faster in bun.js (100,000 iterations) ![image](https://user-images.githubusercontent.com/709451/150666351-7bcce5bb-0d55-45a9-ab2f-d0d00a9718b6.png) The following functions are implemented: - `fs.accessSync` - `fs.appendFileSync` - `fs.chmodSync` - `fs.chownSync` - `fs.closeSync` - `fs.copyFileSync` - `fs.existsSync` - `fs.fchmodSync` - `fs.fchownSync` - `fs.fstatSync` - `fs.fsyncSync` - `fs.ftruncateSync` - `fs.futimesSync` - `fs.lchmodSync` - `fs.lchownSync` - `fs.linkSync` - `fs.lstatSync` - `fs.lutimesSync` - `fs.mkdirSync` - `fs.openSync` - `fs.readdirSync` - `fs.readFileSync` - `fs.readlinkSync` - `fs.readSync` - `fs.realpathSync` - `fs.renameSync` - `fs.statSync` - `fs.symlinkSync` - `fs.truncateSync` - `fs.unlinkSync` - `fs.utimesSync` - `fs.writeFileSync` - `fs.writeSync` Bun also includes an implementation of Node's [`SystemError`](https://nodejs.org/api/errors.html#class-systemerror) with pretty printing. Note that since source maps are not implemented yet, sometimes the line:column will be off by a little. ![image](https://user-images.githubusercontent.com/709451/150667445-6292d1bb-cecf-48b1-9594-10f1c94305ca.png) This is what the same error looks like in Node ![image](https://user-images.githubusercontent.com/709451/150667464-bf975b13-a02e-4725-9c93-ac829e27ac5a.png) ### Node.js `process` object bun.js has more support for the `process` object from Node.js. ```js // These work now in bun.js process.chdir("insert-dir-name-here"); process.cwd(); // arguments used to launch, excluding "run" if via "bun run" for compatibility with npm packages process.argv; // current process id process.pid; // parent process pid process.ppid; // returns bun's version process.version process.versions { // fake version for compatibility with npm packages potentially looking this up "node": "17.0.0", "modules": "67", // bun version "bun": "0.0.68", // git shas/tag of bun dependencies "webkit": "96e77eccfde8dc9c207520d8ced856d8bdb8d386", "mimalloc": "f412df7a2b64421e1f1d61fde6055a6ea288e8f5", "libarchive": "dc321febde83dd0f31158e1be61a7aedda65e7a2", "picohttpparser": "066d2b1e9ab820703db0837a7255d92d30f0c9f5", "boringssl": "b3ed071ecc4efb77afd0a025ea1078da19578bfd", "zlib": "959b4ea305821e753385e873ec4edfaa9a5d49b7", "zig": "0.10.0-dev.315+4d05f2ae5" } // process.nextTick() is now implemented (currently only supports up to 4 arguments) process.nextTick(() => console.log("second")); console.log("first"); ``` ## More stuff `import.meta` in bun.js returns an object with `file` and `dir` ```js const { // import.meta.dir returns absolute path to the directory the script is in. sort of like __dirname dir, // import.meta.file returns absolute path to the script file, } = import.meta; ``` - [`queueMicrotask`](https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask) is implemented - If bun exits due to running out of file descriptors, bun will print some platform-specific instructions explaining how to fix it. - No longer need a `./` to run a script with bun.js, e.g. instead of `bun ./foo.js`, `bun foo.js` works now - Bun actually detects `.mjs` or `.mts` files now and treats them as ESM. Before it was reading them but ignoring the extension - Fixed a couple regressions that caused bun to start up slower, now it's back to about 3.5ms on macOS aarch64 and 0.5ms on linux amd64 - Fixed a bug in the upgrade checker that would sometimes cause bun to crash, typically after about 30 seconds - `Bun.gc(force)` lets you manually run the garbage collector - `Bun.shrink()` runs a JavaScriptCore VM function that attempts to [shrink the amount of memory](https://bugs.webkit.org/attachment.cgi?id=341536&action=review) used by JavaScriptCore - `Bun.generateHeapSnapshot()` returns a heap snapshot in a format I'm not entirely sure how to visualize yet If you look hard enough, you'll also find a new subcommand for a very incomplete but fast Jest-like test runner. Hopefully will talk more about that next release or the one after. #### Thanks - @Andarist [for adding module conditions](https://github.com/Jarred-Sumner/bun/pull/104) when building for node