hono 2.0.1 → 2.0.2

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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <div align="center">
2
2
  <a href="https://honojs.dev">
3
- <img src="https://raw.githubusercontent.com/honojs/hono/master/docs/images/hono-title.png" width="500" height="auto" alt="Hono"/>
3
+ <img src="https://raw.githubusercontent.com/honojs/hono/main/docs/images/hono-title.png" width="500" height="auto" alt="Hono"/>
4
4
  </a>
5
5
  </div>
6
6
 
@@ -14,12 +14,12 @@
14
14
  <hr />
15
15
 
16
16
  [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/honojs/hono/ci)](https://github.com/honojs/hono/actions)
17
- [![GitHub](https://img.shields.io/github/license/honojs/hono)](https://github.com/honojs/hono/blob/master/LICENSE)
17
+ [![GitHub](https://img.shields.io/github/license/honojs/hono)](https://github.com/honojs/hono/blob/main/LICENSE)
18
18
  [![npm](https://img.shields.io/npm/v/hono)](https://www.npmjs.com/package/hono)
19
19
  [![npm](https://img.shields.io/npm/dm/hono)](https://www.npmjs.com/package/hono)
20
20
  [![npm type definitions](https://img.shields.io/npm/types/hono)](https://www.npmjs.com/package/hono)
21
21
  [![GitHub commit activity](https://img.shields.io/github/commit-activity/m/honojs/hono)](https://github.com/honojs/hono/pulse)
22
- [![GitHub last commit](https://img.shields.io/github/last-commit/honojs/hono)](https://github.com/honojs/hono/commits/master)
22
+ [![GitHub last commit](https://img.shields.io/github/last-commit/honojs/hono)](https://github.com/honojs/hono/commits/main)
23
23
  [![Deno badge](https://img.shields.io/endpoint?url=https%3A%2F%2Fdeno-visualizer.danopia.net%2Fshields%2Flatest-version%2Fx%2Fhono%2Fmod.ts)](https://doc.deno.land/https/deno.land/x/hono/mod.ts)
24
24
 
25
25
  Hono - _**[炎] means flame🔥 in Japanese**_ - is a small, simple, and ultrafast web framework for Cloudflare Workers, Deno, Bun, and others.
package/dist/context.d.ts CHANGED
@@ -16,7 +16,7 @@ export interface Context<RequestParamKeyType extends string = string, E = Env> {
16
16
  header: (name: string, value: string) => void;
17
17
  status: (status: StatusCode) => void;
18
18
  set: (key: string, value: any) => void;
19
- get: (key: string) => any;
19
+ get: <T = any>(key: string) => T;
20
20
  pretty: (prettyJSON: boolean, space?: number) => void;
21
21
  newResponse: (data: Data | null, status: StatusCode, headers: Headers) => Response;
22
22
  body: (data: Data | null, status?: StatusCode, headers?: Headers) => Response;
@@ -1,5 +1,5 @@
1
1
  import type { Context } from '../../context';
2
2
  import type { Next } from '../../hono';
3
3
  declare type PrintFunc = (str: string, ...rest: string[]) => void;
4
- export declare const logger: (fn: PrintFunc) => (c: Context, next: Next) => Promise<void>;
4
+ export declare const logger: (fn?: PrintFunc) => (c: Context, next: Next) => Promise<void>;
5
5
  export {};
@@ -36,7 +36,7 @@ function log(fn, prefix, method, path, status = 0, elapsed) {
36
36
  : ` ${prefix} ${method} ${path} ${colorStatus(status)} ${elapsed}`;
37
37
  fn(out);
38
38
  }
39
- const logger = (fn) => {
39
+ const logger = (fn = console.log) => {
40
40
  return async (c, next) => {
41
41
  const { method } = c.req;
42
42
  const path = (0, url_1.getPathFromURL)(c.req.url);
@@ -6,6 +6,7 @@ import { serveStatic } from './serve-static';
6
6
  const module = (options = { root: '' }) => {
7
7
  return serveStatic({
8
8
  root: options.root,
9
+ path: options.path,
9
10
  manifest: options.manifest ? options.manifest : manifest,
10
11
  });
11
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Ultrafast web framework for Cloudflare Workers.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",