A shot-scraper-style JSON API on Bun 1.4's new Bun.WebView
The software release Bun 1.4 marks the first stable version of the runtime since its core was rewritten from Zig to Rust. Alongside this major architectural change, the update introduces thousands of bug fixes, expands compatibility with the Node system, and significantly improves startup times while reducing memory and CPU usage.
Among the newly added built-in features is Bun.WebView, which provides native browser automation support directly within the runtime. This tool can operate using macOS WebKit or by controlling a local Chromium instance through the Chrome DevTools Protocol.
Utilizing this new capability alongside an AI coding assistant, a developer built a prototype TypeScript web API inspired by the shot-scraper command-line tool. This server loads web pages and executes JavaScript against them.
Resource testing using cgroups showed that running this browser automation service against complex web pages requires a container with 192 to 256 megabytes of RAM to support a full Chrome instance.