hono 4.6.1 → 4.6.3
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/bun/serve-static.js +3 -3
- package/dist/adapter/deno/serve-static.js +1 -1
- package/dist/cjs/adapter/bun/serve-static.js +3 -3
- package/dist/cjs/adapter/deno/serve-static.js +1 -1
- package/dist/cjs/helper/ssg/middleware.js +1 -1
- package/dist/cjs/helper/streaming/sse.js +1 -1
- package/dist/cjs/jsx/base.js +5 -3
- package/dist/cjs/jsx/dom/hooks/index.js +2 -2
- package/dist/cjs/jsx/dom/index.js +1 -1
- package/dist/cjs/jsx/dom/intrinsic-element/components.js +2 -2
- package/dist/cjs/jsx/dom/render.js +1 -1
- package/dist/cjs/jsx/index.js +46 -46
- package/dist/cjs/jsx/intrinsic-element/components.js +3 -3
- package/dist/cjs/jsx/jsx-runtime.js +28 -1
- package/dist/cjs/jsx/streaming.js +7 -4
- package/dist/cjs/middleware/combine/index.js +3 -2
- package/dist/cjs/middleware/compress/index.js +2 -2
- package/dist/cjs/middleware/secure-headers/secure-headers.js +8 -1
- package/dist/cjs/middleware/serve-static/index.js +25 -12
- package/dist/cjs/router/pattern-router/router.js +1 -1
- package/dist/cjs/utils/compress.js +28 -0
- package/dist/cjs/utils/cookie.js +1 -1
- package/dist/cjs/utils/filepath.js +3 -0
- package/dist/cjs/utils/jwt/jwt.js +1 -1
- package/dist/cjs/utils/stream.js +2 -2
- package/dist/helper/ssg/middleware.js +1 -1
- package/dist/helper/streaming/sse.js +1 -1
- package/dist/jsx/base.js +4 -3
- package/dist/jsx/dom/hooks/index.js +2 -2
- package/dist/jsx/dom/index.js +1 -1
- package/dist/jsx/dom/intrinsic-element/components.js +2 -2
- package/dist/jsx/dom/render.js +1 -1
- package/dist/jsx/index.js +1 -1
- package/dist/jsx/intrinsic-element/components.js +3 -3
- package/dist/jsx/jsx-runtime.js +28 -1
- package/dist/jsx/streaming.js +7 -4
- package/dist/middleware/combine/index.js +3 -2
- package/dist/middleware/compress/index.js +2 -2
- package/dist/middleware/secure-headers/secure-headers.js +8 -1
- package/dist/middleware/serve-static/index.js +25 -12
- package/dist/router/pattern-router/router.js +1 -1
- package/dist/types/context.d.ts +1 -1
- package/dist/types/jsx/base.d.ts +1 -0
- package/dist/types/jsx/dom/index.d.ts +2 -2
- package/dist/types/jsx/dom/intrinsic-element/components.d.ts +1 -1
- package/dist/types/jsx/dom/server.d.ts +1 -1
- package/dist/types/jsx/hooks/index.d.ts +1 -1
- package/dist/types/jsx/index.d.ts +2 -2
- package/dist/types/jsx/intrinsic-element/components.d.ts +1 -1
- package/dist/types/jsx/jsx-runtime.d.ts +1 -1
- package/dist/types/jsx/streaming.d.ts +2 -1
- package/dist/types/middleware/jwt/jwt.d.ts +2 -2
- package/dist/types/middleware/secure-headers/secure-headers.d.ts +2 -0
- package/dist/types/types.d.ts +23 -23
- package/dist/types/utils/compress.d.ts +8 -0
- package/dist/types/utils/types.d.ts +3 -1
- package/dist/utils/compress.js +5 -0
- package/dist/utils/cookie.js +1 -1
- package/dist/utils/filepath.js +3 -0
- package/dist/utils/jwt/jwt.js +1 -1
- package/dist/utils/stream.js +2 -2
- package/package.json +15 -15
- package/perf-measures/type-check/generated/.gitkeep +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/jsx/dom/hooks/index.ts
|
|
2
|
+
import { PERMALINK } from "../../constants.js";
|
|
2
3
|
import { useContext } from "../../context.js";
|
|
3
|
-
import { createContext } from "../context.js";
|
|
4
4
|
import { useCallback, useState } from "../../hooks/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { createContext } from "../context.js";
|
|
6
6
|
var FormContext = createContext({
|
|
7
7
|
pending: false,
|
|
8
8
|
data: null,
|
package/dist/jsx/dom/index.js
CHANGED
|
@@ -24,9 +24,9 @@ import {
|
|
|
24
24
|
useTransition,
|
|
25
25
|
useViewTransition
|
|
26
26
|
} from "../hooks/index.js";
|
|
27
|
-
import { useActionState, useFormStatus, useOptimistic } from "./hooks/index.js";
|
|
28
27
|
import { ErrorBoundary, Suspense } from "./components.js";
|
|
29
28
|
import { createContext } from "./context.js";
|
|
29
|
+
import { useActionState, useFormStatus, useOptimistic } from "./hooks/index.js";
|
|
30
30
|
import { Fragment, jsx } from "./jsx-runtime.js";
|
|
31
31
|
import { createPortal, flushSync } from "./render.js";
|
|
32
32
|
import { render } from "./render.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// src/jsx/dom/intrinsic-element/components.ts
|
|
2
|
-
import { createPortal, getNameSpaceContext } from "../render.js";
|
|
3
2
|
import { useContext } from "../../context.js";
|
|
4
3
|
import { use, useCallback, useMemo, useState } from "../../hooks/index.js";
|
|
5
|
-
import { FormContext, registerAction } from "../hooks/index.js";
|
|
6
4
|
import { dataPrecedenceAttr, deDupeKeyMap, domRenderers } from "../../intrinsic-element/common.js";
|
|
5
|
+
import { FormContext, registerAction } from "../hooks/index.js";
|
|
6
|
+
import { createPortal, getNameSpaceContext } from "../render.js";
|
|
7
7
|
var clearCache = () => {
|
|
8
8
|
blockingPromiseMap = /* @__PURE__ */ Object.create(null);
|
|
9
9
|
createdElements = /* @__PURE__ */ Object.create(null);
|
package/dist/jsx/dom/render.js
CHANGED
package/dist/jsx/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Fragment, cloneElement, isValidElement, jsx, memo, reactAPICompatVersio
|
|
|
3
3
|
import { Children } from "./children.js";
|
|
4
4
|
import { ErrorBoundary } from "./components.js";
|
|
5
5
|
import { createContext, useContext } from "./context.js";
|
|
6
|
+
import { useActionState, useOptimistic } from "./dom/hooks/index.js";
|
|
6
7
|
import {
|
|
7
8
|
createRef,
|
|
8
9
|
forwardRef,
|
|
@@ -25,7 +26,6 @@ import {
|
|
|
25
26
|
useTransition,
|
|
26
27
|
useViewTransition
|
|
27
28
|
} from "./hooks/index.js";
|
|
28
|
-
import { useActionState, useOptimistic } from "./dom/hooks/index.js";
|
|
29
29
|
import { Suspense } from "./streaming.js";
|
|
30
30
|
var jsx_default = {
|
|
31
31
|
version: reactAPICompatVersion,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// src/jsx/intrinsic-element/components.ts
|
|
2
|
+
import { raw } from "../../helper/html/index.js";
|
|
2
3
|
import { JSXNode, getNameSpaceContext } from "../base.js";
|
|
4
|
+
import { toArray } from "../children.js";
|
|
5
|
+
import { PERMALINK } from "../constants.js";
|
|
3
6
|
import { useContext } from "../context.js";
|
|
4
|
-
import { raw } from "../../helper/html/index.js";
|
|
5
7
|
import { dataPrecedenceAttr, deDupeKeyMap } from "./common.js";
|
|
6
|
-
import { PERMALINK } from "../constants.js";
|
|
7
|
-
import { toArray } from "../children.js";
|
|
8
8
|
var metaTagMap = /* @__PURE__ */ new WeakMap();
|
|
9
9
|
var insertIntoHead = (tagName, tag, props, precedence) => ({ buffer, context }) => {
|
|
10
10
|
if (!buffer) {
|
package/dist/jsx/jsx-runtime.js
CHANGED
|
@@ -2,7 +2,34 @@
|
|
|
2
2
|
import { jsxDEV, Fragment } from "./jsx-dev-runtime.js";
|
|
3
3
|
import { jsxDEV as jsxDEV2 } from "./jsx-dev-runtime.js";
|
|
4
4
|
import { html, raw } from "../helper/html/index.js";
|
|
5
|
-
|
|
5
|
+
import { escapeToBuffer, stringBufferToString } from "../utils/html.js";
|
|
6
|
+
import { styleObjectForEach } from "./utils.js";
|
|
7
|
+
var jsxAttr = (key, v) => {
|
|
8
|
+
const buffer = [`${key}="`];
|
|
9
|
+
if (key === "style" && typeof v === "object") {
|
|
10
|
+
let styleStr = "";
|
|
11
|
+
styleObjectForEach(v, (property, value) => {
|
|
12
|
+
if (value != null) {
|
|
13
|
+
styleStr += `${styleStr ? ";" : ""}${property}:${value}`;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
escapeToBuffer(styleStr, buffer);
|
|
17
|
+
buffer[0] += '"';
|
|
18
|
+
} else if (typeof v === "string") {
|
|
19
|
+
escapeToBuffer(v, buffer);
|
|
20
|
+
buffer[0] += '"';
|
|
21
|
+
} else if (v === null || v === void 0) {
|
|
22
|
+
return raw("");
|
|
23
|
+
} else if (typeof v === "number" || v.isEscaped) {
|
|
24
|
+
buffer[0] += `${v}"`;
|
|
25
|
+
} else if (v instanceof Promise) {
|
|
26
|
+
buffer.unshift('"', v);
|
|
27
|
+
} else {
|
|
28
|
+
escapeToBuffer(v.toString(), buffer);
|
|
29
|
+
buffer[0] += '"';
|
|
30
|
+
}
|
|
31
|
+
return buffer.length === 1 ? raw(buffer[0]) : stringBufferToString(buffer, void 0);
|
|
32
|
+
};
|
|
6
33
|
var jsxEscape = (value) => value;
|
|
7
34
|
export {
|
|
8
35
|
Fragment,
|
package/dist/jsx/streaming.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/jsx/streaming.ts
|
|
2
2
|
import { raw } from "../helper/html/index.js";
|
|
3
3
|
import { HtmlEscapedCallbackPhase, resolveCallback } from "../utils/html.js";
|
|
4
|
+
import { JSXNode } from "./base.js";
|
|
4
5
|
import { childrenToString } from "./components.js";
|
|
5
6
|
import { DOM_RENDERER, DOM_STASH } from "./constants.js";
|
|
6
7
|
import { Suspense as SuspenseDomRenderer } from "./dom/components.js";
|
|
@@ -87,14 +88,16 @@ d.replaceWith(c.content)
|
|
|
87
88
|
};
|
|
88
89
|
Suspense[DOM_RENDERER] = SuspenseDomRenderer;
|
|
89
90
|
var textEncoder = new TextEncoder();
|
|
90
|
-
var renderToReadableStream = (
|
|
91
|
+
var renderToReadableStream = (content, onError = console.trace) => {
|
|
91
92
|
const reader = new ReadableStream({
|
|
92
93
|
async start(controller) {
|
|
93
94
|
try {
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
if (content instanceof JSXNode) {
|
|
96
|
+
content = content.toString();
|
|
97
|
+
}
|
|
98
|
+
const context = typeof content === "object" ? content : {};
|
|
96
99
|
const resolved = await resolveCallback(
|
|
97
|
-
|
|
100
|
+
content,
|
|
98
101
|
HtmlEscapedCallbackPhase.BeforeStream,
|
|
99
102
|
true,
|
|
100
103
|
context
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/middleware/combine/index.ts
|
|
2
|
-
import { TrieRouter } from "../../router/trie-router/index.js";
|
|
3
|
-
import { METHOD_NAME_ALL } from "../../router.js";
|
|
4
2
|
import { compose } from "../../compose.js";
|
|
3
|
+
import { METHOD_NAME_ALL } from "../../router.js";
|
|
4
|
+
import { TrieRouter } from "../../router/trie-router/index.js";
|
|
5
5
|
var some = (...middleware) => {
|
|
6
6
|
return async function some2(c, next) {
|
|
7
7
|
let lastError;
|
|
@@ -32,6 +32,7 @@ var every = (...middleware) => {
|
|
|
32
32
|
if (res === false) {
|
|
33
33
|
throw new Error("Unmet condition");
|
|
34
34
|
}
|
|
35
|
+
return res;
|
|
35
36
|
});
|
|
36
37
|
const handler = async (c, next) => compose(wrappedMiddleware.map((m) => [[m, void 0], c.req.param()]))(c, next);
|
|
37
38
|
return async function every2(c, next) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/middleware/compress/index.ts
|
|
2
|
+
import { COMPRESSIBLE_CONTENT_TYPE_REGEX } from "../../utils/compress.js";
|
|
2
3
|
var ENCODING_TYPES = ["gzip", "deflate"];
|
|
3
4
|
var cacheControlNoTransformRegExp = /(?:^|,)\s*?no-transform\s*?(?:,|$)/i;
|
|
4
|
-
var compressibleContentTypeRegExp = /^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i;
|
|
5
5
|
var compress = (options) => {
|
|
6
6
|
const threshold = options?.threshold ?? 1024;
|
|
7
7
|
return async function compress2(ctx, next) {
|
|
@@ -23,7 +23,7 @@ var compress = (options) => {
|
|
|
23
23
|
};
|
|
24
24
|
var shouldCompress = (res) => {
|
|
25
25
|
const type = res.headers.get("Content-Type");
|
|
26
|
-
return type &&
|
|
26
|
+
return type && COMPRESSIBLE_CONTENT_TYPE_REGEX.test(type);
|
|
27
27
|
};
|
|
28
28
|
var shouldTransform = (res) => {
|
|
29
29
|
const cacheControl = res.headers.get("Cache-Control");
|
|
@@ -54,6 +54,13 @@ var secureHeaders = (customOptions) => {
|
|
|
54
54
|
}
|
|
55
55
|
headersToSet.push(["Content-Security-Policy", value]);
|
|
56
56
|
}
|
|
57
|
+
if (options.contentSecurityPolicyReportOnly) {
|
|
58
|
+
const [callback, value] = getCSPDirectives(options.contentSecurityPolicyReportOnly);
|
|
59
|
+
if (callback) {
|
|
60
|
+
callbacks.push(callback);
|
|
61
|
+
}
|
|
62
|
+
headersToSet.push(["Content-Security-Policy-Report-Only", value]);
|
|
63
|
+
}
|
|
57
64
|
if (options.permissionsPolicy && Object.keys(options.permissionsPolicy).length > 0) {
|
|
58
65
|
headersToSet.push([
|
|
59
66
|
"Permissions-Policy",
|
|
@@ -106,7 +113,7 @@ function getCSPDirectives(contentSecurityPolicy) {
|
|
|
106
113
|
resultValues.pop();
|
|
107
114
|
return callbacks.length === 0 ? [void 0, resultValues.join("")] : [
|
|
108
115
|
(ctx, headersToSet) => headersToSet.map((values) => {
|
|
109
|
-
if (values[0] === "Content-Security-Policy") {
|
|
116
|
+
if (values[0] === "Content-Security-Policy" || values[0] === "Content-Security-Policy-Report-Only") {
|
|
110
117
|
const clone = values[1].slice();
|
|
111
118
|
callbacks.forEach((cb) => {
|
|
112
119
|
cb(ctx, clone);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/middleware/serve-static/index.ts
|
|
2
|
+
import { COMPRESSIBLE_CONTENT_TYPE_REGEX } from "../../utils/compress.js";
|
|
2
3
|
import { getFilePath, getFilePathWithoutDefaultDocument } from "../../utils/filepath.js";
|
|
3
4
|
import { getMimeType } from "../../utils/mime.js";
|
|
4
5
|
var ENCODINGS = {
|
|
@@ -6,9 +7,20 @@ var ENCODINGS = {
|
|
|
6
7
|
zstd: ".zst",
|
|
7
8
|
gzip: ".gz"
|
|
8
9
|
};
|
|
10
|
+
var ENCODINGS_ORDERED_KEYS = Object.keys(ENCODINGS);
|
|
9
11
|
var DEFAULT_DOCUMENT = "index.html";
|
|
10
12
|
var defaultPathResolve = (path) => path;
|
|
11
13
|
var serveStatic = (options) => {
|
|
14
|
+
let isAbsoluteRoot = false;
|
|
15
|
+
let root;
|
|
16
|
+
if (options.root) {
|
|
17
|
+
if (options.root.startsWith("/")) {
|
|
18
|
+
isAbsoluteRoot = true;
|
|
19
|
+
root = new URL(`file://${options.root}`).pathname;
|
|
20
|
+
} else {
|
|
21
|
+
root = options.root;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
12
24
|
return async (c, next) => {
|
|
13
25
|
if (c.finalized) {
|
|
14
26
|
await next();
|
|
@@ -16,7 +28,6 @@ var serveStatic = (options) => {
|
|
|
16
28
|
}
|
|
17
29
|
let filename = options.path ?? decodeURI(c.req.path);
|
|
18
30
|
filename = options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename;
|
|
19
|
-
const root = options.root;
|
|
20
31
|
if (!filename.endsWith("/") && options.isDir) {
|
|
21
32
|
const path2 = getFilePathWithoutDefaultDocument({
|
|
22
33
|
filename,
|
|
@@ -34,6 +45,9 @@ var serveStatic = (options) => {
|
|
|
34
45
|
if (!path) {
|
|
35
46
|
return await next();
|
|
36
47
|
}
|
|
48
|
+
if (isAbsoluteRoot) {
|
|
49
|
+
path = "/" + path;
|
|
50
|
+
}
|
|
37
51
|
const getContent = options.getContent;
|
|
38
52
|
const pathResolve = options.pathResolve ?? defaultPathResolve;
|
|
39
53
|
path = pathResolve(path);
|
|
@@ -57,18 +71,17 @@ var serveStatic = (options) => {
|
|
|
57
71
|
if (content instanceof Response) {
|
|
58
72
|
return c.newResponse(content.body, content);
|
|
59
73
|
}
|
|
60
|
-
const mimeType = options.mimes ? getMimeType(path, options.mimes) ?? getMimeType(path) : getMimeType(path);
|
|
61
|
-
if (mimeType) {
|
|
62
|
-
c.header("Content-Type", mimeType);
|
|
63
|
-
}
|
|
64
74
|
if (content) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
(
|
|
70
|
-
)
|
|
71
|
-
for (const encoding of
|
|
75
|
+
const mimeType = options.mimes && getMimeType(path, options.mimes) || getMimeType(path);
|
|
76
|
+
c.header("Content-Type", mimeType || "application/octet-stream");
|
|
77
|
+
if (options.precompressed && (!mimeType || COMPRESSIBLE_CONTENT_TYPE_REGEX.test(mimeType))) {
|
|
78
|
+
const acceptEncodingSet = new Set(
|
|
79
|
+
c.req.header("Accept-Encoding")?.split(",").map((encoding) => encoding.trim())
|
|
80
|
+
);
|
|
81
|
+
for (const encoding of ENCODINGS_ORDERED_KEYS) {
|
|
82
|
+
if (!acceptEncodingSet.has(encoding)) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
72
85
|
const compressedContent = await getContent(path + ENCODINGS[encoding], c);
|
|
73
86
|
if (compressedContent) {
|
|
74
87
|
content = compressedContent;
|
package/dist/types/context.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { HonoRequest } from './request';
|
|
|
2
2
|
import type { Result } from './router';
|
|
3
3
|
import type { Env, FetchEventLike, H, Input, NotFoundHandler, RouterRoute, TypedResponse } from './types';
|
|
4
4
|
import type { RedirectStatusCode, StatusCode } from './utils/http-status';
|
|
5
|
-
import type { InvalidJSONValue, IsAny, JSONParsed, JSONValue, SimplifyDeepArray } from './utils/types';
|
|
6
5
|
import type { BaseMime } from './utils/mime';
|
|
6
|
+
import type { InvalidJSONValue, IsAny, JSONParsed, JSONValue, SimplifyDeepArray } from './utils/types';
|
|
7
7
|
type HeaderRecord = Record<'Content-Type', BaseMime> | Record<ResponseHeader, string | string[]> | Record<string, string | string[]>;
|
|
8
8
|
/**
|
|
9
9
|
* Data type can be a string, ArrayBuffer, or ReadableStream.
|
package/dist/types/jsx/base.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export declare namespace JSX {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
export declare const getNameSpaceContext: () => Context<string> | undefined;
|
|
21
|
+
export declare const booleanAttributes: string[];
|
|
21
22
|
type LocalContexts = [Context<unknown>, unknown][];
|
|
22
23
|
export type Child = string | Promise<string> | number | JSXNode | null | undefined | boolean | Child[];
|
|
23
24
|
export declare class JSXNode implements HtmlEscaped {
|
|
@@ -7,9 +7,9 @@ import type { Child, DOMAttributes, JSX, JSXNode, Props } from '../base';
|
|
|
7
7
|
import { Children } from '../children';
|
|
8
8
|
import { useContext } from '../context';
|
|
9
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 { useActionState, useFormStatus, useOptimistic } from './hooks';
|
|
11
10
|
import { ErrorBoundary, Suspense } from './components';
|
|
12
11
|
import { createContext } from './context';
|
|
12
|
+
import { useActionState, useFormStatus, useOptimistic } from './hooks';
|
|
13
13
|
import { Fragment } from './jsx-runtime';
|
|
14
14
|
import { createPortal, flushSync } from './render';
|
|
15
15
|
export { render } from './render';
|
|
@@ -42,7 +42,7 @@ declare const _default: {
|
|
|
42
42
|
ref?: import("../hooks").RefObject<T_9> | undefined;
|
|
43
43
|
}) => JSX.Element;
|
|
44
44
|
useImperativeHandle: <T_10>(ref: import("../hooks").RefObject<T_10>, createHandle: () => T_10, deps: readonly unknown[]) => void;
|
|
45
|
-
useSyncExternalStore: <T_11>(subscribe: (callback: (
|
|
45
|
+
useSyncExternalStore: <T_11>(subscribe: (callback: () => void) => () => void, getSnapshot: () => T_11, getServerSnapshot?: (() => T_11) | undefined) => T_11;
|
|
46
46
|
useFormStatus: () => {
|
|
47
47
|
pending: false;
|
|
48
48
|
data: null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FC, PropsWithChildren, RefObject } from '../../types';
|
|
2
1
|
import type { IntrinsicElements } from '../../intrinsic-elements';
|
|
2
|
+
import type { FC, PropsWithChildren, RefObject } from '../../types';
|
|
3
3
|
export declare const clearCache: () => void;
|
|
4
4
|
export declare const composeRef: <T>(ref: Function | RefObject<T> | undefined, cb: (e: T) => void | (() => void)) => (e: T) => () => void;
|
|
5
5
|
export declare const title: FC<PropsWithChildren>;
|
|
@@ -62,7 +62,7 @@ declare const _default: {
|
|
|
62
62
|
ref?: import("./").RefObject<T_9> | undefined;
|
|
63
63
|
}) => import("../base").JSX.Element;
|
|
64
64
|
useImperativeHandle: <T_10>(ref: import("./").RefObject<T_10>, createHandle: () => T_10, deps: readonly unknown[]) => void;
|
|
65
|
-
useSyncExternalStore: <T_11>(subscribe: (callback: (
|
|
65
|
+
useSyncExternalStore: <T_11>(subscribe: (callback: () => void) => () => void, getSnapshot: () => T_11, getServerSnapshot?: (() => T_11) | undefined) => T_11;
|
|
66
66
|
useFormStatus: () => {
|
|
67
67
|
pending: false;
|
|
68
68
|
data: null;
|
|
@@ -41,5 +41,5 @@ export declare const forwardRef: <T, P = {}>(Component: (props: P, ref?: RefObje
|
|
|
41
41
|
ref?: RefObject<T> | undefined;
|
|
42
42
|
}) => JSX.Element;
|
|
43
43
|
export declare const useImperativeHandle: <T>(ref: RefObject<T>, createHandle: () => T, deps: readonly unknown[]) => void;
|
|
44
|
-
export declare const useSyncExternalStore: <T>(subscribe: (callback: (
|
|
44
|
+
export declare const useSyncExternalStore: <T>(subscribe: (callback: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: (() => T) | undefined) => T;
|
|
45
45
|
export {};
|
|
@@ -7,8 +7,8 @@ import type { DOMAttributes } from './base';
|
|
|
7
7
|
import { Children } from './children';
|
|
8
8
|
import { ErrorBoundary } from './components';
|
|
9
9
|
import { createContext, useContext } from './context';
|
|
10
|
-
import { createRef, forwardRef, startTransition, startViewTransition, use, useCallback, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore, useTransition, useViewTransition } from './hooks';
|
|
11
10
|
import { useActionState, useOptimistic } from './dom/hooks';
|
|
11
|
+
import { createRef, forwardRef, startTransition, startViewTransition, use, useCallback, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore, useTransition, useViewTransition } from './hooks';
|
|
12
12
|
import { Suspense } from './streaming';
|
|
13
13
|
export { reactAPICompatVersion as version, jsx, memo, Fragment, Fragment as StrictMode, 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, useActionState, useOptimistic, Suspense, Children, DOMAttributes, };
|
|
14
14
|
declare const _default: {
|
|
@@ -56,7 +56,7 @@ declare const _default: {
|
|
|
56
56
|
ref?: import("./hooks").RefObject<T_13> | undefined;
|
|
57
57
|
}) => import("./base").JSX.Element;
|
|
58
58
|
useImperativeHandle: <T_14>(ref: import("./hooks").RefObject<T_14>, createHandle: () => T_14, deps: readonly unknown[]) => void;
|
|
59
|
-
useSyncExternalStore: <T_15>(subscribe: (callback: (
|
|
59
|
+
useSyncExternalStore: <T_15>(subscribe: (callback: () => void) => () => void, getSnapshot: () => T_15, getServerSnapshot?: (() => T_15) | undefined) => T_15;
|
|
60
60
|
useActionState: <T_16>(fn: Function, initialState: T_16, permalink?: string | undefined) => [T_16, Function];
|
|
61
61
|
useOptimistic: <T_17, N>(state: T_17, updateState: (currentState: T_17, action: N) => T_17) => [T_17, (action: N) => void];
|
|
62
62
|
Suspense: import("./base").FC<import("./types").PropsWithChildren<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FC, PropsWithChildren } from '../types';
|
|
2
1
|
import type { IntrinsicElements } from '../intrinsic-elements';
|
|
2
|
+
import type { FC, PropsWithChildren } from '../types';
|
|
3
3
|
export declare const title: FC<PropsWithChildren>;
|
|
4
4
|
export declare const script: FC<PropsWithChildren<IntrinsicElements['script']>>;
|
|
5
5
|
export declare const style: FC<PropsWithChildren<IntrinsicElements['style']>>;
|
|
@@ -8,5 +8,5 @@ export type { JSX } from './jsx-dev-runtime';
|
|
|
8
8
|
import { html } from '../helper/html';
|
|
9
9
|
import type { HtmlEscapedString } from '../utils/html';
|
|
10
10
|
export { html as jsxTemplate };
|
|
11
|
-
export declare const jsxAttr: (
|
|
11
|
+
export declare const jsxAttr: (key: string, v: string | Promise<string> | Record<string, string | number | null | undefined | boolean>) => HtmlEscapedString | Promise<HtmlEscapedString>;
|
|
12
12
|
export declare const jsxEscape: (value: string) => string;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* This module enables JSX to supports streaming Response.
|
|
4
4
|
*/
|
|
5
5
|
import type { HtmlEscapedString } from '../utils/html';
|
|
6
|
+
import { JSXNode } from './base';
|
|
6
7
|
import type { FC, PropsWithChildren } from './';
|
|
7
8
|
/**
|
|
8
9
|
* @experimental
|
|
@@ -17,4 +18,4 @@ export declare const Suspense: FC<PropsWithChildren<{
|
|
|
17
18
|
* `renderToReadableStream()` is an experimental feature.
|
|
18
19
|
* The API might be changed.
|
|
19
20
|
*/
|
|
20
|
-
export declare const renderToReadableStream: (
|
|
21
|
+
export declare const renderToReadableStream: (content: HtmlEscapedString | JSXNode | Promise<HtmlEscapedString>, onError?: (e: unknown) => string | void) => ReadableStream<Uint8Array>;
|
|
@@ -7,8 +7,8 @@ import type { CookiePrefixOptions } from '../../utils/cookie';
|
|
|
7
7
|
import '../../context';
|
|
8
8
|
import type { SignatureAlgorithm } from '../../utils/jwt/jwa';
|
|
9
9
|
import type { SignatureKey } from '../../utils/jwt/jws';
|
|
10
|
-
export type JwtVariables = {
|
|
11
|
-
jwtPayload:
|
|
10
|
+
export type JwtVariables<T = any> = {
|
|
11
|
+
jwtPayload: T;
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
14
|
* JWT Auth Middleware for Hono.
|
|
@@ -51,6 +51,7 @@ type PermissionsPolicyOptions = Partial<Record<PermissionsPolicyDirective, Permi
|
|
|
51
51
|
type overridableHeader = boolean | string;
|
|
52
52
|
interface SecureHeadersOptions {
|
|
53
53
|
contentSecurityPolicy?: ContentSecurityPolicyOptions;
|
|
54
|
+
contentSecurityPolicyReportOnly?: ContentSecurityPolicyOptions;
|
|
54
55
|
crossOriginEmbedderPolicy?: overridableHeader;
|
|
55
56
|
crossOriginResourcePolicy?: overridableHeader;
|
|
56
57
|
crossOriginOpenerPolicy?: overridableHeader;
|
|
@@ -76,6 +77,7 @@ export declare const NONCE: ContentSecurityPolicyOptionHandler;
|
|
|
76
77
|
*
|
|
77
78
|
* @param {Partial<SecureHeadersOptions>} [customOptions] - The options for the secure headers middleware.
|
|
78
79
|
* @param {ContentSecurityPolicyOptions} [customOptions.contentSecurityPolicy] - Settings for the Content-Security-Policy header.
|
|
80
|
+
* @param {ContentSecurityPolicyOptions} [customOptions.contentSecurityPolicyReportOnly] - Settings for the Content-Security-Policy-Report-Only header.
|
|
79
81
|
* @param {overridableHeader} [customOptions.crossOriginEmbedderPolicy=false] - Settings for the Cross-Origin-Embedder-Policy header.
|
|
80
82
|
* @param {overridableHeader} [customOptions.crossOriginResourcePolicy=true] - Settings for the Cross-Origin-Resource-Policy header.
|
|
81
83
|
* @param {overridableHeader} [customOptions.crossOriginOpenerPolicy=true] - Settings for the Cross-Origin-Opener-Policy header.
|