hono 4.13.5 → 4.13.6
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.
|
@@ -157,24 +157,24 @@ const hc = (baseUrl, options) => createProxy(function proxyCallback(opts) {
|
|
|
157
157
|
const path = parts.join("/");
|
|
158
158
|
const url = (0, import_utils.mergePath)(baseUrl, path);
|
|
159
159
|
if (method === "url" || method === "path") {
|
|
160
|
-
let result = url;
|
|
160
|
+
let result = (0, import_utils.removeIndexString)(url);
|
|
161
161
|
if (opts.args[0]) {
|
|
162
162
|
if (opts.args[0].param) {
|
|
163
|
-
result = (0, import_utils.replaceUrlParam)(
|
|
163
|
+
result = (0, import_utils.replaceUrlParam)(result, opts.args[0].param);
|
|
164
164
|
}
|
|
165
165
|
if (opts.args[0].query) {
|
|
166
166
|
result = appendQueryParams(result, buildSearchParamsOption(opts.args[0].query));
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
result = (0, import_utils.removeIndexString)(result);
|
|
170
169
|
if (method === "url") {
|
|
171
170
|
return new URL(result);
|
|
172
171
|
}
|
|
173
172
|
return result.slice(baseUrl.replace(/\/+$/, "").length).replace(/^\/?/, "/");
|
|
174
173
|
}
|
|
175
174
|
if (method === "ws") {
|
|
175
|
+
const normalizedUrl = (0, import_utils.removeIndexString)(url);
|
|
176
176
|
const webSocketUrl = (0, import_utils.replaceUrlProtocol)(
|
|
177
|
-
opts.args[0]?.param ? (0, import_utils.replaceUrlParam)(
|
|
177
|
+
opts.args[0]?.param ? (0, import_utils.replaceUrlParam)(normalizedUrl, opts.args[0].param) : normalizedUrl,
|
|
178
178
|
"ws"
|
|
179
179
|
);
|
|
180
180
|
const targetUrl = new URL(webSocketUrl);
|
package/dist/cjs/hono-base.js
CHANGED
|
@@ -61,13 +61,14 @@ class Hono {
|
|
|
61
61
|
const allMethods = [...import_router.METHODS, import_router.METHOD_NAME_ALL_LOWERCASE];
|
|
62
62
|
allMethods.forEach((method) => {
|
|
63
63
|
this[method] = (args1, ...args) => {
|
|
64
|
+
const methodName = method.toUpperCase();
|
|
64
65
|
if (typeof args1 === "string") {
|
|
65
66
|
this.#path = args1;
|
|
66
67
|
} else {
|
|
67
|
-
this.#addRoute(
|
|
68
|
+
this.#addRoute(methodName, this.#path, args1);
|
|
68
69
|
}
|
|
69
70
|
args.forEach((handler) => {
|
|
70
|
-
this.#addRoute(
|
|
71
|
+
this.#addRoute(methodName, this.#path, handler);
|
|
71
72
|
});
|
|
72
73
|
return this;
|
|
73
74
|
};
|
|
@@ -76,9 +77,10 @@ class Hono {
|
|
|
76
77
|
for (const p of [path].flat()) {
|
|
77
78
|
this.#path = p;
|
|
78
79
|
for (const m of [method].flat()) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
const methodName = m.toUpperCase();
|
|
81
|
+
for (const handler of handlers) {
|
|
82
|
+
this.#addRoute(methodName, this.#path, handler);
|
|
83
|
+
}
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
86
|
return this;
|
|
@@ -279,7 +281,6 @@ class Hono {
|
|
|
279
281
|
return this;
|
|
280
282
|
}
|
|
281
283
|
#addRoute(method, path, handler, baseRoutePath) {
|
|
282
|
-
method = method.toUpperCase();
|
|
283
284
|
path = (0, import_url.mergePath)(this._basePath, path);
|
|
284
285
|
const r = {
|
|
285
286
|
basePath: baseRoutePath !== void 0 ? (0, import_url.mergePath)(this._basePath, baseRoutePath) : this._basePath,
|
package/dist/client/client.js
CHANGED
|
@@ -143,24 +143,24 @@ var hc = (baseUrl, options) => createProxy(function proxyCallback(opts) {
|
|
|
143
143
|
const path = parts.join("/");
|
|
144
144
|
const url = mergePath(baseUrl, path);
|
|
145
145
|
if (method === "url" || method === "path") {
|
|
146
|
-
let result = url;
|
|
146
|
+
let result = removeIndexString(url);
|
|
147
147
|
if (opts.args[0]) {
|
|
148
148
|
if (opts.args[0].param) {
|
|
149
|
-
result = replaceUrlParam(
|
|
149
|
+
result = replaceUrlParam(result, opts.args[0].param);
|
|
150
150
|
}
|
|
151
151
|
if (opts.args[0].query) {
|
|
152
152
|
result = appendQueryParams(result, buildSearchParamsOption(opts.args[0].query));
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
result = removeIndexString(result);
|
|
156
155
|
if (method === "url") {
|
|
157
156
|
return new URL(result);
|
|
158
157
|
}
|
|
159
158
|
return result.slice(baseUrl.replace(/\/+$/, "").length).replace(/^\/?/, "/");
|
|
160
159
|
}
|
|
161
160
|
if (method === "ws") {
|
|
161
|
+
const normalizedUrl = removeIndexString(url);
|
|
162
162
|
const webSocketUrl = replaceUrlProtocol(
|
|
163
|
-
opts.args[0]?.param ? replaceUrlParam(
|
|
163
|
+
opts.args[0]?.param ? replaceUrlParam(normalizedUrl, opts.args[0].param) : normalizedUrl,
|
|
164
164
|
"ws"
|
|
165
165
|
);
|
|
166
166
|
const targetUrl = new URL(webSocketUrl);
|
package/dist/hono-base.js
CHANGED
|
@@ -40,13 +40,14 @@ var Hono = class _Hono {
|
|
|
40
40
|
const allMethods = [...METHODS, METHOD_NAME_ALL_LOWERCASE];
|
|
41
41
|
allMethods.forEach((method) => {
|
|
42
42
|
this[method] = (args1, ...args) => {
|
|
43
|
+
const methodName = method.toUpperCase();
|
|
43
44
|
if (typeof args1 === "string") {
|
|
44
45
|
this.#path = args1;
|
|
45
46
|
} else {
|
|
46
|
-
this.#addRoute(
|
|
47
|
+
this.#addRoute(methodName, this.#path, args1);
|
|
47
48
|
}
|
|
48
49
|
args.forEach((handler) => {
|
|
49
|
-
this.#addRoute(
|
|
50
|
+
this.#addRoute(methodName, this.#path, handler);
|
|
50
51
|
});
|
|
51
52
|
return this;
|
|
52
53
|
};
|
|
@@ -55,9 +56,10 @@ var Hono = class _Hono {
|
|
|
55
56
|
for (const p of [path].flat()) {
|
|
56
57
|
this.#path = p;
|
|
57
58
|
for (const m of [method].flat()) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
const methodName = m.toUpperCase();
|
|
60
|
+
for (const handler of handlers) {
|
|
61
|
+
this.#addRoute(methodName, this.#path, handler);
|
|
62
|
+
}
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
65
|
return this;
|
|
@@ -258,7 +260,6 @@ var Hono = class _Hono {
|
|
|
258
260
|
return this;
|
|
259
261
|
}
|
|
260
262
|
#addRoute(method, path, handler, baseRoutePath) {
|
|
261
|
-
method = method.toUpperCase();
|
|
262
263
|
path = mergePath(this._basePath, path);
|
|
263
264
|
const r = {
|
|
264
265
|
basePath: baseRoutePath !== void 0 ? mergePath(this._basePath, baseRoutePath) : this._basePath,
|
package/dist/types/context.d.ts
CHANGED
|
@@ -347,7 +347,7 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
|
|
|
347
347
|
* ```
|
|
348
348
|
*/
|
|
349
349
|
set: Set<IsAny<E> extends true ? {
|
|
350
|
-
Variables: ContextVariableMap & Record<
|
|
350
|
+
Variables: ContextVariableMap & Record<PropertyKey, any>;
|
|
351
351
|
} : E>;
|
|
352
352
|
/**
|
|
353
353
|
* `.get()` can use the value specified by the key.
|
|
@@ -363,7 +363,7 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
|
|
|
363
363
|
* ```
|
|
364
364
|
*/
|
|
365
365
|
get: Get<IsAny<E> extends true ? {
|
|
366
|
-
Variables: ContextVariableMap & Record<
|
|
366
|
+
Variables: ContextVariableMap & Record<PropertyKey, any>;
|
|
367
367
|
} : E>;
|
|
368
368
|
/**
|
|
369
369
|
* `.var` can access the value of a variable.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hono",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.6",
|
|
4
4
|
"description": "Web framework built on Web Standards",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -682,7 +682,7 @@
|
|
|
682
682
|
"@typescript/native-preview": "7.0.0-dev.20260210.1",
|
|
683
683
|
"@vitest/coverage-v8": "^4.1.7",
|
|
684
684
|
"bun-types": "^1.2.20",
|
|
685
|
-
"editorconfig-checker": "6.
|
|
685
|
+
"editorconfig-checker": "6.2.0",
|
|
686
686
|
"esbuild": "^0.27.1",
|
|
687
687
|
"eslint": "^9.39.3",
|
|
688
688
|
"jsdom": "22.1.0",
|