hono 4.2.6 → 4.2.8
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/cloudflare-workers/utils.js +1 -1
- package/dist/cjs/adapter/cloudflare-workers/utils.js +1 -1
- package/dist/cjs/context.js +7 -0
- package/dist/cjs/middleware/serve-static/index.js +1 -2
- package/dist/context.js +7 -0
- package/dist/middleware/serve-static/index.js +1 -2
- package/dist/types/adapter/cloudflare-workers/utils.d.ts +1 -1
- package/dist/types/jsx/dom/index.d.ts +14 -11
- package/dist/types/jsx/hooks/index.d.ts +5 -1
- package/dist/types/jsx/index.d.ts +10 -7
- package/package.json +3 -3
|
@@ -24,7 +24,7 @@ var getContentFromKVAsset = async (path, options) => {
|
|
|
24
24
|
if (!key) {
|
|
25
25
|
return null;
|
|
26
26
|
}
|
|
27
|
-
const content = await ASSET_NAMESPACE.get(key, { type: "
|
|
27
|
+
const content = await ASSET_NAMESPACE.get(key, { type: "stream" });
|
|
28
28
|
if (!content) {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
@@ -46,7 +46,7 @@ const getContentFromKVAsset = async (path, options) => {
|
|
|
46
46
|
if (!key) {
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
|
-
const content = await ASSET_NAMESPACE.get(key, { type: "
|
|
49
|
+
const content = await ASSET_NAMESPACE.get(key, { type: "stream" });
|
|
50
50
|
if (!content) {
|
|
51
51
|
return null;
|
|
52
52
|
}
|
package/dist/cjs/context.js
CHANGED
|
@@ -170,6 +170,13 @@ class Context {
|
|
|
170
170
|
setHeaders(this.#headers, this.#preparedHeaders);
|
|
171
171
|
if (this.#res) {
|
|
172
172
|
this.#res.headers.forEach((v, k) => {
|
|
173
|
+
if (k === "set-cookie" && this.#res) {
|
|
174
|
+
const cookies = this.#res.headers.getSetCookie();
|
|
175
|
+
for (const cookie of cookies) {
|
|
176
|
+
this.#headers?.append("set-cookie", cookie);
|
|
177
|
+
}
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
173
180
|
this.#headers?.set(k, v);
|
|
174
181
|
});
|
|
175
182
|
setHeaders(this.#headers, this.#preparedHeaders);
|
|
@@ -31,8 +31,7 @@ const serveStatic = (options) => {
|
|
|
31
31
|
await next();
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
let filename = options.path ?? decodeURI(url.pathname);
|
|
34
|
+
let filename = options.path ?? decodeURI(c.req.path);
|
|
36
35
|
filename = options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename;
|
|
37
36
|
const root = options.root;
|
|
38
37
|
let path = (0, import_filepath.getFilePath)({
|
package/dist/context.js
CHANGED
|
@@ -147,6 +147,13 @@ var Context = class {
|
|
|
147
147
|
setHeaders(this.#headers, this.#preparedHeaders);
|
|
148
148
|
if (this.#res) {
|
|
149
149
|
this.#res.headers.forEach((v, k) => {
|
|
150
|
+
if (k === "set-cookie" && this.#res) {
|
|
151
|
+
const cookies = this.#res.headers.getSetCookie();
|
|
152
|
+
for (const cookie of cookies) {
|
|
153
|
+
this.#headers?.append("set-cookie", cookie);
|
|
154
|
+
}
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
150
157
|
this.#headers?.set(k, v);
|
|
151
158
|
});
|
|
152
159
|
setHeaders(this.#headers, this.#preparedHeaders);
|
|
@@ -9,8 +9,7 @@ var serveStatic = (options) => {
|
|
|
9
9
|
await next();
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
let filename = options.path ?? decodeURI(url.pathname);
|
|
12
|
+
let filename = options.path ?? decodeURI(c.req.path);
|
|
14
13
|
filename = options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename;
|
|
15
14
|
const root = options.root;
|
|
16
15
|
let path = getFilePath({
|
|
@@ -3,4 +3,4 @@ export type KVAssetOptions = {
|
|
|
3
3
|
manifest?: object | string;
|
|
4
4
|
namespace?: KVNamespace;
|
|
5
5
|
};
|
|
6
|
-
export declare const getContentFromKVAsset: (path: string, options?: KVAssetOptions) => Promise<
|
|
6
|
+
export declare const getContentFromKVAsset: (path: string, options?: KVAssetOptions) => Promise<ReadableStream | null>;
|
|
@@ -9,19 +9,22 @@ declare const createElement: (tag: string | ((props: Props) => JSXNode), props:
|
|
|
9
9
|
declare const cloneElement: <T extends JSXNode | JSX.Element>(element: T, props: Props, ...children: Child[]) => T;
|
|
10
10
|
export { createElement as jsx, useState, useEffect, useRef, useCallback, use, startTransition, useTransition, useDeferredValue, startViewTransition, useViewTransition, useMemo, useLayoutEffect, useReducer, useId, useDebugValue, Suspense, ErrorBoundary, createContext, useContext, memo, isValidElement, createElement, cloneElement, };
|
|
11
11
|
declare const _default: {
|
|
12
|
-
useState:
|
|
12
|
+
useState: {
|
|
13
|
+
<T>(initialState: T | (() => T)): [T, (newState: T | ((currentState: T) => T)) => void];
|
|
14
|
+
<T_1 = undefined>(): [T_1 | undefined, (newState: T_1 | ((currentState: T_1 | undefined) => T_1 | undefined) | undefined) => void];
|
|
15
|
+
};
|
|
13
16
|
useEffect: (effect: () => void | (() => void), deps?: readonly unknown[] | undefined) => void;
|
|
14
|
-
useRef: <
|
|
15
|
-
useCallback: <
|
|
16
|
-
use: <
|
|
17
|
+
useRef: <T_2>(initialValue: T_2 | null) => import("../hooks").RefObject<T_2>;
|
|
18
|
+
useCallback: <T_3 extends (...args: unknown[]) => unknown>(callback: T_3, deps: readonly unknown[]) => T_3;
|
|
19
|
+
use: <T_4>(promise: Promise<T_4>) => T_4;
|
|
17
20
|
startTransition: (callback: () => void) => void;
|
|
18
21
|
useTransition: () => [boolean, (callback: () => void) => void];
|
|
19
|
-
useDeferredValue: <
|
|
22
|
+
useDeferredValue: <T_5>(value: T_5) => T_5;
|
|
20
23
|
startViewTransition: (callback: () => void) => void;
|
|
21
24
|
useViewTransition: () => [boolean, (callback: () => void) => void];
|
|
22
|
-
useMemo: <
|
|
25
|
+
useMemo: <T_6>(factory: () => T_6, deps: readonly unknown[]) => T_6;
|
|
23
26
|
useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[] | undefined) => void;
|
|
24
|
-
useReducer: <
|
|
27
|
+
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];
|
|
25
28
|
useId: () => string;
|
|
26
29
|
useDebugValue: (_value: unknown, _formatter?: ((value: unknown) => string) | undefined) => void;
|
|
27
30
|
Suspense: import("../base").FC<import("..").PropsWithChildren<{
|
|
@@ -32,12 +35,12 @@ declare const _default: {
|
|
|
32
35
|
fallbackRender?: import("../components").FallbackRender | undefined;
|
|
33
36
|
onError?: import("../components").ErrorHandler | undefined;
|
|
34
37
|
}>>;
|
|
35
|
-
createContext: <
|
|
36
|
-
useContext: <
|
|
37
|
-
memo: <
|
|
38
|
+
createContext: <T_8>(defaultValue: T_8) => import("../context").Context<T_8>;
|
|
39
|
+
useContext: <T_9>(context: import("../context").Context<T_9>) => T_9;
|
|
40
|
+
memo: <T_10>(component: import("../base").FC<T_10>, propsAreEqual?: (prevProps: Readonly<T_10>, nextProps: Readonly<T_10>) => boolean) => import("../base").FC<T_10>;
|
|
38
41
|
isValidElement: (element: unknown) => element is JSXNode;
|
|
39
42
|
createElement: (tag: string | ((props: Props) => JSXNode), props: Props, ...children: Child[]) => JSXNode;
|
|
40
|
-
cloneElement: <
|
|
43
|
+
cloneElement: <T_11 extends JSXNode | JSX.Element>(element: T_11, props: Props, ...children: Child[]) => T_11;
|
|
41
44
|
};
|
|
42
45
|
export default _default;
|
|
43
46
|
export type { Context } from '../context';
|
|
@@ -14,7 +14,11 @@ export declare const useViewTransition: () => [boolean, (callback: () => void) =
|
|
|
14
14
|
export declare const startTransition: (callback: () => void) => void;
|
|
15
15
|
export declare const useTransition: () => [boolean, (callback: () => void) => void];
|
|
16
16
|
export declare const useDeferredValue: <T>(value: T) => T;
|
|
17
|
-
|
|
17
|
+
type UseStateType = {
|
|
18
|
+
<T>(initialState: T | (() => T)): [T, UpdateStateFunction<T>];
|
|
19
|
+
<T = undefined>(): [T | undefined, UpdateStateFunction<T | undefined>];
|
|
20
|
+
};
|
|
21
|
+
export declare const useState: UseStateType;
|
|
18
22
|
export declare const useReducer: <T, A>(reducer: (state: T, action: A) => T, initialArg: T, init?: ((initialState: T) => T) | undefined) => [T, (action: A) => void];
|
|
19
23
|
export declare const useEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
|
|
20
24
|
export declare const useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[]) => void;
|
|
@@ -20,20 +20,23 @@ declare const _default: {
|
|
|
20
20
|
}>>;
|
|
21
21
|
createContext: <T_2>(defaultValue: T_2) => import("./context").Context<T_2>;
|
|
22
22
|
useContext: <T_3>(context: import("./context").Context<T_3>) => T_3;
|
|
23
|
-
useState:
|
|
23
|
+
useState: {
|
|
24
|
+
<T_4>(initialState: T_4 | (() => T_4)): [T_4, (newState: T_4 | ((currentState: T_4) => T_4)) => void];
|
|
25
|
+
<T_5 = undefined>(): [T_5 | undefined, (newState: T_5 | ((currentState: T_5 | undefined) => T_5 | undefined) | undefined) => void];
|
|
26
|
+
};
|
|
24
27
|
useEffect: (effect: () => void | (() => void), deps?: readonly unknown[] | undefined) => void;
|
|
25
|
-
useRef: <
|
|
26
|
-
useCallback: <
|
|
27
|
-
useReducer: <
|
|
28
|
+
useRef: <T_6>(initialValue: T_6 | null) => import("./hooks").RefObject<T_6>;
|
|
29
|
+
useCallback: <T_7 extends (...args: unknown[]) => unknown>(callback: T_7, deps: readonly unknown[]) => T_7;
|
|
30
|
+
useReducer: <T_8, A>(reducer: (state: T_8, action: A) => T_8, initialArg: T_8, init?: ((initialState: T_8) => T_8) | undefined) => [T_8, (action: A) => void];
|
|
28
31
|
useId: () => string;
|
|
29
32
|
useDebugValue: (_value: unknown, _formatter?: ((value: unknown) => string) | undefined) => void;
|
|
30
|
-
use: <
|
|
33
|
+
use: <T_9>(promise: Promise<T_9>) => T_9;
|
|
31
34
|
startTransition: (callback: () => void) => void;
|
|
32
35
|
useTransition: () => [boolean, (callback: () => void) => void];
|
|
33
|
-
useDeferredValue: <
|
|
36
|
+
useDeferredValue: <T_10>(value: T_10) => T_10;
|
|
34
37
|
startViewTransition: (callback: () => void) => void;
|
|
35
38
|
useViewTransition: () => [boolean, (callback: () => void) => void];
|
|
36
|
-
useMemo: <
|
|
39
|
+
useMemo: <T_11>(factory: () => T_11, deps: readonly unknown[]) => T_11;
|
|
37
40
|
useLayoutEffect: (effect: () => void | (() => void), deps?: readonly unknown[] | undefined) => void;
|
|
38
41
|
Suspense: import("./base").FC<import("./types").PropsWithChildren<{
|
|
39
42
|
fallback: any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hono",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.8",
|
|
4
4
|
"description": "Ultrafast web framework for the Edges",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"test:all": "bun run test && bun test:deno && bun test:bun && bun test:fastly && bun test:node && bun test:wrangler && bun test:lambda && bun test:lambda-edge",
|
|
23
23
|
"lint": "eslint --ext js,ts,tsx src runtime_tests",
|
|
24
24
|
"lint:fix": "eslint --ext js,ts,tsx src runtime_tests --fix",
|
|
25
|
-
"format": "prettier --check \"src/**/*.{js,ts,tsx}\" \"runtime_tests/**/*.{js,ts,tsx}\"",
|
|
26
|
-
"format:fix": "prettier --write \"src/**/*.{js,ts,tsx}\" \"runtime_tests/**/*.{js,ts,tsx}\"",
|
|
25
|
+
"format": "prettier --check --cache \"src/**/*.{js,ts,tsx}\" \"runtime_tests/**/*.{js,ts,tsx}\"",
|
|
26
|
+
"format:fix": "prettier --write --cache --cache-strategy metadata \"src/**/*.{js,ts,tsx}\" \"runtime_tests/**/*.{js,ts,tsx}\"",
|
|
27
27
|
"denoify": "rimraf deno_dist && denoify && rimraf \"deno_dist/**/*.test.{ts,tsx}\"",
|
|
28
28
|
"copy:package.cjs.json": "cp ./package.cjs.json ./dist/cjs/package.json && cp ./package.cjs.json ./dist/types/package.json ",
|
|
29
29
|
"build": "rimraf dist && tsx ./build.ts && bun run copy:package.cjs.json",
|