hono 4.4.11 → 4.4.13

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 (35) 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/jsx/base.js +1 -0
  4. package/dist/jsx/base.js +1 -0
  5. package/dist/types/context.d.ts +20 -20
  6. package/dist/types/helper/factory/index.d.ts +1 -1
  7. package/dist/types/hono-base.d.ts +11 -11
  8. package/dist/types/http-exception.d.ts +1 -1
  9. package/dist/types/jsx/intrinsic-elements.d.ts +3 -3
  10. package/dist/types/middleware/basic-auth/index.d.ts +1 -1
  11. package/dist/types/middleware/bearer-auth/index.d.ts +1 -1
  12. package/dist/types/middleware/body-limit/index.d.ts +1 -1
  13. package/dist/types/middleware/cache/index.d.ts +1 -1
  14. package/dist/types/middleware/compress/index.d.ts +1 -1
  15. package/dist/types/middleware/cors/index.d.ts +1 -1
  16. package/dist/types/middleware/csrf/index.d.ts +1 -1
  17. package/dist/types/middleware/etag/index.d.ts +1 -1
  18. package/dist/types/middleware/jsx-renderer/index.d.ts +1 -1
  19. package/dist/types/middleware/jwt/jwt.d.ts +1 -1
  20. package/dist/types/middleware/logger/index.d.ts +1 -1
  21. package/dist/types/middleware/method-override/index.d.ts +1 -1
  22. package/dist/types/middleware/pretty-json/index.d.ts +1 -1
  23. package/dist/types/middleware/secure-headers/secure-headers.d.ts +1 -1
  24. package/dist/types/middleware/timing/timing.d.ts +1 -1
  25. package/dist/types/middleware/trailing-slash/index.d.ts +2 -2
  26. package/dist/types/request.d.ts +17 -17
  27. package/dist/types/types.d.ts +63 -2
  28. package/dist/types/utils/http-status.d.ts +2 -2
  29. package/dist/types/utils/jwt/jwa.d.ts +5 -0
  30. package/dist/types/utils/jwt/jws.d.ts +5 -0
  31. package/dist/types/utils/jwt/jwt.d.ts +5 -0
  32. package/dist/types/utils/jwt/types.d.ts +4 -0
  33. package/dist/types/utils/jwt/utf8.d.ts +4 -0
  34. package/dist/types/utils/types.d.ts +15 -3
  35. package/package.json +3 -4
