hono 3.7.3 → 3.7.4

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 = {
@@ -21,7 +21,6 @@ __export(context_exports, {
21
21
  Context: () => Context
22
22
  });
23
23
  module.exports = __toCommonJS(context_exports);
24
- var import_types = require("./types");
25
24
  var import_cookie = require("./utils/cookie");
26
25
  var import_stream = require("./utils/stream");
27
26
  const TEXT_PLAIN = "text/plain; charset=UTF-8";
@@ -200,7 +199,7 @@ class Context {
200
199
  }
201
200
  }
202
201
  get event() {
203
- if (this._exCtx instanceof import_types.FetchEventLike) {
202
+ if (this._exCtx instanceof FetchEvent) {
204
203
  return this._exCtx;
205
204
  } else {
206
205
  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/context.js CHANGED
@@ -1,5 +1,4 @@
1
1
  // src/context.ts
2
- import { FetchEventLike } from "./types.js";
3
2
  import { serialize } from "./utils/cookie.js";
4
3
  import { StreamingApi } from "./utils/stream.js";
5
4
  var TEXT_PLAIN = "text/plain; charset=UTF-8";
@@ -178,7 +177,7 @@ var Context = class {
178
177
  }
179
178
  }
180
179
  get event() {
181
- if (this._exCtx instanceof FetchEventLike) {
180
+ if (this._exCtx instanceof FetchEvent) {
182
181
  return this._exCtx;
183
182
  } else {
184
183
  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,2 @@
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
+ export declare const handle: (app: Hono<any, any, any>) => (req: Request, requestContext: FetchEvent) => Response | Promise<Response>;
@@ -1,5 +1,6 @@
1
+ /// <reference lib="es2022" />
2
+ /// <reference lib="webworker" />
1
3
  import type { HonoRequest } from './request';
2
- import { FetchEventLike } from './types';
3
4
  import type { Env, NotFoundHandler, Input, TypedResponse } from './types';
4
5
  import type { CookieOptions } from './utils/cookie';
5
6
  import type { StatusCode } from './utils/http-status';
@@ -52,7 +53,7 @@ interface HTMLRespond {
52
53
  }
53
54
  declare type ContextOptions<E extends Env> = {
54
55
  env: E['Bindings'];
55
- executionCtx?: FetchEventLike | ExecutionContext | undefined;
56
+ executionCtx?: FetchEvent | ExecutionContext | undefined;
56
57
  notFoundHandler?: NotFoundHandler<E>;
57
58
  };
58
59
  export declare class Context<E extends Env = any, P extends string = any, I extends Input = {}> {
@@ -70,7 +71,7 @@ export declare class Context<E extends Env = any, P extends string = any, I exte
70
71
  private _renderer;
71
72
  private notFoundHandler;
72
73
  constructor(req: HonoRequest<P, I['out']>, options?: ContextOptions<E>);
73
- get event(): FetchEventLike;
74
+ get event(): FetchEvent;
74
75
  get executionCtx(): ExecutionContext;
75
76
  get res(): Response;
76
77
  set res(_res: Response | undefined);
@@ -10,11 +10,11 @@ interface RouterRoute {
10
10
  }
11
11
  declare const Hono_base: new <E_1 extends Env = Env, S_1 extends Schema = {}, BasePath_1 extends string = "/">() => {
12
12
  all: HandlerInterface<E_1, "all", S_1, BasePath_1>;
13
- options: HandlerInterface<E_1, "options", S_1, BasePath_1>;
14
13
  get: HandlerInterface<E_1, "get", S_1, BasePath_1>;
15
14
  post: HandlerInterface<E_1, "post", S_1, BasePath_1>;
16
15
  put: HandlerInterface<E_1, "put", S_1, BasePath_1>;
17
16
  delete: HandlerInterface<E_1, "delete", S_1, BasePath_1>;
17
+ options: HandlerInterface<E_1, "options", S_1, BasePath_1>;
18
18
  patch: HandlerInterface<E_1, "patch", S_1, BasePath_1>;
19
19
  } & {
20
20
  on: OnHandlerInterface<E_1, S_1, BasePath_1>;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono",
3
- "version": "3.7.3",
3
+ "version": "3.7.4",
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",