Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next #3144

Merged
merged 33 commits into from
Jul 16, 2024
Merged

Next #3144

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
668a07c
feat(jsx/dom): export createRoot and hydrateRoot from jsx/dom/client …
usualoma Jun 12, 2024
c910923
feat(jsx/server): introduce `jsx/dom/server` module for compatibility…
usualoma Jun 12, 2024
9c21cc6
feat(jsx/dom): Improve compatibility React (useCallback, React.Strict…
usualoma Jun 12, 2024
61d50f6
v4.5.0-rc.1
yusukebe Jun 12, 2024
42436bf
Merge branch 'main' into next
yusukebe Jun 27, 2024
936db9b
feat(jwt): Use Signed Cookie in JWT Middleware (#2989)
newarifrh Jun 27, 2024
37a10f4
feat(jsx): bump react compat version to 19.0.0-hono-jsx (#2963)
usualoma Jun 12, 2024
032070a
feat(jsx/dom): implement "<Context> as a provider" for compatibility …
usualoma Jun 13, 2024
4201a29
feat(jsx/dom): Compatible implementation of new features in React 19 …
usualoma Jun 21, 2024
afa44e9
feat(adaptor): Remove `unknown` from AddressType (#2958)
yasuaki640 Jun 27, 2024
5201c9f
Merge branch 'main' into next
yusukebe Jun 27, 2024
ebbaea9
Merge branch 'main' into next
yusukebe Jun 29, 2024
cb79f23
test(adapter/bun): fixed `conninfo.test.ts` (#3059)
yusukebe Jun 29, 2024
a8a84f3
feat(jsx/dom): skip calculate children if props are the same (#3049)
usualoma Jun 29, 2024
204e10b
feat(cloudflare-pages): Add Cloudflare Pages middleware handler (#3028)
BarryThePenguin Jun 29, 2024
f2908d6
v4.5.0-rc.2
yusukebe Jun 29, 2024
f393730
fix(cloudflare-pages): Expose Cloudflare Pages type parameters (#3065)
BarryThePenguin Jul 1, 2024
58f421f
Merge branch 'main' into next
yusukebe Jul 8, 2024
fa5b742
fix(helper/conninfo): add `undefined` for `AddressType` (#3112)
yusukebe Jul 8, 2024
71cdcf4
feat: Introduce IP Restriction Middleware (#2813)
nakasyou Jul 8, 2024
fbae337
fix(ip-restriction): return the named function (#3113)
yusukebe Jul 8, 2024
ce1c817
feat(vercel): add `getConnInfo` for vercel adapter (#3085)
promer94 Jul 8, 2024
74310f4
fix(vercel): remove deprecated address type (#3115)
ryuapp Jul 8, 2024
4a4e851
feat(lambda-edge): add `getConnInfo` helper for Lambda@Edge (#3099)
yasuaki640 Jul 11, 2024
c2698fa
feat: Introduce Service Worker Adapter (#3062)
nakasyou Jul 11, 2024
e6d253d
feat(middleware): introduce Request ID middleware (#3082)
ryuapp Jul 13, 2024
9a6e52d
feat(middleware/combine): Introduce combine middleware (#2941)
usualoma Jul 13, 2024
9987b59
Merge branch 'main' into next
yusukebe Jul 16, 2024
1cee728
feat(types): allow passing `interface`s as Bindings / Variables (#3136)
ottomated Jul 16, 2024
1afecac
chore: update comments in codes (#3145)
yusukebe Jul 16, 2024
024ec0f
fix(types): use `ContextVariableMap` in `Context<any>` (#3134)
yusukebe Jul 16, 2024
20d8771
feat(jsx): add global attributes to interface definition (#3142)
yasuaki640 Jul 16, 2024
c632511
fix(types): remove slow types (#3147)
yusukebe Jul 16, 2024
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
8 changes: 7 additions & 1 deletion jsr.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"./basic-auth": "./src/middleware/basic-auth/index.ts",
"./bearer-auth": "./src/middleware/bearer-auth/index.ts",
"./body-limit": "./src/middleware/body-limit/index.ts",
"./ip-restriction": "./src/middleware/ip-restriction/index.ts",
"./cache": "./src/middleware/cache/index.ts",
"./cookie": "./src/helper/cookie/index.ts",
"./accepts": "./src/helper/accepts/index.ts",
Expand All @@ -41,13 +42,16 @@
"./jsx/dom/jsx-runtime": "./src/jsx/dom/jsx-runtime.ts",
"./jsx/dom/client": "./src/jsx/dom/client.ts",
"./jsx/dom/css": "./src/jsx/dom/css.ts",
"./jsx/dom/server": "./src/jsx/dom/server.ts",
"./jwt": "./src/middleware/jwt/jwt.ts",
"./timing": "./src/middleware/timing/timing.ts",
"./logger": "./src/middleware/logger/index.ts",
"./method-override": "./src/middleware/method-override/index.ts",
"./powered-by": "./src/middleware/powered-by/index.ts",
"./pretty-json": "./src/middleware/pretty-json/index.ts",
"./request-id": "./src/middleware/request-id/request-id.ts",
"./secure-headers": "./src/middleware/secure-headers/secure-headers.ts",
"./combine": "./src/middleware/combine/index.ts",
"./ssg": "./src/helper/ssg/index.ts",
"./streaming": "./src/helper/streaming/index.ts",
"./validator": "./src/validator/index.ts",
Expand All @@ -69,6 +73,7 @@
"./vercel": "./src/adapter/vercel/index.ts",
"./netlify": "./src/adapter/netlify/index.ts",
"./lambda-edge": "./src/adapter/lambda-edge/index.ts",
"./service-worker": "./src/adapter/service-worker/index.ts",
"./testing": "./src/helper/testing/index.ts",
"./dev": "./src/helper/dev/index.ts",
"./ws": "./src/helper/websocket/index.ts",
Expand All @@ -92,7 +97,8 @@
"./utils/mime": "./src/utils/mime.ts",
"./utils/stream": "./src/utils/stream.ts",
"./utils/types": "./src/utils/types.ts",
"./utils/url": "./src/utils/url.ts"
"./utils/url": "./src/utils/url.ts",
"./utils/ipaddr": "./src/utils/ipaddr.ts"
},
"publish": {
"include": [
Expand Down
44 changes: 42 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hono",
"version": "4.4.13",
"version": "4.5.0-rc.2",
"description": "Web framework built on Web Standards",
"main": "dist/cjs/index.js",
"type": "module",
Expand Down Expand Up @@ -78,6 +78,11 @@
"import": "./dist/middleware/body-limit/index.js",
"require": "./dist/cjs/middleware/body-limit/index.js"
},
"./ip-restriction": {
"types": "./dist/types/middleware/ip-restriction/index.d.ts",
"import": "./dist/middleware/ip-restriction/index.js",
"require": "./dist/cjs/middleware/ip-restriction/index.js"
},
"./cache": {
"types": "./dist/types/middleware/cache/index.d.ts",
"import": "./dist/middleware/cache/index.js",
Expand Down Expand Up @@ -178,6 +183,11 @@
"import": "./dist/jsx/dom/css.js",
"require": "./dist/cjs/jsx/dom/css.js"
},
"./jsx/dom/server": {
"types": "./dist/types/jsx/dom/server.d.ts",
"import": "./dist/jsx/dom/server.js",
"require": "./dist/cjs/jsx/dom/server.js"
},
"./jwt": {
"types": "./dist/types/middleware/jwt/index.d.ts",
"import": "./dist/middleware/jwt/index.js",
Expand Down Expand Up @@ -213,11 +223,21 @@
"import": "./dist/middleware/pretty-json/index.js",
"require": "./dist/cjs/middleware/pretty-json/index.js"
},
"./request-id": {
"types": "./dist/types/middleware/request-id/index.d.ts",
"import": "./dist/middleware/request-id/index.js",
"require": "./dist/cjs/middleware/request-id/index.js"
},
"./secure-headers": {
"types": "./dist/types/middleware/secure-headers/index.d.ts",
"import": "./dist/middleware/secure-headers/index.js",
"require": "./dist/cjs/middleware/secure-headers/index.js"
},
"./combine": {
"types": "./dist/types/middleware/combine/index.d.ts",
"import": "./dist/middleware/combine/index.js",
"require": "./dist/cjs/middleware/combine/index.js"
},
"./ssg": {
"types": "./dist/types/helper/ssg/index.d.ts",
"import": "./dist/helper/ssg/index.js",
Expand Down Expand Up @@ -333,6 +353,11 @@
"import": "./dist/adapter/lambda-edge/index.js",
"require": "./dist/cjs/adapter/lambda-edge/index.js"
},
"./service-worker": {
"types": "./dist/types/adapter/service-worker/index.d.ts",
"import": "./dist/adapter/service-worker/index.js",
"require": "./dist/cjs/adapter/service-worker/index.js"
},
"./testing": {
"types": "./dist/types/helper/testing/index.d.ts",
"import": "./dist/helper/testing/index.js",
Expand Down Expand Up @@ -380,6 +405,9 @@
"body-limit": [
"./dist/types/middleware/body-limit"
],
"ip-restriction": [
"./dist/types/middleware/ip-restriction"
],
"cache": [
"./dist/types/middleware/cache"
],
Expand Down Expand Up @@ -434,6 +462,9 @@
"jsx/dom/css": [
"./dist/types/jsx/dom/css.d.ts"
],
"jsx/dom/server": [
"./dist/types/jsx/dom/server.d.ts"
],
"jwt": [
"./dist/types/middleware/jwt"
],
Expand All @@ -455,6 +486,9 @@
"pretty-json": [
"./dist/types/middleware/pretty-json"
],
"request-id": [
"./dist/types/middleware/request-id"
],
"streaming": [
"./dist/types/helper/streaming"
],
Expand All @@ -464,6 +498,9 @@
"secure-headers": [
"./dist/types/middleware/secure-headers"
],
"combine": [
"./dist/types/middleware/combine"
],
"validator": [
"./dist/types/validator/index.d.ts"
],
Expand Down Expand Up @@ -527,6 +564,9 @@
"lambda-edge": [
"./dist/types/adapter/lambda-edge"
],
"service-worker": [
"./dist/types/adapter/service-worker"
],
"testing": [
"./dist/types/helper/testing"
],
Expand Down Expand Up @@ -599,4 +639,4 @@
"engines": {
"node": ">=16.0.0"
}
}
}
3 changes: 2 additions & 1 deletion runtime_tests/deno-jsx/deno.precompile.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"jsxImportSource": "hono/jsx",
"lib": [
"deno.ns",
"dom"
"dom",
"dom.iterable"
]
},
"unstable": [
Expand Down
3 changes: 2 additions & 1 deletion runtime_tests/deno-jsx/deno.react-jsx.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"jsxImportSource": "hono/jsx",
"lib": [
"deno.ns",
"dom"
"dom",
"dom.iterable"
]
},
"unstable": [
Expand Down
23 changes: 19 additions & 4 deletions src/adapter/bun/conninfo.test.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import { Context } from '../../context'
import { getConnInfo } from './conninfo'
import type { AddressType } from '../../helper/conninfo'

const createRandomBunServer = () => {
const address = Math.random().toString()
const port = Math.floor(Math.random() * (65535 + 1))
const createRandomBunServer = ({
address = Math.random().toString(),
port = Math.floor(Math.random() * (65535 + 1)),
family = 'IPv6',
}: {
address?: string
port?: number
family?: AddressType | string
} = {}) => {
return {
address,
port,
server: {
requestIP() {
return {
address,
family: 'IPv6',
family,
port,
}
},
Expand Down Expand Up @@ -40,6 +47,14 @@ describe('getConnInfo', () => {
expect(info.remote.addressType).toBe('IPv6')
expect(info.remote.transport).toBeUndefined()
})
it('should return undefined when addressType is invalid string', () => {
const { server } = createRandomBunServer({ family: 'invalid' })
const c = new Context(new Request('http://localhost/'), { env: { server } })

const info = getConnInfo(c)

expect(info.remote.addressType).toBeUndefined()
})
it('Should throw error when user did not give server', () => {
const c = new Context(new Request('http://localhost/'), { env: {} })

Expand Down
2 changes: 1 addition & 1 deletion src/adapter/bun/conninfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const getConnInfo: GetConnInfo = (c: Context) => {
return {
remote: {
address: info.address,
addressType: info.family === 'IPv6' || info.family === 'IPv4' ? info.family : 'unknown',
addressType: info.family === 'IPv6' || info.family === 'IPv4' ? info.family : undefined,
port: info.port,
},
}
Expand Down
Loading