hono 4.6.2 → 4.6.4

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 (59) hide show
  1. package/dist/adapter/bun/serve-static.js +2 -2
  2. package/dist/adapter/deno/serve-static.js +1 -1
  3. package/dist/adapter/service-worker/handler.js +1 -1
  4. package/dist/cjs/adapter/bun/serve-static.js +2 -2
  5. package/dist/cjs/adapter/deno/serve-static.js +1 -1
  6. package/dist/cjs/adapter/service-worker/handler.js +1 -1
  7. package/dist/cjs/jsx/base.js +2 -0
  8. package/dist/cjs/jsx/jsx-runtime.js +28 -1
  9. package/dist/cjs/jsx/streaming.js +7 -4
  10. package/dist/cjs/middleware/combine/index.js +1 -0
  11. package/dist/cjs/middleware/secure-headers/secure-headers.js +8 -1
  12. package/dist/cjs/middleware/serve-static/index.js +13 -1
  13. package/dist/cjs/utils/filepath.js +3 -0
  14. package/dist/jsx/base.js +1 -0
  15. package/dist/jsx/jsx-runtime.js +28 -1
  16. package/dist/jsx/streaming.js +7 -4
  17. package/dist/middleware/combine/index.js +1 -0
  18. package/dist/middleware/secure-headers/secure-headers.js +8 -1
  19. package/dist/middleware/serve-static/index.js +13 -1
  20. package/dist/types/adapter/aws-lambda/handler.d.ts +1 -1
  21. package/dist/types/adapter/cloudflare-pages/handler.d.ts +1 -1
  22. package/dist/types/adapter/lambda-edge/handler.d.ts +2 -2
  23. package/dist/types/adapter/netlify/handler.d.ts +1 -1
  24. package/dist/types/client/utils.d.ts +1 -1
  25. package/dist/types/compose.d.ts +1 -1
  26. package/dist/types/context.d.ts +1 -1
  27. package/dist/types/helper/adapter/index.d.ts +1 -1
  28. package/dist/types/helper/dev/index.d.ts +3 -3
  29. package/dist/types/helper/factory/index.d.ts +6 -3
  30. package/dist/types/helper/ssg/utils.d.ts +1 -1
  31. package/dist/types/helper/streaming/sse.d.ts +1 -1
  32. package/dist/types/helper/streaming/stream.d.ts +1 -1
  33. package/dist/types/helper/streaming/text.d.ts +1 -1
  34. package/dist/types/helper/testing/index.d.ts +1 -1
  35. package/dist/types/hono-base.d.ts +1 -1
  36. package/dist/types/jsx/base.d.ts +5 -1
  37. package/dist/types/jsx/dom/index.d.ts +28 -28
  38. package/dist/types/jsx/dom/intrinsic-element/components.d.ts +1 -1
  39. package/dist/types/jsx/dom/server.d.ts +32 -32
  40. package/dist/types/jsx/hooks/index.d.ts +6 -6
  41. package/dist/types/jsx/index.d.ts +29 -29
  42. package/dist/types/jsx/jsx-runtime.d.ts +1 -1
  43. package/dist/types/jsx/streaming.d.ts +2 -1
  44. package/dist/types/middleware/cache/index.d.ts +4 -4
  45. package/dist/types/middleware/context-storage/index.d.ts +1 -1
  46. package/dist/types/middleware/ip-restriction/index.d.ts +2 -2
  47. package/dist/types/middleware/jwt/jwt.d.ts +4 -4
  48. package/dist/types/middleware/secure-headers/secure-headers.d.ts +2 -0
  49. package/dist/types/middleware/serve-static/index.d.ts +3 -3
  50. package/dist/types/types.d.ts +23 -23
  51. package/dist/types/utils/concurrent.d.ts +2 -2
  52. package/dist/types/utils/cookie.d.ts +1 -1
  53. package/dist/types/utils/filepath.d.ts +1 -1
  54. package/dist/types/utils/jwt/index.d.ts +2 -2
  55. package/dist/types/utils/types.d.ts +3 -1
  56. package/dist/types/validator/validator.d.ts +3 -3
  57. package/dist/utils/filepath.js +3 -0
  58. package/package.json +14 -16
  59. package/perf-measures/type-check/generated/.gitkeep +0 -0
