hono 4.6.20 → 4.7.1

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 (101) hide show
  1. package/dist/adapter/aws-lambda/handler.js +0 -2
  2. package/dist/cjs/adapter/aws-lambda/handler.js +0 -8
  3. package/dist/cjs/helper/accepts/accepts.js +4 -26
  4. package/dist/cjs/helper/factory/index.js +6 -2
  5. package/dist/cjs/helper/proxy/index.js +75 -0
  6. package/dist/cjs/middleware/combine/index.js +10 -3
  7. package/dist/cjs/middleware/etag/digest.js +3 -8
  8. package/dist/cjs/middleware/etag/index.js +18 -2
  9. package/dist/cjs/middleware/jwk/index.js +28 -0
  10. package/dist/cjs/middleware/jwk/jwk.js +124 -0
  11. package/dist/cjs/middleware/language/index.js +36 -0
  12. package/dist/cjs/middleware/language/language.js +210 -0
  13. package/dist/cjs/middleware/logger/index.js +2 -3
  14. package/dist/cjs/request.js +1 -1
  15. package/dist/cjs/router/linear-router/router.js +3 -1
  16. package/dist/cjs/router/trie-router/node.js +24 -11
  17. package/dist/cjs/utils/accept.js +86 -0
  18. package/dist/cjs/utils/jwt/index.js +1 -1
  19. package/dist/cjs/utils/jwt/jwt.js +56 -3
  20. package/dist/cjs/utils/jwt/types.js +8 -0
  21. package/dist/cjs/utils/url.js +10 -25
  22. package/dist/helper/accepts/accepts.js +2 -23
  23. package/dist/helper/factory/index.js +6 -2
  24. package/dist/helper/proxy/index.js +52 -0
  25. package/dist/middleware/combine/index.js +10 -3
  26. package/dist/middleware/etag/digest.js +3 -8
  27. package/dist/middleware/etag/index.js +18 -2
  28. package/dist/middleware/jwk/index.js +5 -0
  29. package/dist/middleware/jwk/jwk.js +101 -0
  30. package/dist/middleware/language/index.js +15 -0
  31. package/dist/middleware/language/language.js +178 -0
  32. package/dist/middleware/logger/index.js +2 -3
  33. package/dist/request.js +1 -1
  34. package/dist/router/linear-router/router.js +3 -1
  35. package/dist/router/trie-router/node.js +24 -11
  36. package/dist/types/adapter/cloudflare-pages/handler.d.ts +1 -1
  37. package/dist/types/adapter/cloudflare-workers/websocket.d.ts +1 -1
  38. package/dist/types/adapter/lambda-edge/handler.d.ts +2 -2
  39. package/dist/types/client/types.d.ts +7 -8
  40. package/dist/types/compose.d.ts +11 -1
  41. package/dist/types/context.d.ts +31 -21
  42. package/dist/types/helper/accepts/accepts.d.ts +0 -1
  43. package/dist/types/helper/adapter/index.d.ts +2 -2
  44. package/dist/types/helper/conninfo/types.d.ts +2 -2
  45. package/dist/types/helper/css/common.d.ts +6 -1
  46. package/dist/types/helper/factory/index.d.ts +289 -12
  47. package/dist/types/helper/proxy/index.d.ts +54 -0
  48. package/dist/types/helper/ssg/ssg.d.ts +1 -1
  49. package/dist/types/helper/websocket/index.d.ts +1 -2
  50. package/dist/types/hono-base.d.ts +18 -15
  51. package/dist/types/hono.d.ts +1 -1
  52. package/dist/types/jsx/base.d.ts +4 -1
  53. package/dist/types/jsx/dom/hooks/index.d.ts +9 -3
  54. package/dist/types/jsx/dom/index.d.ts +28 -7
  55. package/dist/types/jsx/dom/intrinsic-element/components.d.ts +6 -6
  56. package/dist/types/jsx/dom/render.d.ts +28 -4
  57. package/dist/types/jsx/dom/server.d.ts +28 -7
  58. package/dist/types/jsx/hooks/index.d.ts +20 -5
  59. package/dist/types/jsx/index.d.ts +28 -7
  60. package/dist/types/jsx/intrinsic-element/components.d.ts +4 -4
  61. package/dist/types/jsx/intrinsic-elements.d.ts +46 -46
  62. package/dist/types/middleware/compress/index.d.ts +4 -1
  63. package/dist/types/middleware/etag/digest.d.ts +1 -1
  64. package/dist/types/middleware/etag/index.d.ts +4 -0
  65. package/dist/types/middleware/jwk/index.d.ts +1 -0
  66. package/dist/types/middleware/jwk/jwk.d.ts +40 -0
  67. package/dist/types/middleware/language/index.d.ts +7 -0
  68. package/dist/types/middleware/language/language.d.ts +102 -0
  69. package/dist/types/middleware/secure-headers/permissions-policy.d.ts +3 -3
  70. package/dist/types/middleware/secure-headers/secure-headers.d.ts +1 -1
  71. package/dist/types/preset/quick.d.ts +1 -1
  72. package/dist/types/preset/tiny.d.ts +1 -1
  73. package/dist/types/request.d.ts +5 -3
  74. package/dist/types/router/linear-router/router.d.ts +0 -1
  75. package/dist/types/router/pattern-router/router.d.ts +0 -1
  76. package/dist/types/router/reg-exp-router/node.d.ts +4 -2
  77. package/dist/types/router/reg-exp-router/router.d.ts +0 -1
  78. package/dist/types/router/reg-exp-router/trie.d.ts +5 -2
  79. package/dist/types/router/smart-router/router.d.ts +0 -1
  80. package/dist/types/router/trie-router/node.d.ts +6 -2
  81. package/dist/types/router/trie-router/router.d.ts +0 -1
  82. package/dist/types/router.d.ts +20 -2
  83. package/dist/types/types.d.ts +2002 -111
  84. package/dist/types/utils/accept.d.ts +11 -0
  85. package/dist/types/utils/cookie.d.ts +4 -4
  86. package/dist/types/utils/headers.d.ts +3 -3
  87. package/dist/types/utils/html.d.ts +6 -2
  88. package/dist/types/utils/jwt/index.d.ts +4 -0
  89. package/dist/types/utils/jwt/jws.d.ts +4 -1
  90. package/dist/types/utils/jwt/jwt.d.ts +8 -2
  91. package/dist/types/utils/jwt/types.d.ts +4 -0
  92. package/dist/types/utils/mime.d.ts +2 -2
  93. package/dist/types/utils/stream.d.ts +0 -4
  94. package/dist/types/utils/url.d.ts +16 -2
  95. package/dist/types/validator/validator.d.ts +18 -6
  96. package/dist/utils/accept.js +63 -0
  97. package/dist/utils/jwt/index.js +2 -2
  98. package/dist/utils/jwt/jwt.js +54 -2
  99. package/dist/utils/jwt/types.js +7 -0
  100. package/dist/utils/url.js +10 -25
  101. package/package.json +24 -3
