hono 3.11.2 → 3.11.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.
@@ -130,7 +130,7 @@ var isProxyEventV2 = (event) => {
130
130
  return Object.prototype.hasOwnProperty.call(event, "rawPath");
131
131
  };
132
132
  var isContentTypeBinary = (contentType) => {
133
- return !/^(text\/(plain|html|css|javascript|csv).*|application\/(.*json|.*xml).*|image\/svg\+xml)$/.test(
133
+ return !/^(text\/(plain|html|css|javascript|csv).*|application\/(.*json|.*xml).*|image\/svg\+xml.*)$/.test(
134
134
  contentType
135
135
  );
136
136
  };
@@ -50,7 +50,7 @@ var createRequest = (event) => {
50
50
  });
51
51
  };
52
52
  var isContentTypeBinary = (contentType) => {
53
- return !/^(text\/(plain|html|css|javascript|csv).*|application\/(.*json|.*xml).*|image\/svg\+xml)$/.test(
53
+ return !/^(text\/(plain|html|css|javascript|csv).*|application\/(.*json|.*xml).*|image\/svg\+xml.*)$/.test(
54
54
  contentType
55
55
  );
56
56
  };
@@ -161,7 +161,7 @@ const isProxyEventV2 = (event) => {
161
161
  return Object.prototype.hasOwnProperty.call(event, "rawPath");
162
162
  };
163
163
  const isContentTypeBinary = (contentType) => {
164
- return !/^(text\/(plain|html|css|javascript|csv).*|application\/(.*json|.*xml).*|image\/svg\+xml)$/.test(
164
+ return !/^(text\/(plain|html|css|javascript|csv).*|application\/(.*json|.*xml).*|image\/svg\+xml.*)$/.test(
165
165
  contentType
166
166
  );
167
167
  };
@@ -79,7 +79,7 @@ const createRequest = (event) => {
79
79
  });
80
80
  };
