Comparing version 4.1.3 to 4.1.4
@@ -32,3 +32,3 @@ "use strict"; | ||
try { | ||
return children.map((c) => c.toString()); | ||
return children.flat().map((c) => c == null || typeof c === "boolean" ? "" : c.toString()); | ||
} catch (e) { | ||
@@ -57,3 +57,5 @@ if (e instanceof Promise) { | ||
try { | ||
resArray = children.map((c) => c.toString()); | ||
resArray = children.map( | ||
(c) => c == null || typeof c === "boolean" ? "" : c.toString() | ||
); | ||
} catch (e) { | ||
@@ -60,0 +62,0 @@ fallbackStr = await fallback?.toString(); |
@@ -297,3 +297,3 @@ "use strict"; | ||
}; | ||
const useDebugValue = (value, formatter) => { | ||
const useDebugValue = (_value, _formatter) => { | ||
}; | ||
@@ -300,0 +300,0 @@ // Annotate the CommonJS export names for ESM import in node: |
@@ -51,3 +51,5 @@ "use strict"; | ||
import_render.buildDataStack.push([[], stackNode]); | ||
resArray = children.map((c) => c.toString()); | ||
resArray = children.map( | ||
(c) => c == null || typeof c === "boolean" ? "" : c.toString() | ||
); | ||
} catch (e) { | ||
@@ -54,0 +56,0 @@ if (e instanceof Promise) { |
@@ -33,3 +33,6 @@ "use strict"; | ||
return wildcardRegExpCache[path] ??= new RegExp( | ||
path === "*" ? "" : `^${path.replace(/\/\*/, "(?:|/.*)")}$` | ||
path === "*" ? "" : `^${path.replace( | ||
/\/\*$|([.\\+*[^\]$()])/g, | ||
(_, metaChar) => metaChar ? `\\${metaChar}` : "(?:|/.*)" | ||
)}$` | ||
); | ||
@@ -36,0 +39,0 @@ } |
@@ -9,3 +9,3 @@ // src/jsx/components.ts | ||
try { | ||
return children.map((c) => c.toString()); | ||
return children.flat().map((c) => c == null || typeof c === "boolean" ? "" : c.toString()); | ||
} catch (e) { | ||
@@ -34,3 +34,5 @@ if (e instanceof Promise) { | ||
try { | ||
resArray = children.map((c) => c.toString()); | ||
resArray = children.map( | ||
(c) => c == null || typeof c === "boolean" ? "" : c.toString() | ||
); | ||
} catch (e) { | ||
@@ -37,0 +39,0 @@ fallbackStr = await fallback?.toString(); |
@@ -261,3 +261,3 @@ // src/jsx/hooks/index.ts | ||
}; | ||
var useDebugValue = (value, formatter) => { | ||
var useDebugValue = (_value, _formatter) => { | ||
}; | ||
@@ -264,0 +264,0 @@ export { |
@@ -28,3 +28,5 @@ // src/jsx/streaming.ts | ||
buildDataStack.push([[], stackNode]); | ||
resArray = children.map((c) => c.toString()); | ||
resArray = children.map( | ||
(c) => c == null || typeof c === "boolean" ? "" : c.toString() | ||
); | ||
} catch (e) { | ||
@@ -31,0 +33,0 @@ if (e instanceof Promise) { |
@@ -15,3 +15,6 @@ // src/router/reg-exp-router/router.ts | ||
return wildcardRegExpCache[path] ??= new RegExp( | ||
path === "*" ? "" : `^${path.replace(/\/\*/, "(?:|/.*)")}$` | ||
path === "*" ? "" : `^${path.replace( | ||
/\/\*$|([.\\+*[^\]$()])/g, | ||
(_, metaChar) => metaChar ? `\\${metaChar}` : "(?:|/.*)" | ||
)}$` | ||
); | ||
@@ -18,0 +21,0 @@ } |
@@ -0,4 +1,5 @@ | ||
import type { ExecutionContext } from '../../context'; | ||
import type { Hono } from '../../hono'; | ||
type ExtractEnv<T> = T extends Hono<infer E, any, any> ? E : never; | ||
export declare const testClient: <T extends Hono<any, any, any>>(app: T, Env?: {} | ExtractEnv<T>["Bindings"] | undefined, executionCtx?: any) => import("../../utils/types").UnionToIntersection<import("../../client/types").Client<T>>; | ||
export declare const testClient: <T extends Hono<any, any, any>>(app: T, Env?: {} | ExtractEnv<T>["Bindings"] | undefined, executionCtx?: ExecutionContext) => import("../../utils/types").UnionToIntersection<import("../../client/types").Client<T>>; | ||
export {}; |
@@ -18,3 +18,3 @@ import type { StringBuffer, HtmlEscaped, HtmlEscapedString } from '../utils/html'; | ||
type LocalContexts = [Context<unknown>, unknown][]; | ||
export type Child = string | Promise<string> | number | JSXNode | Child[]; | ||
export type Child = string | Promise<string> | number | JSXNode | null | undefined | boolean | Child[]; | ||
export declare class JSXNode implements HtmlEscaped { | ||
@@ -39,3 +39,3 @@ tag: string | Function; | ||
key?: string | undefined; | ||
children?: HtmlEscapedString | Child | undefined; | ||
children?: Child | HtmlEscapedString; | ||
}) => HtmlEscapedString; | ||
@@ -42,0 +42,0 @@ export declare const isValidElement: (element: unknown) => element is JSXNode; |
@@ -25,3 +25,3 @@ import type { Props, Child, JSXNode } from '../base'; | ||
useReducer: <T_6, A>(reducer: (state: T_6, action: A) => T_6, initialArg: T_6, init?: ((initialState: T_6) => T_6) | undefined) => [T_6, (action: A) => void]; | ||
useDebugValue: (value: unknown, formatter?: ((value: unknown) => string) | undefined) => void; | ||
useDebugValue: (_value: unknown, _formatter?: ((value: unknown) => string) | undefined) => void; | ||
Suspense: import("../base").FC<import("..").PropsWithChildren<{ | ||
@@ -31,3 +31,3 @@ fallback: any; | ||
ErrorBoundary: import("../base").FC<import("..").PropsWithChildren<{ | ||
fallback?: Child | undefined; | ||
fallback?: Child; | ||
fallbackRender?: import("../components").FallbackRender | undefined; | ||
@@ -34,0 +34,0 @@ onError?: import("../components").ErrorHandler | undefined; |
@@ -28,3 +28,3 @@ type UpdateStateFunction<T> = (newState: T | ((currentState: T) => T)) => void; | ||
export declare const useMemo: <T>(factory: () => T, deps: readonly unknown[]) => T; | ||
export declare const useDebugValue: (value: unknown, formatter?: ((value: unknown) => string) | undefined) => void; | ||
export declare const useDebugValue: (_value: unknown, _formatter?: ((value: unknown) => string) | undefined) => void; | ||
export {}; |
@@ -11,3 +11,3 @@ import { jsx, memo, Fragment, isValidElement, cloneElement } from './base'; | ||
key?: string | undefined; | ||
children?: import("../utils/html").HtmlEscapedString | import("./base").Child | undefined; | ||
children?: import("../utils/html").HtmlEscapedString | import("./base").Child; | ||
}) => import("../utils/html").HtmlEscapedString; | ||
@@ -18,3 +18,3 @@ isValidElement: (element: unknown) => element is import("./base").JSXNode; | ||
ErrorBoundary: import("./base").FC<import("./types").PropsWithChildren<{ | ||
fallback?: import("./base").Child | undefined; | ||
fallback?: import("./base").Child; | ||
fallbackRender?: import("./components").FallbackRender | undefined; | ||
@@ -30,3 +30,3 @@ onError?: import("./components").ErrorHandler | undefined; | ||
useReducer: <T_7, A>(reducer: (state: T_7, action: A) => T_7, initialArg: T_7, init?: ((initialState: T_7) => T_7) | undefined) => [T_7, (action: A) => void]; | ||
useDebugValue: (value: unknown, formatter?: ((value: unknown) => string) | undefined) => void; | ||
useDebugValue: (_value: unknown, _formatter?: ((value: unknown) => string) | undefined) => void; | ||
use: <T_8>(promise: Promise<T_8>) => T_8; | ||
@@ -33,0 +33,0 @@ startTransition: (callback: () => void) => void; |
import type { Context } from './context'; | ||
import type { Hono } from './hono'; | ||
import type { IfAnyThenEmptyObject, RemoveBlankRecord, UnionToIntersection } from './utils/types'; | ||
import type { IfAnyThenEmptyObject, Prettify, RemoveBlankRecord, UnionToIntersection } from './utils/types'; | ||
export type Bindings = Record<string, unknown>; | ||
@@ -30,6 +30,22 @@ export type Variables = Record<string, unknown>; | ||
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<S>, I extends Input = BlankInput, R extends HandlerResponse<any> = any, E2 extends Env = E>(handler: H<E2, P, I, R>): Hono<IntersectNonAnyTypes<[E, E2]>, S & ToSchema<M, P, I['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<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<IntersectNonAnyTypes<[E, E2]>, S & ToSchema<M, MergePath<BasePath, P>, I['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<S>, I extends Input = BlankInput, I2 extends Input = I, R extends HandlerResponse<any> = any, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>>(...handlers: [H<E2, P, I>, H<E3, P, I2, R>]): Hono<IntersectNonAnyTypes<[E, E2, E3]>, S & ToSchema<M, P, I2['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>>(path: P, ...handlers: [H<E2, MergedPath, I>, H<E3, MergedPath, I2, R>]): Hono<IntersectNonAnyTypes<[E, E2, E3]>, S & ToSchema<M, MergePath<BasePath, P>, I2['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<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<[E, E2, E3]>>(...handlers: [H<E2, P, I>, H<E3, P, I2>, H<E4, P, I3, R>]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4]>, S & ToSchema<M, P, I3['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<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, E2 extends Env = E, E3 extends Env = E, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>>(path: P, ...handlers: [H<E2, MergedPath, I>, H<E3, MergedPath, I2>, H<E4, MergedPath, I3, R>]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4]>, S & ToSchema<M, MergePath<BasePath, P>, I3['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<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<[E, E2, E3, E4]>>(...handlers: [H<E2, P, I>, H<E3, P, I2>, H<E4, P, I3>, H<E5, P, I4, R>]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, S & ToSchema<M, P, I4['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<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, E2 extends Env = E, E3 extends Env = E, E4 extends Env = E, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>>(path: P, ...handlers: [ | ||
H<E2, MergedPath, I>, | ||
H<E3, MergedPath, I2>, | ||
H<E4, MergedPath, I3>, | ||
H<E5, MergedPath, I4, R> | ||
]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5]>, S & ToSchema<M, MergePath<BasePath, P>, I4['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<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<[E, E2, E3, E4, E5]>>(...handlers: [H<E2, P, I>, H<E3, P, I2>, H<E4, P, I3>, H<E5, P, I4>, H<E6, P, I5, R>]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, S & ToSchema<M, P, I5['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<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, 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: [ | ||
H<E2, MergedPath, I>, | ||
H<E3, MergedPath, I2>, | ||
H<E4, MergedPath, I3>, | ||
H<E5, MergedPath, I4>, | ||
H<E6, MergedPath, I5, R> | ||
]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6]>, S & ToSchema<M, MergePath<BasePath, P>, I5['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<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<[E, E2, E3, E4, E5, E6]>>(...handlers: [ | ||
@@ -43,2 +59,10 @@ H<E2, P, I>, | ||
]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, S & ToSchema<M, P, I6['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<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, 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: [ | ||
H<E2, MergedPath, I>, | ||
H<E3, MergedPath, I2>, | ||
H<E4, MergedPath, I3>, | ||
H<E5, MergedPath, I4>, | ||
H<E6, MergedPath, I5>, | ||
H<E7, MergedPath, I6, R> | ||
]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7]>, S & ToSchema<M, MergePath<BasePath, P>, I6['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<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<[E, E2, E3, E4, E5, E6, E7]>>(...handlers: [ | ||
@@ -53,2 +77,11 @@ H<E2, P, I>, | ||
]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, S & ToSchema<M, P, I7['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<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, 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: [ | ||
H<E2, MergedPath, I>, | ||
H<E3, MergedPath, I2>, | ||
H<E4, MergedPath, I3>, | ||
H<E5, MergedPath, I4>, | ||
H<E6, MergedPath, I5>, | ||
H<E7, MergedPath, I6>, | ||
H<E8, MergedPath, I7, R> | ||
]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8]>, S & ToSchema<M, MergePath<BasePath, P>, I7['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<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<[E, E2, E3, E4, E5, E6, E7, E8]>>(...handlers: [ | ||
@@ -64,2 +97,12 @@ H<E2, P, I>, | ||
]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, S & ToSchema<M, P, I8['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<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, 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: [ | ||
H<E2, MergedPath, I>, | ||
H<E3, MergedPath, I2>, | ||
H<E4, MergedPath, I3>, | ||
H<E5, MergedPath, I4>, | ||
H<E6, MergedPath, I5>, | ||
H<E7, MergedPath, I6>, | ||
H<E8, MergedPath, I7>, | ||
H<E9, MergedPath, I8, R> | ||
]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9]>, S & ToSchema<M, MergePath<BasePath, P>, I8['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<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<[E, E2, E3, E4, E5, E6, E7, E8, E9]>>(...handlers: [ | ||
@@ -76,2 +119,13 @@ H<E2, P, I>, | ||
]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>, S & ToSchema<M, P, I9['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<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, 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: [ | ||
H<E2, MergedPath, I>, | ||
H<E3, MergedPath, I2>, | ||
H<E4, MergedPath, I3>, | ||
H<E5, MergedPath, I4>, | ||
H<E6, MergedPath, I5>, | ||
H<E7, MergedPath, I6>, | ||
H<E8, MergedPath, I7>, | ||
H<E9, MergedPath, I8>, | ||
H<E10, MergedPath, I9, R> | ||
]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>, S & ToSchema<M, MergePath<BasePath, P>, I9['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<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<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>>(...handlers: [ | ||
@@ -89,58 +143,2 @@ H<E2, P, I>, | ||
]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11]>, S & ToSchema<M, P, I10['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<S>, I extends Input = BlankInput, R extends HandlerResponse<any> = any>(...handlers: H<E, P, I, R>[]): Hono<E, S & ToSchema<M, P, I['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<P extends string, R extends HandlerResponse<any> = any, I extends Input = {}>(path: P): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<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['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<P extends string, MergedPath extends MergePath<BasePath, P> = MergePath<BasePath, P>, R extends HandlerResponse<any> = any, I extends Input = BlankInput, I2 extends Input = I, E2 extends Env = E, E3 extends Env = IntersectNonAnyTypes<[E, E2]>>(path: P, ...handlers: [H<E2, MergedPath, I>, H<E3, MergedPath, I2, R>]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I2['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<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, E2 extends Env = E, E3 extends Env = E, E4 extends Env = IntersectNonAnyTypes<[E, E2, E3]>>(path: P, ...handlers: [H<E2, MergedPath, I>, H<E3, MergedPath, I2>, H<E4, MergedPath, I3, R>]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I3['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<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, E2 extends Env = E, E3 extends Env = E, E4 extends Env = E, E5 extends Env = IntersectNonAnyTypes<[E, E2, E3, E4]>>(path: P, ...handlers: [ | ||
H<E2, MergedPath, I>, | ||
H<E3, MergedPath, I2>, | ||
H<E4, MergedPath, I3>, | ||
H<E5, MergedPath, I4, R> | ||
]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I4['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<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, 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: [ | ||
H<E2, MergedPath, I>, | ||
H<E3, MergedPath, I2>, | ||
H<E4, MergedPath, I3>, | ||
H<E5, MergedPath, I4>, | ||
H<E6, MergedPath, I5, R> | ||
]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I5['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<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, 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: [ | ||
H<E2, MergedPath, I>, | ||
H<E3, MergedPath, I2>, | ||
H<E4, MergedPath, I3>, | ||
H<E5, MergedPath, I4>, | ||
H<E6, MergedPath, I5>, | ||
H<E7, MergedPath, I6, R> | ||
]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I6['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<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, 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: [ | ||
H<E2, MergedPath, I>, | ||
H<E3, MergedPath, I2>, | ||
H<E4, MergedPath, I3>, | ||
H<E5, MergedPath, I4>, | ||
H<E6, MergedPath, I5>, | ||
H<E7, MergedPath, I6>, | ||
H<E8, MergedPath, I7, R> | ||
]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I7['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<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, 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: [ | ||
H<E2, MergedPath, I>, | ||
H<E3, MergedPath, I2>, | ||
H<E4, MergedPath, I3>, | ||
H<E5, MergedPath, I4>, | ||
H<E6, MergedPath, I5>, | ||
H<E7, MergedPath, I6>, | ||
H<E8, MergedPath, I7>, | ||
H<E9, MergedPath, I8, R> | ||
]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I8['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<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, 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: [ | ||
H<E2, MergedPath, I>, | ||
H<E3, MergedPath, I2>, | ||
H<E4, MergedPath, I3>, | ||
H<E5, MergedPath, I4>, | ||
H<E6, MergedPath, I5>, | ||
H<E7, MergedPath, I6>, | ||
H<E8, MergedPath, I7>, | ||
H<E9, MergedPath, I8>, | ||
H<E10, MergedPath, I9, R> | ||
]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I9['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<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<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10]>>(path: P, ...handlers: [ | ||
@@ -157,4 +155,6 @@ H<E2, MergedPath, I>, | ||
H<E11, MergedPath, I10, R> | ||
]): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I10['in'], MergeTypedResponseData<R>>, BasePath>; | ||
]): Hono<IntersectNonAnyTypes<[E, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11]>, S & ToSchema<M, MergePath<BasePath, P>, I10['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<P extends string = ExtractKey<S> extends never ? BasePath : ExtractKey<S>, I extends Input = BlankInput, R extends HandlerResponse<any> = any>(...handlers: H<E, P, I, R>[]): Hono<E, S & ToSchema<M, P, I['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<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['in'], MergeTypedResponseData<R>>, BasePath>; | ||
<P extends string, R extends HandlerResponse<any> = any, I extends Input = {}>(path: P): Hono<E, S & ToSchema<M, MergePath<BasePath, P>, I['in'], MergeTypedResponseData<R>>, BasePath>; | ||
} | ||
@@ -369,3 +369,3 @@ export interface MiddlewareHandlerInterface<E extends Env = Env, S extends Schema = {}, BasePath extends string = '/'> { | ||
type ExtractKey<S> = S extends Record<infer Key, unknown> ? Key extends string ? Key : never : string; | ||
export type ToSchema<M extends string, P extends string, I extends Input['in'], O> = { | ||
export type ToSchema<M extends string, P extends string, I extends Input['in'], O> = Prettify<{ | ||
[K in P]: { | ||
@@ -377,3 +377,3 @@ [K2 in M as AddDollar<K2>]: { | ||
}; | ||
}; | ||
}>; | ||
export type Schema = { | ||
@@ -389,5 +389,5 @@ [Path: string]: { | ||
}; | ||
type ExtractParams<Path extends string> = string extends Path ? Record<string, string> : Path extends `${infer Start}:${infer Param}/${infer Rest}` ? { | ||
type ExtractParams<Path extends string> = string extends Path ? Record<string, string> : Path extends `${infer _Start}:${infer Param}/${infer Rest}` ? { | ||
[K in Param | keyof ExtractParams<`/${Rest}`>]: string; | ||
} : Path extends `${infer Start}:${infer Param}` ? { | ||
} : Path extends `${infer _Start}:${infer Param}` ? { | ||
[K in Param]: string; | ||
@@ -398,3 +398,3 @@ } : never; | ||
} : never; | ||
export type MergeSchemaPath<OrigSchema extends Schema, SubPath extends string> = { | ||
export type MergeSchemaPath<OrigSchema extends Schema, SubPath extends string> = Prettify<{ | ||
[P in keyof OrigSchema as MergePath<SubPath, P & string>]: { | ||
@@ -419,3 +419,3 @@ [M in keyof OrigSchema[P]]: OrigSchema[P][M] extends { | ||
}; | ||
}; | ||
}>; | ||
export type AddParam<I, P extends string> = ParamKeys<P> extends never ? I : I extends { | ||
@@ -432,4 +432,3 @@ param: infer _; | ||
}; | ||
type ExtractResponseData<T> = T extends Promise<infer T2> ? T2 extends TypedResponse<infer U> ? U : {} : T extends TypedResponse<infer U> ? U : {}; | ||
type MergeTypedResponseData<T> = ExtractResponseData<T>; | ||
type MergeTypedResponseData<T> = T extends Promise<infer T2> ? T2 extends TypedResponse<infer U> ? U : {} : T extends TypedResponse<infer U> ? U : {}; | ||
export type ValidationTargets = { | ||
@@ -436,0 +435,0 @@ json: any; |
@@ -26,1 +26,4 @@ export type Expect<T extends true> = T; | ||
export type IsAny<T> = boolean extends (T extends never ? true : false) ? true : false; | ||
export type Prettify<T> = { | ||
[K in keyof T]: T[K]; | ||
} & {}; |
{ | ||
"name": "hono", | ||
"version": "4.1.3", | ||
"version": "4.1.4", | ||
"description": "Ultrafast web framework for the Edges", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
747009
20757