hono 4.6.4 → 4.6.6
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.
- package/dist/adapter/deno/serve-static.js +4 -2
- package/dist/cjs/adapter/deno/serve-static.js +4 -2
- package/dist/cjs/client/client.js +10 -16
- package/dist/cjs/client/utils.js +18 -0
- package/dist/cjs/middleware/cors/index.js +6 -2
- package/dist/cjs/middleware/csrf/index.js +1 -1
- package/dist/cjs/middleware/powered-by/index.js +2 -2
- package/dist/cjs/middleware/secure-headers/secure-headers.js +6 -5
- package/dist/client/client.js +11 -16
- package/dist/client/utils.js +17 -0
- package/dist/middleware/cors/index.js +6 -2
- package/dist/middleware/csrf/index.js +1 -1
- package/dist/middleware/powered-by/index.js +2 -2
- package/dist/middleware/secure-headers/secure-headers.js +6 -5
- package/dist/types/adapter/cloudflare-pages/handler.d.ts +1 -1
- package/dist/types/adapter/lambda-edge/handler.d.ts +2 -2
- package/dist/types/client/types.d.ts +18 -8
- package/dist/types/client/utils.d.ts +1 -0
- package/dist/types/compose.d.ts +7 -1
- package/dist/types/context.d.ts +26 -16
- package/dist/types/helper/accepts/accepts.d.ts +1 -1
- package/dist/types/helper/adapter/index.d.ts +1 -1
- package/dist/types/helper/conninfo/types.d.ts +2 -2
- package/dist/types/helper/css/common.d.ts +6 -1
- package/dist/types/helper/factory/index.d.ts +31 -10
- package/dist/types/helper/ssg/ssg.d.ts +1 -1
- package/dist/types/helper/websocket/index.d.ts +1 -1
- package/dist/types/hono-base.d.ts +19 -22
- package/dist/types/hono.d.ts +1 -1
- package/dist/types/jsx/base.d.ts +4 -1
- package/dist/types/jsx/dom/hooks/index.d.ts +9 -3
- package/dist/types/jsx/dom/index.d.ts +28 -7
- package/dist/types/jsx/dom/intrinsic-element/components.d.ts +6 -6
- package/dist/types/jsx/dom/render.d.ts +28 -4
- package/dist/types/jsx/dom/server.d.ts +28 -7
- package/dist/types/jsx/hooks/index.d.ts +20 -5
- package/dist/types/jsx/index.d.ts +28 -7
- package/dist/types/jsx/intrinsic-element/components.d.ts +4 -4
- package/dist/types/jsx/intrinsic-elements.d.ts +46 -46
- package/dist/types/middleware/compress/index.d.ts +4 -1
- package/dist/types/middleware/powered-by/index.d.ts +24 -1
- package/dist/types/middleware/secure-headers/permissions-policy.d.ts +3 -3
- package/dist/types/middleware/secure-headers/secure-headers.d.ts +1 -1
- package/dist/types/preset/quick.d.ts +1 -1
- package/dist/types/preset/tiny.d.ts +1 -1
- package/dist/types/request.d.ts +5 -7
- package/dist/types/router/linear-router/router.d.ts +5 -1
- package/dist/types/router/pattern-router/router.d.ts +0 -1
- package/dist/types/router/reg-exp-router/node.d.ts +4 -1
- package/dist/types/router/reg-exp-router/router.d.ts +4 -3
- package/dist/types/router/reg-exp-router/trie.d.ts +5 -1
- package/dist/types/router/smart-router/router.d.ts +6 -2
- package/dist/types/router/trie-router/node.d.ts +6 -2
- package/dist/types/router.d.ts +20 -2
- package/dist/types/types.d.ts +908 -120
- package/dist/types/utils/cookie.d.ts +3 -3
- package/dist/types/utils/html.d.ts +6 -2
- package/dist/types/utils/jwt/jwt.d.ts +1 -1
- package/dist/types/utils/mime.d.ts +1 -1
- package/dist/types/utils/stream.d.ts +0 -4
- package/dist/types/utils/url.d.ts +5 -1
- package/dist/types/validator/validator.d.ts +18 -6
- package/package.json +8 -7
|
@@ -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 =
|
|
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?:
|
|
148
|
+
autocapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined;
|
|
149
149
|
autofocus?: boolean | undefined;
|
|
150
150
|
class?: string | Promise<string> | undefined;
|
|
151
|
-
contenteditable?: boolean |
|
|
151
|
+
contenteditable?: boolean | "inherit" | undefined;
|
|
152
152
|
contextmenu?: string | undefined;
|
|
153
153
|
dir?: string | undefined;
|
|
154
|
-
draggable?:
|
|
155
|
-
enterkeyhint?:
|
|
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?:
|
|
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 |
|
|
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?:
|
|
176
|
+
translate?: "yes" | "no" | undefined;
|
|
177
177
|
itemProp?: string | undefined;
|
|
178
178
|
}
|
|
179
|
-
type HTMLAttributeReferrerPolicy =
|
|
180
|
-
type HTMLAttributeAnchorTarget = StringLiteralUnion<
|
|
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 =
|
|
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?:
|
|
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 =
|
|
263
|
+
type HTMLAttributeFormMethod = "get" | "post" | "dialog";
|
|
264
264
|
/** @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#enctype */
|
|
265
|
-
type HTMLAttributeFormEnctype =
|
|
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 =
|
|
267
|
+
type HTMLAttributeFormAutocomplete = "on" | "off";
|
|
268
268
|
interface FormHTMLAttributes extends HTMLAttributes {
|
|
269
|
-
|
|
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?:
|
|
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?:
|
|
297
|
+
decoding?: "async" | "auto" | "sync" | undefined;
|
|
298
298
|
height?: number | string | undefined;
|
|
299
|
-
loading?:
|
|
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<
|
|
312
|
-
type AutoFillAddressKind =
|
|
313
|
-
type AutoFillBase =
|
|
314
|
-
type AutoFillContactField =
|
|
315
|
-
type AutoFillContactKind =
|
|
316
|
-
type AutoFillCredentialField =
|
|
317
|
-
type AutoFillNormalField =
|
|
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 |
|
|
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?:
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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<
|
|
424
|
-
|
|
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?:
|
|
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<
|
|
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?:
|
|
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?:
|
|
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?:
|
|
534
|
+
blocking?: "render" | undefined;
|
|
535
535
|
}
|
|
536
536
|
interface TableHTMLAttributes extends HTMLAttributes {
|
|
537
|
-
align?:
|
|
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?:
|
|
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?:
|
|
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?:
|
|
572
|
+
valign?: "top" | "middle" | "bottom" | "baseline" | undefined;
|
|
573
573
|
}
|
|
574
574
|
interface ThHTMLAttributes extends HTMLAttributes {
|
|
575
|
-
align?:
|
|
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?:
|
|
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 [
|
|
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;
|
|
@@ -3,4 +3,27 @@
|
|
|
3
3
|
* Powered By Middleware for Hono.
|
|
4
4
|
*/
|
|
5
5
|
import type { MiddlewareHandler } from '../../types';
|
|
6
|
-
|
|
6
|
+
type PoweredByOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* The value for X-Powered-By header.
|
|
9
|
+
* @default Hono
|
|
10
|
+
*/
|
|
11
|
+
serverName?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Powered By Middleware for Hono.
|
|
15
|
+
*
|
|
16
|
+
* @param options - The options for the Powered By Middleware.
|
|
17
|
+
* @returns {MiddlewareHandler} The middleware handler function.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { poweredBy } from 'hono/powered-by'
|
|
22
|
+
*
|
|
23
|
+
* const app = new Hono()
|
|
24
|
+
*
|
|
25
|
+
* app.use(poweredBy()) // With options: poweredBy({ serverName: "My Server" })
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const poweredBy: (options?: PoweredByOptions) => MiddlewareHandler;
|
|
29
|
+
export {};
|
|
@@ -2,13 +2,13 @@ export type PermissionsPolicyDirective = StandardizedFeatures | ProposedFeatures
|
|
|
2
2
|
/**
|
|
3
3
|
* These features have been declared in a published version of the respective specification.
|
|
4
4
|
*/
|
|
5
|
-
type StandardizedFeatures =
|
|
5
|
+
type StandardizedFeatures = "accelerometer" | "ambientLightSensor" | "attributionReporting" | "autoplay" | "battery" | "bluetooth" | "camera" | "chUa" | "chUaArch" | "chUaBitness" | "chUaFullVersion" | "chUaFullVersionList" | "chUaMobile" | "chUaModel" | "chUaPlatform" | "chUaPlatformVersion" | "chUaWow64" | "computePressure" | "crossOriginIsolated" | "directSockets" | "displayCapture" | "encryptedMedia" | "executionWhileNotRendered" | "executionWhileOutOfViewport" | "fullscreen" | "geolocation" | "gyroscope" | "hid" | "identityCredentialsGet" | "idleDetection" | "keyboardMap" | "magnetometer" | "microphone" | "midi" | "navigationOverride" | "payment" | "pictureInPicture" | "publickeyCredentialsGet" | "screenWakeLock" | "serial" | "storageAccess" | "syncXhr" | "usb" | "webShare" | "windowManagement" | "xrSpatialTracking";
|
|
6
6
|
/**
|
|
7
7
|
* These features have been proposed, but the definitions have not yet been integrated into their respective specs.
|
|
8
8
|
*/
|
|
9
|
-
type ProposedFeatures =
|
|
9
|
+
type ProposedFeatures = "clipboardRead" | "clipboardWrite" | "gemepad" | "sharedAutofill" | "speakerSelection";
|
|
10
10
|
/**
|
|
11
11
|
* These features generally have an explainer only, but may be available for experimentation by web developers.
|
|
12
12
|
*/
|
|
13
|
-
type ExperimentalFeatures =
|
|
13
|
+
type ExperimentalFeatures = "allScreensCapture" | "browsingTopics" | "capturedSurfaceControl" | "conversionMeasurement" | "digitalCredentialsGet" | "focusWithoutUserActivation" | "joinAdInterestGroup" | "localFonts" | "runAdAuction" | "smartCard" | "syncScript" | "trustTokenRedemption" | "unload" | "verticalScroll";
|
|
14
14
|
export {};
|
|
@@ -46,7 +46,7 @@ interface ReportingEndpointOptions {
|
|
|
46
46
|
name: string;
|
|
47
47
|
url: string;
|
|
48
48
|
}
|
|
49
|
-
type PermissionsPolicyValue =
|
|
49
|
+
type PermissionsPolicyValue = "*" | "self" | "src" | "none" | string;
|
|
50
50
|
type PermissionsPolicyOptions = Partial<Record<PermissionsPolicyDirective, PermissionsPolicyValue[] | boolean>>;
|
|
51
51
|
type overridableHeader = boolean | string;
|
|
52
52
|
interface SecureHeadersOptions {
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
import { HonoBase } from '../hono-base';
|
|
6
6
|
import type { HonoOptions } from '../hono-base';
|
|
7
7
|
import type { BlankEnv, BlankSchema, Env, Schema } from '../types';
|
|
8
|
-
export declare class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string =
|
|
8
|
+
export declare class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> extends HonoBase<E, S, BasePath> {
|
|
9
9
|
constructor(options?: HonoOptions<E>);
|
|
10
10
|
}
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
import { HonoBase } from '../hono-base';
|
|
6
6
|
import type { HonoOptions } from '../hono-base';
|
|
7
7
|
import type { BlankEnv, BlankSchema, Env, Schema } from '../types';
|
|
8
|
-
export declare class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string =
|
|
8
|
+
export declare class Hono<E extends Env = BlankEnv, S extends Schema = BlankSchema, BasePath extends string = "/"> extends HonoBase<E, S, BasePath> {
|
|
9
9
|
constructor(options?: HonoOptions<E>);
|
|
10
10
|
}
|
package/dist/types/request.d.ts
CHANGED
|
@@ -12,8 +12,7 @@ type Body = {
|
|
|
12
12
|
type BodyCache = Partial<Body & {
|
|
13
13
|
parsedBody: BodyData;
|
|
14
14
|
}>;
|
|
15
|
-
export declare class HonoRequest<P extends string =
|
|
16
|
-
#private;
|
|
15
|
+
export declare class HonoRequest<P extends string = "/", I extends Input["out"] = {}> {
|
|
17
16
|
/**
|
|
18
17
|
* `.raw` can get the raw Request object.
|
|
19
18
|
*
|
|
@@ -44,7 +43,10 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
|
|
|
44
43
|
*/
|
|
45
44
|
path: string;
|
|
46
45
|
bodyCache: BodyCache;
|
|
47
|
-
constructor(request: Request, path?: string, matchResult?: Result<[
|
|
46
|
+
constructor(request: Request, path?: string, matchResult?: Result<[
|
|
47
|
+
unknown,
|
|
48
|
+
RouterRoute
|
|
49
|
+
]>);
|
|
48
50
|
/**
|
|
49
51
|
* `.req.param()` gets the path parameters.
|
|
50
52
|
*
|
|
@@ -61,9 +63,6 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
|
|
|
61
63
|
param<P2 extends RemoveQuestion<ParamKeys<P>> = RemoveQuestion<ParamKeys<P>>>(key: P2): string | undefined;
|
|
62
64
|
param(key: string): string | undefined;
|
|
63
65
|
param<P2 extends string = P>(): Simplify<UnionToIntersection<ParamKeyToRecord<ParamKeys<P2>>>>;
|
|
64
|
-
private getDecodedParam;
|
|
65
|
-
private getAllDecodedParams;
|
|
66
|
-
private getParamValue;
|
|
67
66
|
/**
|
|
68
67
|
* `.query()` can get querystring parameters.
|
|
69
68
|
*
|
|
@@ -127,7 +126,6 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
|
|
|
127
126
|
*/
|
|
128
127
|
parseBody<Options extends Partial<ParseBodyOptions>, T extends BodyData<Options>>(options?: Options): Promise<T>;
|
|
129
128
|
parseBody<T extends BodyData>(options?: Partial<ParseBodyOptions>): Promise<T>;
|
|
130
|
-
private cachedBody;
|
|
131
129
|
/**
|
|
132
130
|
* `.json()` can parse Request body of type `application/json`
|
|
133
131
|
*
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { Result, Router } from '../../router';
|
|
2
2
|
export declare class LinearRouter<T> implements Router<T> {
|
|
3
3
|
name: string;
|
|
4
|
-
routes: [
|
|
4
|
+
routes: [
|
|
5
|
+
string,
|
|
6
|
+
string,
|
|
7
|
+
T
|
|
8
|
+
][];
|
|
5
9
|
add(method: string, path: string, handler: T): void;
|
|
6
10
|
match(method: string, path: string): Result<T>;
|
|
7
11
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { Result, Router } from '../../router';
|
|
2
|
-
type HandlerWithMetadata<T> = [
|
|
2
|
+
type HandlerWithMetadata<T> = [
|
|
3
|
+
T,
|
|
4
|
+
number
|
|
5
|
+
];
|
|
3
6
|
export declare class RegExpRouter<T> implements Router<T> {
|
|
4
7
|
name: string;
|
|
5
8
|
middleware?: Record<string, Record<string, HandlerWithMetadata<T>[]>>;
|
|
@@ -7,7 +10,5 @@ export declare class RegExpRouter<T> implements Router<T> {
|
|
|
7
10
|
constructor();
|
|
8
11
|
add(method: string, path: string, handler: T): void;
|
|
9
12
|
match(method: string, path: string): Result<T>;
|
|
10
|
-
private buildAllMatchers;
|
|
11
|
-
private buildMatcher;
|
|
12
13
|
}
|
|
13
14
|
export {};
|
|
@@ -5,5 +5,9 @@ export declare class Trie {
|
|
|
5
5
|
context: Context;
|
|
6
6
|
root: Node;
|
|
7
7
|
insert(path: string, index: number, pathErrorCheckOnly: boolean): ParamAssocArray;
|
|
8
|
-
buildRegExp(): [
|
|
8
|
+
buildRegExp(): [
|
|
9
|
+
RegExp,
|
|
10
|
+
ReplacementMap,
|
|
11
|
+
ReplacementMap
|
|
12
|
+
];
|
|
9
13
|
}
|
|
@@ -2,8 +2,12 @@ import type { Result, Router } from '../../router';
|
|
|
2
2
|
export declare class SmartRouter<T> implements Router<T> {
|
|
3
3
|
name: string;
|
|
4
4
|
routers: Router<T>[];
|
|
5
|
-
routes?: [
|
|
6
|
-
|
|
5
|
+
routes?: [
|
|
6
|
+
string,
|
|
7
|
+
string,
|
|
8
|
+
T
|
|
9
|
+
][];
|
|
10
|
+
constructor(init: Pick<SmartRouter<T>, "routers">);
|
|
7
11
|
add(method: string, path: string, handler: T): void;
|
|
8
12
|
match(method: string, path: string): Result<T>;
|
|
9
13
|
get activeRouter(): Router<T>;
|
|
@@ -15,7 +15,11 @@ export declare class Node<T> {
|
|
|
15
15
|
params: Record<string, string>;
|
|
16
16
|
constructor(method?: string, handler?: T, children?: Record<string, Node<T>>);
|
|
17
17
|
insert(method: string, path: string, handler: T): Node<T>;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
search(method: string, path: string): [
|
|
19
|
+
[
|
|
20
|
+
T,
|
|
21
|
+
Params
|
|
22
|
+
][]
|
|
23
|
+
];
|
|
20
24
|
}
|
|
21
25
|
export {};
|
package/dist/types/router.d.ts
CHANGED
|
@@ -13,7 +13,14 @@ export declare const METHOD_NAME_ALL_LOWERCASE: "all";
|
|
|
13
13
|
/**
|
|
14
14
|
* Array of supported HTTP methods.
|
|
15
15
|
*/
|
|
16
|
-
export declare const METHODS: readonly [
|
|
16
|
+
export declare const METHODS: readonly [
|
|
17
|
+
"get",
|
|
18
|
+
"post",
|
|
19
|
+
"put",
|
|
20
|
+
"delete",
|
|
21
|
+
"options",
|
|
22
|
+
"patch"
|
|
23
|
+
];
|
|
17
24
|
/**
|
|
18
25
|
* Error message indicating that a route cannot be added because the matcher is already built.
|
|
19
26
|
*/
|
|
@@ -89,7 +96,18 @@ export type Params = Record<string, string>;
|
|
|
89
96
|
* ]
|
|
90
97
|
* ```
|
|
91
98
|
*/
|
|
92
|
-
export type Result<T> = [
|
|
99
|
+
export type Result<T> = [
|
|
100
|
+
[
|
|
101
|
+
T,
|
|
102
|
+
ParamIndexMap
|
|
103
|
+
][],
|
|
104
|
+
ParamStash
|
|
105
|
+
] | [
|
|
106
|
+
[
|
|
107
|
+
T,
|
|
108
|
+
Params
|
|
109
|
+
][]
|
|
110
|
+
];
|
|
93
111
|
/**
|
|
94
112
|
* Error class representing an unsupported path error.
|
|
95
113
|
*/
|