hono 4.6.7 → 4.6.8

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.
@@ -16,16 +16,14 @@ var createWSContext = (ws) => {
16
16
  });
17
17
  };
18
18
  var createBunWebSocket = () => {
19
- const websocketConns = [];
20
19
  const upgradeWebSocket = defineWebSocketHelper((c, events) => {
21
20
  const server = getBunServer(c);
22
21
  if (!server) {
23
22
  throw new TypeError("env has to include the 2nd argument of fetch.");
24
23
  }
25
- const connId = websocketConns.push(events) - 1;
26
24
  const upgradeResult = server.upgrade(c.req.raw, {
27
25
  data: {
28
- connId,
26
+ events,
29
27
  url: new URL(c.req.url),
30
28
  protocol: c.req.url
31
29
  }
@@ -37,13 +35,13 @@ var createBunWebSocket = () => {
37
35
  });
38
36
  const websocket = {
39
37
  open(ws) {
40
- const websocketListeners = websocketConns[ws.data.connId];
38
+ const websocketListeners = ws.data.events;
41
39
  if (websocketListeners.onOpen) {
42
40
  websocketListeners.onOpen(new Event("open"), createWSContext(ws));
43
41
  }
44
42
  },
45
43
  close(ws, code, reason) {
46
- const websocketListeners = websocketConns[ws.data.connId];
44
+ const websocketListeners = ws.data.events;
47
45
  if (websocketListeners.onClose) {
48
46
  websocketListeners.onClose(
49
47
  new CloseEvent("close", {
@@ -55,7 +53,7 @@ var createBunWebSocket = () => {
55
53
  }
56
54
  },
57
55
  message(ws, message) {
58
- const websocketListeners = websocketConns[ws.data.connId];
56
+ const websocketListeners = ws.data.events;
59
57
  if (websocketListeners.onMessage) {
60
58
  const normalizedReceiveData = typeof message === "string" ? message : message.buffer;
61
59
  websocketListeners.onMessage(
@@ -39,16 +39,14 @@ const createWSContext = (ws) => {
39
39
  });
40
40
  };
41
41
  const createBunWebSocket = () => {
42
- const websocketConns = [];
43
42
  const upgradeWebSocket = (0, import_websocket.defineWebSocketHelper)((c, events) => {
44
43
  const server = (0, import_server.getBunServer)(c);
45
44
  if (!server) {
46
45
  throw new TypeError("env has to include the 2nd argument of fetch.");
47
46
  }
48
- const connId = websocketConns.push(events) - 1;
49
47
  const upgradeResult = server.upgrade(c.req.raw, {
50
48
  data: {
51
- connId,
49
+ events,
52
50
  url: new URL(c.req.url),
53
51
  protocol: c.req.url
54
52
  }
@@ -60,13 +58,13 @@ const createBunWebSocket = () => {
60
58
  });
61
59
  const websocket = {
62
60
  open(ws) {
63
- const websocketListeners = websocketConns[ws.data.connId];
61
+ const websocketListeners = ws.data.events;
64
62
  if (websocketListeners.onOpen) {
65
63
  websocketListeners.onOpen(new Event("open"), createWSContext(ws));
66
64
  }
67
65
  },
68
66
  close(ws, code, reason) {
69
- const websocketListeners = websocketConns[ws.data.connId];
67
+ const websocketListeners = ws.data.events;
70
68
  if (websocketListeners.onClose) {
71
69
  websocketListeners.onClose(
72
70
  new CloseEvent("close", {
@@ -78,7 +76,7 @@ const createBunWebSocket = () => {
78
76
  }
79
77
  },
80
78
  message(ws, message) {
81
- const websocketListeners = websocketConns[ws.data.connId];
79
+ const websocketListeners = ws.data.events;
82
80
  if (websocketListeners.onMessage) {
83
81
  const normalizedReceiveData = typeof message === "string" ? message : message.buffer;
84
82
  websocketListeners.onMessage(
@@ -82,7 +82,7 @@ const setCookie = (c, name, value, opt) => {
82
82
  } else {
83
83
  cookie = (0, import_cookie.serialize)(name, value, { path: "/", ...opt });
84
84
  }
85
- c.header("set-cookie", cookie, { append: true });
85
+ c.header("Set-Cookie", cookie, { append: true });
86
86
  };
87
87
  const setSignedCookie = async (c, name, value, secret, opt) => {
88
88
  let cookie;
@@ -32,10 +32,7 @@ class WSContext {
32
32
  this.protocol = init.protocol ?? null;
33
33
  }
34
34
  send(source, options) {
35
- this.#init.send(
36
- typeof source === "string" ? source : source instanceof Uint8Array ? source.buffer : source,
37
- options ?? {}
38
- );
35
+ this.#init.send(source, options ?? {});
39
36
  }
40
37
  raw;
41
38
  binaryType = "arraybuffer";
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var headers_exports = {};
16
+ module.exports = __toCommonJS(headers_exports);
@@ -56,7 +56,7 @@ var setCookie = (c, name, value, opt) => {
56
56
  } else {
57
57
  cookie = serialize(name, value, { path: "/", ...opt });
58
58
  }
59
- c.header("set-cookie", cookie, { append: true });
59
+ c.header("Set-Cookie", cookie, { append: true });
60
60
  };
61
61
  var setSignedCookie = async (c, name, value, secret, opt) => {
62
62
  let cookie;
@@ -8,10 +8,7 @@ var WSContext = class {
8
8
  this.protocol = init.protocol ?? null;
9
9
  }
10
10
  send(source, options) {
11
- this.#init.send(
12
- typeof source === "string" ? source : source instanceof Uint8Array ? source.buffer : source,
13
- options ?? {}
14
- );
11
+ this.#init.send(source, options ?? {});
15
12
  }
16
13
  raw;
17
14
  binaryType = "arraybuffer";
@@ -1,4 +1,4 @@
1
- import type { UpgradeWebSocket } from '../../helper/websocket';
1
+ import type { UpgradeWebSocket, WSEvents } from '../../helper/websocket';
2
2
  import { WSContext } from '../../helper/websocket';
3
3
  /**
4
4
  * @internal
@@ -12,14 +12,16 @@ export interface BunServerWebSocket<T> {
12
12
  interface BunWebSocketHandler<T> {
13
13
  open(ws: BunServerWebSocket<T>): void;
14
14
  close(ws: BunServerWebSocket<T>, code?: number, reason?: string): void;
15
- message(ws: BunServerWebSocket<T>, message: string | Uint8Array): void;
15
+ message(ws: BunServerWebSocket<T>, message: string | {
16
+ buffer: ArrayBufferLike;
17
+ }): void;
16
18
  }
17
19
  interface CreateWebSocket<T> {
18
20
  upgradeWebSocket: UpgradeWebSocket<T>;
19
21
  websocket: BunWebSocketHandler<BunWebSocketData>;
20
22
  }
21
23
  export interface BunWebSocketData {
22
- connId: number;
24
+ events: WSEvents;
23
25
  url: URL;
24
26
  protocol: string;
25
27
  }
@@ -1,6 +1,7 @@
1
1
  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
+ import type { ResponseHeader } from './utils/headers';
4
5
  import type { RedirectStatusCode, StatusCode } from './utils/http-status';
5
6
  import type { BaseMime } from './utils/mime';
6
7
  import type { InvalidJSONValue, IsAny, JSONParsed, JSONValue, SimplifyDeepArray } from './utils/types';
@@ -170,7 +171,6 @@ type ContextOptions<E extends Env> = {
170
171
  interface SetHeadersOptions {
171
172
  append?: boolean;
172
173
  }
173
- type ResponseHeader = "Access-Control-Allow-Credentials" | "Access-Control-Allow-Headers" | "Access-Control-Allow-Methods" | "Access-Control-Allow-Origin" | "Access-Control-Expose-Headers" | "Access-Control-Max-Age" | "Age" | "Allow" | "Cache-Control" | "Clear-Site-Data" | "Content-Disposition" | "Content-Encoding" | "Content-Language" | "Content-Length" | "Content-Location" | "Content-Range" | "Content-Security-Policy" | "Content-Security-Policy-Report-Only" | "Content-Type" | "Cookie" | "Cross-Origin-Embedder-Policy" | "Cross-Origin-Opener-Policy" | "Cross-Origin-Resource-Policy" | "Date" | "ETag" | "Expires" | "Last-Modified" | "Location" | "Permissions-Policy" | "Pragma" | "Retry-After" | "Save-Data" | "Sec-CH-Prefers-Color-Scheme" | "Sec-CH-Prefers-Reduced-Motion" | "Sec-CH-UA" | "Sec-CH-UA-Arch" | "Sec-CH-UA-Bitness" | "Sec-CH-UA-Form-Factor" | "Sec-CH-UA-Full-Version" | "Sec-CH-UA-Full-Version-List" | "Sec-CH-UA-Mobile" | "Sec-CH-UA-Model" | "Sec-CH-UA-Platform" | "Sec-CH-UA-Platform-Version" | "Sec-CH-UA-WoW64" | "Sec-Fetch-Dest" | "Sec-Fetch-Mode" | "Sec-Fetch-Site" | "Sec-Fetch-User" | "Sec-GPC" | "Server" | "Server-Timing" | "Service-Worker-Navigation-Preload" | "Set-Cookie" | "Strict-Transport-Security" | "Timing-Allow-Origin" | "Trailer" | "Transfer-Encoding" | "Upgrade" | "Vary" | "WWW-Authenticate" | "Warning" | "X-Content-Type-Options" | "X-DNS-Prefetch-Control" | "X-Frame-Options" | "X-Permitted-Cross-Domain-Policies" | "X-Powered-By" | "X-Robots-Tag" | "X-XSS-Protection";
174
174
  interface SetHeaders {
175
175
  (name: "Content-Type", value?: BaseMime, options?: SetHeadersOptions): void;
176
176
  (name: ResponseHeader, value?: string, options?: SetHeadersOptions): void;
@@ -1,5 +1,5 @@
1
1
  import type { Context } from '../../context';
2
- export type AcceptHeader = "Accept" | "Accept-Charset" | "Accept-Encoding" | "Accept-Language" | "Accept-Patch" | "Accept-Post" | "Accept-Ranges";
2
+ import type { AcceptHeader } from '../../utils/headers';
3
3
  export interface Accept {
4
4
  type: string;
5
5
  params: Record<string, string>;
@@ -26,7 +26,7 @@ export type WSReadyState = 0 | 1 | 2 | 3;
26
26
  /**
27
27
  * An argument for WSContext class
28
28
  */
29
- export interface WSContestInit<T = unknown> {
29
+ export interface WSContextInit<T = unknown> {
30
30
  send(data: string | ArrayBuffer, options: SendOptions): void;
31
31
  close(code?: number, reason?: string): void;
32
32
  raw?: T;
@@ -44,7 +44,7 @@ export interface SendOptions {
44
44
  * A context for controlling WebSockets
45
45
  */
46
46
  export declare class WSContext<T = unknown> {
47
- constructor(init: WSContestInit<T>);
47
+ constructor(init: WSContextInit<T>);
48
48
  send(source: string | ArrayBuffer | Uint8Array, options?: SendOptions): void;
49
49
  raw?: T;
50
50
  binaryType: BinaryType;
@@ -1,6 +1,7 @@
1
1
  import type { Result } from './router';
2
2
  import type { Input, InputToDataByTarget, ParamKeyToRecord, ParamKeys, RemoveQuestion, RouterRoute, ValidationTargets } from './types';
3
3
  import type { BodyData, ParseBodyOptions } from './utils/body';
4
+ import type { CustomHeader, RequestHeader } from './utils/headers';
4
5
  import type { Simplify, UnionToIntersection } from './utils/types';
5
6
  type Body = {
6
7
  json: any;
@@ -110,8 +111,9 @@ export declare class HonoRequest<P extends string = "/", I extends Input["out"]
110
111
  * })
111
112
  * ```
112
113
  */
114
+ header(name: RequestHeader): string | undefined;
113
115
  header(name: string): string | undefined;
114
- header(): Record<string, string>;
116
+ header(): Record<RequestHeader | (string & CustomHeader), string>;
115
117
  /**
116
118
  * `.parseBody()` can parse Request body of type `multipart/form-data` or `application/x-www-form-urlencoded`
117
119
  *
@@ -3,7 +3,8 @@
3
3
  * This module contains some type definitions for the Hono modules.
4
4
  */
5
5
  import type { Context } from './context';
6
- import type { Hono } from './hono';
6
+ import type { HonoBase } from './hono-base';
7
+ import type { CustomHeader, RequestHeader } from './utils/headers';
7
8
  import type { StatusCode } from './utils/http-status';
8
9
  import type { IfAnyThenEmptyObject, IsAny, JSONValue, RemoveBlankRecord, Simplify, UnionToIntersection } from './utils/types';
9
10
  export type Bindings = object;
@@ -37,7 +38,7 @@ export interface HTTPResponseError extends Error {
37
38
  }
38
39
  export type ErrorHandler<E extends Env = any> = (err: Error | HTTPResponseError, c: Context<E>) => Response | Promise<Response>;
39
40
  export interface HandlerInterface<E extends Env = Env, M extends string = string, S extends Schema = BlankSchema, BasePath extends string = "/"> {
40
- <P extends string = ExtractStringKey<S> extends never ? BasePath : ExtractStringKey<S>, I extends Input = BlankInput, R extends HandlerResponse<any> = any, E2 extends Env = E>(handler: H<E2, P, I, R>): Hono<IntersectNonAnyTypes<[
41
+ <P extends string = ExtractStringKey<S> extends never ? BasePath : ExtractStringKey<S>, I extends Input = BlankInput, R extends HandlerResponse<any> = any, E2 extends Env = E>(handler: H<E2, P, I, R>): HonoBase<IntersectNonAnyTypes<[
41
42
  E,
42
43
  E2
43
44
  ]>, S & ToSchema<M, P, I, MergeTypedResponse<R>>, BasePath>;
@@ -47,12 +48,12 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
47
48
  ]>>(...handlers: [
48
49
  H<E2, P, I>,
49
50
  H<E3, P, I2, R>
50
- ]): Hono<IntersectNonAnyTypes<[
51
+ ]): HonoBase<IntersectNonAnyTypes<[
51
52
  E,
52
53
  E2,
53
54
  E3
54
55
  ]>, S & ToSchema<M, P, I2, MergeTypedResponse<R>>, BasePath>;
55
- <P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, E2 extends Env = E>(path: P, handler: H<E2, MergedPath, I, R>): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath>;
56
+ <P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, E2 extends Env = E>(path: P, handler: H<E2, MergedPath, I, R>): HonoBase<E, S & ToSchema<M, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath>;
56
57
  <P extends string = ExtractStringKey<S> extends never ? BasePath : ExtractStringKey<S>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, E2 extends Env = E, E3 extends Env = E, E4 extends Env = IntersectNonAnyTypes<[
57
58
  E,
58
59
  E2,
@@ -61,7 +62,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
61
62
  H<E2, P, I>,
62
63
  H<E3, P, I2>,
63
64
  H<E4, P, I3, R>
64
- ]): Hono<IntersectNonAnyTypes<[
65
+ ]): HonoBase<IntersectNonAnyTypes<[
65
66
  E,
66
67
  E2,
67
68
  E3,
@@ -73,7 +74,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
73
74
  ]>>(path: P, ...handlers: [
74
75
  H<E2, MergedPath, I>,
75
76
  H<E3, MergedPath, I2, R>
76
- ]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I2, MergeTypedResponse<R>>, BasePath>;
77
+ ]): HonoBase<E, S & ToSchema<M, MergePath<BasePath, P>, I2, MergeTypedResponse<R>>, BasePath>;
77
78
  <P extends string = ExtractStringKey<S> extends never ? BasePath : ExtractStringKey<S>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, E2 extends Env = E, E3 extends Env = E, E4 extends Env = E, E5 extends Env = IntersectNonAnyTypes<[
78
79
  E,
79
80
  E2,
@@ -84,7 +85,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
84
85
  H<E3, P, I2>,
85
86
  H<E4, P, I3>,
86
87
  H<E5, P, I4, R>
87
- ]): Hono<IntersectNonAnyTypes<[
88
+ ]): HonoBase<IntersectNonAnyTypes<[
88
89
  E,
89
90
  E2,
90
91
  E3,
@@ -99,7 +100,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
99
100
  H<E2, MergedPath, I>,
100
101
  H<E3, MergedPath, I2>,
101
102
  H<E4, MergedPath, I3, R>
102
- ]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I3, MergeTypedResponse<R>>, BasePath>;
103
+ ]): HonoBase<E, S & ToSchema<M, MergePath<BasePath, P>, I3, MergeTypedResponse<R>>, BasePath>;
103
104
  <P extends string = ExtractStringKey<S> extends never ? BasePath : ExtractStringKey<S>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, E2 extends Env = E, E3 extends Env = E, E4 extends Env = E, E5 extends Env = E, E6 extends Env = IntersectNonAnyTypes<[
104
105
  E,
105
106
  E2,
@@ -112,7 +113,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
112
113
  H<E4, P, I3>,
113
114
  H<E5, P, I4>,
114
115
  H<E6, P, I5, R>
115
- ]): Hono<IntersectNonAnyTypes<[
116
+ ]): HonoBase<IntersectNonAnyTypes<[
116
117
  E,
117
118
  E2,
118
119
  E3,
@@ -130,7 +131,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
130
131
  H<E3, MergedPath, I2>,
131
132
  H<E4, MergedPath, I3>,
132
133
  H<E5, MergedPath, I4, R>
133
- ]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I4, MergeTypedResponse<R>>, BasePath>;
134
+ ]): HonoBase<E, S & ToSchema<M, MergePath<BasePath, P>, I4, MergeTypedResponse<R>>, BasePath>;
134
135
  <P extends string = ExtractStringKey<S> extends never ? BasePath : ExtractStringKey<S>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, E2 extends Env = E, E3 extends Env = E, E4 extends Env = E, E5 extends Env = E, E6 extends Env = E, E7 extends Env = IntersectNonAnyTypes<[
135
136
  E,
136
137
  E2,
@@ -145,7 +146,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
145
146
  H<E5, P, I4>,
146
147
  H<E6, P, I5>,
147
148
  H<E7, P, I6, R>
148
- ]): Hono<IntersectNonAnyTypes<[
149
+ ]): HonoBase<IntersectNonAnyTypes<[
149
150
  E,
150
151
  E2,
151
152
  E3,
@@ -166,7 +167,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
166
167
  H<E4, MergedPath, I3>,
167
168
  H<E5, MergedPath, I4>,
168
169
  H<E6, MergedPath, I5, R>
169
- ]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I5, MergeTypedResponse<R>>, BasePath>;
170
+ ]): HonoBase<E, S & ToSchema<M, MergePath<BasePath, P>, I5, MergeTypedResponse<R>>, BasePath>;
170
171
  <P extends string = ExtractStringKey<S> extends never ? BasePath : ExtractStringKey<S>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, 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<[
171
172
  E,
172
173
  E2,
@@ -183,7 +184,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
183
184
  H<E6, P, I5>,
184
185
  H<E7, P, I6>,
185
186
  H<E8, P, I7, R>
186
- ]): Hono<IntersectNonAnyTypes<[
187
+ ]): HonoBase<IntersectNonAnyTypes<[
187
188
  E,
188
189
  E2,
189
190
  E3,
@@ -207,7 +208,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
207
208
  H<E5, MergedPath, I4>,
208
209
  H<E6, MergedPath, I5>,
209
210
  H<E7, MergedPath, I6, R>
210
- ]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I6, MergeTypedResponse<R>>, BasePath>;
211
+ ]): HonoBase<E, S & ToSchema<M, MergePath<BasePath, P>, I6, MergeTypedResponse<R>>, BasePath>;
211
212
  <P extends string = ExtractStringKey<S> extends never ? BasePath : ExtractStringKey<S>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, 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<[
212
213
  E,
213
214
  E2,
@@ -226,7 +227,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
226
227
  H<E7, P, I6>,
227
228
  H<E8, P, I7>,
228
229
  H<E9, P, I8, R>
229
- ]): Hono<IntersectNonAnyTypes<[
230
+ ]): HonoBase<IntersectNonAnyTypes<[
230
231
  E,
231
232
  E2,
232
233
  E3,
@@ -253,7 +254,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
253
254
  H<E6, MergedPath, I5>,
254
255
  H<E7, MergedPath, I6>,
255
256
  H<E8, MergedPath, I7, R>
256
- ]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I7, MergeTypedResponse<R>>, BasePath>;
257
+ ]): HonoBase<E, S & ToSchema<M, MergePath<BasePath, P>, I7, MergeTypedResponse<R>>, BasePath>;
257
258
  <P extends string = ExtractStringKey<S> extends never ? BasePath : ExtractStringKey<S>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, 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<[
258
259
  E,
259
260
  E2,
@@ -274,7 +275,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
274
275
  H<E8, P, I7>,
275
276
  H<E9, P, I8>,
276
277
  H<E10, P, I9, R>
277
- ]): Hono<IntersectNonAnyTypes<[
278
+ ]): HonoBase<IntersectNonAnyTypes<[
278
279
  E,
279
280
  E2,
280
281
  E3,
@@ -304,7 +305,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
304
305
  H<E7, MergedPath, I6>,
305
306
  H<E8, MergedPath, I7>,
306
307
  H<E9, MergedPath, I8, R>
307
- ]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I8, MergeTypedResponse<R>>, BasePath>;
308
+ ]): HonoBase<E, S & ToSchema<M, MergePath<BasePath, P>, I8, MergeTypedResponse<R>>, BasePath>;
308
309
  <P extends string = ExtractStringKey<S> extends never ? BasePath : ExtractStringKey<S>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, I10 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9, 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<[
309
310
  E,
310
311
  E2,
@@ -327,7 +328,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
327
328
  H<E9, P, I8>,
328
329
  H<E10, P, I9>,
329
330
  H<E11, P, I10, R>
330
- ]): Hono<IntersectNonAnyTypes<[
331
+ ]): HonoBase<IntersectNonAnyTypes<[
331
332
  E,
332
333
  E2,
333
334
  E3,
@@ -360,7 +361,7 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
360
361
  H<E8, MergedPath, I7>,
361
362
  H<E9, MergedPath, I8>,
362
363
  H<E10, MergedPath, I9, R>
363
- ]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I9, MergeTypedResponse<R>>, BasePath>;
364
+ ]): HonoBase<E, S & ToSchema<M, MergePath<BasePath, P>, I9, MergeTypedResponse<R>>, BasePath>;
364
365
  <P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, I3 extends Input = I & I2, I4 extends Input = I & I2 & I3, I5 extends Input = I & I2 & I3 & I4, I6 extends Input = I & I2 & I3 & I4 & I5, I7 extends Input = I & I2 & I3 & I4 & I5 & I6, I8 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7, I9 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8, I10 extends Input = I & I2 & I3 & I4 & I5 & I6 & I7 & I8 & I9, 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<[
365
366
  E,
366
367
  E2,
@@ -383,17 +384,17 @@ export interface HandlerInterface<E extends Env = Env, M extends string = string
383
384
  H<E9, MergedPath, I8>,
384
385
  H<E10, MergedPath, I9>,
385
386
  H<E11, MergedPath, I10, R>
386
- ]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I10, MergeTypedResponse<R>>, BasePath>;
387
- <P extends string = ExtractStringKey<S> extends never ? BasePath : ExtractStringKey<S>, I extends Input = BlankInput, R extends HandlerResponse<any> = any>(...handlers: H<E, P, I, R>[]): Hono<E, S & ToSchema<M, P, I, MergeTypedResponse<R>>, BasePath>;
388
- <P extends string, I extends Input = BlankInput, R extends HandlerResponse<any> = any>(path: P, ...handlers: H<E, MergePath<BasePath, P>, I, R>[]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath>;
389
- <P extends string, R extends HandlerResponse<any> = any, I extends Input = BlankInput>(path: P): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath>;
387
+ ]): HonoBase<E, S & ToSchema<M, MergePath<BasePath, P>, I10, MergeTypedResponse<R>>, BasePath>;
388
+ <P extends string = ExtractStringKey<S> extends never ? BasePath : ExtractStringKey<S>, I extends Input = BlankInput, R extends HandlerResponse<any> = any>(...handlers: H<E, P, I, R>[]): HonoBase<E, S & ToSchema<M, P, I, MergeTypedResponse<R>>, BasePath>;
389
+ <P extends string, I extends Input = BlankInput, R extends HandlerResponse<any> = any>(path: P, ...handlers: H<E, MergePath<BasePath, P>, I, R>[]): HonoBase<E, S & ToSchema<M, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath>;
390
+ <P extends string, R extends HandlerResponse<any> = any, I extends Input = BlankInput>(path: P): HonoBase<E, S & ToSchema<M, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath>;
390
391
  }
391
392
  export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schema = BlankSchema, BasePath extends string = "/"> {
392
- <E2 extends Env = E>(...handlers: MiddlewareHandler<E2, MergePath<BasePath, ExtractStringKey<S>>>[]): Hono<IntersectNonAnyTypes<[
393
+ <E2 extends Env = E>(...handlers: MiddlewareHandler<E2, MergePath<BasePath, ExtractStringKey<S>>>[]): HonoBase<IntersectNonAnyTypes<[
393
394
  E,
394
395
  E2
395
396
  ]>, S, BasePath>;
396
- <E2 extends Env = E>(handler: MiddlewareHandler<E2, MergePath<BasePath, ExtractStringKey<S>>>): Hono<IntersectNonAnyTypes<[
397
+ <E2 extends Env = E>(handler: MiddlewareHandler<E2, MergePath<BasePath, ExtractStringKey<S>>>): HonoBase<IntersectNonAnyTypes<[
397
398
  E,
398
399
  E2
399
400
  ]>, S, BasePath>;
@@ -403,12 +404,12 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
403
404
  ]>, P extends string = MergePath<BasePath, ExtractStringKey<S>>>(...handlers: [
404
405
  MiddlewareHandler<E2, P>,
405
406
  MiddlewareHandler<E3, P>
406
- ]): Hono<IntersectNonAnyTypes<[
407
+ ]): HonoBase<IntersectNonAnyTypes<[
407
408
  E,
408
409
  E2,
409
410
  E3
410
411
  ]>, S, BasePath>;
411
- <P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, E2 extends Env = E>(path: P, handler: MiddlewareHandler<E2, MergedPath>): Hono<IntersectNonAnyTypes<[
412
+ <P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, E2 extends Env = E>(path: P, handler: MiddlewareHandler<E2, MergedPath>): HonoBase<IntersectNonAnyTypes<[
412
413
  E,
413
414
  E2
414
415
  ]>, ChangePathOfSchema<S, MergedPath>, BasePath>;
@@ -420,7 +421,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
420
421
  MiddlewareHandler<E2, P>,
421
422
  MiddlewareHandler<E3, P>,
422
423
  MiddlewareHandler<E4, P>
423
- ]): Hono<IntersectNonAnyTypes<[
424
+ ]): HonoBase<IntersectNonAnyTypes<[
424
425
  E,
425
426
  E2,
426
427
  E3,
@@ -432,7 +433,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
432
433
  ]>>(path: P, ...handlers: [
433
434
  MiddlewareHandler<E2, P>,
434
435
  MiddlewareHandler<E3, P>
435
- ]): Hono<IntersectNonAnyTypes<[
436
+ ]): HonoBase<IntersectNonAnyTypes<[
436
437
  E,
437
438
  E2,
438
439
  E3
@@ -447,7 +448,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
447
448
  MiddlewareHandler<E3, P>,
448
449
  MiddlewareHandler<E4, P>,
449
450
  MiddlewareHandler<E5, P>
450
- ]): Hono<IntersectNonAnyTypes<[
451
+ ]): HonoBase<IntersectNonAnyTypes<[
451
452
  E,
452
453
  E2,
453
454
  E3,
@@ -462,7 +463,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
462
463
  MiddlewareHandler<E2, P>,
463
464
  MiddlewareHandler<E3, P>,
464
465
  MiddlewareHandler<E4, P>
465
- ]): Hono<IntersectNonAnyTypes<[
466
+ ]): HonoBase<IntersectNonAnyTypes<[
466
467
  E,
467
468
  E2,
468
469
  E3,
@@ -480,7 +481,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
480
481
  MiddlewareHandler<E4, P>,
481
482
  MiddlewareHandler<E5, P>,
482
483
  MiddlewareHandler<E6, P>
483
- ]): Hono<IntersectNonAnyTypes<[
484
+ ]): HonoBase<IntersectNonAnyTypes<[
484
485
  E,
485
486
  E2,
486
487
  E3,
@@ -498,7 +499,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
498
499
  MiddlewareHandler<E3, P>,
499
500
  MiddlewareHandler<E4, P>,
500
501
  MiddlewareHandler<E5, P>
501
- ]): Hono<IntersectNonAnyTypes<[
502
+ ]): HonoBase<IntersectNonAnyTypes<[
502
503
  E,
503
504
  E2,
504
505
  E3,
@@ -519,7 +520,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
519
520
  MiddlewareHandler<E5, P>,
520
521
  MiddlewareHandler<E6, P>,
521
522
  MiddlewareHandler<E7, P>
522
- ]): Hono<IntersectNonAnyTypes<[
523
+ ]): HonoBase<IntersectNonAnyTypes<[
523
524
  E,
524
525
  E2,
525
526
  E3,
@@ -540,7 +541,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
540
541
  MiddlewareHandler<E4, P>,
541
542
  MiddlewareHandler<E5, P>,
542
543
  MiddlewareHandler<E6, P>
543
- ]): Hono<IntersectNonAnyTypes<[
544
+ ]): HonoBase<IntersectNonAnyTypes<[
544
545
  E,
545
546
  E2,
546
547
  E3,
@@ -564,7 +565,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
564
565
  MiddlewareHandler<E6, P>,
565
566
  MiddlewareHandler<E7, P>,
566
567
  MiddlewareHandler<E8, P>
567
- ]): Hono<IntersectNonAnyTypes<[
568
+ ]): HonoBase<IntersectNonAnyTypes<[
568
569
  E,
569
570
  E2,
570
571
  E3,
@@ -588,7 +589,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
588
589
  MiddlewareHandler<E5, P>,
589
590
  MiddlewareHandler<E6, P>,
590
591
  MiddlewareHandler<E7, P>
591
- ]): Hono<IntersectNonAnyTypes<[
592
+ ]): HonoBase<IntersectNonAnyTypes<[
592
593
  E,
593
594
  E2,
594
595
  E3,
@@ -615,7 +616,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
615
616
  MiddlewareHandler<E7, P>,
616
617
  MiddlewareHandler<E8, P>,
617
618
  MiddlewareHandler<E9, P>
618
- ]): Hono<IntersectNonAnyTypes<[
619
+ ]): HonoBase<IntersectNonAnyTypes<[
619
620
  E,
620
621
  E2,
621
622
  E3,
@@ -642,7 +643,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
642
643
  MiddlewareHandler<E6, P>,
643
644
  MiddlewareHandler<E7, P>,
644
645
  MiddlewareHandler<E8, P>
645
- ]): Hono<IntersectNonAnyTypes<[
646
+ ]): HonoBase<IntersectNonAnyTypes<[
646
647
  E,
647
648
  E2,
648
649
  E3,
@@ -672,7 +673,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
672
673
  MiddlewareHandler<E8, P>,
673
674
  MiddlewareHandler<E9, P>,
674
675
  MiddlewareHandler<E10, P>
675
- ]): Hono<IntersectNonAnyTypes<[
676
+ ]): HonoBase<IntersectNonAnyTypes<[
676
677
  E,
677
678
  E2,
678
679
  E3,
@@ -702,7 +703,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
702
703
  MiddlewareHandler<E7, P>,
703
704
  MiddlewareHandler<E8, P>,
704
705
  MiddlewareHandler<E9, P>
705
- ]): Hono<IntersectNonAnyTypes<[
706
+ ]): HonoBase<IntersectNonAnyTypes<[
706
707
  E,
707
708
  E2,
708
709
  E3,
@@ -735,7 +736,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
735
736
  MiddlewareHandler<E9, P>,
736
737
  MiddlewareHandler<E10, P>,
737
738
  MiddlewareHandler<E11, P>
738
- ]): Hono<IntersectNonAnyTypes<[
739
+ ]): HonoBase<IntersectNonAnyTypes<[
739
740
  E,
740
741
  E2,
741
742
  E3,
@@ -768,7 +769,7 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
768
769
  MiddlewareHandler<E8, P>,
769
770
  MiddlewareHandler<E9, P>,
770
771
  MiddlewareHandler<E10, P>
771
- ]): Hono<IntersectNonAnyTypes<[
772
+ ]): HonoBase<IntersectNonAnyTypes<[
772
773
  E,
773
774
  E2,
774
775
  E3,
@@ -780,10 +781,10 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schem
780
781
  E9,
781
782
  E10
782
783
  ]>, ChangePathOfSchema<S, MergedPath>, BasePath>;
783
- <P extends string, E2 extends Env = E>(path: P, ...handlers: MiddlewareHandler<E2, MergePath<BasePath, P>>[]): Hono<E, S, BasePath>;
784
+ <P extends string, E2 extends Env = E>(path: P, ...handlers: MiddlewareHandler<E2, MergePath<BasePath, P>>[]): HonoBase<E, S, BasePath>;
784
785
  }
785
786
  export interface OnHandlerInterface<E extends Env = Env, S extends Schema = BlankSchema, BasePath extends string = "/"> {
786
- <M extends string, P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, E2 extends Env = E>(method: M, path: P, handler: H<E2, MergedPath, I, R>): Hono<IntersectNonAnyTypes<[
787
+ <M extends string, P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, E2 extends Env = E>(method: M, path: P, handler: H<E2, MergedPath, I, R>): HonoBase<IntersectNonAnyTypes<[
787
788
  E,
788
789
  E2
789
790
  ]>, S & ToSchema<M, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath>;
@@ -793,7 +794,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
793
794
  ]>>(method: M, path: P, ...handlers: [
794
795
  H<E2, MergedPath, I>,
795
796
  H<E3, MergedPath, I2, R>
796
- ]): Hono<IntersectNonAnyTypes<[
797
+ ]): HonoBase<IntersectNonAnyTypes<[
797
798
  E,
798
799
  E2,
799
800
  E3
@@ -806,7 +807,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
806
807
  H<E2, MergedPath, I>,
807
808
  H<E3, MergedPath, I2>,
808
809
  H<E4, MergedPath, I3, R>
809
- ]): Hono<IntersectNonAnyTypes<[
810
+ ]): HonoBase<IntersectNonAnyTypes<[
810
811
  E,
811
812
  E2,
812
813
  E3,
@@ -822,7 +823,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
822
823
  H<E3, MergedPath, I2>,
823
824
  H<E4, MergedPath, I3>,
824
825
  H<E5, MergedPath, I4, R>
825
- ]): Hono<IntersectNonAnyTypes<[
826
+ ]): HonoBase<IntersectNonAnyTypes<[
826
827
  E,
827
828
  E2,
828
829
  E3,
@@ -841,7 +842,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
841
842
  H<E4, MergedPath, I3>,
842
843
  H<E5, MergedPath, I4>,
843
844
  H<E6, MergedPath, I5, R>
844
- ]): Hono<IntersectNonAnyTypes<[
845
+ ]): HonoBase<IntersectNonAnyTypes<[
845
846
  E,
846
847
  E2,
847
848
  E3,
@@ -863,7 +864,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
863
864
  H<E5, MergedPath, I4>,
864
865
  H<E6, MergedPath, I5>,
865
866
  H<E7, MergedPath, I6, R>
866
- ]): Hono<IntersectNonAnyTypes<[
867
+ ]): HonoBase<IntersectNonAnyTypes<[
867
868
  E,
868
869
  E2,
869
870
  E3,
@@ -888,7 +889,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
888
889
  H<E6, MergedPath, I5>,
889
890
  H<E7, MergedPath, I6>,
890
891
  H<E8, MergedPath, I7, R>
891
- ]): Hono<IntersectNonAnyTypes<[
892
+ ]): HonoBase<IntersectNonAnyTypes<[
892
893
  E,
893
894
  E2,
894
895
  E3,
@@ -916,7 +917,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
916
917
  H<E7, MergedPath, I6>,
917
918
  H<E8, MergedPath, I7>,
918
919
  H<E9, MergedPath, I8, R>
919
- ]): Hono<IntersectNonAnyTypes<[
920
+ ]): HonoBase<IntersectNonAnyTypes<[
920
921
  E,
921
922
  E2,
922
923
  E3,
@@ -947,7 +948,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
947
948
  H<E8, MergedPath, I7>,
948
949
  H<E9, MergedPath, I8>,
949
950
  H<E10, MergedPath, I9, R>
950
- ]): Hono<IntersectNonAnyTypes<[
951
+ ]): HonoBase<IntersectNonAnyTypes<[
951
952
  E,
952
953
  E2,
953
954
  E3,
@@ -981,7 +982,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
981
982
  H<E9, MergedPath, I8>,
982
983
  H<E10, MergedPath, I9>,
983
984
  H<E11, MergedPath, I10>
984
- ]): Hono<IntersectNonAnyTypes<[
985
+ ]): HonoBase<IntersectNonAnyTypes<[
985
986
  E,
986
987
  E2,
987
988
  E3,
@@ -994,8 +995,8 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
994
995
  E10,
995
996
  E11
996
997
  ]>, S & ToSchema<M, MergePath<BasePath, P>, I10, MergeTypedResponse<HandlerResponse<any>>>, BasePath>;
997
- <M extends string, P extends string, R extends HandlerResponse<any> = any, I extends Input = BlankInput>(method: M, path: P, ...handlers: H<E, MergePath<BasePath, P>, I, R>[]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath>;
998
- <Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, E2 extends Env = E>(methods: Ms, path: P, handler: H<E2, MergedPath, I, R>): Hono<IntersectNonAnyTypes<[
998
+ <M extends string, P extends string, R extends HandlerResponse<any> = any, I extends Input = BlankInput>(method: M, path: P, ...handlers: H<E, MergePath<BasePath, P>, I, R>[]): HonoBase<E, S & ToSchema<M, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath>;
999
+ <Ms extends string[], P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, E2 extends Env = E>(methods: Ms, path: P, handler: H<E2, MergedPath, I, R>): HonoBase<IntersectNonAnyTypes<[
999
1000
  E,
1000
1001
  E2
1001
1002
  ]>, S & ToSchema<Ms[number], MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath>;
@@ -1005,7 +1006,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
1005
1006
  ]>>(methods: Ms, path: P, ...handlers: [
1006
1007
  H<E2, MergedPath, I>,
1007
1008
  H<E3, MergedPath, I2, R>
1008
- ]): Hono<IntersectNonAnyTypes<[
1009
+ ]): HonoBase<IntersectNonAnyTypes<[
1009
1010
  E,
1010
1011
  E2,
1011
1012
  E3
@@ -1018,7 +1019,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
1018
1019
  H<E2, MergedPath, I>,
1019
1020
  H<E3, MergedPath, I2>,
1020
1021
  H<E4, MergedPath, I3, R>
1021
- ]): Hono<IntersectNonAnyTypes<[
1022
+ ]): HonoBase<IntersectNonAnyTypes<[
1022
1023
  E,
1023
1024
  E2,
1024
1025
  E3,
@@ -1034,7 +1035,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
1034
1035
  H<E3, MergedPath, I2>,
1035
1036
  H<E4, MergedPath, I3>,
1036
1037
  H<E5, MergedPath, I4, R>
1037
- ]): Hono<IntersectNonAnyTypes<[
1038
+ ]): HonoBase<IntersectNonAnyTypes<[
1038
1039
  E,
1039
1040
  E2,
1040
1041
  E3,
@@ -1053,7 +1054,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
1053
1054
  H<E4, MergedPath, I3>,
1054
1055
  H<E5, MergedPath, I4>,
1055
1056
  H<E6, MergedPath, I5, R>
1056
- ]): Hono<IntersectNonAnyTypes<[
1057
+ ]): HonoBase<IntersectNonAnyTypes<[
1057
1058
  E,
1058
1059
  E2,
1059
1060
  E3,
@@ -1075,7 +1076,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
1075
1076
  H<E5, MergedPath, I4>,
1076
1077
  H<E6, MergedPath, I5>,
1077
1078
  H<E7, MergedPath, I6, R>
1078
- ]): Hono<IntersectNonAnyTypes<[
1079
+ ]): HonoBase<IntersectNonAnyTypes<[
1079
1080
  E,
1080
1081
  E2,
1081
1082
  E3,
@@ -1100,7 +1101,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
1100
1101
  H<E6, MergedPath, I5>,
1101
1102
  H<E7, MergedPath, I6>,
1102
1103
  H<E8, MergedPath, I7, R>
1103
- ]): Hono<IntersectNonAnyTypes<[
1104
+ ]): HonoBase<IntersectNonAnyTypes<[
1104
1105
  E,
1105
1106
  E2,
1106
1107
  E3,
@@ -1128,7 +1129,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
1128
1129
  H<E7, MergedPath, I6>,
1129
1130
  H<E8, MergedPath, I7>,
1130
1131
  H<E9, MergedPath, I8, R>
1131
- ]): Hono<IntersectNonAnyTypes<[
1132
+ ]): HonoBase<IntersectNonAnyTypes<[
1132
1133
  E,
1133
1134
  E2,
1134
1135
  E3,
@@ -1159,7 +1160,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
1159
1160
  H<E8, MergedPath, I7>,
1160
1161
  H<E9, MergedPath, I8>,
1161
1162
  H<E10, MergedPath, I9>
1162
- ]): Hono<IntersectNonAnyTypes<[
1163
+ ]): HonoBase<IntersectNonAnyTypes<[
1163
1164
  E,
1164
1165
  E2,
1165
1166
  E3,
@@ -1193,7 +1194,7 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
1193
1194
  H<E9, MergedPath, I8>,
1194
1195
  H<E10, MergedPath, I9>,
1195
1196
  H<E11, MergedPath, I10>
1196
- ]): Hono<IntersectNonAnyTypes<[
1197
+ ]): HonoBase<IntersectNonAnyTypes<[
1197
1198
  E,
1198
1199
  E2,
1199
1200
  E3,
@@ -1206,8 +1207,8 @@ export interface OnHandlerInterface<E extends Env = Env, S extends Schema = Blan
1206
1207
  E10,
1207
1208
  E11
1208
1209
  ]>, S & ToSchema<Ms[number], MergePath<BasePath, P>, I10, MergeTypedResponse<HandlerResponse<any>>>, BasePath>;
1209
- <P extends string, R extends HandlerResponse<any> = any, I extends Input = BlankInput>(methods: string[], path: P, ...handlers: H<E, MergePath<BasePath, P>, I, R>[]): Hono<E, S & ToSchema<string, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath>;
1210
- <I extends Input = BlankInput, R extends HandlerResponse<any> = any>(methods: string | string[], paths: string[], ...handlers: H<E, any, I, R>[]): Hono<E, S & ToSchema<string, string, I, MergeTypedResponse<R>>, BasePath>;
1210
+ <P extends string, R extends HandlerResponse<any> = any, I extends Input = BlankInput>(methods: string[], path: P, ...handlers: H<E, MergePath<BasePath, P>, I, R>[]): HonoBase<E, S & ToSchema<string, MergePath<BasePath, P>, I, MergeTypedResponse<R>>, BasePath>;
1211
+ <I extends Input = BlankInput, R extends HandlerResponse<any> = any>(methods: string | string[], paths: string[], ...handlers: H<E, any, I, R>[]): HonoBase<E, S & ToSchema<string, string, I, MergeTypedResponse<R>>, BasePath>;
1211
1212
  }
1212
1213
  type ExtractStringKey<S> = keyof S & string;
1213
1214
  export type ToSchema<M extends string, P extends string, I extends Input | Input["in"], RorO> = Simplify<{
@@ -1304,7 +1305,7 @@ export type ValidationTargets<T extends FormValue = ParsedFormValue, P extends s
1304
1305
  form: Record<string, T | T[]>;
1305
1306
  query: Record<string, string | string[]>;
1306
1307
  param: Record<P, P extends `${infer _}?` ? string | undefined : string>;
1307
- header: Record<string, string>;
1308
+ header: Record<RequestHeader | CustomHeader, string>;
1308
1309
  cookie: Record<string, string>;
1309
1310
  };
1310
1311
  type ParamKeyName<NameWithPattern> = NameWithPattern extends `${infer Name}{${infer Rest}` ? Rest extends `${infer _Pattern}?` ? `${Name}?` : Name : NameWithPattern;
@@ -1317,7 +1318,7 @@ export type InputToDataByTarget<T extends Input["out"], Target extends keyof Val
1317
1318
  [K in Target]: infer R;
1318
1319
  } ? R : never;
1319
1320
  export type RemoveQuestion<T> = T extends `${infer R}?` ? R : T;
1320
- export type ExtractSchema<T> = UnionToIntersection<T extends Hono<infer _, infer S, any> ? S : never>;
1321
+ export type ExtractSchema<T> = UnionToIntersection<T extends HonoBase<infer _, infer S, any> ? S : never>;
1321
1322
  type EnvOrEmpty<T> = T extends Env ? (Env extends T ? {} : T) : T;
1322
1323
  type IntersectNonAnyTypes<T extends any[]> = T extends [
1323
1324
  infer Head,
@@ -4,11 +4,11 @@
4
4
  */
5
5
  export type Cookie = Record<string, string>;
6
6
  export type SignedCookie = Record<string, string | false>;
7
- type PartitionCookieConstraint = {
8
- partition: true;
7
+ type PartitionedCookieConstraint = {
8
+ partitioned: true;
9
9
  secure: true;
10
10
  } | {
11
- partition?: boolean;
11
+ partitioned?: boolean;
12
12
  secure?: boolean;
13
13
  };
14
14
  type SecureCookieConstraint = {
@@ -30,7 +30,7 @@ export type CookieOptions = {
30
30
  sameSite?: "Strict" | "Lax" | "None" | "strict" | "lax" | "none";
31
31
  partitioned?: boolean;
32
32
  prefix?: CookiePrefixOptions;
33
- } & PartitionCookieConstraint;
33
+ } & PartitionedCookieConstraint;
34
34
  export type CookiePrefixOptions = "host" | "secure";
35
35
  export type CookieConstraint<Name> = Name extends `__Secure-${string}` ? CookieOptions & SecureCookieConstraint : Name extends `__Host-${string}` ? CookieOptions & HostCookieConstraint : CookieOptions;
36
36
  export declare const parse: (cookie: string, name?: string) => Cookie;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @module
3
+ * HTTP Headers utility.
4
+ */
5
+ export type RequestHeader = "A-IM" | "Accept" | "Accept-Additions" | "Accept-CH" | "Accept-Charset" | "Accept-Datetime" | "Accept-Encoding" | "Accept-Features" | "Accept-Language" | "Accept-Patch" | "Accept-Post" | "Accept-Ranges" | "Accept-Signature" | "Access-Control" | "Access-Control-Allow-Credentials" | "Access-Control-Allow-Headers" | "Access-Control-Allow-Methods" | "Access-Control-Allow-Origin" | "Access-Control-Expose-Headers" | "Access-Control-Max-Age" | "Access-Control-Request-Headers" | "Access-Control-Request-Method" | "Age" | "Allow" | "ALPN" | "Alt-Svc" | "Alt-Used" | "Alternates" | "AMP-Cache-Transform" | "Apply-To-Redirect-Ref" | "Authentication-Control" | "Authentication-Info" | "Authorization" | "Available-Dictionary" | "C-Ext" | "C-Man" | "C-Opt" | "C-PEP" | "C-PEP-Info" | "Cache-Control" | "Cache-Status" | "Cal-Managed-ID" | "CalDAV-Timezones" | "Capsule-Protocol" | "CDN-Cache-Control" | "CDN-Loop" | "Cert-Not-After" | "Cert-Not-Before" | "Clear-Site-Data" | "Client-Cert" | "Client-Cert-Chain" | "Close" | "CMCD-Object" | "CMCD-Request" | "CMCD-Session" | "CMCD-Status" | "CMSD-Dynamic" | "CMSD-Static" | "Concealed-Auth-Export" | "Configuration-Context" | "Connection" | "Content-Base" | "Content-Digest" | "Content-Disposition" | "Content-Encoding" | "Content-ID" | "Content-Language" | "Content-Length" | "Content-Location" | "Content-MD5" | "Content-Range" | "Content-Script-Type" | "Content-Security-Policy" | "Content-Security-Policy-Report-Only" | "Content-Style-Type" | "Content-Type" | "Content-Version" | "Cookie" | "Cookie2" | "Cross-Origin-Embedder-Policy" | "Cross-Origin-Embedder-Policy-Report-Only" | "Cross-Origin-Opener-Policy" | "Cross-Origin-Opener-Policy-Report-Only" | "Cross-Origin-Resource-Policy" | "CTA-Common-Access-Token" | "DASL" | "Date" | "DAV" | "Default-Style" | "Delta-Base" | "Deprecation" | "Depth" | "Derived-From" | "Destination" | "Differential-ID" | "Dictionary-ID" | "Digest" | "DPoP" | "DPoP-Nonce" | "Early-Data" | "EDIINT-Features" | "ETag" | "Expect" | "Expect-CT" | "Expires" | "Ext" | "Forwarded" | "From" | "GetProfile" | "Hobareg" | "Host" | "HTTP2-Settings" | "If" | "If-Match" | "If-Modified-Since" | "If-None-Match" | "If-Range" | "If-Schedule-Tag-Match" | "If-Unmodified-Since" | "IM" | "Include-Referred-Token-Binding-ID" | "Isolation" | "Keep-Alive" | "Label" | "Last-Event-ID" | "Last-Modified" | "Link" | "Link-Template" | "Location" | "Lock-Token" | "Man" | "Max-Forwards" | "Memento-Datetime" | "Meter" | "Method-Check" | "Method-Check-Expires" | "MIME-Version" | "Negotiate" | "NEL" | "OData-EntityId" | "OData-Isolation" | "OData-MaxVersion" | "OData-Version" | "Opt" | "Optional-WWW-Authenticate" | "Ordering-Type" | "Origin" | "Origin-Agent-Cluster" | "OSCORE" | "OSLC-Core-Version" | "Overwrite" | "P3P" | "PEP" | "PEP-Info" | "Permissions-Policy" | "PICS-Label" | "Ping-From" | "Ping-To" | "Position" | "Pragma" | "Prefer" | "Preference-Applied" | "Priority" | "ProfileObject" | "Protocol" | "Protocol-Info" | "Protocol-Query" | "Protocol-Request" | "Proxy-Authenticate" | "Proxy-Authentication-Info" | "Proxy-Authorization" | "Proxy-Features" | "Proxy-Instruction" | "Proxy-Status" | "Public" | "Public-Key-Pins" | "Public-Key-Pins-Report-Only" | "Range" | "Redirect-Ref" | "Referer" | "Referer-Root" | "Referrer-Policy" | "Refresh" | "Repeatability-Client-ID" | "Repeatability-First-Sent" | "Repeatability-Request-ID" | "Repeatability-Result" | "Replay-Nonce" | "Reporting-Endpoints" | "Repr-Digest" | "Retry-After" | "Safe" | "Schedule-Reply" | "Schedule-Tag" | "Sec-GPC" | "Sec-Purpose" | "Sec-Token-Binding" | "Sec-WebSocket-Accept" | "Sec-WebSocket-Extensions" | "Sec-WebSocket-Key" | "Sec-WebSocket-Protocol" | "Sec-WebSocket-Version" | "Security-Scheme" | "Server" | "Server-Timing" | "Set-Cookie" | "Set-Cookie2" | "SetProfile" | "Signature" | "Signature-Input" | "SLUG" | "SoapAction" | "Status-URI" | "Strict-Transport-Security" | "Sunset" | "Surrogate-Capability" | "Surrogate-Control" | "TCN" | "TE" | "Timeout" | "Timing-Allow-Origin" | "Topic" | "Traceparent" | "Tracestate" | "Trailer" | "Transfer-Encoding" | "TTL" | "Upgrade" | "Urgency" | "URI" | "Use-As-Dictionary" | "User-Agent" | "Variant-Vary" | "Vary" | "Via" | "Want-Content-Digest" | "Want-Digest" | "Want-Repr-Digest" | "Warning" | "WWW-Authenticate" | "X-Content-Type-Options" | "X-Frame-Options";
6
+ export type ResponseHeader = "Access-Control-Allow-Credentials" | "Access-Control-Allow-Headers" | "Access-Control-Allow-Methods" | "Access-Control-Allow-Origin" | "Access-Control-Expose-Headers" | "Access-Control-Max-Age" | "Age" | "Allow" | "Cache-Control" | "Clear-Site-Data" | "Content-Disposition" | "Content-Encoding" | "Content-Language" | "Content-Length" | "Content-Location" | "Content-Range" | "Content-Security-Policy" | "Content-Security-Policy-Report-Only" | "Content-Type" | "Cookie" | "Cross-Origin-Embedder-Policy" | "Cross-Origin-Opener-Policy" | "Cross-Origin-Resource-Policy" | "Date" | "ETag" | "Expires" | "Last-Modified" | "Location" | "Permissions-Policy" | "Pragma" | "Retry-After" | "Save-Data" | "Sec-CH-Prefers-Color-Scheme" | "Sec-CH-Prefers-Reduced-Motion" | "Sec-CH-UA" | "Sec-CH-UA-Arch" | "Sec-CH-UA-Bitness" | "Sec-CH-UA-Form-Factor" | "Sec-CH-UA-Full-Version" | "Sec-CH-UA-Full-Version-List" | "Sec-CH-UA-Mobile" | "Sec-CH-UA-Model" | "Sec-CH-UA-Platform" | "Sec-CH-UA-Platform-Version" | "Sec-CH-UA-WoW64" | "Sec-Fetch-Dest" | "Sec-Fetch-Mode" | "Sec-Fetch-Site" | "Sec-Fetch-User" | "Sec-GPC" | "Server" | "Server-Timing" | "Service-Worker-Navigation-Preload" | "Set-Cookie" | "Strict-Transport-Security" | "Timing-Allow-Origin" | "Trailer" | "Transfer-Encoding" | "Upgrade" | "Vary" | "WWW-Authenticate" | "Warning" | "X-Content-Type-Options" | "X-DNS-Prefetch-Control" | "X-Frame-Options" | "X-Permitted-Cross-Domain-Policies" | "X-Powered-By" | "X-Robots-Tag" | "X-XSS-Protection";
7
+ export type AcceptHeader = "Accept" | "Accept-Charset" | "Accept-Encoding" | "Accept-Language" | "Accept-Patch" | "Accept-Post" | "Accept-Ranges";
8
+ export type CustomHeader = string & {};
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono",
3
- "version": "4.6.7",
3
+ "version": "4.6.8",
4
4
  "description": "Web framework built on Web Standards",
5
5
  "main": "dist/cjs/index.js",
6
6
  "type": "module",