@@ -3,14 +3,14 @@ import type { FC, PropsWithChildren, RefObject } from '../../types';
3
3
  export declare const clearCache: () => void;
4
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
- export declare const script: FC<PropsWithChildren<IntrinsicElements['script']>>;
7
- export declare const style: FC<PropsWithChildren<IntrinsicElements['style']>>;
8
- export declare const link: FC<PropsWithChildren<IntrinsicElements['link']>>;
6
+ export declare const script: FC<PropsWithChildren<IntrinsicElements["script"]>>;
7
+ export declare const style: FC<PropsWithChildren<IntrinsicElements["style"]>>;
8
+ export declare const link: FC<PropsWithChildren<IntrinsicElements["link"]>>;
9
9
  export declare const meta: FC<PropsWithChildren>;
10
10
  export declare const form: FC<PropsWithChildren<{
11
11
  action?: Function | string;
12
- method?: 'get' | 'post';
12
+ method?: "get" | "post";
13
13
  ref?: RefObject<HTMLFormElement> | ((e: HTMLFormElement | null) => void | (() => void));
14
14
  }>>;
15
- export declare const input: FC<PropsWithChildren<IntrinsicElements['input']>>;
16
- export declare const button: FC<PropsWithChildren<IntrinsicElements['button']>>;
15
+ export declare const input: FC<PropsWithChildren<IntrinsicElements["input"]>>;
16
+ export declare const button: FC<PropsWithChildren<IntrinsicElements["button"]>>;
@@ -6,7 +6,10 @@ export type HasRenderToDom = FC<any> & {
6
6
  };
7
7
  export type ErrorHandler = (error: any, retry: () => void) => Child | undefined;
8
8
  type Container = HTMLElement | DocumentFragment;
9
- type LocalJSXContexts = [JSXContext<unknown>, unknown][] | undefined;
9
+ type LocalJSXContexts = [
10
+ JSXContext<unknown>,
11
+ unknown
12
+ ][] | undefined;
10
13
  type SupportedElement = HTMLElement | SVGElement | MathMLElement;
11
14
  export type PreserveNodeType = 1 | 2;
12
15
  export type NodeObject = {
@@ -32,7 +35,10 @@ export type NodeObject = {
32
35
  Function,
33
36
  NodeObject
34
37
  ]
35
- ] | [number, any[][]];
38
+ ] | [
39
+ number,
40
+ any[][]
41
+ ];
36
42
  } & JSXNode;
37
43
  type NodeString = {
38
44
  t: string;
@@ -60,8 +66,26 @@ export type Context = [
60
66
  Function,
61
67
  NodeObject
62
68
  ][]
63
- ] | [PendingType, boolean, UpdateHook, boolean] | [PendingType, boolean, UpdateHook] | [PendingType, boolean] | [PendingType] | [];
64
- export declare const buildDataStack: [Context, Node][];
69
+ ] | [
70
+ PendingType,
71
+ boolean,
72
+ UpdateHook,
73
+ boolean
74
+ ] | [
75
+ PendingType,
76
+ boolean,
77
+ UpdateHook
78
+ ] | [
79
+ PendingType,
80
+ boolean
81
+ ] | [
82
+ PendingType
83
+ ] | [
84
+ ];
85
+ export declare const buildDataStack: [
86
+ Context,
87
+ Node
88
+ ][];
65
89
  export declare const getNameSpaceContext: () => JSXContext<string> | undefined;
66
90
  export declare const build: (context: Context, node: NodeObject, children?: Child[]) => void;
