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/
|
|
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
|
[](https://github.com/honojs/hono/actions)
|
|
17
|
-
[](https://github.com/honojs/hono/blob/
|
|
17
|
+
[](https://github.com/honojs/hono/blob/main/LICENSE)
|
|
18
18
|
[](https://www.npmjs.com/package/hono)
|
|
19
19
|
[](https://www.npmjs.com/package/hono)
|
|
20
20
|
[](https://www.npmjs.com/package/hono)
|
|
21
21
|
[](https://github.com/honojs/hono/pulse)
|
|
22
|
-
[](https://github.com/honojs/hono/commits/
|
|
22
|
+
[](https://github.com/honojs/hono/commits/main)
|
|
23
23
|
[](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) =>
|
|
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
|
|
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);
|