---
title: "Bun 1.4 内置 WebView：构建 shot-scraper 风格 JSON API 的实验"
source: "Simon Willison 博客（Atom）"
source_tier: "t2"
url: "https://simonwillison.net/2026/Aug/20/bun-webview-json-api/"
permalink: "https://feed.astralor.com/items/itm_356bdab6beb75ab8ed388067"
published: "2026-08-20T15:37:00.000Z"
score: 76
channel: "tech"
tags: ["Bun","Bun.WebView","Claude Code","shot-scraper","开发工具","浏览器自动化"]
---

# Bun 1.4 内置 WebView：构建 shot-scraper 风格 JSON API 的实验

## AI 点评

> 我认为这篇的价值不在于罗列新功能，而在于作者用第一手实验把“Bun.WebView 能做什么”变成了可量化的部署数据。对正在搭建抓取服务或 AI Agent 工具链的团队来说，那 192MB-256MB 的内存估算比任何营销话术都有用。

## 速览

Bun 1.4 正式发布，这是自几个月前从 Zig 重写为 Rust 以来的首个稳定版本，新增 Bun.WebView、Bun.Image、Bun.markdown 等特性并修复 2900 多个问题。作者用 Claude Code 构建了一个 shot-scraper 风格的 JSON API 原型，通过 Bun.WebView 加载网页并执行 JavaScript。实测表明，一个完整 Chrome 实例处理复杂页面大约需要 192MB-256MB 内存，为后续容器化部署提供了参考。

## 关键点

- Bun 1.4 发布，Rust 重写后首个稳定版本，新增 Bun.WebView 等多项内置能力。
- 作者用 Claude Code 构建了 shot-scraper 风格的 JSON API 原型，通过 WebView 加载网页并执行 JS。
- 实测完整 Chrome 处理复杂页面约需 192MB-256MB 内存，为容器化部署提供参考。

## 全文

Research: A shot-scraper-style JSON API on Bun 1.4's new Bun.WebView Today saw the long awaited release of Bun 1.4, the first stable version since the infamous Rust rewrite a few months ago. Interestingly, the Rust rewrite was downplayed in the release notes, which introduced a bewildering array of new features and claimed 2,900 additional bug fixes: Bun 1.4 adds +1,517 tests from the Node.js test suite - our biggest jump in Node.js compatibility since Bun 1.0. Bun v1.4 also fixes over 2,900 issues. It reduces idle CPU usage by 5x, reduces memory usage by up to 35%, and starts 50% faster on Linux. It adds Bun.Image, Bun.WebView, Bun.markdown, Bun.cron(), Bun.Terminal, bun run --parallel, bun test --parallel, bun audit fix, bun dedupe, and bun prune. And it rewrites Bun from Zig to Rust. Of these the one that most caught my eye was Bun.WebView, which adds first class support for browser automation to Bun core using either macOS WebKit or control of a local Chromium process via the Chrome DevTools Protocol (CDP). I had Claude Code for web build a prototype of a web API providing the ability to load a web page and then execute JavaScript against it, inspired by my shot-scraper javascript CLI tool - partly to see how much RAM would be needed by such a service. Here's that TypeScript server implementation, which appears to need a 192MB-256MB container to run a full Chrome against complex web pages - tested using cgroups. Tags: browsers, javascript, ai, rust, typescript, generative-ai, llms, coding-agents, bun

---

引用前请核对原文;本文由星际流动整理:https://feed.astralor.com/items/itm_356bdab6beb75ab8ed388067
