hono 4.8.10 → 4.8.12
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/dist/adapter/service-worker/handler.js +1 -1
- package/dist/cjs/adapter/service-worker/handler.js +1 -1
- package/dist/cjs/router/reg-exp-router/node.js +3 -0
- package/dist/cjs/router/trie-router/node.js +2 -2
- package/dist/router/reg-exp-router/node.js +3 -0
- package/dist/router/trie-router/node.js +2 -2
- package/dist/types/context.d.ts +4 -4
- package/package.json +2 -2
|
@@ -27,7 +27,7 @@ const handle = (app, opts = {
|
|
|
27
27
|
return (evt) => {
|
|
28
28
|
evt.respondWith(
|
|
29
29
|
(async () => {
|
|
30
|
-
const res = await app.fetch(evt.request);
|
|
30
|
+
const res = await app.fetch(evt.request, evt);
|
|
31
31
|
if (opts.fetch && res.status === 404) {
|
|
32
32
|
return await opts.fetch(evt.request);
|
|
33
33
|
}
|
|
@@ -68,6 +68,9 @@ class Node {
|
|
|
68
68
|
const name = pattern[1];
|
|
69
69
|
let regexpStr = pattern[2] || LABEL_REG_EXP_STR;
|
|
70
70
|
if (name && pattern[2]) {
|
|
71
|
+
if (regexpStr === ".*") {
|
|
72
|
+
throw PATH_ERROR;
|
|
73
|
+
}
|
|
71
74
|
regexpStr = regexpStr.replace(/^\((?!\?:)(?=[^)]+\)$)/, "(?:");
|
|
72
75
|
if (/\((?!\?:)/.test(regexpStr)) {
|
|
73
76
|
throw PATH_ERROR;
|
|
@@ -133,10 +133,10 @@ class Node {
|
|
|
133
133
|
}
|
|
134
134
|
continue;
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
const [key, name, matcher] = pattern;
|
|
137
|
+
if (!part && !(matcher instanceof RegExp)) {
|
|
137
138
|
continue;
|
|
138
139
|
}
|
|
139
|
-
const [key, name, matcher] = pattern;
|
|
140
140
|
const child = node.#children[key];
|
|
141
141
|
const restPathString = parts.slice(i).join("/");
|
|
142
142
|
if (matcher instanceof RegExp) {
|
|
@@ -45,6 +45,9 @@ var Node = class {
|
|
|
45
45
|
const name = pattern[1];
|
|
46
46
|
let regexpStr = pattern[2] || LABEL_REG_EXP_STR;
|
|
47
47
|
if (name && pattern[2]) {
|
|
48
|
+
if (regexpStr === ".*") {
|
|
49
|
+
throw PATH_ERROR;
|
|
50
|
+
}
|
|
48
51
|
regexpStr = regexpStr.replace(/^\((?!\?:)(?=[^)]+\)$)/, "(?:");
|
|
49
52
|
if (/\((?!\?:)/.test(regexpStr)) {
|
|
50
53
|
throw PATH_ERROR;
|
|
@@ -111,10 +111,10 @@ var Node = class {
|
|
|
111
111
|
}
|
|
112
112
|
continue;
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
const [key, name, matcher] = pattern;
|
|
115
|
+
if (!part && !(matcher instanceof RegExp)) {
|
|
115
116
|
continue;
|
|
116
117
|
}
|
|
117
|
-
const [key, name, matcher] = pattern;
|
|
118
118
|
const child = node.#children[key];
|
|
119
119
|
const restPathString = parts.slice(i).join("/");
|
|
120
120
|
if (matcher instanceof RegExp) {
|
package/dist/types/context.d.ts
CHANGED
|
@@ -92,10 +92,10 @@ interface NewResponse {
|
|
|
92
92
|
* Interface for responding with a body.
|
|
93
93
|
*/
|
|
94
94
|
interface BodyRespond {
|
|
95
|
-
<U extends ContentfulStatusCode>(data:
|
|
96
|
-
<U extends
|
|
97
|
-
<U extends
|
|
98
|
-
<U extends StatusCode>(data:
|
|
95
|
+
<T extends Data, U extends ContentfulStatusCode>(data: T, status?: U, headers?: HeaderRecord): Response & TypedResponse<T, U, "body">;
|
|
96
|
+
<T extends Data, U extends ContentfulStatusCode>(data: T, init?: ResponseOrInit<U>): Response & TypedResponse<T, U, "body">;
|
|
97
|
+
<T extends null, U extends StatusCode>(data: T, status?: U, headers?: HeaderRecord): Response & TypedResponse<null, U, "body">;
|
|
98
|
+
<T extends null, U extends StatusCode>(data: T, init?: ResponseOrInit<U>): Response & TypedResponse<null, U, "body">;
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
101
|
* Interface for responding with text.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hono",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.12",
|
|
4
4
|
"description": "Web framework built on Web Standards",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -656,7 +656,7 @@
|
|
|
656
656
|
"nodejs"
|
|
657
657
|
],
|
|
658
658
|
"devDependencies": {
|
|
659
|
-
"@hono/eslint-config": "^
|
|
659
|
+
"@hono/eslint-config": "^2.0.3",
|
|
660
660
|
"@hono/node-server": "^1.13.5",
|
|
661
661
|
"@types/glob": "^8.1.0",
|
|
662
662
|
"@types/jsdom": "^21.1.7",
|