hono 4.3.11 → 4.4.0
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/README.md +2 -3
- package/dist/adapter/aws-lambda/handler.js +12 -9
- package/dist/adapter/bun/conninfo.js +21 -0
- package/dist/adapter/bun/index.js +2 -0
- package/dist/adapter/bun/websocket.js +1 -3
- package/dist/adapter/cloudflare-workers/conninfo.js +10 -0
- package/dist/adapter/cloudflare-workers/websocket.js +2 -6
- package/dist/adapter/deno/conninfo.js +15 -0
- package/dist/adapter/deno/index.js +2 -0
- package/dist/adapter/lambda-edge/handler.js +3 -3
- package/dist/cjs/adapter/aws-lambda/handler.js +12 -9
- package/dist/cjs/adapter/bun/conninfo.js +44 -0
- package/dist/cjs/adapter/bun/index.js +3 -0
- package/dist/cjs/adapter/cloudflare-workers/conninfo.js +33 -0
- package/dist/cjs/adapter/cloudflare-workers/websocket.js +2 -6
- package/dist/cjs/adapter/deno/conninfo.js +38 -0
- package/dist/cjs/adapter/deno/index.js +3 -0
- package/dist/cjs/adapter/lambda-edge/handler.js +3 -3
- package/dist/cjs/helper/conninfo/index.js +16 -0
- package/dist/cjs/helper/ssg/ssg.js +64 -3
- package/dist/cjs/helper/streaming/text.js +1 -1
- package/dist/cjs/hono-base.js +10 -6
- package/dist/cjs/jsx/base.js +5 -2
- package/dist/cjs/jsx/dom/client.js +68 -0
- package/dist/cjs/jsx/dom/index.js +8 -4
- package/dist/cjs/jsx/dom/jsx-dev-runtime.js +6 -20
- package/dist/cjs/jsx/dom/render.js +41 -25
- package/dist/cjs/jsx/dom/utils.js +15 -0
- package/dist/cjs/jsx/hooks/index.js +4 -1
- package/dist/cjs/jsx/index.js +8 -4
- package/dist/cjs/middleware/jwt/index.js +5 -82
- package/dist/cjs/middleware/jwt/jwt.js +111 -0
- package/dist/cjs/middleware/secure-headers/index.js +3 -123
- package/dist/cjs/middleware/secure-headers/secure-headers.js +150 -0
- package/dist/cjs/middleware/timeout/index.js +48 -0
- package/dist/cjs/middleware/timing/index.js +5 -89
- package/dist/cjs/middleware/timing/timing.js +118 -0
- package/dist/cjs/utils/body.js +34 -9
- package/dist/cjs/utils/jwt/jws.js +4 -5
- package/dist/cjs/utils/jwt/jwt.js +6 -7
- package/dist/cjs/utils/url.js +26 -2
- package/dist/helper/css/index.js +4 -4
- package/dist/helper/html/index.js +1 -1
- package/dist/helper/ssg/ssg.js +63 -5
- package/dist/helper/streaming/text.js +1 -1
- package/dist/hono-base.js +11 -7
- package/dist/jsx/base.js +3 -1
- package/dist/jsx/dom/client.js +44 -0
- package/dist/jsx/dom/css.js +4 -4
- package/dist/jsx/dom/index.js +25 -21
- package/dist/jsx/dom/jsx-dev-runtime.js +6 -20
- package/dist/jsx/dom/render.js +40 -26
- package/dist/jsx/dom/utils.js +14 -0
- package/dist/jsx/hooks/index.js +4 -2
- package/dist/jsx/index.js +22 -18
- package/dist/jsx/jsx-runtime.js +1 -1
- package/dist/middleware/jsx-renderer/index.js +1 -1
- package/dist/middleware/jwt/index.js +1 -78
- package/dist/middleware/jwt/jwt.js +85 -0
- package/dist/middleware/secure-headers/index.js +1 -121
- package/dist/middleware/secure-headers/secure-headers.js +126 -0
- package/dist/middleware/timeout/index.js +25 -0
- package/dist/middleware/timing/index.js +1 -85
- package/dist/middleware/timing/timing.js +92 -0
- package/dist/request.js +1 -1
- package/dist/router/reg-exp-router/router.js +2 -2
- package/dist/router/smart-router/router.js +1 -1
- package/dist/router/trie-router/node.js +1 -1
- package/dist/types/adapter/aws-lambda/handler.d.ts +3 -3
- package/dist/types/adapter/aws-lambda/index.d.ts +4 -0
- package/dist/types/adapter/bun/conninfo.d.ts +7 -0
- package/dist/types/adapter/bun/index.d.ts +5 -0
- package/dist/types/adapter/bun/websocket.d.ts +2 -3
- package/dist/types/adapter/cloudflare-pages/index.d.ts +4 -0
- package/dist/types/adapter/cloudflare-workers/conninfo.d.ts +2 -0
- package/dist/types/adapter/cloudflare-workers/index.d.ts +4 -0
- package/dist/types/adapter/cloudflare-workers/serve-static-module.d.ts +2 -2
- package/dist/types/adapter/cloudflare-workers/serve-static.d.ts +1 -2
- package/dist/types/adapter/cloudflare-workers/utils.d.ts +1 -2
- package/dist/types/adapter/deno/conninfo.d.ts +7 -0
- package/dist/types/adapter/deno/index.d.ts +5 -0
- package/dist/types/adapter/lambda-edge/handler.d.ts +1 -2
- package/dist/types/adapter/lambda-edge/index.d.ts +4 -0
- package/dist/types/adapter/netlify/handler.d.ts +1 -7
- package/dist/types/adapter/netlify/index.d.ts +4 -0
- package/dist/types/adapter/netlify/mod.d.ts +0 -1
- package/dist/types/adapter/vercel/index.d.ts +4 -0
- package/dist/types/client/index.d.ts +4 -0
- package/dist/types/compose.d.ts +1 -1
- package/dist/types/helper/accepts/index.d.ts +4 -0
- package/dist/types/helper/adapter/index.d.ts +4 -0
- package/dist/types/helper/conninfo/index.d.ts +40 -0
- package/dist/types/helper/cookie/index.d.ts +5 -1
- package/dist/types/helper/css/index.d.ts +4 -0
- package/dist/types/helper/dev/index.d.ts +4 -0
- package/dist/types/helper/factory/index.d.ts +4 -0
- package/dist/types/helper/html/index.d.ts +4 -0
- package/dist/types/helper/ssg/index.d.ts +4 -0
- package/dist/types/helper/ssg/ssg.d.ts +6 -3
- package/dist/types/helper/streaming/index.d.ts +4 -0
- package/dist/types/helper/testing/index.d.ts +4 -0
- package/dist/types/helper/websocket/index.d.ts +4 -0
- package/dist/types/hono-base.d.ts +15 -15
- package/dist/types/http-exception.d.ts +4 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/jsx/base.d.ts +10 -11
- package/dist/types/jsx/components.d.ts +1 -1
- package/dist/types/jsx/context.d.ts +1 -1
- package/dist/types/jsx/dom/client.d.ts +26 -0
- package/dist/types/jsx/dom/components.d.ts +2 -2
- package/dist/types/jsx/dom/css.d.ts +31 -20
- package/dist/types/jsx/dom/index.d.ts +13 -7
- package/dist/types/jsx/dom/jsx-dev-runtime.d.ts +5 -1
- package/dist/types/jsx/dom/jsx-runtime.d.ts +4 -0
- package/dist/types/jsx/dom/render.d.ts +4 -3
- package/dist/types/jsx/dom/utils.d.ts +6 -0
- package/dist/types/jsx/hooks/index.d.ts +4 -0
- package/dist/types/jsx/index.d.ts +13 -7
- package/dist/types/jsx/intrinsic-elements.d.ts +629 -630
- package/dist/types/jsx/jsx-dev-runtime.d.ts +5 -0
- package/dist/types/jsx/jsx-runtime.d.ts +5 -0
- package/dist/types/jsx/streaming.d.ts +5 -1
- package/dist/types/jsx/types.d.ts +1 -0
- package/dist/types/middleware/basic-auth/index.d.ts +35 -0
- package/dist/types/middleware/bearer-auth/index.d.ts +33 -0
- package/dist/types/middleware/body-limit/index.d.ts +28 -11
- package/dist/types/middleware/cache/index.d.ts +29 -0
- package/dist/types/middleware/compress/index.d.ts +20 -0
- package/dist/types/middleware/cors/index.d.ts +43 -0
- package/dist/types/middleware/csrf/index.d.ts +41 -0
- package/dist/types/middleware/etag/index.d.ts +24 -0
- package/dist/types/middleware/jsx-renderer/index.d.ts +63 -2
- package/dist/types/middleware/jwt/index.d.ts +5 -17
- package/dist/types/middleware/jwt/jwt.d.ts +48 -0
- package/dist/types/middleware/logger/index.d.ts +20 -0
- package/dist/types/middleware/method-override/index.d.ts +22 -10
- package/dist/types/middleware/powered-by/index.d.ts +4 -0
- package/dist/types/middleware/pretty-json/index.d.ts +23 -0
- package/dist/types/middleware/secure-headers/index.d.ts +6 -64
- package/dist/types/middleware/secure-headers/secure-headers.d.ts +97 -0
- package/dist/types/middleware/serve-static/index.d.ts +4 -0
- package/dist/types/middleware/timeout/index.d.ts +31 -0
- package/dist/types/middleware/timing/index.d.ts +5 -29
- package/dist/types/middleware/timing/timing.d.ts +111 -0
- package/dist/types/middleware/trailing-slash/index.d.ts +29 -5
- package/dist/types/preset/quick.d.ts +4 -0
- package/dist/types/preset/tiny.d.ts +4 -0
- package/dist/types/request.d.ts +5 -4
- package/dist/types/router/linear-router/index.d.ts +4 -0
- package/dist/types/router/linear-router/router.d.ts +1 -1
- package/dist/types/router/pattern-router/index.d.ts +4 -0
- package/dist/types/router/reg-exp-router/index.d.ts +4 -0
- package/dist/types/router/reg-exp-router/router.d.ts +1 -1
- package/dist/types/router/reg-exp-router/trie.d.ts +1 -1
- package/dist/types/router/smart-router/index.d.ts +4 -0
- package/dist/types/router/smart-router/router.d.ts +1 -1
- package/dist/types/router/trie-router/index.d.ts +4 -0
- package/dist/types/router.d.ts +4 -0
- package/dist/types/types.d.ts +4 -0
- package/dist/types/utils/body.d.ts +61 -3
- package/dist/types/utils/buffer.d.ts +4 -0
- package/dist/types/utils/color.d.ts +4 -0
- package/dist/types/utils/concurrent.d.ts +4 -0
- package/dist/types/utils/cookie.d.ts +4 -0
- package/dist/types/utils/crypto.d.ts +4 -0
- package/dist/types/utils/encode.d.ts +4 -0
- package/dist/types/utils/filepath.d.ts +4 -0
- package/dist/types/utils/handler.d.ts +4 -0
- package/dist/types/utils/html.d.ts +4 -0
- package/dist/types/utils/http-status.d.ts +4 -0
- package/dist/types/utils/jwt/index.d.ts +4 -0
- package/dist/types/utils/jwt/jwt.d.ts +3 -3
- package/dist/types/utils/mime.d.ts +4 -0
- package/dist/types/utils/stream.d.ts +4 -0
- package/dist/types/utils/types.d.ts +4 -0
- package/dist/types/utils/url.d.ts +4 -0
- package/dist/types/validator/index.d.ts +4 -0
- package/dist/types/validator/validator.d.ts +1 -1
- package/dist/utils/body.js +34 -9
- package/dist/utils/jwt/index.js +1 -1
- package/dist/utils/jwt/jws.js +1 -2
- package/dist/utils/jwt/jwt.js +5 -5
- package/dist/utils/url.js +26 -2
- package/package.json +27 -6
- package/dist/cjs/adapter/aws-lambda/awslambda.d.js +0 -1
- package/dist/cjs/helper.js +0 -44
- package/dist/helper.js +0 -18
- /package/dist/{adapter/aws-lambda/awslambda.d.js → helper/conninfo/index.js} +0 -0
|
@@ -25,11 +25,14 @@ export declare const defaultExtensionMap: Record<string, string>;
|
|
|
25
25
|
export type BeforeRequestHook = (req: Request) => Request | false | Promise<Request | false>;
|
|
26
26
|
export type AfterResponseHook = (res: Response) => Response | false | Promise<Response | false>;
|
|
27
27
|
export type AfterGenerateHook = (result: ToSSGResult) => void | Promise<void>;
|
|
28
|
+
export declare const combineBeforeRequestHooks: (hooks: BeforeRequestHook | BeforeRequestHook[]) => BeforeRequestHook;
|
|
29
|
+
export declare const combineAfterResponseHooks: (hooks: AfterResponseHook | AfterResponseHook[]) => AfterResponseHook;
|
|
30
|
+
export declare const combineAfterGenerateHooks: (hooks: AfterGenerateHook | AfterGenerateHook[]) => AfterGenerateHook;
|
|
28
31
|
export interface ToSSGOptions {
|
|
29
32
|
dir?: string;
|
|
30
|
-
beforeRequestHook?: BeforeRequestHook;
|
|
31
|
-
afterResponseHook?: AfterResponseHook;
|
|
32
|
-
afterGenerateHook?: AfterGenerateHook;
|
|
33
|
+
beforeRequestHook?: BeforeRequestHook | BeforeRequestHook[];
|
|
34
|
+
afterResponseHook?: AfterResponseHook | AfterResponseHook[];
|
|
35
|
+
afterGenerateHook?: AfterGenerateHook | AfterGenerateHook[];
|
|
33
36
|
concurrency?: number;
|
|
34
37
|
extensionMap?: Record<string, string>;
|
|
35
38
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* This module is the base module for the Hono object.
|
|
4
|
+
*/
|
|
1
5
|
import { Context } from './context';
|
|
2
6
|
import type { ExecutionContext } from './context';
|
|
3
7
|
import type { Router } from './router';
|
|
4
|
-
import type { Env, ErrorHandler, H, HandlerInterface, MiddlewareHandlerInterface, NotFoundHandler, OnHandlerInterface,
|
|
8
|
+
import type { Env, ErrorHandler, H, HandlerInterface, MergePath, MergeSchemaPath, MiddlewareHandlerInterface, NotFoundHandler, OnHandlerInterface, RouterRoute, Schema } from './types';
|
|
5
9
|
export declare const COMPOSED_HANDLER: unique symbol;
|
|
6
10
|
type GetPath<E extends Env> = (request: Request, options?: {
|
|
7
11
|
env?: E['Bindings'];
|
|
@@ -41,21 +45,17 @@ export type HonoOptions<E extends Env> = {
|
|
|
41
45
|
*/
|
|
42
46
|
getPath?: GetPath<E>;
|
|
43
47
|
};
|
|
44
|
-
declare
|
|
45
|
-
all: HandlerInterface<E_1, "all", S_1, BasePath_1>;
|
|
46
|
-
options: HandlerInterface<E_1, "options", S_1, BasePath_1>;
|
|
47
|
-
get: HandlerInterface<E_1, "get", S_1, BasePath_1>;
|
|
48
|
-
post: HandlerInterface<E_1, "post", S_1, BasePath_1>;
|
|
49
|
-
put: HandlerInterface<E_1, "put", S_1, BasePath_1>;
|
|
50
|
-
delete: HandlerInterface<E_1, "delete", S_1, BasePath_1>;
|
|
51
|
-
patch: HandlerInterface<E_1, "patch", S_1, BasePath_1>;
|
|
52
|
-
} & {
|
|
53
|
-
on: OnHandlerInterface<E_1, S_1, BasePath_1>;
|
|
54
|
-
} & {
|
|
55
|
-
use: MiddlewareHandlerInterface<E_1, S_1, BasePath_1>;
|
|
56
|
-
};
|
|
57
|
-
declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = '/'> extends Hono_base<E, S, BasePath> {
|
|
48
|
+
declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string = '/'> {
|
|
58
49
|
#private;
|
|
50
|
+
get: HandlerInterface<E, 'get', S, BasePath>;
|
|
51
|
+
post: HandlerInterface<E, 'post', S, BasePath>;
|
|
52
|
+
put: HandlerInterface<E, 'put', S, BasePath>;
|
|
53
|
+
delete: HandlerInterface<E, 'delete', S, BasePath>;
|
|
54
|
+
options: HandlerInterface<E, 'options', S, BasePath>;
|
|
55
|
+
patch: HandlerInterface<E, 'patch', S, BasePath>;
|
|
56
|
+
all: HandlerInterface<E, 'all', S, BasePath>;
|
|
57
|
+
on: OnHandlerInterface<E, S, BasePath>;
|
|
58
|
+
use: MiddlewareHandlerInterface<E, S, BasePath>;
|
|
59
59
|
router: Router<[H, RouterRoute]>;
|
|
60
60
|
readonly getPath: GetPath<E>;
|
|
61
61
|
private _basePath;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
*
|
|
4
|
+
* Hono - Web Framework built on Web Standards
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { Hono } from 'hono'
|
|
9
|
+
* const app = new Hono()
|
|
10
|
+
*
|
|
11
|
+
* app.get('/', (c) => c.text('Hono!'))
|
|
12
|
+
*
|
|
13
|
+
* export default app
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
1
16
|
import { Hono } from './hono';
|
|
2
17
|
export type { Env, ErrorHandler, Handler, MiddlewareHandler, Next, NotFoundHandler, ValidationTargets, Input, Schema, ToSchema, TypedResponse, } from './types';
|
|
3
18
|
export type { Context, ContextVariableMap, ContextRenderer, ExecutionContext } from './context';
|
package/dist/types/jsx/base.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HtmlEscaped, HtmlEscapedString, StringBuffer } from '../utils/html';
|
|
2
2
|
import type { Context } from './context';
|
|
3
|
-
import type { IntrinsicElements as IntrinsicElementsDefined } from './intrinsic-elements';
|
|
3
|
+
import type { Hono, IntrinsicElements as IntrinsicElementsDefined } from './intrinsic-elements';
|
|
4
4
|
export type Props = Record<string, any>;
|
|
5
5
|
export type FC<P = Props> = {
|
|
6
6
|
(props: P): HtmlEscapedString | Promise<HtmlEscapedString>;
|
|
@@ -8,15 +8,13 @@ export type FC<P = Props> = {
|
|
|
8
8
|
displayName?: string | undefined;
|
|
9
9
|
};
|
|
10
10
|
export type DOMAttributes = Hono.HTMLAttributes;
|
|
11
|
-
declare
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
[tagName: string]: Props;
|
|
19
|
-
}
|
|
11
|
+
export declare namespace JSX {
|
|
12
|
+
type Element = HtmlEscapedString | Promise<HtmlEscapedString>;
|
|
13
|
+
interface ElementChildrenAttribute {
|
|
14
|
+
children: Child;
|
|
15
|
+
}
|
|
16
|
+
interface IntrinsicElements extends IntrinsicElementsDefined {
|
|
17
|
+
[tagName: string]: Props;
|
|
20
18
|
}
|
|
21
19
|
}
|
|
22
20
|
type LocalContexts = [Context<unknown>, unknown][];
|
|
@@ -46,4 +44,5 @@ export declare const Fragment: ({ children, }: {
|
|
|
46
44
|
}) => HtmlEscapedString;
|
|
47
45
|
export declare const isValidElement: (element: unknown) => element is JSXNode;
|
|
48
46
|
export declare const cloneElement: <T extends JSXNode | JSX.Element>(element: T, props: Partial<Props>, ...children: Child[]) => T;
|
|
47
|
+
export declare const reactAPICompatVersion = "18.0.0-hono-jsx";
|
|
49
48
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HtmlEscapedString } from '../utils/html';
|
|
2
|
-
import type { FC, PropsWithChildren
|
|
2
|
+
import type { Child, FC, PropsWithChildren } from './';
|
|
3
3
|
export declare const childrenToString: (children: Child[]) => Promise<HtmlEscapedString[]>;
|
|
4
4
|
export type ErrorHandler = (error: Error) => void;
|
|
5
5
|
export type FallbackRender = (error: Error) => Child;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* This module provides APIs for `hono/jsx/dom/client`, which is compatible with `react-dom/client`.
|
|
4
|
+
*/
|
|
5
|
+
import type { Child } from '../base';
|
|
6
|
+
export interface Root {
|
|
7
|
+
render(children: Child): void;
|
|
8
|
+
unmount(): void;
|
|
9
|
+
}
|
|
10
|
+
export type RootOptions = Record<string, unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* Create a root object for rendering
|
|
13
|
+
* @param element Render target
|
|
14
|
+
* @param options Options for createRoot (not supported yet)
|
|
15
|
+
* @returns Root object has `render` and `unmount` methods
|
|
16
|
+
*/
|
|
17
|
+
export declare const createRoot: (element: HTMLElement | DocumentFragment, options?: RootOptions) => Root;
|
|
18
|
+
/**
|
|
19
|
+
* Create a root object and hydrate app to the target element.
|
|
20
|
+
* In hono/jsx/dom, hydrate is equivalent to render.
|
|
21
|
+
* @param element Render target
|
|
22
|
+
* @param reactNode A JSXNode to render
|
|
23
|
+
* @param options Options for createRoot (not supported yet)
|
|
24
|
+
* @returns Root object has `render` and `unmount` methods
|
|
25
|
+
*/
|
|
26
|
+
export declare const hydrateRoot: (element: HTMLElement | DocumentFragment, reactNode: Child, options?: RootOptions) => Root;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FC, PropsWithChildren
|
|
2
|
-
import type {
|
|
1
|
+
import type { Child, FC, PropsWithChildren } from '../';
|
|
2
|
+
import type { ErrorHandler, FallbackRender } from '../components';
|
|
3
3
|
export declare const ErrorBoundary: FC<PropsWithChildren<{
|
|
4
4
|
fallback?: Child;
|
|
5
5
|
fallbackRender?: FallbackRender;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* This module provides APIs that enable `hono/jsx/dom` to support.
|
|
4
|
+
*/
|
|
5
|
+
import type { FC, PropsWithChildren } from '../';
|
|
2
6
|
import type { CssClassName, CssVariableType } from '../../helper/css/common';
|
|
3
7
|
export { rawCssString } from '../../helper/css/common';
|
|
4
8
|
interface CreateCssJsxDomObjectsType {
|
|
@@ -12,6 +16,27 @@ interface CreateCssJsxDomObjectsType {
|
|
|
12
16
|
];
|
|
13
17
|
}
|
|
14
18
|
export declare const createCssJsxDomObjects: CreateCssJsxDomObjectsType;
|
|
19
|
+
interface CssType {
|
|
20
|
+
(strings: TemplateStringsArray, ...values: CssVariableType[]): string;
|
|
21
|
+
}
|
|
22
|
+
interface CxType {
|
|
23
|
+
(...args: (string | boolean | null | undefined)[]): string;
|
|
24
|
+
}
|
|
25
|
+
interface KeyframesType {
|
|
26
|
+
(strings: TemplateStringsArray, ...values: CssVariableType[]): CssClassName;
|
|
27
|
+
}
|
|
28
|
+
interface ViewTransitionType {
|
|
29
|
+
(strings: TemplateStringsArray, ...values: CssVariableType[]): string;
|
|
30
|
+
(content: string): string;
|
|
31
|
+
(): string;
|
|
32
|
+
}
|
|
33
|
+
interface DefaultContextType {
|
|
34
|
+
css: CssType;
|
|
35
|
+
cx: CxType;
|
|
36
|
+
keyframes: KeyframesType;
|
|
37
|
+
viewTransition: ViewTransitionType;
|
|
38
|
+
Style: FC<PropsWithChildren<void>>;
|
|
39
|
+
}
|
|
15
40
|
/**
|
|
16
41
|
* @experimental
|
|
17
42
|
* `createCssContext` is an experimental feature.
|
|
@@ -19,45 +44,31 @@ export declare const createCssJsxDomObjects: CreateCssJsxDomObjectsType;
|
|
|
19
44
|
*/
|
|
20
45
|
export declare const createCssContext: ({ id }: {
|
|
21
46
|
id: Readonly<string>;
|
|
22
|
-
}) =>
|
|
23
|
-
css: (strings: TemplateStringsArray, ...values: CssVariableType[]) => string;
|
|
24
|
-
cx: (...args: (string | boolean | null | undefined)[]) => string;
|
|
25
|
-
keyframes: (strings: TemplateStringsArray, ...values: CssVariableType[]) => CssClassName;
|
|
26
|
-
viewTransition: {
|
|
27
|
-
(strings: TemplateStringsArray, ...values: CssVariableType[]): string;
|
|
28
|
-
(content: string): string;
|
|
29
|
-
(): string;
|
|
30
|
-
};
|
|
31
|
-
Style: FC<PropsWithChildren<void>>;
|
|
32
|
-
};
|
|
47
|
+
}) => DefaultContextType;
|
|
33
48
|
/**
|
|
34
49
|
* @experimental
|
|
35
50
|
* `css` is an experimental feature.
|
|
36
51
|
* The API might be changed.
|
|
37
52
|
*/
|
|
38
|
-
export declare const css:
|
|
53
|
+
export declare const css: CssType;
|
|
39
54
|
/**
|
|
40
55
|
* @experimental
|
|
41
56
|
* `cx` is an experimental feature.
|
|
42
57
|
* The API might be changed.
|
|
43
58
|
*/
|
|
44
|
-
export declare const cx:
|
|
59
|
+
export declare const cx: CxType;
|
|
45
60
|
/**
|
|
46
61
|
* @experimental
|
|
47
62
|
* `keyframes` is an experimental feature.
|
|
48
63
|
* The API might be changed.
|
|
49
64
|
*/
|
|
50
|
-
export declare const keyframes:
|
|
65
|
+
export declare const keyframes: KeyframesType;
|
|
51
66
|
/**
|
|
52
67
|
* @experimental
|
|
53
68
|
* `viewTransition` is an experimental feature.
|
|
54
69
|
* The API might be changed.
|
|
55
70
|
*/
|
|
56
|
-
export declare const viewTransition:
|
|
57
|
-
(strings: TemplateStringsArray, ...values: CssVariableType[]): string;
|
|
58
|
-
(content: string): string;
|
|
59
|
-
(): string;
|
|
60
|
-
};
|
|
71
|
+
export declare const viewTransition: ViewTransitionType;
|
|
61
72
|
/**
|
|
62
73
|
* @experimental
|
|
63
74
|
* `Style` is an experimental feature.
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* This module provides APIs for `hono/jsx/dom`.
|
|
4
|
+
*/
|
|
5
|
+
import { isValidElement, memo, reactAPICompatVersion } from '../base';
|
|
6
|
+
import type { Child, DOMAttributes, JSX, JSXNode, Props } from '../base';
|
|
3
7
|
import { Children } from '../children';
|
|
4
8
|
import { useContext } from '../context';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
9
|
+
import { createRef, forwardRef, startTransition, startViewTransition, use, useCallback, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore, useTransition, useViewTransition } from '../hooks';
|
|
10
|
+
import { ErrorBoundary, Suspense } from './components';
|
|
7
11
|
import { createContext } from './context';
|
|
8
12
|
import { Fragment } from './jsx-runtime';
|
|
9
|
-
import {
|
|
13
|
+
import { createPortal, flushSync } from './render';
|
|
10
14
|
export { render } from './render';
|
|
11
15
|
declare const createElement: (tag: string | ((props: Props) => JSXNode), props: Props | null, ...children: Child[]) => JSXNode;
|
|
12
16
|
declare const cloneElement: <T extends JSXNode | JSX.Element>(element: T, props: Props, ...children: Child[]) => T;
|
|
13
|
-
export { createElement as jsx, useState, useEffect, useRef, useCallback, use, startTransition, useTransition, useDeferredValue, startViewTransition, useViewTransition, useMemo, useLayoutEffect, useReducer, useId, useDebugValue, createRef, forwardRef, useImperativeHandle, useSyncExternalStore, Suspense, ErrorBoundary, createContext, useContext, memo, isValidElement, createElement, cloneElement, Children, Fragment, DOMAttributes, flushSync, createPortal, };
|
|
17
|
+
export { reactAPICompatVersion as version, createElement as jsx, useState, useEffect, useRef, useCallback, use, startTransition, useTransition, useDeferredValue, startViewTransition, useViewTransition, useMemo, useLayoutEffect, useInsertionEffect, useReducer, useId, useDebugValue, createRef, forwardRef, useImperativeHandle, useSyncExternalStore, Suspense, ErrorBoundary, createContext, useContext, memo, isValidElement, createElement, cloneElement, Children, Fragment, DOMAttributes, flushSync, createPortal, };
|
|
14
18
|
declare const _default: {
|
|
19
|
+
version: string;
|
|
15
20
|
useState: {
|
|
16
21
|
<T>(initialState: T | (() => T)): [T, (newState: T | ((currentState: T) => T)) => void];
|
|
17
22
|
<T_1 = undefined>(): [T_1 | undefined, (newState: T_1 | ((currentState: T_1 | undefined) => T_1 | undefined) | undefined) => void];
|
|
@@ -27,6 +32,7 @@ declare const _default: {
|
|
|
27
32
|
useViewTransition: () => [boolean, (callback: () => void) => void];
|
|
28
33
|
useMemo: <T_6>(factory: () => T_6, deps: readonly unknown[]) => T_6;
|
|
29
34
|
useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[] | undefined) => void;
|
|
35
|
+
useInsertionEffect: (effect: () => void | (() => void), deps?: readonly unknown[] | undefined) => void;
|
|
30
36
|
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];
|
|
31
37
|
useId: () => string;
|
|
32
38
|
useDebugValue: (_value: unknown, _formatter?: ((value: unknown) => string) | undefined) => void;
|
|
@@ -63,4 +69,4 @@ declare const _default: {
|
|
|
63
69
|
};
|
|
64
70
|
export default _default;
|
|
65
71
|
export type { Context } from '../context';
|
|
66
|
-
export * from '../types';
|
|
72
|
+
export type * from '../types';
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* This module provides the `hono/jsx/dom` dev runtime.
|
|
4
|
+
*/
|
|
5
|
+
import type { JSXNode, Props } from '../base';
|
|
2
6
|
export declare const jsxDEV: (tag: string | Function, props: Props, key?: string) => JSXNode;
|
|
3
7
|
export declare const Fragment: (props: Record<string, unknown>) => JSXNode;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { JSXNode } from '../base';
|
|
2
|
-
import type { FC, Child, Props } from '../base';
|
|
1
|
+
import type { Child, FC, JSXNode, Props } from '../base';
|
|
3
2
|
import { DOM_RENDERER, DOM_STASH } from '../constants';
|
|
4
3
|
import type { Context as JSXContext } from '../context';
|
|
5
4
|
export type HasRenderToDom = FC<any> & {
|
|
@@ -49,8 +48,10 @@ export type Context = [
|
|
|
49
48
|
] | [PendingType, boolean, UpdateHook, boolean] | [PendingType, boolean, UpdateHook] | [PendingType, boolean] | [PendingType] | [];
|
|
50
49
|
export declare const buildDataStack: [Context, Node][];
|
|
51
50
|
export declare const build: (context: Context, node: NodeObject, topLevelErrorHandlerNode: NodeObject | undefined, children?: Child[]) => void;
|
|
51
|
+
export declare const buildNode: (node: Child) => Node | undefined;
|
|
52
52
|
export declare const update: (context: Context, node: NodeObject) => Promise<NodeObject | undefined>;
|
|
53
|
-
export declare const
|
|
53
|
+
export declare const renderNode: (node: NodeObject, container: Container) => void;
|
|
54
|
+
export declare const render: (jsxNode: Child, container: Container) => void;
|
|
54
55
|
export declare const flushSync: (callback: () => void) => void;
|
|
55
56
|
export declare const createPortal: (children: Child, container: HTMLElement, key?: string) => Child;
|
|
56
57
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { JSX } from '../base';
|
|
1
2
|
type UpdateStateFunction<T> = (newState: T | ((currentState: T) => T)) => void;
|
|
2
3
|
export declare const STASH_EFFECT = 1;
|
|
3
4
|
export type EffectData = [
|
|
@@ -7,6 +8,8 @@ export type EffectData = [
|
|
|
7
8
|
// layout effect
|
|
8
9
|
(() => void) | undefined,
|
|
9
10
|
// cleanup
|
|
11
|
+
(() => void) | undefined,
|
|
12
|
+
// effect
|
|
10
13
|
(() => void) | undefined
|
|
11
14
|
];
|
|
12
15
|
export declare const startViewTransition: (callback: () => void) => void;
|
|
@@ -22,6 +25,7 @@ export declare const useState: UseStateType;
|
|
|
22
25
|
export declare const useReducer: <T, A>(reducer: (state: T, action: A) => T, initialArg: T, init?: ((initialState: T) => T) | undefined) => [T, (action: A) => void];
|
|
23
26
|
export declare const useEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
|
|
24
27
|
export declare const useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
|
|
28
|
+
export declare const useInsertionEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
|
|
25
29
|
export declare const useCallback: <T extends (...args: unknown[]) => unknown>(callback: T, deps: readonly unknown[]) => T;
|
|
26
30
|
export type RefObject<T> = {
|
|
27
31
|
current: T | null;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* JSX for Hono.
|
|
4
|
+
*/
|
|
5
|
+
import { Fragment, cloneElement, isValidElement, jsx, memo, reactAPICompatVersion } from './base';
|
|
2
6
|
import type { DOMAttributes } from './base';
|
|
3
7
|
import { Children } from './children';
|
|
4
8
|
import { ErrorBoundary } from './components';
|
|
5
9
|
import { createContext, useContext } from './context';
|
|
6
|
-
import {
|
|
10
|
+
import { createRef, forwardRef, startTransition, startViewTransition, use, useCallback, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore, useTransition, useViewTransition } from './hooks';
|
|
7
11
|
import { Suspense } from './streaming';
|
|
8
|
-
export { jsx, memo, Fragment, isValidElement, jsx as createElement, cloneElement, ErrorBoundary, createContext, useContext, useState, useEffect, useRef, useCallback, useReducer, useId, useDebugValue, use, startTransition, useTransition, useDeferredValue, startViewTransition, useViewTransition, useMemo, useLayoutEffect, createRef, forwardRef, useImperativeHandle, useSyncExternalStore, Suspense, Children, DOMAttributes, };
|
|
12
|
+
export { reactAPICompatVersion as version, jsx, memo, Fragment, isValidElement, jsx as createElement, cloneElement, ErrorBoundary, createContext, useContext, useState, useEffect, useRef, useCallback, useReducer, useId, useDebugValue, use, startTransition, useTransition, useDeferredValue, startViewTransition, useViewTransition, useMemo, useLayoutEffect, useInsertionEffect, createRef, forwardRef, useImperativeHandle, useSyncExternalStore, Suspense, Children, DOMAttributes, };
|
|
9
13
|
declare const _default: {
|
|
14
|
+
version: string;
|
|
10
15
|
memo: <T>(component: import("./base").FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean) => import("./base").FC<T>;
|
|
11
16
|
Fragment: ({ children, }: {
|
|
12
17
|
key?: string | undefined;
|
|
@@ -14,7 +19,7 @@ declare const _default: {
|
|
|
14
19
|
}) => import("../utils/html").HtmlEscapedString;
|
|
15
20
|
isValidElement: (element: unknown) => element is import("./base").JSXNode;
|
|
16
21
|
createElement: (tag: string | Function, props: import("./base").Props | null, ...children: (string | number | import("../utils/html").HtmlEscapedString)[]) => import("./base").JSXNode;
|
|
17
|
-
cloneElement: <T_1 extends import("./base").JSXNode | JSX.Element>(element: T_1, props: Partial<import("./base").Props>, ...children: import("./base").Child[]) => T_1;
|
|
22
|
+
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;
|
|
18
23
|
ErrorBoundary: import("./base").FC<import("./types").PropsWithChildren<{
|
|
19
24
|
fallback?: import("./base").Child;
|
|
20
25
|
fallbackRender?: import("./components").FallbackRender | undefined;
|
|
@@ -40,10 +45,11 @@ declare const _default: {
|
|
|
40
45
|
useViewTransition: () => [boolean, (callback: () => void) => void];
|
|
41
46
|
useMemo: <T_11>(factory: () => T_11, deps: readonly unknown[]) => T_11;
|
|
42
47
|
useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[] | undefined) => void;
|
|
48
|
+
useInsertionEffect: (effect: () => void | (() => void), deps?: readonly unknown[] | undefined) => void;
|
|
43
49
|
createRef: <T_12>() => import("./hooks").RefObject<T_12>;
|
|
44
|
-
forwardRef: <T_13, P = {}>(Component: (props: P, ref?: import("./hooks").RefObject<T_13> | undefined) => JSX.Element) => (props: P & {
|
|
50
|
+
forwardRef: <T_13, P = {}>(Component: (props: P, ref?: import("./hooks").RefObject<T_13> | undefined) => import("./base").JSX.Element) => (props: P & {
|
|
45
51
|
ref?: import("./hooks").RefObject<T_13> | undefined;
|
|
46
|
-
}) => JSX.Element;
|
|
52
|
+
}) => import("./base").JSX.Element;
|
|
47
53
|
useImperativeHandle: <T_14>(ref: import("./hooks").RefObject<T_14>, createHandle: () => T_14, deps: readonly unknown[]) => void;
|
|
48
54
|
useSyncExternalStore: <T_15>(subscribe: (callback: (value: T_15) => void) => () => void, getSnapshot: () => T_15, getServerSnapshot?: (() => T_15) | undefined) => T_15;
|
|
49
55
|
Suspense: import("./base").FC<import("./types").PropsWithChildren<{
|
|
@@ -58,4 +64,4 @@ declare const _default: {
|
|
|
58
64
|
};
|
|
59
65
|
};
|
|
60
66
|
export default _default;
|
|
61
|
-
export * from './types';
|
|
67
|
+
export type * from './types';
|