Subtitles section Play video
BUN is a complete toolkit for building, running, and testing JavaScript and TypeScript applications.
BUN 是一個用於構建、運行和測試 JavaScript 和 TypeScript 應用程序的完整工具包。
With BUN 1.2, we're introducing new features and APIs that make it easier than ever.
隨著 BUN 1.2 的推出,我們將引入新的功能和應用程序接口,使其比以往更加簡單。
We've also spent a lot of time improving stability and Node.js compatibility.
我們還花了大量時間來提高穩定性和 Node.js 兼容性。
That's why companies like X are using BUN in production.
這就是 X 等公司在生產中使用 BUN 的原因。
BUN lets them ship features at scale in days instead of months.
BUN 可讓他們在數天內而不是數月內大規模發佈功能。
Before we talk about the new features in BUN 1.2, let's start with an update on Node compatibility.
在討論 BUN 1.2 的新功能之前,我們先來了解一下節點兼容性的最新情況。
BUN is designed to be a drop-in replacement for Node.js.
BUN 的設計目的是成為 Node.js 的直接替代品。
BUN supports all the major Node.js APIs like FS, Net, and HTTP.
BUN 支持所有主要的 Node.js API,如 FS、Net 和 HTTP。
In BUN 1.2, we've added support for even more APIs, including DGRAM, HTTP2 Server, and Cluster.
在 BUN 1.2 中,我們增加了對更多 API 的支持,包括 DGRAM、HTTP2 Server 和 Cluster。
We've also made some major performance improvements.
我們還對性能進行了重大改進。
In BUN 1.2, a Hello World Express server handles three times more requests per second than in Node.js.
在 BUN 1.2 中,Hello World Express 服務器每秒處理的請求數是 Node.js 的三倍。
In BUN 1.2, we started to run the entire Node.js test suite for every change we make to BUN.
在 BUN 1.2 中,我們開始為 BUN 的每一次更改運行整個 Node.js 測試套件。
It's a suite that includes thousands of tests from Node's repository and ensures that if code works in Node, it also works in BUN.
該套件包含 Node 代碼庫中的數千個測試,可確保代碼在 Node 中運行時,也能在 BUN 中運行。
For each of the following Node.js modules, BUN passes over 90% of Node's test suite.
對於以下每個 Node.js 模塊,BUN 都能通過 90% 以上的 Node 測試套件。
Every day, BUN gets closer to 100% Node compatibility, and we're excited to share more progress on this very soon.
每天,BUN 都在向 100% Node 兼容性邁進,我們很高興很快就能分享這方面的更多進展。
BUN is designed as a cloud-first JavaScript runtime.
BUN 被設計為雲計算優先的 JavaScript 運行時。
That means providing built-in APIs for all the tools you need when running a production application in the cloud.
這意味著要為您在雲中運行生產應用程序時所需的所有工具提供內置 API。
That's why we're excited to introduce S3 object support in BUN.
是以,我們很高興在 BUN 中引入 S3 對象支持。
S3 is the de facto standard for object storage and even predates Node.js.
S3 是對象存儲的事實標準,甚至早於 Node.js。
Think of it as the file system API for the cloud.
將其視為雲計算的文件系統 API。
There are dozens of S3-compatible services that you can use in production or even on your local machine.
有幾十種與 S3 兼容的服務,你可以在生產中甚至在在地機器上使用。
In BUN 1.2, you can use the new BUN S3 API to read and write files from an S3 bucket.
在 BUN 1.2 中,您可以使用新的 BUN S3 API 從 S3 存儲桶中讀寫文件。
It uses the same simple APIs as BUN file.
它使用與 BUN 文件相同的簡單應用程序接口。
It also extends the web standard APIs.
它還擴展了網絡標準應用程序接口。
That means you can pass it to any API that accepts blobs, like requests and response.
這意味著您可以將它傳遞給任何接受 blob 的 API,如請求和響應。
We've also made it possible to read and write S3 files with just a URL.
我們還實現了只需一個 URL 就能讀寫 S3 文件。
BUN looks for well-known environment variables to configure your credentials and bucket.
BUN 會查找眾所周知的環境變量來配置你的證書和郵筒。
If you want to customize and create your own S3 client, you can import the S3 client API.
如果想定製和創建自己的 S3 客戶端,可以導入 S3 客戶端 API。
BUN's S3 client is implemented in highly optimized native code.
BUN 的 S3 客戶端由高度優化的在地代碼實現。
The S3 client in BUN can download files in parallel up to five times faster than the leading MPM package can on Node.js.
BUN 中的 S3 客戶端並行下載文件的速度比 Node.js 上領先的 MPM 套裝軟體快五倍。
Just like object storage, another data store that's widely used in production is Postgres.
與對象存儲一樣,另一種在生產中廣泛使用的數據存儲是 Postgres。
And that's why we're excited to introduce built-in Postgres support for BUN.
是以,我們很高興能為 BUN 引入 Postgres 內置支持。
In BUN 1.2, we're expanding the BUN SQLite APIs by introducing BUN SQL.
在 BUN 1.2 中,我們通過引入 BUN SQL 擴展了 BUN SQLite API。
BUN SQL is a fast built-in SQL client for BUN.
BUN SQL 是 BUN 的快速內置 SQL 客戶端。
Postgres is the first database we support, and we have a PR to add MySQL very soon.
Postgres 是我們支持的第一個數據庫,我們很快就會在 PR 中添加 MySQL。
BUN SQL's APIs use tagged template literals to create queries.
BUN SQL 的應用程序接口使用帶標記的模板文字來創建查詢。
This prevents SQL injection by design without having to manually escape strings.
這樣就可以防止 SQL 注入,而無需手動轉義字符串。
BUN SQL's APIs are inspired by the popular MPM package, Postgres.js.
BUN SQL 的 API 受流行的 MPM 套裝軟體 Postgres.js 的啟發。
If you're already using Postgres.js, you can switch to BUN SQL by changing the import.
如果您已經在使用 Postgres.js,則可以通過更改導入來切換到 BUN SQL。
Just like BUN S3, BUN SQL is implemented in native code instead of JavaScript.
與 BUN S3 一樣,BUN SQL 也是用在地代碼而不是 JavaScript 實現的。
It can read rows up to 50% faster than the leading MPM package can on Node.js.
在 Node.js 上,它讀取行的速度比領先的 MPM 套裝軟體快 50%。
BUN isn't just a JavaScript runtime.
BUN 不僅僅是 JavaScript 運行時。
It's also an MPM compatible package manager.
它還是 MPM 兼容的套裝軟體管理器。
BUN install is designed to work with Node.js and BUN.
BUN 安裝旨在與 Node.js 和 BUN 配合使用。
Even if you aren't ready to migrate your application to BUN, you can still use BUN install with Node.js.
即使您還沒有準備好將應用程序遷移到 BUN,您仍然可以使用 BUN 安裝 Node.js。
In BUN 1.2, we're introducing the biggest update yet to BUN install, a text-based log file.
在 BUN 1.2 中,我們將推出 BUN 安裝的最大更新,即基於文本的日誌文件。
When BUN install was first designed, we decided to use a binary log file for performance reasons, but we heard a lot of your feedback that they're impossible to review in pull requests, hard to fix merge conflicts, and difficult for tooling to use.
在最初設計 BUN install 時,出於性能考慮,我們決定使用二進制日誌文件,但我們聽到了很多反饋,認為它們無法在拉取請求中進行審查,難以修復合併衝突,而且工具也很難使用。
That's why BUN's new text log file is a JSON C file, which is JSON with support for comments and trailing commas.
這就是為什麼 BUN 的新文本日誌文件是一個 JSON C 文件,即支持註釋和尾部逗號的 JSON 文件。
This makes it much easier to view diffs in pull requests, and trailing commas make it much less likely to cause merge conflicts.
這樣就更容易查看拉取請求中的差異,而且尾隨逗號也更不容易引起合併衝突。
Some projects start out being faster, then get slower as they add new features.
有些項目開始時速度較快,但隨著新功能的增加,速度會越來越慢。
BUN is not one of those projects.
BUN 不屬於這些項目。
That's why we spent a lot of time figuring out how to make the text log file just as fast.
這就是為什麼我們花了很多時間來研究如何讓文本日誌文件也同樣快速。
In BUN 1.2, we made cached installs 30% faster.
在 BUN 1.2 中,我們將緩存安裝的速度提高了 30%。
For new projects, BUN install will default to generating a text log file.
對於新項目,BUN 安裝將默認生成文本日誌文件。
For existing projects, BUN will continue to use the binary log file.
對於現有項目,BUN 將繼續使用二進制日誌文件。
To migrate to the text log file, you can pass the save text log file flag to BUN install.
要遷移到文本日誌文件,可以向 BUN 安裝傳遞保存文本日誌文件標誌。
BUN is a complete toolkit for building full stack applications with JavaScript and TypeScript.
BUN 是使用 JavaScript 和 TypeScript 構建全棧應用程序的完整工具包。
And front-end is a really important part of your stack.
而前端是堆棧中非常重要的一部分。
In BUN 1.2, we're introducing HTML imports.
在 BUN 1.2 中,我們引入了 HTML 導入。
HTML imports simplify your entire front-end tool chain into a single import statement.
HTML 導入將整個前端工具鏈簡化為一條導入語句。
BUN scans the HTML and automatically minifies and bundles JavaScript and CSS.
BUN 會掃描 HTML,並自動精簡和捆綁 JavaScript 和 CSS。
Modern tools like React, TypeScript and Tailwind just work.
React、TypeScript 和 Tailwind 等現代工具都能正常工作。
Together with HTML imports, S3 and BUN SQL, building full stack applications with JavaScript has never been simpler.
通過 HTML 導入、S3 和 BUN SQL,使用 JavaScript 構建全棧應用程序變得前所未有的簡單。
We're really excited to see what you build with BUN.
我們非常期待看到你們用 BUN 打造的產品。
There's so many more features and improvements in BUN 1.2 that we can't go over them all.
BUN 1.2 中還有很多功能和改進,我們無法一一列舉。
Check out our blog for everything else that we shipped in BUN 1.2.
查看我們的博客,瞭解我們在 BUN 1.2 中發佈的其他內容。
To get started with BUN, run any of the following commands in your terminal.
要開始使用 BUN,請在終端運行以下任意命令。
That's BUN 1.2.
這是 BUN 1.2。
And for BUN, it's still just the beginning.
而對於 BUN 來說,這還僅僅是個開始。