hono 2.2.0 → 2.2.1

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,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HonoContext = void 0;
4
- const hono_1 = require("./hono");
5
4
  const cookie_1 = require("./utils/cookie");
6
5
  class HonoContext {
7
6
  constructor(req, env = undefined, executionCtx = undefined, notFoundHandler = () => new Response()) {
@@ -31,7 +30,7 @@ class HonoContext {
31
30
  }
32
31
  }
33
32
  get res() {
34
- return (this._res || (this._res = new Response(hono_1.defaultNotFoundMessage, { status: 404 })));
33
+ return (this._res || (this._res = new Response('404 Not Found', { status: 404 })));
35
34
  }
36
35
  set res(_res) {
37
36
  this._res = _res;
package/dist/cjs/hono.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Hono = exports.defaultNotFoundMessage = void 0;
3
+ exports.Hono = void 0;
4
4
  const compose_1 = require("./compose");
5
5
  const context_1 = require("./context");
6
6
  const request_1 = require("./request");
@@ -11,7 +11,6 @@ const smart_router_1 = require("./router/smart-router");
11
11
  const static_router_1 = require("./router/static-router");
12
12
  const trie_router_1 = require("./router/trie-router");
13
13
  const url_1 = require("./utils/url");
14
- exports.defaultNotFoundMessage = '404 Not Found';
15
14
  function defineDynamicClass() {
16
15
  return class {
17
16
  };
@@ -27,8 +26,7 @@ class Hono extends defineDynamicClass() {
27
26
  this.path = '/';
28
27
  this.routes = [];
29
28
  this.notFoundHandler = (c) => {
30
- const message = exports.defaultNotFoundMessage;
31
- return c.text(message, 404);
29
+ return c.text('404 Not Found', 404);
32
30
  };
33
31
  this.errorHandler = (err, c) => {
34
32
  console.error(`${err.stack || err.message}`);
package/dist/context.js CHANGED
@@ -1,4 +1,3 @@
1
- import { defaultNotFoundMessage } from './hono';
2
1
  import { serialize } from './utils/cookie';
3
2
  export class HonoContext {
4
3
  constructor(req, env = undefined, executionCtx = undefined, notFoundHandler = () => new Response()) {
@@ -28,7 +27,7 @@ export class HonoContext {
28
27
  }
29
28
  }
30
29
  get res() {
31
- return (this._res || (this._res = new Response(defaultNotFoundMessage, { status: 404 })));
30
+ return (this._res || (this._res = new Response('404 Not Found', { status: 404 })));
32
31
  }
33
32
  set res(_res) {
34
33
  this._res = _res;
package/dist/hono.d.ts CHANGED
@@ -15,7 +15,6 @@ export declare type MiddlewareHandler = <E extends Partial<Environment> = Enviro
15
15
  export declare type NotFoundHandler<E extends Partial<Environment> = Environment> = (c: Context<string, E>) => Response | Promise<Response>;
16
16
  export declare type ErrorHandler<E extends Partial<Environment> = Environment> = (err: Error, c: Context<string, E>) => Response;
17
17
  export declare type Next = () => Promise<void>;
18
- export declare const defaultNotFoundMessage = "404 Not Found";
19
18
  declare type ParamKeyName<NameWithPattern> = NameWithPattern extends `${infer Name}{${infer _Pattern}` ? Name : NameWithPattern;
20
19
  declare type ParamKey<Component> = Component extends `:${infer NameWithPattern}` ? ParamKeyName<NameWithPattern> : never;
21
20
  declare type ParamKeys<Path> = Path extends `${infer Component}/${infer Rest}` ? ParamKey<Component> | ParamKeys<Rest> : ParamKey<Path>;
package/dist/hono.js CHANGED
@@ -8,7 +8,6 @@ import { SmartRouter } from './router/smart-router';
8
8
  import { StaticRouter } from './router/static-router';
9
9
  import { TrieRouter } from './router/trie-router';
10
10
  import { getPathFromURL, mergePath } from './utils/url';
11
- export const defaultNotFoundMessage = '404 Not Found';
12
11
  function defineDynamicClass() {
13
12
  return class {
14
13
  };
@@ -24,8 +23,7 @@ export class Hono extends defineDynamicClass() {
24
23
  this.path = '/';
25
24
  this.routes = [];
26
25
  this.notFoundHandler = (c) => {
27
- const message = defaultNotFoundMessage;
28
- return c.text(message, 404);
26
+ return c.text('404 Not Found', 404);
29
27
  };
30
28
  this.errorHandler = (err, c) => {
31
29
  console.error(`${err.stack || err.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Ultrafast web framework for Cloudflare Workers.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",