Bun 1.2 squashes Node.js compatibility bugs

Bun 1.2, an update to the all-in-one runtime and toolkit for building, running, and testing full-stack JavaScript and TypeScript applications, has arrived, boasting dramatic improvements in Node.js compatibility. The new version also adds a built-in Amazon S3 object storage API and a built-in PostgreSQL client.

Bun 1.2 was announced on January 22. With version 1.2, the Bun developers changed how they test and improve compatibility with Node.js, running the Node.js test suite for every change made to Bun. As a result, the team has fixed thousands of bugs and 11 Node.js modules now pass more than 90% of their tests with Bun, Oven product manager Ashcon Partovi wrote in a blog post.

Also with Bun 1.2, node:http2 can be used to create HTTP/2 servers and gRPC servers, which are now supported in Bun. Developers with Bun 1.2 also can use node:cluster to spawn multiple instances of Bun and can bind and connect to UDP sockets using node:dgram. And the entirenode:zlib module was rewritten from JavaScript to native code.

Procedures for installing and upgrading Bun can found in the blog post. Elsewhere in Bun 1.2:

Experimental support is featured for compiling and running C from JavaScript. Developers can use C system libraries from JavaScript without a build step.

The Express framework can serve HTTP requests as much as three times faster in Bun 1.2 than in Node.js, Partovi said.

Support has been added for reading NPM’s config file, .npmrc. This can be used to configure an NPM registry and scoped packages. Also, NPM packages now can be published using bun publish, which is a drop-in replacement for npm publish.

Built-in support is offered for Amazon S3 object storage.

A new CSS parser is featured.

HTML imports now are supported.

Support for SQL databases is expanded through Bun.sql, a built-in SQL client with Postgres support. MySQL support is anticipated as well.

A new text-based lockfile, bun.lock, is being introduced.

bun install in Bun 1.2 is 30% faster than in Bun 1.1, which was unveiled in April 2024.

Custom error messages now are supported using expect().

Source

Yorum yapın