docs: document v1.2.1 features

Add minimal documentation for new features in Bun v1.2.1:
- S3 storageClass option for presigned URLs
- X25519 curve support in crypto.generateKeyPair
- Indented inline snapshots in bun test
- minify option for HTML imports in bunfig.toml
- --zero-fill-buffers CLI flag
- reuseAddr/reusePort options for UDP sockets

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude Bot
2025-10-01 21:22:12 +00:00
parent eac82e2184
commit b6e7e312a7
6 changed files with 67 additions and 0 deletions

View File

@@ -235,6 +235,19 @@ const url = s3file.presign({
});
```
### Storage class
Control the storage class for presigned uploads:
```ts
const url = s3file.presign({
method: "PUT",
storageClass: "GLACIER",
});
```
Supported storage classes: `STANDARD`, `REDUCED_REDUNDANCY`, `STANDARD_IA`, `ONEZONE_IA`, `INTELLIGENT_TIERING`, `GLACIER`, `DEEP_ARCHIVE`, `GLACIER_IR`.
### `method`
To set the HTTP method for a presigned URL, pass the `method` option.

View File

@@ -18,6 +18,20 @@ const socket = await Bun.udpSocket({
console.log(socket.port); // 41234
```
### Socket options
Configure socket behavior with `reuseAddr` and `reusePort`:
```ts
const socket = await Bun.udpSocket({
port: 8080,
reuseAddr: true, // Allow binding to addresses in TIME_WAIT state
reusePort: true, // Linux-only: share port across multiple processes
});
```
`reuseAddr` allows reusing addresses immediately after closing. `reusePort` enables load balancing across processes but is Linux-only.
### Send a datagram
Specify the data to send, as well as the destination port and address.

View File

@@ -342,6 +342,22 @@ $ bun add bun-plugin-tailwind
plugins = ["bun-plugin-tailwind"]
```
### Minification
Control HTML import minification in `bunfig.toml`:
```toml#bunfig.toml
[serve.static]
# Boolean: enable all minification
minify = true
# Or object for fine-grained control
[serve.static.minify]
whitespace = true
identifiers = true
syntax = true
```
This will allow you to use TailwindCSS utility classes in your HTML and CSS files. All you need to do is import `tailwindcss` somewhere:
```html#index.html

View File

@@ -159,6 +159,14 @@ Disable native addons and use the `node-addons` export condition.
$ bun --no-addons run server.js
```
### `--zero-fill-buffers`
Force all `Buffer` allocations to be zero-filled for security (Node.js compatibility):
```bash
$ bun --zero-fill-buffers run app.js
```
### Filtering
In monorepos containing multiple packages, you can use the `--filter` argument to execute scripts in many packages at once.

View File

@@ -80,6 +80,7 @@ The following Web APIs are partially or completely supported.
- [`crypto`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto)
[`SubtleCrypto`](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto)
[`CryptoKey`](https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey)
(X25519 curve support for `crypto.subtle.generateKey()`)
---

View File

@@ -40,6 +40,21 @@ test("inline snapshot", () => {
When you run the test, Bun automatically updates the test file itself with the generated snapshot string. This makes the tests more portable and easier to understand, since the expected output is right next to the test.
Indentation is automatically preserved to match your test file's formatting:
```ts
test("nested object", () => {
expect({ user: { name: "Alice", role: "admin" } }).toMatchInlineSnapshot(`
{
"user": {
"name": "Alice",
"role": "admin",
},
}
`);
});
```
### Using inline snapshots
1. Write your test with `.toMatchInlineSnapshot()`