Skip to content

Commit ee082b6

Browse files
author
Charlie Tonneslan
authored
chore: mark @hono/bun-compress as deprecated (#1809)
* chore: mark @hono/bun-compress as deprecated Bun now supports CompressionStream natively, making this middleware unnecessary. The README already stated it would be deprecated once Bun added support. - Add deprecated field to package.json - Update README with deprecation notice and migration guide - Point users to the built-in hono/compress middleware Closes #1807 * Add patch changeset for bun-compress deprecation
1 parent 38993fa commit ee082b6

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hono/bun-compress": patch
3+
---
4+
5+
Mark package as deprecated now that Bun supports CompressionStream natively

packages/bun-compress/README.md

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,21 @@
11
# Bun Compress Middleware for Hono
22

3-
Bun does not currently support the [CompressionStream API](https://developer.mozilla.org/en-US/docs/Web/API/CompressionStream) so this middleware replicates the behavior of [`hono/compress`](https://hono.dev/docs/middleware/builtin/compress) using the Zlib library. This middleware will be deprecated once [Bun adds support for `CompressionStream`](https://github.com/oven-sh/bun/issues/1723).
3+
> **Deprecated**: Bun now supports the [CompressionStream API](https://developer.mozilla.org/en-US/docs/Web/API/CompressionStream) natively (since [oven-sh/bun#1723](https://github.com/oven-sh/bun/issues/1723) was resolved). Use the built-in [`hono/compress`](https://hono.dev/docs/middleware/builtin/compress) middleware instead.
44
5-
This middleware will use `hono/compress` if CompressionStream is available so you can use this middleware in Bun and Node.js without any changes.
5+
This middleware was created as a workaround for Bun's missing `CompressionStream` support. Now that Bun has added native support, `hono/compress` works on Bun without any polyfill.
66

7-
## Import
7+
## Migration
8+
9+
Replace:
810

911
```ts
10-
import { Hono } from 'hono'
1112
import { compress } from '@hono/bun-compress'
1213
```
1314

14-
## Usage
15+
With:
1516

1617
```ts
17-
const app = new Hono()
18-
19-
app.use(compress())
18+
import { compress } from 'hono/compress'
2019
```
2120

22-
## Options
23-
24-
### <Badge type="info" text="optional" /> encoding: `'gzip'` | `'deflate'`
25-
26-
The compression scheme to allow for response compression. Either `gzip` or `deflate`. If not defined, both are allowed and will be used based on the `Accept-Encoding` header. `gzip` is prioritized if this option is not provided and the client provides both in the `Accept-Encoding` header.
27-
28-
### <Badge type="info" text="optional" /> threshold: `number`
29-
30-
The minimum size in bytes to compress. Defaults to 1024 bytes.
21+
No other changes needed — the API is the same.

packages/bun-compress/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "@hono/bun-compress",
33
"version": "0.1.0",
4-
"description": "A Hono middleware for compressing responses using Bun's built-in compression.",
4+
"description": "Deprecated: Use hono/compress instead. Bun now supports CompressionStream natively.",
5+
"deprecated": "Bun now supports CompressionStream natively. Use the built-in hono/compress middleware instead.",
56
"type": "module",
67
"module": "dist/index.js",
78
"types": "dist/index.d.ts",

0 commit comments

Comments
 (0)