@hono/node-server 1.14.4 → 1.15.0
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/dist/globals.d.mts +1 -1
- package/dist/globals.d.ts +1 -1
- package/dist/response.d.mts +1 -1
- package/dist/response.d.ts +1 -1
- package/dist/serve-static.d.mts +3 -3
- package/dist/serve-static.d.ts +3 -3
- package/dist/serve-static.js +2 -2
- package/dist/serve-static.mjs +2 -2
- package/dist/types.d.mts +3 -3
- package/dist/types.d.ts +3 -3
- package/dist/utils.d.mts +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +1 -1
package/dist/globals.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
export {
|
|
2
|
+
export { }
|
package/dist/globals.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
export {
|
|
2
|
+
export { }
|
package/dist/response.d.mts
CHANGED
package/dist/response.d.ts
CHANGED
package/dist/serve-static.d.mts
CHANGED
|
@@ -8,10 +8,10 @@ type ServeStaticOptions<E extends Env = Env> = {
|
|
|
8
8
|
path?: string;
|
|
9
9
|
index?: string;
|
|
10
10
|
precompressed?: boolean;
|
|
11
|
-
rewriteRequestPath?: (path: string) => string;
|
|
11
|
+
rewriteRequestPath?: (path: string, c: Context<E>) => string;
|
|
12
12
|
onFound?: (path: string, c: Context<E>) => void | Promise<void>;
|
|
13
13
|
onNotFound?: (path: string, c: Context<E>) => void | Promise<void>;
|
|
14
14
|
};
|
|
15
|
-
declare const serveStatic: (options?: ServeStaticOptions) => MiddlewareHandler
|
|
15
|
+
declare const serveStatic: <E extends Env = any>(options?: ServeStaticOptions<E>) => MiddlewareHandler<E>;
|
|
16
16
|
|
|
17
|
-
export { ServeStaticOptions, serveStatic };
|
|
17
|
+
export { type ServeStaticOptions, serveStatic };
|
package/dist/serve-static.d.ts
CHANGED
|
@@ -8,10 +8,10 @@ type ServeStaticOptions<E extends Env = Env> = {
|
|
|
8
8
|
path?: string;
|
|
9
9
|
index?: string;
|
|
10
10
|
precompressed?: boolean;
|
|
11
|
-
rewriteRequestPath?: (path: string) => string;
|
|
11
|
+
rewriteRequestPath?: (path: string, c: Context<E>) => string;
|
|
12
12
|
onFound?: (path: string, c: Context<E>) => void | Promise<void>;
|
|
13
13
|
onNotFound?: (path: string, c: Context<E>) => void | Promise<void>;
|
|
14
14
|
};
|
|
15
|
-
declare const serveStatic: (options?: ServeStaticOptions) => MiddlewareHandler
|
|
15
|
+
declare const serveStatic: <E extends Env = any>(options?: ServeStaticOptions<E>) => MiddlewareHandler<E>;
|
|
16
16
|
|
|
17
|
-
export { ServeStaticOptions, serveStatic };
|
|
17
|
+
export { type ServeStaticOptions, serveStatic };
|
package/dist/serve-static.js
CHANGED
|
@@ -73,7 +73,7 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
73
73
|
return next();
|
|
74
74
|
}
|
|
75
75
|
let path = (0, import_filepath.getFilePathWithoutDefaultDocument)({
|
|
76
|
-
filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,
|
|
76
|
+
filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename, c) : filename,
|
|
77
77
|
root: options.root
|
|
78
78
|
});
|
|
79
79
|
if (path) {
|
|
@@ -84,7 +84,7 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
84
84
|
let stats = getStats(path);
|
|
85
85
|
if (stats && stats.isDirectory()) {
|
|
86
86
|
path = (0, import_filepath.getFilePath)({
|
|
87
|
-
filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,
|
|
87
|
+
filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename, c) : filename,
|
|
88
88
|
root: options.root,
|
|
89
89
|
defaultDocument: options.index ?? "index.html"
|
|
90
90
|
});
|
package/dist/serve-static.mjs
CHANGED
|
@@ -49,7 +49,7 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
49
49
|
return next();
|
|
50
50
|
}
|
|
51
51
|
let path = getFilePathWithoutDefaultDocument({
|
|
52
|
-
filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,
|
|
52
|
+
filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename, c) : filename,
|
|
53
53
|
root: options.root
|
|
54
54
|
});
|
|
55
55
|
if (path) {
|
|
@@ -60,7 +60,7 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
60
60
|
let stats = getStats(path);
|
|
61
61
|
if (stats && stats.isDirectory()) {
|
|
62
62
|
path = getFilePath({
|
|
63
|
-
filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,
|
|
63
|
+
filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename, c) : filename,
|
|
64
64
|
root: options.root,
|
|
65
65
|
defaultDocument: options.index ?? "index.html"
|
|
66
66
|
});
|
package/dist/types.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IncomingMessage, ServerResponse,
|
|
2
|
-
import { Http2ServerRequest, Http2ServerResponse,
|
|
1
|
+
import { IncomingMessage, ServerResponse, ServerOptions as ServerOptions$1, createServer, Server } from 'node:http';
|
|
2
|
+
import { Http2ServerRequest, Http2ServerResponse, ServerOptions as ServerOptions$3, createServer as createServer$2, SecureServerOptions, createSecureServer, Http2Server, Http2SecureServer } from 'node:http2';
|
|
3
3
|
import { ServerOptions as ServerOptions$2, createServer as createServer$1 } from 'node:https';
|
|
4
4
|
|
|
5
5
|
type HttpBindings = {
|
|
@@ -40,4 +40,4 @@ type Options = {
|
|
|
40
40
|
} & ServerOptions;
|
|
41
41
|
type CustomErrorHandler = (err: unknown) => void | Response | Promise<void | Response>;
|
|
42
42
|
|
|
43
|
-
export { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerOptions, ServerType };
|
|
43
|
+
export type { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerOptions, ServerType };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IncomingMessage, ServerResponse,
|
|
2
|
-
import { Http2ServerRequest, Http2ServerResponse,
|
|
1
|
+
import { IncomingMessage, ServerResponse, ServerOptions as ServerOptions$1, createServer, Server } from 'node:http';
|
|
2
|
+
import { Http2ServerRequest, Http2ServerResponse, ServerOptions as ServerOptions$3, createServer as createServer$2, SecureServerOptions, createSecureServer, Http2Server, Http2SecureServer } from 'node:http2';
|
|
3
3
|
import { ServerOptions as ServerOptions$2, createServer as createServer$1 } from 'node:https';
|
|
4
4
|
|
|
5
5
|
type HttpBindings = {
|
|
@@ -40,4 +40,4 @@ type Options = {
|
|
|
40
40
|
} & ServerOptions;
|
|
41
41
|
type CustomErrorHandler = (err: unknown) => void | Response | Promise<void | Response>;
|
|
42
42
|
|
|
43
|
-
export { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerOptions, ServerType };
|
|
43
|
+
export type { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerOptions, ServerType };
|
package/dist/utils.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OutgoingHttpHeaders } from 'node:http';
|
|
2
2
|
import { Writable } from 'node:stream';
|
|
3
3
|
|
|
4
|
-
declare function writeFromReadableStream(stream: ReadableStream<Uint8Array>, writable: Writable): Promise<
|
|
4
|
+
declare function writeFromReadableStream(stream: ReadableStream<Uint8Array>, writable: Writable): Promise<undefined> | undefined;
|
|
5
5
|
declare const buildOutgoingHttpHeaders: (headers: Headers | HeadersInit | null | undefined) => OutgoingHttpHeaders;
|
|
6
6
|
|
|
7
7
|
export { buildOutgoingHttpHeaders, writeFromReadableStream };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OutgoingHttpHeaders } from 'node:http';
|
|
2
2
|
import { Writable } from 'node:stream';
|
|
3
3
|
|
|
4
|
-
declare function writeFromReadableStream(stream: ReadableStream<Uint8Array>, writable: Writable): Promise<
|
|
4
|
+
declare function writeFromReadableStream(stream: ReadableStream<Uint8Array>, writable: Writable): Promise<undefined> | undefined;
|
|
5
5
|
declare const buildOutgoingHttpHeaders: (headers: Headers | HeadersInit | null | undefined) => OutgoingHttpHeaders;
|
|
6
6
|
|
|
7
7
|
export { buildOutgoingHttpHeaders, writeFromReadableStream };
|