@@ -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");
@@ -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",
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
@@ -73,5 +73,5 @@ export declare class Factory<E extends Env = any, P extends string = any> {
73
73
  export declare const createFactory: <E extends Env = any, P extends string = any>(init?: {
74
74
  initApp?: InitApp<E> | undefined;
75
75
  } | undefined) => Factory<E, P>;
76
- export declare const createMiddleware: <E extends Env = any, P extends string = any, I extends Input = {}>(middleware: MiddlewareHandler<E, P, I>) => MiddlewareHandler<E, P, I>;
76
+ export declare const createMiddleware: <E extends Env = any, P extends string = string, I extends Input = {}>(middleware: MiddlewareHandler<E, P, I>) => MiddlewareHandler<E, P, I>;
77
77
  export {};
@@ -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;
@@ -494,7 +494,7 @@ export declare namespace JSX {
494
494
  colspan?: number | undefined;
495
495
  headers?: string | undefined;
496
496
  rowspan?: number | undefined;
497
- scope?: string | undefined;
497
+ scope?: 'row' | 'col' | 'rowgroup' | 'colgroup' | string | undefined;
498
498
  abbr?: string | undefined;
499
499
  }
500
500
  interface TimeHTMLAttributes extends HTMLAttributes {
@@ -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.
@@ -6,7 +6,7 @@ import type { MiddlewareHandler } from '../../types';
6
6
  /**
7
7
  * Trailing Slash Middleware for Hono.
8
8
  *
9
- * @see {@link https://hono.dev/middleware/builtin/trailing-slash}
9
+ * @see {@link https://hono.dev/docs/middleware/builtin/trailing-slash}
10
10
  *
11
11
  * @returns {MiddlewareHandler} The middleware handler function.
12
12
  *
@@ -23,7 +23,7 @@ export declare const trimTrailingSlash: () => MiddlewareHandler;
23
23
  * Append trailing slash middleware for Hono.
24
24
  * Append a trailing slash to the URL if it doesn't have one. For example, `/path/to/page` will be redirected to `/path/to/page/`.
25
25
  *
26
- * @see {@link https://hono.dev/middleware/builtin/trailing-slash}
26
+ * @see {@link https://hono.dev/docs/middleware/builtin/trailing-slash}
27
27
  *
28
28
  * @returns {MiddlewareHandler} The middleware handler function.
29
29
  *
@@ -17,7 +17,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
17
17
  /**
18
18
  * `.raw` can get the raw Request object.
19
19
  *
20
- * @see {@link https://hono.dev/api/request#raw}
20
+ * @see {@link https://hono.dev/docs/api/request#raw}
21
21
  *
22
22
  * @example
23
23
  * ```ts
@@ -33,7 +33,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
33
33
  /**
34
34
  * `.path` can get the pathname of the request.
35
35
  *
36
- * @see {@link https://hono.dev/api/request#path}
36
+ * @see {@link https://hono.dev/docs/api/request#path}
37
37
  *
38
38
  * @example
39
39
  * ```ts
@@ -48,7 +48,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
48
48
  /**
49
49
  * `.req.param()` gets the path parameters.
50
50
  *
51
- * @see {@link https://hono.dev/api/routing#path-parameter}
51
+ * @see {@link https://hono.dev/docs/api/routing#path-parameter}
52
52
  *
53
53
  * @example
54
54
  * ```ts
@@ -67,7 +67,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
67
67
  /**
68
68
  * `.query()` can get querystring parameters.
69
69
  *
70
- * @see {@link https://hono.dev/api/request#query}
70
+ * @see {@link https://hono.dev/docs/api/request#query}
71
71
  *
72
72
  * @example
73
73
  * ```ts
@@ -87,7 +87,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
87
87
  /**
88
88
  * `.queries()` can get multiple querystring parameter values, e.g. /search?tags=A&tags=B
89
89
  *
90
- * @see {@link https://hono.dev/api/request#queries}
90
+ * @see {@link https://hono.dev/docs/api/request#queries}
91
91
  *
92
92
  * @example
93
93
  * ```ts
@@ -102,7 +102,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
102
102
  /**
103
103
  * `.header()` can get the request header value.
104
104
  *
105
- * @see {@link https://hono.dev/api/request#header}
105
+ * @see {@link https://hono.dev/docs/api/request#header}
106
106
  *
107
107
  * @example
108
108
  * ```ts
@@ -116,7 +116,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
116
116
  /**
117
117
  * `.parseBody()` can parse Request body of type `multipart/form-data` or `application/x-www-form-urlencoded`
118
118
  *
119
- * @see {@link https://hono.dev/api/request#parsebody}
119
+ * @see {@link https://hono.dev/docs/api/request#parsebody}
120
120
  *
121
121
  * @example
122
122
  * ```ts
@@ -131,7 +131,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
131
131
  /**
132
132
  * `.json()` can parse Request body of type `application/json`
133
133
  *
134
- * @see {@link https://hono.dev/api/request#json}
134
+ * @see {@link https://hono.dev/docs/api/request#json}
135
135
  *
136
136
  * @example
137
137
  * ```ts
@@ -144,7 +144,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
144
144
  /**
145
145
  * `.text()` can parse Request body of type `text/plain`
146
146
  *
147
- * @see {@link https://hono.dev/api/request#text}
147
+ * @see {@link https://hono.dev/docs/api/request#text}
148
148
  *
149
149
  * @example
150
150
  * ```ts
@@ -157,7 +157,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
157
157
  /**
158
158
  * `.arrayBuffer()` parse Request body as an `ArrayBuffer`
159
159
  *
160
- * @see {@link https://hono.dev/api/request#arraybuffer}
160
+ * @see {@link https://hono.dev/docs/api/request#arraybuffer}
161
161
  *
162
162
  * @example
163
163
  * ```ts
@@ -175,7 +175,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
175
175
  * const body = await c.req.blob();
176
176
  * });
177
177
  * ```
178
- * @see https://hono.dev/api/request#blob
178
+ * @see https://hono.dev/docs/api/request#blob
179
179
  */
180
180
  blob(): Promise<Blob>;
181
181
  /**
@@ -186,7 +186,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
186
186
  * const body = await c.req.formData();
187
187
  * });
188
188
  * ```
189
- * @see https://hono.dev/api/request#formdata
189
+ * @see https://hono.dev/docs/api/request#formdata
190
190
  */
191
191
  formData(): Promise<FormData>;
192
192
  /**
@@ -202,13 +202,13 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
202
202
  * @param target - The target of the validation.
203
203
  * @returns The validated data.
204
204
  *
205
- * @see https://hono.dev/api/request#valid
205
+ * @see https://hono.dev/docs/api/request#valid
206
206
  */
207
207
  valid<T extends keyof I & keyof ValidationTargets>(target: T): InputToDataByTarget<I, T>;
208
208
  /**
209
209
  * `.url()` can get the request url strings.
210
210
  *
211
- * @see {@link https://hono.dev/api/request#url}
211
+ * @see {@link https://hono.dev/docs/api/request#url}
212
212
  *
213
213
  * @example
214
214
  * ```ts
@@ -222,7 +222,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
222
222
  /**
223
223
  * `.method()` can get the method name of the request.
224
224
  *
225
- * @see {@link https://hono.dev/api/request#method}
225
+ * @see {@link https://hono.dev/docs/api/request#method}
226
226
  *
227
227
  * @example
228
228
  * ```ts
@@ -235,7 +235,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
235
235
  /**
236
236
  * `.matchedRoutes()` can return a matched route in the handler
237
237
  *
238
- * @see {@link https://hono.dev/api/request#matchedroutes}
238
+ * @see {@link https://hono.dev/docs/api/request#matchedroutes}
239
239
  *
240
240
  * @example
241
241
  * ```ts
@@ -259,7 +259,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
259
259
  /**
260
260
  * `routePath()` can retrieve the path registered within the handler
261
261
  *
262
- * @see {@link https://hono.dev/api/request#routepath}
262
+ * @see {@link https://hono.dev/docs/api/request#routepath}
263
263
  *
264
264
  * @example
265
265
  * ```ts
@@ -166,13 +166,16 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
166
166
  <E2 extends Env = E>(...handlers: MiddlewareHandler<E2, MergePath<BasePath, ExtractKey<S>>>[]): Hono<IntersectNonAnyTypes<[E, E2]>, S, BasePath>;
167
167
  <E2 extends Env = E>(handler: MiddlewareHandler<E2, MergePath<BasePath, ExtractKey<S>>>): Hono<IntersectNonAnyTypes<[E, E2]>, S, BasePath>;
168
168
  <E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>, P extends string = MergePath<BasePath, ExtractKey<S>>>(...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>]): Hono<IntersectNonAnyTypes<[E, E2, E3]>, S, BasePath>;
169
+ <P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, E2 extends Env = E>(path: P, handler: MiddlewareHandler<E2, MergedPath>): Hono<IntersectNonAnyTypes<[E, E2]>, ChangePathOfSchema<S, MergedPath>, BasePath>;
169
170
  <E2 extends Env = E, E3 extends Env = E, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>, P extends string = MergePath<BasePath, ExtractKey<S>>>(...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>, MiddlewareHandler<E4, P>]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4]>, S, BasePath>;
171
+ <P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>>(path: P, ...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>]): Hono<IntersectNonAnyTypes<[E, E2, E3]>, ChangePathOfSchema<S, MergedPath>, BasePath>;
170
172
  <E2 extends Env = E, E3 extends Env = E, E4 extends Env = E, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>, P extends string = MergePath<BasePath, ExtractKey<S>>>(...handlers: [
171
173
  MiddlewareHandler<E2, P>,
172
174
  MiddlewareHandler<E3, P>,
173
175
  MiddlewareHandler<E4, P>,
174
176
  MiddlewareHandler<E5, P>
175
177
  ]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, S, BasePath>;
178
+ <P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = E, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>>(path: P, ...handlers: [MiddlewareHandler<E2, P>, MiddlewareHandler<E3, P>, MiddlewareHandler<E4, P>]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4]>, ChangePathOfSchema<S, MergedPath>, BasePath>;
176
179
  <E2 extends Env = E, E3 extends Env = E, E4 extends Env = E, E5 extends Env = E, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, P extends string = MergePath<BasePath, ExtractKey<S>>>(...handlers: [
177
180
  MiddlewareHandler<E2, P>,
178
181
  MiddlewareHandler<E3, P>,
@@ -180,6 +183,12 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
180
183
  MiddlewareHandler<E5, P>,
181
184
  MiddlewareHandler<E6, P>
182
185
  ]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, S, BasePath>;
186
+ <P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = E, E4 extends Env = E, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>>(path: P, ...handlers: [
187
+ MiddlewareHandler<E2, P>,
188
+ MiddlewareHandler<E3, P>,
189
+ MiddlewareHandler<E4, P>,
190
+ MiddlewareHandler<E5, P>
191
+ ]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, ChangePathOfSchema<S, MergedPath>, BasePath>;
183
192
  <E2 extends Env = E, E3 extends Env = E, E4 extends Env = E, E5 extends Env = E, E6 extends Env = E, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, P extends string = MergePath<BasePath, ExtractKey<S>>>(...handlers: [
184
193
  MiddlewareHandler<E2, P>,
185
194
  MiddlewareHandler<E3, P>,
@@ -188,6 +197,13 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
188
197
  MiddlewareHandler<E6, P>,
189
198
  MiddlewareHandler<E7, P>
190
199
  ]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, S, BasePath>;
200
+ <P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = E, E4 extends Env = E, E5 extends Env = E, E6 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5]>>(path: P, ...handlers: [
201
+ MiddlewareHandler<E2, P>,
202
+ MiddlewareHandler<E3, P>,
203
+ MiddlewareHandler<E4, P>,
204
+ MiddlewareHandler<E5, P>,
205
+ MiddlewareHandler<E6, P>
206
+ ]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, ChangePathOfSchema<S, MergedPath>, BasePath>;
191
207
  <E2 extends Env = E, E3 extends Env = E, E4 extends Env = E, E5 extends Env = E, E6 extends Env = E, E7 extends Env = E, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, P extends string = MergePath<BasePath, ExtractKey<S>>>(...handlers: [
192
208
  MiddlewareHandler<E2, P>,
193
209
  MiddlewareHandler<E3, P>,
@@ -197,6 +213,14 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
197
213
  MiddlewareHandler<E7, P>,
198
214
  MiddlewareHandler<E8, P>
199
215
  ]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, S, BasePath>;
216
+ <P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = E, E4 extends Env = E, E5 extends Env = E, E6 extends Env = E, E7 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>>(path: P, ...handlers: [
217
+ MiddlewareHandler<E2, P>,
218
+ MiddlewareHandler<E3, P>,
219
+ MiddlewareHandler<E4, P>,
220
+ MiddlewareHandler<E5, P>,
221
+ MiddlewareHandler<E6, P>,
222
+ MiddlewareHandler<E7, P>
223
+ ]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, ChangePathOfSchema<S, MergedPath>, BasePath>;
200
224
  <E2 extends Env = E, E3 extends Env = E, E4 extends Env = E, E5 extends Env = E, E6 extends Env = E, E7 extends Env = E, E8 extends Env = E, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, P extends string = MergePath<BasePath, ExtractKey<S>>>(...handlers: [
201
225
  MiddlewareHandler<E2, P>,
202
226
  MiddlewareHandler<E3, P>,
@@ -207,6 +231,15 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
207
231
  MiddlewareHandler<E8, P>,
208
232
  MiddlewareHandler<E9, P>
209
233
  ]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, S, BasePath>;
234
+ <P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = E, E4 extends Env = E, E5 extends Env = E, E6 extends Env = E, E7 extends Env = E, E8 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>>(path: P, ...handlers: [
235
+ MiddlewareHandler<E2, P>,
236
+ MiddlewareHandler<E3, P>,
237
+ MiddlewareHandler<E4, P>,
238
+ MiddlewareHandler<E5, P>,
239
+ MiddlewareHandler<E6, P>,
240
+ MiddlewareHandler<E7, P>,
241
+ MiddlewareHandler<E8, P>
242
+ ]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, ChangePathOfSchema<S, MergedPath>, BasePath>;
210
243
  <E2 extends Env = E, E3 extends Env = E, E4 extends Env = E, E5 extends Env = E, E6 extends Env = E, E7 extends Env = E, E8 extends Env = E, E9 extends Env = E, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, P extends string = MergePath<BasePath, ExtractKey<S>>>(...handlers: [
211
244
  MiddlewareHandler<E2, P>,
212
245
  MiddlewareHandler<E3, P>,
@@ -218,6 +251,16 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
218
251
  MiddlewareHandler<E9, P>,
219
252
  MiddlewareHandler<E10, P>
220
253
  ]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>, S, BasePath>;
254
+ <P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = E, E4 extends Env = E, E5 extends Env = E, E6 extends Env = E, E7 extends Env = E, E8 extends Env = E, E9 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>>(path: P, ...handlers: [
255
+ MiddlewareHandler<E2, P>,
256
+ MiddlewareHandler<E3, P>,
257
+ MiddlewareHandler<E4, P>,
258
+ MiddlewareHandler<E5, P>,
259
+ MiddlewareHandler<E6, P>,
260
+ MiddlewareHandler<E7, P>,
261
+ MiddlewareHandler<E8, P>,
262
+ MiddlewareHandler<E9, P>
263
+ ]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, ChangePathOfSchema<S, MergedPath>, BasePath>;
221
264
  <E2 extends Env = E, E3 extends Env = E, E4 extends Env = E, E5 extends Env = E, E6 extends Env = E, E7 extends Env = E, E8 extends Env = E, E9 extends Env = E, E10 extends Env = E, E11 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>, P extends string = MergePath<BasePath, ExtractKey<S>>>(...handlers: [
222
265
  MiddlewareHandler<E2, P>,
223
266
  MiddlewareHandler<E3, P>,
@@ -230,6 +273,17 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
230
273
  MiddlewareHandler<E10, P>,
231
274
  MiddlewareHandler<E11, P>
232
275
  ]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11]>, S, BasePath>;
276
+ <P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, E2 extends Env = E, E3 extends Env = E, E4 extends Env = E, E5 extends Env = E, E6 extends Env = E, E7 extends Env = E, E8 extends Env = E, E9 extends Env = E, E10 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>>(path: P, ...handlers: [
277
+ MiddlewareHandler<E2, P>,
278
+ MiddlewareHandler<E3, P>,
279
+ MiddlewareHandler<E4, P>,
280
+ MiddlewareHandler<E5, P>,
281
+ MiddlewareHandler<E6, P>,
282
+ MiddlewareHandler<E7, P>,
283
+ MiddlewareHandler<E8, P>,
284
+ MiddlewareHandler<E9, P>,
285
+ MiddlewareHandler<E10, P>
286
+ ]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>, ChangePathOfSchema<S, MergedPath>, BasePath>;
233
287
  <P extends string, E2 extends Env = E>(path: P, ...handlers: MiddlewareHandler<E2, MergePath<BasePath, P>>[]): Hono<E, S, BasePath>;
234
288
  }
235
289
  export interface OnHandlerInterface<E extends Env = Env, S extends Schema = BlankSchema, BasePath extends string = '/'> {
@@ -398,6 +452,11 @@ export type Schema = {
398
452
  [Method: `$${Lowercase<string>}`]: Endpoint;
399
453
  };
400
454
  };
455
+ type ChangePathOfSchema<S extends Schema, Path extends string> = keyof S extends never ? {
456
+ [K in Path]: {};
457
+ } : {
458
+ [K in keyof S as Path]: S[K];
459
+ };
401
460
  export type Endpoint = {
402
461
  input: Partial<ValidationTargets>;
403
462
  output: any;
@@ -453,9 +512,11 @@ export type TypedResponse<T = unknown, U extends StatusCode = StatusCode, F exte
453
512
  _format: F;
454
513
  };
455
514
  type MergeTypedResponse<T> = T extends Promise<infer T2> ? T2 extends TypedResponse ? T2 : TypedResponse : T extends TypedResponse ? T : TypedResponse;
456
- export type ValidationTargets = {
515
+ export type FormValue = string | Blob;
516
+ export type ParsedFormValue = string | File;
517
+ export type ValidationTargets<T extends FormValue = ParsedFormValue> = {
457
518
  json: any;
458
- form: Record<string, string | File>;
519
+ form: Record<string, T | T[]>;
459
520
  query: Record<string, string | string[]>;
460
521
  param: Record<string, string> | Record<string, string | undefined>;
461
522
  header: Record<string, string>;
@@ -23,8 +23,8 @@ export type UnofficialStatusCode = -1;
23
23
  * @deprecated
24
24
  * Use `UnofficialStatusCode` instead.
25
25
  */
26
- export type UnOfficalStatusCode = -1;
26
+ export type UnOfficalStatusCode = UnofficialStatusCode;
27
27
  /**
28
28
  * If you want to use an unofficial status, use `UnofficialStatusCode`.
29
29
  */
30
- export type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | UnofficialStatusCode | UnOfficalStatusCode;
30
+ export type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | UnofficialStatusCode;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @module
3
+ * JSON Web Algorithms (JWA)
4
+ * https://datatracker.ietf.org/doc/html/rfc7518
5
+ */
1
6
  export declare enum AlgorithmTypes {
2
7
  HS256 = "HS256",
3
8
  HS384 = "HS384",
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @module
3
+ * JSON Web Signature (JWS)
4
+ * https://datatracker.ietf.org/doc/html/rfc7515
5
+ */
1
6
  import type { SignatureAlgorithm } from './jwa';
2
7
  export type SignatureKey = string | JsonWebKey | CryptoKey;
3
8
  export declare function signing(privateKey: SignatureKey, alg: SignatureAlgorithm, data: BufferSource): Promise<ArrayBuffer>;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @module
3
+ * JSON Web Token (JWT)
4
+ * https://datatracker.ietf.org/doc/html/rfc7519
5
+ */
1
6
  import type { SignatureAlgorithm } from './jwa';
2
7
  import type { SignatureKey } from './jws';
3
8
  import type { JWTPayload } from './types';
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @module
3
+ * Type definitions for JWT utilities.
4
+ */
1
5
  export declare class JwtAlgorithmNotImplemented extends Error {
2
6
  constructor(alg: string);
3
7
  }
@@ -1,2 +1,6 @@
1
+ /**
2
+ * @module
3
+ * Functions for encoding/decoding UTF8.
4
+ */
1
5
  export declare const utf8Encoder: TextEncoder;
2
6
  export declare const utf8Decoder: TextDecoder;
@@ -8,16 +8,27 @@ export type NotEqual<X, Y> = true extends Equal<X, Y> ? false : true;
8
8
  export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
9
9
  export type RemoveBlankRecord<T> = T extends Record<infer K, unknown> ? K extends string ? T : never : never;
10
10
  export type IfAnyThenEmptyObject<T> = 0 extends 1 & T ? {} : T;
11
- export type JSONPrimitive = string | boolean | number | null | undefined;
11
+ export type JSONPrimitive = string | boolean | number | null;
12
12
  export type JSONArray = (JSONPrimitive | JSONObject | JSONArray)[];
13
13
  export type JSONObject = {
14
14
  [key: string]: JSONPrimitive | JSONArray | JSONObject | object;
15
15
  };
16
+ export type InvalidJSONValue = undefined | symbol | ((...args: unknown[]) => unknown);
17
+ type InvalidToNull<T> = T extends InvalidJSONValue ? null : T;
18
+ type IsInvalid<T> = T extends InvalidJSONValue ? true : false;
19
+ /**
20
+ * symbol keys are omitted through `JSON.stringify`
21
+ */
22
+ type OmitSymbolKeys<T> = {
23
+ [K in keyof T as K extends symbol ? never : K]: T[K];
24
+ };
16
25
  export type JSONValue = JSONObject | JSONArray | JSONPrimitive;
17
26
  export type JSONParsed<T> = T extends {
18
27
  toJSON(): infer J;
19
- } ? (() => J) extends () => JSONObject ? J : JSONParsed<J> : T extends JSONPrimitive ? T : T extends Array<infer U> ? Array<JSONParsed<U>> : T extends object ? {
20
- [K in keyof T]: JSONParsed<T[K]>;
28
+ } ? (() => J) extends () => JSONPrimitive ? J : (() => J) extends () => {
29
+ toJSON(): unknown;
30
+ } ? {} : JSONParsed<J> : T extends JSONPrimitive ? T : T extends InvalidJSONValue ? never : T extends [] ? [] : T extends readonly [infer R, ...infer U] ? [JSONParsed<InvalidToNull<R>>, ...JSONParsed<U>] : T extends Array<infer U> ? Array<JSONParsed<InvalidToNull<U>>> : T extends Set<unknown> | Map<unknown, unknown> ? {} : T extends object ? {
31
+ [K in keyof OmitSymbolKeys<T> as IsInvalid<T[K]> extends true ? never : K]: boolean extends IsInvalid<T[K]> ? JSONParsed<T[K]> | undefined : JSONParsed<T[K]>;
21
32
  } : never;
22
33
  /**
23
34
  * Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
@@ -40,3 +51,4 @@ export type RequiredKeysOf<BaseType extends object> = Exclude<{
40
51
  }[keyof BaseType], undefined>;
41
52
  export type HasRequiredKeys<BaseType extends object> = RequiredKeysOf<BaseType> extends never ? false : true;
42
53
  export type IsAny<T> = boolean extends (T extends never ? true : false) ? true : false;
54
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono",
3
- "version": "4.4.11",
3
+ "version": "4.4.13",
4
4
  "description": "Web framework built on Web Standards",
5
5
  "main": "dist/cjs/index.js",
6
6
  "type": "module",
@@ -25,9 +25,9 @@
25
25
  "format": "prettier --check --cache \"src/**/*.{js,ts,tsx}\" \"runtime_tests/**/*.{js,ts,tsx}\"",
26
26
  "format:fix": "prettier --write --cache --cache-strategy metadata \"src/**/*.{js,ts,tsx}\" \"runtime_tests/**/*.{js,ts,tsx}\"",
27
27
  "copy:package.cjs.json": "cp ./package.cjs.json ./dist/cjs/package.json && cp ./package.cjs.json ./dist/types/package.json ",
28
- "build": "rimraf dist && tsx ./build.ts && bun run copy:package.cjs.json",
28
+ "build": "rimraf dist && bun ./build.ts && bun run copy:package.cjs.json",
29
29
  "postbuild": "publint",
30
- "watch": "rimraf dist && tsx ./build.ts --watch && bun run copy:package.cjs.json",
30
+ "watch": "rimraf dist && bun ./build.ts --watch && bun run copy:package.cjs.json",
31
31
  "coverage": "vitest --run --coverage",
32
32
  "prerelease": "bun test:deno && bun run build",
33
33
  "release": "np"
@@ -589,7 +589,6 @@
589
589
  "publint": "^0.1.8",
590
590
  "rimraf": "^3.0.2",
591
591
  "supertest": "^6.3.3",
592
- "tsx": "^4.7.0",
593
592
  "typescript": "^5.3.3",
594
593
  "vite-plugin-fastly-js-compute": "^0.4.2",
595
594
  "vitest": "^1.2.2",