67
91
  export declare const buildNode: (node: Child) => Node | undefined;
@@ -39,22 +39,37 @@ declare const _default: {
39
39
  version: {
40
40
  version: string;
41
41
  useState: {
42
- <T>(initialState: T | (() => T)): [T, (newState: T | ((currentState: T) => T)) => void];
43
- <T = undefined>(): [T | undefined, (newState: T | ((currentState: T | undefined) => T | undefined) | undefined) => void];
42
+ <T>(initialState: T | (() => T)): [
43
+ T,
44
+ (newState: T | ((currentState: T) => T)) => void
45
+ ];
46
+ <T = undefined>(): [
47
+ T | undefined,
48
+ (newState: T | ((currentState: T | undefined) => T | undefined) | undefined) => void
49
+ ];
44
50
  };
45
51
  useEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
46
52
  useRef: <T>(initialValue: T | null) => import("..").RefObject<T>;
47
53
  useCallback: <T extends Function>(callback: T, deps: readonly unknown[]) => T;
48
54
  use: <T>(promise: Promise<T>) => T;
49
55
  startTransition: (callback: () => void) => void;
50
- useTransition: () => [boolean, (callback: () => void | Promise<void>) => void];
56
+ useTransition: () => [
57
+ boolean,
58
+ (callback: () => void | Promise<void>) => void
59
+ ];
51
60
  useDeferredValue: <T>(value: T, initialValue?: T) => T;
52
61
  startViewTransition: (callback: () => void) => void;
53
- useViewTransition: () => [boolean, (callback: () => void) => void];
62
+ useViewTransition: () => [
63
+ boolean,
64
+ (callback: () => void) => void
65
+ ];
54
66
  useMemo: <T>(factory: () => T, deps: readonly unknown[]) => T;
55
67
  useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
56
68
  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];
69
+ useReducer: <T, A>(reducer: (state: T, action: A) => T, initialArg: T, init?: (initialState: T) => T) => [
70
+ T,
71
+ (action: A) => void
72
+ ];
58
73
  useId: () => string;
59
74
  useDebugValue: (_value: unknown, _formatter?: (value: unknown) => string) => void;
60
75
  createRef: <T>() => import("..").RefObject<T>;
@@ -74,8 +89,14 @@ declare const _default: {
74
89
  method: "get" | "post";
75
90
  action: string | ((formData: FormData) => void | Promise<void>);
76
91
  };
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];
92
+ useActionState: <T>(fn: Function, initialState: T, permalink?: string) => [
93
+ T,
94
+ Function
95
+ ];
96
+ useOptimistic: <T, N>(state: T, updateState: (currentState: T, action: N) => T) => [
97
+ T,
98
+ (action: N) => void
99
+ ];
79
100
  Suspense: import("..").FC<import("..").PropsWithChildren<{
80
101
  fallback: any;
81
102
  }>>;
@@ -13,17 +13,32 @@ export type EffectData = [
13
13
  (() => void) | undefined
14
14
  ];
15
15
  export declare const startViewTransition: (callback: () => void) => void;
16
- export declare const useViewTransition: () => [boolean, (callback: () => void) => void];
16
+ export declare const useViewTransition: () => [
17
+ boolean,
18
+ (callback: () => void) => void
19
+ ];
17
20
  export declare const startTransition: (callback: () => void) => void;
18
- export declare const useTransition: () => [boolean, (callback: () => void | Promise<void>) => void];
21
+ export declare const useTransition: () => [
22
+ boolean,
23
+ (callback: () => void | Promise<void>) => void
24
+ ];
19
25
  type UseDeferredValue = <T>(value: T, initialValue?: T) => T;
20
26
  export declare const useDeferredValue: UseDeferredValue;
21
27
  type UseStateType = {
22
- <T>(initialState: T | (() => T)): [T, UpdateStateFunction<T>];
23
- <T = undefined>(): [T | undefined, UpdateStateFunction<T | undefined>];
28
+ <T>(initialState: T | (() => T)): [
29
+ T,
30
+ UpdateStateFunction<T>
31
+ ];
32
+ <T = undefined>(): [
33
+ T | undefined,
34
+ UpdateStateFunction<T | undefined>
35
+ ];
24
36
  };
25
37
  export declare const useState: UseStateType;
26
- export declare const useReducer: <T, A>(reducer: (state: T, action: A) => T, initialArg: T, init?: (initialState: T) => T) => [T, (action: A) => void];
38
+ export declare const useReducer: <T, A>(reducer: (state: T, action: A) => T, initialArg: T, init?: (initialState: T) => T) => [
39
+ T,
40
+ (action: A) => void
41
+ ];
27
42
  export declare const useEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
28
43
  export declare const useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
29
44
  export declare const useInsertionEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
@@ -33,21 +33,36 @@ declare const _default: {
33
33
  createContext: <T>(defaultValue: T) => import("./context").Context<T>;
34
34
  useContext: <T>(context: import("./context").Context<T>) => T;
35
35
  useState: {
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];
36
+ <T>(initialState: T | (() => T)): [
37
+ T,
38
+ (newState: T | ((currentState: T) => T)) => void
39
+ ];
40
+ <T = undefined>(): [
41
+ T | undefined,
42
+ (newState: T | ((currentState: T | undefined) => T | undefined) | undefined) => void
43
+ ];
38
44
  };
