A shot-scraper-style JSON API on Bun 1.4's new Bun.WebView
Bun 1.4 was released, marking the first stable version since the project's Rust rewrite. The release notes highlighted over 2,900 bug fixes and a significant increase in Node.js compatibility, adding 1,517 tests from the Node.js test suite. New features include Bun.Image, Bun.WebView, Bun.markdown, Bun.cron(), Bun.Terminal, and parallel execution commands. Among these, Bun.WebView stood out for adding first-class browser automation support to Bun core, using either macOS WebKit or a local Chromium process via the Chrome DevTools Protocol (CDP). Simon Willison, using Claude Code for web, built a prototype TypeScript server that leverages Bun.WebView to provide a web API similar to his shot-scraper javascript CLI tool. The service, roughly 150 lines with zero dependencies, creates one browser tab per request and supports concurrency, returning page results and errors as JSON through endpoints like /javascript, /screenshot, and /healthz. Testing with cgroups indicated that running a full Chrome against complex web pages would require a container with 192MB-256MB of RAM.
Bun.WebView could enable lightweight, dependency-free browser automation services without Puppeteer or Playwright.