The Bun Shell
Bun Shell is an experimental embedded shell language and interpreter in Bun (v1.0.24+) that runs cross-platform shell scripts from JavaScript and TypeScript via the `$` tagged template. It targets the platform differences that push npm projects toward polyfill packages like rimraf, cross-env and which, as well as the roughly 7ms cost of spawning bash or sh for each command. Template variables are escaped to prevent injection, and scripts can redirect and pipe to and from Buffers, Responses and files, with builtins like cd, echo and rm. It will power package.json scripts in Bun for Windows.
Related posts
- Bun v1.0.24
Bun mediumAdept
Bun v1.0.24 introduces Bun Shell, an experimental embedded shell language and interpreter for running cross-platform shell scripts from JavaScript and TypeScript via the $ template tag, with interop for fetch responses, files and line-by-line output. The release also fixes 9 bugs, mostly Node.js compatibility issues. Sockets no longer close on timeout. perf_hooks.eventLoopUtilization is now defined so Hapi works. process.exit had been rejecting integer exit codes that JavaScriptCore stores as doubles, which broke Prisma CLI. Other fixes cover bun install bin linking with dangling symlinks, path.parse edge cases and a recursive console.log hang.
- Bun v1.1.5
Bun mediumAdept
Bun v1.1.5 adds cross-compilation of standalone executables via `bun build --compile --target` (Linux x64/arm64, Windows x64, macOS arm64), so CI can build binaries for every platform from one machine. Other additions: text, json, toml and file import attributes; tolerance of comments and trailing commas in package.json; multi-certificate SNI in Bun.serve; embedding native libraries for bun:ffi in compiled executables; and a compact crash reporter, bun.report. The release fixes 64 bugs, including `bun run --filter` exiting 0 on failure, pidfd_open error handling and a race in Bun.spawn on Linux, Windows readline issues caused by duplicate uv_tty_t handles, and several Node.js compatibility gaps in fs, child_process, crypto and worker_threads.
- Bun v1.0.32
Bun mediumAdept
Bun v1.0.32 fixes 13 bugs, several of them regressions from the I/O rewrite in v1.0.31 done in preparation for Windows support. bun install could hang in GitHub Actions because the active lifecycle-script counter was never decremented. --frozen-lockfile and --production still installed packages, and Bun Shell hung on && and || because a file descriptor was left open. Node.js compatibility improves: the ws package can send and receive ping/pong, FileHandle read/write return correct results, util.promisify works on the timer functions, Subprocess.kill(undefined) coerces to SIGTERM, and a new --shell flag selects the bun or system shell for package.json scripts.
- Bun 1.1
Bun mediumAdept
Bun 1.1 adds Windows 10+ support, passing 98% of the macOS/Linux test suite, and reports `bun install` 18x faster than yarn and 30x faster than npm on Windows. A new `.bunx` file format acts as a cross-filesystem symlink so scripts launch without shebangs, `.cmd`/`.ps1` permutations or "Terminate batch job?" prompts. Other changes include a content-addressable transpiler cache for files over 50KB that roughly doubles startup for large tools like tsc, and the cross-platform Bun Shell (`Bun.$`) with argument escaping against command injection. The release also adds new APIs (Glob, Semver, stringWidth) and closes Node.js compatibility gaps: an HTTP/2 client, Date parsing ported from V8, recursive readdir, Bun–Node IPC, and undocumented internals used by Express and Astro.
- Bun v1.0.12
Bun mediumAdept
Bun v1.0.12 fixes 24 bugs and adds `bun -e` for evaluating inline scripts (with TypeScript, JSX and top-level await), `--env-file` for choosing which .env files to load, `server.url`, `import.meta.env`, and `expect.unreachable()` in bun:test. Macros can now import builtin modules like node:fs and node:child_process at bundle time, and `mock.module` now handles default exports and re-exports. Two fixes include root-cause explanations: a bun:sqlite `.get()` hang came from a wrong JavaScriptCore JSType tag that misled the DFG JIT, and a `require()` crash came from source code being garbage collected before an exception was thrown. As a result, Bun's debug builds now run JavaScriptCore with assertions enabled.