hono 4.7.9 → 4.7.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/cjs/hono-base.js +4 -1
- package/dist/cjs/middleware/etag/index.js +2 -1
- package/dist/cjs/utils/jwt/jwt.js +1 -1
- package/dist/hono-base.js +4 -1
- package/dist/middleware/etag/index.js +2 -1
- package/dist/types/helper/adapter/index.d.ts +1 -1
- package/dist/utils/jwt/jwt.js +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
[](https://github.com/honojs/hono/commits/main)
|
|
25
25
|
[](https://codecov.io/github/honojs/hono)
|
|
26
26
|
[](https://discord.gg/KMh2eNSdxV)
|
|
27
|
+
[](https://deepwiki.com/honojs/hono)
|
|
27
28
|
|
|
28
29
|
Hono - _**means flame🔥 in Japanese**_ - is a small, simple, and ultrafast web framework built on Web Standards. It works on any JavaScript runtime: Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, AWS Lambda, Lambda@Edge, and Node.js.
|
|
29
30
|
|
package/dist/cjs/hono-base.js
CHANGED
|
@@ -31,7 +31,8 @@ const notFoundHandler = (c) => {
|
|
|
31
31
|
};
|
|
32
32
|
const errorHandler = (err, c) => {
|
|
33
33
|
if ("getResponse" in err) {
|
|
34
|
-
|
|
34
|
+
const res = err.getResponse();
|
|
35
|
+
return c.newResponse(res.body, res);
|
|
35
36
|
}
|
|
36
37
|
console.error(err);
|
|
37
38
|
return c.text("Internal Server Error", 500);
|
|
@@ -98,6 +99,8 @@ class Hono {
|
|
|
98
99
|
router: this.router,
|
|
99
100
|
getPath: this.getPath
|
|
100
101
|
});
|
|
102
|
+
clone.errorHandler = this.errorHandler;
|
|
103
|
+
clone.#notFoundHandler = this.#notFoundHandler;
|
|
101
104
|
clone.routes = this.routes;
|
|
102
105
|
return clone;
|
|
103
106
|
}
|
|
@@ -31,8 +31,9 @@ const RETAINED_304_HEADERS = [
|
|
|
31
31
|
"expires",
|
|
32
32
|
"vary"
|
|
33
33
|
];
|
|
34
|
+
const stripWeak = (tag) => tag.replace(/^W\//, "");
|
|
34
35
|
function etagMatches(etag2, ifNoneMatch) {
|
|
35
|
-
return ifNoneMatch != null && ifNoneMatch.split(/,\s*/).
|
|
36
|
+
return ifNoneMatch != null && ifNoneMatch.split(/,\s*/).some((t) => stripWeak(t) === stripWeak(etag2));
|
|
36
37
|
}
|
|
37
38
|
function initializeGenerator(generator) {
|
|
38
39
|
if (!generator) {
|
|
@@ -119,7 +119,7 @@ const verifyFromJwks = async (token, options, init) => {
|
|
|
119
119
|
if (!matchingKey) {
|
|
120
120
|
throw new import_types.JwtTokenInvalid(token);
|
|
121
121
|
}
|
|
122
|
-
return await verify(token, matchingKey, matchingKey.alg);
|
|
122
|
+
return await verify(token, matchingKey, matchingKey.alg || header.alg);
|
|
123
123
|
};
|
|
124
124
|
const decode = (token) => {
|
|
125
125
|
try {
|
package/dist/hono-base.js
CHANGED
|
@@ -9,7 +9,8 @@ var notFoundHandler = (c) => {
|
|
|
9
9
|
};
|
|
10
10
|
var errorHandler = (err, c) => {
|
|
11
11
|
if ("getResponse" in err) {
|
|
12
|
-
|
|
12
|
+
const res = err.getResponse();
|
|
13
|
+
return c.newResponse(res.body, res);
|
|
13
14
|
}
|
|
14
15
|
console.error(err);
|
|
15
16
|
return c.text("Internal Server Error", 500);
|
|
@@ -76,6 +77,8 @@ var Hono = class {
|
|
|
76
77
|
router: this.router,
|
|
77
78
|
getPath: this.getPath
|
|
78
79
|
});
|
|
80
|
+
clone.errorHandler = this.errorHandler;
|
|
81
|
+
clone.#notFoundHandler = this.#notFoundHandler;
|
|
79
82
|
clone.routes = this.routes;
|
|
80
83
|
return clone;
|
|
81
84
|
}
|
|
@@ -8,8 +8,9 @@ var RETAINED_304_HEADERS = [
|
|
|
8
8
|
"expires",
|
|
9
9
|
"vary"
|
|
10
10
|
];
|
|
11
|
+
var stripWeak = (tag) => tag.replace(/^W\//, "");
|
|
11
12
|
function etagMatches(etag2, ifNoneMatch) {
|
|
12
|
-
return ifNoneMatch != null && ifNoneMatch.split(/,\s*/).
|
|
13
|
+
return ifNoneMatch != null && ifNoneMatch.split(/,\s*/).some((t) => stripWeak(t) === stripWeak(etag2));
|
|
13
14
|
}
|
|
14
15
|
function initializeGenerator(generator) {
|
|
15
16
|
if (!generator) {
|
|
@@ -6,7 +6,7 @@ import type { Context } from '../../context';
|
|
|
6
6
|
export type Runtime = "node" | "deno" | "bun" | "workerd" | "fastly" | "edge-light" | "other";
|
|
7
7
|
export declare const env: <T extends Record<string, unknown>, C extends Context = Context<{
|
|
8
8
|
Bindings: T;
|
|
9
|
-
}>>(c: T extends Record<string, unknown> ? Context : C, runtime?: Runtime) => T & C["env"];
|
|
9
|
+
}, any, {}>>(c: T extends Record<string, unknown> ? Context : C, runtime?: Runtime) => T & C["env"];
|
|
10
10
|
export declare const knownUserAgents: Partial<Record<Runtime, string>>;
|
|
11
11
|
export declare const getRuntimeKey: () => Runtime;
|
|
12
12
|
export declare const checkUserAgentEquals: (platform: string) => boolean;
|
package/dist/utils/jwt/jwt.js
CHANGED
|
@@ -100,7 +100,7 @@ var verifyFromJwks = async (token, options, init) => {
|
|
|
100
100
|
if (!matchingKey) {
|
|
101
101
|
throw new JwtTokenInvalid(token);
|
|
102
102
|
}
|
|
103
|
-
return await verify(token, matchingKey, matchingKey.alg);
|
|
103
|
+
return await verify(token, matchingKey, matchingKey.alg || header.alg);
|
|
104
104
|
};
|
|
105
105
|
var decode = (token) => {
|
|
106
106
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hono",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.11",
|
|
4
4
|
"description": "Web framework built on Web Standards",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -653,6 +653,7 @@
|
|
|
653
653
|
"@types/jsdom": "^21.1.7",
|
|
654
654
|
"@types/node": "20.11.4",
|
|
655
655
|
"@types/supertest": "^2.0.16",
|
|
656
|
+
"@typescript/native-preview": "7.0.0-dev.20250523.1",
|
|
656
657
|
"@vitest/coverage-v8": "^3.0.5",
|
|
657
658
|
"arg": "^5.0.2",
|
|
658
659
|
"bun-types": "^1.1.39",
|