81
81
  const isContentTypeBinary = (contentType) => {
82
- return !/^(text\/(plain|html|css|javascript|csv).*|application\/(.*json|.*xml).*|image\/svg\+xml)$/.test(
82
+ return !/^(text\/(plain|html|css|javascript|csv).*|application\/(.*json|.*xml).*|image\/svg\+xml.*)$/.test(
83
83
  contentType
84
84
  );
85
85
  };
@@ -45,7 +45,7 @@ var import_http_exception = require("./http-exception");
45
45
  var import_request = require("./request");
46
46
  var import_router = require("./router");
47
47
  var import_url = require("./utils/url");
48
- var _basePath, _path;
48
+ var _path;
49
49
  function defineDynamicClass() {
50
50
  return class {
51
51
  };
@@ -64,7 +64,7 @@ const errorHandler = (err, c) => {
64
64
  const _Hono = class extends defineDynamicClass() {
65
65
  constructor(options = {}) {
66
66
  super();
67
- __privateAdd(this, _basePath, "/");
67
+ this._basePath = "/";
68
68
  __privateAdd(this, _path, "/");
69
69
  this.routes = [];
70
70
  this.notFoundHandler = notFoundHandler;
@@ -160,7 +160,7 @@ const _Hono = class extends defineDynamicClass() {
160
160
  }
161
161
  basePath(path) {
162
162
  const subApp = this.clone();
163
- __privateSet(subApp, _basePath, (0, import_url.mergePath)(__privateGet(this, _basePath), path));
163
+ subApp._basePath = (0, import_url.mergePath)(this._basePath, path);
164
164
  return subApp;
165
165
  }
166
166
  onError(handler) {
@@ -180,7 +180,7 @@ const _Hono = class extends defineDynamicClass() {
180
180
  });
181
181
  }
182
182
  mount(path, applicationHandler, optionHandler) {
183
- const mergedPath = (0, import_url.mergePath)(__privateGet(this, _basePath), path);
183
+ const mergedPath = (0, import_url.mergePath)(this._basePath, path);
184
184
  const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
185
185
  const handler = async (c, next) => {
186
186
  let executionContext = void 0;
@@ -211,7 +211,7 @@ const _Hono = class extends defineDynamicClass() {
211
211
  }
212
212
  addRoute(method, path, handler) {
213
213
  method = method.toUpperCase();
214
- path = (0, import_url.mergePath)(__privateGet(this, _basePath), path);
214
+ path = (0, import_url.mergePath)(this._basePath, path);
215
215
  const r = { path, method, handler };
216
216
  this.router.add(method, path, [handler, r]);
217
217
  this.routes.push(r);
@@ -279,7 +279,6 @@ const _Hono = class extends defineDynamicClass() {
279
279
  }
280
280
  };
281
281
  let Hono = _Hono;
282
- _basePath = new WeakMap();
283
282
  _path = new WeakMap();
284
283
  // Annotate the CommonJS export names for ESM import in node:
285
284
  0 && (module.exports = {
package/dist/hono-base.js CHANGED
@@ -39,11 +39,11 @@ var errorHandler = (err, c) => {
39
39
  const message = "Internal Server Error";
40
40
  return c.text(message, 500);
41
41
  };
42
- var _basePath, _path;
42
+ var _path;
43
43
  var _Hono = class extends defineDynamicClass() {
44
44
  constructor(options = {}) {
45
45
  super();
46
- __privateAdd(this, _basePath, "/");
46
+ this._basePath = "/";
47
47
  __privateAdd(this, _path, "/");
48
48
  this.routes = [];
49
49
  this.notFoundHandler = notFoundHandler;
@@ -139,7 +139,7 @@ var _Hono = class extends defineDynamicClass() {
139
139
  }
140
140
  basePath(path) {
141
141
  const subApp = this.clone();
142
- __privateSet(subApp, _basePath, mergePath(__privateGet(this, _basePath), path));
142
+ subApp._basePath = mergePath(this._basePath, path);
143
143
  return subApp;
144
144
  }
145
145
  onError(handler) {
@@ -159,7 +159,7 @@ var _Hono = class extends defineDynamicClass() {
159
159
  });
160
160
  }
161
161
  mount(path, applicationHandler, optionHandler) {
162
- const mergedPath = mergePath(__privateGet(this, _basePath), path);
162
+ const mergedPath = mergePath(this._basePath, path);
163
163
  const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
164
164
  const handler = async (c, next) => {
165
165
  let executionContext = void 0;
@@ -190,7 +190,7 @@ var _Hono = class extends defineDynamicClass() {
190
190
  }
191
191
  addRoute(method, path, handler) {
192
192
  method = method.toUpperCase();
193
- path = mergePath(__privateGet(this, _basePath), path);
193
+ path = mergePath(this._basePath, path);
194
194
  const r = { path, method, handler };
195
195
  this.router.add(method, path, [handler, r]);
196
196
  this.routes.push(r);
@@ -258,7 +258,6 @@ var _Hono = class extends defineDynamicClass() {
258
258
  }
259
259
  };
260
260
  var Hono = _Hono;
261
- _basePath = new WeakMap();
262
261
  _path = new WeakMap();
263
262
  export {
264
263
  Hono as HonoBase
@@ -17,7 +17,7 @@ declare type ClientRequest<S extends Schema> = {
17
17
  } & {
18
18
  $url: () => URL;
19
19
  };
20
- declare type BlankRecordToNever<T> = keyof T extends never ? never : T;
20
+ declare type BlankRecordToNever<T> = T extends any ? (keyof T extends never ? never : T) : never;
21
21
  export interface ClientResponse<T> {
22
22
  ok: boolean;
23
23
  status: number;
@@ -27,6 +27,7 @@ declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends
27
27
  #private;
28
28
  router: Router<[H, RouterRoute]>;
29
29
  readonly getPath: GetPath<E>;
30
+ private _basePath;
30
31
  routes: RouterRoute[];
31
32
  constructor(options?: HonoOptions<E>);
32
33
  private clone;
@@ -306,7 +306,7 @@ export declare type Schema = {
306
306
  input: Partial<ValidationTargets> & {
307
307
  param?: Record<string, string>;
308
308
  };
309
- output: {};
309
+ output: any;
310
310
  };
311
311
  };
312
312
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono",
3
- "version": "3.11.2",
3
+ "version": "3.11.4",
4
4
  "description": "Ultrafast web framework for the Edges",
5
5
  "main": "dist/cjs/index.js",
6
6
  "type": "module",