@vitejs/devtools-rpc 0.0.0-alpha.6 → 0.0.0-alpha.7
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-BOWJO778.d.ts → index-SwSDJlvS.d.ts} +1 -1
- package/dist/presets/index.d.ts +1 -1
- package/dist/presets/index.js +1 -1
- package/dist/presets/ws/client.d.ts +1 -1
- package/dist/presets/ws/client.js +2 -3
- package/dist/presets/ws/server.d.ts +1 -1
- package/dist/presets/ws/server.js +20 -41
- package/dist/{presets-CXNlz3L-.js → presets-CHvTKHNF.js} +1 -1
- package/package.json +2 -2
|
@@ -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 };
|
package/dist/presets/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
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
2
|
export { RpcClientPreset, RpcClientPresetBasicType, RpcClientPresetReturnType, RpcServerPreset, RpcServerPresetBasicType, RpcServerPresetReturnType, defineRpcClientPreset, defineRpcServerPreset };
|
package/dist/presets/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineRpcClientPreset } from "../../presets-
|
|
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 { defineRpcServerPreset } from "../../presets-
|
|
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
|
|
|
@@ -260,10 +260,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJS({ "../../node_module
|
|
|
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}
|
|
@@ -889,14 +886,12 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
|
|
|
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 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
|
|
|
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 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
|
|
|
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 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
|
|
|
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
|
}
|
|
@@ -1069,8 +1053,7 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
|
|
|
1069
1053
|
if (buf.length) {
|
|
1070
1054
|
this._messageLength += buf.length;
|
|
1071
1055
|
if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
|
|
1072
|
-
|
|
1073
|
-
cb(error);
|
|
1056
|
+
cb(this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));
|
|
1074
1057
|
return;
|
|
1075
1058
|
}
|
|
1076
1059
|
this._fragments.push(buf);
|
|
@@ -1116,8 +1099,7 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
|
|
|
1116
1099
|
} else {
|
|
1117
1100
|
const buf = concat(fragments, messageLength);
|
|
1118
1101
|
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
1119
|
-
|
|
1120
|
-
cb(error);
|
|
1102
|
+
cb(this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8"));
|
|
1121
1103
|
return;
|
|
1122
1104
|
}
|
|
1123
1105
|
if (this._state === INFLATING || this._allowSynchronousEvents) {
|
|
@@ -1149,14 +1131,12 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
|
|
|
1149
1131
|
} else {
|
|
1150
1132
|
const code = data.readUInt16BE(0);
|
|
1151
1133
|
if (!isValidStatusCode$1(code)) {
|
|
1152
|
-
|
|
1153
|
-
cb(error);
|
|
1134
|
+
cb(this.createError(RangeError, `invalid status code ${code}`, true, 1002, "WS_ERR_INVALID_CLOSE_CODE"));
|
|
1154
1135
|
return;
|
|
1155
1136
|
}
|
|
1156
1137
|
const buf = new FastBuffer(data.buffer, data.byteOffset + 2, data.length - 2);
|
|
1157
1138
|
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
1158
|
-
|
|
1159
|
-
cb(error);
|
|
1139
|
+
cb(this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8"));
|
|
1160
1140
|
return;
|
|
1161
1141
|
}
|
|
1162
1142
|
this._loop = false;
|
|
@@ -2704,8 +2684,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2704
2684
|
try {
|
|
2705
2685
|
addr = new URL(location, address);
|
|
2706
2686
|
} catch (e) {
|
|
2707
|
-
|
|
2708
|
-
emitErrorAndClose(websocket, err);
|
|
2687
|
+
emitErrorAndClose(websocket, /* @__PURE__ */ new SyntaxError(`Invalid URL: ${location}`));
|
|
2709
2688
|
return;
|
|
2710
2689
|
}
|
|
2711
2690
|
initAsClient(websocket, addr, protocols, options);
|
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.7",
|
|
5
5
|
"description": "DevTools rpc for Vite (work in progress)",
|
|
6
6
|
"author": "VoidZero Inc.",
|
|
7
7
|
"license": "MIT",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"structured-clone-es": "^1.0.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"tsdown": "^0.15.
|
|
44
|
+
"tsdown": "^0.15.12",
|
|
45
45
|
"ws": "^8.18.3"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|