@vitejs/devtools-rpc 0.0.0-alpha.19 → 0.0.0-alpha.20
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 +7 -7
- package/dist/index.mjs +6 -2
- package/dist/presets/index.d.mts +12 -1
- package/dist/presets/index.mjs +8 -1
- package/dist/presets/ws/client.d.mts +3 -7
- package/dist/presets/ws/client.mjs +1 -1
- package/dist/presets/ws/server.d.mts +2 -2
- package/dist/presets/ws/server.mjs +251 -249
- package/package.json +3 -3
- package/dist/index-SH_k2HUP.d.mts +0 -13
- package/dist/presets-DpriP7xc.mjs +0 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineRpcServerPreset } from "../index.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { parse, stringify } from "structured-clone-es";
|
|
4
4
|
|
|
@@ -9,16 +9,18 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
9
9
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
10
|
var __getProtoOf = Object.getPrototypeOf;
|
|
11
11
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
-
var
|
|
13
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
14
|
-
};
|
|
12
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
15
13
|
var __copyProps = (to, from, except, desc) => {
|
|
16
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
16
|
+
key = keys[i];
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
18
|
+
__defProp(to, key, {
|
|
19
|
+
get: ((k) => from[k]).bind(null, key),
|
|
20
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
22
24
|
}
|
|
23
25
|
return to;
|
|
24
26
|
};
|
|
@@ -30,32 +32,32 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
30
32
|
|
|
31
33
|
//#endregion
|
|
32
34
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/constants.js
|
|
33
|
-
var require_constants = /* @__PURE__ */
|
|
34
|
-
const BINARY_TYPES
|
|
35
|
+
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
36
|
+
const BINARY_TYPES = [
|
|
35
37
|
"nodebuffer",
|
|
36
38
|
"arraybuffer",
|
|
37
39
|
"fragments"
|
|
38
40
|
];
|
|
39
|
-
const hasBlob
|
|
40
|
-
if (hasBlob
|
|
41
|
+
const hasBlob = typeof Blob !== "undefined";
|
|
42
|
+
if (hasBlob) BINARY_TYPES.push("blob");
|
|
41
43
|
module.exports = {
|
|
42
|
-
BINARY_TYPES
|
|
44
|
+
BINARY_TYPES,
|
|
43
45
|
EMPTY_BUFFER: Buffer.alloc(0),
|
|
44
46
|
GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
|
|
45
|
-
hasBlob
|
|
47
|
+
hasBlob,
|
|
46
48
|
kForOnEventAttribute: Symbol("kIsForOnEventAttribute"),
|
|
47
49
|
kListener: Symbol("kListener"),
|
|
48
50
|
kStatusCode: Symbol("status-code"),
|
|
49
51
|
kWebSocket: Symbol("websocket"),
|
|
50
52
|
NOOP: () => {}
|
|
51
53
|
};
|
|
52
|
-
})
|
|
54
|
+
}));
|
|
53
55
|
|
|
54
56
|
//#endregion
|
|
55
57
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/buffer-util.js
|
|
56
|
-
var require_buffer_util = /* @__PURE__ */
|
|
57
|
-
const { EMPTY_BUFFER
|
|
58
|
-
const FastBuffer
|
|
58
|
+
var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
59
|
+
const { EMPTY_BUFFER } = require_constants();
|
|
60
|
+
const FastBuffer = Buffer[Symbol.species];
|
|
59
61
|
/**
|
|
60
62
|
* Merges an array of buffers into a new buffer.
|
|
61
63
|
*
|
|
@@ -64,8 +66,8 @@ var require_buffer_util = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
|
|
|
64
66
|
* @return {Buffer} The resulting buffer
|
|
65
67
|
* @public
|
|
66
68
|
*/
|
|
67
|
-
function concat
|
|
68
|
-
if (list.length === 0) return EMPTY_BUFFER
|
|
69
|
+
function concat(list, totalLength) {
|
|
70
|
+
if (list.length === 0) return EMPTY_BUFFER;
|
|
69
71
|
if (list.length === 1) return list[0];
|
|
70
72
|
const target = Buffer.allocUnsafe(totalLength);
|
|
71
73
|
let offset = 0;
|
|
@@ -74,7 +76,7 @@ var require_buffer_util = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
|
|
|
74
76
|
target.set(buf, offset);
|
|
75
77
|
offset += buf.length;
|
|
76
78
|
}
|
|
77
|
-
if (offset < totalLength) return new FastBuffer
|
|
79
|
+
if (offset < totalLength) return new FastBuffer(target.buffer, target.byteOffset, offset);
|
|
78
80
|
return target;
|
|
79
81
|
}
|
|
80
82
|
/**
|
|
@@ -107,7 +109,7 @@ var require_buffer_util = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
|
|
|
107
109
|
* @return {ArrayBuffer} Converted buffer
|
|
108
110
|
* @public
|
|
109
111
|
*/
|
|
110
|
-
function toArrayBuffer
|
|
112
|
+
function toArrayBuffer(buf) {
|
|
111
113
|
if (buf.length === buf.buffer.byteLength) return buf.buffer;
|
|
112
114
|
return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length);
|
|
113
115
|
}
|
|
@@ -119,49 +121,49 @@ var require_buffer_util = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
|
|
|
119
121
|
* @throws {TypeError}
|
|
120
122
|
* @public
|
|
121
123
|
*/
|
|
122
|
-
function toBuffer
|
|
123
|
-
toBuffer
|
|
124
|
+
function toBuffer(data) {
|
|
125
|
+
toBuffer.readOnly = true;
|
|
124
126
|
if (Buffer.isBuffer(data)) return data;
|
|
125
127
|
let buf;
|
|
126
|
-
if (data instanceof ArrayBuffer) buf = new FastBuffer
|
|
127
|
-
else if (ArrayBuffer.isView(data)) buf = new FastBuffer
|
|
128
|
+
if (data instanceof ArrayBuffer) buf = new FastBuffer(data);
|
|
129
|
+
else if (ArrayBuffer.isView(data)) buf = new FastBuffer(data.buffer, data.byteOffset, data.byteLength);
|
|
128
130
|
else {
|
|
129
131
|
buf = Buffer.from(data);
|
|
130
|
-
toBuffer
|
|
132
|
+
toBuffer.readOnly = false;
|
|
131
133
|
}
|
|
132
134
|
return buf;
|
|
133
135
|
}
|
|
134
136
|
module.exports = {
|
|
135
|
-
concat
|
|
137
|
+
concat,
|
|
136
138
|
mask: _mask,
|
|
137
|
-
toArrayBuffer
|
|
138
|
-
toBuffer
|
|
139
|
+
toArrayBuffer,
|
|
140
|
+
toBuffer,
|
|
139
141
|
unmask: _unmask
|
|
140
142
|
};
|
|
141
143
|
/* istanbul ignore else */
|
|
142
144
|
if (!process.env.WS_NO_BUFFER_UTIL) try {
|
|
143
|
-
const bufferUtil
|
|
145
|
+
const bufferUtil = __require("bufferutil");
|
|
144
146
|
module.exports.mask = function(source, mask, output, offset, length) {
|
|
145
147
|
if (length < 48) _mask(source, mask, output, offset, length);
|
|
146
|
-
else bufferUtil
|
|
148
|
+
else bufferUtil.mask(source, mask, output, offset, length);
|
|
147
149
|
};
|
|
148
150
|
module.exports.unmask = function(buffer, mask) {
|
|
149
151
|
if (buffer.length < 32) _unmask(buffer, mask);
|
|
150
|
-
else bufferUtil
|
|
152
|
+
else bufferUtil.unmask(buffer, mask);
|
|
151
153
|
};
|
|
152
154
|
} catch (e) {}
|
|
153
|
-
})
|
|
155
|
+
}));
|
|
154
156
|
|
|
155
157
|
//#endregion
|
|
156
158
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/limiter.js
|
|
157
|
-
var require_limiter = /* @__PURE__ */
|
|
159
|
+
var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
158
160
|
const kDone = Symbol("kDone");
|
|
159
161
|
const kRun = Symbol("kRun");
|
|
160
162
|
/**
|
|
161
163
|
* A very simple job queue with adjustable concurrency. Adapted from
|
|
162
164
|
* https://github.com/STRML/async-limiter
|
|
163
165
|
*/
|
|
164
|
-
var Limiter
|
|
166
|
+
var Limiter = class {
|
|
165
167
|
/**
|
|
166
168
|
* Creates a new `Limiter`.
|
|
167
169
|
*
|
|
@@ -201,17 +203,17 @@ var require_limiter = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@
|
|
|
201
203
|
}
|
|
202
204
|
}
|
|
203
205
|
};
|
|
204
|
-
module.exports = Limiter
|
|
205
|
-
})
|
|
206
|
+
module.exports = Limiter;
|
|
207
|
+
}));
|
|
206
208
|
|
|
207
209
|
//#endregion
|
|
208
210
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/permessage-deflate.js
|
|
209
|
-
var require_permessage_deflate = /* @__PURE__ */
|
|
211
|
+
var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
210
212
|
const zlib = __require("zlib");
|
|
211
213
|
const bufferUtil = require_buffer_util();
|
|
212
214
|
const Limiter = require_limiter();
|
|
213
|
-
const { kStatusCode
|
|
214
|
-
const FastBuffer
|
|
215
|
+
const { kStatusCode } = require_constants();
|
|
216
|
+
const FastBuffer = Buffer[Symbol.species];
|
|
215
217
|
const TRAILER = Buffer.from([
|
|
216
218
|
0,
|
|
217
219
|
0,
|
|
@@ -222,12 +224,12 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJS({ "../../node_module
|
|
|
222
224
|
const kTotalLength = Symbol("total-length");
|
|
223
225
|
const kCallback = Symbol("callback");
|
|
224
226
|
const kBuffers = Symbol("buffers");
|
|
225
|
-
const kError
|
|
227
|
+
const kError = Symbol("error");
|
|
226
228
|
let zlibLimiter;
|
|
227
229
|
/**
|
|
228
230
|
* permessage-deflate implementation.
|
|
229
231
|
*/
|
|
230
|
-
var PerMessageDeflate
|
|
232
|
+
var PerMessageDeflate = class {
|
|
231
233
|
/**
|
|
232
234
|
* Creates a PerMessageDeflate instance.
|
|
233
235
|
*
|
|
@@ -438,7 +440,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJS({ "../../node_module
|
|
|
438
440
|
this._inflate.write(data);
|
|
439
441
|
if (fin) this._inflate.write(TRAILER);
|
|
440
442
|
this._inflate.flush(() => {
|
|
441
|
-
const err = this._inflate[kError
|
|
443
|
+
const err = this._inflate[kError];
|
|
442
444
|
if (err) {
|
|
443
445
|
this._inflate.close();
|
|
444
446
|
this._inflate = null;
|
|
@@ -483,7 +485,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJS({ "../../node_module
|
|
|
483
485
|
this._deflate.flush(zlib.Z_SYNC_FLUSH, () => {
|
|
484
486
|
if (!this._deflate) return;
|
|
485
487
|
let data$1 = bufferUtil.concat(this._deflate[kBuffers], this._deflate[kTotalLength]);
|
|
486
|
-
if (fin) data$1 = new FastBuffer
|
|
488
|
+
if (fin) data$1 = new FastBuffer(data$1.buffer, data$1.byteOffset, data$1.length - 4);
|
|
487
489
|
this._deflate[kCallback] = null;
|
|
488
490
|
this._deflate[kTotalLength] = 0;
|
|
489
491
|
this._deflate[kBuffers] = [];
|
|
@@ -492,7 +494,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJS({ "../../node_module
|
|
|
492
494
|
});
|
|
493
495
|
}
|
|
494
496
|
};
|
|
495
|
-
module.exports = PerMessageDeflate
|
|
497
|
+
module.exports = PerMessageDeflate;
|
|
496
498
|
/**
|
|
497
499
|
* The listener of the `zlib.DeflateRaw` stream `'data'` event.
|
|
498
500
|
*
|
|
@@ -515,9 +517,9 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJS({ "../../node_module
|
|
|
515
517
|
this[kBuffers].push(chunk);
|
|
516
518
|
return;
|
|
517
519
|
}
|
|
518
|
-
this[kError
|
|
519
|
-
this[kError
|
|
520
|
-
this[kError
|
|
520
|
+
this[kError] = /* @__PURE__ */ new RangeError("Max payload size exceeded");
|
|
521
|
+
this[kError].code = "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH";
|
|
522
|
+
this[kError][kStatusCode] = 1009;
|
|
521
523
|
this.removeListener("data", inflateOnData);
|
|
522
524
|
this.reset();
|
|
523
525
|
}
|
|
@@ -529,21 +531,21 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJS({ "../../node_module
|
|
|
529
531
|
*/
|
|
530
532
|
function inflateOnError(err) {
|
|
531
533
|
this[kPerMessageDeflate]._inflate = null;
|
|
532
|
-
if (this[kError
|
|
533
|
-
this[kCallback](this[kError
|
|
534
|
+
if (this[kError]) {
|
|
535
|
+
this[kCallback](this[kError]);
|
|
534
536
|
return;
|
|
535
537
|
}
|
|
536
|
-
err[kStatusCode
|
|
538
|
+
err[kStatusCode] = 1007;
|
|
537
539
|
this[kCallback](err);
|
|
538
540
|
}
|
|
539
|
-
})
|
|
541
|
+
}));
|
|
540
542
|
|
|
541
543
|
//#endregion
|
|
542
544
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/validation.js
|
|
543
|
-
var require_validation = /* @__PURE__ */
|
|
545
|
+
var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
544
546
|
const { isUtf8 } = __require("buffer");
|
|
545
547
|
const { hasBlob } = require_constants();
|
|
546
|
-
const tokenChars
|
|
548
|
+
const tokenChars = [
|
|
547
549
|
0,
|
|
548
550
|
0,
|
|
549
551
|
0,
|
|
@@ -680,7 +682,7 @@ var require_validation = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/
|
|
|
680
682
|
* @return {Boolean} `true` if the status code is valid, else `false`
|
|
681
683
|
* @public
|
|
682
684
|
*/
|
|
683
|
-
function isValidStatusCode
|
|
685
|
+
function isValidStatusCode(code) {
|
|
684
686
|
return code >= 1e3 && code <= 1014 && code !== 1004 && code !== 1005 && code !== 1006 || code >= 3e3 && code <= 4999;
|
|
685
687
|
}
|
|
686
688
|
/**
|
|
@@ -715,34 +717,34 @@ var require_validation = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/
|
|
|
715
717
|
* @return {Boolean} `true` if `value` is a `Blob`, else `false`
|
|
716
718
|
* @private
|
|
717
719
|
*/
|
|
718
|
-
function isBlob
|
|
720
|
+
function isBlob(value) {
|
|
719
721
|
return hasBlob && typeof value === "object" && typeof value.arrayBuffer === "function" && typeof value.type === "string" && typeof value.stream === "function" && (value[Symbol.toStringTag] === "Blob" || value[Symbol.toStringTag] === "File");
|
|
720
722
|
}
|
|
721
723
|
module.exports = {
|
|
722
|
-
isBlob
|
|
723
|
-
isValidStatusCode
|
|
724
|
+
isBlob,
|
|
725
|
+
isValidStatusCode,
|
|
724
726
|
isValidUTF8: _isValidUTF8,
|
|
725
|
-
tokenChars
|
|
727
|
+
tokenChars
|
|
726
728
|
};
|
|
727
729
|
if (isUtf8) module.exports.isValidUTF8 = function(buf) {
|
|
728
730
|
return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf);
|
|
729
731
|
};
|
|
730
732
|
else if (!process.env.WS_NO_UTF_8_VALIDATE) try {
|
|
731
|
-
const isValidUTF8
|
|
733
|
+
const isValidUTF8 = __require("utf-8-validate");
|
|
732
734
|
module.exports.isValidUTF8 = function(buf) {
|
|
733
|
-
return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8
|
|
735
|
+
return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);
|
|
734
736
|
};
|
|
735
737
|
} catch (e) {}
|
|
736
|
-
})
|
|
738
|
+
}));
|
|
737
739
|
|
|
738
740
|
//#endregion
|
|
739
741
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/receiver.js
|
|
740
|
-
var require_receiver = /* @__PURE__ */
|
|
742
|
+
var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
741
743
|
const { Writable } = __require("stream");
|
|
742
|
-
const PerMessageDeflate
|
|
743
|
-
const { BINARY_TYPES
|
|
744
|
+
const PerMessageDeflate = require_permessage_deflate();
|
|
745
|
+
const { BINARY_TYPES, EMPTY_BUFFER, kStatusCode, kWebSocket } = require_constants();
|
|
744
746
|
const { concat, toArrayBuffer, unmask } = require_buffer_util();
|
|
745
|
-
const { isValidStatusCode
|
|
747
|
+
const { isValidStatusCode, isValidUTF8 } = require_validation();
|
|
746
748
|
const FastBuffer = Buffer[Symbol.species];
|
|
747
749
|
const GET_INFO = 0;
|
|
748
750
|
const GET_PAYLOAD_LENGTH_16 = 1;
|
|
@@ -756,7 +758,7 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
|
|
|
756
758
|
*
|
|
757
759
|
* @extends Writable
|
|
758
760
|
*/
|
|
759
|
-
var Receiver
|
|
761
|
+
var Receiver = class extends Writable {
|
|
760
762
|
/**
|
|
761
763
|
* Creates a Receiver instance.
|
|
762
764
|
*
|
|
@@ -776,12 +778,12 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
|
|
|
776
778
|
constructor(options = {}) {
|
|
777
779
|
super();
|
|
778
780
|
this._allowSynchronousEvents = options.allowSynchronousEvents !== void 0 ? options.allowSynchronousEvents : true;
|
|
779
|
-
this._binaryType = options.binaryType || BINARY_TYPES
|
|
781
|
+
this._binaryType = options.binaryType || BINARY_TYPES[0];
|
|
780
782
|
this._extensions = options.extensions || {};
|
|
781
783
|
this._isServer = !!options.isServer;
|
|
782
784
|
this._maxPayload = options.maxPayload | 0;
|
|
783
785
|
this._skipUTF8Validation = !!options.skipUTF8Validation;
|
|
784
|
-
this[kWebSocket
|
|
786
|
+
this[kWebSocket] = void 0;
|
|
785
787
|
this._bufferedBytes = 0;
|
|
786
788
|
this._buffers = [];
|
|
787
789
|
this._compressed = false;
|
|
@@ -890,7 +892,7 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
|
|
|
890
892
|
return;
|
|
891
893
|
}
|
|
892
894
|
const compressed = (buf[0] & 64) === 64;
|
|
893
|
-
if (compressed && !this._extensions[PerMessageDeflate
|
|
895
|
+
if (compressed && !this._extensions[PerMessageDeflate.extensionName]) {
|
|
894
896
|
cb(this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
|
|
895
897
|
return;
|
|
896
898
|
}
|
|
@@ -1016,7 +1018,7 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
|
|
|
1016
1018
|
* @private
|
|
1017
1019
|
*/
|
|
1018
1020
|
getData(cb) {
|
|
1019
|
-
let data = EMPTY_BUFFER
|
|
1021
|
+
let data = EMPTY_BUFFER;
|
|
1020
1022
|
if (this._payloadLength) {
|
|
1021
1023
|
if (this._bufferedBytes < this._payloadLength) {
|
|
1022
1024
|
this._loop = false;
|
|
@@ -1048,7 +1050,7 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
|
|
|
1048
1050
|
* @private
|
|
1049
1051
|
*/
|
|
1050
1052
|
decompress(data, cb) {
|
|
1051
|
-
this._extensions[PerMessageDeflate
|
|
1053
|
+
this._extensions[PerMessageDeflate.extensionName].decompress(data, this._fin, (err, buf) => {
|
|
1052
1054
|
if (err) return cb(err);
|
|
1053
1055
|
if (buf.length) {
|
|
1054
1056
|
this._messageLength += buf.length;
|
|
@@ -1126,11 +1128,11 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
|
|
|
1126
1128
|
if (this._opcode === 8) {
|
|
1127
1129
|
if (data.length === 0) {
|
|
1128
1130
|
this._loop = false;
|
|
1129
|
-
this.emit("conclude", 1005, EMPTY_BUFFER
|
|
1131
|
+
this.emit("conclude", 1005, EMPTY_BUFFER);
|
|
1130
1132
|
this.end();
|
|
1131
1133
|
} else {
|
|
1132
1134
|
const code = data.readUInt16BE(0);
|
|
1133
|
-
if (!isValidStatusCode
|
|
1135
|
+
if (!isValidStatusCode(code)) {
|
|
1134
1136
|
cb(this.createError(RangeError, `invalid status code ${code}`, true, 1002, "WS_ERR_INVALID_CLOSE_CODE"));
|
|
1135
1137
|
return;
|
|
1136
1138
|
}
|
|
@@ -1176,22 +1178,22 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
|
|
|
1176
1178
|
const err = new ErrorCtor(prefix ? `Invalid WebSocket frame: ${message}` : message);
|
|
1177
1179
|
Error.captureStackTrace(err, this.createError);
|
|
1178
1180
|
err.code = errorCode;
|
|
1179
|
-
err[kStatusCode
|
|
1181
|
+
err[kStatusCode] = statusCode;
|
|
1180
1182
|
return err;
|
|
1181
1183
|
}
|
|
1182
1184
|
};
|
|
1183
|
-
module.exports = Receiver
|
|
1184
|
-
})
|
|
1185
|
+
module.exports = Receiver;
|
|
1186
|
+
}));
|
|
1185
1187
|
|
|
1186
1188
|
//#endregion
|
|
1187
1189
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/sender.js
|
|
1188
|
-
var require_sender = /* @__PURE__ */
|
|
1190
|
+
var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1189
1191
|
const { Duplex: Duplex$3 } = __require("stream");
|
|
1190
1192
|
const { randomFillSync } = __require("crypto");
|
|
1191
|
-
const PerMessageDeflate
|
|
1192
|
-
const { EMPTY_BUFFER
|
|
1193
|
-
const { isBlob
|
|
1194
|
-
const { mask: applyMask, toBuffer
|
|
1193
|
+
const PerMessageDeflate = require_permessage_deflate();
|
|
1194
|
+
const { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants();
|
|
1195
|
+
const { isBlob, isValidStatusCode } = require_validation();
|
|
1196
|
+
const { mask: applyMask, toBuffer } = require_buffer_util();
|
|
1195
1197
|
const kByteLength = Symbol("kByteLength");
|
|
1196
1198
|
const maskBuffer = Buffer.alloc(4);
|
|
1197
1199
|
const RANDOM_POOL_SIZE = 8 * 1024;
|
|
@@ -1203,7 +1205,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
1203
1205
|
/**
|
|
1204
1206
|
* HyBi Sender implementation.
|
|
1205
1207
|
*/
|
|
1206
|
-
var Sender
|
|
1208
|
+
var Sender = class Sender {
|
|
1207
1209
|
/**
|
|
1208
1210
|
* Creates a Sender instance.
|
|
1209
1211
|
*
|
|
@@ -1224,8 +1226,8 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
1224
1226
|
this._bufferedBytes = 0;
|
|
1225
1227
|
this._queue = [];
|
|
1226
1228
|
this._state = DEFAULT;
|
|
1227
|
-
this.onerror = NOOP
|
|
1228
|
-
this[kWebSocket
|
|
1229
|
+
this.onerror = NOOP;
|
|
1230
|
+
this[kWebSocket] = void 0;
|
|
1229
1231
|
}
|
|
1230
1232
|
/**
|
|
1231
1233
|
* Frames a piece of data according to the HyBi WebSocket protocol.
|
|
@@ -1323,7 +1325,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
1323
1325
|
*/
|
|
1324
1326
|
close(code, data, mask, cb) {
|
|
1325
1327
|
let buf;
|
|
1326
|
-
if (code === void 0) buf = EMPTY_BUFFER
|
|
1328
|
+
if (code === void 0) buf = EMPTY_BUFFER;
|
|
1327
1329
|
else if (typeof code !== "number" || !isValidStatusCode(code)) throw new TypeError("First argument must be a valid error code number");
|
|
1328
1330
|
else if (data === void 0 || !data.length) {
|
|
1329
1331
|
buf = Buffer.allocUnsafe(2);
|
|
@@ -1353,7 +1355,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
1353
1355
|
options,
|
|
1354
1356
|
cb
|
|
1355
1357
|
]);
|
|
1356
|
-
else this.sendFrame(Sender
|
|
1358
|
+
else this.sendFrame(Sender.frame(buf, options), cb);
|
|
1357
1359
|
}
|
|
1358
1360
|
/**
|
|
1359
1361
|
* Sends a ping message to the other peer.
|
|
@@ -1369,13 +1371,13 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
1369
1371
|
if (typeof data === "string") {
|
|
1370
1372
|
byteLength = Buffer.byteLength(data);
|
|
1371
1373
|
readOnly = false;
|
|
1372
|
-
} else if (isBlob
|
|
1374
|
+
} else if (isBlob(data)) {
|
|
1373
1375
|
byteLength = data.size;
|
|
1374
1376
|
readOnly = false;
|
|
1375
1377
|
} else {
|
|
1376
|
-
data = toBuffer
|
|
1378
|
+
data = toBuffer(data);
|
|
1377
1379
|
byteLength = data.length;
|
|
1378
|
-
readOnly = toBuffer
|
|
1380
|
+
readOnly = toBuffer.readOnly;
|
|
1379
1381
|
}
|
|
1380
1382
|
if (byteLength > 125) throw new RangeError("The data size must not be greater than 125 bytes");
|
|
1381
1383
|
const options = {
|
|
@@ -1388,7 +1390,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
1388
1390
|
readOnly,
|
|
1389
1391
|
rsv1: false
|
|
1390
1392
|
};
|
|
1391
|
-
if (isBlob
|
|
1393
|
+
if (isBlob(data)) if (this._state !== DEFAULT) this.enqueue([
|
|
1392
1394
|
this.getBlobData,
|
|
1393
1395
|
data,
|
|
1394
1396
|
false,
|
|
@@ -1403,7 +1405,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
1403
1405
|
options,
|
|
1404
1406
|
cb
|
|
1405
1407
|
]);
|
|
1406
|
-
else this.sendFrame(Sender
|
|
1408
|
+
else this.sendFrame(Sender.frame(data, options), cb);
|
|
1407
1409
|
}
|
|
1408
1410
|
/**
|
|
1409
1411
|
* Sends a pong message to the other peer.
|
|
@@ -1419,13 +1421,13 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
1419
1421
|
if (typeof data === "string") {
|
|
1420
1422
|
byteLength = Buffer.byteLength(data);
|
|
1421
1423
|
readOnly = false;
|
|
1422
|
-
} else if (isBlob
|
|
1424
|
+
} else if (isBlob(data)) {
|
|
1423
1425
|
byteLength = data.size;
|
|
1424
1426
|
readOnly = false;
|
|
1425
1427
|
} else {
|
|
1426
|
-
data = toBuffer
|
|
1428
|
+
data = toBuffer(data);
|
|
1427
1429
|
byteLength = data.length;
|
|
1428
|
-
readOnly = toBuffer
|
|
1430
|
+
readOnly = toBuffer.readOnly;
|
|
1429
1431
|
}
|
|
1430
1432
|
if (byteLength > 125) throw new RangeError("The data size must not be greater than 125 bytes");
|
|
1431
1433
|
const options = {
|
|
@@ -1438,7 +1440,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
1438
1440
|
readOnly,
|
|
1439
1441
|
rsv1: false
|
|
1440
1442
|
};
|
|
1441
|
-
if (isBlob
|
|
1443
|
+
if (isBlob(data)) if (this._state !== DEFAULT) this.enqueue([
|
|
1442
1444
|
this.getBlobData,
|
|
1443
1445
|
data,
|
|
1444
1446
|
false,
|
|
@@ -1453,7 +1455,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
1453
1455
|
options,
|
|
1454
1456
|
cb
|
|
1455
1457
|
]);
|
|
1456
|
-
else this.sendFrame(Sender
|
|
1458
|
+
else this.sendFrame(Sender.frame(data, options), cb);
|
|
1457
1459
|
}
|
|
1458
1460
|
/**
|
|
1459
1461
|
* Sends a data message to the other peer.
|
|
@@ -1472,7 +1474,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
1472
1474
|
* @public
|
|
1473
1475
|
*/
|
|
1474
1476
|
send(data, options, cb) {
|
|
1475
|
-
const perMessageDeflate = this._extensions[PerMessageDeflate
|
|
1477
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
|
|
1476
1478
|
let opcode = options.binary ? 2 : 1;
|
|
1477
1479
|
let rsv1 = options.compress;
|
|
1478
1480
|
let byteLength;
|
|
@@ -1480,13 +1482,13 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
1480
1482
|
if (typeof data === "string") {
|
|
1481
1483
|
byteLength = Buffer.byteLength(data);
|
|
1482
1484
|
readOnly = false;
|
|
1483
|
-
} else if (isBlob
|
|
1485
|
+
} else if (isBlob(data)) {
|
|
1484
1486
|
byteLength = data.size;
|
|
1485
1487
|
readOnly = false;
|
|
1486
1488
|
} else {
|
|
1487
|
-
data = toBuffer
|
|
1489
|
+
data = toBuffer(data);
|
|
1488
1490
|
byteLength = data.length;
|
|
1489
|
-
readOnly = toBuffer
|
|
1491
|
+
readOnly = toBuffer.readOnly;
|
|
1490
1492
|
}
|
|
1491
1493
|
if (this._firstFragment) {
|
|
1492
1494
|
this._firstFragment = false;
|
|
@@ -1507,7 +1509,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
1507
1509
|
readOnly,
|
|
1508
1510
|
rsv1
|
|
1509
1511
|
};
|
|
1510
|
-
if (isBlob
|
|
1512
|
+
if (isBlob(data)) if (this._state !== DEFAULT) this.enqueue([
|
|
1511
1513
|
this.getBlobData,
|
|
1512
1514
|
data,
|
|
1513
1515
|
this._compress,
|
|
@@ -1557,10 +1559,10 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
1557
1559
|
return;
|
|
1558
1560
|
}
|
|
1559
1561
|
this._bufferedBytes -= options[kByteLength];
|
|
1560
|
-
const data = toBuffer
|
|
1562
|
+
const data = toBuffer(arrayBuffer);
|
|
1561
1563
|
if (!compress) {
|
|
1562
1564
|
this._state = DEFAULT;
|
|
1563
|
-
this.sendFrame(Sender
|
|
1565
|
+
this.sendFrame(Sender.frame(data, options), cb);
|
|
1564
1566
|
this.dequeue();
|
|
1565
1567
|
} else this.dispatch(data, compress, options, cb);
|
|
1566
1568
|
}).catch((err) => {
|
|
@@ -1592,10 +1594,10 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
1592
1594
|
*/
|
|
1593
1595
|
dispatch(data, compress, options, cb) {
|
|
1594
1596
|
if (!compress) {
|
|
1595
|
-
this.sendFrame(Sender
|
|
1597
|
+
this.sendFrame(Sender.frame(data, options), cb);
|
|
1596
1598
|
return;
|
|
1597
1599
|
}
|
|
1598
|
-
const perMessageDeflate = this._extensions[PerMessageDeflate
|
|
1600
|
+
const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
|
|
1599
1601
|
this._bufferedBytes += options[kByteLength];
|
|
1600
1602
|
this._state = DEFLATING;
|
|
1601
1603
|
perMessageDeflate.compress(data, options.fin, (_, buf) => {
|
|
@@ -1606,7 +1608,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
1606
1608
|
this._bufferedBytes -= options[kByteLength];
|
|
1607
1609
|
this._state = DEFAULT;
|
|
1608
1610
|
options.readOnly = false;
|
|
1609
|
-
this.sendFrame(Sender
|
|
1611
|
+
this.sendFrame(Sender.frame(buf, options), cb);
|
|
1610
1612
|
this.dequeue();
|
|
1611
1613
|
});
|
|
1612
1614
|
}
|
|
@@ -1648,7 +1650,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
1648
1650
|
} else this._socket.write(list[0], cb);
|
|
1649
1651
|
}
|
|
1650
1652
|
};
|
|
1651
|
-
module.exports = Sender
|
|
1653
|
+
module.exports = Sender;
|
|
1652
1654
|
/**
|
|
1653
1655
|
* Calls queued callbacks with an error.
|
|
1654
1656
|
*
|
|
@@ -1677,12 +1679,12 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
1677
1679
|
callCallbacks(sender, err, cb);
|
|
1678
1680
|
sender.onerror(err);
|
|
1679
1681
|
}
|
|
1680
|
-
})
|
|
1682
|
+
}));
|
|
1681
1683
|
|
|
1682
1684
|
//#endregion
|
|
1683
1685
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/event-target.js
|
|
1684
|
-
var require_event_target = /* @__PURE__ */
|
|
1685
|
-
const { kForOnEventAttribute
|
|
1686
|
+
var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1687
|
+
const { kForOnEventAttribute, kListener } = require_constants();
|
|
1686
1688
|
const kCode = Symbol("kCode");
|
|
1687
1689
|
const kData = Symbol("kData");
|
|
1688
1690
|
const kError = Symbol("kError");
|
|
@@ -1836,7 +1838,7 @@ var require_event_target = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
|
|
|
1836
1838
|
*/
|
|
1837
1839
|
const EventTarget = {
|
|
1838
1840
|
addEventListener(type, handler, options = {}) {
|
|
1839
|
-
for (const listener of this.listeners(type)) if (!options[kForOnEventAttribute
|
|
1841
|
+
for (const listener of this.listeners(type)) if (!options[kForOnEventAttribute] && listener[kListener] === handler && !listener[kForOnEventAttribute]) return;
|
|
1840
1842
|
let wrapper;
|
|
1841
1843
|
if (type === "message") wrapper = function onMessage(data, isBinary) {
|
|
1842
1844
|
const event = new MessageEvent("message", { data: isBinary ? data : data.toString() });
|
|
@@ -1852,7 +1854,7 @@ var require_event_target = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
|
|
|
1852
1854
|
event[kTarget] = this;
|
|
1853
1855
|
callListener(handler, this, event);
|
|
1854
1856
|
};
|
|
1855
|
-
else if (type === "error") wrapper = function onError
|
|
1857
|
+
else if (type === "error") wrapper = function onError(error) {
|
|
1856
1858
|
const event = new ErrorEvent("error", {
|
|
1857
1859
|
error,
|
|
1858
1860
|
message: error.message
|
|
@@ -1866,13 +1868,13 @@ var require_event_target = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
|
|
|
1866
1868
|
callListener(handler, this, event);
|
|
1867
1869
|
};
|
|
1868
1870
|
else return;
|
|
1869
|
-
wrapper[kForOnEventAttribute
|
|
1870
|
-
wrapper[kListener
|
|
1871
|
+
wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute];
|
|
1872
|
+
wrapper[kListener] = handler;
|
|
1871
1873
|
if (options.once) this.once(type, wrapper);
|
|
1872
1874
|
else this.on(type, wrapper);
|
|
1873
1875
|
},
|
|
1874
1876
|
removeEventListener(type, handler) {
|
|
1875
|
-
for (const listener of this.listeners(type)) if (listener[kListener
|
|
1877
|
+
for (const listener of this.listeners(type)) if (listener[kListener] === handler && !listener[kForOnEventAttribute]) {
|
|
1876
1878
|
this.removeListener(type, listener);
|
|
1877
1879
|
break;
|
|
1878
1880
|
}
|
|
@@ -1897,12 +1899,12 @@ var require_event_target = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
|
|
|
1897
1899
|
if (typeof listener === "object" && listener.handleEvent) listener.handleEvent.call(listener, event);
|
|
1898
1900
|
else listener.call(thisArg, event);
|
|
1899
1901
|
}
|
|
1900
|
-
})
|
|
1902
|
+
}));
|
|
1901
1903
|
|
|
1902
1904
|
//#endregion
|
|
1903
1905
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/extension.js
|
|
1904
|
-
var require_extension = /* @__PURE__ */
|
|
1905
|
-
const { tokenChars
|
|
1906
|
+
var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1907
|
+
const { tokenChars } = require_validation();
|
|
1906
1908
|
/**
|
|
1907
1909
|
* Adds an offer to the map of extension offers or a parameter to the map of
|
|
1908
1910
|
* parameters.
|
|
@@ -1924,7 +1926,7 @@ var require_extension = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
1924
1926
|
* @return {Object} The parsed object
|
|
1925
1927
|
* @public
|
|
1926
1928
|
*/
|
|
1927
|
-
function parse
|
|
1929
|
+
function parse(header) {
|
|
1928
1930
|
const offers = Object.create(null);
|
|
1929
1931
|
let params = Object.create(null);
|
|
1930
1932
|
let mustUnescape = false;
|
|
@@ -1938,7 +1940,7 @@ var require_extension = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
1938
1940
|
let i = 0;
|
|
1939
1941
|
for (; i < header.length; i++) {
|
|
1940
1942
|
code = header.charCodeAt(i);
|
|
1941
|
-
if (extensionName === void 0) if (end === -1 && tokenChars
|
|
1943
|
+
if (extensionName === void 0) if (end === -1 && tokenChars[code] === 1) {
|
|
1942
1944
|
if (start === -1) start = i;
|
|
1943
1945
|
} else if (i !== 0 && (code === 32 || code === 9)) {
|
|
1944
1946
|
if (end === -1 && start !== -1) end = i;
|
|
@@ -1952,7 +1954,7 @@ var require_extension = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
1952
1954
|
} else extensionName = name;
|
|
1953
1955
|
start = end = -1;
|
|
1954
1956
|
} else throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
1955
|
-
else if (paramName === void 0) if (end === -1 && tokenChars
|
|
1957
|
+
else if (paramName === void 0) if (end === -1 && tokenChars[code] === 1) {
|
|
1956
1958
|
if (start === -1) start = i;
|
|
1957
1959
|
} else if (code === 32 || code === 9) {
|
|
1958
1960
|
if (end === -1 && start !== -1) end = i;
|
|
@@ -1971,11 +1973,11 @@ var require_extension = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
1971
1973
|
start = end = -1;
|
|
1972
1974
|
} else throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
1973
1975
|
else if (isEscaping) {
|
|
1974
|
-
if (tokenChars
|
|
1976
|
+
if (tokenChars[code] !== 1) throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
1975
1977
|
if (start === -1) start = i;
|
|
1976
1978
|
else if (!mustUnescape) mustUnescape = true;
|
|
1977
1979
|
isEscaping = false;
|
|
1978
|
-
} else if (inQuotes) if (tokenChars
|
|
1980
|
+
} else if (inQuotes) if (tokenChars[code] === 1) {
|
|
1979
1981
|
if (start === -1) start = i;
|
|
1980
1982
|
} else if (code === 34 && start !== -1) {
|
|
1981
1983
|
inQuotes = false;
|
|
@@ -1983,7 +1985,7 @@ var require_extension = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
1983
1985
|
} else if (code === 92) isEscaping = true;
|
|
1984
1986
|
else throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
1985
1987
|
else if (code === 34 && header.charCodeAt(i - 1) === 61) inQuotes = true;
|
|
1986
|
-
else if (end === -1 && tokenChars
|
|
1988
|
+
else if (end === -1 && tokenChars[code] === 1) {
|
|
1987
1989
|
if (start === -1) start = i;
|
|
1988
1990
|
} else if (start !== -1 && (code === 32 || code === 9)) {
|
|
1989
1991
|
if (end === -1) end = i;
|
|
@@ -2024,12 +2026,12 @@ var require_extension = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2024
2026
|
* @return {String} A string representing the given object
|
|
2025
2027
|
* @public
|
|
2026
2028
|
*/
|
|
2027
|
-
function format
|
|
2028
|
-
return Object.keys(extensions).map((extension
|
|
2029
|
-
let configurations = extensions[extension
|
|
2029
|
+
function format(extensions) {
|
|
2030
|
+
return Object.keys(extensions).map((extension) => {
|
|
2031
|
+
let configurations = extensions[extension];
|
|
2030
2032
|
if (!Array.isArray(configurations)) configurations = [configurations];
|
|
2031
2033
|
return configurations.map((params) => {
|
|
2032
|
-
return [extension
|
|
2034
|
+
return [extension].concat(Object.keys(params).map((k) => {
|
|
2033
2035
|
let values = params[k];
|
|
2034
2036
|
if (!Array.isArray(values)) values = [values];
|
|
2035
2037
|
return values.map((v) => v === true ? k : `${k}=${v}`).join("; ");
|
|
@@ -2038,14 +2040,14 @@ var require_extension = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2038
2040
|
}).join(", ");
|
|
2039
2041
|
}
|
|
2040
2042
|
module.exports = {
|
|
2041
|
-
format
|
|
2042
|
-
parse
|
|
2043
|
+
format,
|
|
2044
|
+
parse
|
|
2043
2045
|
};
|
|
2044
|
-
})
|
|
2046
|
+
}));
|
|
2045
2047
|
|
|
2046
2048
|
//#endregion
|
|
2047
2049
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket.js
|
|
2048
|
-
var require_websocket = /* @__PURE__ */
|
|
2050
|
+
var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2049
2051
|
const EventEmitter$1 = __require("events");
|
|
2050
2052
|
const https = __require("https");
|
|
2051
2053
|
const http$1 = __require("http");
|
|
@@ -2054,13 +2056,13 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2054
2056
|
const { randomBytes, createHash: createHash$1 } = __require("crypto");
|
|
2055
2057
|
const { Duplex: Duplex$2, Readable } = __require("stream");
|
|
2056
2058
|
const { URL } = __require("url");
|
|
2057
|
-
const PerMessageDeflate
|
|
2058
|
-
const Receiver
|
|
2059
|
-
const Sender
|
|
2059
|
+
const PerMessageDeflate = require_permessage_deflate();
|
|
2060
|
+
const Receiver = require_receiver();
|
|
2061
|
+
const Sender = require_sender();
|
|
2060
2062
|
const { isBlob } = require_validation();
|
|
2061
|
-
const { BINARY_TYPES, EMPTY_BUFFER, GUID
|
|
2063
|
+
const { BINARY_TYPES, EMPTY_BUFFER, GUID, kForOnEventAttribute, kListener, kStatusCode, kWebSocket, NOOP } = require_constants();
|
|
2062
2064
|
const { EventTarget: { addEventListener, removeEventListener } } = require_event_target();
|
|
2063
|
-
const { format, parse
|
|
2065
|
+
const { format, parse } = require_extension();
|
|
2064
2066
|
const { toBuffer } = require_buffer_util();
|
|
2065
2067
|
const closeTimeout = 30 * 1e3;
|
|
2066
2068
|
const kAborted = Symbol("kAborted");
|
|
@@ -2077,7 +2079,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2077
2079
|
*
|
|
2078
2080
|
* @extends EventEmitter
|
|
2079
2081
|
*/
|
|
2080
|
-
var WebSocket
|
|
2082
|
+
var WebSocket = class WebSocket extends EventEmitter$1 {
|
|
2081
2083
|
/**
|
|
2082
2084
|
* Create a new `WebSocket`.
|
|
2083
2085
|
*
|
|
@@ -2097,7 +2099,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2097
2099
|
this._extensions = {};
|
|
2098
2100
|
this._paused = false;
|
|
2099
2101
|
this._protocol = "";
|
|
2100
|
-
this._readyState = WebSocket
|
|
2102
|
+
this._readyState = WebSocket.CONNECTING;
|
|
2101
2103
|
this._receiver = null;
|
|
2102
2104
|
this._sender = null;
|
|
2103
2105
|
this._socket = null;
|
|
@@ -2212,7 +2214,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2212
2214
|
* @private
|
|
2213
2215
|
*/
|
|
2214
2216
|
setSocket(socket, head, options) {
|
|
2215
|
-
const receiver = new Receiver
|
|
2217
|
+
const receiver = new Receiver({
|
|
2216
2218
|
allowSynchronousEvents: options.allowSynchronousEvents,
|
|
2217
2219
|
binaryType: this.binaryType,
|
|
2218
2220
|
extensions: this._extensions,
|
|
@@ -2220,13 +2222,13 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2220
2222
|
maxPayload: options.maxPayload,
|
|
2221
2223
|
skipUTF8Validation: options.skipUTF8Validation
|
|
2222
2224
|
});
|
|
2223
|
-
const sender = new Sender
|
|
2225
|
+
const sender = new Sender(socket, this._extensions, options.generateMask);
|
|
2224
2226
|
this._receiver = receiver;
|
|
2225
2227
|
this._sender = sender;
|
|
2226
2228
|
this._socket = socket;
|
|
2227
|
-
receiver[kWebSocket
|
|
2228
|
-
sender[kWebSocket
|
|
2229
|
-
socket[kWebSocket
|
|
2229
|
+
receiver[kWebSocket] = this;
|
|
2230
|
+
sender[kWebSocket] = this;
|
|
2231
|
+
socket[kWebSocket] = this;
|
|
2230
2232
|
receiver.on("conclude", receiverOnConclude);
|
|
2231
2233
|
receiver.on("drain", receiverOnDrain);
|
|
2232
2234
|
receiver.on("error", receiverOnError);
|
|
@@ -2240,8 +2242,8 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2240
2242
|
socket.on("close", socketOnClose);
|
|
2241
2243
|
socket.on("data", socketOnData);
|
|
2242
2244
|
socket.on("end", socketOnEnd);
|
|
2243
|
-
socket.on("error", socketOnError
|
|
2244
|
-
this._readyState = WebSocket
|
|
2245
|
+
socket.on("error", socketOnError);
|
|
2246
|
+
this._readyState = WebSocket.OPEN;
|
|
2245
2247
|
this.emit("open");
|
|
2246
2248
|
}
|
|
2247
2249
|
/**
|
|
@@ -2251,13 +2253,13 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2251
2253
|
*/
|
|
2252
2254
|
emitClose() {
|
|
2253
2255
|
if (!this._socket) {
|
|
2254
|
-
this._readyState = WebSocket
|
|
2256
|
+
this._readyState = WebSocket.CLOSED;
|
|
2255
2257
|
this.emit("close", this._closeCode, this._closeMessage);
|
|
2256
2258
|
return;
|
|
2257
2259
|
}
|
|
2258
|
-
if (this._extensions[PerMessageDeflate
|
|
2260
|
+
if (this._extensions[PerMessageDeflate.extensionName]) this._extensions[PerMessageDeflate.extensionName].cleanup();
|
|
2259
2261
|
this._receiver.removeAllListeners();
|
|
2260
|
-
this._readyState = WebSocket
|
|
2262
|
+
this._readyState = WebSocket.CLOSED;
|
|
2261
2263
|
this.emit("close", this._closeCode, this._closeMessage);
|
|
2262
2264
|
}
|
|
2263
2265
|
/**
|
|
@@ -2281,16 +2283,16 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2281
2283
|
* @public
|
|
2282
2284
|
*/
|
|
2283
2285
|
close(code, data) {
|
|
2284
|
-
if (this.readyState === WebSocket
|
|
2285
|
-
if (this.readyState === WebSocket
|
|
2286
|
-
abortHandshake
|
|
2286
|
+
if (this.readyState === WebSocket.CLOSED) return;
|
|
2287
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
2288
|
+
abortHandshake(this, this._req, "WebSocket was closed before the connection was established");
|
|
2287
2289
|
return;
|
|
2288
2290
|
}
|
|
2289
|
-
if (this.readyState === WebSocket
|
|
2291
|
+
if (this.readyState === WebSocket.CLOSING) {
|
|
2290
2292
|
if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) this._socket.end();
|
|
2291
2293
|
return;
|
|
2292
2294
|
}
|
|
2293
|
-
this._readyState = WebSocket
|
|
2295
|
+
this._readyState = WebSocket.CLOSING;
|
|
2294
2296
|
this._sender.close(code, data, !this._isServer, (err) => {
|
|
2295
2297
|
if (err) return;
|
|
2296
2298
|
this._closeFrameSent = true;
|
|
@@ -2304,7 +2306,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2304
2306
|
* @public
|
|
2305
2307
|
*/
|
|
2306
2308
|
pause() {
|
|
2307
|
-
if (this.readyState === WebSocket
|
|
2309
|
+
if (this.readyState === WebSocket.CONNECTING || this.readyState === WebSocket.CLOSED) return;
|
|
2308
2310
|
this._paused = true;
|
|
2309
2311
|
this._socket.pause();
|
|
2310
2312
|
}
|
|
@@ -2317,7 +2319,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2317
2319
|
* @public
|
|
2318
2320
|
*/
|
|
2319
2321
|
ping(data, mask, cb) {
|
|
2320
|
-
if (this.readyState === WebSocket
|
|
2322
|
+
if (this.readyState === WebSocket.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
2321
2323
|
if (typeof data === "function") {
|
|
2322
2324
|
cb = data;
|
|
2323
2325
|
data = mask = void 0;
|
|
@@ -2326,7 +2328,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2326
2328
|
mask = void 0;
|
|
2327
2329
|
}
|
|
2328
2330
|
if (typeof data === "number") data = data.toString();
|
|
2329
|
-
if (this.readyState !== WebSocket
|
|
2331
|
+
if (this.readyState !== WebSocket.OPEN) {
|
|
2330
2332
|
sendAfterClose(this, data, cb);
|
|
2331
2333
|
return;
|
|
2332
2334
|
}
|
|
@@ -2342,7 +2344,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2342
2344
|
* @public
|
|
2343
2345
|
*/
|
|
2344
2346
|
pong(data, mask, cb) {
|
|
2345
|
-
if (this.readyState === WebSocket
|
|
2347
|
+
if (this.readyState === WebSocket.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
2346
2348
|
if (typeof data === "function") {
|
|
2347
2349
|
cb = data;
|
|
2348
2350
|
data = mask = void 0;
|
|
@@ -2351,7 +2353,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2351
2353
|
mask = void 0;
|
|
2352
2354
|
}
|
|
2353
2355
|
if (typeof data === "number") data = data.toString();
|
|
2354
|
-
if (this.readyState !== WebSocket
|
|
2356
|
+
if (this.readyState !== WebSocket.OPEN) {
|
|
2355
2357
|
sendAfterClose(this, data, cb);
|
|
2356
2358
|
return;
|
|
2357
2359
|
}
|
|
@@ -2364,7 +2366,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2364
2366
|
* @public
|
|
2365
2367
|
*/
|
|
2366
2368
|
resume() {
|
|
2367
|
-
if (this.readyState === WebSocket
|
|
2369
|
+
if (this.readyState === WebSocket.CONNECTING || this.readyState === WebSocket.CLOSED) return;
|
|
2368
2370
|
this._paused = false;
|
|
2369
2371
|
if (!this._receiver._writableState.needDrain) this._socket.resume();
|
|
2370
2372
|
}
|
|
@@ -2384,13 +2386,13 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2384
2386
|
* @public
|
|
2385
2387
|
*/
|
|
2386
2388
|
send(data, options, cb) {
|
|
2387
|
-
if (this.readyState === WebSocket
|
|
2389
|
+
if (this.readyState === WebSocket.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
2388
2390
|
if (typeof options === "function") {
|
|
2389
2391
|
cb = options;
|
|
2390
2392
|
options = {};
|
|
2391
2393
|
}
|
|
2392
2394
|
if (typeof data === "number") data = data.toString();
|
|
2393
|
-
if (this.readyState !== WebSocket
|
|
2395
|
+
if (this.readyState !== WebSocket.OPEN) {
|
|
2394
2396
|
sendAfterClose(this, data, cb);
|
|
2395
2397
|
return;
|
|
2396
2398
|
}
|
|
@@ -2401,7 +2403,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2401
2403
|
fin: true,
|
|
2402
2404
|
...options
|
|
2403
2405
|
};
|
|
2404
|
-
if (!this._extensions[PerMessageDeflate
|
|
2406
|
+
if (!this._extensions[PerMessageDeflate.extensionName]) opts.compress = false;
|
|
2405
2407
|
this._sender.send(data || EMPTY_BUFFER, opts, cb);
|
|
2406
2408
|
}
|
|
2407
2409
|
/**
|
|
@@ -2410,13 +2412,13 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2410
2412
|
* @public
|
|
2411
2413
|
*/
|
|
2412
2414
|
terminate() {
|
|
2413
|
-
if (this.readyState === WebSocket
|
|
2414
|
-
if (this.readyState === WebSocket
|
|
2415
|
-
abortHandshake
|
|
2415
|
+
if (this.readyState === WebSocket.CLOSED) return;
|
|
2416
|
+
if (this.readyState === WebSocket.CONNECTING) {
|
|
2417
|
+
abortHandshake(this, this._req, "WebSocket was closed before the connection was established");
|
|
2416
2418
|
return;
|
|
2417
2419
|
}
|
|
2418
2420
|
if (this._socket) {
|
|
2419
|
-
this._readyState = WebSocket
|
|
2421
|
+
this._readyState = WebSocket.CLOSING;
|
|
2420
2422
|
this._socket.destroy();
|
|
2421
2423
|
}
|
|
2422
2424
|
}
|
|
@@ -2425,7 +2427,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2425
2427
|
* @constant {Number} CONNECTING
|
|
2426
2428
|
* @memberof WebSocket
|
|
2427
2429
|
*/
|
|
2428
|
-
Object.defineProperty(WebSocket
|
|
2430
|
+
Object.defineProperty(WebSocket, "CONNECTING", {
|
|
2429
2431
|
enumerable: true,
|
|
2430
2432
|
value: readyStates.indexOf("CONNECTING")
|
|
2431
2433
|
});
|
|
@@ -2433,7 +2435,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2433
2435
|
* @constant {Number} CONNECTING
|
|
2434
2436
|
* @memberof WebSocket.prototype
|
|
2435
2437
|
*/
|
|
2436
|
-
Object.defineProperty(WebSocket
|
|
2438
|
+
Object.defineProperty(WebSocket.prototype, "CONNECTING", {
|
|
2437
2439
|
enumerable: true,
|
|
2438
2440
|
value: readyStates.indexOf("CONNECTING")
|
|
2439
2441
|
});
|
|
@@ -2441,7 +2443,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2441
2443
|
* @constant {Number} OPEN
|
|
2442
2444
|
* @memberof WebSocket
|
|
2443
2445
|
*/
|
|
2444
|
-
Object.defineProperty(WebSocket
|
|
2446
|
+
Object.defineProperty(WebSocket, "OPEN", {
|
|
2445
2447
|
enumerable: true,
|
|
2446
2448
|
value: readyStates.indexOf("OPEN")
|
|
2447
2449
|
});
|
|
@@ -2449,7 +2451,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2449
2451
|
* @constant {Number} OPEN
|
|
2450
2452
|
* @memberof WebSocket.prototype
|
|
2451
2453
|
*/
|
|
2452
|
-
Object.defineProperty(WebSocket
|
|
2454
|
+
Object.defineProperty(WebSocket.prototype, "OPEN", {
|
|
2453
2455
|
enumerable: true,
|
|
2454
2456
|
value: readyStates.indexOf("OPEN")
|
|
2455
2457
|
});
|
|
@@ -2457,7 +2459,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2457
2459
|
* @constant {Number} CLOSING
|
|
2458
2460
|
* @memberof WebSocket
|
|
2459
2461
|
*/
|
|
2460
|
-
Object.defineProperty(WebSocket
|
|
2462
|
+
Object.defineProperty(WebSocket, "CLOSING", {
|
|
2461
2463
|
enumerable: true,
|
|
2462
2464
|
value: readyStates.indexOf("CLOSING")
|
|
2463
2465
|
});
|
|
@@ -2465,7 +2467,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2465
2467
|
* @constant {Number} CLOSING
|
|
2466
2468
|
* @memberof WebSocket.prototype
|
|
2467
2469
|
*/
|
|
2468
|
-
Object.defineProperty(WebSocket
|
|
2470
|
+
Object.defineProperty(WebSocket.prototype, "CLOSING", {
|
|
2469
2471
|
enumerable: true,
|
|
2470
2472
|
value: readyStates.indexOf("CLOSING")
|
|
2471
2473
|
});
|
|
@@ -2473,7 +2475,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2473
2475
|
* @constant {Number} CLOSED
|
|
2474
2476
|
* @memberof WebSocket
|
|
2475
2477
|
*/
|
|
2476
|
-
Object.defineProperty(WebSocket
|
|
2478
|
+
Object.defineProperty(WebSocket, "CLOSED", {
|
|
2477
2479
|
enumerable: true,
|
|
2478
2480
|
value: readyStates.indexOf("CLOSED")
|
|
2479
2481
|
});
|
|
@@ -2481,7 +2483,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2481
2483
|
* @constant {Number} CLOSED
|
|
2482
2484
|
* @memberof WebSocket.prototype
|
|
2483
2485
|
*/
|
|
2484
|
-
Object.defineProperty(WebSocket
|
|
2486
|
+
Object.defineProperty(WebSocket.prototype, "CLOSED", {
|
|
2485
2487
|
enumerable: true,
|
|
2486
2488
|
value: readyStates.indexOf("CLOSED")
|
|
2487
2489
|
});
|
|
@@ -2494,7 +2496,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2494
2496
|
"readyState",
|
|
2495
2497
|
"url"
|
|
2496
2498
|
].forEach((property) => {
|
|
2497
|
-
Object.defineProperty(WebSocket
|
|
2499
|
+
Object.defineProperty(WebSocket.prototype, property, { enumerable: true });
|
|
2498
2500
|
});
|
|
2499
2501
|
[
|
|
2500
2502
|
"open",
|
|
@@ -2502,7 +2504,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2502
2504
|
"close",
|
|
2503
2505
|
"message"
|
|
2504
2506
|
].forEach((method) => {
|
|
2505
|
-
Object.defineProperty(WebSocket
|
|
2507
|
+
Object.defineProperty(WebSocket.prototype, `on${method}`, {
|
|
2506
2508
|
enumerable: true,
|
|
2507
2509
|
get() {
|
|
2508
2510
|
for (const listener of this.listeners(method)) if (listener[kForOnEventAttribute]) return listener[kListener];
|
|
@@ -2518,9 +2520,9 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2518
2520
|
}
|
|
2519
2521
|
});
|
|
2520
2522
|
});
|
|
2521
|
-
WebSocket
|
|
2522
|
-
WebSocket
|
|
2523
|
-
module.exports = WebSocket
|
|
2523
|
+
WebSocket.prototype.addEventListener = addEventListener;
|
|
2524
|
+
WebSocket.prototype.removeEventListener = removeEventListener;
|
|
2525
|
+
module.exports = WebSocket;
|
|
2524
2526
|
/**
|
|
2525
2527
|
* Initialize a WebSocket client.
|
|
2526
2528
|
*
|
|
@@ -2620,8 +2622,8 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2620
2622
|
opts.path = parsedUrl.pathname + parsedUrl.search;
|
|
2621
2623
|
opts.timeout = opts.handshakeTimeout;
|
|
2622
2624
|
if (opts.perMessageDeflate) {
|
|
2623
|
-
perMessageDeflate = new PerMessageDeflate
|
|
2624
|
-
opts.headers["Sec-WebSocket-Extensions"] = format({ [PerMessageDeflate
|
|
2625
|
+
perMessageDeflate = new PerMessageDeflate(opts.perMessageDeflate !== true ? opts.perMessageDeflate : {}, false, opts.maxPayload);
|
|
2626
|
+
opts.headers["Sec-WebSocket-Extensions"] = format({ [PerMessageDeflate.extensionName]: perMessageDeflate.offer() });
|
|
2625
2627
|
}
|
|
2626
2628
|
if (protocols.length) {
|
|
2627
2629
|
for (const protocol of protocols) {
|
|
@@ -2664,7 +2666,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2664
2666
|
if (websocket._redirects) websocket.emit("redirect", websocket.url, req);
|
|
2665
2667
|
} else req = websocket._req = request(opts);
|
|
2666
2668
|
if (opts.timeout) req.on("timeout", () => {
|
|
2667
|
-
abortHandshake
|
|
2669
|
+
abortHandshake(websocket, req, "Opening handshake has timed out");
|
|
2668
2670
|
});
|
|
2669
2671
|
req.on("error", (err) => {
|
|
2670
2672
|
if (req === null || req[kAborted]) return;
|
|
@@ -2676,7 +2678,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2676
2678
|
const statusCode = res.statusCode;
|
|
2677
2679
|
if (location && opts.followRedirects && statusCode >= 300 && statusCode < 400) {
|
|
2678
2680
|
if (++websocket._redirects > opts.maxRedirects) {
|
|
2679
|
-
abortHandshake
|
|
2681
|
+
abortHandshake(websocket, req, "Maximum redirects exceeded");
|
|
2680
2682
|
return;
|
|
2681
2683
|
}
|
|
2682
2684
|
req.abort();
|
|
@@ -2688,20 +2690,20 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2688
2690
|
return;
|
|
2689
2691
|
}
|
|
2690
2692
|
initAsClient(websocket, addr, protocols, options);
|
|
2691
|
-
} else if (!websocket.emit("unexpected-response", req, res)) abortHandshake
|
|
2693
|
+
} else if (!websocket.emit("unexpected-response", req, res)) abortHandshake(websocket, req, `Unexpected server response: ${res.statusCode}`);
|
|
2692
2694
|
});
|
|
2693
2695
|
req.on("upgrade", (res, socket, head) => {
|
|
2694
2696
|
websocket.emit("upgrade", res);
|
|
2695
|
-
if (websocket.readyState !== WebSocket
|
|
2697
|
+
if (websocket.readyState !== WebSocket.CONNECTING) return;
|
|
2696
2698
|
req = websocket._req = null;
|
|
2697
2699
|
const upgrade = res.headers.upgrade;
|
|
2698
2700
|
if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
|
|
2699
|
-
abortHandshake
|
|
2701
|
+
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
2700
2702
|
return;
|
|
2701
2703
|
}
|
|
2702
|
-
const digest = createHash$1("sha1").update(key + GUID
|
|
2704
|
+
const digest = createHash$1("sha1").update(key + GUID).digest("base64");
|
|
2703
2705
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
2704
|
-
abortHandshake
|
|
2706
|
+
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
2705
2707
|
return;
|
|
2706
2708
|
}
|
|
2707
2709
|
const serverProt = res.headers["sec-websocket-protocol"];
|
|
@@ -2711,35 +2713,35 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2711
2713
|
else if (!protocolSet.has(serverProt)) protError = "Server sent an invalid subprotocol";
|
|
2712
2714
|
} else if (protocolSet.size) protError = "Server sent no subprotocol";
|
|
2713
2715
|
if (protError) {
|
|
2714
|
-
abortHandshake
|
|
2716
|
+
abortHandshake(websocket, socket, protError);
|
|
2715
2717
|
return;
|
|
2716
2718
|
}
|
|
2717
2719
|
if (serverProt) websocket._protocol = serverProt;
|
|
2718
2720
|
const secWebSocketExtensions = res.headers["sec-websocket-extensions"];
|
|
2719
2721
|
if (secWebSocketExtensions !== void 0) {
|
|
2720
2722
|
if (!perMessageDeflate) {
|
|
2721
|
-
abortHandshake
|
|
2723
|
+
abortHandshake(websocket, socket, "Server sent a Sec-WebSocket-Extensions header but no extension was requested");
|
|
2722
2724
|
return;
|
|
2723
2725
|
}
|
|
2724
2726
|
let extensions;
|
|
2725
2727
|
try {
|
|
2726
|
-
extensions = parse
|
|
2728
|
+
extensions = parse(secWebSocketExtensions);
|
|
2727
2729
|
} catch (err) {
|
|
2728
|
-
abortHandshake
|
|
2730
|
+
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Extensions header");
|
|
2729
2731
|
return;
|
|
2730
2732
|
}
|
|
2731
2733
|
const extensionNames = Object.keys(extensions);
|
|
2732
|
-
if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate
|
|
2733
|
-
abortHandshake
|
|
2734
|
+
if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate.extensionName) {
|
|
2735
|
+
abortHandshake(websocket, socket, "Server indicated an extension that was not requested");
|
|
2734
2736
|
return;
|
|
2735
2737
|
}
|
|
2736
2738
|
try {
|
|
2737
|
-
perMessageDeflate.accept(extensions[PerMessageDeflate
|
|
2739
|
+
perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]);
|
|
2738
2740
|
} catch (err) {
|
|
2739
|
-
abortHandshake
|
|
2741
|
+
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Extensions header");
|
|
2740
2742
|
return;
|
|
2741
2743
|
}
|
|
2742
|
-
websocket._extensions[PerMessageDeflate
|
|
2744
|
+
websocket._extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
|
|
2743
2745
|
}
|
|
2744
2746
|
websocket.setSocket(socket, head, {
|
|
2745
2747
|
allowSynchronousEvents: opts.allowSynchronousEvents,
|
|
@@ -2759,7 +2761,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2759
2761
|
* @private
|
|
2760
2762
|
*/
|
|
2761
2763
|
function emitErrorAndClose(websocket, err) {
|
|
2762
|
-
websocket._readyState = WebSocket
|
|
2764
|
+
websocket._readyState = WebSocket.CLOSING;
|
|
2763
2765
|
websocket._errorEmitted = true;
|
|
2764
2766
|
websocket.emit("error", err);
|
|
2765
2767
|
websocket.emitClose();
|
|
@@ -2796,10 +2798,10 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2796
2798
|
* @param {String} message The error message
|
|
2797
2799
|
* @private
|
|
2798
2800
|
*/
|
|
2799
|
-
function abortHandshake
|
|
2800
|
-
websocket._readyState = WebSocket
|
|
2801
|
+
function abortHandshake(websocket, stream, message) {
|
|
2802
|
+
websocket._readyState = WebSocket.CLOSING;
|
|
2801
2803
|
const err = new Error(message);
|
|
2802
|
-
Error.captureStackTrace(err, abortHandshake
|
|
2804
|
+
Error.captureStackTrace(err, abortHandshake);
|
|
2803
2805
|
if (stream.setHeader) {
|
|
2804
2806
|
stream[kAborted] = true;
|
|
2805
2807
|
stream.abort();
|
|
@@ -2839,11 +2841,11 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2839
2841
|
* @private
|
|
2840
2842
|
*/
|
|
2841
2843
|
function receiverOnConclude(code, reason) {
|
|
2842
|
-
const websocket = this[kWebSocket
|
|
2844
|
+
const websocket = this[kWebSocket];
|
|
2843
2845
|
websocket._closeFrameReceived = true;
|
|
2844
2846
|
websocket._closeMessage = reason;
|
|
2845
2847
|
websocket._closeCode = code;
|
|
2846
|
-
if (websocket._socket[kWebSocket
|
|
2848
|
+
if (websocket._socket[kWebSocket] === void 0) return;
|
|
2847
2849
|
websocket._socket.removeListener("data", socketOnData);
|
|
2848
2850
|
process.nextTick(resume, websocket._socket);
|
|
2849
2851
|
if (code === 1005) websocket.close();
|
|
@@ -2855,7 +2857,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2855
2857
|
* @private
|
|
2856
2858
|
*/
|
|
2857
2859
|
function receiverOnDrain() {
|
|
2858
|
-
const websocket = this[kWebSocket
|
|
2860
|
+
const websocket = this[kWebSocket];
|
|
2859
2861
|
if (!websocket.isPaused) websocket._socket.resume();
|
|
2860
2862
|
}
|
|
2861
2863
|
/**
|
|
@@ -2865,8 +2867,8 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2865
2867
|
* @private
|
|
2866
2868
|
*/
|
|
2867
2869
|
function receiverOnError(err) {
|
|
2868
|
-
const websocket = this[kWebSocket
|
|
2869
|
-
if (websocket._socket[kWebSocket
|
|
2870
|
+
const websocket = this[kWebSocket];
|
|
2871
|
+
if (websocket._socket[kWebSocket] !== void 0) {
|
|
2870
2872
|
websocket._socket.removeListener("data", socketOnData);
|
|
2871
2873
|
process.nextTick(resume, websocket._socket);
|
|
2872
2874
|
websocket.close(err[kStatusCode]);
|
|
@@ -2882,7 +2884,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2882
2884
|
* @private
|
|
2883
2885
|
*/
|
|
2884
2886
|
function receiverOnFinish() {
|
|
2885
|
-
this[kWebSocket
|
|
2887
|
+
this[kWebSocket].emitClose();
|
|
2886
2888
|
}
|
|
2887
2889
|
/**
|
|
2888
2890
|
* The listener of the `Receiver` `'message'` event.
|
|
@@ -2892,7 +2894,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2892
2894
|
* @private
|
|
2893
2895
|
*/
|
|
2894
2896
|
function receiverOnMessage(data, isBinary) {
|
|
2895
|
-
this[kWebSocket
|
|
2897
|
+
this[kWebSocket].emit("message", data, isBinary);
|
|
2896
2898
|
}
|
|
2897
2899
|
/**
|
|
2898
2900
|
* The listener of the `Receiver` `'ping'` event.
|
|
@@ -2901,8 +2903,8 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2901
2903
|
* @private
|
|
2902
2904
|
*/
|
|
2903
2905
|
function receiverOnPing(data) {
|
|
2904
|
-
const websocket = this[kWebSocket
|
|
2905
|
-
if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP
|
|
2906
|
+
const websocket = this[kWebSocket];
|
|
2907
|
+
if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);
|
|
2906
2908
|
websocket.emit("ping", data);
|
|
2907
2909
|
}
|
|
2908
2910
|
/**
|
|
@@ -2912,7 +2914,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2912
2914
|
* @private
|
|
2913
2915
|
*/
|
|
2914
2916
|
function receiverOnPong(data) {
|
|
2915
|
-
this[kWebSocket
|
|
2917
|
+
this[kWebSocket].emit("pong", data);
|
|
2916
2918
|
}
|
|
2917
2919
|
/**
|
|
2918
2920
|
* Resume a readable stream
|
|
@@ -2930,10 +2932,10 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2930
2932
|
* @private
|
|
2931
2933
|
*/
|
|
2932
2934
|
function senderOnError(err) {
|
|
2933
|
-
const websocket = this[kWebSocket
|
|
2934
|
-
if (websocket.readyState === WebSocket
|
|
2935
|
-
if (websocket.readyState === WebSocket
|
|
2936
|
-
websocket._readyState = WebSocket
|
|
2935
|
+
const websocket = this[kWebSocket];
|
|
2936
|
+
if (websocket.readyState === WebSocket.CLOSED) return;
|
|
2937
|
+
if (websocket.readyState === WebSocket.OPEN) {
|
|
2938
|
+
websocket._readyState = WebSocket.CLOSING;
|
|
2937
2939
|
setCloseTimer(websocket);
|
|
2938
2940
|
}
|
|
2939
2941
|
this._socket.end();
|
|
@@ -2957,15 +2959,15 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2957
2959
|
* @private
|
|
2958
2960
|
*/
|
|
2959
2961
|
function socketOnClose() {
|
|
2960
|
-
const websocket = this[kWebSocket
|
|
2962
|
+
const websocket = this[kWebSocket];
|
|
2961
2963
|
this.removeListener("close", socketOnClose);
|
|
2962
2964
|
this.removeListener("data", socketOnData);
|
|
2963
2965
|
this.removeListener("end", socketOnEnd);
|
|
2964
|
-
websocket._readyState = WebSocket
|
|
2966
|
+
websocket._readyState = WebSocket.CLOSING;
|
|
2965
2967
|
let chunk;
|
|
2966
2968
|
if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && (chunk = websocket._socket.read()) !== null) websocket._receiver.write(chunk);
|
|
2967
2969
|
websocket._receiver.end();
|
|
2968
|
-
this[kWebSocket
|
|
2970
|
+
this[kWebSocket] = void 0;
|
|
2969
2971
|
clearTimeout(websocket._closeTimer);
|
|
2970
2972
|
if (websocket._receiver._writableState.finished || websocket._receiver._writableState.errorEmitted) websocket.emitClose();
|
|
2971
2973
|
else {
|
|
@@ -2980,7 +2982,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2980
2982
|
* @private
|
|
2981
2983
|
*/
|
|
2982
2984
|
function socketOnData(chunk) {
|
|
2983
|
-
if (!this[kWebSocket
|
|
2985
|
+
if (!this[kWebSocket]._receiver.write(chunk)) this.pause();
|
|
2984
2986
|
}
|
|
2985
2987
|
/**
|
|
2986
2988
|
* The listener of the socket `'end'` event.
|
|
@@ -2988,8 +2990,8 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2988
2990
|
* @private
|
|
2989
2991
|
*/
|
|
2990
2992
|
function socketOnEnd() {
|
|
2991
|
-
const websocket = this[kWebSocket
|
|
2992
|
-
websocket._readyState = WebSocket
|
|
2993
|
+
const websocket = this[kWebSocket];
|
|
2994
|
+
websocket._readyState = WebSocket.CLOSING;
|
|
2993
2995
|
websocket._receiver.end();
|
|
2994
2996
|
this.end();
|
|
2995
2997
|
}
|
|
@@ -2998,20 +3000,20 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
|
|
|
2998
3000
|
*
|
|
2999
3001
|
* @private
|
|
3000
3002
|
*/
|
|
3001
|
-
function socketOnError
|
|
3002
|
-
const websocket = this[kWebSocket
|
|
3003
|
-
this.removeListener("error", socketOnError
|
|
3004
|
-
this.on("error", NOOP
|
|
3003
|
+
function socketOnError() {
|
|
3004
|
+
const websocket = this[kWebSocket];
|
|
3005
|
+
this.removeListener("error", socketOnError);
|
|
3006
|
+
this.on("error", NOOP);
|
|
3005
3007
|
if (websocket) {
|
|
3006
|
-
websocket._readyState = WebSocket
|
|
3008
|
+
websocket._readyState = WebSocket.CLOSING;
|
|
3007
3009
|
this.destroy();
|
|
3008
3010
|
}
|
|
3009
3011
|
}
|
|
3010
|
-
})
|
|
3012
|
+
}));
|
|
3011
3013
|
|
|
3012
3014
|
//#endregion
|
|
3013
3015
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/stream.js
|
|
3014
|
-
var require_stream = /* @__PURE__ */
|
|
3016
|
+
var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3015
3017
|
require_websocket();
|
|
3016
3018
|
const { Duplex: Duplex$1 } = __require("stream");
|
|
3017
3019
|
/**
|
|
@@ -3020,7 +3022,7 @@ var require_stream = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
3020
3022
|
* @param {Duplex} stream The stream.
|
|
3021
3023
|
* @private
|
|
3022
3024
|
*/
|
|
3023
|
-
function emitClose
|
|
3025
|
+
function emitClose(stream) {
|
|
3024
3026
|
stream.emit("close");
|
|
3025
3027
|
}
|
|
3026
3028
|
/**
|
|
@@ -3050,7 +3052,7 @@ var require_stream = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
3050
3052
|
* @return {Duplex} The duplex stream
|
|
3051
3053
|
* @public
|
|
3052
3054
|
*/
|
|
3053
|
-
function createWebSocketStream
|
|
3055
|
+
function createWebSocketStream(ws, options) {
|
|
3054
3056
|
let terminateOnDestroy = true;
|
|
3055
3057
|
const duplex = new Duplex$1({
|
|
3056
3058
|
...options,
|
|
@@ -3075,7 +3077,7 @@ var require_stream = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
3075
3077
|
duplex._destroy = function(err, callback) {
|
|
3076
3078
|
if (ws.readyState === ws.CLOSED) {
|
|
3077
3079
|
callback(err);
|
|
3078
|
-
process.nextTick(emitClose
|
|
3080
|
+
process.nextTick(emitClose, duplex);
|
|
3079
3081
|
return;
|
|
3080
3082
|
}
|
|
3081
3083
|
let called = false;
|
|
@@ -3085,7 +3087,7 @@ var require_stream = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
3085
3087
|
});
|
|
3086
3088
|
ws.once("close", function close() {
|
|
3087
3089
|
if (!called) callback(err);
|
|
3088
|
-
process.nextTick(emitClose
|
|
3090
|
+
process.nextTick(emitClose, duplex);
|
|
3089
3091
|
});
|
|
3090
3092
|
if (terminateOnDestroy) ws.terminate();
|
|
3091
3093
|
};
|
|
@@ -3123,12 +3125,12 @@ var require_stream = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
|
|
|
3123
3125
|
duplex.on("error", duplexOnError);
|
|
3124
3126
|
return duplex;
|
|
3125
3127
|
}
|
|
3126
|
-
module.exports = createWebSocketStream
|
|
3127
|
-
})
|
|
3128
|
+
module.exports = createWebSocketStream;
|
|
3129
|
+
}));
|
|
3128
3130
|
|
|
3129
3131
|
//#endregion
|
|
3130
3132
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/subprotocol.js
|
|
3131
|
-
var require_subprotocol = /* @__PURE__ */
|
|
3133
|
+
var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3132
3134
|
const { tokenChars } = require_validation();
|
|
3133
3135
|
/**
|
|
3134
3136
|
* Parses the `Sec-WebSocket-Protocol` header into a set of subprotocol names.
|
|
@@ -3137,7 +3139,7 @@ var require_subprotocol = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
|
|
|
3137
3139
|
* @return {Set} The subprotocol names
|
|
3138
3140
|
* @public
|
|
3139
3141
|
*/
|
|
3140
|
-
function parse
|
|
3142
|
+
function parse(header) {
|
|
3141
3143
|
const protocols = /* @__PURE__ */ new Set();
|
|
3142
3144
|
let start = -1;
|
|
3143
3145
|
let end = -1;
|
|
@@ -3163,12 +3165,12 @@ var require_subprotocol = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
|
|
|
3163
3165
|
protocols.add(protocol);
|
|
3164
3166
|
return protocols;
|
|
3165
3167
|
}
|
|
3166
|
-
module.exports = { parse
|
|
3167
|
-
})
|
|
3168
|
+
module.exports = { parse };
|
|
3169
|
+
}));
|
|
3168
3170
|
|
|
3169
3171
|
//#endregion
|
|
3170
3172
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket-server.js
|
|
3171
|
-
var require_websocket_server = /* @__PURE__ */
|
|
3173
|
+
var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3172
3174
|
const EventEmitter = __require("events");
|
|
3173
3175
|
const http = __require("http");
|
|
3174
3176
|
const { Duplex } = __require("stream");
|
|
@@ -3176,7 +3178,7 @@ var require_websocket_server = /* @__PURE__ */ __commonJS({ "../../node_modules/
|
|
|
3176
3178
|
const extension = require_extension();
|
|
3177
3179
|
const PerMessageDeflate = require_permessage_deflate();
|
|
3178
3180
|
const subprotocol = require_subprotocol();
|
|
3179
|
-
const WebSocket
|
|
3181
|
+
const WebSocket = require_websocket();
|
|
3180
3182
|
const { GUID, kWebSocket } = require_constants();
|
|
3181
3183
|
const keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
3182
3184
|
const RUNNING = 0;
|
|
@@ -3187,7 +3189,7 @@ var require_websocket_server = /* @__PURE__ */ __commonJS({ "../../node_modules/
|
|
|
3187
3189
|
*
|
|
3188
3190
|
* @extends EventEmitter
|
|
3189
3191
|
*/
|
|
3190
|
-
var WebSocketServer
|
|
3192
|
+
var WebSocketServer = class extends EventEmitter {
|
|
3191
3193
|
/**
|
|
3192
3194
|
* Create a `WebSocketServer` instance.
|
|
3193
3195
|
*
|
|
@@ -3236,7 +3238,7 @@ var require_websocket_server = /* @__PURE__ */ __commonJS({ "../../node_modules/
|
|
|
3236
3238
|
host: null,
|
|
3237
3239
|
path: null,
|
|
3238
3240
|
port: null,
|
|
3239
|
-
WebSocket
|
|
3241
|
+
WebSocket,
|
|
3240
3242
|
...options
|
|
3241
3243
|
};
|
|
3242
3244
|
if (options.port == null && !options.server && !options.noServer || options.port != null && (options.server || options.noServer) || options.server && options.noServer) throw new TypeError("One and only one of the \"port\", \"server\", or \"noServer\" options must be specified");
|
|
@@ -3461,7 +3463,7 @@ var require_websocket_server = /* @__PURE__ */ __commonJS({ "../../node_modules/
|
|
|
3461
3463
|
cb(ws, req);
|
|
3462
3464
|
}
|
|
3463
3465
|
};
|
|
3464
|
-
module.exports = WebSocketServer
|
|
3466
|
+
module.exports = WebSocketServer;
|
|
3465
3467
|
/**
|
|
3466
3468
|
* Add event listeners on an `EventEmitter` using a map of <event, listener>
|
|
3467
3469
|
* pairs.
|
|
@@ -3535,7 +3537,7 @@ var require_websocket_server = /* @__PURE__ */ __commonJS({ "../../node_modules/
|
|
|
3535
3537
|
server.emit("wsClientError", err, socket, req);
|
|
3536
3538
|
} else abortHandshake(socket, code, message, headers);
|
|
3537
3539
|
}
|
|
3538
|
-
})
|
|
3540
|
+
}));
|
|
3539
3541
|
|
|
3540
3542
|
//#endregion
|
|
3541
3543
|
//#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/wrapper.mjs
|