@shopify/cli 3.73.2 → 3.74.0
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/assets/dev-console/extensions/dev-console/assets/{index-D7F9wNys.js → index-lyGm6l3x.js} +12 -12
- package/dist/assets/dev-console/index.html +2 -2
- package/dist/assets/speedscope/SourceCodePro-Regular.ttf.f546cbe0.woff2 +0 -0
- package/dist/assets/speedscope/demangle-cpp.1768f4cc.js +4 -0
- package/dist/assets/speedscope/favicon-16x16.f74b3187.png +0 -0
- package/dist/assets/speedscope/favicon-32x32.bc503437.png +0 -0
- package/dist/assets/speedscope/file-format-schema.json +324 -0
- package/dist/assets/speedscope/import.bcbb2033.js +123 -0
- package/dist/assets/speedscope/index.html +2 -0
- package/dist/assets/speedscope/perf-vertx-stacks-01-collapsed-all.2681da68.txt +199 -0
- package/dist/assets/speedscope/release.txt +3 -0
- package/dist/assets/speedscope/reset.8c46b7a1.css +2 -0
- package/dist/assets/speedscope/source-code-pro.52b1676f.css +2 -0
- package/dist/assets/speedscope/source-code-pro.LICENSE.md +93 -0
- package/dist/assets/speedscope/source-map.438fa06b.js +24 -0
- package/dist/assets/speedscope/speedscope.6f107512.js +193 -0
- package/dist/{chokidar-5LLC6S6D.js → chokidar-BLUAYFAB.js} +13 -1044
- package/dist/chokidar-OATAHMV6.js +1122 -0
- package/dist/{chunk-ES3T7FIW.js → chunk-2GCE2GUM.js} +3 -3
- package/dist/chunk-3I3GQNEW.js +95 -0
- package/dist/{chunk-5NHIBL5K.js → chunk-4QRIOWN3.js} +2 -2
- package/dist/{chunk-Y2KXNORY.js → chunk-4W33LVQQ.js} +3 -3
- package/dist/{chunk-CKC5C2DR.js → chunk-53WQGP7S.js} +4 -4
- package/dist/chunk-57Q6OQG4.js +111 -0
- package/dist/{chunk-MHUINF7I.js → chunk-5CLGH5PH.js} +2 -2
- package/dist/{chunk-CRHXI6PS.js → chunk-5DBS6QOU.js} +102 -638
- package/dist/{chunk-ZOCACHGF.js → chunk-5JC3BUPR.js} +3 -3
- package/dist/{chunk-YMB5HUU3.js → chunk-5JWRABV2.js} +8 -8
- package/dist/{chunk-LLWX47E4.js → chunk-6JNRBEP6.js} +7 -9
- package/dist/{chunk-Y43XESY2.js → chunk-76NEANNG.js} +6442 -3165
- package/dist/{chunk-LVEURM2X.js → chunk-7T4EKFVU.js} +16 -2
- package/dist/{chunk-WKN62GWH.js → chunk-ACIVN2Q4.js} +502 -699
- package/dist/{chunk-ZX3L2JKV.js → chunk-AKL7T64Q.js} +80 -133
- package/dist/{chunk-2QGVACPR.js → chunk-B27LGWRZ.js} +3 -3
- package/dist/{chunk-BUFIEXZ5.js → chunk-B3YWYURY.js} +701 -141
- package/dist/{chunk-7VQ2QADA.js → chunk-BWBSJLZN.js} +333 -156
- package/dist/{chunk-K7HGDAI4.js → chunk-CDBXAE2F.js} +20 -104
- package/dist/{chunk-SBPFWO4S.js → chunk-CDQA3SST.js} +56182 -37290
- package/dist/chunk-CP3BRHWK.js +33 -0
- package/dist/{chunk-XEZJEXCU.js → chunk-D5AR5HKB.js} +2 -2
- package/dist/chunk-EMPP4I5H.js +497 -0
- package/dist/{chunk-DVCOVWXF.js → chunk-FCWD4NEK.js} +3 -3
- package/dist/{chunk-PJZVGRJ6.js → chunk-FMXC2O6H.js} +2 -2
- package/dist/{chunk-2GWO5FJL.js → chunk-GVMUVIT5.js} +7 -7
- package/dist/{chunk-KUM3DVPF.js → chunk-HMDWNGIV.js} +142 -471
- package/dist/{chunk-SVSIFM5Y.js → chunk-I6YWZKVU.js} +2 -2
- package/dist/{chunk-7TAOK36E.js → chunk-IYQNHNNP.js} +4 -4
- package/dist/{chunk-KXGCBBJW.js → chunk-JWRRKMF2.js} +2 -2
- package/dist/{chunk-IY7TUSI2.js → chunk-L3FVJFIT.js} +498 -412
- package/dist/{chunk-FJHGD37G.js → chunk-LH6BHL6J.js} +3 -3
- package/dist/{chunk-OAZFIMJ3.js → chunk-LQ2ZKVR6.js} +45 -115
- package/dist/{chunk-ONK6AXDE.js → chunk-MDJOXUMQ.js} +4 -4
- package/dist/{chunk-52WEPVL5.js → chunk-MSBZRBI5.js} +4 -4
- package/dist/{chunk-3HBRMIPY.js → chunk-MW7RWHY5.js} +341 -211
- package/dist/{chunk-O73CKGH7.js → chunk-NUW6LQU4.js} +4 -4
- package/dist/{chunk-ZQ55XXD5.js → chunk-PMOQBQSE.js} +3 -3
- package/dist/{chunk-2RKSPXIM.js → chunk-QEUQO265.js} +5 -7
- package/dist/chunk-QRARFXIM.js +1137 -0
- package/dist/{chunk-NQFTYLP6.js → chunk-R7RENZQC.js} +3 -3
- package/dist/chunk-UB7RN523.js +15933 -0
- package/dist/{chunk-GSPOKRGB.js → chunk-VI4NVMJH.js} +2 -2
- package/dist/{chunk-WNQ6HYKJ.js → chunk-WBTJ7MQU.js} +3 -3
- package/dist/{chunk-2EKHINO6.js → chunk-WKO4CJCL.js} +5 -7
- package/dist/{chunk-YP35ARHU.js → chunk-WNUVUNTL.js} +41 -23
- package/dist/{chunk-AWW6JHWH.js → chunk-XBIDXV7B.js} +4 -4
- package/dist/{chunk-KETZRITQ.js → chunk-XJNTFQIK.js} +5 -5
- package/dist/cli/commands/auth/logout.js +20 -19
- package/dist/cli/commands/auth/logout.test.js +22 -21
- package/dist/cli/commands/cache/clear.js +19 -18
- package/dist/cli/commands/debug/command-flags.js +19 -18
- package/dist/cli/commands/docs/generate.js +19 -18
- package/dist/cli/commands/docs/generate.test.js +20 -19
- package/dist/cli/commands/help.js +19 -18
- package/dist/cli/commands/kitchen-sink/async.js +20 -19
- package/dist/cli/commands/kitchen-sink/async.test.js +21 -20
- package/dist/cli/commands/kitchen-sink/index.js +22 -21
- package/dist/cli/commands/kitchen-sink/index.test.js +23 -22
- package/dist/cli/commands/kitchen-sink/prompts.js +20 -19
- package/dist/cli/commands/kitchen-sink/prompts.test.js +21 -20
- package/dist/cli/commands/kitchen-sink/static.js +20 -19
- package/dist/cli/commands/kitchen-sink/static.test.js +21 -20
- package/dist/cli/commands/notifications/generate.js +20 -19
- package/dist/cli/commands/notifications/list.js +20 -19
- package/dist/cli/commands/search.js +20 -19
- package/dist/cli/commands/upgrade.js +20 -19
- package/dist/cli/commands/upgrade.test.js +2 -1
- package/dist/cli/commands/version.js +20 -19
- package/dist/cli/commands/version.test.js +21 -20
- package/dist/cli/services/commands/notifications.js +14 -13
- package/dist/cli/services/commands/search.js +9 -8
- package/dist/cli/services/commands/search.test.js +10 -9
- package/dist/cli/services/commands/version.js +10 -9
- package/dist/cli/services/commands/version.test.js +12 -11
- package/dist/cli/services/kitchen-sink/async.js +9 -8
- package/dist/cli/services/kitchen-sink/prompts.js +9 -8
- package/dist/cli/services/kitchen-sink/static.js +9 -8
- package/dist/cli/services/upgrade.d.ts +0 -1
- package/dist/cli/services/upgrade.js +11 -10
- package/dist/cli/services/upgrade.test.js +14 -13
- package/dist/configs/all.yml +6 -0
- package/dist/configs/recommended.yml +6 -0
- package/dist/{custom-oclif-loader-4X7Y4CNS.js → custom-oclif-loader-ZY5GUSB3.js} +9 -8
- package/dist/{del-P2RS6GN2.js → del-FBU5JYXS.js} +4 -4
- package/dist/{devtools-K7FXBBFZ.js → devtools-6LOQORRT.js} +2 -2
- package/dist/{error-handler-KHFKBXR4.js → error-handler-YRN4E6SY.js} +17 -16
- package/dist/hooks/postrun.js +18 -16
- package/dist/hooks/prerun.js +15 -14
- package/dist/{http-proxy-FXWKYHZ3.js → http-proxy-L3MCJRQS.js} +3 -2
- package/dist/index.js +18712 -17414
- package/dist/lib-E2DSNKUX.js +13 -0
- package/dist/{local-PBMBK3CF.js → local-VTZT5Q4L.js} +11 -10
- package/dist/{morph-OSHCID2F.js → morph-ACVSDUS7.js} +3 -3
- package/dist/{node-ENALIQ2H.js → node-ONVZF27D.js} +23 -20
- package/dist/{node-package-manager-CVGCLCTC.js → node-package-manager-BZNXJETD.js} +11 -10
- package/dist/{npa-TM76BGG3.js → npa-JAX2F6CO.js} +2 -2
- package/dist/out-AZBX4ITJ.js +7 -0
- package/dist/{path-2HZUSAGR.js → path-2K5HIMHZ.js} +3 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{ui-BBB46DQS.js → ui-3RKZNTJR.js} +9 -8
- package/dist/{workerd-F7DWDIYO.js → workerd-PSNADDQA.js} +23 -20
- package/oclif.manifest.json +103 -2
- package/package.json +9 -9
- package/LICENSE +0 -8
- package/dist/chunk-KIOWYILS.js +0 -3811
- package/dist/chunk-R4HZPLY4.js +0 -15746
- package/dist/lib-QZGSY5YB.js +0 -13
- package/dist/out-JR4DWQ2G.js +0 -7
- /package/dist/assets/dev-console/extensions/dev-console/assets/{index-Cgb-oKsM.css → index-n8yr6cxq.css} +0 -0
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
init_cjs_shims
|
|
6
6
|
} from "./chunk-PKR7KJ6P.js";
|
|
7
7
|
|
|
8
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
8
|
+
// ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/stream.js
|
|
9
9
|
var require_stream = __commonJS({
|
|
10
|
-
"../../node_modules/.pnpm/ws@8.
|
|
10
|
+
"../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/stream.js"(exports, module) {
|
|
11
11
|
"use strict";
|
|
12
12
|
init_cjs_shims();
|
|
13
13
|
var { Duplex } = __require("stream");
|
|
@@ -72,15 +72,18 @@ var require_stream = __commonJS({
|
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
75
|
+
// ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/constants.js
|
|
76
76
|
var require_constants = __commonJS({
|
|
77
|
-
"../../node_modules/.pnpm/ws@8.
|
|
77
|
+
"../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/constants.js"(exports, module) {
|
|
78
78
|
"use strict";
|
|
79
79
|
init_cjs_shims();
|
|
80
|
+
var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"], hasBlob = typeof Blob < "u";
|
|
81
|
+
hasBlob && BINARY_TYPES.push("blob");
|
|
80
82
|
module.exports = {
|
|
81
|
-
BINARY_TYPES
|
|
83
|
+
BINARY_TYPES,
|
|
82
84
|
EMPTY_BUFFER: Buffer.alloc(0),
|
|
83
85
|
GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
|
|
86
|
+
hasBlob,
|
|
84
87
|
kForOnEventAttribute: Symbol("kIsForOnEventAttribute"),
|
|
85
88
|
kListener: Symbol("kListener"),
|
|
86
89
|
kStatusCode: Symbol("status-code"),
|
|
@@ -91,9 +94,9 @@ var require_constants = __commonJS({
|
|
|
91
94
|
}
|
|
92
95
|
});
|
|
93
96
|
|
|
94
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
97
|
+
// ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/buffer-util.js
|
|
95
98
|
var require_buffer_util = __commonJS({
|
|
96
|
-
"../../node_modules/.pnpm/ws@8.
|
|
99
|
+
"../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/buffer-util.js"(exports, module) {
|
|
97
100
|
"use strict";
|
|
98
101
|
init_cjs_shims();
|
|
99
102
|
var { EMPTY_BUFFER } = require_constants(), FastBuffer = Buffer[Symbol.species];
|
|
@@ -143,9 +146,9 @@ var require_buffer_util = __commonJS({
|
|
|
143
146
|
}
|
|
144
147
|
});
|
|
145
148
|
|
|
146
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
149
|
+
// ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/limiter.js
|
|
147
150
|
var require_limiter = __commonJS({
|
|
148
|
-
"../../node_modules/.pnpm/ws@8.
|
|
151
|
+
"../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/limiter.js"(exports, module) {
|
|
149
152
|
"use strict";
|
|
150
153
|
init_cjs_shims();
|
|
151
154
|
var kDone = Symbol("kDone"), kRun = Symbol("kRun"), Limiter = class {
|
|
@@ -185,9 +188,9 @@ var require_limiter = __commonJS({
|
|
|
185
188
|
}
|
|
186
189
|
});
|
|
187
190
|
|
|
188
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
191
|
+
// ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/permessage-deflate.js
|
|
189
192
|
var require_permessage_deflate = __commonJS({
|
|
190
|
-
"../../node_modules/.pnpm/ws@8.
|
|
193
|
+
"../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/permessage-deflate.js"(exports, module) {
|
|
191
194
|
"use strict";
|
|
192
195
|
init_cjs_shims();
|
|
193
196
|
var zlib = __require("zlib"), bufferUtil = require_buffer_util(), Limiter = require_limiter(), { kStatusCode } = require_constants(), FastBuffer = Buffer[Symbol.species], TRAILER = Buffer.from([0, 0, 255, 255]), kPerMessageDeflate = Symbol("permessage-deflate"), kTotalLength = Symbol("total-length"), kCallback = Symbol("callback"), kBuffers = Symbol("buffers"), kError = Symbol("error"), zlibLimiter, PerMessageDeflate = class {
|
|
@@ -442,12 +445,12 @@ var require_permessage_deflate = __commonJS({
|
|
|
442
445
|
}
|
|
443
446
|
});
|
|
444
447
|
|
|
445
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
448
|
+
// ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/validation.js
|
|
446
449
|
var require_validation = __commonJS({
|
|
447
|
-
"../../node_modules/.pnpm/ws@8.
|
|
450
|
+
"../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/validation.js"(exports, module) {
|
|
448
451
|
"use strict";
|
|
449
452
|
init_cjs_shims();
|
|
450
|
-
var { isUtf8 } = __require("buffer"), tokenChars = [
|
|
453
|
+
var { isUtf8 } = __require("buffer"), { hasBlob } = require_constants(), tokenChars = [
|
|
451
454
|
0,
|
|
452
455
|
0,
|
|
453
456
|
0,
|
|
@@ -611,7 +614,11 @@ var require_validation = __commonJS({
|
|
|
611
614
|
return !1;
|
|
612
615
|
return !0;
|
|
613
616
|
}
|
|
617
|
+
function isBlob(value) {
|
|
618
|
+
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");
|
|
619
|
+
}
|
|
614
620
|
module.exports = {
|
|
621
|
+
isBlob,
|
|
615
622
|
isValidStatusCode,
|
|
616
623
|
isValidUTF8: _isValidUTF8,
|
|
617
624
|
tokenChars
|
|
@@ -631,9 +638,9 @@ var require_validation = __commonJS({
|
|
|
631
638
|
}
|
|
632
639
|
});
|
|
633
640
|
|
|
634
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
641
|
+
// ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/receiver.js
|
|
635
642
|
var require_receiver = __commonJS({
|
|
636
|
-
"../../node_modules/.pnpm/ws@8.
|
|
643
|
+
"../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/receiver.js"(exports, module) {
|
|
637
644
|
"use strict";
|
|
638
645
|
init_cjs_shims();
|
|
639
646
|
var { Writable } = __require("stream"), PerMessageDeflate = require_permessage_deflate(), {
|
|
@@ -641,11 +648,14 @@ var require_receiver = __commonJS({
|
|
|
641
648
|
EMPTY_BUFFER,
|
|
642
649
|
kStatusCode,
|
|
643
650
|
kWebSocket
|
|
644
|
-
} = require_constants(), { concat, toArrayBuffer, unmask } = require_buffer_util(), { isValidStatusCode, isValidUTF8 } = require_validation(), FastBuffer = Buffer[Symbol.species], GET_INFO = 0, GET_PAYLOAD_LENGTH_16 = 1, GET_PAYLOAD_LENGTH_64 = 2, GET_MASK = 3, GET_DATA = 4, INFLATING = 5, Receiver2 = class extends Writable {
|
|
651
|
+
} = require_constants(), { concat, toArrayBuffer, unmask } = require_buffer_util(), { isValidStatusCode, isValidUTF8 } = require_validation(), FastBuffer = Buffer[Symbol.species], GET_INFO = 0, GET_PAYLOAD_LENGTH_16 = 1, GET_PAYLOAD_LENGTH_64 = 2, GET_MASK = 3, GET_DATA = 4, INFLATING = 5, DEFER_EVENT = 6, Receiver2 = class extends Writable {
|
|
645
652
|
/**
|
|
646
653
|
* Creates a Receiver instance.
|
|
647
654
|
*
|
|
648
655
|
* @param {Object} [options] Options object
|
|
656
|
+
* @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether
|
|
657
|
+
* any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
|
|
658
|
+
* multiple times in the same tick
|
|
649
659
|
* @param {String} [options.binaryType=nodebuffer] The type for binary data
|
|
650
660
|
* @param {Object} [options.extensions] An object containing the negotiated
|
|
651
661
|
* extensions
|
|
@@ -656,7 +666,7 @@ var require_receiver = __commonJS({
|
|
|
656
666
|
* not to skip UTF-8 validation for text and close messages
|
|
657
667
|
*/
|
|
658
668
|
constructor(options = {}) {
|
|
659
|
-
super(), this._binaryType = options.binaryType || BINARY_TYPES[0], this._extensions = options.extensions || {}, this._isServer = !!options.isServer, this._maxPayload = options.maxPayload | 0, this._skipUTF8Validation = !!options.skipUTF8Validation, this[kWebSocket] = void 0, this._bufferedBytes = 0, this._buffers = [], this._compressed = !1, this._payloadLength = 0, this._mask = void 0, this._fragmented = 0, this._masked = !1, this._fin = !1, this._opcode = 0, this._totalPayloadLength = 0, this._messageLength = 0, this._fragments = [], this.
|
|
669
|
+
super(), this._allowSynchronousEvents = options.allowSynchronousEvents !== void 0 ? options.allowSynchronousEvents : !0, this._binaryType = options.binaryType || BINARY_TYPES[0], this._extensions = options.extensions || {}, this._isServer = !!options.isServer, this._maxPayload = options.maxPayload | 0, this._skipUTF8Validation = !!options.skipUTF8Validation, this[kWebSocket] = void 0, this._bufferedBytes = 0, this._buffers = [], this._compressed = !1, this._payloadLength = 0, this._mask = void 0, this._fragmented = 0, this._masked = !1, this._fin = !1, this._opcode = 0, this._totalPayloadLength = 0, this._messageLength = 0, this._fragments = [], this._errored = !1, this._loop = !1, this._state = GET_INFO;
|
|
660
670
|
}
|
|
661
671
|
/**
|
|
662
672
|
* Implements `Writable.prototype._write()`.
|
|
@@ -705,191 +715,230 @@ var require_receiver = __commonJS({
|
|
|
705
715
|
* @private
|
|
706
716
|
*/
|
|
707
717
|
startLoop(cb) {
|
|
708
|
-
let err;
|
|
709
718
|
this._loop = !0;
|
|
710
719
|
do
|
|
711
720
|
switch (this._state) {
|
|
712
721
|
case GET_INFO:
|
|
713
|
-
|
|
722
|
+
this.getInfo(cb);
|
|
714
723
|
break;
|
|
715
724
|
case GET_PAYLOAD_LENGTH_16:
|
|
716
|
-
|
|
725
|
+
this.getPayloadLength16(cb);
|
|
717
726
|
break;
|
|
718
727
|
case GET_PAYLOAD_LENGTH_64:
|
|
719
|
-
|
|
728
|
+
this.getPayloadLength64(cb);
|
|
720
729
|
break;
|
|
721
730
|
case GET_MASK:
|
|
722
731
|
this.getMask();
|
|
723
732
|
break;
|
|
724
733
|
case GET_DATA:
|
|
725
|
-
|
|
734
|
+
this.getData(cb);
|
|
726
735
|
break;
|
|
727
|
-
|
|
736
|
+
case INFLATING:
|
|
737
|
+
case DEFER_EVENT:
|
|
728
738
|
this._loop = !1;
|
|
729
739
|
return;
|
|
730
740
|
}
|
|
731
741
|
while (this._loop);
|
|
732
|
-
cb(
|
|
742
|
+
this._errored || cb();
|
|
733
743
|
}
|
|
734
744
|
/**
|
|
735
745
|
* Reads the first two bytes of a frame.
|
|
736
746
|
*
|
|
737
|
-
* @
|
|
747
|
+
* @param {Function} cb Callback
|
|
738
748
|
* @private
|
|
739
749
|
*/
|
|
740
|
-
getInfo() {
|
|
750
|
+
getInfo(cb) {
|
|
741
751
|
if (this._bufferedBytes < 2) {
|
|
742
752
|
this._loop = !1;
|
|
743
753
|
return;
|
|
744
754
|
}
|
|
745
755
|
let buf = this.consume(2);
|
|
746
|
-
if (buf[0] & 48)
|
|
747
|
-
|
|
756
|
+
if (buf[0] & 48) {
|
|
757
|
+
let error = this.createError(
|
|
748
758
|
RangeError,
|
|
749
759
|
"RSV2 and RSV3 must be clear",
|
|
750
760
|
!0,
|
|
751
761
|
1002,
|
|
752
762
|
"WS_ERR_UNEXPECTED_RSV_2_3"
|
|
753
763
|
);
|
|
764
|
+
cb(error);
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
754
767
|
let compressed = (buf[0] & 64) === 64;
|
|
755
|
-
if (compressed && !this._extensions[PerMessageDeflate.extensionName])
|
|
756
|
-
|
|
768
|
+
if (compressed && !this._extensions[PerMessageDeflate.extensionName]) {
|
|
769
|
+
let error = this.createError(
|
|
757
770
|
RangeError,
|
|
758
771
|
"RSV1 must be clear",
|
|
759
772
|
!0,
|
|
760
773
|
1002,
|
|
761
774
|
"WS_ERR_UNEXPECTED_RSV_1"
|
|
762
775
|
);
|
|
776
|
+
cb(error);
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
763
779
|
if (this._fin = (buf[0] & 128) === 128, this._opcode = buf[0] & 15, this._payloadLength = buf[1] & 127, this._opcode === 0) {
|
|
764
|
-
if (compressed)
|
|
765
|
-
|
|
780
|
+
if (compressed) {
|
|
781
|
+
let error = this.createError(
|
|
766
782
|
RangeError,
|
|
767
783
|
"RSV1 must be clear",
|
|
768
784
|
!0,
|
|
769
785
|
1002,
|
|
770
786
|
"WS_ERR_UNEXPECTED_RSV_1"
|
|
771
787
|
);
|
|
772
|
-
|
|
773
|
-
return
|
|
788
|
+
cb(error);
|
|
789
|
+
return;
|
|
790
|
+
}
|
|
791
|
+
if (!this._fragmented) {
|
|
792
|
+
let error = this.createError(
|
|
774
793
|
RangeError,
|
|
775
794
|
"invalid opcode 0",
|
|
776
795
|
!0,
|
|
777
796
|
1002,
|
|
778
797
|
"WS_ERR_INVALID_OPCODE"
|
|
779
798
|
);
|
|
799
|
+
cb(error);
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
780
802
|
this._opcode = this._fragmented;
|
|
781
803
|
} else if (this._opcode === 1 || this._opcode === 2) {
|
|
782
|
-
if (this._fragmented)
|
|
783
|
-
|
|
804
|
+
if (this._fragmented) {
|
|
805
|
+
let error = this.createError(
|
|
784
806
|
RangeError,
|
|
785
807
|
`invalid opcode ${this._opcode}`,
|
|
786
808
|
!0,
|
|
787
809
|
1002,
|
|
788
810
|
"WS_ERR_INVALID_OPCODE"
|
|
789
811
|
);
|
|
812
|
+
cb(error);
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
790
815
|
this._compressed = compressed;
|
|
791
816
|
} else if (this._opcode > 7 && this._opcode < 11) {
|
|
792
|
-
if (!this._fin)
|
|
793
|
-
|
|
817
|
+
if (!this._fin) {
|
|
818
|
+
let error = this.createError(
|
|
794
819
|
RangeError,
|
|
795
820
|
"FIN must be set",
|
|
796
821
|
!0,
|
|
797
822
|
1002,
|
|
798
823
|
"WS_ERR_EXPECTED_FIN"
|
|
799
824
|
);
|
|
800
|
-
|
|
801
|
-
return
|
|
825
|
+
cb(error);
|
|
826
|
+
return;
|
|
827
|
+
}
|
|
828
|
+
if (compressed) {
|
|
829
|
+
let error = this.createError(
|
|
802
830
|
RangeError,
|
|
803
831
|
"RSV1 must be clear",
|
|
804
832
|
!0,
|
|
805
833
|
1002,
|
|
806
834
|
"WS_ERR_UNEXPECTED_RSV_1"
|
|
807
835
|
);
|
|
808
|
-
|
|
809
|
-
return
|
|
836
|
+
cb(error);
|
|
837
|
+
return;
|
|
838
|
+
}
|
|
839
|
+
if (this._payloadLength > 125 || this._opcode === 8 && this._payloadLength === 1) {
|
|
840
|
+
let error = this.createError(
|
|
810
841
|
RangeError,
|
|
811
842
|
`invalid payload length ${this._payloadLength}`,
|
|
812
843
|
!0,
|
|
813
844
|
1002,
|
|
814
845
|
"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"
|
|
815
846
|
);
|
|
816
|
-
|
|
817
|
-
|
|
847
|
+
cb(error);
|
|
848
|
+
return;
|
|
849
|
+
}
|
|
850
|
+
} else {
|
|
851
|
+
let error = this.createError(
|
|
818
852
|
RangeError,
|
|
819
853
|
`invalid opcode ${this._opcode}`,
|
|
820
854
|
!0,
|
|
821
855
|
1002,
|
|
822
856
|
"WS_ERR_INVALID_OPCODE"
|
|
823
857
|
);
|
|
858
|
+
cb(error);
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
824
861
|
if (!this._fin && !this._fragmented && (this._fragmented = this._opcode), this._masked = (buf[1] & 128) === 128, this._isServer) {
|
|
825
|
-
if (!this._masked)
|
|
826
|
-
|
|
862
|
+
if (!this._masked) {
|
|
863
|
+
let error = this.createError(
|
|
827
864
|
RangeError,
|
|
828
865
|
"MASK must be set",
|
|
829
866
|
!0,
|
|
830
867
|
1002,
|
|
831
868
|
"WS_ERR_EXPECTED_MASK"
|
|
832
869
|
);
|
|
833
|
-
|
|
834
|
-
|
|
870
|
+
cb(error);
|
|
871
|
+
return;
|
|
872
|
+
}
|
|
873
|
+
} else if (this._masked) {
|
|
874
|
+
let error = this.createError(
|
|
835
875
|
RangeError,
|
|
836
876
|
"MASK must be clear",
|
|
837
877
|
!0,
|
|
838
878
|
1002,
|
|
839
879
|
"WS_ERR_UNEXPECTED_MASK"
|
|
840
880
|
);
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
881
|
+
cb(error);
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
884
|
+
this._payloadLength === 126 ? this._state = GET_PAYLOAD_LENGTH_16 : this._payloadLength === 127 ? this._state = GET_PAYLOAD_LENGTH_64 : this.haveLength(cb);
|
|
844
885
|
}
|
|
845
886
|
/**
|
|
846
887
|
* Gets extended payload length (7+16).
|
|
847
888
|
*
|
|
848
|
-
* @
|
|
889
|
+
* @param {Function} cb Callback
|
|
849
890
|
* @private
|
|
850
891
|
*/
|
|
851
|
-
getPayloadLength16() {
|
|
892
|
+
getPayloadLength16(cb) {
|
|
852
893
|
if (this._bufferedBytes < 2) {
|
|
853
894
|
this._loop = !1;
|
|
854
895
|
return;
|
|
855
896
|
}
|
|
856
|
-
|
|
897
|
+
this._payloadLength = this.consume(2).readUInt16BE(0), this.haveLength(cb);
|
|
857
898
|
}
|
|
858
899
|
/**
|
|
859
900
|
* Gets extended payload length (7+64).
|
|
860
901
|
*
|
|
861
|
-
* @
|
|
902
|
+
* @param {Function} cb Callback
|
|
862
903
|
* @private
|
|
863
904
|
*/
|
|
864
|
-
getPayloadLength64() {
|
|
905
|
+
getPayloadLength64(cb) {
|
|
865
906
|
if (this._bufferedBytes < 8) {
|
|
866
907
|
this._loop = !1;
|
|
867
908
|
return;
|
|
868
909
|
}
|
|
869
910
|
let buf = this.consume(8), num = buf.readUInt32BE(0);
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
911
|
+
if (num > Math.pow(2, 21) - 1) {
|
|
912
|
+
let error = this.createError(
|
|
913
|
+
RangeError,
|
|
914
|
+
"Unsupported WebSocket frame: payload length > 2^53 - 1",
|
|
915
|
+
!1,
|
|
916
|
+
1009,
|
|
917
|
+
"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH"
|
|
918
|
+
);
|
|
919
|
+
cb(error);
|
|
920
|
+
return;
|
|
921
|
+
}
|
|
922
|
+
this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4), this.haveLength(cb);
|
|
877
923
|
}
|
|
878
924
|
/**
|
|
879
925
|
* Payload length has been read.
|
|
880
926
|
*
|
|
881
|
-
* @
|
|
927
|
+
* @param {Function} cb Callback
|
|
882
928
|
* @private
|
|
883
929
|
*/
|
|
884
|
-
haveLength() {
|
|
885
|
-
if (this._payloadLength && this._opcode < 8 && (this._totalPayloadLength += this._payloadLength, this._totalPayloadLength > this._maxPayload && this._maxPayload > 0))
|
|
886
|
-
|
|
930
|
+
haveLength(cb) {
|
|
931
|
+
if (this._payloadLength && this._opcode < 8 && (this._totalPayloadLength += this._payloadLength, this._totalPayloadLength > this._maxPayload && this._maxPayload > 0)) {
|
|
932
|
+
let error = this.createError(
|
|
887
933
|
RangeError,
|
|
888
934
|
"Max payload size exceeded",
|
|
889
935
|
!1,
|
|
890
936
|
1009,
|
|
891
937
|
"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"
|
|
892
938
|
);
|
|
939
|
+
cb(error);
|
|
940
|
+
return;
|
|
941
|
+
}
|
|
893
942
|
this._masked ? this._state = GET_MASK : this._state = GET_DATA;
|
|
894
943
|
}
|
|
895
944
|
/**
|
|
@@ -908,7 +957,6 @@ var require_receiver = __commonJS({
|
|
|
908
957
|
* Reads data bytes.
|
|
909
958
|
*
|
|
910
959
|
* @param {Function} cb Callback
|
|
911
|
-
* @return {(Error|RangeError|undefined)} A possible error
|
|
912
960
|
* @private
|
|
913
961
|
*/
|
|
914
962
|
getData(cb) {
|
|
@@ -920,12 +968,15 @@ var require_receiver = __commonJS({
|
|
|
920
968
|
}
|
|
921
969
|
data = this.consume(this._payloadLength), this._masked && this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3] && unmask(data, this._mask);
|
|
922
970
|
}
|
|
923
|
-
if (this._opcode > 7)
|
|
971
|
+
if (this._opcode > 7) {
|
|
972
|
+
this.controlMessage(data, cb);
|
|
973
|
+
return;
|
|
974
|
+
}
|
|
924
975
|
if (this._compressed) {
|
|
925
976
|
this._state = INFLATING, this.decompress(data, cb);
|
|
926
977
|
return;
|
|
927
978
|
}
|
|
928
|
-
|
|
979
|
+
data.length && (this._messageLength = this._totalPayloadLength, this._fragments.push(data)), this.dataMessage(cb);
|
|
929
980
|
}
|
|
930
981
|
/**
|
|
931
982
|
* Decompresses data.
|
|
@@ -938,49 +989,56 @@ var require_receiver = __commonJS({
|
|
|
938
989
|
this._extensions[PerMessageDeflate.extensionName].decompress(data, this._fin, (err, buf) => {
|
|
939
990
|
if (err) return cb(err);
|
|
940
991
|
if (buf.length) {
|
|
941
|
-
if (this._messageLength += buf.length, this._messageLength > this._maxPayload && this._maxPayload > 0)
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"
|
|
949
|
-
)
|
|
992
|
+
if (this._messageLength += buf.length, this._messageLength > this._maxPayload && this._maxPayload > 0) {
|
|
993
|
+
let error = this.createError(
|
|
994
|
+
RangeError,
|
|
995
|
+
"Max payload size exceeded",
|
|
996
|
+
!1,
|
|
997
|
+
1009,
|
|
998
|
+
"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"
|
|
950
999
|
);
|
|
1000
|
+
cb(error);
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
951
1003
|
this._fragments.push(buf);
|
|
952
1004
|
}
|
|
953
|
-
|
|
954
|
-
if (er) return cb(er);
|
|
955
|
-
this.startLoop(cb);
|
|
1005
|
+
this.dataMessage(cb), this._state === GET_INFO && this.startLoop(cb);
|
|
956
1006
|
});
|
|
957
1007
|
}
|
|
958
1008
|
/**
|
|
959
1009
|
* Handles a data message.
|
|
960
1010
|
*
|
|
961
|
-
* @
|
|
1011
|
+
* @param {Function} cb Callback
|
|
962
1012
|
* @private
|
|
963
1013
|
*/
|
|
964
|
-
dataMessage() {
|
|
965
|
-
if (this._fin) {
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
1014
|
+
dataMessage(cb) {
|
|
1015
|
+
if (!this._fin) {
|
|
1016
|
+
this._state = GET_INFO;
|
|
1017
|
+
return;
|
|
1018
|
+
}
|
|
1019
|
+
let messageLength = this._messageLength, fragments = this._fragments;
|
|
1020
|
+
if (this._totalPayloadLength = 0, this._messageLength = 0, this._fragmented = 0, this._fragments = [], this._opcode === 2) {
|
|
1021
|
+
let data;
|
|
1022
|
+
this._binaryType === "nodebuffer" ? data = concat(fragments, messageLength) : this._binaryType === "arraybuffer" ? data = toArrayBuffer(concat(fragments, messageLength)) : this._binaryType === "blob" ? data = new Blob(fragments) : data = fragments, this._allowSynchronousEvents ? (this.emit("message", data, !0), this._state = GET_INFO) : (this._state = DEFER_EVENT, setImmediate(() => {
|
|
1023
|
+
this.emit("message", data, !0), this._state = GET_INFO, this.startLoop(cb);
|
|
1024
|
+
}));
|
|
1025
|
+
} else {
|
|
1026
|
+
let buf = concat(fragments, messageLength);
|
|
1027
|
+
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
1028
|
+
let error = this.createError(
|
|
1029
|
+
Error,
|
|
1030
|
+
"invalid UTF-8 sequence",
|
|
1031
|
+
!0,
|
|
1032
|
+
1007,
|
|
1033
|
+
"WS_ERR_INVALID_UTF8"
|
|
1034
|
+
);
|
|
1035
|
+
cb(error);
|
|
1036
|
+
return;
|
|
981
1037
|
}
|
|
1038
|
+
this._state === INFLATING || this._allowSynchronousEvents ? (this.emit("message", buf, !1), this._state = GET_INFO) : (this._state = DEFER_EVENT, setImmediate(() => {
|
|
1039
|
+
this.emit("message", buf, !1), this._state = GET_INFO, this.startLoop(cb);
|
|
1040
|
+
}));
|
|
982
1041
|
}
|
|
983
|
-
this._state = GET_INFO;
|
|
984
1042
|
}
|
|
985
1043
|
/**
|
|
986
1044
|
* Handles a control message.
|
|
@@ -989,65 +1047,88 @@ var require_receiver = __commonJS({
|
|
|
989
1047
|
* @return {(Error|RangeError|undefined)} A possible error
|
|
990
1048
|
* @private
|
|
991
1049
|
*/
|
|
992
|
-
controlMessage(data) {
|
|
993
|
-
if (this._opcode === 8)
|
|
994
|
-
if (
|
|
995
|
-
this.emit("conclude", 1005, EMPTY_BUFFER), this.end();
|
|
1050
|
+
controlMessage(data, cb) {
|
|
1051
|
+
if (this._opcode === 8) {
|
|
1052
|
+
if (data.length === 0)
|
|
1053
|
+
this._loop = !1, this.emit("conclude", 1005, EMPTY_BUFFER), this.end();
|
|
996
1054
|
else {
|
|
997
1055
|
let code = data.readUInt16BE(0);
|
|
998
|
-
if (!isValidStatusCode(code))
|
|
999
|
-
|
|
1056
|
+
if (!isValidStatusCode(code)) {
|
|
1057
|
+
let error = this.createError(
|
|
1000
1058
|
RangeError,
|
|
1001
1059
|
`invalid status code ${code}`,
|
|
1002
1060
|
!0,
|
|
1003
1061
|
1002,
|
|
1004
1062
|
"WS_ERR_INVALID_CLOSE_CODE"
|
|
1005
1063
|
);
|
|
1064
|
+
cb(error);
|
|
1065
|
+
return;
|
|
1066
|
+
}
|
|
1006
1067
|
let buf = new FastBuffer(
|
|
1007
1068
|
data.buffer,
|
|
1008
1069
|
data.byteOffset + 2,
|
|
1009
1070
|
data.length - 2
|
|
1010
1071
|
);
|
|
1011
|
-
if (!this._skipUTF8Validation && !isValidUTF8(buf))
|
|
1012
|
-
|
|
1072
|
+
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
1073
|
+
let error = this.createError(
|
|
1013
1074
|
Error,
|
|
1014
1075
|
"invalid UTF-8 sequence",
|
|
1015
1076
|
!0,
|
|
1016
1077
|
1007,
|
|
1017
1078
|
"WS_ERR_INVALID_UTF8"
|
|
1018
1079
|
);
|
|
1019
|
-
|
|
1080
|
+
cb(error);
|
|
1081
|
+
return;
|
|
1082
|
+
}
|
|
1083
|
+
this._loop = !1, this.emit("conclude", code, buf), this.end();
|
|
1020
1084
|
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1085
|
+
this._state = GET_INFO;
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1088
|
+
this._allowSynchronousEvents ? (this.emit(this._opcode === 9 ? "ping" : "pong", data), this._state = GET_INFO) : (this._state = DEFER_EVENT, setImmediate(() => {
|
|
1089
|
+
this.emit(this._opcode === 9 ? "ping" : "pong", data), this._state = GET_INFO, this.startLoop(cb);
|
|
1090
|
+
}));
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Builds an error object.
|
|
1094
|
+
*
|
|
1095
|
+
* @param {function(new:Error|RangeError)} ErrorCtor The error constructor
|
|
1096
|
+
* @param {String} message The error message
|
|
1097
|
+
* @param {Boolean} prefix Specifies whether or not to add a default prefix to
|
|
1098
|
+
* `message`
|
|
1099
|
+
* @param {Number} statusCode The status code
|
|
1100
|
+
* @param {String} errorCode The exposed error code
|
|
1101
|
+
* @return {(Error|RangeError)} The error
|
|
1102
|
+
* @private
|
|
1103
|
+
*/
|
|
1104
|
+
createError(ErrorCtor, message, prefix, statusCode, errorCode) {
|
|
1105
|
+
this._loop = !1, this._errored = !0;
|
|
1106
|
+
let err = new ErrorCtor(
|
|
1107
|
+
prefix ? `Invalid WebSocket frame: ${message}` : message
|
|
1108
|
+
);
|
|
1109
|
+
return Error.captureStackTrace(err, this.createError), err.code = errorCode, err[kStatusCode] = statusCode, err;
|
|
1023
1110
|
}
|
|
1024
1111
|
};
|
|
1025
1112
|
module.exports = Receiver2;
|
|
1026
|
-
function error(ErrorCtor, message, prefix, statusCode, errorCode) {
|
|
1027
|
-
let err = new ErrorCtor(
|
|
1028
|
-
prefix ? `Invalid WebSocket frame: ${message}` : message
|
|
1029
|
-
);
|
|
1030
|
-
return Error.captureStackTrace(err, error), err.code = errorCode, err[kStatusCode] = statusCode, err;
|
|
1031
|
-
}
|
|
1032
1113
|
}
|
|
1033
1114
|
});
|
|
1034
1115
|
|
|
1035
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
1116
|
+
// ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/sender.js
|
|
1036
1117
|
var require_sender = __commonJS({
|
|
1037
|
-
"../../node_modules/.pnpm/ws@8.
|
|
1118
|
+
"../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/sender.js"(exports, module) {
|
|
1038
1119
|
"use strict";
|
|
1039
1120
|
init_cjs_shims();
|
|
1040
|
-
var
|
|
1121
|
+
var { Duplex } = __require("stream"), { randomFillSync } = __require("crypto"), PerMessageDeflate = require_permessage_deflate(), { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants(), { isBlob, isValidStatusCode } = require_validation(), { mask: applyMask, toBuffer } = require_buffer_util(), kByteLength = Symbol("kByteLength"), maskBuffer = Buffer.alloc(4), RANDOM_POOL_SIZE = 8 * 1024, randomPool, randomPoolPointer = RANDOM_POOL_SIZE, DEFAULT = 0, DEFLATING = 1, GET_BLOB_DATA = 2, Sender2 = class _Sender {
|
|
1041
1122
|
/**
|
|
1042
1123
|
* Creates a Sender instance.
|
|
1043
1124
|
*
|
|
1044
|
-
* @param {
|
|
1125
|
+
* @param {Duplex} socket The connection socket
|
|
1045
1126
|
* @param {Object} [extensions] An object containing the negotiated extensions
|
|
1046
1127
|
* @param {Function} [generateMask] The function used to generate the masking
|
|
1047
1128
|
* key
|
|
1048
1129
|
*/
|
|
1049
1130
|
constructor(socket, extensions, generateMask) {
|
|
1050
|
-
this._extensions = extensions || {}, generateMask && (this._generateMask = generateMask, this._maskBuffer = Buffer.alloc(4)), this._socket = socket, this._firstFragment = !0, this._compress = !1, this._bufferedBytes = 0, this.
|
|
1131
|
+
this._extensions = extensions || {}, generateMask && (this._generateMask = generateMask, this._maskBuffer = Buffer.alloc(4)), this._socket = socket, this._firstFragment = !0, this._compress = !1, this._bufferedBytes = 0, this._queue = [], this._state = DEFAULT, this.onerror = NOOP, this[kWebSocket] = void 0;
|
|
1051
1132
|
}
|
|
1052
1133
|
/**
|
|
1053
1134
|
* Frames a piece of data according to the HyBi WebSocket protocol.
|
|
@@ -1072,7 +1153,7 @@ var require_sender = __commonJS({
|
|
|
1072
1153
|
*/
|
|
1073
1154
|
static frame(data, options) {
|
|
1074
1155
|
let mask, merge = !1, offset = 2, skipMasking = !1;
|
|
1075
|
-
options.mask && (mask = options.maskBuffer || maskBuffer, options.generateMask ? options.generateMask(mask) : randomFillSync(
|
|
1156
|
+
options.mask && (mask = options.maskBuffer || maskBuffer, options.generateMask ? options.generateMask(mask) : (randomPoolPointer === RANDOM_POOL_SIZE && (randomPool === void 0 && (randomPool = Buffer.alloc(RANDOM_POOL_SIZE)), randomFillSync(randomPool, 0, RANDOM_POOL_SIZE), randomPoolPointer = 0), mask[0] = randomPool[randomPoolPointer++], mask[1] = randomPool[randomPoolPointer++], mask[2] = randomPool[randomPoolPointer++], mask[3] = randomPool[randomPoolPointer++]), skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0, offset = 6);
|
|
1076
1157
|
let dataLength;
|
|
1077
1158
|
typeof data == "string" ? (!options.mask || skipMasking) && options[kByteLength] !== void 0 ? dataLength = options[kByteLength] : (data = Buffer.from(data), dataLength = data.length) : (dataLength = data.length, merge = options.mask && options.readOnly && !skipMasking);
|
|
1078
1159
|
let payloadLength = dataLength;
|
|
@@ -1115,7 +1196,7 @@ var require_sender = __commonJS({
|
|
|
1115
1196
|
readOnly: !1,
|
|
1116
1197
|
rsv1: !1
|
|
1117
1198
|
};
|
|
1118
|
-
this.
|
|
1199
|
+
this._state !== DEFAULT ? this.enqueue([this.dispatch, buf, !1, options, cb]) : this.sendFrame(_Sender.frame(buf, options), cb);
|
|
1119
1200
|
}
|
|
1120
1201
|
/**
|
|
1121
1202
|
* Sends a ping message to the other peer.
|
|
@@ -1127,7 +1208,7 @@ var require_sender = __commonJS({
|
|
|
1127
1208
|
*/
|
|
1128
1209
|
ping(data, mask, cb) {
|
|
1129
1210
|
let byteLength, readOnly;
|
|
1130
|
-
if (typeof data == "string" ? (byteLength = Buffer.byteLength(data), readOnly = !1) : (data = toBuffer(data), byteLength = data.length, readOnly = toBuffer.readOnly), byteLength > 125)
|
|
1211
|
+
if (typeof data == "string" ? (byteLength = Buffer.byteLength(data), readOnly = !1) : isBlob(data) ? (byteLength = data.size, readOnly = !1) : (data = toBuffer(data), byteLength = data.length, readOnly = toBuffer.readOnly), byteLength > 125)
|
|
1131
1212
|
throw new RangeError("The data size must not be greater than 125 bytes");
|
|
1132
1213
|
let options = {
|
|
1133
1214
|
[kByteLength]: byteLength,
|
|
@@ -1139,7 +1220,7 @@ var require_sender = __commonJS({
|
|
|
1139
1220
|
readOnly,
|
|
1140
1221
|
rsv1: !1
|
|
1141
1222
|
};
|
|
1142
|
-
this.
|
|
1223
|
+
isBlob(data) ? this._state !== DEFAULT ? this.enqueue([this.getBlobData, data, !1, options, cb]) : this.getBlobData(data, !1, options, cb) : this._state !== DEFAULT ? this.enqueue([this.dispatch, data, !1, options, cb]) : this.sendFrame(_Sender.frame(data, options), cb);
|
|
1143
1224
|
}
|
|
1144
1225
|
/**
|
|
1145
1226
|
* Sends a pong message to the other peer.
|
|
@@ -1151,7 +1232,7 @@ var require_sender = __commonJS({
|
|
|
1151
1232
|
*/
|
|
1152
1233
|
pong(data, mask, cb) {
|
|
1153
1234
|
let byteLength, readOnly;
|
|
1154
|
-
if (typeof data == "string" ? (byteLength = Buffer.byteLength(data), readOnly = !1) : (data = toBuffer(data), byteLength = data.length, readOnly = toBuffer.readOnly), byteLength > 125)
|
|
1235
|
+
if (typeof data == "string" ? (byteLength = Buffer.byteLength(data), readOnly = !1) : isBlob(data) ? (byteLength = data.size, readOnly = !1) : (data = toBuffer(data), byteLength = data.length, readOnly = toBuffer.readOnly), byteLength > 125)
|
|
1155
1236
|
throw new RangeError("The data size must not be greater than 125 bytes");
|
|
1156
1237
|
let options = {
|
|
1157
1238
|
[kByteLength]: byteLength,
|
|
@@ -1163,7 +1244,7 @@ var require_sender = __commonJS({
|
|
|
1163
1244
|
readOnly,
|
|
1164
1245
|
rsv1: !1
|
|
1165
1246
|
};
|
|
1166
|
-
this.
|
|
1247
|
+
isBlob(data) ? this._state !== DEFAULT ? this.enqueue([this.getBlobData, data, !1, options, cb]) : this.getBlobData(data, !1, options, cb) : this._state !== DEFAULT ? this.enqueue([this.dispatch, data, !1, options, cb]) : this.sendFrame(_Sender.frame(data, options), cb);
|
|
1167
1248
|
}
|
|
1168
1249
|
/**
|
|
1169
1250
|
* Sends a data message to the other peer.
|
|
@@ -1183,32 +1264,57 @@ var require_sender = __commonJS({
|
|
|
1183
1264
|
*/
|
|
1184
1265
|
send(data, options, cb) {
|
|
1185
1266
|
let perMessageDeflate = this._extensions[PerMessageDeflate.extensionName], opcode = options.binary ? 2 : 1, rsv1 = options.compress, byteLength, readOnly;
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1267
|
+
typeof data == "string" ? (byteLength = Buffer.byteLength(data), readOnly = !1) : isBlob(data) ? (byteLength = data.size, readOnly = !1) : (data = toBuffer(data), byteLength = data.length, readOnly = toBuffer.readOnly), this._firstFragment ? (this._firstFragment = !1, rsv1 && perMessageDeflate && perMessageDeflate.params[perMessageDeflate._isServer ? "server_no_context_takeover" : "client_no_context_takeover"] && (rsv1 = byteLength >= perMessageDeflate._threshold), this._compress = rsv1) : (rsv1 = !1, opcode = 0), options.fin && (this._firstFragment = !0);
|
|
1268
|
+
let opts = {
|
|
1269
|
+
[kByteLength]: byteLength,
|
|
1270
|
+
fin: options.fin,
|
|
1271
|
+
generateMask: this._generateMask,
|
|
1272
|
+
mask: options.mask,
|
|
1273
|
+
maskBuffer: this._maskBuffer,
|
|
1274
|
+
opcode,
|
|
1275
|
+
readOnly,
|
|
1276
|
+
rsv1
|
|
1277
|
+
};
|
|
1278
|
+
isBlob(data) ? this._state !== DEFAULT ? this.enqueue([this.getBlobData, data, this._compress, opts, cb]) : this.getBlobData(data, this._compress, opts, cb) : this._state !== DEFAULT ? this.enqueue([this.dispatch, data, this._compress, opts, cb]) : this.dispatch(data, this._compress, opts, cb);
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Gets the contents of a blob as binary data.
|
|
1282
|
+
*
|
|
1283
|
+
* @param {Blob} blob The blob
|
|
1284
|
+
* @param {Boolean} [compress=false] Specifies whether or not to compress
|
|
1285
|
+
* the data
|
|
1286
|
+
* @param {Object} options Options object
|
|
1287
|
+
* @param {Boolean} [options.fin=false] Specifies whether or not to set the
|
|
1288
|
+
* FIN bit
|
|
1289
|
+
* @param {Function} [options.generateMask] The function used to generate the
|
|
1290
|
+
* masking key
|
|
1291
|
+
* @param {Boolean} [options.mask=false] Specifies whether or not to mask
|
|
1292
|
+
* `data`
|
|
1293
|
+
* @param {Buffer} [options.maskBuffer] The buffer used to store the masking
|
|
1294
|
+
* key
|
|
1295
|
+
* @param {Number} options.opcode The opcode
|
|
1296
|
+
* @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
|
|
1297
|
+
* modified
|
|
1298
|
+
* @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
|
|
1299
|
+
* RSV1 bit
|
|
1300
|
+
* @param {Function} [cb] Callback
|
|
1301
|
+
* @private
|
|
1302
|
+
*/
|
|
1303
|
+
getBlobData(blob, compress, options, cb) {
|
|
1304
|
+
this._bufferedBytes += options[kByteLength], this._state = GET_BLOB_DATA, blob.arrayBuffer().then((arrayBuffer) => {
|
|
1305
|
+
if (this._socket.destroyed) {
|
|
1306
|
+
let err = new Error(
|
|
1307
|
+
"The socket was closed while the blob was being read"
|
|
1308
|
+
);
|
|
1309
|
+
process.nextTick(callCallbacks, this, err, cb);
|
|
1310
|
+
return;
|
|
1311
|
+
}
|
|
1312
|
+
this._bufferedBytes -= options[kByteLength];
|
|
1313
|
+
let data = toBuffer(arrayBuffer);
|
|
1314
|
+
compress ? this.dispatch(data, compress, options, cb) : (this._state = DEFAULT, this.sendFrame(_Sender.frame(data, options), cb), this.dequeue());
|
|
1315
|
+
}).catch((err) => {
|
|
1316
|
+
process.nextTick(onError, this, err, cb);
|
|
1317
|
+
});
|
|
1212
1318
|
}
|
|
1213
1319
|
/**
|
|
1214
1320
|
* Dispatches a message.
|
|
@@ -1239,19 +1345,15 @@ var require_sender = __commonJS({
|
|
|
1239
1345
|
return;
|
|
1240
1346
|
}
|
|
1241
1347
|
let perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
|
|
1242
|
-
this._bufferedBytes += options[kByteLength], this.
|
|
1348
|
+
this._bufferedBytes += options[kByteLength], this._state = DEFLATING, perMessageDeflate.compress(data, options.fin, (_, buf) => {
|
|
1243
1349
|
if (this._socket.destroyed) {
|
|
1244
1350
|
let err = new Error(
|
|
1245
1351
|
"The socket was closed while data was being compressed"
|
|
1246
1352
|
);
|
|
1247
|
-
|
|
1248
|
-
for (let i = 0; i < this._queue.length; i++) {
|
|
1249
|
-
let params = this._queue[i], callback = params[params.length - 1];
|
|
1250
|
-
typeof callback == "function" && callback(err);
|
|
1251
|
-
}
|
|
1353
|
+
callCallbacks(this, err, cb);
|
|
1252
1354
|
return;
|
|
1253
1355
|
}
|
|
1254
|
-
this._bufferedBytes -= options[kByteLength], this.
|
|
1356
|
+
this._bufferedBytes -= options[kByteLength], this._state = DEFAULT, options.readOnly = !1, this.sendFrame(_Sender.frame(buf, options), cb), this.dequeue();
|
|
1255
1357
|
});
|
|
1256
1358
|
}
|
|
1257
1359
|
/**
|
|
@@ -1260,7 +1362,7 @@ var require_sender = __commonJS({
|
|
|
1260
1362
|
* @private
|
|
1261
1363
|
*/
|
|
1262
1364
|
dequeue() {
|
|
1263
|
-
for (;
|
|
1365
|
+
for (; this._state === DEFAULT && this._queue.length; ) {
|
|
1264
1366
|
let params = this._queue.shift();
|
|
1265
1367
|
this._bufferedBytes -= params[3][kByteLength], Reflect.apply(params[0], this, params.slice(1));
|
|
1266
1368
|
}
|
|
@@ -1286,12 +1388,22 @@ var require_sender = __commonJS({
|
|
|
1286
1388
|
}
|
|
1287
1389
|
};
|
|
1288
1390
|
module.exports = Sender2;
|
|
1391
|
+
function callCallbacks(sender, err, cb) {
|
|
1392
|
+
typeof cb == "function" && cb(err);
|
|
1393
|
+
for (let i = 0; i < sender._queue.length; i++) {
|
|
1394
|
+
let params = sender._queue[i], callback = params[params.length - 1];
|
|
1395
|
+
typeof callback == "function" && callback(err);
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
function onError(sender, err, cb) {
|
|
1399
|
+
callCallbacks(sender, err, cb), sender.onerror(err);
|
|
1400
|
+
}
|
|
1289
1401
|
}
|
|
1290
1402
|
});
|
|
1291
1403
|
|
|
1292
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
1404
|
+
// ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/event-target.js
|
|
1293
1405
|
var require_event_target = __commonJS({
|
|
1294
|
-
"../../node_modules/.pnpm/ws@8.
|
|
1406
|
+
"../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/event-target.js"(exports, module) {
|
|
1295
1407
|
"use strict";
|
|
1296
1408
|
init_cjs_shims();
|
|
1297
1409
|
var { kForOnEventAttribute, kListener } = require_constants(), kCode = Symbol("kCode"), kData = Symbol("kData"), kError = Symbol("kError"), kMessage = Symbol("kMessage"), kReason = Symbol("kReason"), kTarget = Symbol("kTarget"), kType = Symbol("kType"), kWasClean = Symbol("kWasClean"), Event = class {
|
|
@@ -1485,9 +1597,9 @@ var require_event_target = __commonJS({
|
|
|
1485
1597
|
}
|
|
1486
1598
|
});
|
|
1487
1599
|
|
|
1488
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
1600
|
+
// ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/extension.js
|
|
1489
1601
|
var require_extension = __commonJS({
|
|
1490
|
-
"../../node_modules/.pnpm/ws@8.
|
|
1602
|
+
"../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/extension.js"(exports, module) {
|
|
1491
1603
|
"use strict";
|
|
1492
1604
|
init_cjs_shims();
|
|
1493
1605
|
var { tokenChars } = require_validation();
|
|
@@ -1571,12 +1683,12 @@ var require_extension = __commonJS({
|
|
|
1571
1683
|
}
|
|
1572
1684
|
});
|
|
1573
1685
|
|
|
1574
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
1686
|
+
// ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/websocket.js
|
|
1575
1687
|
var require_websocket = __commonJS({
|
|
1576
|
-
"../../node_modules/.pnpm/ws@8.
|
|
1688
|
+
"../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/websocket.js"(exports, module) {
|
|
1577
1689
|
"use strict";
|
|
1578
1690
|
init_cjs_shims();
|
|
1579
|
-
var EventEmitter = __require("events"), https = __require("https"), http = __require("http"), net = __require("net"), tls = __require("tls"), { randomBytes, createHash } = __require("crypto"), { Readable } = __require("stream"), { URL } = __require("url"), PerMessageDeflate = require_permessage_deflate(), Receiver2 = require_receiver(), Sender2 = require_sender(), {
|
|
1691
|
+
var EventEmitter = __require("events"), https = __require("https"), http = __require("http"), net = __require("net"), tls = __require("tls"), { randomBytes, createHash } = __require("crypto"), { Duplex, Readable } = __require("stream"), { URL } = __require("url"), PerMessageDeflate = require_permessage_deflate(), Receiver2 = require_receiver(), Sender2 = require_sender(), { isBlob } = require_validation(), {
|
|
1580
1692
|
BINARY_TYPES,
|
|
1581
1693
|
EMPTY_BUFFER,
|
|
1582
1694
|
GUID,
|
|
@@ -1596,12 +1708,11 @@ var require_websocket = __commonJS({
|
|
|
1596
1708
|
* @param {Object} [options] Connection options
|
|
1597
1709
|
*/
|
|
1598
1710
|
constructor(address, protocols, options) {
|
|
1599
|
-
super(), this._binaryType = BINARY_TYPES[0], this._closeCode = 1006, this._closeFrameReceived = !1, this._closeFrameSent = !1, this._closeMessage = EMPTY_BUFFER, this._closeTimer = null, this._extensions = {}, this._paused = !1, this._protocol = "", this._readyState = _WebSocket.CONNECTING, this._receiver = null, this._sender = null, this._socket = null, address !== null ? (this._bufferedAmount = 0, this._isServer = !1, this._redirects = 0, protocols === void 0 ? protocols = [] : Array.isArray(protocols) || (typeof protocols == "object" && protocols !== null ? (options = protocols, protocols = []) : protocols = [protocols]), initAsClient(this, address, protocols, options)) : this._isServer = !0;
|
|
1711
|
+
super(), this._binaryType = BINARY_TYPES[0], this._closeCode = 1006, this._closeFrameReceived = !1, this._closeFrameSent = !1, this._closeMessage = EMPTY_BUFFER, this._closeTimer = null, this._errorEmitted = !1, this._extensions = {}, this._paused = !1, this._protocol = "", this._readyState = _WebSocket.CONNECTING, this._receiver = null, this._sender = null, this._socket = null, address !== null ? (this._bufferedAmount = 0, this._isServer = !1, this._redirects = 0, protocols === void 0 ? protocols = [] : Array.isArray(protocols) || (typeof protocols == "object" && protocols !== null ? (options = protocols, protocols = []) : protocols = [protocols]), initAsClient(this, address, protocols, options)) : (this._autoPong = options.autoPong, this._isServer = !0);
|
|
1600
1712
|
}
|
|
1601
1713
|
/**
|
|
1602
|
-
*
|
|
1603
|
-
*
|
|
1604
|
-
* type).
|
|
1714
|
+
* For historical reasons, the custom "nodebuffer" type is used by the default
|
|
1715
|
+
* instead of "blob".
|
|
1605
1716
|
*
|
|
1606
1717
|
* @type {String}
|
|
1607
1718
|
*/
|
|
@@ -1678,10 +1789,12 @@ var require_websocket = __commonJS({
|
|
|
1678
1789
|
/**
|
|
1679
1790
|
* Set up the socket and the internal resources.
|
|
1680
1791
|
*
|
|
1681
|
-
* @param {
|
|
1682
|
-
* server and client
|
|
1792
|
+
* @param {Duplex} socket The network socket between the server and client
|
|
1683
1793
|
* @param {Buffer} head The first packet of the upgraded stream
|
|
1684
1794
|
* @param {Object} options Options object
|
|
1795
|
+
* @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether
|
|
1796
|
+
* any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
|
|
1797
|
+
* multiple times in the same tick
|
|
1685
1798
|
* @param {Function} [options.generateMask] The function used to generate the
|
|
1686
1799
|
* masking key
|
|
1687
1800
|
* @param {Number} [options.maxPayload=0] The maximum allowed message size
|
|
@@ -1691,13 +1804,14 @@ var require_websocket = __commonJS({
|
|
|
1691
1804
|
*/
|
|
1692
1805
|
setSocket(socket, head, options) {
|
|
1693
1806
|
let receiver = new Receiver2({
|
|
1807
|
+
allowSynchronousEvents: options.allowSynchronousEvents,
|
|
1694
1808
|
binaryType: this.binaryType,
|
|
1695
1809
|
extensions: this._extensions,
|
|
1696
1810
|
isServer: this._isServer,
|
|
1697
1811
|
maxPayload: options.maxPayload,
|
|
1698
1812
|
skipUTF8Validation: options.skipUTF8Validation
|
|
1699
|
-
});
|
|
1700
|
-
this.
|
|
1813
|
+
}), sender = new Sender2(socket, this._extensions, options.generateMask);
|
|
1814
|
+
this._receiver = receiver, this._sender = sender, this._socket = socket, receiver[kWebSocket] = this, sender[kWebSocket] = this, socket[kWebSocket] = this, receiver.on("conclude", receiverOnConclude), receiver.on("drain", receiverOnDrain), receiver.on("error", receiverOnError), receiver.on("message", receiverOnMessage), receiver.on("ping", receiverOnPing), receiver.on("pong", receiverOnPong), sender.onerror = senderOnError, socket.setTimeout && socket.setTimeout(0), socket.setNoDelay && socket.setNoDelay(), head.length > 0 && socket.unshift(head), socket.on("close", socketOnClose), socket.on("data", socketOnData), socket.on("end", socketOnEnd), socket.on("error", socketOnError), this._readyState = _WebSocket.OPEN, this.emit("open");
|
|
1701
1815
|
}
|
|
1702
1816
|
/**
|
|
1703
1817
|
* Emit the `'close'` event.
|
|
@@ -1743,10 +1857,7 @@ var require_websocket = __commonJS({
|
|
|
1743
1857
|
}
|
|
1744
1858
|
this._readyState = _WebSocket.CLOSING, this._sender.close(code, data, !this._isServer, (err) => {
|
|
1745
1859
|
err || (this._closeFrameSent = !0, (this._closeFrameReceived || this._receiver._writableState.errorEmitted) && this._socket.end());
|
|
1746
|
-
}), this
|
|
1747
|
-
this._socket.destroy.bind(this._socket),
|
|
1748
|
-
closeTimeout
|
|
1749
|
-
);
|
|
1860
|
+
}), setCloseTimer(this);
|
|
1750
1861
|
}
|
|
1751
1862
|
}
|
|
1752
1863
|
/**
|
|
@@ -1913,6 +2024,8 @@ var require_websocket = __commonJS({
|
|
|
1913
2024
|
module.exports = WebSocket2;
|
|
1914
2025
|
function initAsClient(websocket, address, protocols, options) {
|
|
1915
2026
|
let opts = {
|
|
2027
|
+
allowSynchronousEvents: !0,
|
|
2028
|
+
autoPong: !0,
|
|
1916
2029
|
protocolVersion: protocolVersions[1],
|
|
1917
2030
|
maxPayload: 104857600,
|
|
1918
2031
|
skipUTF8Validation: !1,
|
|
@@ -1920,7 +2033,6 @@ var require_websocket = __commonJS({
|
|
|
1920
2033
|
followRedirects: !1,
|
|
1921
2034
|
maxRedirects: 10,
|
|
1922
2035
|
...options,
|
|
1923
|
-
createConnection: void 0,
|
|
1924
2036
|
socketPath: void 0,
|
|
1925
2037
|
hostname: void 0,
|
|
1926
2038
|
protocol: void 0,
|
|
@@ -1930,23 +2042,22 @@ var require_websocket = __commonJS({
|
|
|
1930
2042
|
path: void 0,
|
|
1931
2043
|
port: void 0
|
|
1932
2044
|
};
|
|
1933
|
-
if (!protocolVersions.includes(opts.protocolVersion))
|
|
2045
|
+
if (websocket._autoPong = opts.autoPong, !protocolVersions.includes(opts.protocolVersion))
|
|
1934
2046
|
throw new RangeError(
|
|
1935
2047
|
`Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})`
|
|
1936
2048
|
);
|
|
1937
2049
|
let parsedUrl;
|
|
1938
2050
|
if (address instanceof URL)
|
|
1939
|
-
parsedUrl = address
|
|
1940
|
-
else
|
|
2051
|
+
parsedUrl = address;
|
|
2052
|
+
else
|
|
1941
2053
|
try {
|
|
1942
2054
|
parsedUrl = new URL(address);
|
|
1943
2055
|
} catch {
|
|
1944
2056
|
throw new SyntaxError(`Invalid URL: ${address}`);
|
|
1945
2057
|
}
|
|
1946
|
-
|
|
1947
|
-
}
|
|
2058
|
+
parsedUrl.protocol === "http:" ? parsedUrl.protocol = "ws:" : parsedUrl.protocol === "https:" && (parsedUrl.protocol = "wss:"), websocket._url = parsedUrl.href;
|
|
1948
2059
|
let isSecure = parsedUrl.protocol === "wss:", isIpcUrl = parsedUrl.protocol === "ws+unix:", invalidUrlMessage;
|
|
1949
|
-
if (parsedUrl.protocol !== "ws:" && !isSecure && !isIpcUrl ? invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"` : isIpcUrl && !parsedUrl.pathname ? invalidUrlMessage = "The URL's pathname is empty" : parsedUrl.hash && (invalidUrlMessage = "The URL contains a fragment identifier"), invalidUrlMessage) {
|
|
2060
|
+
if (parsedUrl.protocol !== "ws:" && !isSecure && !isIpcUrl ? invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"` : isIpcUrl && !parsedUrl.pathname ? invalidUrlMessage = "The URL's pathname is empty" : parsedUrl.hash && (invalidUrlMessage = "The URL contains a fragment identifier"), invalidUrlMessage) {
|
|
1950
2061
|
let err = new SyntaxError(invalidUrlMessage);
|
|
1951
2062
|
if (websocket._redirects === 0)
|
|
1952
2063
|
throw err;
|
|
@@ -1954,7 +2065,7 @@ var require_websocket = __commonJS({
|
|
|
1954
2065
|
return;
|
|
1955
2066
|
}
|
|
1956
2067
|
let defaultPort = isSecure ? 443 : 80, key = randomBytes(16).toString("base64"), request = isSecure ? https.request : http.request, protocolSet = /* @__PURE__ */ new Set(), perMessageDeflate;
|
|
1957
|
-
if (opts.createConnection = isSecure ? tlsConnect : netConnect, opts.defaultPort = opts.defaultPort || defaultPort, opts.port = parsedUrl.port || defaultPort, opts.host = parsedUrl.hostname.startsWith("[") ? parsedUrl.hostname.slice(1, -1) : parsedUrl.hostname, opts.headers = {
|
|
2068
|
+
if (opts.createConnection = opts.createConnection || (isSecure ? tlsConnect : netConnect), opts.defaultPort = opts.defaultPort || defaultPort, opts.port = parsedUrl.port || defaultPort, opts.host = parsedUrl.hostname.startsWith("[") ? parsedUrl.hostname.slice(1, -1) : parsedUrl.hostname, opts.headers = {
|
|
1958
2069
|
...opts.headers,
|
|
1959
2070
|
"Sec-WebSocket-Version": opts.protocolVersion,
|
|
1960
2071
|
"Sec-WebSocket-Key": key,
|
|
@@ -2023,7 +2134,9 @@ var require_websocket = __commonJS({
|
|
|
2023
2134
|
);
|
|
2024
2135
|
}), req.on("upgrade", (res, socket, head) => {
|
|
2025
2136
|
if (websocket.emit("upgrade", res), websocket.readyState !== WebSocket2.CONNECTING) return;
|
|
2026
|
-
|
|
2137
|
+
req = websocket._req = null;
|
|
2138
|
+
let upgrade = res.headers.upgrade;
|
|
2139
|
+
if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
|
|
2027
2140
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
2028
2141
|
return;
|
|
2029
2142
|
}
|
|
@@ -2065,6 +2178,7 @@ var require_websocket = __commonJS({
|
|
|
2065
2178
|
websocket._extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
|
|
2066
2179
|
}
|
|
2067
2180
|
websocket.setSocket(socket, head, {
|
|
2181
|
+
allowSynchronousEvents: opts.allowSynchronousEvents,
|
|
2068
2182
|
generateMask: opts.generateMask,
|
|
2069
2183
|
maxPayload: opts.maxPayload,
|
|
2070
2184
|
skipUTF8Validation: opts.skipUTF8Validation
|
|
@@ -2072,7 +2186,7 @@ var require_websocket = __commonJS({
|
|
|
2072
2186
|
}), opts.finishRequest ? opts.finishRequest(req, websocket) : req.end();
|
|
2073
2187
|
}
|
|
2074
2188
|
function emitErrorAndClose(websocket, err) {
|
|
2075
|
-
websocket._readyState = WebSocket2.CLOSING, websocket.emit("error", err), websocket.emitClose();
|
|
2189
|
+
websocket._readyState = WebSocket2.CLOSING, websocket._errorEmitted = !0, websocket.emit("error", err), websocket.emitClose();
|
|
2076
2190
|
}
|
|
2077
2191
|
function netConnect(options) {
|
|
2078
2192
|
return options.path = options.socketPath, net.connect(options);
|
|
@@ -2087,7 +2201,7 @@ var require_websocket = __commonJS({
|
|
|
2087
2201
|
}
|
|
2088
2202
|
function sendAfterClose(websocket, data, cb) {
|
|
2089
2203
|
if (data) {
|
|
2090
|
-
let length = toBuffer(data).length;
|
|
2204
|
+
let length = isBlob(data) ? data.size : toBuffer(data).length;
|
|
2091
2205
|
websocket._socket ? websocket._sender._bufferedBytes += length : websocket._bufferedAmount += length;
|
|
2092
2206
|
}
|
|
2093
2207
|
if (cb) {
|
|
@@ -2107,7 +2221,7 @@ var require_websocket = __commonJS({
|
|
|
2107
2221
|
}
|
|
2108
2222
|
function receiverOnError(err) {
|
|
2109
2223
|
let websocket = this[kWebSocket];
|
|
2110
|
-
websocket._socket[kWebSocket] !== void 0 && (websocket._socket.removeListener("data", socketOnData), process.nextTick(resume, websocket._socket), websocket.close(err[kStatusCode])), websocket.emit("error", err);
|
|
2224
|
+
websocket._socket[kWebSocket] !== void 0 && (websocket._socket.removeListener("data", socketOnData), process.nextTick(resume, websocket._socket), websocket.close(err[kStatusCode])), websocket._errorEmitted || (websocket._errorEmitted = !0, websocket.emit("error", err));
|
|
2111
2225
|
}
|
|
2112
2226
|
function receiverOnFinish() {
|
|
2113
2227
|
this[kWebSocket].emitClose();
|
|
@@ -2117,7 +2231,7 @@ var require_websocket = __commonJS({
|
|
|
2117
2231
|
}
|
|
2118
2232
|
function receiverOnPing(data) {
|
|
2119
2233
|
let websocket = this[kWebSocket];
|
|
2120
|
-
websocket.pong(data, !
|
|
2234
|
+
websocket._autoPong && websocket.pong(data, !this._isServer, NOOP), websocket.emit("ping", data);
|
|
2121
2235
|
}
|
|
2122
2236
|
function receiverOnPong(data) {
|
|
2123
2237
|
this[kWebSocket].emit("pong", data);
|
|
@@ -2125,6 +2239,16 @@ var require_websocket = __commonJS({
|
|
|
2125
2239
|
function resume(stream) {
|
|
2126
2240
|
stream.resume();
|
|
2127
2241
|
}
|
|
2242
|
+
function senderOnError(err) {
|
|
2243
|
+
let websocket = this[kWebSocket];
|
|
2244
|
+
websocket.readyState !== WebSocket2.CLOSED && (websocket.readyState === WebSocket2.OPEN && (websocket._readyState = WebSocket2.CLOSING, setCloseTimer(websocket)), this._socket.end(), websocket._errorEmitted || (websocket._errorEmitted = !0, websocket.emit("error", err)));
|
|
2245
|
+
}
|
|
2246
|
+
function setCloseTimer(websocket) {
|
|
2247
|
+
websocket._closeTimer = setTimeout(
|
|
2248
|
+
websocket._socket.destroy.bind(websocket._socket),
|
|
2249
|
+
closeTimeout
|
|
2250
|
+
);
|
|
2251
|
+
}
|
|
2128
2252
|
function socketOnClose() {
|
|
2129
2253
|
let websocket = this[kWebSocket];
|
|
2130
2254
|
this.removeListener("close", socketOnClose), this.removeListener("data", socketOnData), this.removeListener("end", socketOnEnd), websocket._readyState = WebSocket2.CLOSING;
|
|
@@ -2145,9 +2269,9 @@ var require_websocket = __commonJS({
|
|
|
2145
2269
|
}
|
|
2146
2270
|
});
|
|
2147
2271
|
|
|
2148
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
2272
|
+
// ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/subprotocol.js
|
|
2149
2273
|
var require_subprotocol = __commonJS({
|
|
2150
|
-
"../../node_modules/.pnpm/ws@8.
|
|
2274
|
+
"../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/subprotocol.js"(exports, module) {
|
|
2151
2275
|
"use strict";
|
|
2152
2276
|
init_cjs_shims();
|
|
2153
2277
|
var { tokenChars } = require_validation();
|
|
@@ -2181,16 +2305,21 @@ var require_subprotocol = __commonJS({
|
|
|
2181
2305
|
}
|
|
2182
2306
|
});
|
|
2183
2307
|
|
|
2184
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
2308
|
+
// ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/websocket-server.js
|
|
2185
2309
|
var require_websocket_server = __commonJS({
|
|
2186
|
-
"../../node_modules/.pnpm/ws@8.
|
|
2310
|
+
"../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/websocket-server.js"(exports, module) {
|
|
2187
2311
|
"use strict";
|
|
2188
2312
|
init_cjs_shims();
|
|
2189
|
-
var EventEmitter = __require("events"), http = __require("http"),
|
|
2313
|
+
var EventEmitter = __require("events"), http = __require("http"), { Duplex } = __require("stream"), { createHash } = __require("crypto"), extension = require_extension(), PerMessageDeflate = require_permessage_deflate(), subprotocol = require_subprotocol(), WebSocket2 = require_websocket(), { GUID, kWebSocket } = require_constants(), keyRegex = /^[+/0-9A-Za-z]{22}==$/, RUNNING = 0, CLOSING = 1, CLOSED = 2, WebSocketServer2 = class extends EventEmitter {
|
|
2190
2314
|
/**
|
|
2191
2315
|
* Create a `WebSocketServer` instance.
|
|
2192
2316
|
*
|
|
2193
2317
|
* @param {Object} options Configuration options
|
|
2318
|
+
* @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether
|
|
2319
|
+
* any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
|
|
2320
|
+
* multiple times in the same tick
|
|
2321
|
+
* @param {Boolean} [options.autoPong=true] Specifies whether or not to
|
|
2322
|
+
* automatically send a pong in response to a ping
|
|
2194
2323
|
* @param {Number} [options.backlog=511] The maximum length of the queue of
|
|
2195
2324
|
* pending connections
|
|
2196
2325
|
* @param {Boolean} [options.clientTracking=true] Specifies whether or not to
|
|
@@ -2215,6 +2344,8 @@ var require_websocket_server = __commonJS({
|
|
|
2215
2344
|
*/
|
|
2216
2345
|
constructor(options, callback) {
|
|
2217
2346
|
if (super(), options = {
|
|
2347
|
+
allowSynchronousEvents: !0,
|
|
2348
|
+
autoPong: !0,
|
|
2218
2349
|
maxPayload: 100 * 1024 * 1024,
|
|
2219
2350
|
skipUTF8Validation: !1,
|
|
2220
2351
|
perMessageDeflate: !1,
|
|
@@ -2313,24 +2444,23 @@ var require_websocket_server = __commonJS({
|
|
|
2313
2444
|
* Handle a HTTP Upgrade request.
|
|
2314
2445
|
*
|
|
2315
2446
|
* @param {http.IncomingMessage} req The request object
|
|
2316
|
-
* @param {
|
|
2317
|
-
* server and client
|
|
2447
|
+
* @param {Duplex} socket The network socket between the server and client
|
|
2318
2448
|
* @param {Buffer} head The first packet of the upgraded stream
|
|
2319
2449
|
* @param {Function} cb Callback
|
|
2320
2450
|
* @public
|
|
2321
2451
|
*/
|
|
2322
2452
|
handleUpgrade(req, socket, head, cb) {
|
|
2323
2453
|
socket.on("error", socketOnError);
|
|
2324
|
-
let key = req.headers["sec-websocket-key"], version = +req.headers["sec-websocket-version"];
|
|
2454
|
+
let key = req.headers["sec-websocket-key"], upgrade = req.headers.upgrade, version = +req.headers["sec-websocket-version"];
|
|
2325
2455
|
if (req.method !== "GET") {
|
|
2326
2456
|
abortHandshakeOrEmitwsClientError(this, req, socket, 405, "Invalid HTTP method");
|
|
2327
2457
|
return;
|
|
2328
2458
|
}
|
|
2329
|
-
if (
|
|
2459
|
+
if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
|
|
2330
2460
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Invalid Upgrade header");
|
|
2331
2461
|
return;
|
|
2332
2462
|
}
|
|
2333
|
-
if (
|
|
2463
|
+
if (key === void 0 || !keyRegex.test(key)) {
|
|
2334
2464
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Missing or invalid Sec-WebSocket-Key header");
|
|
2335
2465
|
return;
|
|
2336
2466
|
}
|
|
@@ -2398,8 +2528,7 @@ var require_websocket_server = __commonJS({
|
|
|
2398
2528
|
* @param {String} key The value of the `Sec-WebSocket-Key` header
|
|
2399
2529
|
* @param {Set} protocols The subprotocols
|
|
2400
2530
|
* @param {http.IncomingMessage} req The request object
|
|
2401
|
-
* @param {
|
|
2402
|
-
* server and client
|
|
2531
|
+
* @param {Duplex} socket The network socket between the server and client
|
|
2403
2532
|
* @param {Buffer} head The first packet of the upgraded stream
|
|
2404
2533
|
* @param {Function} cb Callback
|
|
2405
2534
|
* @throws {Error} If called more than once with the same socket
|
|
@@ -2417,7 +2546,7 @@ var require_websocket_server = __commonJS({
|
|
|
2417
2546
|
"Upgrade: websocket",
|
|
2418
2547
|
"Connection: Upgrade",
|
|
2419
2548
|
`Sec-WebSocket-Accept: ${createHash("sha1").update(key + GUID).digest("base64")}`
|
|
2420
|
-
], ws = new this.options.WebSocket(null);
|
|
2549
|
+
], ws = new this.options.WebSocket(null, void 0, this.options);
|
|
2421
2550
|
if (protocols.size) {
|
|
2422
2551
|
let protocol = this.options.handleProtocols ? this.options.handleProtocols(protocols, req) : protocols.values().next().value;
|
|
2423
2552
|
protocol && (headers.push(`Sec-WebSocket-Protocol: ${protocol}`), ws._protocol = protocol);
|
|
@@ -2431,6 +2560,7 @@ var require_websocket_server = __commonJS({
|
|
|
2431
2560
|
this.emit("headers", headers, req), socket.write(headers.concat(`\r
|
|
2432
2561
|
`).join(`\r
|
|
2433
2562
|
`)), socket.removeListener("error", socketOnError), ws.setSocket(socket, head, {
|
|
2563
|
+
allowSynchronousEvents: this.options.allowSynchronousEvents,
|
|
2434
2564
|
maxPayload: this.options.maxPayload,
|
|
2435
2565
|
skipUTF8Validation: this.options.skipUTF8Validation
|
|
2436
2566
|
}), this.clients && (this.clients.add(ws), ws.on("close", () => {
|
|
@@ -2476,7 +2606,7 @@ var require_websocket_server = __commonJS({
|
|
|
2476
2606
|
}
|
|
2477
2607
|
});
|
|
2478
2608
|
|
|
2479
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
2609
|
+
// ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/wrapper.mjs
|
|
2480
2610
|
init_cjs_shims();
|
|
2481
2611
|
var import_stream = __toESM(require_stream(), 1), import_receiver = __toESM(require_receiver(), 1), import_sender = __toESM(require_sender(), 1), import_websocket = __toESM(require_websocket(), 1), import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
2482
2612
|
var wrapper_default = import_websocket.default;
|
|
@@ -2485,4 +2615,4 @@ export {
|
|
|
2485
2615
|
import_websocket_server,
|
|
2486
2616
|
wrapper_default
|
|
2487
2617
|
};
|
|
2488
|
-
//# sourceMappingURL=chunk-
|
|
2618
|
+
//# sourceMappingURL=chunk-MW7RWHY5.js.map
|