Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/what-changed/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as core from '@actions/core'
import * as exec from '@actions/exec'

const exclude = new Set(['@hono/bun-transpiler'])
const exclude = new Set(['@hono/bun-compiler', '@hono/bun-transpiler'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the @hono/bun-compiler is a typo?

const since = core.getInput('since')

const workspaces = await exec.getExecOutput('yarn workspaces list', [
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/ci-bun-compress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: ci-bun-compress
on:
push:
branches: [main]
paths:
- 'packages/bun-compress/**'
pull_request:
branches: ['*']
paths:
- 'packages/bun-compress/**'

jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
bun-version: [1.3.2, 1.3.3]
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ matrix.bun-version }}
- run: yarn workspaces focus hono-middleware @hono/bun-compress
- run: yarn turbo --filter @hono/bun-compress build
- run: bun test packages/bun-compress --coverage --coverage-reporter lcov
- uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
directory: ./coverage
flags: bun-compress
4 changes: 2 additions & 2 deletions .github/workflows/ci-bun-transpiler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
bun-version-file: .tool-versions
- run: yarn workspaces focus hono-middleware @hono/bun-transpiler
- run: yarn turbo --filter @hono/bun-transpiler build
- run: yarn workspace @hono/bun-transpiler test --coverage --coverage-reporter lcov
- run: bun test packages/bun-transpiler --coverage --coverage-reporter lcov
- uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
directory: ./packages/bun-transpiler/coverage
directory: ./coverage
flags: bun-transpiler
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
"@hono/eslint-config": "workspace:*",
"@ryoppippi/unplugin-typia": "^2.6.5",
"@tsconfig/strictest": "^2.0.8",
"@types/bun": "^1.0.0",
"@types/node": "^25.0.3",
"@types/ws": "^8.18.0",
Comment on lines -45 to -47
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't remember why exactly.. but in #1077 and #1098 I moved these packages to the monorepo root.

I think it may have been related to tsup config needing to resolve types relative to the root? But we don't have that problem anymore..

"@vitest/coverage-istanbul": "^4.0.16",
"eslint": "^9.39.2",
"hono": "^4.11.3",
Expand Down
8 changes: 0 additions & 8 deletions packages/bun-compress/eslint-suppressions.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
{
"src/index.test.ts": {
"@typescript-eslint/no-unsafe-argument": {
"count": 1
},
"@typescript-eslint/no-unsafe-assignment": {
"count": 1
},
"@typescript-eslint/no-unsafe-member-access": {
"count": 2
}
},
"src/index.ts": {
"@typescript-eslint/no-unsafe-argument": {
"count": 1
}
}
}
3 changes: 1 addition & 2 deletions packages/bun-compress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
"hono": ">=4.0.0"
},
"devDependencies": {
"@types/bun": "^1.2.12",
"@types/node": "^25.0.3",
"@types/bun": "^1.3.5",
"hono": "^4.11.3",
"tsdown": "^0.15.9",
"typescript": "^5.8.2",
Expand Down
4 changes: 1 addition & 3 deletions packages/bun-compress/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,6 @@ async function decompressResponse(res: Response): Promise<string> {
const readableStream = Readable.fromWeb(resBody)
const decompressedStream = readableStream.pipe(createGunzip())
const decompressedReadableStream = Readable.toWeb(decompressedStream)

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const decompressedResponse = new Response(decompressedReadableStream as any)
const decompressedResponse = new Response(decompressedReadableStream)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No more type assertion ✨

return await decompressedResponse.text()
}
9 changes: 3 additions & 6 deletions packages/bun-compress/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import type { MiddlewareHandler } from 'hono'
import { compress as originalCompress } from 'hono/compress'
import { COMPRESSIBLE_CONTENT_TYPE_REGEX } from 'hono/utils/compress'
import { Readable } from 'node:stream'
import type { ReadableStream } from 'node:stream/web'
import { createDeflate, createGzip } from 'node:zlib'

const ENCODING_TYPES = ['gzip', 'deflate'] as const
Expand Down Expand Up @@ -74,14 +73,12 @@ export const compress = (options?: CompressionOptions): MiddlewareHandler => {
try {
const compressedStream = encoding === 'gzip' ? createGzip() : createDeflate()

const readableBody = ctx.res.body as ReadableStream
const readableStream = Readable.fromWeb(readableBody)
const readableStream = Readable.fromWeb(ctx.res.body)
const compressedBody = readableStream.pipe(compressedStream)
const compressedReadableStream = Readable.toWeb(compressedBody) as ReadableStream<Uint8Array>
const compressedReadableStream = Readable.toWeb(compressedBody)

// Create a new response with the compressed body
// eslint-disable-next-line @typescript-eslint/no-explicit-any
ctx.res = new Response(compressedReadableStream as any, ctx.res)
ctx.res = new Response(compressedReadableStream, ctx.res)
ctx.res.headers.delete('Content-Length')
ctx.res.headers.set('Content-Encoding', encoding)
} catch (error) {
Expand Down
3 changes: 2 additions & 1 deletion packages/bun-compress/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "../../tsconfig.build.json",
"compilerOptions": {
"types": ["node", "bun"]
"lib": [],
"types": ["bun"]
},
"references": []
}
1 change: 1 addition & 0 deletions packages/bun-compress/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"lib": [],
"outDir": "../../dist/packages/bun-compress",
"types": ["vitest/globals"]
},
Expand Down
1 change: 1 addition & 0 deletions packages/bun-transpiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"hono": ">=4.0.0"
},
"devDependencies": {
"@types/bun": "^1.3.5",
"hono": "^4.11.3",
"tsdown": "^0.15.9",
"typescript": "^5.8.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/bun-transpiler/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('Bun Transpiler middleware', () => {
app.get('/bad.ts', (c) => c.text(BAD))

// serve middleware script to test compliance with serveStatic
app.get('/index.ts', serveStatic({ root: './src' }))
app.get('/index.ts', serveStatic({ root: import.meta.dirname }))

it('Should ignore non typescript content paths', async () => {
const res = await app.request(`${HOST}/script.js`)
Expand Down
1 change: 1 addition & 0 deletions packages/casbin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"hono": ">=4.5.11"
},
"devDependencies": {
"@types/node": "^25.0.3",
"casbin": "^5.40.0",
"hono": "^4.11.3",
"tsdown": "^0.15.9",
Expand Down
1 change: 1 addition & 0 deletions packages/cloudflare-access/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"hono": ">=4.0.0"
},
"devDependencies": {
"@types/node": "^25.0.3",
"hono": "^4.11.3",
"tsdown": "^0.15.9",
"typescript": "^5.8.2",
Expand Down
1 change: 1 addition & 0 deletions packages/graphql-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"graphql": "^16.5.0"
},
"devDependencies": {
"@types/bun": "^1.3.5",
"hono": "^4.11.3",
"tsdown": "^0.15.9",
"typescript": "^5.8.2",
Expand Down
1 change: 1 addition & 0 deletions packages/node-ws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"homepage": "https://github.com/honojs/middleware",
"devDependencies": {
"@hono/node-server": "^1.19.2",
"@types/ws": "^8.18.1",
"hono": "^4.11.3",
"tsdown": "^0.15.9",
"typescript": "^5.8.2",
Expand Down
5 changes: 0 additions & 5 deletions packages/ua-blocker/eslint-suppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,5 @@
"@typescript-eslint/require-await": {
"count": 1
}
},
"src/escape.ts": {
"@typescript-eslint/restrict-plus-operands": {
"count": 1
}
}
}
51 changes: 16 additions & 35 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2046,8 +2046,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@hono/bun-compress@workspace:packages/bun-compress"
dependencies:
"@types/bun": "npm:^1.2.12"
"@types/node": "npm:^25.0.3"
"@types/bun": "npm:^1.3.5"
hono: "npm:^4.11.3"
tsdown: "npm:^0.15.9"
typescript: "npm:^5.8.2"
Expand All @@ -2061,6 +2060,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@hono/bun-transpiler@workspace:packages/bun-transpiler"
dependencies:
"@types/bun": "npm:^1.3.5"
hono: "npm:^4.11.3"
tsdown: "npm:^0.15.9"
typescript: "npm:^5.8.2"
Expand Down Expand Up @@ -2094,6 +2094,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@hono/casbin@workspace:packages/casbin"
dependencies:
"@types/node": "npm:^25.0.3"
casbin: "npm:^5.40.0"
hono: "npm:^4.11.3"
tsdown: "npm:^0.15.9"
Expand Down Expand Up @@ -2142,6 +2143,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@hono/cloudflare-access@workspace:packages/cloudflare-access"
dependencies:
"@types/node": "npm:^25.0.3"
hono: "npm:^4.11.3"
tsdown: "npm:^0.15.9"
typescript: "npm:^5.8.2"
Expand Down Expand Up @@ -2251,6 +2253,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@hono/graphql-server@workspace:packages/graphql-server"
dependencies:
"@types/bun": "npm:^1.3.5"
graphql: "npm:^16.5.0"
hono: "npm:^4.11.3"
tsdown: "npm:^0.15.9"
Expand Down Expand Up @@ -2333,6 +2336,7 @@ __metadata:
resolution: "@hono/node-ws@workspace:packages/node-ws"
dependencies:
"@hono/node-server": "npm:^1.19.2"
"@types/ws": "npm:^8.18.1"
hono: "npm:^4.11.3"
tsdown: "npm:^0.15.9"
typescript: "npm:^5.8.2"
Expand Down Expand Up @@ -4883,21 +4887,12 @@ __metadata:
languageName: node
linkType: hard

"@types/bun@npm:^1.0.0":
version: 1.3.1
resolution: "@types/bun@npm:1.3.1"
dependencies:
bun-types: "npm:1.3.1"
checksum: 10c0/048a992fd2b7d87cbeaac3511f224b8b8744bd6fe83a35bd85eff11d16bebe715e8da5e4410f813c686464450049de53fa7d82fe798987f15f68ac7e87dc9aa0
languageName: node
linkType: hard

"@types/bun@npm:^1.2.12":
version: 1.2.12
resolution: "@types/bun@npm:1.2.12"
"@types/bun@npm:^1.3.5":
version: 1.3.5
resolution: "@types/bun@npm:1.3.5"
dependencies:
bun-types: "npm:1.2.12"
checksum: 10c0/168578a09e9408792c44363957b45d6f574b684a87cfb1ec350131a868e5001b6ce5006a1503846ff1afb7cd827911c5538ec27ba24cbc287e5f200b748ebe30
bun-types: "npm:1.3.5"
checksum: 10c0/ec3b364bcad3faeed6e5033f76c3618d4469719d04c5c4f31659953461c6b36509cf9befb05ad3c455f2584f64eff6ff636bca8a36590ae4184caf146ad86601
languageName: node
linkType: hard

Expand Down Expand Up @@ -5125,7 +5120,7 @@ __metadata:
languageName: node
linkType: hard

"@types/ws@npm:^8.18.0, @types/ws@npm:^8.5.0":
"@types/ws@npm:^8.18.1, @types/ws@npm:^8.5.0":
version: 8.18.1
resolution: "@types/ws@npm:8.18.1"
dependencies:
Expand Down Expand Up @@ -6164,23 +6159,12 @@ __metadata:
languageName: node
linkType: hard

"bun-types@npm:1.2.12":
version: 1.2.12
resolution: "bun-types@npm:1.2.12"
dependencies:
"@types/node": "npm:*"
checksum: 10c0/9e6f421f82164f39ada25f202969f267609e477286817395420cf2b0f4d9e98d2243ec5e73f564a4448941d6706a53329e2fbdbdac7e2e6a32f6882ec63eddae
languageName: node
linkType: hard

"bun-types@npm:1.3.1":
version: 1.3.1
resolution: "bun-types@npm:1.3.1"
"bun-types@npm:1.3.5":
version: 1.3.5
resolution: "bun-types@npm:1.3.5"
dependencies:
"@types/node": "npm:*"
peerDependencies:
"@types/react": ^19
checksum: 10c0/4429af038fe2807466a0bb30dc2515ddd197d0869237b9b29b8b8ce6d40cca26f21d2afa1ee583f9eb28b94480c08a16d3a4f0e13b3bf3aa3a3807c47df24b6f
checksum: 10c0/f46aa39af49cb7f06e101e57c10f80a33df3ddd162e3d22aee87f96923b5b5782dd6a2cf52ef475d84148e0a73a326a4e7df82b7457da5c142a52170c76bce92
languageName: node
linkType: hard

Expand Down Expand Up @@ -9814,9 +9798,6 @@ __metadata:
"@hono/eslint-config": "workspace:*"
"@ryoppippi/unplugin-typia": "npm:^2.6.5"
"@tsconfig/strictest": "npm:^2.0.8"
"@types/bun": "npm:^1.0.0"
"@types/node": "npm:^25.0.3"
"@types/ws": "npm:^8.18.0"
"@vitest/coverage-istanbul": "npm:^4.0.16"
eslint: "npm:^9.39.2"
hono: "npm:^4.11.3"
Expand Down
Loading