@vitejs/devtools-rpc 0.0.0-alpha.1 → 0.0.0-alpha.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/dist/{index.d.mts → index.d.ts} +2 -3
- package/dist/presets/{index.d.mts → index.d.ts} +1 -1
- package/dist/presets/index.js +3 -0
- package/dist/presets/ws/{client.d.mts → client.d.ts} +1 -1
- package/dist/presets/ws/{client.mjs → client.js} +1 -1
- package/dist/presets/ws/{server.d.mts → server.d.ts} +2 -2
- package/dist/presets/ws/{server.mjs → server.js} +91 -107
- package/package.json +16 -13
- package/dist/presets/index.mjs +0 -3
- /package/{LICENSE.md → LICENSE} +0 -0
- /package/dist/{presets/index-CNN7vRfy.d.mts → index-BOWJO778.d.ts} +0 -0
- /package/dist/{index.mjs → index.js} +0 -0
- /package/dist/{presets/presets-B1cCNE-L.mjs → presets-CXNlz3L-.js} +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { BirpcGroup, BirpcOptions, EventOptions } from "birpc";
|
|
1
|
+
import { BirpcGroup, BirpcOptions, BirpcReturn, EventOptions } from "birpc";
|
|
3
2
|
|
|
4
3
|
//#region src/client.d.ts
|
|
5
4
|
declare function createRpcClient<ServerFunctions = Record<string, never>, ClientFunctions extends object = Record<string, never>>(functions: ClientFunctions, options: {
|
|
6
5
|
preset: BirpcOptions<ServerFunctions>;
|
|
7
6
|
rpcOptions?: Partial<BirpcOptions<ServerFunctions>>;
|
|
8
|
-
}):
|
|
7
|
+
}): BirpcReturn<ServerFunctions, ClientFunctions>;
|
|
9
8
|
//#endregion
|
|
10
9
|
//#region src/server.d.ts
|
|
11
10
|
declare function createRpcServer<ClientFunctions extends object = Record<string, never>, ServerFunctions extends object = Record<string, never>>(functions: ServerFunctions, options: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RpcClientPreset, RpcClientPresetBasicType, RpcClientPresetReturnType, RpcServerPreset, RpcServerPresetBasicType, RpcServerPresetReturnType, defineRpcClientPreset, defineRpcServerPreset } from "
|
|
1
|
+
import { RpcClientPreset, RpcClientPresetBasicType, RpcClientPresetReturnType, RpcServerPreset, RpcServerPresetBasicType, RpcServerPresetReturnType, defineRpcClientPreset, defineRpcServerPreset } from "../index-BOWJO778.js";
|
|
2
2
|
export { RpcClientPreset, RpcClientPresetBasicType, RpcClientPresetReturnType, RpcServerPreset, RpcServerPresetBasicType, RpcServerPresetReturnType, defineRpcClientPreset, defineRpcServerPreset };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RpcServerPreset } from "
|
|
1
|
+
import { RpcServerPreset } from "../../index-BOWJO778.js";
|
|
2
2
|
import { BirpcGroup, BirpcOptions } from "birpc";
|
|
3
3
|
import { WebSocket } from "ws";
|
|
4
4
|
|
|
@@ -8,6 +8,6 @@ interface WebSocketRpcServerOptions {
|
|
|
8
8
|
onConnected?: (ws: WebSocket) => void;
|
|
9
9
|
onDisconnected?: (ws: WebSocket) => void;
|
|
10
10
|
}
|
|
11
|
-
declare const createWsRpcPreset: RpcServerPreset<(options: WebSocketRpcServerOptions) => <ClientFunctions, ServerFunctions>(rpc: BirpcGroup<ClientFunctions, ServerFunctions>, options?: Pick<BirpcOptions<ClientFunctions>,
|
|
11
|
+
declare const createWsRpcPreset: RpcServerPreset<(options: WebSocketRpcServerOptions) => <ClientFunctions, ServerFunctions>(rpc: BirpcGroup<ClientFunctions, ServerFunctions>, options?: Pick<BirpcOptions<ClientFunctions>, 'serialize' | 'deserialize'>) => void>;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { WebSocketRpcServerOptions, createWsRpcPreset };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineRpcServerPreset } from "
|
|
1
|
+
import { defineRpcServerPreset } from "../../presets-CXNlz3L-.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { parse, stringify } from "structured-clone-es";
|
|
4
4
|
|
|
@@ -30,7 +30,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
30
30
|
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/constants.js
|
|
33
|
-
var require_constants = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/constants.js"(exports, module) {
|
|
33
|
+
var require_constants = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/constants.js": ((exports, module) => {
|
|
34
34
|
const BINARY_TYPES$2 = [
|
|
35
35
|
"nodebuffer",
|
|
36
36
|
"arraybuffer",
|
|
@@ -49,11 +49,11 @@ var require_constants = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
49
49
|
kWebSocket: Symbol("websocket"),
|
|
50
50
|
NOOP: () => {}
|
|
51
51
|
};
|
|
52
|
-
} });
|
|
52
|
+
}) });
|
|
53
53
|
|
|
54
54
|
//#endregion
|
|
55
55
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/buffer-util.js
|
|
56
|
-
var require_buffer_util = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/buffer-util.js"(exports, module) {
|
|
56
|
+
var require_buffer_util = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/buffer-util.js": ((exports, module) => {
|
|
57
57
|
const { EMPTY_BUFFER: EMPTY_BUFFER$3 } = require_constants();
|
|
58
58
|
const FastBuffer$2 = Buffer[Symbol.species];
|
|
59
59
|
/**
|
|
@@ -150,11 +150,11 @@ var require_buffer_util = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_
|
|
|
150
150
|
else bufferUtil$1.unmask(buffer, mask);
|
|
151
151
|
};
|
|
152
152
|
} catch (e) {}
|
|
153
|
-
} });
|
|
153
|
+
}) });
|
|
154
154
|
|
|
155
155
|
//#endregion
|
|
156
156
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/limiter.js
|
|
157
|
-
var require_limiter = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/limiter.js"(exports, module) {
|
|
157
|
+
var require_limiter = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/limiter.js": ((exports, module) => {
|
|
158
158
|
const kDone = Symbol("kDone");
|
|
159
159
|
const kRun = Symbol("kRun");
|
|
160
160
|
/**
|
|
@@ -202,11 +202,11 @@ var require_limiter = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modu
|
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
204
|
module.exports = Limiter$1;
|
|
205
|
-
} });
|
|
205
|
+
}) });
|
|
206
206
|
|
|
207
207
|
//#endregion
|
|
208
208
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/permessage-deflate.js
|
|
209
|
-
var require_permessage_deflate = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/permessage-deflate.js"(exports, module) {
|
|
209
|
+
var require_permessage_deflate = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/permessage-deflate.js": ((exports, module) => {
|
|
210
210
|
const zlib = __require("zlib");
|
|
211
211
|
const bufferUtil = require_buffer_util();
|
|
212
212
|
const Limiter = require_limiter();
|
|
@@ -539,11 +539,11 @@ var require_permessage_deflate = __commonJS({ "../../node_modules/.pnpm/ws@8.18.
|
|
|
539
539
|
err[kStatusCode$2] = 1007;
|
|
540
540
|
this[kCallback](err);
|
|
541
541
|
}
|
|
542
|
-
} });
|
|
542
|
+
}) });
|
|
543
543
|
|
|
544
544
|
//#endregion
|
|
545
545
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/validation.js
|
|
546
|
-
var require_validation = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/validation.js"(exports, module) {
|
|
546
|
+
var require_validation = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/validation.js": ((exports, module) => {
|
|
547
547
|
const { isUtf8 } = __require("buffer");
|
|
548
548
|
const { hasBlob } = require_constants();
|
|
549
549
|
const tokenChars$2 = [
|
|
@@ -736,11 +736,11 @@ var require_validation = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_m
|
|
|
736
736
|
return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8$1(buf);
|
|
737
737
|
};
|
|
738
738
|
} catch (e) {}
|
|
739
|
-
} });
|
|
739
|
+
}) });
|
|
740
740
|
|
|
741
741
|
//#endregion
|
|
742
742
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/receiver.js
|
|
743
|
-
var require_receiver = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/receiver.js"(exports, module) {
|
|
743
|
+
var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/receiver.js": ((exports, module) => {
|
|
744
744
|
const { Writable } = __require("stream");
|
|
745
745
|
const PerMessageDeflate$3 = require_permessage_deflate();
|
|
746
746
|
const { BINARY_TYPES: BINARY_TYPES$1, EMPTY_BUFFER: EMPTY_BUFFER$2, kStatusCode: kStatusCode$1, kWebSocket: kWebSocket$3 } = require_constants();
|
|
@@ -1064,8 +1064,7 @@ var require_receiver = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mod
|
|
|
1064
1064
|
* @private
|
|
1065
1065
|
*/
|
|
1066
1066
|
decompress(data, cb) {
|
|
1067
|
-
|
|
1068
|
-
perMessageDeflate.decompress(data, this._fin, (err, buf) => {
|
|
1067
|
+
this._extensions[PerMessageDeflate$3.extensionName].decompress(data, this._fin, (err, buf) => {
|
|
1069
1068
|
if (err) return cb(err);
|
|
1070
1069
|
if (buf.length) {
|
|
1071
1070
|
this._messageLength += buf.length;
|
|
@@ -1202,11 +1201,11 @@ var require_receiver = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mod
|
|
|
1202
1201
|
}
|
|
1203
1202
|
};
|
|
1204
1203
|
module.exports = Receiver$2;
|
|
1205
|
-
} });
|
|
1204
|
+
}) });
|
|
1206
1205
|
|
|
1207
1206
|
//#endregion
|
|
1208
1207
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/sender.js
|
|
1209
|
-
var require_sender = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/sender.js"(exports, module) {
|
|
1208
|
+
var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/sender.js": ((exports, module) => {
|
|
1210
1209
|
const { Duplex: Duplex$3 } = __require("stream");
|
|
1211
1210
|
const { randomFillSync } = __require("crypto");
|
|
1212
1211
|
const PerMessageDeflate$2 = require_permessage_deflate();
|
|
@@ -1621,8 +1620,7 @@ var require_sender = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modul
|
|
|
1621
1620
|
this._state = DEFLATING;
|
|
1622
1621
|
perMessageDeflate.compress(data, options.fin, (_, buf) => {
|
|
1623
1622
|
if (this._socket.destroyed) {
|
|
1624
|
-
|
|
1625
|
-
callCallbacks(this, err, cb);
|
|
1623
|
+
callCallbacks(this, /* @__PURE__ */ new Error("The socket was closed while data was being compressed"), cb);
|
|
1626
1624
|
return;
|
|
1627
1625
|
}
|
|
1628
1626
|
this._bufferedBytes -= options[kByteLength];
|
|
@@ -1699,11 +1697,11 @@ var require_sender = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modul
|
|
|
1699
1697
|
callCallbacks(sender, err, cb);
|
|
1700
1698
|
sender.onerror(err);
|
|
1701
1699
|
}
|
|
1702
|
-
} });
|
|
1700
|
+
}) });
|
|
1703
1701
|
|
|
1704
1702
|
//#endregion
|
|
1705
1703
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/event-target.js
|
|
1706
|
-
var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/event-target.js"(exports, module) {
|
|
1704
|
+
var require_event_target = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/event-target.js": ((exports, module) => {
|
|
1707
1705
|
const { kForOnEventAttribute: kForOnEventAttribute$1, kListener: kListener$1 } = require_constants();
|
|
1708
1706
|
const kCode = Symbol("kCode");
|
|
1709
1707
|
const kData = Symbol("kData");
|
|
@@ -1919,11 +1917,11 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node
|
|
|
1919
1917
|
if (typeof listener === "object" && listener.handleEvent) listener.handleEvent.call(listener, event);
|
|
1920
1918
|
else listener.call(thisArg, event);
|
|
1921
1919
|
}
|
|
1922
|
-
} });
|
|
1920
|
+
}) });
|
|
1923
1921
|
|
|
1924
1922
|
//#endregion
|
|
1925
1923
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/extension.js
|
|
1926
|
-
var require_extension = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/extension.js"(exports, module) {
|
|
1924
|
+
var require_extension = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/extension.js": ((exports, module) => {
|
|
1927
1925
|
const { tokenChars: tokenChars$1 } = require_validation();
|
|
1928
1926
|
/**
|
|
1929
1927
|
* Adds an offer to the map of extension offers or a parameter to the map of
|
|
@@ -2063,11 +2061,11 @@ var require_extension = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2063
2061
|
format: format$1,
|
|
2064
2062
|
parse: parse$3
|
|
2065
2063
|
};
|
|
2066
|
-
} });
|
|
2064
|
+
}) });
|
|
2067
2065
|
|
|
2068
2066
|
//#endregion
|
|
2069
2067
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket.js
|
|
2070
|
-
var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket.js"(exports, module) {
|
|
2068
|
+
var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket.js": ((exports, module) => {
|
|
2071
2069
|
const EventEmitter$1 = __require("events");
|
|
2072
2070
|
const https = __require("https");
|
|
2073
2071
|
const http$1 = __require("http");
|
|
@@ -2099,7 +2097,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2099
2097
|
*
|
|
2100
2098
|
* @extends EventEmitter
|
|
2101
2099
|
*/
|
|
2102
|
-
var WebSocket$
|
|
2100
|
+
var WebSocket$2 = class WebSocket$2 extends EventEmitter$1 {
|
|
2103
2101
|
/**
|
|
2104
2102
|
* Create a new `WebSocket`.
|
|
2105
2103
|
*
|
|
@@ -2119,7 +2117,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2119
2117
|
this._extensions = {};
|
|
2120
2118
|
this._paused = false;
|
|
2121
2119
|
this._protocol = "";
|
|
2122
|
-
this._readyState = WebSocket$
|
|
2120
|
+
this._readyState = WebSocket$2.CONNECTING;
|
|
2123
2121
|
this._receiver = null;
|
|
2124
2122
|
this._sender = null;
|
|
2125
2123
|
this._socket = null;
|
|
@@ -2263,7 +2261,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2263
2261
|
socket.on("data", socketOnData);
|
|
2264
2262
|
socket.on("end", socketOnEnd);
|
|
2265
2263
|
socket.on("error", socketOnError$1);
|
|
2266
|
-
this._readyState = WebSocket$
|
|
2264
|
+
this._readyState = WebSocket$2.OPEN;
|
|
2267
2265
|
this.emit("open");
|
|
2268
2266
|
}
|
|
2269
2267
|
/**
|
|
@@ -2273,13 +2271,13 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2273
2271
|
*/
|
|
2274
2272
|
emitClose() {
|
|
2275
2273
|
if (!this._socket) {
|
|
2276
|
-
this._readyState = WebSocket$
|
|
2274
|
+
this._readyState = WebSocket$2.CLOSED;
|
|
2277
2275
|
this.emit("close", this._closeCode, this._closeMessage);
|
|
2278
2276
|
return;
|
|
2279
2277
|
}
|
|
2280
2278
|
if (this._extensions[PerMessageDeflate$1.extensionName]) this._extensions[PerMessageDeflate$1.extensionName].cleanup();
|
|
2281
2279
|
this._receiver.removeAllListeners();
|
|
2282
|
-
this._readyState = WebSocket$
|
|
2280
|
+
this._readyState = WebSocket$2.CLOSED;
|
|
2283
2281
|
this.emit("close", this._closeCode, this._closeMessage);
|
|
2284
2282
|
}
|
|
2285
2283
|
/**
|
|
@@ -2303,17 +2301,16 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2303
2301
|
* @public
|
|
2304
2302
|
*/
|
|
2305
2303
|
close(code, data) {
|
|
2306
|
-
if (this.readyState === WebSocket$
|
|
2307
|
-
if (this.readyState === WebSocket$
|
|
2308
|
-
|
|
2309
|
-
abortHandshake$1(this, this._req, msg);
|
|
2304
|
+
if (this.readyState === WebSocket$2.CLOSED) return;
|
|
2305
|
+
if (this.readyState === WebSocket$2.CONNECTING) {
|
|
2306
|
+
abortHandshake$1(this, this._req, "WebSocket was closed before the connection was established");
|
|
2310
2307
|
return;
|
|
2311
2308
|
}
|
|
2312
|
-
if (this.readyState === WebSocket$
|
|
2309
|
+
if (this.readyState === WebSocket$2.CLOSING) {
|
|
2313
2310
|
if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) this._socket.end();
|
|
2314
2311
|
return;
|
|
2315
2312
|
}
|
|
2316
|
-
this._readyState = WebSocket$
|
|
2313
|
+
this._readyState = WebSocket$2.CLOSING;
|
|
2317
2314
|
this._sender.close(code, data, !this._isServer, (err) => {
|
|
2318
2315
|
if (err) return;
|
|
2319
2316
|
this._closeFrameSent = true;
|
|
@@ -2327,7 +2324,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2327
2324
|
* @public
|
|
2328
2325
|
*/
|
|
2329
2326
|
pause() {
|
|
2330
|
-
if (this.readyState === WebSocket$
|
|
2327
|
+
if (this.readyState === WebSocket$2.CONNECTING || this.readyState === WebSocket$2.CLOSED) return;
|
|
2331
2328
|
this._paused = true;
|
|
2332
2329
|
this._socket.pause();
|
|
2333
2330
|
}
|
|
@@ -2340,7 +2337,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2340
2337
|
* @public
|
|
2341
2338
|
*/
|
|
2342
2339
|
ping(data, mask, cb) {
|
|
2343
|
-
if (this.readyState === WebSocket$
|
|
2340
|
+
if (this.readyState === WebSocket$2.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
2344
2341
|
if (typeof data === "function") {
|
|
2345
2342
|
cb = data;
|
|
2346
2343
|
data = mask = void 0;
|
|
@@ -2349,7 +2346,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2349
2346
|
mask = void 0;
|
|
2350
2347
|
}
|
|
2351
2348
|
if (typeof data === "number") data = data.toString();
|
|
2352
|
-
if (this.readyState !== WebSocket$
|
|
2349
|
+
if (this.readyState !== WebSocket$2.OPEN) {
|
|
2353
2350
|
sendAfterClose(this, data, cb);
|
|
2354
2351
|
return;
|
|
2355
2352
|
}
|
|
@@ -2365,7 +2362,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2365
2362
|
* @public
|
|
2366
2363
|
*/
|
|
2367
2364
|
pong(data, mask, cb) {
|
|
2368
|
-
if (this.readyState === WebSocket$
|
|
2365
|
+
if (this.readyState === WebSocket$2.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
2369
2366
|
if (typeof data === "function") {
|
|
2370
2367
|
cb = data;
|
|
2371
2368
|
data = mask = void 0;
|
|
@@ -2374,7 +2371,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2374
2371
|
mask = void 0;
|
|
2375
2372
|
}
|
|
2376
2373
|
if (typeof data === "number") data = data.toString();
|
|
2377
|
-
if (this.readyState !== WebSocket$
|
|
2374
|
+
if (this.readyState !== WebSocket$2.OPEN) {
|
|
2378
2375
|
sendAfterClose(this, data, cb);
|
|
2379
2376
|
return;
|
|
2380
2377
|
}
|
|
@@ -2387,7 +2384,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2387
2384
|
* @public
|
|
2388
2385
|
*/
|
|
2389
2386
|
resume() {
|
|
2390
|
-
if (this.readyState === WebSocket$
|
|
2387
|
+
if (this.readyState === WebSocket$2.CONNECTING || this.readyState === WebSocket$2.CLOSED) return;
|
|
2391
2388
|
this._paused = false;
|
|
2392
2389
|
if (!this._receiver._writableState.needDrain) this._socket.resume();
|
|
2393
2390
|
}
|
|
@@ -2407,13 +2404,13 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2407
2404
|
* @public
|
|
2408
2405
|
*/
|
|
2409
2406
|
send(data, options, cb) {
|
|
2410
|
-
if (this.readyState === WebSocket$
|
|
2407
|
+
if (this.readyState === WebSocket$2.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
2411
2408
|
if (typeof options === "function") {
|
|
2412
2409
|
cb = options;
|
|
2413
2410
|
options = {};
|
|
2414
2411
|
}
|
|
2415
2412
|
if (typeof data === "number") data = data.toString();
|
|
2416
|
-
if (this.readyState !== WebSocket$
|
|
2413
|
+
if (this.readyState !== WebSocket$2.OPEN) {
|
|
2417
2414
|
sendAfterClose(this, data, cb);
|
|
2418
2415
|
return;
|
|
2419
2416
|
}
|
|
@@ -2433,14 +2430,13 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2433
2430
|
* @public
|
|
2434
2431
|
*/
|
|
2435
2432
|
terminate() {
|
|
2436
|
-
if (this.readyState === WebSocket$
|
|
2437
|
-
if (this.readyState === WebSocket$
|
|
2438
|
-
|
|
2439
|
-
abortHandshake$1(this, this._req, msg);
|
|
2433
|
+
if (this.readyState === WebSocket$2.CLOSED) return;
|
|
2434
|
+
if (this.readyState === WebSocket$2.CONNECTING) {
|
|
2435
|
+
abortHandshake$1(this, this._req, "WebSocket was closed before the connection was established");
|
|
2440
2436
|
return;
|
|
2441
2437
|
}
|
|
2442
2438
|
if (this._socket) {
|
|
2443
|
-
this._readyState = WebSocket$
|
|
2439
|
+
this._readyState = WebSocket$2.CLOSING;
|
|
2444
2440
|
this._socket.destroy();
|
|
2445
2441
|
}
|
|
2446
2442
|
}
|
|
@@ -2449,7 +2445,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2449
2445
|
* @constant {Number} CONNECTING
|
|
2450
2446
|
* @memberof WebSocket
|
|
2451
2447
|
*/
|
|
2452
|
-
Object.defineProperty(WebSocket$
|
|
2448
|
+
Object.defineProperty(WebSocket$2, "CONNECTING", {
|
|
2453
2449
|
enumerable: true,
|
|
2454
2450
|
value: readyStates.indexOf("CONNECTING")
|
|
2455
2451
|
});
|
|
@@ -2457,7 +2453,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2457
2453
|
* @constant {Number} CONNECTING
|
|
2458
2454
|
* @memberof WebSocket.prototype
|
|
2459
2455
|
*/
|
|
2460
|
-
Object.defineProperty(WebSocket$
|
|
2456
|
+
Object.defineProperty(WebSocket$2.prototype, "CONNECTING", {
|
|
2461
2457
|
enumerable: true,
|
|
2462
2458
|
value: readyStates.indexOf("CONNECTING")
|
|
2463
2459
|
});
|
|
@@ -2465,7 +2461,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2465
2461
|
* @constant {Number} OPEN
|
|
2466
2462
|
* @memberof WebSocket
|
|
2467
2463
|
*/
|
|
2468
|
-
Object.defineProperty(WebSocket$
|
|
2464
|
+
Object.defineProperty(WebSocket$2, "OPEN", {
|
|
2469
2465
|
enumerable: true,
|
|
2470
2466
|
value: readyStates.indexOf("OPEN")
|
|
2471
2467
|
});
|
|
@@ -2473,7 +2469,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2473
2469
|
* @constant {Number} OPEN
|
|
2474
2470
|
* @memberof WebSocket.prototype
|
|
2475
2471
|
*/
|
|
2476
|
-
Object.defineProperty(WebSocket$
|
|
2472
|
+
Object.defineProperty(WebSocket$2.prototype, "OPEN", {
|
|
2477
2473
|
enumerable: true,
|
|
2478
2474
|
value: readyStates.indexOf("OPEN")
|
|
2479
2475
|
});
|
|
@@ -2481,7 +2477,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2481
2477
|
* @constant {Number} CLOSING
|
|
2482
2478
|
* @memberof WebSocket
|
|
2483
2479
|
*/
|
|
2484
|
-
Object.defineProperty(WebSocket$
|
|
2480
|
+
Object.defineProperty(WebSocket$2, "CLOSING", {
|
|
2485
2481
|
enumerable: true,
|
|
2486
2482
|
value: readyStates.indexOf("CLOSING")
|
|
2487
2483
|
});
|
|
@@ -2489,7 +2485,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2489
2485
|
* @constant {Number} CLOSING
|
|
2490
2486
|
* @memberof WebSocket.prototype
|
|
2491
2487
|
*/
|
|
2492
|
-
Object.defineProperty(WebSocket$
|
|
2488
|
+
Object.defineProperty(WebSocket$2.prototype, "CLOSING", {
|
|
2493
2489
|
enumerable: true,
|
|
2494
2490
|
value: readyStates.indexOf("CLOSING")
|
|
2495
2491
|
});
|
|
@@ -2497,7 +2493,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2497
2493
|
* @constant {Number} CLOSED
|
|
2498
2494
|
* @memberof WebSocket
|
|
2499
2495
|
*/
|
|
2500
|
-
Object.defineProperty(WebSocket$
|
|
2496
|
+
Object.defineProperty(WebSocket$2, "CLOSED", {
|
|
2501
2497
|
enumerable: true,
|
|
2502
2498
|
value: readyStates.indexOf("CLOSED")
|
|
2503
2499
|
});
|
|
@@ -2505,7 +2501,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2505
2501
|
* @constant {Number} CLOSED
|
|
2506
2502
|
* @memberof WebSocket.prototype
|
|
2507
2503
|
*/
|
|
2508
|
-
Object.defineProperty(WebSocket$
|
|
2504
|
+
Object.defineProperty(WebSocket$2.prototype, "CLOSED", {
|
|
2509
2505
|
enumerable: true,
|
|
2510
2506
|
value: readyStates.indexOf("CLOSED")
|
|
2511
2507
|
});
|
|
@@ -2518,7 +2514,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2518
2514
|
"readyState",
|
|
2519
2515
|
"url"
|
|
2520
2516
|
].forEach((property) => {
|
|
2521
|
-
Object.defineProperty(WebSocket$
|
|
2517
|
+
Object.defineProperty(WebSocket$2.prototype, property, { enumerable: true });
|
|
2522
2518
|
});
|
|
2523
2519
|
[
|
|
2524
2520
|
"open",
|
|
@@ -2526,7 +2522,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2526
2522
|
"close",
|
|
2527
2523
|
"message"
|
|
2528
2524
|
].forEach((method) => {
|
|
2529
|
-
Object.defineProperty(WebSocket$
|
|
2525
|
+
Object.defineProperty(WebSocket$2.prototype, `on${method}`, {
|
|
2530
2526
|
enumerable: true,
|
|
2531
2527
|
get() {
|
|
2532
2528
|
for (const listener of this.listeners(method)) if (listener[kForOnEventAttribute]) return listener[kListener];
|
|
@@ -2542,9 +2538,9 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2542
2538
|
}
|
|
2543
2539
|
});
|
|
2544
2540
|
});
|
|
2545
|
-
WebSocket$
|
|
2546
|
-
WebSocket$
|
|
2547
|
-
module.exports = WebSocket$
|
|
2541
|
+
WebSocket$2.prototype.addEventListener = addEventListener;
|
|
2542
|
+
WebSocket$2.prototype.removeEventListener = removeEventListener;
|
|
2543
|
+
module.exports = WebSocket$2;
|
|
2548
2544
|
/**
|
|
2549
2545
|
* Initialize a WebSocket client.
|
|
2550
2546
|
*
|
|
@@ -2717,7 +2713,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2717
2713
|
});
|
|
2718
2714
|
req.on("upgrade", (res, socket, head) => {
|
|
2719
2715
|
websocket.emit("upgrade", res);
|
|
2720
|
-
if (websocket.readyState !== WebSocket$
|
|
2716
|
+
if (websocket.readyState !== WebSocket$2.CONNECTING) return;
|
|
2721
2717
|
req = websocket._req = null;
|
|
2722
2718
|
const upgrade = res.headers.upgrade;
|
|
2723
2719
|
if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
|
|
@@ -2743,29 +2739,25 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2743
2739
|
const secWebSocketExtensions = res.headers["sec-websocket-extensions"];
|
|
2744
2740
|
if (secWebSocketExtensions !== void 0) {
|
|
2745
2741
|
if (!perMessageDeflate) {
|
|
2746
|
-
|
|
2747
|
-
abortHandshake$1(websocket, socket, message);
|
|
2742
|
+
abortHandshake$1(websocket, socket, "Server sent a Sec-WebSocket-Extensions header but no extension was requested");
|
|
2748
2743
|
return;
|
|
2749
2744
|
}
|
|
2750
2745
|
let extensions;
|
|
2751
2746
|
try {
|
|
2752
2747
|
extensions = parse$2(secWebSocketExtensions);
|
|
2753
2748
|
} catch (err) {
|
|
2754
|
-
|
|
2755
|
-
abortHandshake$1(websocket, socket, message);
|
|
2749
|
+
abortHandshake$1(websocket, socket, "Invalid Sec-WebSocket-Extensions header");
|
|
2756
2750
|
return;
|
|
2757
2751
|
}
|
|
2758
2752
|
const extensionNames = Object.keys(extensions);
|
|
2759
2753
|
if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate$1.extensionName) {
|
|
2760
|
-
|
|
2761
|
-
abortHandshake$1(websocket, socket, message);
|
|
2754
|
+
abortHandshake$1(websocket, socket, "Server indicated an extension that was not requested");
|
|
2762
2755
|
return;
|
|
2763
2756
|
}
|
|
2764
2757
|
try {
|
|
2765
2758
|
perMessageDeflate.accept(extensions[PerMessageDeflate$1.extensionName]);
|
|
2766
2759
|
} catch (err) {
|
|
2767
|
-
|
|
2768
|
-
abortHandshake$1(websocket, socket, message);
|
|
2760
|
+
abortHandshake$1(websocket, socket, "Invalid Sec-WebSocket-Extensions header");
|
|
2769
2761
|
return;
|
|
2770
2762
|
}
|
|
2771
2763
|
websocket._extensions[PerMessageDeflate$1.extensionName] = perMessageDeflate;
|
|
@@ -2788,7 +2780,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2788
2780
|
* @private
|
|
2789
2781
|
*/
|
|
2790
2782
|
function emitErrorAndClose(websocket, err) {
|
|
2791
|
-
websocket._readyState = WebSocket$
|
|
2783
|
+
websocket._readyState = WebSocket$2.CLOSING;
|
|
2792
2784
|
websocket._errorEmitted = true;
|
|
2793
2785
|
websocket.emit("error", err);
|
|
2794
2786
|
websocket.emitClose();
|
|
@@ -2826,7 +2818,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2826
2818
|
* @private
|
|
2827
2819
|
*/
|
|
2828
2820
|
function abortHandshake$1(websocket, stream, message) {
|
|
2829
|
-
websocket._readyState = WebSocket$
|
|
2821
|
+
websocket._readyState = WebSocket$2.CLOSING;
|
|
2830
2822
|
const err = new Error(message);
|
|
2831
2823
|
Error.captureStackTrace(err, abortHandshake$1);
|
|
2832
2824
|
if (stream.setHeader) {
|
|
@@ -2960,9 +2952,9 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2960
2952
|
*/
|
|
2961
2953
|
function senderOnError(err) {
|
|
2962
2954
|
const websocket = this[kWebSocket$1];
|
|
2963
|
-
if (websocket.readyState === WebSocket$
|
|
2964
|
-
if (websocket.readyState === WebSocket$
|
|
2965
|
-
websocket._readyState = WebSocket$
|
|
2955
|
+
if (websocket.readyState === WebSocket$2.CLOSED) return;
|
|
2956
|
+
if (websocket.readyState === WebSocket$2.OPEN) {
|
|
2957
|
+
websocket._readyState = WebSocket$2.CLOSING;
|
|
2966
2958
|
setCloseTimer(websocket);
|
|
2967
2959
|
}
|
|
2968
2960
|
this._socket.end();
|
|
@@ -2990,7 +2982,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2990
2982
|
this.removeListener("close", socketOnClose);
|
|
2991
2983
|
this.removeListener("data", socketOnData);
|
|
2992
2984
|
this.removeListener("end", socketOnEnd);
|
|
2993
|
-
websocket._readyState = WebSocket$
|
|
2985
|
+
websocket._readyState = WebSocket$2.CLOSING;
|
|
2994
2986
|
let chunk;
|
|
2995
2987
|
if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && (chunk = websocket._socket.read()) !== null) websocket._receiver.write(chunk);
|
|
2996
2988
|
websocket._receiver.end();
|
|
@@ -3018,7 +3010,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
3018
3010
|
*/
|
|
3019
3011
|
function socketOnEnd() {
|
|
3020
3012
|
const websocket = this[kWebSocket$1];
|
|
3021
|
-
websocket._readyState = WebSocket$
|
|
3013
|
+
websocket._readyState = WebSocket$2.CLOSING;
|
|
3022
3014
|
websocket._receiver.end();
|
|
3023
3015
|
this.end();
|
|
3024
3016
|
}
|
|
@@ -3032,16 +3024,16 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
3032
3024
|
this.removeListener("error", socketOnError$1);
|
|
3033
3025
|
this.on("error", NOOP$1);
|
|
3034
3026
|
if (websocket) {
|
|
3035
|
-
websocket._readyState = WebSocket$
|
|
3027
|
+
websocket._readyState = WebSocket$2.CLOSING;
|
|
3036
3028
|
this.destroy();
|
|
3037
3029
|
}
|
|
3038
3030
|
}
|
|
3039
|
-
} });
|
|
3031
|
+
}) });
|
|
3040
3032
|
|
|
3041
3033
|
//#endregion
|
|
3042
3034
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/stream.js
|
|
3043
|
-
var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/stream.js"(exports, module) {
|
|
3044
|
-
|
|
3035
|
+
var require_stream = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/stream.js": ((exports, module) => {
|
|
3036
|
+
require_websocket();
|
|
3045
3037
|
const { Duplex: Duplex$1 } = __require("stream");
|
|
3046
3038
|
/**
|
|
3047
3039
|
* Emits the `'close'` event on a stream.
|
|
@@ -3153,11 +3145,11 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modul
|
|
|
3153
3145
|
return duplex;
|
|
3154
3146
|
}
|
|
3155
3147
|
module.exports = createWebSocketStream$1;
|
|
3156
|
-
} });
|
|
3148
|
+
}) });
|
|
3157
3149
|
|
|
3158
3150
|
//#endregion
|
|
3159
3151
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/subprotocol.js
|
|
3160
|
-
var require_subprotocol = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/subprotocol.js"(exports, module) {
|
|
3152
|
+
var require_subprotocol = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/subprotocol.js": ((exports, module) => {
|
|
3161
3153
|
const { tokenChars } = require_validation();
|
|
3162
3154
|
/**
|
|
3163
3155
|
* Parses the `Sec-WebSocket-Protocol` header into a set of subprotocol names.
|
|
@@ -3193,11 +3185,11 @@ var require_subprotocol = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_
|
|
|
3193
3185
|
return protocols;
|
|
3194
3186
|
}
|
|
3195
3187
|
module.exports = { parse: parse$1 };
|
|
3196
|
-
} });
|
|
3188
|
+
}) });
|
|
3197
3189
|
|
|
3198
3190
|
//#endregion
|
|
3199
3191
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket-server.js
|
|
3200
|
-
var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket-server.js"(exports, module) {
|
|
3192
|
+
var require_websocket_server = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket-server.js": ((exports, module) => {
|
|
3201
3193
|
const EventEmitter = __require("events");
|
|
3202
3194
|
const http = __require("http");
|
|
3203
3195
|
const { Duplex } = __require("stream");
|
|
@@ -3357,8 +3349,7 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/
|
|
|
3357
3349
|
shouldHandle(req) {
|
|
3358
3350
|
if (this.options.path) {
|
|
3359
3351
|
const index = req.url.indexOf("?");
|
|
3360
|
-
|
|
3361
|
-
if (pathname !== this.options.path) return false;
|
|
3352
|
+
if ((index !== -1 ? req.url.slice(0, index) : req.url) !== this.options.path) return false;
|
|
3362
3353
|
}
|
|
3363
3354
|
return true;
|
|
3364
3355
|
}
|
|
@@ -3377,23 +3368,19 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/
|
|
|
3377
3368
|
const upgrade = req.headers.upgrade;
|
|
3378
3369
|
const version = +req.headers["sec-websocket-version"];
|
|
3379
3370
|
if (req.method !== "GET") {
|
|
3380
|
-
|
|
3381
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);
|
|
3371
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 405, "Invalid HTTP method");
|
|
3382
3372
|
return;
|
|
3383
3373
|
}
|
|
3384
3374
|
if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
|
|
3385
|
-
|
|
3386
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
3375
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Invalid Upgrade header");
|
|
3387
3376
|
return;
|
|
3388
3377
|
}
|
|
3389
3378
|
if (key === void 0 || !keyRegex.test(key)) {
|
|
3390
|
-
|
|
3391
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
3379
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Missing or invalid Sec-WebSocket-Key header");
|
|
3392
3380
|
return;
|
|
3393
3381
|
}
|
|
3394
3382
|
if (version !== 13 && version !== 8) {
|
|
3395
|
-
|
|
3396
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, { "Sec-WebSocket-Version": "13, 8" });
|
|
3383
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Missing or invalid Sec-WebSocket-Version header", { "Sec-WebSocket-Version": "13, 8" });
|
|
3397
3384
|
return;
|
|
3398
3385
|
}
|
|
3399
3386
|
if (!this.shouldHandle(req)) {
|
|
@@ -3405,8 +3392,7 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/
|
|
|
3405
3392
|
if (secWebSocketProtocol !== void 0) try {
|
|
3406
3393
|
protocols = subprotocol.parse(secWebSocketProtocol);
|
|
3407
3394
|
} catch (err) {
|
|
3408
|
-
|
|
3409
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
3395
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Invalid Sec-WebSocket-Protocol header");
|
|
3410
3396
|
return;
|
|
3411
3397
|
}
|
|
3412
3398
|
const secWebSocketExtensions = req.headers["sec-websocket-extensions"];
|
|
@@ -3420,8 +3406,7 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/
|
|
|
3420
3406
|
extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
|
|
3421
3407
|
}
|
|
3422
3408
|
} catch (err) {
|
|
3423
|
-
|
|
3424
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
3409
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Invalid or unacceptable Sec-WebSocket-Extensions header");
|
|
3425
3410
|
return;
|
|
3426
3411
|
}
|
|
3427
3412
|
}
|
|
@@ -3459,12 +3444,11 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/
|
|
|
3459
3444
|
if (!socket.readable || !socket.writable) return socket.destroy();
|
|
3460
3445
|
if (socket[kWebSocket]) throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");
|
|
3461
3446
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
3462
|
-
const digest = createHash("sha1").update(key + GUID).digest("base64");
|
|
3463
3447
|
const headers = [
|
|
3464
3448
|
"HTTP/1.1 101 Switching Protocols",
|
|
3465
3449
|
"Upgrade: websocket",
|
|
3466
3450
|
"Connection: Upgrade",
|
|
3467
|
-
`Sec-WebSocket-Accept: ${digest}`
|
|
3451
|
+
`Sec-WebSocket-Accept: ${createHash("sha1").update(key + GUID).digest("base64")}`
|
|
3468
3452
|
];
|
|
3469
3453
|
const ws = new this.options.WebSocket(null, void 0, this.options);
|
|
3470
3454
|
if (protocols.size) {
|
|
@@ -3572,15 +3556,15 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/
|
|
|
3572
3556
|
server.emit("wsClientError", err, socket, req);
|
|
3573
3557
|
} else abortHandshake(socket, code, message, headers);
|
|
3574
3558
|
}
|
|
3575
|
-
} });
|
|
3559
|
+
}) });
|
|
3576
3560
|
|
|
3577
3561
|
//#endregion
|
|
3578
3562
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/wrapper.mjs
|
|
3579
|
-
var import_stream = __toESM(require_stream(), 1);
|
|
3580
|
-
var import_receiver = __toESM(require_receiver(), 1);
|
|
3581
|
-
var import_sender = __toESM(require_sender(), 1);
|
|
3582
|
-
var import_websocket = __toESM(require_websocket(), 1);
|
|
3583
|
-
var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
3563
|
+
var import_stream = /* @__PURE__ */ __toESM(require_stream(), 1);
|
|
3564
|
+
var import_receiver = /* @__PURE__ */ __toESM(require_receiver(), 1);
|
|
3565
|
+
var import_sender = /* @__PURE__ */ __toESM(require_sender(), 1);
|
|
3566
|
+
var import_websocket = /* @__PURE__ */ __toESM(require_websocket(), 1);
|
|
3567
|
+
var import_websocket_server = /* @__PURE__ */ __toESM(require_websocket_server(), 1);
|
|
3584
3568
|
|
|
3585
3569
|
//#endregion
|
|
3586
3570
|
//#region src/presets/ws/server.ts
|
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitejs/devtools-rpc",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-alpha.
|
|
4
|
+
"version": "0.0.0-alpha.2",
|
|
5
5
|
"description": "DevTools rpc for Vite (work in progress)",
|
|
6
6
|
"author": "VoidZero Inc.",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"homepage": "https://github.com/vitejs/
|
|
8
|
+
"homepage": "https://github.com/vitejs/devtools#readme",
|
|
9
9
|
"repository": {
|
|
10
|
+
"directory": "packages/devtools-rpc",
|
|
10
11
|
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/vitejs/
|
|
12
|
+
"url": "git+https://github.com/vitejs/devtools.git"
|
|
12
13
|
},
|
|
13
|
-
"bugs": "https://github.com/vitejs/
|
|
14
|
+
"bugs": "https://github.com/vitejs/devtools/issues",
|
|
14
15
|
"keywords": [
|
|
15
16
|
"vite",
|
|
16
17
|
"devtools",
|
|
@@ -18,13 +19,15 @@
|
|
|
18
19
|
],
|
|
19
20
|
"sideEffects": false,
|
|
20
21
|
"exports": {
|
|
21
|
-
".": "./dist/index.
|
|
22
|
-
"./presets
|
|
23
|
-
"./presets/ws/client": "./dist/presets/ws/client.
|
|
24
|
-
"./presets": "./dist/presets/
|
|
22
|
+
".": "./dist/index.js",
|
|
23
|
+
"./presets": "./dist/presets/index.js",
|
|
24
|
+
"./presets/ws/client": "./dist/presets/ws/client.js",
|
|
25
|
+
"./presets/ws/server": "./dist/presets/ws/server.js",
|
|
26
|
+
"./package.json": "./package.json"
|
|
25
27
|
},
|
|
26
|
-
"main": "./dist/index.
|
|
27
|
-
"
|
|
28
|
+
"main": "./dist/index.js",
|
|
29
|
+
"module": "./dist/index.js",
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
28
31
|
"files": [
|
|
29
32
|
"dist"
|
|
30
33
|
],
|
|
@@ -34,15 +37,15 @@
|
|
|
34
37
|
}
|
|
35
38
|
},
|
|
36
39
|
"dependencies": {
|
|
37
|
-
"birpc": "^2.
|
|
40
|
+
"birpc": "^2.6.1",
|
|
38
41
|
"structured-clone-es": "^1.0.0"
|
|
39
42
|
},
|
|
40
43
|
"devDependencies": {
|
|
41
|
-
"tsdown": "^0.
|
|
44
|
+
"tsdown": "^0.15.6",
|
|
42
45
|
"ws": "^8.18.3"
|
|
43
46
|
},
|
|
44
47
|
"scripts": {
|
|
45
48
|
"build": "tsdown",
|
|
46
|
-
"
|
|
49
|
+
"watch": "tsdown --watch"
|
|
47
50
|
}
|
|
48
51
|
}
|
package/dist/presets/index.mjs
DELETED
/package/{LICENSE.md → LICENSE}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|