@@ -20,29 +20,29 @@ declare const _default: {
20
20
  version: string;
21
21
  useState: {
22
22
  <T>(initialState: T | (() => T)): [T, (newState: T | ((currentState: T) => T)) => void];
23
- <T_1 = undefined>(): [T_1 | undefined, (newState: T_1 | ((currentState: T_1 | undefined) => T_1 | undefined) | undefined) => void];
23
+ <T = undefined>(): [T | undefined, (newState: T | ((currentState: T | undefined) => T | undefined) | undefined) => void];
24
24
  };
25
- useEffect: (effect: () => void | (() => void), deps?: readonly unknown[] | undefined) => void;
26
- useRef: <T_2>(initialValue: T_2 | null) => import("../hooks").RefObject<T_2>;
27
- useCallback: <T_3 extends Function>(callback: T_3, deps: readonly unknown[]) => T_3;
28
- use: <T_4>(promise: Promise<T_4>) => T_4;
25
+ useEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
26
+ useRef: <T>(initialValue: T | null) => import("..").RefObject<T>;
27
+ useCallback: <T extends Function>(callback: T, deps: readonly unknown[]) => T;
28
+ use: <T>(promise: Promise<T>) => T;
29
29
  startTransition: (callback: () => void) => void;
30
30
  useTransition: () => [boolean, (callback: () => void | Promise<void>) => void];
31
- useDeferredValue: <T_5>(value: T_5, initialValue?: T_5 | undefined) => T_5;
31
+ useDeferredValue: <T>(value: T, initialValue?: T) => T;
32
32
  startViewTransition: (callback: () => void) => void;
33
33
  useViewTransition: () => [boolean, (callback: () => void) => void];
34
- useMemo: <T_6>(factory: () => T_6, deps: readonly unknown[]) => T_6;
35
- useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[] | undefined) => void;
36
- useInsertionEffect: (effect: () => void | (() => void), deps?: readonly unknown[] | undefined) => void;
37
- 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];
34
+ useMemo: <T>(factory: () => T, deps: readonly unknown[]) => T;
35
+ useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
36
+ useInsertionEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
37
+ useReducer: <T, A>(reducer: (state: T, action: A) => T, initialArg: T, init?: (initialState: T) => T) => [T, (action: A) => void];
38
38
  useId: () => string;
