hono 4.0.7 → 4.0.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.
@@ -29,7 +29,6 @@ __export(ssg_exports, {
29
29
  });
30
30
  module.exports = __toCommonJS(ssg_exports);
31
31
  var import_utils = require("../../client/utils");
32
- var import_buffer = require("../../utils/buffer");
33
32
  var import_mime = require("../../utils/mime");
34
33
  var import_utils2 = require("./utils");
35
34
  const SSG_CONTEXT = "HONO_SSG_CONTEXT";
@@ -139,7 +138,7 @@ const saveContentToFiles = async (htmlMap, fsModule, outDir) => {
139
138
  if (typeof content === "string") {
140
139
  await fsModule.writeFile(filePath, content);
141
140
  } else if (content instanceof ArrayBuffer) {
142
- await fsModule.writeFile(filePath, (0, import_buffer.bufferToString)(content));
141
+ await fsModule.writeFile(filePath, new Uint8Array(content));
143
142
  }
144
143
  files.push(filePath);
145
144
  }
@@ -29,7 +29,7 @@ module.exports = __toCommonJS(jsx_runtime_exports);
29
29
  var import_jsx_dev_runtime = require("./jsx-dev-runtime");
30
30
  var import_jsx_dev_runtime2 = require("./jsx-dev-runtime");
31
31
  var import_html = require("../helper/html");
32
- const jsxAttr = (name, value) => (0, import_html.raw)(name + '="' + import_html.html`${value}` + '"');
32
+ const jsxAttr = (name, value) => typeof value === "string" ? (0, import_html.raw)(name + '="' + import_html.html`${value}` + '"') : import_html.html`${name}="${value}"`;
33
33
  const jsxEscape = (value) => value;
34
34
  // Annotate the CommonJS export names for ESM import in node:
