@hono/node-server 1.19.9 → 1.19.10
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/LICENSE +21 -0
- package/README.md +4 -3
- package/dist/globals.d.mts +1 -1
- package/dist/globals.d.ts +1 -1
- package/dist/request.d.mts +1 -1
- package/dist/request.d.ts +1 -1
- package/dist/response.d.mts +1 -1
- package/dist/response.d.ts +1 -1
- package/dist/serve-static.d.mts +1 -1
- package/dist/serve-static.d.ts +1 -1
- package/dist/serve-static.js +15 -1
- package/dist/serve-static.mjs +15 -1
- package/dist/types.d.mts +3 -3
- package/dist/types.d.ts +3 -3
- package/dist/utils.d.mts +2 -2
- package/dist/utils.d.ts +2 -2
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 - present, Yusuke Wada and Hono contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -335,7 +335,7 @@ import { createAdaptorServer } from '@hono/node-server'
|
|
|
335
335
|
|
|
336
336
|
// ...
|
|
337
337
|
|
|
338
|
-
const socketPath ='/tmp/example.sock'
|
|
338
|
+
const socketPath = '/tmp/example.sock'
|
|
339
339
|
|
|
340
340
|
const server = createAdaptorServer(app)
|
|
341
341
|
server.listen(socketPath, () => {
|
|
@@ -348,9 +348,10 @@ server.listen(socketPath, () => {
|
|
|
348
348
|
- Hono - <https://hono.dev>
|
|
349
349
|
- Hono GitHub repository - <https://github.com/honojs/hono>
|
|
350
350
|
|
|
351
|
-
##
|
|
351
|
+
## Authors
|
|
352
352
|
|
|
353
|
-
Yusuke Wada <https://github.com/yusukebe>
|
|
353
|
+
- Yusuke Wada <https://github.com/yusukebe>
|
|
354
|
+
- Taku Amano <https://github.com/usualoma>
|
|
354
355
|
|
|
355
356
|
## License
|
|
356
357
|
|
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/request.d.mts
CHANGED
|
@@ -22,4 +22,4 @@ declare const abortControllerKey: unique symbol;
|
|
|
22
22
|
declare const getAbortController: unique symbol;
|
|
23
23
|
declare const newRequest: (incoming: IncomingMessage | Http2ServerRequest, defaultHostname?: string) => any;
|
|
24
24
|
|
|
25
|
-
export { GlobalRequest, IncomingMessageWithWrapBodyStream, Request, RequestError, abortControllerKey, getAbortController, newRequest, toRequestError, wrapBodyStream };
|
|
25
|
+
export { GlobalRequest, type IncomingMessageWithWrapBodyStream, Request, RequestError, abortControllerKey, getAbortController, newRequest, toRequestError, wrapBodyStream };
|
package/dist/request.d.ts
CHANGED
|
@@ -22,4 +22,4 @@ declare const abortControllerKey: unique symbol;
|
|
|
22
22
|
declare const getAbortController: unique symbol;
|
|
23
23
|
declare const newRequest: (incoming: IncomingMessage | Http2ServerRequest, defaultHostname?: string) => any;
|
|
24
24
|
|
|
25
|
-
export { GlobalRequest, IncomingMessageWithWrapBodyStream, Request, RequestError, abortControllerKey, getAbortController, newRequest, toRequestError, wrapBodyStream };
|
|
25
|
+
export { GlobalRequest, type IncomingMessageWithWrapBodyStream, Request, RequestError, abortControllerKey, getAbortController, newRequest, toRequestError, wrapBodyStream };
|
package/dist/response.d.mts
CHANGED
package/dist/response.d.ts
CHANGED
package/dist/serve-static.d.mts
CHANGED
package/dist/serve-static.d.ts
CHANGED
package/dist/serve-static.js
CHANGED
|
@@ -70,6 +70,20 @@ var getStats = (path) => {
|
|
|
70
70
|
}
|
|
71
71
|
return stats;
|
|
72
72
|
};
|
|
73
|
+
var tryDecode = (str, decoder) => {
|
|
74
|
+
try {
|
|
75
|
+
return decoder(str);
|
|
76
|
+
} catch {
|
|
77
|
+
return str.replace(/(?:%[0-9A-Fa-f]{2})+/g, (match) => {
|
|
78
|
+
try {
|
|
79
|
+
return decoder(match);
|
|
80
|
+
} catch {
|
|
81
|
+
return match;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
var tryDecodeURI = (str) => tryDecode(str, decodeURI);
|
|
73
87
|
var serveStatic = (options = { root: "" }) => {
|
|
74
88
|
const root = options.root || "";
|
|
75
89
|
const optionPath = options.path;
|
|
@@ -85,7 +99,7 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
85
99
|
filename = optionPath;
|
|
86
100
|
} else {
|
|
87
101
|
try {
|
|
88
|
-
filename =
|
|
102
|
+
filename = tryDecodeURI(c.req.path);
|
|
89
103
|
if (/(?:^|[\/\\])\.\.(?:$|[\/\\])/.test(filename)) {
|
|
90
104
|
throw new Error();
|
|
91
105
|
}
|
package/dist/serve-static.mjs
CHANGED
|
@@ -46,6 +46,20 @@ var getStats = (path) => {
|
|
|
46
46
|
}
|
|
47
47
|
return stats;
|
|
48
48
|
};
|
|
49
|
+
var tryDecode = (str, decoder) => {
|
|
50
|
+
try {
|
|
51
|
+
return decoder(str);
|
|
52
|
+
} catch {
|
|
53
|
+
return str.replace(/(?:%[0-9A-Fa-f]{2})+/g, (match) => {
|
|
54
|
+
try {
|
|
55
|
+
return decoder(match);
|
|
56
|
+
} catch {
|
|
57
|
+
return match;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var tryDecodeURI = (str) => tryDecode(str, decodeURI);
|
|
49
63
|
var serveStatic = (options = { root: "" }) => {
|
|
50
64
|
const root = options.root || "";
|
|
51
65
|
const optionPath = options.path;
|
|
@@ -61,7 +75,7 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
61
75
|
filename = optionPath;
|
|
62
76
|
} else {
|
|
63
77
|
try {
|
|
64
|
-
filename =
|
|
78
|
+
filename = tryDecodeURI(c.req.path);
|
|
65
79
|
if (/(?:^|[\/\\])\.\.(?:$|[\/\\])/.test(filename)) {
|
|
66
80
|
throw new Error();
|
|
67
81
|
}
|
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 = {
|
|
@@ -41,4 +41,4 @@ type Options = {
|
|
|
41
41
|
} & ServerOptions;
|
|
42
42
|
type CustomErrorHandler = (err: unknown) => void | Response | Promise<void | Response>;
|
|
43
43
|
|
|
44
|
-
export { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerOptions, ServerType };
|
|
44
|
+
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 = {
|
|
@@ -41,4 +41,4 @@ type Options = {
|
|
|
41
41
|
} & ServerOptions;
|
|
42
42
|
type CustomErrorHandler = (err: unknown) => void | Response | Promise<void | Response>;
|
|
43
43
|
|
|
44
|
-
export { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerOptions, ServerType };
|
|
44
|
+
export type { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerOptions, ServerType };
|
package/dist/utils.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import { OutgoingHttpHeaders } from 'node:http';
|
|
|
2
2
|
import { Writable } from 'node:stream';
|
|
3
3
|
|
|
4
4
|
declare function readWithoutBlocking(readPromise: Promise<ReadableStreamReadResult<Uint8Array>>): Promise<ReadableStreamReadResult<Uint8Array> | undefined>;
|
|
5
|
-
declare function writeFromReadableStreamDefaultReader(reader: ReadableStreamDefaultReader<Uint8Array>, writable: Writable, currentReadPromise?: Promise<ReadableStreamReadResult<Uint8Array>> | undefined): Promise<
|
|
6
|
-
declare function writeFromReadableStream(stream: ReadableStream<Uint8Array>, writable: Writable): Promise<
|
|
5
|
+
declare function writeFromReadableStreamDefaultReader(reader: ReadableStreamDefaultReader<Uint8Array>, writable: Writable, currentReadPromise?: Promise<ReadableStreamReadResult<Uint8Array>> | undefined): Promise<undefined>;
|
|
6
|
+
declare function writeFromReadableStream(stream: ReadableStream<Uint8Array>, writable: Writable): Promise<undefined> | undefined;
|
|
7
7
|
declare const buildOutgoingHttpHeaders: (headers: Headers | HeadersInit | null | undefined) => OutgoingHttpHeaders;
|
|
8
8
|
|
|
9
9
|
export { buildOutgoingHttpHeaders, readWithoutBlocking, writeFromReadableStream, writeFromReadableStreamDefaultReader };
|
package/dist/utils.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { OutgoingHttpHeaders } from 'node:http';
|
|
|
2
2
|
import { Writable } from 'node:stream';
|
|
3
3
|
|
|
4
4
|
declare function readWithoutBlocking(readPromise: Promise<ReadableStreamReadResult<Uint8Array>>): Promise<ReadableStreamReadResult<Uint8Array> | undefined>;
|
|
5
|
-
declare function writeFromReadableStreamDefaultReader(reader: ReadableStreamDefaultReader<Uint8Array>, writable: Writable, currentReadPromise?: Promise<ReadableStreamReadResult<Uint8Array>> | undefined): Promise<
|
|
6
|
-
declare function writeFromReadableStream(stream: ReadableStream<Uint8Array>, writable: Writable): Promise<
|
|
5
|
+
declare function writeFromReadableStreamDefaultReader(reader: ReadableStreamDefaultReader<Uint8Array>, writable: Writable, currentReadPromise?: Promise<ReadableStreamReadResult<Uint8Array>> | undefined): Promise<undefined>;
|
|
6
|
+
declare function writeFromReadableStream(stream: ReadableStream<Uint8Array>, writable: Writable): Promise<undefined> | undefined;
|
|
7
7
|
declare const buildOutgoingHttpHeaders: (headers: Headers | HeadersInit | null | undefined) => OutgoingHttpHeaders;
|
|
8
8
|
|
|
9
9
|
export { buildOutgoingHttpHeaders, readWithoutBlocking, writeFromReadableStream, writeFromReadableStreamDefaultReader };
|