39
45
  useEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
40
46
  useRef: <T>(initialValue: T | null) => import("./hooks").RefObject<T>;
41
47
  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];
48
+ useReducer: <T, A>(reducer: (state: T, action: A) => T, initialArg: T, init?: (initialState: T) => T) => [
49
+ T,
50
+ (action: A) => void
51
+ ];
43
52
  useId: () => string;
44
53
  useDebugValue: (_value: unknown, _formatter?: (value: unknown) => string) => void;
45
54
  use: <T>(promise: Promise<T>) => T;
46
55
  startTransition: (callback: () => void) => void;
47
- useTransition: () => [boolean, (callback: () => void | Promise<void>) => void];
56
+ useTransition: () => [
57
+ boolean,
58
+ (callback: () => void | Promise<void>) => void
59
+ ];
48
60
  useDeferredValue: <T>(value: T, initialValue?: T) => T;
49
61
  startViewTransition: (callback: () => void) => void;
50
- useViewTransition: () => [boolean, (callback: () => void) => void];
62
+ useViewTransition: () => [
63
+ boolean,
64
+ (callback: () => void) => void
65
+ ];
51
66
  useMemo: <T>(factory: () => T, deps: readonly unknown[]) => T;
52
67
  useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
53
68
  useInsertionEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
@@ -57,8 +72,14 @@ declare const _default: {
57
72
  }) => import("./base").JSX.Element);
58
73
  useImperativeHandle: <T>(ref: import("./hooks").RefObject<T>, createHandle: () => T, deps: readonly unknown[]) => void;
59
74
  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];
75
+ useActionState: <T>(fn: Function, initialState: T, permalink?: string) => [
76
+ T,
77
+ Function
78
+ ];
79
+ useOptimistic: <T, N>(state: T, updateState: (currentState: T, action: N) => T) => [
80
+ T,
81
+ (action: N) => void
82
+ ];
62
83
  Suspense: import("./base").FC<import("./types").PropsWithChildren<{
63
84
  fallback: any;
64
85
  }>>;
@@ -1,13 +1,13 @@
1
1
  import type { IntrinsicElements } from '../intrinsic-elements';
2
2
  import type { FC, PropsWithChildren } from '../types';
3
3
  export declare const title: FC<PropsWithChildren>;
4
- export declare const script: FC<PropsWithChildren<IntrinsicElements['script']>>;
5
- export declare const style: FC<PropsWithChildren<IntrinsicElements['style']>>;
6
- export declare const link: FC<PropsWithChildren<IntrinsicElements['link']>>;
4
+ export declare const script: FC<PropsWithChildren<IntrinsicElements["script"]>>;
5
+ export declare const style: FC<PropsWithChildren<IntrinsicElements["style"]>>;
6
+ export declare const link: FC<PropsWithChildren<IntrinsicElements["link"]>>;
7
7
  export declare const meta: FC<PropsWithChildren>;
8
8
  export declare const form: FC<PropsWithChildren<{
9
9
  action?: Function | string;
10
- method?: 'get' | 'post';
10
+ method?: "get" | "post";
11
11
  }>>;
12
12
  export declare const input: (props: PropsWithChildren) => unknown;
13
13
  export declare const button: (props: PropsWithChildren) => unknown;
@@ -7,7 +7,7 @@ import type { StringLiteralUnion } from '../utils/types';
7
7
  * Copyright (c) Meta Platforms, Inc. and affiliates.
8
8
  */
