@vitejs/devtools-rpc 0.0.0-alpha.31 → 0.0.0-alpha.32
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RpcServerPreset } from "../index.mjs";
|
|
2
2
|
import { BirpcGroup, BirpcOptions } from "birpc";
|
|
3
|
+
import { ServerOptions } from "node:https";
|
|
3
4
|
import { IncomingMessage } from "node:http";
|
|
4
5
|
import { WebSocket } from "ws";
|
|
5
6
|
|
|
@@ -14,6 +15,7 @@ interface DevToolsNodeRpcSessionMeta {
|
|
|
14
15
|
interface WebSocketRpcServerOptions {
|
|
15
16
|
port: number;
|
|
16
17
|
host?: string;
|
|
18
|
+
https?: ServerOptions | undefined;
|
|
17
19
|
onConnected?: (ws: WebSocket, req: IncomingMessage, meta: DevToolsNodeRpcSessionMeta) => void;
|
|
18
20
|
onDisconnected?: (ws: WebSocket, meta: DevToolsNodeRpcSessionMeta) => void;
|
|
19
21
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineRpcServerPreset } from "../index.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { parse, stringify } from "structured-clone-es";
|
|
4
|
+
import { createServer } from "node:https";
|
|
4
5
|
|
|
5
6
|
//#region \0rolldown/runtime.js
|
|
6
7
|
var __create = Object.create;
|
|
@@ -3563,8 +3564,9 @@ var import_websocket_server = /* @__PURE__ */ __toESM(require_websocket_server()
|
|
|
3563
3564
|
let id = 0;
|
|
3564
3565
|
function NOOP() {}
|
|
3565
3566
|
const createWsRpcPreset = defineRpcServerPreset((options) => {
|
|
3566
|
-
const { port, host = "localhost", onConnected = NOOP, onDisconnected = NOOP } = options;
|
|
3567
|
-
const
|
|
3567
|
+
const { port, https, host = "localhost", onConnected = NOOP, onDisconnected = NOOP } = options;
|
|
3568
|
+
const httpsServer = https ? createServer(https) : void 0;
|
|
3569
|
+
const wss = https ? new import_websocket_server.default({ server: httpsServer }) : new import_websocket_server.default({
|
|
3568
3570
|
port,
|
|
3569
3571
|
host
|
|
3570
3572
|
});
|
|
@@ -3601,6 +3603,7 @@ const createWsRpcPreset = defineRpcServerPreset((options) => {
|
|
|
3601
3603
|
});
|
|
3602
3604
|
onConnected(ws, req, meta);
|
|
3603
3605
|
});
|
|
3606
|
+
httpsServer?.listen(port, host);
|
|
3604
3607
|
};
|
|
3605
3608
|
});
|
|
3606
3609
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitejs/devtools-rpc",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-alpha.
|
|
4
|
+
"version": "0.0.0-alpha.32",
|
|
5
5
|
"description": "Vite DevTools RPC Layer",
|
|
6
6
|
"author": "VoidZero Inc.",
|
|
7
7
|
"license": "MIT",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"valibot": "^1.2.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"tsdown": "^0.20.
|
|
47
|
+
"tsdown": "^0.20.3",
|
|
48
48
|
"ws": "^8.19.0"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|