hono 3.12.2 → 3.12.4
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/lambda-edge/handler.js +2 -1
- package/dist/cjs/adapter/lambda-edge/handler.js +2 -1
- package/dist/cjs/context.js +11 -3
- package/dist/cjs/router/linear-router/router.js +5 -6
- package/dist/cjs/router/reg-exp-router/router.js +1 -4
- package/dist/cjs/router/trie-router/node.js +2 -2
- package/dist/context.js +11 -3
- package/dist/router/linear-router/router.js +5 -6
- package/dist/router/reg-exp-router/router.js +1 -4
- package/dist/router/trie-router/node.js +2 -2
- package/dist/types/client/index.d.ts +1 -1
- package/package.json +4 -4
package/dist/cjs/context.js
CHANGED
|
@@ -241,9 +241,17 @@ class Context {
|
|
|
241
241
|
__privateSet(this, _isFresh, false);
|
|
242
242
|
if (__privateGet(this, _res) && _res2) {
|
|
243
243
|
__privateGet(this, _res).headers.delete("content-type");
|
|
244
|
-
__privateGet(this, _res).headers.
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
for (const [k, v] of __privateGet(this, _res).headers.entries()) {
|
|
245
|
+
if (k === "set-cookie") {
|
|
246
|
+
const cookies = __privateGet(this, _res).headers.getSetCookie();
|
|
247
|
+
_res2.headers.delete("set-cookie");
|
|
248
|
+
for (const cookie of cookies) {
|
|
249
|
+
_res2.headers.append("set-cookie", cookie);
|
|
250
|
+
}
|
|
251
|
+
} else {
|
|
252
|
+
_res2.headers.set(k, v);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
247
255
|
}
|
|
248
256
|
__privateSet(this, _res, _res2);
|
|
249
257
|
this.finalized = true;
|
|
@@ -22,6 +22,7 @@ __export(router_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(router_exports);
|
|
24
24
|
var import_router = require("../../router");
|
|
25
|
+
var import_url = require("../../utils/url");
|
|
25
26
|
const emptyParams = {};
|
|
26
27
|
const splitPathRe = /\/(:\w+(?:{[^}]+})?)|\/[^\/\?]+|(\?)/g;
|
|
27
28
|
const splitByStarRe = /\*/;
|
|
@@ -31,12 +32,10 @@ class LinearRouter {
|
|
|
31
32
|
this.routes = [];
|
|
32
33
|
}
|
|
33
34
|
add(method, path, handler) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.routes.push([method,
|
|
37
|
-
}
|
|
38
|
-
this.routes.push([method, path, handler]);
|
|
39
|
-
}
|
|
35
|
+
;
|
|
36
|
+
((0, import_url.checkOptionalParameter)(path) || [path]).forEach((p) => {
|
|
37
|
+
this.routes.push([method, p, handler]);
|
|
38
|
+
});
|
|
40
39
|
}
|
|
41
40
|
match(method, path) {
|
|
42
41
|
const handlers = [];
|
|
@@ -167,10 +167,7 @@ class RegExpRouter {
|
|
|
167
167
|
(_a2 = routes[m])[path2] || (_a2[path2] = [
|
|
168
168
|
...findMiddleware(middleware[m], path2) || findMiddleware(middleware[import_router.METHOD_NAME_ALL], path2) || []
|
|
169
169
|
]);
|
|
170
|
-
routes[m][path2].push([
|
|
171
|
-
handler,
|
|
172
|
-
paths.length === 2 && i === 0 ? paramCount - 1 : paramCount
|
|
173
|
-
]);
|
|
170
|
+
routes[m][path2].push([handler, paramCount - len + i + 1]);
|
|
174
171
|
}
|
|
175
172
|
});
|
|
176
173
|
}
|
|
@@ -95,7 +95,6 @@ class Node {
|
|
|
95
95
|
}
|
|
96
96
|
search(method, path) {
|
|
97
97
|
const handlerSets = [];
|
|
98
|
-
const params = {};
|
|
99
98
|
this.params = {};
|
|
100
99
|
const curNode = this;
|
|
101
100
|
let curNodes = [curNode];
|
|
@@ -119,6 +118,7 @@ class Node {
|
|
|
119
118
|
}
|
|
120
119
|
}
|
|
121
120
|
for (let k = 0, len3 = node.patterns.length; k < len3; k++) {
|
|
121
|
+
const params = {};
|
|
122
122
|
const pattern = node.patterns[k];
|
|
123
123
|
if (pattern === "*") {
|
|
124
124
|
const astNode = node.children["*"];
|
|
@@ -161,7 +161,7 @@ class Node {
|
|
|
161
161
|
const results = handlerSets.sort((a, b) => {
|
|
162
162
|
return a.score - b.score;
|
|
163
163
|
});
|
|
164
|
-
return [results.map(({ handler, params
|
|
164
|
+
return [results.map(({ handler, params }) => [handler, params])];
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/context.js
CHANGED
|
@@ -219,9 +219,17 @@ var Context = class {
|
|
|
219
219
|
__privateSet(this, _isFresh, false);
|
|
220
220
|
if (__privateGet(this, _res) && _res2) {
|
|
221
221
|
__privateGet(this, _res).headers.delete("content-type");
|
|
222
|
-
__privateGet(this, _res).headers.
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
for (const [k, v] of __privateGet(this, _res).headers.entries()) {
|
|
223
|
+
if (k === "set-cookie") {
|
|
224
|
+
const cookies = __privateGet(this, _res).headers.getSetCookie();
|
|
225
|
+
_res2.headers.delete("set-cookie");
|
|
226
|
+
for (const cookie of cookies) {
|
|
227
|
+
_res2.headers.append("set-cookie", cookie);
|
|
228
|
+
}
|
|
229
|
+
} else {
|
|
230
|
+
_res2.headers.set(k, v);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
225
233
|
}
|
|
226
234
|
__privateSet(this, _res, _res2);
|
|
227
235
|
this.finalized = true;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/router/linear-router/router.ts
|
|
2
2
|
import { METHOD_NAME_ALL, UnsupportedPathError } from "../../router.js";
|
|
3
|
+
import { checkOptionalParameter } from "../../utils/url.js";
|
|
3
4
|
var emptyParams = {};
|
|
4
5
|
var splitPathRe = /\/(:\w+(?:{[^}]+})?)|\/[^\/\?]+|(\?)/g;
|
|
5
6
|
var splitByStarRe = /\*/;
|
|
@@ -9,12 +10,10 @@ var LinearRouter = class {
|
|
|
9
10
|
this.routes = [];
|
|
10
11
|
}
|
|
11
12
|
add(method, path, handler) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this.routes.push([method,
|
|
15
|
-
}
|
|
16
|
-
this.routes.push([method, path, handler]);
|
|
17
|
-
}
|
|
13
|
+
;
|
|
14
|
+
(checkOptionalParameter(path) || [path]).forEach((p) => {
|
|
15
|
+
this.routes.push([method, p, handler]);
|
|
16
|
+
});
|
|
18
17
|
}
|
|
19
18
|
match(method, path) {
|
|
20
19
|
const handlers = [];
|
|
@@ -150,10 +150,7 @@ var RegExpRouter = class {
|
|
|
150
150
|
(_a2 = routes[m])[path2] || (_a2[path2] = [
|
|
151
151
|
...findMiddleware(middleware[m], path2) || findMiddleware(middleware[METHOD_NAME_ALL], path2) || []
|
|
152
152
|
]);
|
|
153
|
-
routes[m][path2].push([
|
|
154
|
-
handler,
|
|
155
|
-
paths.length === 2 && i === 0 ? paramCount - 1 : paramCount
|
|
156
|
-
]);
|
|
153
|
+
routes[m][path2].push([handler, paramCount - len + i + 1]);
|
|
157
154
|
}
|
|
158
155
|
});
|
|
159
156
|
}
|
|
@@ -73,7 +73,6 @@ var Node = class {
|
|
|
73
73
|
}
|
|
74
74
|
search(method, path) {
|
|
75
75
|
const handlerSets = [];
|
|
76
|
-
const params = {};
|
|
77
76
|
this.params = {};
|
|
78
77
|
const curNode = this;
|
|
79
78
|
let curNodes = [curNode];
|
|
@@ -97,6 +96,7 @@ var Node = class {
|
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
98
|
for (let k = 0, len3 = node.patterns.length; k < len3; k++) {
|
|
99
|
+
const params = {};
|
|
100
100
|
const pattern = node.patterns[k];
|
|
101
101
|
if (pattern === "*") {
|
|
102
102
|
const astNode = node.children["*"];
|
|
@@ -139,7 +139,7 @@ var Node = class {
|
|
|
139
139
|
const results = handlerSets.sort((a, b) => {
|
|
140
140
|
return a.score - b.score;
|
|
141
141
|
});
|
|
142
|
-
return [results.map(({ handler, params
|
|
142
|
+
return [results.map(({ handler, params }) => [handler, params])];
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
145
|
export {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { hc } from './client';
|
|
2
|
-
export type { InferResponseType, InferRequestType, Fetch, ClientRequestOptions } from './types';
|
|
2
|
+
export type { InferResponseType, InferRequestType, Fetch, ClientRequestOptions, ClientRequest, ClientResponse, } from './types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hono",
|
|
3
|
-
"version": "3.12.
|
|
3
|
+
"version": "3.12.4",
|
|
4
4
|
"description": "Ultrafast web framework for the Edges",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"test:all": "yarn test && yarn test:deno && yarn test:bun && yarn test:fastly && yarn test:lagon && yarn test:node && yarn test:wrangler && yarn test:lambda && yarn test:lambda-edge",
|
|
23
23
|
"lint": "eslint --ext js,ts src runtime_tests",
|
|
24
24
|
"lint:fix": "eslint --ext js,ts src runtime_tests --fix",
|
|
25
|
-
"format": "prettier --check
|
|
26
|
-
"format:fix": "prettier --write
|
|
27
|
-
"denoify": "rimraf deno_dist && denoify && rimraf
|
|
25
|
+
"format": "prettier --check \"src/**/*.{js,ts}\" \"runtime_tests/**/*.{js,ts}\"",
|
|
26
|
+
"format:fix": "prettier --write \"src/**/*.{js,ts}\" \"runtime_tests/**/*.{js,ts}\"",
|
|
27
|
+
"denoify": "rimraf deno_dist && denoify && rimraf \"deno_dist/**/*.test.{ts,tsx}\"",
|
|
28
28
|
"copy:package.cjs.json": "cp ./package.cjs.json ./dist/cjs/package.json && cp ./package.cjs.json ./dist/types/package.json ",
|
|
29
29
|
"build": "rimraf dist && tsx ./build.ts && yarn copy:package.cjs.json",
|
|
30
30
|
"postbuild": "publint",
|