@hono/node-server 2.0.0-rc.1 → 2.0.0-rc.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 +55 -11
- package/dist/{listener-Brd4yZ5d.js → index.cjs} +388 -108
- package/dist/{index.d.ts → index.d.cts} +12 -1
- package/dist/index.d.mts +12 -1
- package/dist/index.mjs +981 -4
- package/dist/{serve-static.js → serve-static.cjs} +1 -1
- package/dist/serve-static.mjs +1 -1
- package/dist/utils/{response.js → response.cjs} +1 -1
- package/dist/utils/response.mjs +1 -1
- package/package.json +44 -29
- package/dist/index.js +0 -28
- package/dist/listener-RIBxK9_x.mjs +0 -715
- package/dist/vercel.d.mts +0 -8
- package/dist/vercel.d.ts +0 -8
- package/dist/vercel.js +0 -10
- package/dist/vercel.mjs +0 -9
- /package/dist/{conninfo.js → conninfo.cjs} +0 -0
- /package/dist/{conninfo.d.ts → conninfo.d.cts} +0 -0
- /package/dist/{constants-DEKKqoym.mjs → constants-BLSFu_RU.mjs} +0 -0
- /package/dist/{constants-B7DBcQew.js → constants-BXAKTxRC.cjs} +0 -0
- /package/dist/{serve-static.d.ts → serve-static.d.cts} +0 -0
- /package/dist/utils/{response.d.ts → response.d.cts} +0 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { AddressInfo } from "node:net";
|
|
2
|
+
import { WebSocket, WebSocketServer } from "ws";
|
|
2
3
|
import { IncomingMessage, Server, ServerOptions, ServerResponse, createServer } from "node:http";
|
|
3
4
|
import { Http2SecureServer, Http2Server, Http2ServerRequest, Http2ServerResponse, SecureServerOptions, ServerOptions as ServerOptions$1, createSecureServer, createServer as createServer$1 } from "node:http2";
|
|
4
5
|
import { ServerOptions as ServerOptions$2, createServer as createServer$2 } from "node:https";
|
|
6
|
+
import { UpgradeWebSocket } from "hono/ws";
|
|
5
7
|
|
|
6
8
|
//#region src/types.d.ts
|
|
7
9
|
type HttpBindings = {
|
|
@@ -37,6 +39,9 @@ type Options = {
|
|
|
37
39
|
autoCleanupIncoming?: boolean;
|
|
38
40
|
port?: number;
|
|
39
41
|
hostname?: string;
|
|
42
|
+
websocket?: {
|
|
43
|
+
server: WebSocketServer;
|
|
44
|
+
};
|
|
40
45
|
} & ServerOptions$3;
|
|
41
46
|
type CustomErrorHandler = (err: unknown) => void | Response | Promise<void | Response>;
|
|
42
47
|
//#endregion
|
|
@@ -44,6 +49,12 @@ type CustomErrorHandler = (err: unknown) => void | Response | Promise<void | Res
|
|
|
44
49
|
declare const createAdaptorServer: (options: Options) => ServerType;
|
|
45
50
|
declare const serve: (options: Options, listeningListener?: (info: AddressInfo) => void) => ServerType;
|
|
46
51
|
//#endregion
|
|
52
|
+
//#region src/websocket.d.ts
|
|
53
|
+
type UpgradeWebSocketOptions = {
|
|
54
|
+
onError: (err: unknown) => void;
|
|
55
|
+
};
|
|
56
|
+
declare const upgradeWebSocket: UpgradeWebSocket<WebSocket, UpgradeWebSocketOptions>;
|
|
57
|
+
//#endregion
|
|
47
58
|
//#region src/listener.d.ts
|
|
48
59
|
declare const getRequestListener: (fetchCallback: FetchCallback, options?: {
|
|
49
60
|
hostname?: string;
|
|
@@ -59,4 +70,4 @@ declare class RequestError extends Error {
|
|
|
59
70
|
});
|
|
60
71
|
}
|
|
61
72
|
//#endregion
|
|
62
|
-
export { type Http2Bindings, type HttpBindings, RequestError, type ServerType, createAdaptorServer, getRequestListener, serve };
|
|
73
|
+
export { type Http2Bindings, type HttpBindings, RequestError, type ServerType, createAdaptorServer, getRequestListener, serve, upgradeWebSocket };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { IncomingMessage, Server, ServerOptions, ServerResponse, createServer } from "node:http";
|
|
2
2
|
import { Http2SecureServer, Http2Server, Http2ServerRequest, Http2ServerResponse, SecureServerOptions, ServerOptions as ServerOptions$1, createSecureServer, createServer as createServer$1 } from "node:http2";
|
|
3
|
+
import { UpgradeWebSocket } from "hono/ws";
|
|
3
4
|
import { AddressInfo } from "node:net";
|
|
5
|
+
import { WebSocket, WebSocketServer } from "ws";
|
|
4
6
|
import { ServerOptions as ServerOptions$2, createServer as createServer$2 } from "node:https";
|
|
5
7
|
|
|
6
8
|
//#region src/types.d.ts
|
|
@@ -37,6 +39,9 @@ type Options = {
|
|
|
37
39
|
autoCleanupIncoming?: boolean;
|
|
38
40
|
port?: number;
|
|
39
41
|
hostname?: string;
|
|
42
|
+
websocket?: {
|
|
43
|
+
server: WebSocketServer;
|
|
44
|
+
};
|
|
40
45
|
} & ServerOptions$3;
|
|
41
46
|
type CustomErrorHandler = (err: unknown) => void | Response | Promise<void | Response>;
|
|
42
47
|
//#endregion
|
|
@@ -44,6 +49,12 @@ type CustomErrorHandler = (err: unknown) => void | Response | Promise<void | Res
|
|
|
44
49
|
declare const createAdaptorServer: (options: Options) => ServerType;
|
|
45
50
|
declare const serve: (options: Options, listeningListener?: (info: AddressInfo) => void) => ServerType;
|
|
46
51
|
//#endregion
|
|
52
|
+
//#region src/websocket.d.ts
|
|
53
|
+
type UpgradeWebSocketOptions = {
|
|
54
|
+
onError: (err: unknown) => void;
|
|
55
|
+
};
|
|
56
|
+
declare const upgradeWebSocket: UpgradeWebSocket<WebSocket, UpgradeWebSocketOptions>;
|
|
57
|
+
//#endregion
|
|
47
58
|
//#region src/listener.d.ts
|
|
48
59
|
declare const getRequestListener: (fetchCallback: FetchCallback, options?: {
|
|
49
60
|
hostname?: string;
|
|
@@ -59,4 +70,4 @@ declare class RequestError extends Error {
|
|
|
59
70
|
});
|
|
60
71
|
}
|
|
61
72
|
//#endregion
|
|
62
|
-
export { type Http2Bindings, type HttpBindings, RequestError, type ServerType, createAdaptorServer, getRequestListener, serve };
|
|
73
|
+
export { type Http2Bindings, type HttpBindings, RequestError, type ServerType, createAdaptorServer, getRequestListener, serve, upgradeWebSocket };
|