hono 4.4.10 → 4.4.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.
Files changed (44) hide show
  1. package/dist/adapter/aws-lambda/handler.js +1 -1
  2. package/dist/cjs/adapter/aws-lambda/handler.js +1 -1
  3. package/dist/cjs/client/client.js +6 -2
  4. package/dist/cjs/helper/streaming/sse.js +3 -1
  5. package/dist/cjs/helper/streaming/stream.js +3 -1
  6. package/dist/cjs/jsx/base.js +1 -0
  7. package/dist/cjs/utils/stream.js +2 -0
  8. package/dist/cjs/validator/validator.js +25 -24
  9. package/dist/client/client.js +6 -2
  10. package/dist/helper/streaming/sse.js +3 -1
  11. package/dist/helper/streaming/stream.js +3 -1
  12. package/dist/jsx/base.js +1 -0
  13. package/dist/types/context.d.ts +20 -20
  14. package/dist/types/hono-base.d.ts +11 -11
  15. package/dist/types/http-exception.d.ts +1 -1
  16. package/dist/types/jsx/intrinsic-elements.d.ts +2 -2
  17. package/dist/types/middleware/basic-auth/index.d.ts +1 -1
  18. package/dist/types/middleware/bearer-auth/index.d.ts +1 -1
  19. package/dist/types/middleware/body-limit/index.d.ts +1 -1
  20. package/dist/types/middleware/cache/index.d.ts +1 -1
  21. package/dist/types/middleware/compress/index.d.ts +1 -1
  22. package/dist/types/middleware/cors/index.d.ts +1 -1
  23. package/dist/types/middleware/csrf/index.d.ts +1 -1
  24. package/dist/types/middleware/etag/index.d.ts +1 -1
  25. package/dist/types/middleware/jsx-renderer/index.d.ts +1 -1
  26. package/dist/types/middleware/jwt/jwt.d.ts +1 -1
  27. package/dist/types/middleware/logger/index.d.ts +1 -1
  28. package/dist/types/middleware/method-override/index.d.ts +1 -1
  29. package/dist/types/middleware/pretty-json/index.d.ts +1 -1
  30. package/dist/types/middleware/secure-headers/secure-headers.d.ts +1 -1
  31. package/dist/types/middleware/timing/timing.d.ts +1 -1
  32. package/dist/types/middleware/trailing-slash/index.d.ts +2 -2
  33. package/dist/types/request.d.ts +17 -17
  34. package/dist/types/types.d.ts +86 -27
  35. package/dist/types/utils/jwt/jwa.d.ts +5 -0
  36. package/dist/types/utils/jwt/jws.d.ts +5 -0
  37. package/dist/types/utils/jwt/jwt.d.ts +5 -0
  38. package/dist/types/utils/jwt/types.d.ts +4 -0
  39. package/dist/types/utils/jwt/utf8.d.ts +4 -0
  40. package/dist/types/utils/stream.d.ts +4 -0
  41. package/dist/types/utils/types.d.ts +15 -3
  42. package/dist/utils/stream.js +2 -0
  43. package/dist/validator/validator.js +25 -24
  44. package/package.json +1 -1
@@ -111,7 +111,7 @@ var EventProcessor = class {
111
111
  }
