@vitejs/devtools-rpc 0.0.0-alpha.1 → 0.0.0-alpha.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/dist/{presets/index-CNN7vRfy.d.mts → index-SwSDJlvS.d.ts} +1 -1
- package/dist/{index.d.mts → index.d.ts} +2 -3
- package/dist/presets/index.d.ts +2 -0
- 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} +2 -3
- package/dist/presets/ws/{server.d.mts → server.d.ts} +2 -2
- package/dist/presets/ws/{server.mjs → server.js} +110 -147
- package/dist/{presets/presets-B1cCNE-L.mjs → presets-CHvTKHNF.js} +1 -1
- package/package.json +16 -13
- package/dist/presets/index.d.mts +0 -2
- package/dist/presets/index.mjs +0 -3
- /package/{LICENSE.md → LICENSE} +0 -0
- /package/dist/{index.mjs → index.js} +0 -0
|
@@ -10,4 +10,4 @@ type RpcClientPresetBasicType = (...args: any[]) => RpcClientPresetReturnType;
|
|
|
10
10
|
type RpcClientPreset<T extends RpcClientPresetBasicType> = (...args: Parameters<T>) => RpcClientPresetReturnType;
|
|
11
11
|
declare function defineRpcClientPreset<T extends RpcClientPresetBasicType>(preset: T): RpcClientPreset<T>;
|
|
12
12
|
//#endregion
|
|
13
|
-
export {
|
|
13
|
+
export { RpcServerPresetBasicType as a, defineRpcServerPreset as c, RpcServerPreset as i, RpcClientPresetBasicType as n, RpcServerPresetReturnType as o, RpcClientPresetReturnType as r, defineRpcClientPreset as s, RpcClientPreset as t };
|
|
@@ -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: {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as RpcServerPresetBasicType, c as defineRpcServerPreset, i as RpcServerPreset, n as RpcClientPresetBasicType, o as RpcServerPresetReturnType, r as RpcClientPresetReturnType, s as defineRpcClientPreset, t as RpcClientPreset } from "../index-SwSDJlvS.js";
|
|
2
|
+
export { RpcClientPreset, RpcClientPresetBasicType, RpcClientPresetReturnType, RpcServerPreset, RpcServerPresetBasicType, RpcServerPresetReturnType, defineRpcClientPreset, defineRpcServerPreset };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineRpcClientPreset } from "
|
|
1
|
+
import { t as defineRpcClientPreset } from "../../presets-CHvTKHNF.js";
|
|
2
2
|
import { parse, stringify } from "structured-clone-es";
|
|
3
3
|
|
|
4
4
|
//#region src/presets/ws/client.ts
|
|
@@ -10,8 +10,7 @@ const createWsRpcPreset = defineRpcClientPreset((options) => {
|
|
|
10
10
|
onConnected(e);
|
|
11
11
|
});
|
|
12
12
|
ws.addEventListener("error", (e) => {
|
|
13
|
-
|
|
14
|
-
onError(_e);
|
|
13
|
+
onError(e instanceof Error ? e : new Error(e.type));
|
|
15
14
|
});
|
|
16
15
|
ws.addEventListener("close", (e) => {
|
|
17
16
|
onDisconnected(e);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RpcServerPreset } from "
|
|
1
|
+
import { i as RpcServerPreset } from "../../index-SwSDJlvS.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 { n as defineRpcServerPreset } from "../../presets-CHvTKHNF.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();
|
|
@@ -260,10 +260,7 @@ var require_permessage_deflate = __commonJS({ "../../node_modules/.pnpm/ws@8.18.
|
|
|
260
260
|
this._deflate = null;
|
|
261
261
|
this._inflate = null;
|
|
262
262
|
this.params = null;
|
|
263
|
-
if (!zlibLimiter)
|
|
264
|
-
const concurrency = this._options.concurrencyLimit !== void 0 ? this._options.concurrencyLimit : 10;
|
|
265
|
-
zlibLimiter = new Limiter(concurrency);
|
|
266
|
-
}
|
|
263
|
+
if (!zlibLimiter) zlibLimiter = new Limiter(this._options.concurrencyLimit !== void 0 ? this._options.concurrencyLimit : 10);
|
|
267
264
|
}
|
|
268
265
|
/**
|
|
269
266
|
* @type {String}
|
|
@@ -539,11 +536,11 @@ var require_permessage_deflate = __commonJS({ "../../node_modules/.pnpm/ws@8.18.
|
|
|
539
536
|
err[kStatusCode$2] = 1007;
|
|
540
537
|
this[kCallback](err);
|
|
541
538
|
}
|
|
542
|
-
} });
|
|
539
|
+
}) });
|
|
543
540
|
|
|
544
541
|
//#endregion
|
|
545
542
|
//#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) {
|
|
543
|
+
var require_validation = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/validation.js": ((exports, module) => {
|
|
547
544
|
const { isUtf8 } = __require("buffer");
|
|
548
545
|
const { hasBlob } = require_constants();
|
|
549
546
|
const tokenChars$2 = [
|
|
@@ -736,11 +733,11 @@ var require_validation = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_m
|
|
|
736
733
|
return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8$1(buf);
|
|
737
734
|
};
|
|
738
735
|
} catch (e) {}
|
|
739
|
-
} });
|
|
736
|
+
}) });
|
|
740
737
|
|
|
741
738
|
//#endregion
|
|
742
739
|
//#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) {
|
|
740
|
+
var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/receiver.js": ((exports, module) => {
|
|
744
741
|
const { Writable } = __require("stream");
|
|
745
742
|
const PerMessageDeflate$3 = require_permessage_deflate();
|
|
746
743
|
const { BINARY_TYPES: BINARY_TYPES$1, EMPTY_BUFFER: EMPTY_BUFFER$2, kStatusCode: kStatusCode$1, kWebSocket: kWebSocket$3 } = require_constants();
|
|
@@ -889,14 +886,12 @@ var require_receiver = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mod
|
|
|
889
886
|
}
|
|
890
887
|
const buf = this.consume(2);
|
|
891
888
|
if ((buf[0] & 48) !== 0) {
|
|
892
|
-
|
|
893
|
-
cb(error);
|
|
889
|
+
cb(this.createError(RangeError, "RSV2 and RSV3 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_2_3"));
|
|
894
890
|
return;
|
|
895
891
|
}
|
|
896
892
|
const compressed = (buf[0] & 64) === 64;
|
|
897
893
|
if (compressed && !this._extensions[PerMessageDeflate$3.extensionName]) {
|
|
898
|
-
|
|
899
|
-
cb(error);
|
|
894
|
+
cb(this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
|
|
900
895
|
return;
|
|
901
896
|
}
|
|
902
897
|
this._fin = (buf[0] & 128) === 128;
|
|
@@ -904,55 +899,46 @@ var require_receiver = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mod
|
|
|
904
899
|
this._payloadLength = buf[1] & 127;
|
|
905
900
|
if (this._opcode === 0) {
|
|
906
901
|
if (compressed) {
|
|
907
|
-
|
|
908
|
-
cb(error);
|
|
902
|
+
cb(this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
|
|
909
903
|
return;
|
|
910
904
|
}
|
|
911
905
|
if (!this._fragmented) {
|
|
912
|
-
|
|
913
|
-
cb(error);
|
|
906
|
+
cb(this.createError(RangeError, "invalid opcode 0", true, 1002, "WS_ERR_INVALID_OPCODE"));
|
|
914
907
|
return;
|
|
915
908
|
}
|
|
916
909
|
this._opcode = this._fragmented;
|
|
917
910
|
} else if (this._opcode === 1 || this._opcode === 2) {
|
|
918
911
|
if (this._fragmented) {
|
|
919
|
-
|
|
920
|
-
cb(error);
|
|
912
|
+
cb(this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE"));
|
|
921
913
|
return;
|
|
922
914
|
}
|
|
923
915
|
this._compressed = compressed;
|
|
924
916
|
} else if (this._opcode > 7 && this._opcode < 11) {
|
|
925
917
|
if (!this._fin) {
|
|
926
|
-
|
|
927
|
-
cb(error);
|
|
918
|
+
cb(this.createError(RangeError, "FIN must be set", true, 1002, "WS_ERR_EXPECTED_FIN"));
|
|
928
919
|
return;
|
|
929
920
|
}
|
|
930
921
|
if (compressed) {
|
|
931
|
-
|
|
932
|
-
cb(error);
|
|
922
|
+
cb(this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
|
|
933
923
|
return;
|
|
934
924
|
}
|
|
935
925
|
if (this._payloadLength > 125 || this._opcode === 8 && this._payloadLength === 1) {
|
|
936
|
-
|
|
937
|
-
cb(error);
|
|
926
|
+
cb(this.createError(RangeError, `invalid payload length ${this._payloadLength}`, true, 1002, "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"));
|
|
938
927
|
return;
|
|
939
928
|
}
|
|
940
929
|
} else {
|
|
941
|
-
|
|
942
|
-
cb(error);
|
|
930
|
+
cb(this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE"));
|
|
943
931
|
return;
|
|
944
932
|
}
|
|
945
933
|
if (!this._fin && !this._fragmented) this._fragmented = this._opcode;
|
|
946
934
|
this._masked = (buf[1] & 128) === 128;
|
|
947
935
|
if (this._isServer) {
|
|
948
936
|
if (!this._masked) {
|
|
949
|
-
|
|
950
|
-
cb(error);
|
|
937
|
+
cb(this.createError(RangeError, "MASK must be set", true, 1002, "WS_ERR_EXPECTED_MASK"));
|
|
951
938
|
return;
|
|
952
939
|
}
|
|
953
940
|
} else if (this._masked) {
|
|
954
|
-
|
|
955
|
-
cb(error);
|
|
941
|
+
cb(this.createError(RangeError, "MASK must be clear", true, 1002, "WS_ERR_UNEXPECTED_MASK"));
|
|
956
942
|
return;
|
|
957
943
|
}
|
|
958
944
|
if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16;
|
|
@@ -987,8 +973,7 @@ var require_receiver = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mod
|
|
|
987
973
|
const buf = this.consume(8);
|
|
988
974
|
const num = buf.readUInt32BE(0);
|
|
989
975
|
if (num > Math.pow(2, 21) - 1) {
|
|
990
|
-
|
|
991
|
-
cb(error);
|
|
976
|
+
cb(this.createError(RangeError, "Unsupported WebSocket frame: payload length > 2^53 - 1", false, 1009, "WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH"));
|
|
992
977
|
return;
|
|
993
978
|
}
|
|
994
979
|
this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);
|
|
@@ -1004,8 +989,7 @@ var require_receiver = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mod
|
|
|
1004
989
|
if (this._payloadLength && this._opcode < 8) {
|
|
1005
990
|
this._totalPayloadLength += this._payloadLength;
|
|
1006
991
|
if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {
|
|
1007
|
-
|
|
1008
|
-
cb(error);
|
|
992
|
+
cb(this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));
|
|
1009
993
|
return;
|
|
1010
994
|
}
|
|
1011
995
|
}
|
|
@@ -1064,14 +1048,12 @@ var require_receiver = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mod
|
|
|
1064
1048
|
* @private
|
|
1065
1049
|
*/
|
|
1066
1050
|
decompress(data, cb) {
|
|
1067
|
-
|
|
1068
|
-
perMessageDeflate.decompress(data, this._fin, (err, buf) => {
|
|
1051
|
+
this._extensions[PerMessageDeflate$3.extensionName].decompress(data, this._fin, (err, buf) => {
|
|
1069
1052
|
if (err) return cb(err);
|
|
1070
1053
|
if (buf.length) {
|
|
1071
1054
|
this._messageLength += buf.length;
|
|
1072
1055
|
if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
|
|
1073
|
-
|
|
1074
|
-
cb(error);
|
|
1056
|
+
cb(this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));
|
|
1075
1057
|
return;
|
|
1076
1058
|
}
|
|
1077
1059
|
this._fragments.push(buf);
|
|
@@ -1117,8 +1099,7 @@ var require_receiver = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mod
|
|
|
1117
1099
|
} else {
|
|
1118
1100
|
const buf = concat(fragments, messageLength);
|
|
1119
1101
|
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
1120
|
-
|
|
1121
|
-
cb(error);
|
|
1102
|
+
cb(this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8"));
|
|
1122
1103
|
return;
|
|
1123
1104
|
}
|
|
1124
1105
|
if (this._state === INFLATING || this._allowSynchronousEvents) {
|
|
@@ -1150,14 +1131,12 @@ var require_receiver = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mod
|
|
|
1150
1131
|
} else {
|
|
1151
1132
|
const code = data.readUInt16BE(0);
|
|
1152
1133
|
if (!isValidStatusCode$1(code)) {
|
|
1153
|
-
|
|
1154
|
-
cb(error);
|
|
1134
|
+
cb(this.createError(RangeError, `invalid status code ${code}`, true, 1002, "WS_ERR_INVALID_CLOSE_CODE"));
|
|
1155
1135
|
return;
|
|
1156
1136
|
}
|
|
1157
1137
|
const buf = new FastBuffer(data.buffer, data.byteOffset + 2, data.length - 2);
|
|
1158
1138
|
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
1159
|
-
|
|
1160
|
-
cb(error);
|
|
1139
|
+
cb(this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8"));
|
|
1161
1140
|
return;
|
|
1162
1141
|
}
|
|
1163
1142
|
this._loop = false;
|
|
@@ -1202,11 +1181,11 @@ var require_receiver = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mod
|
|
|
1202
1181
|
}
|
|
1203
1182
|
};
|
|
1204
1183
|
module.exports = Receiver$2;
|
|
1205
|
-
} });
|
|
1184
|
+
}) });
|
|
1206
1185
|
|
|
1207
1186
|
//#endregion
|
|
1208
1187
|
//#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) {
|
|
1188
|
+
var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/sender.js": ((exports, module) => {
|
|
1210
1189
|
const { Duplex: Duplex$3 } = __require("stream");
|
|
1211
1190
|
const { randomFillSync } = __require("crypto");
|
|
1212
1191
|
const PerMessageDeflate$2 = require_permessage_deflate();
|
|
@@ -1621,8 +1600,7 @@ var require_sender = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modul
|
|
|
1621
1600
|
this._state = DEFLATING;
|
|
1622
1601
|
perMessageDeflate.compress(data, options.fin, (_, buf) => {
|
|
1623
1602
|
if (this._socket.destroyed) {
|
|
1624
|
-
|
|
1625
|
-
callCallbacks(this, err, cb);
|
|
1603
|
+
callCallbacks(this, /* @__PURE__ */ new Error("The socket was closed while data was being compressed"), cb);
|
|
1626
1604
|
return;
|
|
1627
1605
|
}
|
|
1628
1606
|
this._bufferedBytes -= options[kByteLength];
|
|
@@ -1699,11 +1677,11 @@ var require_sender = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modul
|
|
|
1699
1677
|
callCallbacks(sender, err, cb);
|
|
1700
1678
|
sender.onerror(err);
|
|
1701
1679
|
}
|
|
1702
|
-
} });
|
|
1680
|
+
}) });
|
|
1703
1681
|
|
|
1704
1682
|
//#endregion
|
|
1705
1683
|
//#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) {
|
|
1684
|
+
var require_event_target = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/event-target.js": ((exports, module) => {
|
|
1707
1685
|
const { kForOnEventAttribute: kForOnEventAttribute$1, kListener: kListener$1 } = require_constants();
|
|
1708
1686
|
const kCode = Symbol("kCode");
|
|
1709
1687
|
const kData = Symbol("kData");
|
|
@@ -1919,11 +1897,11 @@ var require_event_target = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node
|
|
|
1919
1897
|
if (typeof listener === "object" && listener.handleEvent) listener.handleEvent.call(listener, event);
|
|
1920
1898
|
else listener.call(thisArg, event);
|
|
1921
1899
|
}
|
|
1922
|
-
} });
|
|
1900
|
+
}) });
|
|
1923
1901
|
|
|
1924
1902
|
//#endregion
|
|
1925
1903
|
//#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) {
|
|
1904
|
+
var require_extension = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/extension.js": ((exports, module) => {
|
|
1927
1905
|
const { tokenChars: tokenChars$1 } = require_validation();
|
|
1928
1906
|
/**
|
|
1929
1907
|
* Adds an offer to the map of extension offers or a parameter to the map of
|
|
@@ -2063,11 +2041,11 @@ var require_extension = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2063
2041
|
format: format$1,
|
|
2064
2042
|
parse: parse$3
|
|
2065
2043
|
};
|
|
2066
|
-
} });
|
|
2044
|
+
}) });
|
|
2067
2045
|
|
|
2068
2046
|
//#endregion
|
|
2069
2047
|
//#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) {
|
|
2048
|
+
var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket.js": ((exports, module) => {
|
|
2071
2049
|
const EventEmitter$1 = __require("events");
|
|
2072
2050
|
const https = __require("https");
|
|
2073
2051
|
const http$1 = __require("http");
|
|
@@ -2099,7 +2077,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2099
2077
|
*
|
|
2100
2078
|
* @extends EventEmitter
|
|
2101
2079
|
*/
|
|
2102
|
-
var WebSocket$
|
|
2080
|
+
var WebSocket$2 = class WebSocket$2 extends EventEmitter$1 {
|
|
2103
2081
|
/**
|
|
2104
2082
|
* Create a new `WebSocket`.
|
|
2105
2083
|
*
|
|
@@ -2119,7 +2097,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2119
2097
|
this._extensions = {};
|
|
2120
2098
|
this._paused = false;
|
|
2121
2099
|
this._protocol = "";
|
|
2122
|
-
this._readyState = WebSocket$
|
|
2100
|
+
this._readyState = WebSocket$2.CONNECTING;
|
|
2123
2101
|
this._receiver = null;
|
|
2124
2102
|
this._sender = null;
|
|
2125
2103
|
this._socket = null;
|
|
@@ -2263,7 +2241,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2263
2241
|
socket.on("data", socketOnData);
|
|
2264
2242
|
socket.on("end", socketOnEnd);
|
|
2265
2243
|
socket.on("error", socketOnError$1);
|
|
2266
|
-
this._readyState = WebSocket$
|
|
2244
|
+
this._readyState = WebSocket$2.OPEN;
|
|
2267
2245
|
this.emit("open");
|
|
2268
2246
|
}
|
|
2269
2247
|
/**
|
|
@@ -2273,13 +2251,13 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2273
2251
|
*/
|
|
2274
2252
|
emitClose() {
|
|
2275
2253
|
if (!this._socket) {
|
|
2276
|
-
this._readyState = WebSocket$
|
|
2254
|
+
this._readyState = WebSocket$2.CLOSED;
|
|
2277
2255
|
this.emit("close", this._closeCode, this._closeMessage);
|
|
2278
2256
|
return;
|
|
2279
2257
|
}
|
|
2280
2258
|
if (this._extensions[PerMessageDeflate$1.extensionName]) this._extensions[PerMessageDeflate$1.extensionName].cleanup();
|
|
2281
2259
|
this._receiver.removeAllListeners();
|
|
2282
|
-
this._readyState = WebSocket$
|
|
2260
|
+
this._readyState = WebSocket$2.CLOSED;
|
|
2283
2261
|
this.emit("close", this._closeCode, this._closeMessage);
|
|
2284
2262
|
}
|
|
2285
2263
|
/**
|
|
@@ -2303,17 +2281,16 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2303
2281
|
* @public
|
|
2304
2282
|
*/
|
|
2305
2283
|
close(code, data) {
|
|
2306
|
-
if (this.readyState === WebSocket$
|
|
2307
|
-
if (this.readyState === WebSocket$
|
|
2308
|
-
|
|
2309
|
-
abortHandshake$1(this, this._req, msg);
|
|
2284
|
+
if (this.readyState === WebSocket$2.CLOSED) return;
|
|
2285
|
+
if (this.readyState === WebSocket$2.CONNECTING) {
|
|
2286
|
+
abortHandshake$1(this, this._req, "WebSocket was closed before the connection was established");
|
|
2310
2287
|
return;
|
|
2311
2288
|
}
|
|
2312
|
-
if (this.readyState === WebSocket$
|
|
2289
|
+
if (this.readyState === WebSocket$2.CLOSING) {
|
|
2313
2290
|
if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) this._socket.end();
|
|
2314
2291
|
return;
|
|
2315
2292
|
}
|
|
2316
|
-
this._readyState = WebSocket$
|
|
2293
|
+
this._readyState = WebSocket$2.CLOSING;
|
|
2317
2294
|
this._sender.close(code, data, !this._isServer, (err) => {
|
|
2318
2295
|
if (err) return;
|
|
2319
2296
|
this._closeFrameSent = true;
|
|
@@ -2327,7 +2304,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2327
2304
|
* @public
|
|
2328
2305
|
*/
|
|
2329
2306
|
pause() {
|
|
2330
|
-
if (this.readyState === WebSocket$
|
|
2307
|
+
if (this.readyState === WebSocket$2.CONNECTING || this.readyState === WebSocket$2.CLOSED) return;
|
|
2331
2308
|
this._paused = true;
|
|
2332
2309
|
this._socket.pause();
|
|
2333
2310
|
}
|
|
@@ -2340,7 +2317,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2340
2317
|
* @public
|
|
2341
2318
|
*/
|
|
2342
2319
|
ping(data, mask, cb) {
|
|
2343
|
-
if (this.readyState === WebSocket$
|
|
2320
|
+
if (this.readyState === WebSocket$2.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
2344
2321
|
if (typeof data === "function") {
|
|
2345
2322
|
cb = data;
|
|
2346
2323
|
data = mask = void 0;
|
|
@@ -2349,7 +2326,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2349
2326
|
mask = void 0;
|
|
2350
2327
|
}
|
|
2351
2328
|
if (typeof data === "number") data = data.toString();
|
|
2352
|
-
if (this.readyState !== WebSocket$
|
|
2329
|
+
if (this.readyState !== WebSocket$2.OPEN) {
|
|
2353
2330
|
sendAfterClose(this, data, cb);
|
|
2354
2331
|
return;
|
|
2355
2332
|
}
|
|
@@ -2365,7 +2342,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2365
2342
|
* @public
|
|
2366
2343
|
*/
|
|
2367
2344
|
pong(data, mask, cb) {
|
|
2368
|
-
if (this.readyState === WebSocket$
|
|
2345
|
+
if (this.readyState === WebSocket$2.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
2369
2346
|
if (typeof data === "function") {
|
|
2370
2347
|
cb = data;
|
|
2371
2348
|
data = mask = void 0;
|
|
@@ -2374,7 +2351,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2374
2351
|
mask = void 0;
|
|
2375
2352
|
}
|
|
2376
2353
|
if (typeof data === "number") data = data.toString();
|
|
2377
|
-
if (this.readyState !== WebSocket$
|
|
2354
|
+
if (this.readyState !== WebSocket$2.OPEN) {
|
|
2378
2355
|
sendAfterClose(this, data, cb);
|
|
2379
2356
|
return;
|
|
2380
2357
|
}
|
|
@@ -2387,7 +2364,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2387
2364
|
* @public
|
|
2388
2365
|
*/
|
|
2389
2366
|
resume() {
|
|
2390
|
-
if (this.readyState === WebSocket$
|
|
2367
|
+
if (this.readyState === WebSocket$2.CONNECTING || this.readyState === WebSocket$2.CLOSED) return;
|
|
2391
2368
|
this._paused = false;
|
|
2392
2369
|
if (!this._receiver._writableState.needDrain) this._socket.resume();
|
|
2393
2370
|
}
|
|
@@ -2407,13 +2384,13 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2407
2384
|
* @public
|
|
2408
2385
|
*/
|
|
2409
2386
|
send(data, options, cb) {
|
|
2410
|
-
if (this.readyState === WebSocket$
|
|
2387
|
+
if (this.readyState === WebSocket$2.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
2411
2388
|
if (typeof options === "function") {
|
|
2412
2389
|
cb = options;
|
|
2413
2390
|
options = {};
|
|
2414
2391
|
}
|
|
2415
2392
|
if (typeof data === "number") data = data.toString();
|
|
2416
|
-
if (this.readyState !== WebSocket$
|
|
2393
|
+
if (this.readyState !== WebSocket$2.OPEN) {
|
|
2417
2394
|
sendAfterClose(this, data, cb);
|
|
2418
2395
|
return;
|
|
2419
2396
|
}
|
|
@@ -2433,14 +2410,13 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2433
2410
|
* @public
|
|
2434
2411
|
*/
|
|
2435
2412
|
terminate() {
|
|
2436
|
-
if (this.readyState === WebSocket$
|
|
2437
|
-
if (this.readyState === WebSocket$
|
|
2438
|
-
|
|
2439
|
-
abortHandshake$1(this, this._req, msg);
|
|
2413
|
+
if (this.readyState === WebSocket$2.CLOSED) return;
|
|
2414
|
+
if (this.readyState === WebSocket$2.CONNECTING) {
|
|
2415
|
+
abortHandshake$1(this, this._req, "WebSocket was closed before the connection was established");
|
|
2440
2416
|
return;
|
|
2441
2417
|
}
|
|
2442
2418
|
if (this._socket) {
|
|
2443
|
-
this._readyState = WebSocket$
|
|
2419
|
+
this._readyState = WebSocket$2.CLOSING;
|
|
2444
2420
|
this._socket.destroy();
|
|
2445
2421
|
}
|
|
2446
2422
|
}
|
|
@@ -2449,7 +2425,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2449
2425
|
* @constant {Number} CONNECTING
|
|
2450
2426
|
* @memberof WebSocket
|
|
2451
2427
|
*/
|
|
2452
|
-
Object.defineProperty(WebSocket$
|
|
2428
|
+
Object.defineProperty(WebSocket$2, "CONNECTING", {
|
|
2453
2429
|
enumerable: true,
|
|
2454
2430
|
value: readyStates.indexOf("CONNECTING")
|
|
2455
2431
|
});
|
|
@@ -2457,7 +2433,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2457
2433
|
* @constant {Number} CONNECTING
|
|
2458
2434
|
* @memberof WebSocket.prototype
|
|
2459
2435
|
*/
|
|
2460
|
-
Object.defineProperty(WebSocket$
|
|
2436
|
+
Object.defineProperty(WebSocket$2.prototype, "CONNECTING", {
|
|
2461
2437
|
enumerable: true,
|
|
2462
2438
|
value: readyStates.indexOf("CONNECTING")
|
|
2463
2439
|
});
|
|
@@ -2465,7 +2441,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2465
2441
|
* @constant {Number} OPEN
|
|
2466
2442
|
* @memberof WebSocket
|
|
2467
2443
|
*/
|
|
2468
|
-
Object.defineProperty(WebSocket$
|
|
2444
|
+
Object.defineProperty(WebSocket$2, "OPEN", {
|
|
2469
2445
|
enumerable: true,
|
|
2470
2446
|
value: readyStates.indexOf("OPEN")
|
|
2471
2447
|
});
|
|
@@ -2473,7 +2449,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2473
2449
|
* @constant {Number} OPEN
|
|
2474
2450
|
* @memberof WebSocket.prototype
|
|
2475
2451
|
*/
|
|
2476
|
-
Object.defineProperty(WebSocket$
|
|
2452
|
+
Object.defineProperty(WebSocket$2.prototype, "OPEN", {
|
|
2477
2453
|
enumerable: true,
|
|
2478
2454
|
value: readyStates.indexOf("OPEN")
|
|
2479
2455
|
});
|
|
@@ -2481,7 +2457,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2481
2457
|
* @constant {Number} CLOSING
|
|
2482
2458
|
* @memberof WebSocket
|
|
2483
2459
|
*/
|
|
2484
|
-
Object.defineProperty(WebSocket$
|
|
2460
|
+
Object.defineProperty(WebSocket$2, "CLOSING", {
|
|
2485
2461
|
enumerable: true,
|
|
2486
2462
|
value: readyStates.indexOf("CLOSING")
|
|
2487
2463
|
});
|
|
@@ -2489,7 +2465,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2489
2465
|
* @constant {Number} CLOSING
|
|
2490
2466
|
* @memberof WebSocket.prototype
|
|
2491
2467
|
*/
|
|
2492
|
-
Object.defineProperty(WebSocket$
|
|
2468
|
+
Object.defineProperty(WebSocket$2.prototype, "CLOSING", {
|
|
2493
2469
|
enumerable: true,
|
|
2494
2470
|
value: readyStates.indexOf("CLOSING")
|
|
2495
2471
|
});
|
|
@@ -2497,7 +2473,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2497
2473
|
* @constant {Number} CLOSED
|
|
2498
2474
|
* @memberof WebSocket
|
|
2499
2475
|
*/
|
|
2500
|
-
Object.defineProperty(WebSocket$
|
|
2476
|
+
Object.defineProperty(WebSocket$2, "CLOSED", {
|
|
2501
2477
|
enumerable: true,
|
|
2502
2478
|
value: readyStates.indexOf("CLOSED")
|
|
2503
2479
|
});
|
|
@@ -2505,7 +2481,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2505
2481
|
* @constant {Number} CLOSED
|
|
2506
2482
|
* @memberof WebSocket.prototype
|
|
2507
2483
|
*/
|
|
2508
|
-
Object.defineProperty(WebSocket$
|
|
2484
|
+
Object.defineProperty(WebSocket$2.prototype, "CLOSED", {
|
|
2509
2485
|
enumerable: true,
|
|
2510
2486
|
value: readyStates.indexOf("CLOSED")
|
|
2511
2487
|
});
|
|
@@ -2518,7 +2494,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2518
2494
|
"readyState",
|
|
2519
2495
|
"url"
|
|
2520
2496
|
].forEach((property) => {
|
|
2521
|
-
Object.defineProperty(WebSocket$
|
|
2497
|
+
Object.defineProperty(WebSocket$2.prototype, property, { enumerable: true });
|
|
2522
2498
|
});
|
|
2523
2499
|
[
|
|
2524
2500
|
"open",
|
|
@@ -2526,7 +2502,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2526
2502
|
"close",
|
|
2527
2503
|
"message"
|
|
2528
2504
|
].forEach((method) => {
|
|
2529
|
-
Object.defineProperty(WebSocket$
|
|
2505
|
+
Object.defineProperty(WebSocket$2.prototype, `on${method}`, {
|
|
2530
2506
|
enumerable: true,
|
|
2531
2507
|
get() {
|
|
2532
2508
|
for (const listener of this.listeners(method)) if (listener[kForOnEventAttribute]) return listener[kListener];
|
|
@@ -2542,9 +2518,9 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2542
2518
|
}
|
|
2543
2519
|
});
|
|
2544
2520
|
});
|
|
2545
|
-
WebSocket$
|
|
2546
|
-
WebSocket$
|
|
2547
|
-
module.exports = WebSocket$
|
|
2521
|
+
WebSocket$2.prototype.addEventListener = addEventListener;
|
|
2522
|
+
WebSocket$2.prototype.removeEventListener = removeEventListener;
|
|
2523
|
+
module.exports = WebSocket$2;
|
|
2548
2524
|
/**
|
|
2549
2525
|
* Initialize a WebSocket client.
|
|
2550
2526
|
*
|
|
@@ -2708,8 +2684,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2708
2684
|
try {
|
|
2709
2685
|
addr = new URL(location, address);
|
|
2710
2686
|
} catch (e) {
|
|
2711
|
-
|
|
2712
|
-
emitErrorAndClose(websocket, err);
|
|
2687
|
+
emitErrorAndClose(websocket, /* @__PURE__ */ new SyntaxError(`Invalid URL: ${location}`));
|
|
2713
2688
|
return;
|
|
2714
2689
|
}
|
|
2715
2690
|
initAsClient(websocket, addr, protocols, options);
|
|
@@ -2717,7 +2692,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2717
2692
|
});
|
|
2718
2693
|
req.on("upgrade", (res, socket, head) => {
|
|
2719
2694
|
websocket.emit("upgrade", res);
|
|
2720
|
-
if (websocket.readyState !== WebSocket$
|
|
2695
|
+
if (websocket.readyState !== WebSocket$2.CONNECTING) return;
|
|
2721
2696
|
req = websocket._req = null;
|
|
2722
2697
|
const upgrade = res.headers.upgrade;
|
|
2723
2698
|
if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
|
|
@@ -2743,29 +2718,25 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2743
2718
|
const secWebSocketExtensions = res.headers["sec-websocket-extensions"];
|
|
2744
2719
|
if (secWebSocketExtensions !== void 0) {
|
|
2745
2720
|
if (!perMessageDeflate) {
|
|
2746
|
-
|
|
2747
|
-
abortHandshake$1(websocket, socket, message);
|
|
2721
|
+
abortHandshake$1(websocket, socket, "Server sent a Sec-WebSocket-Extensions header but no extension was requested");
|
|
2748
2722
|
return;
|
|
2749
2723
|
}
|
|
2750
2724
|
let extensions;
|
|
2751
2725
|
try {
|
|
2752
2726
|
extensions = parse$2(secWebSocketExtensions);
|
|
2753
2727
|
} catch (err) {
|
|
2754
|
-
|
|
2755
|
-
abortHandshake$1(websocket, socket, message);
|
|
2728
|
+
abortHandshake$1(websocket, socket, "Invalid Sec-WebSocket-Extensions header");
|
|
2756
2729
|
return;
|
|
2757
2730
|
}
|
|
2758
2731
|
const extensionNames = Object.keys(extensions);
|
|
2759
2732
|
if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate$1.extensionName) {
|
|
2760
|
-
|
|
2761
|
-
abortHandshake$1(websocket, socket, message);
|
|
2733
|
+
abortHandshake$1(websocket, socket, "Server indicated an extension that was not requested");
|
|
2762
2734
|
return;
|
|
2763
2735
|
}
|
|
2764
2736
|
try {
|
|
2765
2737
|
perMessageDeflate.accept(extensions[PerMessageDeflate$1.extensionName]);
|
|
2766
2738
|
} catch (err) {
|
|
2767
|
-
|
|
2768
|
-
abortHandshake$1(websocket, socket, message);
|
|
2739
|
+
abortHandshake$1(websocket, socket, "Invalid Sec-WebSocket-Extensions header");
|
|
2769
2740
|
return;
|
|
2770
2741
|
}
|
|
2771
2742
|
websocket._extensions[PerMessageDeflate$1.extensionName] = perMessageDeflate;
|
|
@@ -2788,7 +2759,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2788
2759
|
* @private
|
|
2789
2760
|
*/
|
|
2790
2761
|
function emitErrorAndClose(websocket, err) {
|
|
2791
|
-
websocket._readyState = WebSocket$
|
|
2762
|
+
websocket._readyState = WebSocket$2.CLOSING;
|
|
2792
2763
|
websocket._errorEmitted = true;
|
|
2793
2764
|
websocket.emit("error", err);
|
|
2794
2765
|
websocket.emitClose();
|
|
@@ -2826,7 +2797,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2826
2797
|
* @private
|
|
2827
2798
|
*/
|
|
2828
2799
|
function abortHandshake$1(websocket, stream, message) {
|
|
2829
|
-
websocket._readyState = WebSocket$
|
|
2800
|
+
websocket._readyState = WebSocket$2.CLOSING;
|
|
2830
2801
|
const err = new Error(message);
|
|
2831
2802
|
Error.captureStackTrace(err, abortHandshake$1);
|
|
2832
2803
|
if (stream.setHeader) {
|
|
@@ -2960,9 +2931,9 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2960
2931
|
*/
|
|
2961
2932
|
function senderOnError(err) {
|
|
2962
2933
|
const websocket = this[kWebSocket$1];
|
|
2963
|
-
if (websocket.readyState === WebSocket$
|
|
2964
|
-
if (websocket.readyState === WebSocket$
|
|
2965
|
-
websocket._readyState = WebSocket$
|
|
2934
|
+
if (websocket.readyState === WebSocket$2.CLOSED) return;
|
|
2935
|
+
if (websocket.readyState === WebSocket$2.OPEN) {
|
|
2936
|
+
websocket._readyState = WebSocket$2.CLOSING;
|
|
2966
2937
|
setCloseTimer(websocket);
|
|
2967
2938
|
}
|
|
2968
2939
|
this._socket.end();
|
|
@@ -2990,7 +2961,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
2990
2961
|
this.removeListener("close", socketOnClose);
|
|
2991
2962
|
this.removeListener("data", socketOnData);
|
|
2992
2963
|
this.removeListener("end", socketOnEnd);
|
|
2993
|
-
websocket._readyState = WebSocket$
|
|
2964
|
+
websocket._readyState = WebSocket$2.CLOSING;
|
|
2994
2965
|
let chunk;
|
|
2995
2966
|
if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && (chunk = websocket._socket.read()) !== null) websocket._receiver.write(chunk);
|
|
2996
2967
|
websocket._receiver.end();
|
|
@@ -3018,7 +2989,7 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
3018
2989
|
*/
|
|
3019
2990
|
function socketOnEnd() {
|
|
3020
2991
|
const websocket = this[kWebSocket$1];
|
|
3021
|
-
websocket._readyState = WebSocket$
|
|
2992
|
+
websocket._readyState = WebSocket$2.CLOSING;
|
|
3022
2993
|
websocket._receiver.end();
|
|
3023
2994
|
this.end();
|
|
3024
2995
|
}
|
|
@@ -3032,16 +3003,16 @@ var require_websocket = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_mo
|
|
|
3032
3003
|
this.removeListener("error", socketOnError$1);
|
|
3033
3004
|
this.on("error", NOOP$1);
|
|
3034
3005
|
if (websocket) {
|
|
3035
|
-
websocket._readyState = WebSocket$
|
|
3006
|
+
websocket._readyState = WebSocket$2.CLOSING;
|
|
3036
3007
|
this.destroy();
|
|
3037
3008
|
}
|
|
3038
3009
|
}
|
|
3039
|
-
} });
|
|
3010
|
+
}) });
|
|
3040
3011
|
|
|
3041
3012
|
//#endregion
|
|
3042
3013
|
//#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
|
-
|
|
3014
|
+
var require_stream = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/stream.js": ((exports, module) => {
|
|
3015
|
+
require_websocket();
|
|
3045
3016
|
const { Duplex: Duplex$1 } = __require("stream");
|
|
3046
3017
|
/**
|
|
3047
3018
|
* Emits the `'close'` event on a stream.
|
|
@@ -3153,11 +3124,11 @@ var require_stream = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modul
|
|
|
3153
3124
|
return duplex;
|
|
3154
3125
|
}
|
|
3155
3126
|
module.exports = createWebSocketStream$1;
|
|
3156
|
-
} });
|
|
3127
|
+
}) });
|
|
3157
3128
|
|
|
3158
3129
|
//#endregion
|
|
3159
3130
|
//#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) {
|
|
3131
|
+
var require_subprotocol = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/subprotocol.js": ((exports, module) => {
|
|
3161
3132
|
const { tokenChars } = require_validation();
|
|
3162
3133
|
/**
|
|
3163
3134
|
* Parses the `Sec-WebSocket-Protocol` header into a set of subprotocol names.
|
|
@@ -3193,11 +3164,11 @@ var require_subprotocol = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_
|
|
|
3193
3164
|
return protocols;
|
|
3194
3165
|
}
|
|
3195
3166
|
module.exports = { parse: parse$1 };
|
|
3196
|
-
} });
|
|
3167
|
+
}) });
|
|
3197
3168
|
|
|
3198
3169
|
//#endregion
|
|
3199
3170
|
//#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) {
|
|
3171
|
+
var require_websocket_server = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket-server.js": ((exports, module) => {
|
|
3201
3172
|
const EventEmitter = __require("events");
|
|
3202
3173
|
const http = __require("http");
|
|
3203
3174
|
const { Duplex } = __require("stream");
|
|
@@ -3357,8 +3328,7 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/
|
|
|
3357
3328
|
shouldHandle(req) {
|
|
3358
3329
|
if (this.options.path) {
|
|
3359
3330
|
const index = req.url.indexOf("?");
|
|
3360
|
-
|
|
3361
|
-
if (pathname !== this.options.path) return false;
|
|
3331
|
+
if ((index !== -1 ? req.url.slice(0, index) : req.url) !== this.options.path) return false;
|
|
3362
3332
|
}
|
|
3363
3333
|
return true;
|
|
3364
3334
|
}
|
|
@@ -3377,23 +3347,19 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/
|
|
|
3377
3347
|
const upgrade = req.headers.upgrade;
|
|
3378
3348
|
const version = +req.headers["sec-websocket-version"];
|
|
3379
3349
|
if (req.method !== "GET") {
|
|
3380
|
-
|
|
3381
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);
|
|
3350
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 405, "Invalid HTTP method");
|
|
3382
3351
|
return;
|
|
3383
3352
|
}
|
|
3384
3353
|
if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
|
|
3385
|
-
|
|
3386
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
3354
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Invalid Upgrade header");
|
|
3387
3355
|
return;
|
|
3388
3356
|
}
|
|
3389
3357
|
if (key === void 0 || !keyRegex.test(key)) {
|
|
3390
|
-
|
|
3391
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
3358
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Missing or invalid Sec-WebSocket-Key header");
|
|
3392
3359
|
return;
|
|
3393
3360
|
}
|
|
3394
3361
|
if (version !== 13 && version !== 8) {
|
|
3395
|
-
|
|
3396
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, { "Sec-WebSocket-Version": "13, 8" });
|
|
3362
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Missing or invalid Sec-WebSocket-Version header", { "Sec-WebSocket-Version": "13, 8" });
|
|
3397
3363
|
return;
|
|
3398
3364
|
}
|
|
3399
3365
|
if (!this.shouldHandle(req)) {
|
|
@@ -3405,8 +3371,7 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/
|
|
|
3405
3371
|
if (secWebSocketProtocol !== void 0) try {
|
|
3406
3372
|
protocols = subprotocol.parse(secWebSocketProtocol);
|
|
3407
3373
|
} catch (err) {
|
|
3408
|
-
|
|
3409
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
3374
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Invalid Sec-WebSocket-Protocol header");
|
|
3410
3375
|
return;
|
|
3411
3376
|
}
|
|
3412
3377
|
const secWebSocketExtensions = req.headers["sec-websocket-extensions"];
|
|
@@ -3420,8 +3385,7 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/
|
|
|
3420
3385
|
extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
|
|
3421
3386
|
}
|
|
3422
3387
|
} catch (err) {
|
|
3423
|
-
|
|
3424
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
3388
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Invalid or unacceptable Sec-WebSocket-Extensions header");
|
|
3425
3389
|
return;
|
|
3426
3390
|
}
|
|
3427
3391
|
}
|
|
@@ -3459,12 +3423,11 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/
|
|
|
3459
3423
|
if (!socket.readable || !socket.writable) return socket.destroy();
|
|
3460
3424
|
if (socket[kWebSocket]) throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");
|
|
3461
3425
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
3462
|
-
const digest = createHash("sha1").update(key + GUID).digest("base64");
|
|
3463
3426
|
const headers = [
|
|
3464
3427
|
"HTTP/1.1 101 Switching Protocols",
|
|
3465
3428
|
"Upgrade: websocket",
|
|
3466
3429
|
"Connection: Upgrade",
|
|
3467
|
-
`Sec-WebSocket-Accept: ${digest}`
|
|
3430
|
+
`Sec-WebSocket-Accept: ${createHash("sha1").update(key + GUID).digest("base64")}`
|
|
3468
3431
|
];
|
|
3469
3432
|
const ws = new this.options.WebSocket(null, void 0, this.options);
|
|
3470
3433
|
if (protocols.size) {
|
|
@@ -3572,15 +3535,15 @@ var require_websocket_server = __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/
|
|
|
3572
3535
|
server.emit("wsClientError", err, socket, req);
|
|
3573
3536
|
} else abortHandshake(socket, code, message, headers);
|
|
3574
3537
|
}
|
|
3575
|
-
} });
|
|
3538
|
+
}) });
|
|
3576
3539
|
|
|
3577
3540
|
//#endregion
|
|
3578
3541
|
//#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);
|
|
3542
|
+
var import_stream = /* @__PURE__ */ __toESM(require_stream(), 1);
|
|
3543
|
+
var import_receiver = /* @__PURE__ */ __toESM(require_receiver(), 1);
|
|
3544
|
+
var import_sender = /* @__PURE__ */ __toESM(require_sender(), 1);
|
|
3545
|
+
var import_websocket = /* @__PURE__ */ __toESM(require_websocket(), 1);
|
|
3546
|
+
var import_websocket_server = /* @__PURE__ */ __toESM(require_websocket_server(), 1);
|
|
3584
3547
|
|
|
3585
3548
|
//#endregion
|
|
3586
3549
|
//#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.10",
|
|
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/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.12
|
|
44
|
+
"tsdown": "^0.15.12",
|
|
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.d.mts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { RpcClientPreset, RpcClientPresetBasicType, RpcClientPresetReturnType, RpcServerPreset, RpcServerPresetBasicType, RpcServerPresetReturnType, defineRpcClientPreset, defineRpcServerPreset } from "./index-CNN7vRfy.mjs";
|
|
2
|
-
export { RpcClientPreset, RpcClientPresetBasicType, RpcClientPresetReturnType, RpcServerPreset, RpcServerPresetBasicType, RpcServerPresetReturnType, defineRpcClientPreset, defineRpcServerPreset };
|
package/dist/presets/index.mjs
DELETED
/package/{LICENSE.md → LICENSE}
RENAMED
|
File without changes
|
|
File without changes
|