35
35
  0 && (module.exports = {
@@ -28,6 +28,9 @@ class StreamingApi {
28
28
  this.writer = writable.getWriter();
29
29
  this.encoder = new TextEncoder();
30
30
  const reader = _readable.getReader();
31
+ this.abortSubscribers.push(async () => {
32
+ await reader.cancel();
33
+ });
31
34
  this.responseReadable = new ReadableStream({
32
35
  async pull(controller) {
33
36
  const { done, value } = await reader.read();
@@ -66,7 +69,7 @@ class StreamingApi {
66
69
  await body.pipeTo(this.writable, { preventClose: true });
67
70
  this.writer = this.writable.getWriter();
68
71
  }
69
- async onAbort(listener) {
72
+ onAbort(listener) {
70
73
  this.abortSubscribers.push(listener);
71
74
  }
72
75
  }
@@ -1,6 +1,5 @@
1
1
  // src/helper/ssg/index.ts
2
2
  import { replaceUrlParam } from "../../client/utils.js";
3
- import { bufferToString } from "../../utils/buffer.js";
4
3
  import { getExtension } from "../../utils/mime.js";
5
4
  import { joinPaths, dirname, filterStaticGenerateRoutes } from "./utils.js";
6
5
  var SSG_CONTEXT = "HONO_SSG_CONTEXT";
@@ -110,7 +109,7 @@ var saveContentToFiles = async (htmlMap, fsModule, outDir) => {
110
109
  if (typeof content === "string") {
111
110
  await fsModule.writeFile(filePath, content);
112
111
  } else if (content instanceof ArrayBuffer) {
113
- await fsModule.writeFile(filePath, bufferToString(content));
112
+ await fsModule.writeFile(filePath, new Uint8Array(content));
114
113
  }
115
114
  files.push(filePath);
116
115
  }
@@ -2,7 +2,7 @@
2
2
  import { jsxDEV, Fragment } from "./jsx-dev-runtime.js";
3
3
  import { jsxDEV as jsxDEV2 } from "./jsx-dev-runtime.js";
4
4
  import { raw, html } from "../helper/html/index.js";
5
- var jsxAttr = (name, value) => raw(name + '="' + html`${value}` + '"');
5
+ var jsxAttr = (name, value) => typeof value === "string" ? raw(name + '="' + html`${value}` + '"') : html`${name}="${value}"`;
6
6
  var jsxEscape = (value) => value;
7
7
  export {
8
8
  Fragment,
@@ -67,8 +67,8 @@ export declare const saveContentToFiles: (htmlMap: Map<string, {
67
67
  * `ToSSGInterface` is an experimental feature.
68
68
  * The API might be changed.
69
69
  */
70
- export interface ToSSGInterface<E extends Env = Env, S extends Schema = {}, BasePath extends string = '/'> {
71
- (app: Hono<E, S, BasePath>, fsModule: FileSystemModule, options?: ToSSGOptions): Promise<ToSSGResult>;
70
+ export interface ToSSGInterface {
71
+ (app: Hono<any, any, any>, fsModule: FileSystemModule, options?: ToSSGOptions): Promise<ToSSGResult>;
72
72
  }
73
73
  /**
74
74
  * @experimental
@@ -2,5 +2,5 @@ export { jsxDEV as jsx, Fragment } from './jsx-dev-runtime';
2
2
  export { jsxDEV as jsxs } from './jsx-dev-runtime';
3
3
  import { html } from '../helper/html';
4
4
  export { html as jsxTemplate };
5
- export declare const jsxAttr: (name: string, value: string) => import("../utils/html").HtmlEscapedString;
5
+ export declare const jsxAttr: (name: string, value: string | Promise<string>) => import("../utils/html").HtmlEscapedString | Promise<import("../utils/html").HtmlEscapedString>;
6
6
  export declare const jsxEscape: (value: string) => string;
@@ -9,10 +9,8 @@ export type Env = {
9
9
  };
10
10
  export type Next = () => Promise<void>;
11
11
  export type Input = {
12
- in?: Partial<ValidationTargets>;
13
- out?: Partial<{
14
- [K in keyof ValidationTargets]: unknown;
15
- }>;
12
+ in?: {};
13
+ out?: {};
16
14
  };
17
15
  export type BlankSchema = {};
18
16
  export type BlankInput = {};
@@ -10,5 +10,5 @@ export declare class StreamingApi {
10
10
  sleep(ms: number): Promise<unknown>;
11
11
  close(): Promise<void>;
12
12
  pipe(body: ReadableStream): Promise<void>;
13
- onAbort(listener: () => void | Promise<void>): Promise<void>;
13
+ onAbort(listener: () => void | Promise<void>): void;
14
14
  }
@@ -6,6 +6,9 @@ var StreamingApi = class {
6
6
  this.writer = writable.getWriter();
7
7
  this.encoder = new TextEncoder();
8
8
  const reader = _readable.getReader();
9
+ this.abortSubscribers.push(async () => {
10
+ await reader.cancel();
11
+ });
9
12
  this.responseReadable = new ReadableStream({
10
13
  async pull(controller) {
11
14
  const { done, value } = await reader.read();
@@ -44,7 +47,7 @@ var StreamingApi = class {
44
47
  await body.pipeTo(this.writable, { preventClose: true });
45
48
  this.writer = this.writable.getWriter();
46
49
  }
47
- async onAbort(listener) {
50
+ onAbort(listener) {
48
51
  this.abortSubscribers.push(listener);
49
52
  }
50
53
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono",
3
- "version": "4.0.7",
3
+ "version": "4.0.9",
4
4
  "description": "Ultrafast web framework for the Edges",
5
5
  "main": "dist/cjs/index.js",
6
6
  "type": "module",
@@ -520,6 +520,7 @@
520
520
  "denoify": "^1.6.6",
521
521
  "esbuild": "^0.15.12",
522
522
  "eslint": "^8.55.0",
523
+ "glob": "7.2.3",
523
524
  "jsdom": "^22.1.0",
524
525
  "msw": "1.3.2",
525
526
  "np": "7.7.0",