112
112
  setCookies(event, res, result) {
113
113
  if (res.headers.has("set-cookie")) {
114
- const cookies = res.headers.get("set-cookie")?.split(", ");
114
+ const cookies = res.headers.getSetCookie ? res.headers.getSetCookie() : Array.from(res.headers.entries()).filter(([k]) => k === "set-cookie").map(([, v]) => v);
115
115
  if (Array.isArray(cookies)) {
116
116
  this.setCookiesToResult(event, result, cookies);
117
117
  res.headers.delete("set-cookie");
@@ -143,7 +143,7 @@ class EventProcessor {
143
143
  }
144
144
  setCookies(event, res, result) {
145
145
  if (res.headers.has("set-cookie")) {
146
- const cookies = res.headers.get("set-cookie")?.split(", ");
146
+ const cookies = res.headers.getSetCookie ? res.headers.getSetCookie() : Array.from(res.headers.entries()).filter(([k]) => k === "set-cookie").map(([, v]) => v);
147
147
  if (Array.isArray(cookies)) {
148
148
  this.setCookiesToResult(event, result, cookies);
149
149
  res.headers.delete("set-cookie");
@@ -152,11 +152,15 @@ const hc = (baseUrl, options) => createProxy(function proxyCallback(opts) {
152
152
  return new URL(url);
153
153
  }
154
154
  if (method === "ws") {
155
- const targetUrl = (0, import_utils.replaceUrlProtocol)(
155
+ const webSocketUrl = (0, import_utils.replaceUrlProtocol)(
156
156
  opts.args[0] && opts.args[0].param ? (0, import_utils.replaceUrlParam)(url, opts.args[0].param) : url,
157
157
  "ws"
158
158
  );
159
- return new WebSocket(targetUrl);
159
+ const targetUrl = new URL(webSocketUrl);
160
+ for (const key in opts.args[0]?.query) {
161
+ targetUrl.searchParams.set(key, opts.args[0].query[key]);
162
+ }
163
+ return new WebSocket(targetUrl.toString());
160
164
  }
161
165
  const req = new ClientRequestImpl(url, method);
162
166
  if (method) {
@@ -62,7 +62,9 @@ const streamSSE = (c, cb, onError) => {
62
62
  const { readable, writable } = new TransformStream();
63
63
  const stream = new SSEStreamingApi(writable, readable);
64
64
  c.req.raw.signal.addEventListener("abort", () => {
65
- stream.abort();
65
+ if (!stream.closed) {
66
+ stream.abort();
67
+ }
66
68
  });
67
69
  contextStash.set(stream.responseReadable, c);
68
70
  c.header("Transfer-Encoding", "chunked");
@@ -27,7 +27,9 @@ const stream = (c, cb, onError) => {
27
27
  const { readable, writable } = new TransformStream();
28
28
  const stream2 = new import_stream.StreamingApi(writable, readable);
29
29
  c.req.raw.signal.addEventListener("abort", () => {
30
- stream2.abort();
30
+ if (!stream2.closed) {
31
+ stream2.abort();
32
+ }
31
33
  });
32
34
  contextStash.set(stream2.responseReadable, c);
33
35
  (async () => {
@@ -60,6 +60,7 @@ const booleanAttributes = [
60
60
  "default",
61
61
  "defer",
62
62
  "disabled",
63
+ "download",
63
64
  "formnovalidate",
64
65
  "hidden",
65
66
  "inert",
@@ -28,6 +28,7 @@ class StreamingApi {
28
28
  abortSubscribers = [];
29
29
  responseReadable;
30
30
  aborted = false;
31
+ closed = false;
31
32
  constructor(writable, _readable) {
32
33
  this.writable = writable;
33
34
  this.writer = writable.getWriter();
@@ -68,6 +69,7 @@ class StreamingApi {
68
69
  await this.writer.close();
69
70
  } catch (e) {
70
71
  }
72
+ this.closed = true;
71
73
  }
72
74
  async pipe(body) {
73
75
  this.writer.releaseLock();
@@ -45,33 +45,34 @@ const validator = (target, validationFunc) => {
45
45
  if (!contentType) {
46
46
  break;
47
47
  }
48
+ let formData;
48
49
  if (c.req.bodyCache.formData) {
49
- value = await c.req.bodyCache.formData;
50
- break;
50
+ formData = await c.req.bodyCache.formData;
51
+ } else {
52
+ try {
53
+ const arrayBuffer = await c.req.arrayBuffer();
54
+ formData = await (0, import_buffer.bufferToFormData)(arrayBuffer, contentType);
55
+ c.req.bodyCache.formData = formData;
56
+ } catch (e) {
57
+ let message = "Malformed FormData request.";
58
+ message += e instanceof Error ? ` ${e.message}` : ` ${String(e)}`;
59
+ throw new import_http_exception.HTTPException(400, { message });
60
+ }
51
61
  }
52
- try {
53
- const arrayBuffer = await c.req.arrayBuffer();
54
- const formData = await (0, import_buffer.bufferToFormData)(arrayBuffer, contentType);
55
- const form = {};
56
- formData.forEach((value2, key) => {
57
- if (key.endsWith("[]")) {
58
- if (form[key] === void 0) {
59
- form[key] = [value2];
60
- } else if (Array.isArray(form[key])) {
61
- ;
62
- form[key].push(value2);
63
- }
64
- } else {
65
- form[key] = value2;
62
+ const form = {};
63
+ formData.forEach((value2, key) => {
64
+ if (key.endsWith("[]")) {
65
+ if (form[key] === void 0) {
66
+ form[key] = [value2];
67
+ } else if (Array.isArray(form[key])) {
68
+ ;
69
+ form[key].push(value2);
66
70
  }
67
- });
68
- value = form;
69
- c.req.bodyCache.formData = formData;
70
- } catch (e) {
71
- let message = "Malformed FormData request.";
72
- message += e instanceof Error ? ` ${e.message}` : ` ${String(e)}`;
73
- throw new import_http_exception.HTTPException(400, { message });
74
- }
71
+ } else {
72
+ form[key] = value2;
73
+ }
74
+ });
75
+ value = form;
75
76
  break;
76
77
  }
77
78
  case "query":
@@ -136,11 +136,15 @@ var hc = (baseUrl, options) => createProxy(function proxyCallback(opts) {
136
136
  return new URL(url);
137
137
  }
138
138
  if (method === "ws") {
139
- const targetUrl = replaceUrlProtocol(
139
+ const webSocketUrl = replaceUrlProtocol(
140
140
  opts.args[0] && opts.args[0].param ? replaceUrlParam(url, opts.args[0].param) : url,
141
141
  "ws"
142
142
  );
143
- return new WebSocket(targetUrl);
143
+ const targetUrl = new URL(webSocketUrl);
144
+ for (const key in opts.args[0]?.query) {
145
+ targetUrl.searchParams.set(key, opts.args[0].query[key]);
146
+ }
147
+ return new WebSocket(targetUrl.toString());
144
148
  }
145
149
  const req = new ClientRequestImpl(url, method);
146
150
  if (method) {
@@ -39,7 +39,9 @@ var streamSSE = (c, cb, onError) => {
39
39
  const { readable, writable } = new TransformStream();
40
40
  const stream = new SSEStreamingApi(writable, readable);
41
41
  c.req.raw.signal.addEventListener("abort", () => {
42
- stream.abort();
42
+ if (!stream.closed) {
43
+ stream.abort();
44
+ }
43
45
  });
44
46
  contextStash.set(stream.responseReadable, c);
45
47
  c.header("Transfer-Encoding", "chunked");
@@ -5,7 +5,9 @@ var stream = (c, cb, onError) => {
5
5
  const { readable, writable } = new TransformStream();
6
6
  const stream2 = new StreamingApi(writable, readable);
7
7
  c.req.raw.signal.addEventListener("abort", () => {
8
- stream2.abort();
8
+ if (!stream2.closed) {
9
+ stream2.abort();
10
+ }
9
11
  });
10
12
  contextStash.set(stream2.responseReadable, c);
11
13
  (async () => {
package/dist/jsx/base.js CHANGED
@@ -30,6 +30,7 @@ var booleanAttributes = [
30
30
  "default",
31
31
  "defer",
32
32
  "disabled",
33
+ "download",
33
34
  "formnovalidate",
34
35
  "hidden",
35
36
  "inert",
@@ -2,7 +2,7 @@ import { HonoRequest } from './request';
2
2
  import type { Result } from './router';
3
3
  import type { Env, FetchEventLike, H, Input, NotFoundHandler, RouterRoute, TypedResponse } from './types';
4
4
  import type { RedirectStatusCode, StatusCode } from './utils/http-status';
5
- import type { IsAny, JSONParsed, JSONValue, SimplifyDeepArray } from './utils/types';
5
+ import type { InvalidJSONValue, IsAny, JSONParsed, JSONValue, SimplifyDeepArray } from './utils/types';
6
6
  type HeaderRecord = Record<string, string | string[]>;
7
7
  /**
8
8
  * Data type can be a string, ArrayBuffer, or ReadableStream.
@@ -113,8 +113,8 @@ interface TextRespond {
113
113
  * @returns {JSONRespondReturn<T, U>} - The response after rendering the JSON object, typed with the provided object and status code types.
114
114
  */
115
115
  interface JSONRespond {
116
- <T extends JSONValue | SimplifyDeepArray<unknown>, U extends StatusCode = StatusCode>(object: T, status?: U, headers?: HeaderRecord): JSONRespondReturn<T, U>;
117
- <T extends JSONValue | SimplifyDeepArray<unknown>, U extends StatusCode = StatusCode>(object: T, init?: ResponseInit): JSONRespondReturn<T, U>;
116
+ <T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode = StatusCode>(object: T, status?: U, headers?: HeaderRecord): JSONRespondReturn<T, U>;
117
+ <T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode = StatusCode>(object: T, init?: ResponseInit): JSONRespondReturn<T, U>;
118
118
  }
119
119
  /**
120
120
  * @template T - The type of the JSON value or simplified unknown type.
@@ -122,7 +122,7 @@ interface JSONRespond {
122
122
  *
123
123
  * @returns {Response & TypedResponse<SimplifyDeepArray<T> extends JSONValue ? (JSONValue extends SimplifyDeepArray<T> ? never : JSONParsed<T>) : never, U, 'json'>} - The response after rendering the JSON object, typed with the provided object and status code types.
124
124
  */
125
- type JSONRespondReturn<T extends JSONValue | SimplifyDeepArray<unknown>, U extends StatusCode> = Response & TypedResponse<SimplifyDeepArray<T> extends JSONValue ? JSONValue extends SimplifyDeepArray<T> ? never : JSONParsed<T> : never, U, 'json'>;
125
+ type JSONRespondReturn<T extends JSONValue | SimplifyDeepArray<unknown> | InvalidJSONValue, U extends StatusCode> = Response & TypedResponse<SimplifyDeepArray<T> extends JSONValue ? JSONValue extends SimplifyDeepArray<T> ? never : JSONParsed<T> : JSONParsed<T>, U, 'json'>;
126
126
  /**
127
127
  * Interface representing a function that responds with HTML content.
128
128
  *
@@ -164,7 +164,7 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
164
164
  /**
165
165
  * `.env` can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.
166
166
  *
167
- * @see {@link https://hono.dev/api/context#env}
167
+ * @see {@link https://hono.dev/docs/api/context#env}
168
168
  *
169
169
  * @example
170
170
  * ```ts
@@ -179,7 +179,7 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
179
179
  /**
180
180
  * `.error` can get the error object from the middleware if the Handler throws an error.
181
181
  *
182
- * @see {@link https://hono.dev/api/context#error}
182
+ * @see {@link https://hono.dev/docs/api/context#error}
183
183
  *
184
184
  * @example
185
185
  * ```ts
@@ -204,21 +204,21 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
204
204
  */
205
205
  get req(): HonoRequest<P, I['out']>;
206
206
  /**
207
- * @see {@link https://hono.dev/api/context#event}
207
+ * @see {@link https://hono.dev/docs/api/context#event}
208
208
  * The FetchEvent associated with the current request.
209
209
  *
210
210
  * @throws Will throw an error if the context does not have a FetchEvent.
211
211
  */
212
212
  get event(): FetchEventLike;
213
213
  /**
214
- * @see {@link https://hono.dev/api/context#executionctx}
214
+ * @see {@link https://hono.dev/docs/api/context#executionctx}
215
215
  * The ExecutionContext associated with the current request.
216
216
  *
217
217
  * @throws Will throw an error if the context does not have an ExecutionContext.
218
218
  */
219
219
  get executionCtx(): ExecutionContext;
220
220
  /**
221
- * @see {@link https://hono.dev/api/context#res}
221
+ * @see {@link https://hono.dev/docs/api/context#res}
222
222
  * The Response object for the current request.
223
223
  */
224
224
  get res(): Response;
@@ -231,7 +231,7 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
231
231
  /**
232
232
  * `.render()` can create a response within a layout.
233
233
  *
234
- * @see {@link https://hono.dev/api/context#render-setrenderer}
234
+ * @see {@link https://hono.dev/docs/api/context#render-setrenderer}
235
235
  *
236
236
  * @example
237
237
  * ```ts
@@ -263,7 +263,7 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
263
263
  /**
264
264
  * `.setRenderer()` can set the layout in the custom middleware.
265
265
  *
266
- * @see {@link https://hono.dev/api/context#render-setrenderer}
266
+ * @see {@link https://hono.dev/docs/api/context#render-setrenderer}
267
267
  *
268
268
  * @example
269
269
  * ```tsx
@@ -285,7 +285,7 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
285
285
  /**
286
286
  * `.header()` can set headers.
287
287
  *
288
- * @see {@link https://hono.dev/api/context#body}
288
+ * @see {@link https://hono.dev/docs/api/context#body}
289
289
  *
290
290
  * @example
291
291
  * ```ts
@@ -305,7 +305,7 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
305
305
  /**
306
306
  * `.set()` can set the value specified by the key.
307
307
  *
308
- * @see {@link https://hono.dev/api/context#set-get}
308
+ * @see {@link https://hono.dev/docs/api/context#set-get}
309
309
  *
310
310
  * @example
311
311
  * ```ts
@@ -320,7 +320,7 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
320
320
  /**
321
321
  * `.get()` can use the value specified by the key.
322
322
  *
323
- * @see {@link https://hono.dev/api/context#set-get}
323
+ * @see {@link https://hono.dev/docs/api/context#set-get}
324
324
  *
325
325
  * @example
326
326
  * ```ts
@@ -334,7 +334,7 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
334
334
  /**
335
335
  * `.var` can access the value of a variable.
336
336
  *
337
- * @see {@link https://hono.dev/api/context#var}
337
+ * @see {@link https://hono.dev/docs/api/context#var}
338
338
  *
339
339
  * @example
340
340
  * ```ts
@@ -348,7 +348,7 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
348
348
  * You can set headers with `.header()` and set HTTP status code with `.status`.
349
349
  * This can also be set in `.text()`, `.json()` and so on.
350
350
  *
351
- * @see {@link https://hono.dev/api/context#body}
351
+ * @see {@link https://hono.dev/docs/api/context#body}
352
352
  *
353
353
  * @example
354
354
  * ```ts
@@ -368,7 +368,7 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
368
368
  /**
369
369
  * `.text()` can render text as `Content-Type:text/plain`.
370
370
  *
371
- * @see {@link https://hono.dev/api/context#text}
371
+ * @see {@link https://hono.dev/docs/api/context#text}
372
372
  *
373
373
  * @example
374
374
  * ```ts
@@ -381,7 +381,7 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
381
381
  /**
382
382
  * `.json()` can render JSON as `Content-Type:application/json`.
383
383
  *
384
- * @see {@link https://hono.dev/api/context#json}
384
+ * @see {@link https://hono.dev/docs/api/context#json}
385
385
  *
386
386
  * @example
387
387
  * ```ts
@@ -395,7 +395,7 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
395
395
  /**
396
396
  * `.redirect()` can Redirect, default status code is 302.
397
397
  *
398
- * @see {@link https://hono.dev/api/context#redirect}
398
+ * @see {@link https://hono.dev/docs/api/context#redirect}
399
399
  *
400
400
  * @example
401
401
  * ```ts
@@ -411,7 +411,7 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
411
411
  /**
412
412
  * `.notFound()` can return the Not Found Response.
413
413
  *
414
- * @see {@link https://hono.dev/api/context#notfound}
414
+ * @see {@link https://hono.dev/docs/api/context#notfound}
415
415
  *
416
416
  * @example
417
417
  * ```ts
@@ -17,7 +17,7 @@ export type HonoOptions<E extends Env> = {
17
17
  /**
18
18
  * `strict` option specifies whether to distinguish whether the last path is a directory or not.
19
19
  *
20
- * @see {@link https://hono.dev/api/hono#strict-mode}
20
+ * @see {@link https://hono.dev/docs/api/hono#strict-mode}
21
21
  *
22
22
  * @default true
23
23
  */
@@ -25,7 +25,7 @@ export type HonoOptions<E extends Env> = {
25
25
  /**
26
26
  * `router` option specifices which router to use.
27
27
  *
28
- * @see {@link https://hono.dev/api/hono#router-option}
28
+ * @see {@link https://hono.dev/docs/api/hono#router-option}
29
29
  *
30
30
  * @example
31
31
  * ```ts
@@ -36,7 +36,7 @@ export type HonoOptions<E extends Env> = {
36
36
  /**
37
37
  * `getPath` can handle the host header value.
38
38
  *
39
- * @see {@link https://hono.dev/api/routing#routing-with-host-header-value}
39
+ * @see {@link https://hono.dev/docs/api/routing#routing-with-host-header-value}
40
40
  *
41
41
  * @example
42
42
  * ```ts
@@ -83,7 +83,7 @@ declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends
83
83
  /**
84
84
  * `.route()` allows grouping other Hono instance in routes.
85
85
  *
86
- * @see {@link https://hono.dev/api/routing#grouping}
86
+ * @see {@link https://hono.dev/docs/api/routing#grouping}
87
87
  *
88
88
  * @param {string} path - base Path
89
89
  * @param {Hono} app - other Hono instance
@@ -102,7 +102,7 @@ declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends
102
102
  /**
103
103
  * `.basePath()` allows base paths to be specified.
104
104
  *
105
- * @see {@link https://hono.dev/api/routing#base-path}
105
+ * @see {@link https://hono.dev/docs/api/routing#base-path}
106
106
  *
107
107
  * @param {string} path - base Path
108
108
  * @returns {Hono} changed Hono instance
@@ -116,7 +116,7 @@ declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends
116
116
  /**
117
117
  * `.onError()` handles an error and returns a customized Response.
118
118
  *
119
- * @see {@link https://hono.dev/api/hono#error-handling}
119
+ * @see {@link https://hono.dev/docs/api/hono#error-handling}
120
120
  *
121
121
  * @param {ErrorHandler} handler - request Handler for error
122
122
  * @returns {Hono} changed Hono instance
@@ -133,7 +133,7 @@ declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends
133
133
  /**
134
134
  * `.notFound()` allows you to customize a Not Found Response.
135
135
  *
136
- * @see {@link https://hono.dev/api/hono#not-found}
136
+ * @see {@link https://hono.dev/docs/api/hono#not-found}
137
137
  *
138
138
  * @param {NotFoundHandler} handler - request handler for not-found
139
139
  * @returns {Hono} changed Hono instance
@@ -149,7 +149,7 @@ declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends
149
149
  /**
150
150
  * `.mount()` allows you to mount applications built with other frameworks into your Hono application.
151
151
  *
152
- * @see {@link https://hono.dev/api/hono#mount}
152
+ * @see {@link https://hono.dev/docs/api/hono#mount}
153
153
  *
154
154
  * @param {string} path - base Path
155
155
  * @param {Function} applicationHandler - other Request Handler
@@ -186,7 +186,7 @@ declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends
186
186
  /**
187
187
  * `.fetch()` will be entry point of your app.
188
188
  *
189
- * @see {@link https://hono.dev/api/hono#fetch}
189
+ * @see {@link https://hono.dev/docs/api/hono#fetch}
190
190
  *
191
191
  * @param {Request} request - request Object of request
192
192
  * @param {Env} Env - env Object
@@ -205,13 +205,13 @@ declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends
205
205
  * expect(res.status).toBe(200)
206
206
  * })
207
207
  * ```
208
- * @see https://hono.dev/api/hono#request
208
+ * @see https://hono.dev/docs/api/hono#request
209
209
  */
210
210
  request: (input: RequestInfo | URL, requestInit?: RequestInit, Env?: E['Bindings'] | {}, executionCtx?: ExecutionContext) => Response | Promise<Response>;
211
211
  /**
212
212
  * `.fire()` automatically adds a global fetch event listener.
213
213
  * This can be useful for environments that adhere to the Service Worker API, such as non-ES module Cloudflare Workers.
214
- * @see https://hono.dev/api/hono#fire
214
+ * @see https://hono.dev/docs/api/hono#fire
215
215
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API
216
216
  * @see https://developers.cloudflare.com/workers/reference/migrate-to-module-workers/
217
217
  */
@@ -17,7 +17,7 @@ type HTTPExceptionOptions = {
17
17
  /**
18
18
  * `HTTPException` must be used when a fatal error such as authentication failure occurs.
19
19
  *
20
- * @see {@link https://hono.dev/api/exception}
20
+ * @see {@link https://hono.dev/docs/api/exception}
21
21
  *
22
22
  * @param {StatusCode} status - status code of HTTPException
23
23
  * @param {HTTPExceptionOptions} options - options of HTTPException
@@ -162,7 +162,7 @@ export declare namespace JSX {
162
162
  type HTMLAttributeReferrerPolicy = '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
163
163
  type HTMLAttributeAnchorTarget = '_self' | '_blank' | '_parent' | '_top' | string;
164
164
  interface AnchorHTMLAttributes extends HTMLAttributes {
165
- download?: any;
165
+ download?: string | boolean | undefined;
166
166
  href?: string | undefined;
167
167
  hreflang?: string | undefined;
168
168
  media?: string | undefined;
@@ -176,7 +176,7 @@ export declare namespace JSX {
176
176
  interface AreaHTMLAttributes extends HTMLAttributes {
177
177
  alt?: string | undefined;
178
178
  coords?: string | undefined;
179
- download?: any;
179
+ download?: string | boolean | undefined;
180
180
  href?: string | undefined;
181
181
  hreflang?: string | undefined;
182
182
  media?: string | undefined;
@@ -17,7 +17,7 @@ type BasicAuthOptions = {
17
17
  /**
18
18
  * Basic Auth Middleware for Hono.
19
19
  *
20
- * @see {@link https://hono.dev/middleware/builtin/basic-auth}
20
+ * @see {@link https://hono.dev/docs/middleware/builtin/basic-auth}
21
21
  *
22
22
  * @param {BasicAuthOptions} options - The options for the basic authentication middleware.
23
23
  * @param {string} options.username - The username for authentication.
@@ -20,7 +20,7 @@ type BearerAuthOptions = {
20
20
  /**
21
21
  * Bearer Auth Middleware for Hono.
22
22
  *
23
- * @see {@link https://hono.dev/middleware/builtin/bearer-auth}
23
+ * @see {@link https://hono.dev/docs/middleware/builtin/bearer-auth}
24
24
  *
25
25
  * @param {BearerAuthOptions} options - The options for the bearer authentication middleware.
26
26
  * @param {string | string[]} [options.token] - The string or array of strings to validate the incoming bearer token against.
@@ -12,7 +12,7 @@ type BodyLimitOptions = {
12
12
  /**
13
13
  * Body Limit Middleware for Hono.
14
14
  *
15
- * @see {@link https://hono.dev/middleware/builtin/body-limit}
15
+ * @see {@link https://hono.dev/docs/middleware/builtin/body-limit}
16
16
  *
17
17
  * @param {BodyLimitOptions} options - The options for the body limit middleware.
18
18
  * @param {number} options.maxSize - The maximum body size allowed.
@@ -7,7 +7,7 @@ import type { MiddlewareHandler } from '../../types';
7
7
  /**
8
8
  * Cache Middleware for Hono.
9
9
  *
10
- * @see {@link https://hono.dev/middleware/builtin/cache}
10
+ * @see {@link https://hono.dev/docs/middleware/builtin/cache}
11
11
  *
12
12
  * @param {Object} options - The options for the cache middleware.
13
13
  * @param {string | Function} options.cacheName - The name of the cache. Can be used to store multiple caches with different identifiers.
@@ -10,7 +10,7 @@ interface CompressionOptions {
10
10
  /**
11
11
  * Compress Middleware for Hono.
12
12
  *
13
- * @see {@link https://hono.dev/middleware/builtin/compress}
13
+ * @see {@link https://hono.dev/docs/middleware/builtin/compress}
14
14
  *
15
15
  * @param {CompressionOptions} [options] - The options for the compress middleware.
16
16
  * @param {'gzip' | 'deflate'} [options.encoding] - The compression scheme to allow for response compression. Either 'gzip' or 'deflate'. If not defined, both are allowed and will be used based on the Accept-Encoding header. 'gzip' is prioritized if this option is not provided and the client provides both in the Accept-Encoding header.
@@ -15,7 +15,7 @@ type CORSOptions = {
15
15
  /**
16
16
  * CORS Middleware for Hono.
17
17
  *
18
- * @see {@link https://hono.dev/middleware/builtin/cors}
18
+ * @see {@link https://hono.dev/docs/middleware/builtin/cors}
19
19
  *
20
20
  * @param {CORSOptions} [options] - The options for the CORS middleware.
21
21
  * @param {string | string[] | ((origin: string, c: Context) => string | undefined | null)} [options.origin='*'] - The value of "Access-Control-Allow-Origin" CORS header.
@@ -11,7 +11,7 @@ interface CSRFOptions {
11
11
  /**
12
12
  * CSRF Protection Middleware for Hono.
13
13
  *
14
- * @see {@link https://hono.dev/middleware/builtin/csrf}
14
+ * @see {@link https://hono.dev/docs/middleware/builtin/csrf}
15
15
  *
16
16
  * @param {CSRFOptions} [options] - The options for the CSRF protection middleware.
17
17
  * @param {string|string[]|(origin: string, context: Context) => boolean} [options.origin] - Specify origins.
@@ -17,7 +17,7 @@ export declare const RETAINED_304_HEADERS: string[];
17
17
  /**
18
18
  * ETag Middleware for Hono.
19
19
  *
20
- * @see {@link https://hono.dev/middleware/builtin/etag}
20
+ * @see {@link https://hono.dev/docs/middleware/builtin/etag}
21
21
  *
22
22
  * @param {ETagOptions} [options] - The options for the ETag middleware.
23
23
  * @param {boolean} [options.weak=false] - Define using or not using a weak validation. If true is set, then `W/` is added to the prefix of the value.
@@ -17,7 +17,7 @@ type ComponentWithChildren = (props: PropsWithChildren<PropsForRenderer & {
17
17
  /**
18
18
  * JSX Renderer Middleware for hono.
19
19
  *
20
- * @see {@link{https://hono.dev/middleware/builtin/jsx-renderer}}
20
+ * @see {@link{https://hono.dev/docs/middleware/builtin/jsx-renderer}}
21
21
  *
22
22
  * @param {ComponentWithChildren} [component] - The component to render, which can accept children and props.
23
23
  * @param {RendererOptions} [options] - The options for the JSX renderer middleware.
@@ -11,7 +11,7 @@ export type JwtVariables = {
11
11
  /**
12
12
  * JWT Auth Middleware for Hono.
13
13
  *
14
- * @see {@link https://hono.dev/middleware/builtin/jwt}
14
+ * @see {@link https://hono.dev/docs/middleware/builtin/jwt}
15
15
  *
16
16
  * @param {object} options - The options for the JWT middleware.
17
17
  * @param {string} [options.secret] - A value of your secret key.
@@ -7,7 +7,7 @@ type PrintFunc = (str: string, ...rest: string[]) => void;
7
7
  /**
8
8
  * Logger Middleware for Hono.
9
9
  *
10
- * @see {@link https://hono.dev/middleware/builtin/logger}
10
+ * @see {@link https://hono.dev/docs/middleware/builtin/logger}
11
11
  *
12
12
  * @param {PrintFunc} [fn=console.log] - Optional function for customized logging behavior.
13
13
  * @returns {MiddlewareHandler} The middleware handler function.
@@ -22,7 +22,7 @@ type MethodOverrideOptions = {
22
22
  /**
23
23
  * Method Override Middleware for Hono.
24
24
  *
25
- * @see {@link https://hono.dev/middleware/builtin/method-override}
25
+ * @see {@link https://hono.dev/docs/middleware/builtin/method-override}
26
26
  *
27
27
  * @param {MethodOverrideOptions} options - The options for the method override middleware.
28
28
  * @param {Hono} options.app - The instance of Hono is used in your application.
@@ -9,7 +9,7 @@ type prettyOptions = {
9
9
  /**
10
10
  * Pretty JSON Middleware for Hono.
11
11
  *
12
- * @see {@link https://hono.dev/middleware/builtin/pretty-json}
12
+ * @see {@link https://hono.dev/docs/middleware/builtin/pretty-json}
13
13
  *
14
14
  * @param {prettyOptions} [options] - The options for the pretty JSON middleware.
15
15
  * @param {number} [options.space=2] - Number of spaces for indentation.
@@ -67,7 +67,7 @@ export declare const NONCE: ContentSecurityPolicyOptionHandler;
67
67
  /**
68
68
  * Secure Headers Middleware for Hono.
69
69
  *
70
- * @see {@link https://hono.dev/middleware/builtin/secure-headers}
70
+ * @see {@link https://hono.dev/docs/middleware/builtin/secure-headers}
71
71
  *
72
72
  * @param {Partial<SecureHeadersOptions>} [customOptions] - The options for the secure headers middleware.
73
73
  * @param {ContentSecurityPolicyOptions} [customOptions.contentSecurityPolicy] - Settings for the Content-Security-Policy header.
@@ -25,7 +25,7 @@ interface TimingOptions {
25
25
  /**
26
26
  * Server-Timing Middleware for Hono.
27
27
  *
28
- * @see {@link https://hono.dev/middleware/builtin/timing}
28
+ * @see {@link https://hono.dev/docs/middleware/builtin/timing}
29
29
  *
30
30
  * @param {TimingOptions} [config] - The options for the timing middleware.
31
31
  * @param {boolean} [config.total=true] - Show the total response time.