hono 4.12.4 → 4.12.5
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/aws-lambda/handler.js +1 -1
- package/dist/cjs/adapter/aws-lambda/handler.js +1 -1
- package/dist/cjs/jsx/streaming.js +13 -3
- package/dist/cjs/utils/jwt/jwt.js +11 -5
- package/dist/jsx/streaming.js +13 -3
- package/dist/types/adapter/aws-lambda/handler.d.ts +1 -1
- package/dist/types/request.d.ts +1 -1
- package/dist/utils/jwt/jwt.js +11 -5
- package/package.json +3 -3
|
@@ -137,7 +137,7 @@ var EventProcessor = class {
|
|
|
137
137
|
}
|
|
138
138
|
return result;
|
|
139
139
|
}
|
|
140
|
-
setCookies(
|
|
140
|
+
setCookies(_event, res, result) {
|
|
141
141
|
if (res.headers.has("set-cookie")) {
|
|
142
142
|
const cookies = res.headers.getSetCookie ? res.headers.getSetCookie() : Array.from(res.headers.entries()).filter(([k]) => k === "set-cookie").map(([, v]) => v);
|
|
143
143
|
if (Array.isArray(cookies)) {
|
|
@@ -168,7 +168,7 @@ class EventProcessor {
|
|
|
168
168
|
}
|
|
169
169
|
return result;
|
|
170
170
|
}
|
|
171
|
-
setCookies(
|
|
171
|
+
setCookies(_event, res, result) {
|
|
172
172
|
if (res.headers.has("set-cookie")) {
|
|
173
173
|
const cookies = res.headers.getSetCookie ? res.headers.getSetCookie() : Array.from(res.headers.entries()).filter(([k]) => k === "set-cookie").map(([, v]) => v);
|
|
174
174
|
if (Array.isArray(cookies)) {
|
|
@@ -113,6 +113,7 @@ d.replaceWith(c.content)
|
|
|
113
113
|
Suspense[import_constants.DOM_RENDERER] = import_components2.Suspense;
|
|
114
114
|
const textEncoder = new TextEncoder();
|
|
115
115
|
const renderToReadableStream = (content, onError = console.trace) => {
|
|
116
|
+
let cancelled = false;
|
|
116
117
|
const reader = new ReadableStream({
|
|
117
118
|
async start(controller) {
|
|
118
119
|
try {
|
|
@@ -126,7 +127,9 @@ const renderToReadableStream = (content, onError = console.trace) => {
|
|
|
126
127
|
true,
|
|
127
128
|
context
|
|
128
129
|
);
|
|
129
|
-
|
|
130
|
+
if (!cancelled) {
|
|
131
|
+
controller.enqueue(textEncoder.encode(resolved));
|
|
132
|
+
}
|
|
130
133
|
let resolvedCount = 0;
|
|
131
134
|
const callbacks = [];
|
|
132
135
|
const then = (promise) => {
|
|
@@ -144,7 +147,9 @@ const renderToReadableStream = (content, onError = console.trace) => {
|
|
|
144
147
|
);
|
|
145
148
|
res.callbacks?.map((c) => c({ phase: import_html2.HtmlEscapedCallbackPhase.Stream, context })).filter(Boolean).forEach(then);
|
|
146
149
|
resolvedCount++;
|
|
147
|
-
|
|
150
|
+
if (!cancelled) {
|
|
151
|
+
controller.enqueue(textEncoder.encode(res));
|
|
152
|
+
}
|
|
148
153
|
})
|
|
149
154
|
);
|
|
150
155
|
};
|
|
@@ -155,7 +160,12 @@ const renderToReadableStream = (content, onError = console.trace) => {
|
|
|
155
160
|
} catch (e) {
|
|
156
161
|
onError(e);
|
|
157
162
|
}
|
|
158
|
-
|
|
163
|
+
if (!cancelled) {
|
|
164
|
+
controller.close();
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
cancel() {
|
|
168
|
+
cancelled = true;
|
|
159
169
|
}
|
|
160
170
|
});
|
|
161
171
|
return reader;
|
|
@@ -177,10 +177,13 @@ const verifyWithJwks = async (token, options, init) => {
|
|
|
177
177
|
});
|
|
178
178
|
};
|
|
179
179
|
const decode = (token) => {
|
|
180
|
+
const parts = token.split(".");
|
|
181
|
+
if (parts.length !== 3) {
|
|
182
|
+
throw new import_types.JwtTokenInvalid(token);
|
|
183
|
+
}
|
|
180
184
|
try {
|
|
181
|
-
const
|
|
182
|
-
const
|
|
183
|
-
const payload = decodeJwtPart(p);
|
|
185
|
+
const header = decodeJwtPart(parts[0]);
|
|
186
|
+
const payload = decodeJwtPart(parts[1]);
|
|
184
187
|
return {
|
|
185
188
|
header,
|
|
186
189
|
payload
|
|
@@ -190,9 +193,12 @@ const decode = (token) => {
|
|
|
190
193
|
}
|
|
191
194
|
};
|
|
192
195
|
const decodeHeader = (token) => {
|
|
196
|
+
const parts = token.split(".");
|
|
197
|
+
if (parts.length !== 3) {
|
|
198
|
+
throw new import_types.JwtTokenInvalid(token);
|
|
199
|
+
}
|
|
193
200
|
try {
|
|
194
|
-
|
|
195
|
-
return decodeJwtPart(h);
|
|
201
|
+
return decodeJwtPart(parts[0]);
|
|
196
202
|
} catch {
|
|
197
203
|
throw new import_types.JwtTokenInvalid(token);
|
|
198
204
|
}
|
package/dist/jsx/streaming.js
CHANGED
|
@@ -89,6 +89,7 @@ d.replaceWith(c.content)
|
|
|
89
89
|
Suspense[DOM_RENDERER] = SuspenseDomRenderer;
|
|
90
90
|
var textEncoder = new TextEncoder();
|
|
91
91
|
var renderToReadableStream = (content, onError = console.trace) => {
|
|
92
|
+
let cancelled = false;
|
|
92
93
|
const reader = new ReadableStream({
|
|
93
94
|
async start(controller) {
|
|
94
95
|
try {
|
|
@@ -102,7 +103,9 @@ var renderToReadableStream = (content, onError = console.trace) => {
|
|
|
102
103
|
true,
|
|
103
104
|
context
|
|
104
105
|
);
|
|
105
|
-
|
|
106
|
+
if (!cancelled) {
|
|
107
|
+
controller.enqueue(textEncoder.encode(resolved));
|
|
108
|
+
}
|
|
106
109
|
let resolvedCount = 0;
|
|
107
110
|
const callbacks = [];
|
|
108
111
|
const then = (promise) => {
|
|
@@ -120,7 +123,9 @@ var renderToReadableStream = (content, onError = console.trace) => {
|
|
|
120
123
|
);
|
|
121
124
|
res.callbacks?.map((c) => c({ phase: HtmlEscapedCallbackPhase.Stream, context })).filter(Boolean).forEach(then);
|
|
122
125
|
resolvedCount++;
|
|
123
|
-
|
|
126
|
+
if (!cancelled) {
|
|
127
|
+
controller.enqueue(textEncoder.encode(res));
|
|
128
|
+
}
|
|
124
129
|
})
|
|
125
130
|
);
|
|
126
131
|
};
|
|
@@ -131,7 +136,12 @@ var renderToReadableStream = (content, onError = console.trace) => {
|
|
|
131
136
|
} catch (e) {
|
|
132
137
|
onError(e);
|
|
133
138
|
}
|
|
134
|
-
|
|
139
|
+
if (!cancelled) {
|
|
140
|
+
controller.close();
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
cancel() {
|
|
144
|
+
cancelled = true;
|
|
135
145
|
}
|
|
136
146
|
});
|
|
137
147
|
return reader;
|
|
@@ -138,7 +138,7 @@ export declare abstract class EventProcessor<E extends LambdaEvent> {
|
|
|
138
138
|
protected getDomainName(event: E): string | undefined;
|
|
139
139
|
createRequest(event: E): Request;
|
|
140
140
|
createResult(event: E, res: Response, options: Pick<HandleOptions, 'isContentTypeBinary'>): Promise<APIGatewayProxyResult>;
|
|
141
|
-
setCookies(
|
|
141
|
+
setCookies(_event: E, res: Response, result: APIGatewayProxyResult): void;
|
|
142
142
|
}
|
|
143
143
|
export declare class EventV2Processor extends EventProcessor<APIGatewayProxyEventV2> {
|
|
144
144
|
protected getPath(event: APIGatewayProxyEventV2): string;
|
package/dist/types/request.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
|
|
|
59
59
|
* const { id, comment_id } = c.req.param()
|
|
60
60
|
* ```
|
|
61
61
|
*/
|
|
62
|
-
param<P2 extends ParamKeys<P> = ParamKeys<P>>(key: P2 extends `${infer _}?` ? never : P2): string;
|
|
62
|
+
param<P2 extends ParamKeys<P> = ParamKeys<P>>(key: string extends P ? never : P2 extends `${infer _}?` ? never : P2): string;
|
|
63
63
|
param<P2 extends RemoveQuestion<ParamKeys<P>> = RemoveQuestion<ParamKeys<P>>>(key: P2): string | undefined;
|
|
64
64
|
param(key: string): string | undefined;
|
|
65
65
|
param<P2 extends string = P>(): Simplify<UnionToIntersection<ParamKeyToRecord<ParamKeys<P2>>>>;
|
package/dist/utils/jwt/jwt.js
CHANGED
|
@@ -165,10 +165,13 @@ var verifyWithJwks = async (token, options, init) => {
|
|
|
165
165
|
});
|
|
166
166
|
};
|
|
167
167
|
var decode = (token) => {
|
|
168
|
+
const parts = token.split(".");
|
|
169
|
+
if (parts.length !== 3) {
|
|
170
|
+
throw new JwtTokenInvalid(token);
|
|
171
|
+
}
|
|
168
172
|
try {
|
|
169
|
-
const
|
|
170
|
-
const
|
|
171
|
-
const payload = decodeJwtPart(p);
|
|
173
|
+
const header = decodeJwtPart(parts[0]);
|
|
174
|
+
const payload = decodeJwtPart(parts[1]);
|
|
172
175
|
return {
|
|
173
176
|
header,
|
|
174
177
|
payload
|
|
@@ -178,9 +181,12 @@ var decode = (token) => {
|
|
|
178
181
|
}
|
|
179
182
|
};
|
|
180
183
|
var decodeHeader = (token) => {
|
|
184
|
+
const parts = token.split(".");
|
|
185
|
+
if (parts.length !== 3) {
|
|
186
|
+
throw new JwtTokenInvalid(token);
|
|
187
|
+
}
|
|
181
188
|
try {
|
|
182
|
-
|
|
183
|
-
return decodeJwtPart(h);
|
|
189
|
+
return decodeJwtPart(parts[0]);
|
|
184
190
|
} catch {
|
|
185
191
|
throw new JwtTokenInvalid(token);
|
|
186
192
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hono",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.5",
|
|
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": "^2.0
|
|
659
|
+
"@hono/eslint-config": "^2.1.0",
|
|
660
660
|
"@hono/node-server": "^1.13.5",
|
|
661
661
|
"@types/glob": "^9.0.0",
|
|
662
662
|
"@types/jsdom": "^21.1.7",
|
|
@@ -667,7 +667,7 @@
|
|
|
667
667
|
"bun-types": "^1.2.20",
|
|
668
668
|
"editorconfig-checker": "6.1.1",
|
|
669
669
|
"esbuild": "^0.27.1",
|
|
670
|
-
"eslint": "9.39.
|
|
670
|
+
"eslint": "^9.39.3",
|
|
671
671
|
"glob": "^11.0.0",
|
|
672
672
|
"jsdom": "22.1.0",
|
|
673
673
|
"msw": "^2.6.0",
|