Bun 1.4 Standard Library Additions

Better Stackgo watch the original →

Bun 1.4 integrates native functionality for browser automation, image processing, markdown rendering, terminal management, and archiving, effectively replacing 15 common npm dependencies.

Native Standard Library Integration

Bun 1.4 significantly expands its built-in capabilities, reducing reliance on third-party npm packages for common tasks. The runtime now includes native implementations for headless browser control, image manipulation, markdown parsing, and terminal emulation. By moving these features into the core binary, Bun aims to improve performance and security by mitigating supply chain risks associated with external dependencies.

Key Functional Replacements

  • Browser Automation: The Bun.webview API replaces Playwright and Puppeteer. It supports native macOS WebKit or external Chrome/Chromium instances, allowing for headless automation, script evaluation, and raw CDP command execution.
  • Image Processing: Bun.Image replaces Sharp, providing methods for resizing, rotating, flipping, and metadata extraction, alongside a placeholder generation feature for low-quality image inlining.
  • Markdown Rendering: Bun.markdown offers three distinct APIs for rendering markdown to HTML strings, custom element callbacks, or React JSX, with support for GitHub-flavored tables and auto-links.
  • Terminal and Process Management: Bun.terminal replaces node-pty, enabling the creation of pseudo-terminals for interactive CLI tools. Additionally, native support for parallel script execution via the --parallel flag replaces tools like concurrently or npm-run-all.
  • Archive Handling: The Bun.archive module provides native tar and gzip support, allowing developers to create, compress, and read archives without extracting files to the disk.
  • Utility Helpers: Built-in support for JSON5 and XML parsing, along with terminal-aware string manipulation utilities (Bun.slicey, Bun.ansi, Bun.stringWidth), removes the need for several small, specialized npm packages.

Performance and Deployment

Despite the addition of these features, the Bun binary size has decreased by 17%. The release also introduces a global virtual store for bun install via the isolated-linker configuration, which extracts packages once per machine and uses symlinks to populate node_modules across projects, reducing disk usage and installation time.

  • #ai
  • #dev-tooling

summary by google/gemini-3.1-flash-lite. probably wrong about something. check the source.