hono 3.7.3 → 3.7.5

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.
@@ -1,15 +1,6 @@
1
1
  // src/adapter/vercel/handler.ts
2
2
  var handle = (app) => (req, requestContext) => {
3
- return app.fetch(
4
- req,
5
- {},
6
- {
7
- waitUntil: requestContext?.waitUntil,
8
- passThroughOnException: () => {
9
- throw new Error("`passThroughOnException` is not implemented in the Vercel");
10
- }
11
- }
12
- );
3
+ return app.fetch(req, {}, requestContext);
13
4
  };
14
5
  export {
15
6
  handle
@@ -22,16 +22,7 @@ __export(handler_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(handler_exports);
24
24
  const handle = (app) => (req, requestContext) => {
25
- return app.fetch(
26
- req,
27
- {},
28
- {
29
- waitUntil: requestContext?.waitUntil,
30
- passThroughOnException: () => {
31
- throw new Error("`passThroughOnException` is not implemented in the Vercel");
32
- }
33
- }
34
- );
25
+ return app.fetch(req, {}, requestContext);
35
26
  };
36
27
  // Annotate the CommonJS export names for ESM import in node:
37
28
  0 && (module.exports = {
@@ -200,7 +200,7 @@ class Context {
200
200
  }
201
201
  }
202
202
  get event() {
203
- if (this._exCtx instanceof import_types.FetchEventLike) {
203
+ if (this._exCtx instanceof import_types.FetchEvent) {
204
204
  return this._exCtx;
205
205
  } else {
206
206
  throw Error("This context has no FetchEvent");
@@ -209,10 +209,10 @@ class Hono extends defineDynamicClass() {
209
209
  throw err;
210
210
  }
211
211
  dispatch(request, executionCtx, env, method) {
212
- const path = this.getPath(request, { env });
213
212
  if (method === "HEAD") {
214
213
  return (async () => new Response(null, await this.dispatch(request, executionCtx, env, "GET")))();
215
214
  }
215
+ const path = this.getPath(request, { env });
216
216
  const { handlers, params } = this.matchRoute(method, path);
217
217
  const c = new import_context.Context(new import_request.HonoRequest(request, path, params), {
218
218
  env,
@@ -198,7 +198,7 @@ const memo = (component, propsAreEqual = shallowEqual) => {
198
198
  };
199
199
  };
200
200
  const Fragment = (props) => {
201
- return new JSXFragmentNode("", {}, props.children || []);
201
+ return new JSXFragmentNode("", {}, props.children ? [props.children] : []);
202
202
  };
203
203
  // Annotate the CommonJS export names for ESM import in node:
204
204
  0 && (module.exports = {
package/dist/cjs/types.js CHANGED
@@ -18,12 +18,16 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var types_exports = {};
20
20
  __export(types_exports, {
21
+ FetchEvent: () => FetchEvent,
21
22
  FetchEventLike: () => FetchEventLike
22
23
  });
23
24
  module.exports = __toCommonJS(types_exports);
24
25
  class FetchEventLike {
25
26
  }
27
+ class FetchEvent extends FetchEventLike {
28
+ }
26
29
  // Annotate the CommonJS export names for ESM import in node:
27
30
  0 && (module.exports = {
31
+ FetchEvent,
28
32
  FetchEventLike
29
33
  });
package/dist/context.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/context.ts
2
- import { FetchEventLike } from "./types.js";
2
+ import { FetchEvent } from "./types.js";
3
3
  import { serialize } from "./utils/cookie.js";
4
4
  import { StreamingApi } from "./utils/stream.js";
5
5
  var TEXT_PLAIN = "text/plain; charset=UTF-8";
@@ -178,7 +178,7 @@ var Context = class {
178
178
  }
179
179
  }
180
180
  get event() {
181
- if (this._exCtx instanceof FetchEventLike) {
181
+ if (this._exCtx instanceof FetchEvent) {
182
182
  return this._exCtx;
183
183
  } else {
184
184
  throw Error("This context has no FetchEvent");
package/dist/hono-base.js CHANGED
@@ -187,10 +187,10 @@ var Hono = class extends defineDynamicClass() {
187
187
  throw err;
188
188
  }
189
189
  dispatch(request, executionCtx, env, method) {
190
- const path = this.getPath(request, { env });
191
190
  if (method === "HEAD") {
192
191
  return (async () => new Response(null, await this.dispatch(request, executionCtx, env, "GET")))();
193
192
  }
193
+ const path = this.getPath(request, { env });
194
194
  const { handlers, params } = this.matchRoute(method, path);
195
195
  const c = new Context(new HonoRequest(request, path, params), {
196
196
  env,
package/dist/jsx/index.js CHANGED
@@ -173,7 +173,7 @@ var memo = (component, propsAreEqual = shallowEqual) => {
173
173
  };
174
174
  };
175
175
  var Fragment = (props) => {
176
- return new JSXFragmentNode("", {}, props.children || []);
176
+ return new JSXFragmentNode("", {}, props.children ? [props.children] : []);
177
177
  };
178
178
  export {
179
179
  Fragment,
@@ -1,2 +1,3 @@
1
1
  import type { Hono } from '../../hono';
2
- export declare const handle: (app: Hono<any, any, any>) => (req: Request, requestContext: Omit<ExecutionContext, 'passThroughOnException'>) => Response | Promise<Response>;
2
+ import type { FetchEvent } from '../../types';
3
+ export declare const handle: (app: Hono<any, any, any>) => (req: Request, requestContext: FetchEvent) => Response | Promise<Response>;
@@ -1,6 +1,6 @@
1
1
  import type { HonoRequest } from './request';
2
- import { FetchEventLike } from './types';
3
2
  import type { Env, NotFoundHandler, Input, TypedResponse } from './types';
3
+ import { FetchEvent } from './types';
4
4
  import type { CookieOptions } from './utils/cookie';
5
5
  import type { StatusCode } from './utils/http-status';
6
6
  import { StreamingApi } from './utils/stream';
@@ -52,7 +52,7 @@ interface HTMLRespond {
52
52
  }
53
53
  declare type ContextOptions<E extends Env> = {
54
54
  env: E['Bindings'];
55
- executionCtx?: FetchEventLike | ExecutionContext | undefined;
55
+ executionCtx?: FetchEvent | ExecutionContext | undefined;
56
56
  notFoundHandler?: NotFoundHandler<E>;
57
57
  };
58
58
  export declare class Context<E extends Env = any, P extends string = any, I extends Input = {}> {
@@ -70,7 +70,7 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
70
70
  private _renderer;
71
71
  private notFoundHandler;
72
72
  constructor(req: HonoRequest<P, I['out']>, options?: ContextOptions<E>);
73
- get event(): FetchEventLike;
73
+ get event(): FetchEvent;
74
74
  get executionCtx(): ExecutionContext;
75
75
  get res(): Response;
76
76
  set res(_res: Response | undefined);
@@ -29,5 +29,5 @@ export declare type FC<T = Props> = (props: T & {
29
29
  export declare const memo: <T>(component: FC<T>, propsAreEqual?: (prevProps: Readonly<T>, nextProps: Readonly<T>) => boolean) => FC<T>;
30
30
  export declare const Fragment: (props: {
31
31
  key?: string;
32
- children?: Child[];
32
+ children?: Child | HtmlEscapedString;
33
33
  }) => HtmlEscapedString;
@@ -146,4 +146,6 @@ export declare abstract class FetchEventLike {
146
146
  abstract passThroughOnException(): void;
147
147
  abstract waitUntil(promise: Promise<void>): void;
148
148
  }
149
+ export declare abstract class FetchEvent extends FetchEventLike {
150
+ }
149
151
  export {};
package/dist/types.js CHANGED
@@ -1,6 +1,9 @@
1
1
  // src/types.ts
2
2
  var FetchEventLike = class {
3
3
  };
4
+ var FetchEvent = class extends FetchEventLike {
5
+ };
4
6
  export {
7
+ FetchEvent,
5
8
  FetchEventLike
6
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono",
3
- "version": "3.7.3",
3
+ "version": "3.7.5",
4
4
  "description": "Ultrafast web framework for the Edges",
5
5
  "main": "dist/cjs/index.js",
6
6
  "type": "module",
@@ -398,7 +398,7 @@
398
398
  "@types/crypto-js": "^4.1.1",
399
399
  "@types/glob": "^8.0.0",
400
400
  "@types/jest": "^29.4.0",
401
- "@types/node": "^17.0.29",
401
+ "@types/node": "^20.8.2",
402
402
  "@types/node-fetch": "^2.6.2",
403
403
  "@types/supertest": "^2.0.12",
404
404
  "@typescript-eslint/eslint-plugin": "^5.59.2",