9
9
  export declare namespace JSX {
10
- export type CrossOrigin = 'anonymous' | 'use-credentials' | '' | undefined;
10
+ export type CrossOrigin = "anonymous" | "use-credentials" | "" | undefined;
11
11
  export interface CSSProperties {
12
12
  [propertyKey: string]: unknown;
13
13
  }
@@ -145,18 +145,18 @@ export declare namespace JSX {
145
145
  }
146
146
  export interface HTMLAttributes extends JSXAttributes, EventAttributes, AnyAttributes {
147
147
  accesskey?: string | undefined;
148
- autocapitalize?: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters' | undefined;
148
+ autocapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined;
149
149
  autofocus?: boolean | undefined;
150
150
  class?: string | Promise<string> | undefined;
151
- contenteditable?: boolean | 'inherit' | undefined;
151
+ contenteditable?: boolean | "inherit" | undefined;
152
152
  contextmenu?: string | undefined;
153
153
  dir?: string | undefined;
154
- draggable?: 'true' | 'false' | boolean | undefined;
155
- enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send' | undefined;
154
+ draggable?: "true" | "false" | boolean | undefined;
155
+ enterkeyhint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
156
156
  hidden?: boolean | undefined;
157
157
  id?: string | undefined;
158
158
  inert?: boolean | undefined;
159
- inputmode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search' | undefined;
159
+ inputmode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined;
160
160
  is?: string | undefined;
161
161
  itemid?: string | undefined;
162
162
  itemprop?: string | undefined;
@@ -167,17 +167,17 @@ export declare namespace JSX {
167
167
  nonce?: string | undefined;
168
168
  placeholder?: string | undefined;
169
169
  /** @see https://developer.mozilla.org/en-US/docs/Web/API/Popover_API */
170
- popover?: boolean | 'auto' | 'manual' | undefined;
170
+ popover?: boolean | "auto" | "manual" | undefined;
171
171
  slot?: string | undefined;
172
172
  spellcheck?: boolean | undefined;
173
173
  style?: CSSProperties | string | undefined;
174
174
  tabindex?: number | undefined;
175
175
  title?: string | undefined;
176
- translate?: 'yes' | 'no' | undefined;
176
+ translate?: "yes" | "no" | undefined;
177
177
  itemProp?: string | undefined;
178
178
  }
179
- type HTMLAttributeReferrerPolicy = '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
180
- type HTMLAttributeAnchorTarget = StringLiteralUnion<'_self' | '_blank' | '_parent' | '_top'>;
179
+ type HTMLAttributeReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
180
+ type HTMLAttributeAnchorTarget = StringLiteralUnion<"_self" | "_blank" | "_parent" | "_top">;
181
181
  interface AnchorHTMLAttributes extends HTMLAttributes {
182
182
  download?: string | boolean | undefined;
183
183
  href?: string | undefined;
@@ -209,7 +209,7 @@ export declare namespace JSX {
209
209
  cite?: string | undefined;
210
210
  }
211
211
  /** @see https://developer.mozilla.org/en-US/docs/Web/API/Popover_API */
212
- type HTMLAttributePopoverTargetAction = 'show' | 'hide' | 'toggle';
212
+ type HTMLAttributePopoverTargetAction = "show" | "hide" | "toggle";
213
213
  interface ButtonHTMLAttributes extends HTMLAttributes {
214
214
  disabled?: boolean | undefined;
215
215
  form?: string | undefined;
@@ -218,7 +218,7 @@ export declare namespace JSX {
218
218
  formnovalidate?: boolean | undefined;
219
219
  formtarget?: HTMLAttributeAnchorTarget | undefined;
220
220
  name?: string | undefined;
221
- type?: 'submit' | 'reset' | 'button' | undefined;
221
+ type?: "submit" | "reset" | "button" | undefined;
222
222
  value?: string | ReadonlyArray<string> | number | undefined;
223
223
  popovertarget?: string | undefined;
224
224
  popovertargetaction?: HTMLAttributePopoverTargetAction | undefined;
@@ -260,13 +260,13 @@ export declare namespace JSX {
260
260
  name?: string | undefined;
261
261
  }
262
262
  /** @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#method */
263
- type HTMLAttributeFormMethod = 'get' | 'post' | 'dialog';
263
+ type HTMLAttributeFormMethod = "get" | "post" | "dialog";
264
264
  /** @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#enctype */
265
- type HTMLAttributeFormEnctype = 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';
265
+ type HTMLAttributeFormEnctype = "application/x-www-form-urlencoded" | "multipart/form-data" | "text/plain";
266
266
  /** @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#autocomplete */
267
- type HTMLAttributeFormAutocomplete = 'on' | 'off';
267
+ type HTMLAttributeFormAutocomplete = "on" | "off";
268
268
  interface FormHTMLAttributes extends HTMLAttributes {
269
- 'accept-charset'?: StringLiteralUnion<'utf-8'> | undefined;
269
+ "accept-charset"?: StringLiteralUnion<"utf-8"> | undefined;
270
270
  autocomplete?: HTMLAttributeFormAutocomplete | undefined;
271
271
  enctype?: HTMLAttributeFormEnctype | undefined;
272
272
  method?: HTMLAttributeFormMethod | undefined;
@@ -282,7 +282,7 @@ export declare namespace JSX {
282
282
  allow?: string | undefined;
283
283
  allowfullscreen?: boolean | undefined;
284
284
  height?: number | string | undefined;
285
- loading?: 'eager' | 'lazy' | undefined;
285
+ loading?: "eager" | "lazy" | undefined;
286
286
  name?: string | undefined;
287
287
  referrerpolicy?: HTMLAttributeReferrerPolicy | undefined;
288
288
  sandbox?: string | undefined;
@@ -294,9 +294,9 @@ export declare namespace JSX {
294
294
  interface ImgHTMLAttributes extends HTMLAttributes {
295
295
  alt?: string | undefined;
296
296
  crossorigin?: CrossOrigin;
297
- decoding?: 'async' | 'auto' | 'sync' | undefined;
297
+ decoding?: "async" | "auto" | "sync" | undefined;
298
298
  height?: number | string | undefined;
299
- loading?: 'eager' | 'lazy' | undefined;
299
+ loading?: "eager" | "lazy" | undefined;
300
300
  referrerpolicy?: HTMLAttributeReferrerPolicy | undefined;
301
301
  sizes?: string | undefined;
302
302
  src?: string | undefined;
@@ -308,15 +308,15 @@ export declare namespace JSX {
308
308
  cite?: string | undefined;
309
309
  datetime?: string | undefined;
310
310
  }
311
- type HTMLInputTypeAttribute = StringLiteralUnion<'button' | 'checkbox' | 'color' | 'date' | 'datetime-local' | 'email' | 'file' | 'hidden' | 'image' | 'month' | 'number' | 'password' | 'radio' | 'range' | 'reset' | 'search' | 'submit' | 'tel' | 'text' | 'time' | 'url' | 'week'>;
312
- type AutoFillAddressKind = 'billing' | 'shipping';
313
- type AutoFillBase = '' | 'off' | 'on';
314
- type AutoFillContactField = 'email' | 'tel' | 'tel-area-code' | 'tel-country-code' | 'tel-extension' | 'tel-local' | 'tel-local-prefix' | 'tel-local-suffix' | 'tel-national';
315
- type AutoFillContactKind = 'home' | 'mobile' | 'work';
316
- type AutoFillCredentialField = 'webauthn';
317
- type AutoFillNormalField = 'additional-name' | 'address-level1' | 'address-level2' | 'address-level3' | 'address-level4' | 'address-line1' | 'address-line2' | 'address-line3' | 'bday-day' | 'bday-month' | 'bday-year' | 'cc-csc' | 'cc-exp' | 'cc-exp-month' | 'cc-exp-year' | 'cc-family-name' | 'cc-given-name' | 'cc-name' | 'cc-number' | 'cc-type' | 'country' | 'country-name' | 'current-password' | 'family-name' | 'given-name' | 'honorific-prefix' | 'honorific-suffix' | 'name' | 'new-password' | 'one-time-code' | 'organization' | 'postal-code' | 'street-address' | 'transaction-amount' | 'transaction-currency' | 'username';
318
- type OptionalPrefixToken<T extends string> = `${T} ` | '';
319
- type OptionalPostfixToken<T extends string> = ` ${T}` | '';
311
+ type HTMLInputTypeAttribute = StringLiteralUnion<"button" | "checkbox" | "color" | "date" | "datetime-local" | "email" | "file" | "hidden" | "image" | "month" | "number" | "password" | "radio" | "range" | "reset" | "search" | "submit" | "tel" | "text" | "time" | "url" | "week">;
312
+ type AutoFillAddressKind = "billing" | "shipping";
313
+ type AutoFillBase = "" | "off" | "on";
314
+ type AutoFillContactField = "email" | "tel" | "tel-area-code" | "tel-country-code" | "tel-extension" | "tel-local" | "tel-local-prefix" | "tel-local-suffix" | "tel-national";
315
+ type AutoFillContactKind = "home" | "mobile" | "work";
316
+ type AutoFillCredentialField = "webauthn";
317
+ type AutoFillNormalField = "additional-name" | "address-level1" | "address-level2" | "address-level3" | "address-level4" | "address-line1" | "address-line2" | "address-line3" | "bday-day" | "bday-month" | "bday-year" | "cc-csc" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-family-name" | "cc-given-name" | "cc-name" | "cc-number" | "cc-type" | "country" | "country-name" | "current-password" | "family-name" | "given-name" | "honorific-prefix" | "honorific-suffix" | "name" | "new-password" | "one-time-code" | "organization" | "postal-code" | "street-address" | "transaction-amount" | "transaction-currency" | "username";
318
+ type OptionalPrefixToken<T extends string> = `${T} ` | "";
319
+ type OptionalPostfixToken<T extends string> = ` ${T}` | "";
320
320
  type AutoFillField = AutoFillNormalField | `${OptionalPrefixToken<AutoFillContactKind>}${AutoFillContactField}`;
321
321
  type AutoFillSection = `section-${string}`;
322
322
  type AutoFill = AutoFillBase | `${OptionalPrefixToken<AutoFillSection>}${OptionalPrefixToken<AutoFillAddressKind>}${AutoFillField}${OptionalPostfixToken<AutoFillCredentialField>}`;
@@ -324,7 +324,7 @@ export declare namespace JSX {
324
324
  accept?: string | undefined;
325
325
  alt?: string | undefined;
326
326
  autocomplete?: StringLiteralUnion<AutoFill> | undefined;
327
- capture?: boolean | 'user' | 'environment' | undefined;
327
+ capture?: boolean | "user" | "environment" | undefined;
328
328
  checked?: boolean | undefined;
329
329
  disabled?: boolean | undefined;
330
330
  form?: string | undefined;
@@ -387,7 +387,7 @@ export declare namespace JSX {
387
387
  disabled?: boolean | undefined;
388
388
  onError?: ((event: Event) => void) | undefined;
389
389
  onLoad?: ((event: Event) => void) | undefined;
390
- blocking?: 'render' | undefined;
390
+ blocking?: "render" | undefined;
391
391
  }
392
392
  interface MapHTMLAttributes extends HTMLAttributes {
393
393
  name?: string | undefined;
@@ -410,18 +410,18 @@ export declare namespace JSX {
410
410
  /**
411
411
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#http-equiv
412
412
  */
413
- type MetaHttpEquiv = 'content-security-policy' | 'content-type' | 'default-style' | 'x-ua-compatible' | 'refresh';
413
+ type MetaHttpEquiv = "content-security-policy" | "content-type" | "default-style" | "x-ua-compatible" | "refresh";
414
414
  /**
415
415
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name
416
416
  */
417
- type MetaName = 'application-name' | 'author' | 'description' | 'generator' | 'keywords' | 'referrer' | 'theme-color' | 'color-scheme' | 'viewport' | 'creator' | 'googlebot' | 'publisher' | 'robots';
417
+ type MetaName = "application-name" | "author" | "description" | "generator" | "keywords" | "referrer" | "theme-color" | "color-scheme" | "viewport" | "creator" | "googlebot" | "publisher" | "robots";
418
418
  /**
419
419
  * @see https://ogp.me/
420
420
  */
421
- type MetaProperty = 'og:title' | 'og:type' | 'og:image' | 'og:url' | 'og:audio' | 'og:description' | 'og:determiner' | 'og:locale' | 'og:locale:alternate' | 'og:site_name' | 'og:video' | 'og:image:url' | 'og:image:secure_url' | 'og:image:type' | 'og:image:width' | 'og:image:height' | 'og:image:alt';
421
+ type MetaProperty = "og:title" | "og:type" | "og:image" | "og:url" | "og:audio" | "og:description" | "og:determiner" | "og:locale" | "og:locale:alternate" | "og:site_name" | "og:video" | "og:image:url" | "og:image:secure_url" | "og:image:type" | "og:image:width" | "og:image:height" | "og:image:alt";
422
422
  interface MetaHTMLAttributes extends HTMLAttributes {
423
- charset?: StringLiteralUnion<'utf-8'> | undefined;
424
- 'http-equiv'?: StringLiteralUnion<MetaHttpEquiv> | undefined;
423
+ charset?: StringLiteralUnion<"utf-8"> | undefined;
424
+ "http-equiv"?: StringLiteralUnion<MetaHttpEquiv> | undefined;
425
425
  name?: StringLiteralUnion<MetaName> | undefined;
426
426
  media?: string | undefined;
427
427
  content?: string | undefined;
@@ -452,7 +452,7 @@ export declare namespace JSX {
452
452
  interface OlHTMLAttributes extends HTMLAttributes {
453
453
  reversed?: boolean | undefined;
454
454
  start?: number | undefined;
455
- type?: '1' | 'a' | 'A' | 'i' | 'I' | undefined;
455
+ type?: "1" | "a" | "A" | "i" | "I" | undefined;
456
456
  }
457
457
  interface OptgroupHTMLAttributes extends HTMLAttributes {
458
458
  disabled?: boolean | undefined;
@@ -491,14 +491,14 @@ export declare namespace JSX {
491
491
  /**
492
492
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type
493
493
  */
494
- type?: StringLiteralUnion<'' | 'text/javascript' | 'importmap' | 'module'> | undefined;
494
+ type?: StringLiteralUnion<"" | "text/javascript" | "importmap" | "module"> | undefined;
495
495
  crossOrigin?: CrossOrigin;
496
496
  fetchPriority?: string | undefined;
497
497
  noModule?: boolean | undefined;
498
498
  referrer?: HTMLAttributeReferrerPolicy | undefined;
499
499
  onError?: ((event: Event) => void) | undefined;
500
500
  onLoad?: ((event: Event) => void) | undefined;
501
- blocking?: 'render' | undefined;
501
+ blocking?: "render" | undefined;
502
502
  }
503
503
  interface SelectHTMLAttributes extends HTMLAttributes {
504
504
  autocomplete?: string | undefined;
@@ -526,21 +526,21 @@ export declare namespace JSX {
526
526
  /**
527
527
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style#type
528
528
  */
529
- type?: '' | 'text/css' | undefined;
529
+ type?: "" | "text/css" | undefined;
530
530
  href?: string | undefined;
531
531
  precedence?: string | undefined;
532
532
  title?: string | undefined;
533
533
  disabled?: boolean | undefined;
534
- blocking?: 'render' | undefined;
534
+ blocking?: "render" | undefined;
535
535
  }
536
536
  interface TableHTMLAttributes extends HTMLAttributes {
537
- align?: 'left' | 'center' | 'right' | undefined;
537
+ align?: "left" | "center" | "right" | undefined;
538
538
  bgcolor?: string | undefined;
539
539
  border?: number | undefined;
540
540
  cellpadding?: number | string | undefined;
541
541
  cellspacing?: number | string | undefined;
542
542
  frame?: boolean | undefined;
543
- rules?: 'none' | 'groups' | 'rows' | 'columns' | 'all' | undefined;
543
+ rules?: "none" | "groups" | "rows" | "columns" | "all" | undefined;
544
544
  summary?: string | undefined;
545
545
  width?: number | string | undefined;
546
546
  }
@@ -561,7 +561,7 @@ export declare namespace JSX {
561
561
  wrap?: string | undefined;
562
562
  }
563
563
  interface TdHTMLAttributes extends HTMLAttributes {
564
- align?: 'left' | 'center' | 'right' | 'justify' | 'char' | undefined;
564
+ align?: "left" | "center" | "right" | "justify" | "char" | undefined;
565
565
  colspan?: number | undefined;
566
566
  headers?: string | undefined;
567
567
  rowspan?: number | undefined;
@@ -569,14 +569,14 @@ export declare namespace JSX {
569
569
  abbr?: string | undefined;
570
570
  height?: number | string | undefined;
571
571
  width?: number | string | undefined;
572
- valign?: 'top' | 'middle' | 'bottom' | 'baseline' | undefined;
572
+ valign?: "top" | "middle" | "bottom" | "baseline" | undefined;
573
573
  }
574
574
  interface ThHTMLAttributes extends HTMLAttributes {
575
- align?: 'left' | 'center' | 'right' | 'justify' | 'char' | undefined;
575
+ align?: "left" | "center" | "right" | "justify" | "char" | undefined;
576
576
  colspan?: number | undefined;
577
577
  headers?: string | undefined;
578
578
  rowspan?: number | undefined;
579
- scope?: 'row' | 'col' | 'rowgroup' | 'colgroup' | string | undefined;
579
+ scope?: "row" | "col" | "rowgroup" | "colgroup" | string | undefined;
580
580
  abbr?: string | undefined;
581
581
  }
582
582
  interface TimeHTMLAttributes extends HTMLAttributes {
@@ -3,7 +3,10 @@
3
3
  * Compress Middleware for Hono.
4
4
  */
5
5
  import type { MiddlewareHandler } from '../../types';
6
- declare const ENCODING_TYPES: readonly ["gzip", "deflate"];
6
+ declare const ENCODING_TYPES: readonly [
7
+ "gzip",
8
+ "deflate"
9
+ ];
7
10
  interface CompressionOptions {
8
11
  encoding?: (typeof ENCODING_TYPES)[number];
9
12
  threshold?: number;
@@ -1 +1 @@
1
- export declare const generateDigest: (stream: ReadableStream<Uint8Array> | null) => Promise<string | null>;
1
+ export declare const generateDigest: (stream: ReadableStream<Uint8Array> | null, generator: (body: Uint8Array) => ArrayBuffer | Promise<ArrayBuffer>) => Promise<string | null>;
@@ -6,6 +6,7 @@ import type { MiddlewareHandler } from '../../types';
6
6
  type ETagOptions = {
7
7
  retainedHeaders?: string[];
8
8
  weak?: boolean;
9
+ generateDigest?: (body: Uint8Array) => ArrayBuffer | Promise<ArrayBuffer>;
9
10
  };
10
11
  /**
11
12
  * Default headers to pass through on 304 responses. From the spec:
@@ -22,6 +23,9 @@ export declare const RETAINED_304_HEADERS: string[];
22
23
  * @param {ETagOptions} [options] - The options for the ETag middleware.
23
24
  * @param {boolean} [options.weak=false] - Define using or not using a weak validation. If true is set, then `W/` is added to the prefix of the value.
24
25
  * @param {string[]} [options.retainedHeaders=RETAINED_304_HEADERS] - The headers that you want to retain in the 304 Response.
26
+ * @param {function(Uint8Array): ArrayBuffer | Promise<ArrayBuffer>} [options.generateDigest] -
27
+ * A custom digest generation function. By default, it uses 'SHA-1'
28
+ * This function is called with the response body as a `Uint8Array` and should return a hash as an `ArrayBuffer` or a Promise of one.
25
29
  * @returns {MiddlewareHandler} The middleware handler function.
26
30
  *
27
31
  * @example
@@ -0,0 +1 @@
1
+ export { jwk } from './jwk';
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @module
3
+ * JWK Auth Middleware for Hono.
4
+ */
5
+ import type { MiddlewareHandler } from '../../types';
6
+ import type { CookiePrefixOptions } from '../../utils/cookie';
7
+ import '../../context';
8
+ import type { HonoJsonWebKey } from '../../utils/jwt/jws';
9
+ /**
10
+ * JWK Auth Middleware for Hono.
11
+ *
12
+ * @see {@link https://hono.dev/docs/middleware/builtin/jwk}
13
+ *
14
+ * @param {object} options - The options for the JWK middleware.
15
+ * @param {HonoJsonWebKey[] | (() => Promise<HonoJsonWebKey[]>)} [options.keys] - The values of your public keys, or a function that returns them.
16
+ * @param {string} [options.jwks_uri] - If this value is set, attempt to fetch JWKs from this URI, expecting a JSON response with `keys` which are added to the provided options.keys
17
+ * @param {string} [options.cookie] - If this value is set, then the value is retrieved from the cookie header using that value as a key, which is then validated as a token.
18
+ * @param {RequestInit} [init] - Optional initialization options for the `fetch` request when retrieving JWKS from a URI.
19
+ * @returns {MiddlewareHandler} The middleware handler function.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * const app = new Hono()
24
+ *
25
+ * app.use("/auth/*", jwk({ jwks_uri: "https://example-backend.hono.dev/.well-known/jwks.json" }))
26
+ *
27
+ * app.get('/auth/page', (c) => {
28
+ * return c.text('You are authorized')
29
+ * })
30
+ * ```
31
+ */
32
+ export declare const jwk: (options: {
33
+ keys?: HonoJsonWebKey[] | (() => Promise<HonoJsonWebKey[]>);
34
+ jwks_uri?: string;
35
+ cookie?: string | {
36
+ key: string;
37
+ secret?: string | BufferSource;
38
+ prefixOptions?: CookiePrefixOptions;
39
+ };
40
+ }, init?: RequestInit) => MiddlewareHandler;
@@ -0,0 +1,7 @@
1
+ import type { LanguageVariables, DetectorOptions, DetectorType, CacheType } from './language';
2
+ export type { LanguageVariables, DetectorOptions, DetectorType, CacheType };
3
+ export { languageDetector, detectFromCookie, detectFromHeader, detectFromPath, detectFromQuery, } from './language';
4
+ declare module '../..' {
5
+ interface ContextVariableMap extends LanguageVariables {
6
+ }
7
+ }