39
- useDebugValue: (_value: unknown, _formatter?: ((value: unknown) => string) | undefined) => void;
40
- createRef: <T_8>() => import("../hooks").RefObject<T_8>;
41
- forwardRef: <T_9, P = {}>(Component: (props: P, ref?: import("../hooks").RefObject<T_9> | undefined) => JSX.Element) => (props: P & {
42
- ref?: import("../hooks").RefObject<T_9> | undefined;
43
- }) => JSX.Element;
44
- useImperativeHandle: <T_10>(ref: import("../hooks").RefObject<T_10>, createHandle: () => T_10, deps: readonly unknown[]) => void;
45
- useSyncExternalStore: <T_11>(subscribe: (callback: (value: T_11) => void) => () => void, getSnapshot: () => T_11, getServerSnapshot?: (() => T_11) | undefined) => T_11;
39
+ useDebugValue: (_value: unknown, _formatter?: (value: unknown) => string) => void;
40
+ createRef: <T>() => import("..").RefObject<T>;
41
+ forwardRef: <T, P = {}>(Component: (props: P, ref?: import("..").RefObject<T>) => JSX.Element) => ((props: P & {
42
+ ref?: import("..").RefObject<T>;
43
+ }) => JSX.Element);
44
+ useImperativeHandle: <T>(ref: import("..").RefObject<T>, createHandle: () => T, deps: readonly unknown[]) => void;
45
+ useSyncExternalStore: <T>(subscribe: (callback: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T) => T;
46
46
  useFormStatus: () => {
47
47
  pending: false;
48
48
  data: null;
@@ -54,22 +54,22 @@ declare const _default: {
54
54
  method: "get" | "post";
55
55
  action: string | ((formData: FormData) => void | Promise<void>);
56
56
  };
57
- useActionState: <T_12>(fn: Function, initialState: T_12, permalink?: string | undefined) => [T_12, Function];
58
- useOptimistic: <T_13, N>(state: T_13, updateState: (currentState: T_13, action: N) => T_13) => [T_13, (action: N) => void];
59
- Suspense: import("../base").FC<import("../types").PropsWithChildren<{
57
+ useActionState: <T>(fn: Function, initialState: T, permalink?: string) => [T, Function];
58
+ useOptimistic: <T, N>(state: T, updateState: (currentState: T, action: N) => T) => [T, (action: N) => void];
59
+ Suspense: import("..").FC<import("..").PropsWithChildren<{
60
60
  fallback: any;
61
61
  }>>;
62
- ErrorBoundary: import("../base").FC<import("../types").PropsWithChildren<{
62
+ ErrorBoundary: import("..").FC<import("..").PropsWithChildren<{
63
63
  fallback?: Child;
64
- fallbackRender?: import("../components").FallbackRender | undefined;
65
- onError?: import("../components").ErrorHandler | undefined;
64
+ fallbackRender?: import("../components").FallbackRender;
65
+ onError?: import("../components").ErrorHandler;
66
66
  }>>;
67
- createContext: <T_14>(defaultValue: T_14) => import("../context").Context<T_14>;
68
- useContext: <T_15>(context: import("../context").Context<T_15>) => T_15;
69
- memo: <T_16>(component: import("../base").FC<T_16>, propsAreEqual?: (prevProps: Readonly<T_16>, nextProps: Readonly<T_16>) => boolean) => import("../base").FC<T_16>;
67
+ createContext: <T>(defaultValue: T) => import("..").Context<T>;
68
+ useContext: <T>(context: import("..").Context<T>) => T;
69
+ memo: <T>(component: import("..").FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean) => import("..").FC<T>;
70
70
  isValidElement: (element: unknown) => element is JSXNode;
71
71
  createElement: (tag: string | ((props: Props) => JSXNode), props: Props | null, ...children: Child[]) => JSXNode;
72
- cloneElement: <T_17 extends JSXNode | JSX.Element>(element: T_17, props: Props, ...children: Child[]) => T_17;
72
+ cloneElement: <T extends JSXNode | JSX.Element>(element: T, props: Props, ...children: Child[]) => T;
73
73
  Children: {
74
74
  map: (children: Child[], fn: (child: Child, index: number) => Child) => Child[];
75
75
  forEach: (children: Child[], fn: (child: Child, index: number) => void) => void;
@@ -80,7 +80,7 @@ declare const _default: {
80
80
  Fragment: (props: Record<string, unknown>) => JSXNode;
81
81
  StrictMode: (props: Record<string, unknown>) => JSXNode;
82
82
  flushSync: (callback: () => void) => void;
83
- createPortal: (children: Child, container: HTMLElement, key?: string | undefined) => Child;
83
+ createPortal: (children: Child, container: HTMLElement, key?: string) => Child;
84
84
  };
85
85
  export default _default;
86
86
  export type { Context } from '../context';
@@ -1,7 +1,7 @@
1
1
  import type { IntrinsicElements } from '../../intrinsic-elements';
2
2
  import type { FC, PropsWithChildren, RefObject } from '../../types';
3
3
  export declare const clearCache: () => void;
4
- export declare const composeRef: <T>(ref: Function | RefObject<T> | undefined, cb: (e: T) => void | (() => void)) => (e: T) => () => void;
4
+ export declare const composeRef: <T>(ref: RefObject<T> | Function | undefined, cb: (e: T) => void | (() => void)) => ((e: T) => () => void);
5
5
  export declare const title: FC<PropsWithChildren>;
6
6
  export declare const script: FC<PropsWithChildren<IntrinsicElements['script']>>;
7
7
  export declare const style: FC<PropsWithChildren<IntrinsicElements['style']>>;
@@ -40,29 +40,29 @@ declare const _default: {
40
40
  version: string;
41
41
  useState: {
42
42
  <T>(initialState: T | (() => T)): [T, (newState: T | ((currentState: T) => T)) => void];
43
- <T_1 = undefined>(): [T_1 | undefined, (newState: T_1 | ((currentState: T_1 | undefined) => T_1 | undefined) | undefined) => void];
43
+ <T = undefined>(): [T | undefined, (newState: T | ((currentState: T | undefined) => T | undefined) | undefined) => void];
44
44
  };
45
- useEffect: (effect: () => void | (() => void), deps?: readonly unknown[] | undefined) => void;
46
- useRef: <T_2>(initialValue: T_2 | null) => import("./").RefObject<T_2>;
47
- useCallback: <T_3 extends Function>(callback: T_3, deps: readonly unknown[]) => T_3;
48
- use: <T_4>(promise: Promise<T_4>) => T_4;
45
+ useEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
46
+ useRef: <T>(initialValue: T | null) => import("..").RefObject<T>;
47
+ useCallback: <T extends Function>(callback: T, deps: readonly unknown[]) => T;
48
+ use: <T>(promise: Promise<T>) => T;
49
49
  startTransition: (callback: () => void) => void;
50
50
  useTransition: () => [boolean, (callback: () => void | Promise<void>) => void];
51
- useDeferredValue: <T_5>(value: T_5, initialValue?: T_5 | undefined) => T_5;
51
+ useDeferredValue: <T>(value: T, initialValue?: T) => T;
52
52
  startViewTransition: (callback: () => void) => void;
53
53
  useViewTransition: () => [boolean, (callback: () => void) => void];
54
- useMemo: <T_6>(factory: () => T_6, deps: readonly unknown[]) => T_6;
55
- useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[] | undefined) => void;
56
- useInsertionEffect: (effect: () => void | (() => void), deps?: readonly unknown[] | undefined) => void;
57
- 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];
54
+ useMemo: <T>(factory: () => T, deps: readonly unknown[]) => T;
55
+ useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
56
+ useInsertionEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
57
+ useReducer: <T, A>(reducer: (state: T, action: A) => T, initialArg: T, init?: (initialState: T) => T) => [T, (action: A) => void];
58
58
  useId: () => string;
59
- useDebugValue: (_value: unknown, _formatter?: ((value: unknown) => string) | undefined) => void;
60
- createRef: <T_8>() => import("./").RefObject<T_8>;
61
- forwardRef: <T_9, P = {}>(Component: (props: P, ref?: import("./").RefObject<T_9> | undefined) => import("../base").JSX.Element) => (props: P & {
62
- ref?: import("./").RefObject<T_9> | undefined;
63
- }) => import("../base").JSX.Element;
64
- useImperativeHandle: <T_10>(ref: import("./").RefObject<T_10>, createHandle: () => T_10, deps: readonly unknown[]) => void;
65
- useSyncExternalStore: <T_11>(subscribe: (callback: (value: T_11) => void) => () => void, getSnapshot: () => T_11, getServerSnapshot?: (() => T_11) | undefined) => T_11;
59
+ useDebugValue: (_value: unknown, _formatter?: (value: unknown) => string) => void;
60
+ createRef: <T>() => import("..").RefObject<T>;
61
+ forwardRef: <T, P = {}>(Component: (props: P, ref?: import("..").RefObject<T>) => import("../base").JSX.Element) => ((props: P & {
62
+ ref?: import("..").RefObject<T>;
63
+ }) => import("../base").JSX.Element);
64
+ useImperativeHandle: <T>(ref: import("..").RefObject<T>, createHandle: () => T, deps: readonly unknown[]) => void;
65
+ useSyncExternalStore: <T>(subscribe: (callback: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T) => T;
66
66
  useFormStatus: () => {
67
67
  pending: false;
68
68
  data: null;
@@ -74,22 +74,22 @@ declare const _default: {
74
74
  method: "get" | "post";
75
75
  action: string | ((formData: FormData) => void | Promise<void>);
76
76
  };
77
- useActionState: <T_12>(fn: Function, initialState: T_12, permalink?: string | undefined) => [T_12, Function];
78
- useOptimistic: <T_13, N>(state: T_13, updateState: (currentState: T_13, action: N) => T_13) => [T_13, (action: N) => void];
79
- Suspense: import("./").FC<import("./").PropsWithChildren<{
77
+ useActionState: <T>(fn: Function, initialState: T, permalink?: string) => [T, Function];
78
+ useOptimistic: <T, N>(state: T, updateState: (currentState: T, action: N) => T) => [T, (action: N) => void];
79
+ Suspense: import("..").FC<import("..").PropsWithChildren<{
80
80
  fallback: any;
81
81
  }>>;
82
- ErrorBoundary: import("./").FC<import("./").PropsWithChildren<{
82
+ ErrorBoundary: import("..").FC<import("..").PropsWithChildren<{
83
83
  fallback?: Child;
84
- fallbackRender?: import("../components").FallbackRender | undefined;
85
- onError?: import("../components").ErrorHandler | undefined;
84
+ fallbackRender?: import("../components").FallbackRender;
85
+ onError?: import("../components").ErrorHandler;
86
86
  }>>;
87
- createContext: <T_14>(defaultValue: T_14) => import("./").Context<T_14>;
88
- useContext: <T_15>(context: import("./").Context<T_15>) => T_15;
89
- memo: <T_16>(component: import("./").FC<T_16>, propsAreEqual?: (prevProps: Readonly<T_16>, nextProps: Readonly<T_16>) => boolean) => import("./").FC<T_16>;
90
- isValidElement: (element: unknown) => element is import("./").JSXNode;
91
- createElement: (tag: string | ((props: import("../base").Props) => import("./").JSXNode), props: import("../base").Props | null, ...children: Child[]) => import("./").JSXNode;
92
- cloneElement: <T_17 extends import("./").JSXNode | import("../base").JSX.Element>(element: T_17, props: import("../base").Props, ...children: Child[]) => T_17;
87
+ createContext: <T>(defaultValue: T) => import("..").Context<T>;
88
+ useContext: <T>(context: import("..").Context<T>) => T;
89
+ memo: <T>(component: import("..").FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean) => import("..").FC<T>;
90
+ isValidElement: (element: unknown) => element is import("..").JSXNode;
91
+ createElement: (tag: string | ((props: import("../base").Props) => import("..").JSXNode), props: import("../base").Props | null, ...children: Child[]) => import("..").JSXNode;
92
+ cloneElement: <T extends import("..").JSXNode | import("../base").JSX.Element>(element: T, props: import("../base").Props, ...children: Child[]) => T;
93
93
  Children: {
94
94
  map: (children: Child[], fn: (child: Child, index: number) => Child) => Child[];
95
95
  forEach: (children: Child[], fn: (child: Child, index: number) => void) => void;
@@ -97,10 +97,10 @@ declare const _default: {
97
97
  only: (_children: Child[]) => Child;
98
98
  toArray: (children: Child) => Child[];
99
99
  };
100
- Fragment: (props: Record<string, unknown>) => import("./").JSXNode;
101
- StrictMode: (props: Record<string, unknown>) => import("./").JSXNode;
100
+ Fragment: (props: Record<string, unknown>) => import("..").JSXNode;
101
+ StrictMode: (props: Record<string, unknown>) => import("..").JSXNode;
102
102
  flushSync: (callback: () => void) => void;
103
- createPortal: (children: Child, container: HTMLElement, key?: string | undefined) => Child;
103
+ createPortal: (children: Child, container: HTMLElement, key?: string) => Child;
104
104
  };
105
105
  };
106
106
  export default _default;
@@ -23,7 +23,7 @@ type UseStateType = {
23
23
  <T = undefined>(): [T | undefined, UpdateStateFunction<T | undefined>];
24
24
  };
25
25
  export declare const useState: UseStateType;
26
- export declare const useReducer: <T, A>(reducer: (state: T, action: A) => T, initialArg: T, init?: ((initialState: T) => T) | undefined) => [T, (action: A) => void];
26
+ export declare const useReducer: <T, A>(reducer: (state: T, action: A) => T, initialArg: T, init?: (initialState: T) => T) => [T, (action: A) => void];
27
27
  export declare const useEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
28
28
  export declare const useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
29
29
  export declare const useInsertionEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
@@ -35,11 +35,11 @@ export declare const useRef: <T>(initialValue: T | null) => RefObject<T>;
35
35
  export declare const use: <T>(promise: Promise<T>) => T;
36
36
  export declare const useMemo: <T>(factory: () => T, deps: readonly unknown[]) => T;
37
37
  export declare const useId: () => string;
38
- export declare const useDebugValue: (_value: unknown, _formatter?: ((value: unknown) => string) | undefined) => void;
38
+ export declare const useDebugValue: (_value: unknown, _formatter?: (value: unknown) => string) => void;
39
39
  export declare const createRef: <T>() => RefObject<T>;
40
- export declare const forwardRef: <T, P = {}>(Component: (props: P, ref?: RefObject<T> | undefined) => JSX.Element) => (props: P & {
41
- ref?: RefObject<T> | undefined;
42
- }) => JSX.Element;
40
+ export declare const forwardRef: <T, P = {}>(Component: (props: P, ref?: RefObject<T>) => JSX.Element) => ((props: P & {
41
+ ref?: RefObject<T>;
42
+ }) => JSX.Element);
43
43
  export declare const useImperativeHandle: <T>(ref: RefObject<T>, createHandle: () => T, deps: readonly unknown[]) => void;
44
- export declare const useSyncExternalStore: <T>(subscribe: (callback: (value: T) => void) => () => void, getSnapshot: () => T, getServerSnapshot?: (() => T) | undefined) => T;
44
+ export declare const useSyncExternalStore: <T>(subscribe: (callback: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T) => T;
45
45
  export {};
@@ -15,50 +15,50 @@ declare const _default: {
15
15
  version: string;
16
16
  memo: <T>(component: import("./base").FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean) => import("./base").FC<T>;
17
17
  Fragment: ({ children, }: {
18
- key?: string | undefined;
19
- children?: import("../utils/html").HtmlEscapedString | import("./base").Child;
18
+ key?: string;
19
+ children?: import("./base").Child | import("../utils/html").HtmlEscapedString;
20
20
  }) => import("../utils/html").HtmlEscapedString;
21
21
  StrictMode: ({ children, }: {
22
- key?: string | undefined;
23
- children?: import("../utils/html").HtmlEscapedString | import("./base").Child;
22
+ key?: string;
23
+ children?: import("./base").Child | import("../utils/html").HtmlEscapedString;
24
24
  }) => import("../utils/html").HtmlEscapedString;
25
25
  isValidElement: (element: unknown) => element is import("./base").JSXNode;
26
26
  createElement: (tag: string | Function, props: import("./base").Props | null, ...children: (string | number | import("../utils/html").HtmlEscapedString)[]) => import("./base").JSXNode;
27
- cloneElement: <T_1 extends import("./base").JSXNode | import("./base").JSX.Element>(element: T_1, props: Partial<import("./base").Props>, ...children: import("./base").Child[]) => T_1;
27
+ cloneElement: <T extends import("./base").JSXNode | import("./base").JSX.Element>(element: T, props: Partial<import("./base").Props>, ...children: import("./base").Child[]) => T;
28
28
  ErrorBoundary: import("./base").FC<import("./types").PropsWithChildren<{
29
29
  fallback?: import("./base").Child;
30
- fallbackRender?: import("./components").FallbackRender | undefined;
31
- onError?: import("./components").ErrorHandler | undefined;
30
+ fallbackRender?: import("./components").FallbackRender;
31
+ onError?: import("./components").ErrorHandler;
32
32
  }>>;
33
- createContext: <T_2>(defaultValue: T_2) => import("./context").Context<T_2>;
34
- useContext: <T_3>(context: import("./context").Context<T_3>) => T_3;
33
+ createContext: <T>(defaultValue: T) => import("./context").Context<T>;
34
+ useContext: <T>(context: import("./context").Context<T>) => T;
35
35
  useState: {
36
- <T_4>(initialState: T_4 | (() => T_4)): [T_4, (newState: T_4 | ((currentState: T_4) => T_4)) => void];
37
- <T_5 = undefined>(): [T_5 | undefined, (newState: T_5 | ((currentState: T_5 | undefined) => T_5 | undefined) | undefined) => void];
36
+ <T>(initialState: T | (() => T)): [T, (newState: T | ((currentState: T) => T)) => void];
37
+ <T = undefined>(): [T | undefined, (newState: T | ((currentState: T | undefined) => T | undefined) | undefined) => void];
38
38
  };
39
- useEffect: (effect: () => void | (() => void), deps?: readonly unknown[] | undefined) => void;
40
- useRef: <T_6>(initialValue: T_6 | null) => import("./hooks").RefObject<T_6>;
41
- useCallback: <T_7 extends Function>(callback: T_7, deps: readonly unknown[]) => T_7;
42
- useReducer: <T_8, A>(reducer: (state: T_8, action: A) => T_8, initialArg: T_8, init?: ((initialState: T_8) => T_8) | undefined) => [T_8, (action: A) => void];
39
+ useEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
40
+ useRef: <T>(initialValue: T | null) => import("./hooks").RefObject<T>;
41
+ useCallback: <T extends Function>(callback: T, deps: readonly unknown[]) => T;
42
+ useReducer: <T, A>(reducer: (state: T, action: A) => T, initialArg: T, init?: (initialState: T) => T) => [T, (action: A) => void];
43
43
  useId: () => string;
44
- useDebugValue: (_value: unknown, _formatter?: ((value: unknown) => string) | undefined) => void;
45
- use: <T_9>(promise: Promise<T_9>) => T_9;
44
+ useDebugValue: (_value: unknown, _formatter?: (value: unknown) => string) => void;
45
+ use: <T>(promise: Promise<T>) => T;
46
46
  startTransition: (callback: () => void) => void;
47
47
  useTransition: () => [boolean, (callback: () => void | Promise<void>) => void];
48
- useDeferredValue: <T_10>(value: T_10, initialValue?: T_10 | undefined) => T_10;
48
+ useDeferredValue: <T>(value: T, initialValue?: T) => T;
49
49
  startViewTransition: (callback: () => void) => void;
50
50
  useViewTransition: () => [boolean, (callback: () => void) => void];
51
- useMemo: <T_11>(factory: () => T_11, deps: readonly unknown[]) => T_11;
52
- useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[] | undefined) => void;
53
- useInsertionEffect: (effect: () => void | (() => void), deps?: readonly unknown[] | undefined) => void;
54
- createRef: <T_12>() => import("./hooks").RefObject<T_12>;
55
- forwardRef: <T_13, P = {}>(Component: (props: P, ref?: import("./hooks").RefObject<T_13> | undefined) => import("./base").JSX.Element) => (props: P & {
56
- ref?: import("./hooks").RefObject<T_13> | undefined;
57
- }) => import("./base").JSX.Element;
58
- useImperativeHandle: <T_14>(ref: import("./hooks").RefObject<T_14>, createHandle: () => T_14, deps: readonly unknown[]) => void;
59
- useSyncExternalStore: <T_15>(subscribe: (callback: (value: T_15) => void) => () => void, getSnapshot: () => T_15, getServerSnapshot?: (() => T_15) | undefined) => T_15;
60
- useActionState: <T_16>(fn: Function, initialState: T_16, permalink?: string | undefined) => [T_16, Function];
61
- useOptimistic: <T_17, N>(state: T_17, updateState: (currentState: T_17, action: N) => T_17) => [T_17, (action: N) => void];
51
+ useMemo: <T>(factory: () => T, deps: readonly unknown[]) => T;
52
+ useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
53
+ useInsertionEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
54
+ createRef: <T>() => import("./hooks").RefObject<T>;
55
+ forwardRef: <T, P = {}>(Component: (props: P, ref?: import("./hooks").RefObject<T>) => import("./base").JSX.Element) => ((props: P & {
56
+ ref?: import("./hooks").RefObject<T>;
57
+ }) => import("./base").JSX.Element);
58
+ useImperativeHandle: <T>(ref: import("./hooks").RefObject<T>, createHandle: () => T, deps: readonly unknown[]) => void;
59
+ useSyncExternalStore: <T>(subscribe: (callback: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T) => T;
60
+ useActionState: <T>(fn: Function, initialState: T, permalink?: string) => [T, Function];
61
+ useOptimistic: <T, N>(state: T, updateState: (currentState: T, action: N) => T) => [T, (action: N) => void];
62
62
  Suspense: import("./base").FC<import("./types").PropsWithChildren<{
63
63
  fallback: any;
64
64
  }>>;
@@ -8,5 +8,5 @@ export type { JSX } from './jsx-dev-runtime';
8
8
  import { html } from '../helper/html';
9
9
  import type { HtmlEscapedString } from '../utils/html';
10
10
  export { html as jsxTemplate };
11
- export declare const jsxAttr: (name: string, value: string | Promise<string>) => HtmlEscapedString | Promise<HtmlEscapedString>;
11
+ export declare const jsxAttr: (key: string, v: string | Promise<string> | Record<string, string | number | null | undefined | boolean>) => HtmlEscapedString | Promise<HtmlEscapedString>;
12
12
  export declare const jsxEscape: (value: string) => string;
@@ -3,6 +3,7 @@
3
3
  * This module enables JSX to supports streaming Response.
4
4
  */
5
5
  import type { HtmlEscapedString } from '../utils/html';
6
+ import { JSXNode } from './base';
6
7
  import type { FC, PropsWithChildren } from './';
7
8
  /**
8
9
  * @experimental
@@ -17,4 +18,4 @@ export declare const Suspense: FC<PropsWithChildren<{
17
18
  * `renderToReadableStream()` is an experimental feature.
18
19
  * The API might be changed.
19
20
  */
20
- export declare const renderToReadableStream: (str: HtmlEscapedString | Promise<HtmlEscapedString>, onError?: (e: unknown) => string | void) => ReadableStream<Uint8Array>;
21
+ export declare const renderToReadableStream: (content: HtmlEscapedString | JSXNode | Promise<HtmlEscapedString>, onError?: (e: unknown) => string | void) => ReadableStream<Uint8Array>;
@@ -31,8 +31,8 @@ import type { MiddlewareHandler } from '../../types';
31
31
  */
32
32
  export declare const cache: (options: {
33
33
  cacheName: string | ((c: Context) => Promise<string> | string);
34
- wait?: boolean | undefined;
35
- cacheControl?: string | undefined;
36
- vary?: string | string[] | undefined;
37
- keyGenerator?: ((c: Context) => Promise<string> | string) | undefined;
34
+ wait?: boolean;
35
+ cacheControl?: string;
36
+ vary?: string | string[];
37
+ keyGenerator?: (c: Context) => Promise<string> | string;
38
38
  }) => MiddlewareHandler;
@@ -36,4 +36,4 @@ import type { Env, MiddlewareHandler } from '../../types';
36
36
  * ```
37
37
  */
38
38
  export declare const contextStorage: () => MiddlewareHandler;
39
- export declare const getContext: <E extends Env = Env>() => Context<E, any, {}>;
39
+ export declare const getContext: <E extends Env = Env>() => Context<E>;
@@ -24,8 +24,8 @@ export interface IPRestrictionRules {
24
24
  *
25
25
  * @param getIP function to get IP Address
26
26
  */
27
- export declare const ipRestriction: (getIP: GetIPAddr, { denyList, allowList }: IPRestrictionRules, onError?: ((remote: {
27
+ export declare const ipRestriction: (getIP: GetIPAddr, { denyList, allowList }: IPRestrictionRules, onError?: (remote: {
28
28
  addr: string;
29
29
  type: AddressType;
30
- }, c: Context) => Response | Promise<Response>) | undefined) => MiddlewareHandler;
30
+ }, c: Context) => Response | Promise<Response>) => MiddlewareHandler;
31
31
  export {};
@@ -7,8 +7,8 @@ import type { CookiePrefixOptions } from '../../utils/cookie';
7
7
  import '../../context';
8
8
  import type { SignatureAlgorithm } from '../../utils/jwt/jwa';
9
9
  import type { SignatureKey } from '../../utils/jwt/jws';
10
- export type JwtVariables = {
11
- jwtPayload: any;
10
+ export type JwtVariables<T = any> = {
11
+ jwtPayload: T;
12
12
  };
13
13
  /**
14
14
  * JWT Auth Middleware for Hono.
@@ -46,9 +46,9 @@ export declare const jwt: (options: {
46
46
  };
47
47
  alg?: SignatureAlgorithm;
48
48
  }) => MiddlewareHandler;
49
- export declare const verify: (token: string, publicKey: SignatureKey, alg?: "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "PS256" | "PS384" | "PS512" | "ES256" | "ES384" | "ES512" | "EdDSA") => Promise<import("../../utils/jwt/types").JWTPayload>;
49
+ export declare const verify: (token: string, publicKey: SignatureKey, alg?: SignatureAlgorithm) => Promise<import("../../utils/jwt/types").JWTPayload>;
50
50
  export declare const decode: (token: string) => {
51
51
  header: import("../../utils/jwt/jwt").TokenHeader;
52
52
  payload: import("../../utils/jwt/types").JWTPayload;
53
53
  };
54
- export declare const sign: (payload: import("../../utils/jwt/types").JWTPayload, privateKey: SignatureKey, alg?: "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "PS256" | "PS384" | "PS512" | "ES256" | "ES384" | "ES512" | "EdDSA") => Promise<string>;
54
+ export declare const sign: (payload: import("../../utils/jwt/types").JWTPayload, privateKey: SignatureKey, alg?: SignatureAlgorithm) => Promise<string>;
@@ -51,6 +51,7 @@ type PermissionsPolicyOptions = Partial<Record<PermissionsPolicyDirective, Permi
51
51
  type overridableHeader = boolean | string;
52
52
  interface SecureHeadersOptions {
53
53
  contentSecurityPolicy?: ContentSecurityPolicyOptions;
54
+ contentSecurityPolicyReportOnly?: ContentSecurityPolicyOptions;
54
55
  crossOriginEmbedderPolicy?: overridableHeader;
55
56
  crossOriginResourcePolicy?: overridableHeader;
56
57
  crossOriginOpenerPolicy?: overridableHeader;
@@ -76,6 +77,7 @@ export declare const NONCE: ContentSecurityPolicyOptionHandler;
76
77
  *
77
78
  * @param {Partial<SecureHeadersOptions>} [customOptions] - The options for the secure headers middleware.
78
79
  * @param {ContentSecurityPolicyOptions} [customOptions.contentSecurityPolicy] - Settings for the Content-Security-Policy header.
80
+ * @param {ContentSecurityPolicyOptions} [customOptions.contentSecurityPolicyReportOnly] - Settings for the Content-Security-Policy-Report-Only header.
79
81
  * @param {overridableHeader} [customOptions.crossOriginEmbedderPolicy=false] - Settings for the Cross-Origin-Embedder-Policy header.
80
82
  * @param {overridableHeader} [customOptions.crossOriginResourcePolicy=true] - Settings for the Cross-Origin-Resource-Policy header.
81
83
  * @param {overridableHeader} [customOptions.crossOriginOpenerPolicy=true] - Settings for the Cross-Origin-Opener-Policy header.
@@ -17,7 +17,7 @@ export type ServeStaticOptions<E extends Env = Env> = {
17
17
  * This middleware is not directly used by the user. Create a wrapper specifying `getContent()` by the environment such as Deno or Bun.
18
18
  */
19
19
  export declare const serveStatic: <E extends Env = Env>(options: ServeStaticOptions<E> & {
20
- getContent: (path: string, c: Context<E, any, {}>) => Promise<Data | Response | null>;
21
- pathResolve?: ((path: string) => string) | undefined;
22
- isDir?: ((path: string) => boolean | undefined | Promise<boolean | undefined>) | undefined;
20
+ getContent: (path: string, c: Context<E>) => Promise<Data | Response | null>;
21
+ pathResolve?: (path: string) => string;
22
+ isDir?: (path: string) => boolean | undefined | Promise<boolean | undefined>;
23
23
  }) => MiddlewareHandler;