hono 4.8.11 → 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/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/helper/adapter/index.d.ts +1 -1
- package/dist/types/request.d.ts +5 -0
- package/package.json +1 -1
|
@@ -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) {
|
|
@@ -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
|
-
}
|
|
9
|
+
}>>(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/types/request.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GET_MATCH_RESULT } from './request/constants';
|
|
1
2
|
import type { Result } from './router';
|
|
2
3
|
import type { Input, InputToDataByTarget, ParamKeyToRecord, ParamKeys, RemoveQuestion, RouterRoute, ValidationTargets } from './types';
|
|
3
4
|
import type { BodyData, ParseBodyOptions } from './utils/body';
|
|
@@ -14,6 +15,10 @@ type BodyCache = Partial<Body & {
|
|
|
14
15
|
parsedBody: BodyData;
|
|
15
16
|
}>;
|
|
16
17
|
export declare class HonoRequest<P extends string = "/", I extends Input["out"] = {}> {
|
|
18
|
+
[GET_MATCH_RESULT]: Result<[
|
|
19
|
+
unknown,
|
|
20
|
+
RouterRoute
|
|
21
|
+
]>;
|
|
17
22
|
/**
|
|
18
23
|
* `.raw` can get the raw Request object.
|
|
19
24
|
*
|