@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.
@@ -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 { RpcClientPreset, RpcClientPresetBasicType, RpcClientPresetReturnType, RpcServerPreset, RpcServerPresetBasicType, RpcServerPresetReturnType, defineRpcClientPreset, defineRpcServerPreset };
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,2 +1,2 @@
1
- import { RpcClientPreset, RpcClientPresetBasicType, RpcClientPresetReturnType, RpcServerPreset, RpcServerPresetBasicType, RpcServerPresetReturnType, defineRpcClientPreset, defineRpcServerPreset } from "../index-BOWJO778.js";
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 };
@@ -1,3 +1,3 @@
1
- import { defineRpcClientPreset, defineRpcServerPreset } from "../presets-CXNlz3L-.js";
1
+ import { n as defineRpcServerPreset, t as defineRpcClientPreset } from "../presets-CHvTKHNF.js";
2
2
 
3
3
  export { defineRpcClientPreset, defineRpcServerPreset };
@@ -1,4 +1,4 @@
1
- import { RpcClientPreset } from "../../index-BOWJO778.js";
1
+ import { t as RpcClientPreset } from "../../index-SwSDJlvS.js";
2
2
 
3
3
  //#region src/presets/ws/client.d.ts
4
4
  interface WebSocketRpcClientOptions {
@@ -1,4 +1,4 @@
1
- import { defineRpcClientPreset } from "../../presets-CXNlz3L-.js";
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
- const _e = e instanceof Error ? e : new Error(e.type);
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 "../../index-BOWJO778.js";
1
+ import { i as RpcServerPreset } from "../../index-SwSDJlvS.js";
2
2
  import { BirpcGroup, BirpcOptions } from "birpc";
3
3
  import { WebSocket } from "ws";
4
4
 
@@ -1,4 +1,4 @@
1
- import { defineRpcServerPreset } from "../../presets-CXNlz3L-.js";
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
- const error = this.createError(RangeError, "RSV2 and RSV3 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_2_3");
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
- const error = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
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
- const error = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
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
- const error = this.createError(RangeError, "invalid opcode 0", true, 1002, "WS_ERR_INVALID_OPCODE");
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
- const error = this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE");
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
- const error = this.createError(RangeError, "FIN must be set", true, 1002, "WS_ERR_EXPECTED_FIN");
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
- const error = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
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
- const error = this.createError(RangeError, `invalid payload length ${this._payloadLength}`, true, 1002, "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");
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
- const error = this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE");
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
- const error = this.createError(RangeError, "MASK must be set", true, 1002, "WS_ERR_EXPECTED_MASK");
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
- const error = this.createError(RangeError, "MASK must be clear", true, 1002, "WS_ERR_UNEXPECTED_MASK");
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
- const error = this.createError(RangeError, "Unsupported WebSocket frame: payload length > 2^53 - 1", false, 1009, "WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");
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
- const error = this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");
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
- const error = this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");
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
- const error = this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8");
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
- const error = this.createError(RangeError, `invalid status code ${code}`, true, 1002, "WS_ERR_INVALID_CLOSE_CODE");
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
- const error = this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8");
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
- const err = /* @__PURE__ */ new SyntaxError(`Invalid URL: ${location}`);
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);
@@ -7,4 +7,4 @@ function defineRpcClientPreset(preset) {
7
7
  }
8
8
 
9
9
  //#endregion
10
- export { defineRpcClientPreset, defineRpcServerPreset };
10
+ export { defineRpcServerPreset as n, defineRpcClientPreset as t };
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.6",
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.6",
44
+ "tsdown": "^0.15.12",
45
45
  "ws": "^8.18.3"
46
46
  },
47
47
  "scripts": {