hono 4.2.7 → 4.2.9

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.
@@ -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: "arrayBuffer" });
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: "arrayBuffer" });
49
+ const content = await ASSET_NAMESPACE.get(key, { type: "stream" });
50
50
  if (!content) {
51
51
  return null;
52
52
  }
@@ -170,7 +170,11 @@ class Context {
170
170
  setHeaders(this.#headers, this.#preparedHeaders);
171
171
  if (this.#res) {
172
172
  this.#res.headers.forEach((v, k) => {
173
- this.#headers?.set(k, v);
173
+ if (k === "set-cookie") {
174
+ this.#headers?.append(k, v);
175
+ } else {
176
+ this.#headers?.set(k, v);
177
+ }
174
178
  });
175
179
  setHeaders(this.#headers, this.#preparedHeaders);
176
180
  }
package/dist/context.js CHANGED
@@ -147,7 +147,11 @@ var Context = class {
147
147
  setHeaders(this.#headers, this.#preparedHeaders);
148
148
  if (this.#res) {
149
149
  this.#res.headers.forEach((v, k) => {
150
- this.#headers?.set(k, v);
150
+ if (k === "set-cookie") {
151
+ this.#headers?.append(k, v);
152
+ } else {
153
+ this.#headers?.set(k, v);
154
+ }
151
155
  });
152
156
  setHeaders(this.#headers, this.#preparedHeaders);
153
157
  }
@@ -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<ArrayBuffer | null>;
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: <T>(initialState: T | (() => T)) => [T, (newState: T | ((currentState: T) => T)) => void];
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: <T_1>(initialValue: T_1 | null) => import("../hooks").RefObject<T_1>;
15
- useCallback: <T_2 extends (...args: unknown[]) => unknown>(callback: T_2, deps: readonly unknown[]) => T_2;
16
- use: <T_3>(promise: Promise<T_3>) => T_3;
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: <T_4>(value: T_4) => T_4;
22
+ useDeferredValue: <T_5>(value: T_5) => T_5;
20
23
  startViewTransition: (callback: () => void) => void;
21
24
  useViewTransition: () => [boolean, (callback: () => void) => void];
22
- useMemo: <T_5>(factory: () => T_5, deps: readonly unknown[]) => T_5;
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: <T_6, A>(reducer: (state: T_6, action: A) => T_6, initialArg: T_6, init?: ((initialState: T_6) => T_6) | undefined) => [T_6, (action: A) => void];
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: <T_7>(defaultValue: T_7) => import("../context").Context<T_7>;
36
- useContext: <T_8>(context: import("../context").Context<T_8>) => T_8;
37
- memo: <T_9>(component: import("../base").FC<T_9>, propsAreEqual?: (prevProps: Readonly<T_9>, nextProps: Readonly<T_9>) => boolean) => import("../base").FC<T_9>;
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: <T_10 extends JSXNode | JSX.Element>(element: T_10, props: Props, ...children: Child[]) => T_10;
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
- export declare const useState: <T>(initialState: T | (() => T)) => [T, UpdateStateFunction<T>];
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: <T_4>(initialState: T_4 | (() => T_4)) => [T_4, (newState: T_4 | ((currentState: T_4) => T_4)) => void];
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: <T_5>(initialValue: T_5 | null) => import("./hooks").RefObject<T_5>;
26
- useCallback: <T_6 extends (...args: unknown[]) => unknown>(callback: T_6, deps: readonly unknown[]) => T_6;
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];
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: <T_8>(promise: Promise<T_8>) => T_8;
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: <T_9>(value: T_9) => T_9;
36
+ useDeferredValue: <T_10>(value: T_10) => T_10;
34
37
  startViewTransition: (callback: () => void) => void;
35
38
  useViewTransition: () => [boolean, (callback: () => void) => void];
36
- useMemo: <T_10>(factory: () => T_10, deps: readonly unknown[]) => T_10;
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.7",
3
+ "version": "4.2.9",
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",