
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Security News
Sarah Gooding
January 22, 2025
Bun, the modern JavaScript runtime and toolkit, has released version 1.2 today with a host of exciting features and enhancements. Designed to streamline building, running, and testing JavaScript and TypeScript applications, this release focuses on improving stability, enhancing Node.js compatibility, and introducing powerful new APIs. Here's a detailed look at what's new in Bun 1.2.
One of Bun's key goals is to serve as a drop-in replacement for Node.js, while also offering significant performance improvements and additional features. In version 1.2, Bun extends its support for Node.js APIs by adding compatibility for the following:
node:http2 server
node:dgram
node:cluster
These additions bring Bun closer to full Node.js parity, allowing developers to use Bun in applications that rely on these APIs.
Performance is a major focus when Bun adds support for new APIs. The development team’s tests of a "Hello World" Express server running on Bun 1.2 showed that it can handle 3X more requests per second compared to Node.js. To ensure reliability, Bun now runs the entire Node.js test suite for every change, which includes thousands of tests from Node’s repository. Currently, Bun passes over 90% of Node’s test suite for supported modules, with ongoing progress toward full compatibility.
Bun 1.2 introduces built-in support for S3 object storage, a standard for cloud-based file systems. The new Bun S3 API allows developers to seamlessly read and write files in S3 buckets using the same straightforward APIs as Bun’s file operations.
Key features include:
This feature enhances Bun's appeal as a cloud-first runtime and makes it a more compelling choice for developers building scalable, cloud-native applications.
In addition to S3, Bun 1.2 introduces built-in Postgres support with the new Bun SQL API. The new Bun.sql SQL client supports PostgreSQL and will soon add MySQL.
import { sql } from "bun";
const users = await sql`
SELECT * FROM users
WHERE active = ${true}
LIMIT ${10}
`;
// Select with multiple conditions
const activeUsers = await sql`
SELECT *
FROM users
WHERE active = ${true}
AND age >= ${18}
`;
Highlights include:
Bun 1.2 addresses feedback about its binary lockfile by introducing a new text-based lockfile in JSONC format. This makes lockfiles easier to read, review in pull requests, and resolve merge conflicts. While maintaining performance, cached installs are now 30% faster, and Bun install defaults to generating a text lockfile for new projects.
For existing projects, migration to the text lockfile can be done by using the --save-text-lockfile
flag. (Bun plans to support the binary lockfile “for a long time” so users can continue using common commands as expected.)
Simplifying front-end development, Bun 1.2 introduces HTML Imports. This feature allows developers to import HTML files directly, with automatic bundling and minification of JavaScript and CSS. Frameworks like React, TypeScript, and Tailwind CSS work seamlessly with HTML Imports, streamlining full-stack application development.
The Bun project has gained significant traction in the JavaScript community as a potential successor or alternative to Node.js, especially for developers prioritizing performance and ease of use. Bun shows a 16% adoption rate among respondents to the 2024 State of JavaScript survey, showing a lot of growth potential given that it’s a relatively new runtime compared to Node.js and Deno.
By introducing built-in support for critical datastores like S3 and Postgres, Bun takes a major step towards meeting the demands of production applications, enabling developers to build scalable, cloud-native solutions with fewer external dependencies. These new features in Bun 1.2 go a long way towards solidifying Bun’s position as a mainstream JavaScript runtime. Check out the Bun 1.2 announcement post for implementation details on all the new features and a full breakdown of everything in the release.
Subscribe to our newsletter
Get notified when we publish new security blog posts!
Try it now
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.