@shopify/create-app 4.1.0 → 4.3.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.
Files changed (95) hide show
  1. package/dist/{acorn-B7Z74OJ7.js → acorn-MAWEBG4K.js} +4 -4
  2. package/dist/analytics-3PMXYIP7.js +39 -0
  3. package/dist/analytics-UKSMSQBS.js +33 -0
  4. package/dist/angular-75GZFSHJ.js +3117 -0
  5. package/dist/{babel-CJ53QMMG.js → babel-KZNQAA3R.js} +4 -4
  6. package/dist/{chokidar-HTKREZL3.js → chokidar-JYHMNWDF.js} +4 -4
  7. package/dist/{chunk-TVUF42MB.js → chunk-3HO4OGB2.js} +4 -4
  8. package/dist/{chunk-PKR7KJ6P.js → chunk-3XNI6LP4.js} +13 -4
  9. package/dist/{chunk-A6TJPMVH.js → chunk-5UUZHSUY.js} +28 -28
  10. package/dist/{chunk-SWITKWBS.js → chunk-76IXOUER.js} +4 -4
  11. package/dist/{chunk-DJW2W7VA.js → chunk-7OHJH7BF.js} +2 -2
  12. package/dist/{chunk-DWGHKWV5.js → chunk-BEUNBVME.js} +21 -21
  13. package/dist/{chunk-32DG2OXV.js → chunk-BL35W5EH.js} +25 -18
  14. package/dist/{chunk-S4YEA2XG.js → chunk-BLEIVACU.js} +10911 -2155
  15. package/dist/{chunk-ACS6S42W.js → chunk-C3J4HVUN.js} +2 -2
  16. package/dist/{chunk-OO33NRTL.js → chunk-D6NYWNY2.js} +2 -2
  17. package/dist/{chunk-C5OLLQWI.js → chunk-EBLNNEPP.js} +61 -55
  18. package/dist/{chunk-VBBBCVMH.js → chunk-G53O4PDO.js} +2 -2
  19. package/dist/{chunk-CEGG2EWP.js → chunk-GYXZK243.js} +3 -3
  20. package/dist/{chunk-7IK72W75.js → chunk-HABWQC37.js} +2 -2
  21. package/dist/{chunk-PVHOBK32.js → chunk-HIWQ3G6P.js} +10 -7
  22. package/dist/{chunk-BMI6QCMV.js → chunk-HJATSDRW.js} +560 -898
  23. package/dist/{chunk-PES3XMQM.js → chunk-JGGOQOPO.js} +2 -2
  24. package/dist/{chunk-UX6FRPFM.js → chunk-KWG6VAVE.js} +592 -351
  25. package/dist/{chunk-G2ZZKGSV.js → chunk-LBXDGVFS.js} +2 -2
  26. package/dist/{chunk-CE4S2SGM.js → chunk-LDYT4FTV.js} +233 -152
  27. package/dist/{chunk-TS6LOJXS.js → chunk-LQOISCOF.js} +31 -30
  28. package/dist/{chunk-JCETIRLI.js → chunk-MSED5ZFM.js} +2 -2
  29. package/dist/{chunk-X2WZCKNE.js → chunk-ODCXYGJ2.js} +3 -3
  30. package/dist/{chunk-AROS7RI6.js → chunk-OE3FSIHW.js} +3 -3
  31. package/dist/{chunk-MIECGF3H.js → chunk-OFTMFPMR.js} +6 -6
  32. package/dist/{chunk-6OOTYTVB.js → chunk-OQ3KXXGH.js} +219 -110
  33. package/dist/{chunk-X7YTIMNN.js → chunk-RIQNGBMO.js} +2 -2
  34. package/dist/{chunk-JT5MT2JE.js → chunk-WJSRZNB2.js} +10 -10
  35. package/dist/{chunk-RB7BXTZQ.js → chunk-ZNNK6ZF5.js} +140 -140
  36. package/dist/{chunk-7OFS6B2C.js → chunk-ZTXAANY4.js} +3 -3
  37. package/dist/{conf-store-R26LOTXD.js → conf-store-HDH4Y2F3.js} +15 -15
  38. package/dist/{custom-oclif-loader-354VAVF4.js → custom-oclif-loader-7BTLNXYR.js} +8 -8
  39. package/dist/{deprecations-JWETMJFF.js → deprecations-AREYHAI7.js} +19 -19
  40. package/dist/{devtools-4EY2MEDN.js → devtools-MQLG4C6G.js} +3 -3
  41. package/dist/dist-CECUBBYR.js +510 -0
  42. package/dist/environments-C3Z4TCZS.js +26 -0
  43. package/dist/error-handler-C3IHDYS6.js +37 -0
  44. package/dist/{estree-UBDGCTT2.js → estree-5HWY3OB4.js} +5 -5
  45. package/dist/{flow-FUOSTAYW.js → flow-2RRPTAWK.js} +4 -4
  46. package/dist/{fs-HPLMOQQD.js → fs-BANPZ2MD.js} +8 -8
  47. package/dist/{glimmer-XBFG6K3P.js → glimmer-CEC5WUBW.js} +4 -4
  48. package/dist/{graphql-C5WOGPMM.js → graphql-HWYKHSDS.js} +4 -4
  49. package/dist/hooks/postrun.js +9 -9
  50. package/dist/hooks/prerun.js +7 -7
  51. package/dist/{html-QRIT6TOU.js → html-QFC3GCRO.js} +925 -831
  52. package/dist/{http-proxy-node16-XB2DSBCB.js → http-proxy-node16-5LMQ6YXS.js} +4 -4
  53. package/dist/index.js +6619 -5437
  54. package/dist/index.test.js +7252 -8137
  55. package/dist/{is-global-OXCPPXM7.js → is-global-G56KES2Y.js} +8 -8
  56. package/dist/{is-wsl-YAJ3DFN7.js → is-wsl-63MHD6QC.js} +7 -6
  57. package/dist/{latest-version-3PFKLJZM.js → latest-version-6X5NXQEO.js} +4 -4
  58. package/dist/lib-NKDE2QNY.js +11 -0
  59. package/dist/{local-6ARTMTVE.js → local-JBCA7C7D.js} +4 -4
  60. package/dist/{magic-string.es-TVG7HRZ2.js → magic-string.es-PUBJJZST.js} +2 -2
  61. package/dist/{markdown-M5KQ3F3U.js → markdown-4ZM5GKW2.js} +5 -5
  62. package/dist/{meriyah-QX42RF3Q.js → meriyah-SUZXHXAS.js} +4 -4
  63. package/dist/{metadata-Z65VJ53L.js → metadata-FSAZEGLO.js} +5 -5
  64. package/dist/{multipart-parser-WKKMXACL.js → multipart-parser-QFOUP2TT.js} +3 -3
  65. package/dist/{node-package-manager-Q3Y2FSRM.js → node-package-manager-MQEWWORU.js} +20 -20
  66. package/dist/notifications-system-LRNZSYSG.js +40 -0
  67. package/dist/{open-BHIF7E3E.js → open-JSCXNUDN.js} +3 -3
  68. package/dist/out-B5JNCU2S.js +7 -0
  69. package/dist/{output-MCH67S5U.js → output-SAJPYFUY.js} +8 -8
  70. package/dist/{path-EOPO7QNL.js → path-2WA5R6GG.js} +3 -3
  71. package/dist/{postcss-4PDU7IQT.js → postcss-JKZFHYDB.js} +8 -6
  72. package/dist/{prettier-UAG5TKE4.js → prettier-SS3RRDXK.js} +3 -3
  73. package/dist/system-ERPUEL46.js +47 -0
  74. package/dist/tsconfig.tsbuildinfo +1 -1
  75. package/dist/typescript-4FFXOVC6.js +6 -0
  76. package/dist/{typescript-LCSPQIRD.js → typescript-HLNUID2L.js} +4 -4
  77. package/dist/{ui-AYUE37Z3.js → ui-SD2MSDNB.js} +18 -18
  78. package/dist/{upgrade-DNAT5W4B.js → upgrade-UCWZU5UX.js} +26 -26
  79. package/dist/version-ODTNTG3P.js +8 -0
  80. package/dist/version-ZWXWXLYG.js +30 -0
  81. package/dist/{yaml-VGESS2QB.js → yaml-Y6GPRGAB.js} +4 -4
  82. package/oclif.manifest.json +1 -1
  83. package/package.json +5 -5
  84. package/dist/analytics-RYQKQ4DG.js +0 -39
  85. package/dist/analytics-ZSO2XN53.js +0 -33
  86. package/dist/angular-IKHE4H7C.js +0 -2771
  87. package/dist/environments-VKYG7DMX.js +0 -26
  88. package/dist/error-handler-YXGIUGKI.js +0 -37
  89. package/dist/lib-HWIFANCM.js +0 -11
  90. package/dist/notifications-system-2HPAOE4P.js +0 -40
  91. package/dist/out-JJWXGPI4.js +0 -7
  92. package/dist/system-YW6RJ2KQ.js +0 -47
  93. package/dist/typescript-TKTDYKKG.js +0 -6
  94. package/dist/version-2J64V5CP.js +0 -8
  95. package/dist/version-V77ZX5N2.js +0 -30
@@ -3,84 +3,18 @@ import {
3
3
  __require,
4
4
  __toESM,
5
5
  init_cjs_shims
6
- } from "./chunk-PKR7KJ6P.js";
6
+ } from "./chunk-3XNI6LP4.js";
7
7
 
8
- // ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/stream.js
9
- var require_stream = __commonJS({
10
- "../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/stream.js"(exports, module) {
11
- "use strict";
12
- init_cjs_shims();
13
- var { Duplex } = __require("stream");
14
- function emitClose(stream) {
15
- stream.emit("close");
16
- }
17
- function duplexOnEnd() {
18
- !this.destroyed && this._writableState.finished && this.destroy();
19
- }
20
- function duplexOnError(err) {
21
- this.removeListener("error", duplexOnError), this.destroy(), this.listenerCount("error") === 0 && this.emit("error", err);
22
- }
23
- function createWebSocketStream2(ws, options) {
24
- let terminateOnDestroy = !0, duplex = new Duplex({
25
- ...options,
26
- autoDestroy: !1,
27
- emitClose: !1,
28
- objectMode: !1,
29
- writableObjectMode: !1
30
- });
31
- return ws.on("message", function(msg, isBinary) {
32
- let data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
33
- duplex.push(data) || ws.pause();
34
- }), ws.once("error", function(err) {
35
- duplex.destroyed || (terminateOnDestroy = !1, duplex.destroy(err));
36
- }), ws.once("close", function() {
37
- duplex.destroyed || duplex.push(null);
38
- }), duplex._destroy = function(err, callback) {
39
- if (ws.readyState === ws.CLOSED) {
40
- callback(err), process.nextTick(emitClose, duplex);
41
- return;
42
- }
43
- let called = !1;
44
- ws.once("error", function(err2) {
45
- called = !0, callback(err2);
46
- }), ws.once("close", function() {
47
- called || callback(err), process.nextTick(emitClose, duplex);
48
- }), terminateOnDestroy && ws.terminate();
49
- }, duplex._final = function(callback) {
50
- if (ws.readyState === ws.CONNECTING) {
51
- ws.once("open", function() {
52
- duplex._final(callback);
53
- });
54
- return;
55
- }
56
- ws._socket !== null && (ws._socket._writableState.finished ? (callback(), duplex._readableState.endEmitted && duplex.destroy()) : (ws._socket.once("finish", function() {
57
- callback();
58
- }), ws.close()));
59
- }, duplex._read = function() {
60
- ws.isPaused && ws.resume();
61
- }, duplex._write = function(chunk, encoding, callback) {
62
- if (ws.readyState === ws.CONNECTING) {
63
- ws.once("open", function() {
64
- duplex._write(chunk, encoding, callback);
65
- });
66
- return;
67
- }
68
- ws.send(chunk, callback);
69
- }, duplex.on("end", duplexOnEnd), duplex.on("error", duplexOnError), duplex;
70
- }
71
- module.exports = createWebSocketStream2;
72
- }
73
- });
74
-
75
- // ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/constants.js
8
+ // ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/constants.js
76
9
  var require_constants = __commonJS({
77
- "../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/constants.js"(exports, module) {
10
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/constants.js"(exports, module) {
78
11
  "use strict";
79
12
  init_cjs_shims();
80
13
  var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"], hasBlob = typeof Blob < "u";
81
14
  hasBlob && BINARY_TYPES.push("blob");
82
15
  module.exports = {
83
16
  BINARY_TYPES,
17
+ CLOSE_TIMEOUT: 3e4,
84
18
  EMPTY_BUFFER: Buffer.alloc(0),
85
19
  GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
86
20
  hasBlob,
@@ -94,9 +28,9 @@ var require_constants = __commonJS({
94
28
  }
95
29
  });
96
30
 
97
- // ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/buffer-util.js
31
+ // ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/buffer-util.js
98
32
  var require_buffer_util = __commonJS({
99
- "../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/buffer-util.js"(exports, module) {
33
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/buffer-util.js"(exports, module) {
100
34
  "use strict";
101
35
  init_cjs_shims();
102
36
  var { EMPTY_BUFFER } = require_constants(), FastBuffer = Buffer[Symbol.species];
@@ -146,9 +80,9 @@ var require_buffer_util = __commonJS({
146
80
  }
147
81
  });
148
82
 
149
- // ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/limiter.js
83
+ // ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/limiter.js
150
84
  var require_limiter = __commonJS({
151
- "../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/limiter.js"(exports, module) {
85
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/limiter.js"(exports, module) {
152
86
  "use strict";
153
87
  init_cjs_shims();
154
88
  var kDone = /* @__PURE__ */ Symbol("kDone"), kRun = /* @__PURE__ */ Symbol("kRun"), Limiter = class {
@@ -188,12 +122,12 @@ var require_limiter = __commonJS({
188
122
  }
189
123
  });
190
124
 
191
- // ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/permessage-deflate.js
125
+ // ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/permessage-deflate.js
192
126
  var require_permessage_deflate = __commonJS({
193
- "../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/permessage-deflate.js"(exports, module) {
127
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/permessage-deflate.js"(exports, module) {
194
128
  "use strict";
195
129
  init_cjs_shims();
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 = /* @__PURE__ */ Symbol("permessage-deflate"), kTotalLength = /* @__PURE__ */ Symbol("total-length"), kCallback = /* @__PURE__ */ Symbol("callback"), kBuffers = /* @__PURE__ */ Symbol("buffers"), kError = /* @__PURE__ */ Symbol("error"), zlibLimiter, PerMessageDeflate = class {
130
+ 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 = /* @__PURE__ */ Symbol("permessage-deflate"), kTotalLength = /* @__PURE__ */ Symbol("total-length"), kCallback = /* @__PURE__ */ Symbol("callback"), kBuffers = /* @__PURE__ */ Symbol("buffers"), kError = /* @__PURE__ */ Symbol("error"), zlibLimiter, PerMessageDeflate2 = class {
197
131
  /**
198
132
  * Creates a PerMessageDeflate instance.
199
133
  *
@@ -204,6 +138,9 @@ var require_permessage_deflate = __commonJS({
204
138
  * acknowledge disabling of client context takeover
205
139
  * @param {Number} [options.concurrencyLimit=10] The number of concurrent
206
140
  * calls to zlib
141
+ * @param {Boolean} [options.isServer=false] Create the instance in either
142
+ * server or client mode
143
+ * @param {Number} [options.maxPayload=0] The maximum allowed message length
207
144
  * @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the
208
145
  * use of a custom server window size
209
146
  * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept
@@ -214,12 +151,9 @@ var require_permessage_deflate = __commonJS({
214
151
  * deflate
215
152
  * @param {Object} [options.zlibInflateOptions] Options to pass to zlib on
216
153
  * inflate
217
- * @param {Boolean} [isServer=false] Create the instance in either server or
218
- * client mode
219
- * @param {Number} [maxPayload=0] The maximum allowed message length
220
154
  */
221
- constructor(options, isServer, maxPayload) {
222
- if (this._maxPayload = maxPayload | 0, this._options = options || {}, this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024, this._isServer = !!isServer, this._deflate = null, this._inflate = null, this.params = null, !zlibLimiter) {
155
+ constructor(options) {
156
+ if (this._options = options || {}, this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024, this._maxPayload = this._options.maxPayload | 0, this._isServer = !!this._options.isServer, this._deflate = null, this._inflate = null, this.params = null, !zlibLimiter) {
223
157
  let concurrency = this._options.concurrencyLimit !== void 0 ? this._options.concurrencyLimit : 10;
224
158
  zlibLimiter = new Limiter(concurrency);
225
159
  }
@@ -428,7 +362,7 @@ var require_permessage_deflate = __commonJS({
428
362
  });
429
363
  }
430
364
  };
431
- module.exports = PerMessageDeflate;
365
+ module.exports = PerMessageDeflate2;
432
366
  function deflateOnData(chunk) {
433
367
  this[kBuffers].push(chunk), this[kTotalLength] += chunk.length;
434
368
  }
@@ -440,14 +374,18 @@ var require_permessage_deflate = __commonJS({
440
374
  this[kError] = new RangeError("Max payload size exceeded"), this[kError].code = "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH", this[kError][kStatusCode] = 1009, this.removeListener("data", inflateOnData), this.reset();
441
375
  }
442
376
  function inflateOnError(err) {
443
- this[kPerMessageDeflate]._inflate = null, err[kStatusCode] = 1007, this[kCallback](err);
377
+ if (this[kPerMessageDeflate]._inflate = null, this[kError]) {
378
+ this[kCallback](this[kError]);
379
+ return;
380
+ }
381
+ err[kStatusCode] = 1007, this[kCallback](err);
444
382
  }
445
383
  }
446
384
  });
447
385
 
448
- // ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/validation.js
386
+ // ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/validation.js
449
387
  var require_validation = __commonJS({
450
- "../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/validation.js"(exports, module) {
388
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/validation.js"(exports, module) {
451
389
  "use strict";
452
390
  init_cjs_shims();
453
391
  var { isUtf8 } = __require("buffer"), { hasBlob } = require_constants(), tokenChars = [
@@ -638,12 +576,12 @@ var require_validation = __commonJS({
638
576
  }
639
577
  });
640
578
 
641
- // ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/receiver.js
579
+ // ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/receiver.js
642
580
  var require_receiver = __commonJS({
643
- "../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/receiver.js"(exports, module) {
581
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/receiver.js"(exports, module) {
644
582
  "use strict";
645
583
  init_cjs_shims();
646
- var { Writable } = __require("stream"), PerMessageDeflate = require_permessage_deflate(), {
584
+ var { Writable } = __require("stream"), PerMessageDeflate2 = require_permessage_deflate(), {
647
585
  BINARY_TYPES,
648
586
  EMPTY_BUFFER,
649
587
  kStatusCode,
@@ -661,12 +599,16 @@ var require_receiver = __commonJS({
661
599
  * extensions
662
600
  * @param {Boolean} [options.isServer=false] Specifies whether to operate in
663
601
  * client or server mode
602
+ * @param {Number} [options.maxBufferedChunks=0] The maximum number of
603
+ * buffered data chunks
604
+ * @param {Number} [options.maxFragments=0] The maximum number of message
605
+ * fragments
664
606
  * @param {Number} [options.maxPayload=0] The maximum allowed message length
665
607
  * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
666
608
  * not to skip UTF-8 validation for text and close messages
667
609
  */
668
610
  constructor(options = {}) {
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;
611
+ 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._maxBufferedChunks = options.maxBufferedChunks | 0, this._maxFragments = options.maxFragments | 0, 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;
670
612
  }
671
613
  /**
672
614
  * Implements `Writable.prototype._write()`.
@@ -678,6 +620,18 @@ var require_receiver = __commonJS({
678
620
  */
679
621
  _write(chunk, encoding, cb) {
680
622
  if (this._opcode === 8 && this._state == GET_INFO) return cb();
623
+ if (this._maxBufferedChunks > 0 && this._buffers.length >= this._maxBufferedChunks) {
624
+ cb(
625
+ this.createError(
626
+ RangeError,
627
+ "Too many buffered chunks",
628
+ !1,
629
+ 1008,
630
+ "WS_ERR_TOO_MANY_BUFFERED_PARTS"
631
+ )
632
+ );
633
+ return;
634
+ }
681
635
  this._bufferedBytes += chunk.length, this._buffers.push(chunk), this.startLoop(cb);
682
636
  }
683
637
  /**
@@ -765,7 +719,7 @@ var require_receiver = __commonJS({
765
719
  return;
766
720
  }
767
721
  let compressed = (buf[0] & 64) === 64;
768
- if (compressed && !this._extensions[PerMessageDeflate.extensionName]) {
722
+ if (compressed && !this._extensions[PerMessageDeflate2.extensionName]) {
769
723
  let error = this.createError(
770
724
  RangeError,
771
725
  "RSV1 must be clear",
@@ -976,7 +930,21 @@ var require_receiver = __commonJS({
976
930
  this._state = INFLATING, this.decompress(data, cb);
977
931
  return;
978
932
  }
979
- data.length && (this._messageLength = this._totalPayloadLength, this._fragments.push(data)), this.dataMessage(cb);
933
+ if (data.length) {
934
+ if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
935
+ let error = this.createError(
936
+ RangeError,
937
+ "Too many message fragments",
938
+ !1,
939
+ 1008,
940
+ "WS_ERR_TOO_MANY_BUFFERED_PARTS"
941
+ );
942
+ cb(error);
943
+ return;
944
+ }
945
+ this._messageLength = this._totalPayloadLength, this._fragments.push(data);
946
+ }
947
+ this.dataMessage(cb);
980
948
  }
981
949
  /**
982
950
  * Decompresses data.
@@ -986,7 +954,7 @@ var require_receiver = __commonJS({
986
954
  * @private
987
955
  */
988
956
  decompress(data, cb) {
989
- this._extensions[PerMessageDeflate.extensionName].decompress(data, this._fin, (err, buf) => {
957
+ this._extensions[PerMessageDeflate2.extensionName].decompress(data, this._fin, (err, buf) => {
990
958
  if (err) return cb(err);
991
959
  if (buf.length) {
992
960
  if (this._messageLength += buf.length, this._messageLength > this._maxPayload && this._maxPayload > 0) {
@@ -1000,6 +968,17 @@ var require_receiver = __commonJS({
1000
968
  cb(error);
1001
969
  return;
1002
970
  }
971
+ if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
972
+ let error = this.createError(
973
+ RangeError,
974
+ "Too many message fragments",
975
+ !1,
976
+ 1008,
977
+ "WS_ERR_TOO_MANY_BUFFERED_PARTS"
978
+ );
979
+ cb(error);
980
+ return;
981
+ }
1003
982
  this._fragments.push(buf);
1004
983
  }
1005
984
  this.dataMessage(cb), this._state === GET_INFO && this.startLoop(cb);
@@ -1113,12 +1092,14 @@ var require_receiver = __commonJS({
1113
1092
  }
1114
1093
  });
1115
1094
 
1116
- // ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/sender.js
1095
+ // ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/sender.js
1117
1096
  var require_sender = __commonJS({
1118
- "../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/sender.js"(exports, module) {
1097
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/sender.js"(exports, module) {
1119
1098
  "use strict";
1120
1099
  init_cjs_shims();
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 = /* @__PURE__ */ 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 {
1100
+ var { Duplex } = __require("stream"), { randomFillSync } = __require("crypto"), {
1101
+ types: { isUint8Array }
1102
+ } = __require("util"), PerMessageDeflate2 = require_permessage_deflate(), { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants(), { isBlob, isValidStatusCode } = require_validation(), { mask: applyMask, toBuffer } = require_buffer_util(), kByteLength = /* @__PURE__ */ 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 {
1122
1103
  /**
1123
1104
  * Creates a Sender instance.
1124
1105
  *
@@ -1183,7 +1164,12 @@ var require_sender = __commonJS({
1183
1164
  let length = Buffer.byteLength(data);
1184
1165
  if (length > 123)
1185
1166
  throw new RangeError("The message must not be greater than 123 bytes");
1186
- buf = Buffer.allocUnsafe(2 + length), buf.writeUInt16BE(code, 0), typeof data == "string" ? buf.write(data, 2) : buf.set(data, 2);
1167
+ if (buf = Buffer.allocUnsafe(2 + length), buf.writeUInt16BE(code, 0), typeof data == "string")
1168
+ buf.write(data, 2);
1169
+ else if (isUint8Array(data))
1170
+ buf.set(data, 2);
1171
+ else
1172
+ throw new TypeError("Second argument must be a string or a Uint8Array");
1187
1173
  }
1188
1174
  }
1189
1175
  let options = {
@@ -1263,7 +1249,7 @@ var require_sender = __commonJS({
1263
1249
  * @public
1264
1250
  */
1265
1251
  send(data, options, cb) {
1266
- let perMessageDeflate = this._extensions[PerMessageDeflate.extensionName], opcode = options.binary ? 2 : 1, rsv1 = options.compress, byteLength, readOnly;
1252
+ let perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName], opcode = options.binary ? 2 : 1, rsv1 = options.compress, byteLength, readOnly;
1267
1253
  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
1254
  let opts = {
1269
1255
  [kByteLength]: byteLength,
@@ -1344,7 +1330,7 @@ var require_sender = __commonJS({
1344
1330
  this.sendFrame(_Sender.frame(data, options), cb);
1345
1331
  return;
1346
1332
  }
1347
- let perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
1333
+ let perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
1348
1334
  this._bufferedBytes += options[kByteLength], this._state = DEFLATING, perMessageDeflate.compress(data, options.fin, (_, buf) => {
1349
1335
  if (this._socket.destroyed) {
1350
1336
  let err = new Error(
@@ -1379,7 +1365,7 @@ var require_sender = __commonJS({
1379
1365
  /**
1380
1366
  * Sends a frame.
1381
1367
  *
1382
- * @param {Buffer[]} list The frame to send
1368
+ * @param {(Buffer | String)[]} list The frame to send
1383
1369
  * @param {Function} [cb] Callback
1384
1370
  * @private
1385
1371
  */
@@ -1401,9 +1387,9 @@ var require_sender = __commonJS({
1401
1387
  }
1402
1388
  });
1403
1389
 
1404
- // ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/event-target.js
1390
+ // ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/event-target.js
1405
1391
  var require_event_target = __commonJS({
1406
- "../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/event-target.js"(exports, module) {
1392
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/event-target.js"(exports, module) {
1407
1393
  "use strict";
1408
1394
  init_cjs_shims();
1409
1395
  var { kForOnEventAttribute, kListener } = require_constants(), kCode = /* @__PURE__ */ Symbol("kCode"), kData = /* @__PURE__ */ Symbol("kData"), kError = /* @__PURE__ */ Symbol("kError"), kMessage = /* @__PURE__ */ Symbol("kMessage"), kReason = /* @__PURE__ */ Symbol("kReason"), kTarget = /* @__PURE__ */ Symbol("kTarget"), kType = /* @__PURE__ */ Symbol("kType"), kWasClean = /* @__PURE__ */ Symbol("kWasClean"), Event = class {
@@ -1597,9 +1583,9 @@ var require_event_target = __commonJS({
1597
1583
  }
1598
1584
  });
1599
1585
 
1600
- // ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/extension.js
1586
+ // ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/extension.js
1601
1587
  var require_extension = __commonJS({
1602
- "../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/extension.js"(exports, module) {
1588
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/extension.js"(exports, module) {
1603
1589
  "use strict";
1604
1590
  init_cjs_shims();
1605
1591
  var { tokenChars } = require_validation();
@@ -1669,9 +1655,9 @@ var require_extension = __commonJS({
1669
1655
  return extensionName === void 0 ? push(offers, token, params) : (paramName === void 0 ? push(params, token, !0) : mustUnescape ? push(params, paramName, token.replace(/\\/g, "")) : push(params, paramName, token), push(offers, extensionName, params)), offers;
1670
1656
  }
1671
1657
  function format(extensions) {
1672
- return Object.keys(extensions).map((extension) => {
1673
- let configurations = extensions[extension];
1674
- return Array.isArray(configurations) || (configurations = [configurations]), configurations.map((params) => [extension].concat(
1658
+ return Object.keys(extensions).map((extension2) => {
1659
+ let configurations = extensions[extension2];
1660
+ return Array.isArray(configurations) || (configurations = [configurations]), configurations.map((params) => [extension2].concat(
1675
1661
  Object.keys(params).map((k) => {
1676
1662
  let values = params[k];
1677
1663
  return Array.isArray(values) || (values = [values]), values.map((v) => v === !0 ? k : `${k}=${v}`).join("; ");
@@ -1683,13 +1669,14 @@ var require_extension = __commonJS({
1683
1669
  }
1684
1670
  });
1685
1671
 
1686
- // ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/websocket.js
1672
+ // ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket.js
1687
1673
  var require_websocket = __commonJS({
1688
- "../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/websocket.js"(exports, module) {
1674
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket.js"(exports, module) {
1689
1675
  "use strict";
1690
1676
  init_cjs_shims();
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(), {
1677
+ 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"), PerMessageDeflate2 = require_permessage_deflate(), Receiver2 = require_receiver(), Sender2 = require_sender(), { isBlob } = require_validation(), {
1692
1678
  BINARY_TYPES,
1679
+ CLOSE_TIMEOUT,
1693
1680
  EMPTY_BUFFER,
1694
1681
  GUID,
1695
1682
  kForOnEventAttribute,
@@ -1699,7 +1686,7 @@ var require_websocket = __commonJS({
1699
1686
  NOOP
1700
1687
  } = require_constants(), {
1701
1688
  EventTarget: { addEventListener, removeEventListener }
1702
- } = require_event_target(), { format, parse } = require_extension(), { toBuffer } = require_buffer_util(), closeTimeout = 30 * 1e3, kAborted = /* @__PURE__ */ Symbol("kAborted"), protocolVersions = [8, 13], readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"], subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/, WebSocket2 = class _WebSocket extends EventEmitter {
1689
+ } = require_event_target(), { format, parse } = require_extension(), { toBuffer } = require_buffer_util(), kAborted = /* @__PURE__ */ Symbol("kAborted"), protocolVersions = [8, 13], readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"], subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/, WebSocket2 = class _WebSocket extends EventEmitter {
1703
1690
  /**
1704
1691
  * Create a new `WebSocket`.
1705
1692
  *
@@ -1708,7 +1695,7 @@ var require_websocket = __commonJS({
1708
1695
  * @param {Object} [options] Connection options
1709
1696
  */
1710
1697
  constructor(address, protocols, options) {
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);
1698
+ 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._closeTimeout = options.closeTimeout, this._isServer = !0);
1712
1699
  }
1713
1700
  /**
1714
1701
  * For historical reasons, the custom "nodebuffer" type is used by the default
@@ -1797,6 +1784,10 @@ var require_websocket = __commonJS({
1797
1784
  * multiple times in the same tick
1798
1785
  * @param {Function} [options.generateMask] The function used to generate the
1799
1786
  * masking key
1787
+ * @param {Number} [options.maxBufferedChunks=0] The maximum number of
1788
+ * buffered data chunks
1789
+ * @param {Number} [options.maxFragments=0] The maximum number of message
1790
+ * fragments
1800
1791
  * @param {Number} [options.maxPayload=0] The maximum allowed message size
1801
1792
  * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
1802
1793
  * not to skip UTF-8 validation for text and close messages
@@ -1808,6 +1799,8 @@ var require_websocket = __commonJS({
1808
1799
  binaryType: this.binaryType,
1809
1800
  extensions: this._extensions,
1810
1801
  isServer: this._isServer,
1802
+ maxBufferedChunks: options.maxBufferedChunks,
1803
+ maxFragments: options.maxFragments,
1811
1804
  maxPayload: options.maxPayload,
1812
1805
  skipUTF8Validation: options.skipUTF8Validation
1813
1806
  }), sender = new Sender2(socket, this._extensions, options.generateMask);
@@ -1823,7 +1816,7 @@ var require_websocket = __commonJS({
1823
1816
  this._readyState = _WebSocket.CLOSED, this.emit("close", this._closeCode, this._closeMessage);
1824
1817
  return;
1825
1818
  }
1826
- this._extensions[PerMessageDeflate.extensionName] && this._extensions[PerMessageDeflate.extensionName].cleanup(), this._receiver.removeAllListeners(), this._readyState = _WebSocket.CLOSED, this.emit("close", this._closeCode, this._closeMessage);
1819
+ this._extensions[PerMessageDeflate2.extensionName] && this._extensions[PerMessageDeflate2.extensionName].cleanup(), this._receiver.removeAllListeners(), this._readyState = _WebSocket.CLOSED, this.emit("close", this._closeCode, this._closeMessage);
1827
1820
  }
1828
1821
  /**
1829
1822
  * Start a closing handshake.
@@ -1939,7 +1932,7 @@ var require_websocket = __commonJS({
1939
1932
  fin: !0,
1940
1933
  ...options
1941
1934
  };
1942
- this._extensions[PerMessageDeflate.extensionName] || (opts.compress = !1), this._sender.send(data || EMPTY_BUFFER, opts, cb);
1935
+ this._extensions[PerMessageDeflate2.extensionName] || (opts.compress = !1), this._sender.send(data || EMPTY_BUFFER, opts, cb);
1943
1936
  }
1944
1937
  /**
1945
1938
  * Forcibly close the connection.
@@ -2026,7 +2019,10 @@ var require_websocket = __commonJS({
2026
2019
  let opts = {
2027
2020
  allowSynchronousEvents: !0,
2028
2021
  autoPong: !0,
2022
+ closeTimeout: CLOSE_TIMEOUT,
2029
2023
  protocolVersion: protocolVersions[1],
2024
+ maxBufferedChunks: 1048576,
2025
+ maxFragments: 131072,
2030
2026
  maxPayload: 104857600,
2031
2027
  skipUTF8Validation: !1,
2032
2028
  perMessageDeflate: !0,
@@ -2042,7 +2038,7 @@ var require_websocket = __commonJS({
2042
2038
  path: void 0,
2043
2039
  port: void 0
2044
2040
  };
2045
- if (websocket._autoPong = opts.autoPong, !protocolVersions.includes(opts.protocolVersion))
2041
+ if (websocket._autoPong = opts.autoPong, websocket._closeTimeout = opts.closeTimeout, !protocolVersions.includes(opts.protocolVersion))
2046
2042
  throw new RangeError(
2047
2043
  `Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})`
2048
2044
  );
@@ -2057,7 +2053,7 @@ var require_websocket = __commonJS({
2057
2053
  }
2058
2054
  parsedUrl.protocol === "http:" ? parsedUrl.protocol = "ws:" : parsedUrl.protocol === "https:" && (parsedUrl.protocol = "wss:"), websocket._url = parsedUrl.href;
2059
2055
  let isSecure = parsedUrl.protocol === "wss:", isIpcUrl = parsedUrl.protocol === "ws+unix:", 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) {
2056
+ 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) {
2061
2057
  let err = new SyntaxError(invalidUrlMessage);
2062
2058
  if (websocket._redirects === 0)
2063
2059
  throw err;
@@ -2071,12 +2067,12 @@ var require_websocket = __commonJS({
2071
2067
  "Sec-WebSocket-Key": key,
2072
2068
  Connection: "Upgrade",
2073
2069
  Upgrade: "websocket"
2074
- }, opts.path = parsedUrl.pathname + parsedUrl.search, opts.timeout = opts.handshakeTimeout, opts.perMessageDeflate && (perMessageDeflate = new PerMessageDeflate(
2075
- opts.perMessageDeflate !== !0 ? opts.perMessageDeflate : {},
2076
- !1,
2077
- opts.maxPayload
2078
- ), opts.headers["Sec-WebSocket-Extensions"] = format({
2079
- [PerMessageDeflate.extensionName]: perMessageDeflate.offer()
2070
+ }, opts.path = parsedUrl.pathname + parsedUrl.search, opts.timeout = opts.handshakeTimeout, opts.perMessageDeflate && (perMessageDeflate = new PerMessageDeflate2({
2071
+ ...opts.perMessageDeflate,
2072
+ isServer: !1,
2073
+ maxPayload: opts.maxPayload
2074
+ }), opts.headers["Sec-WebSocket-Extensions"] = format({
2075
+ [PerMessageDeflate2.extensionName]: perMessageDeflate.offer()
2080
2076
  })), protocols.length) {
2081
2077
  for (let protocol of protocols) {
2082
2078
  if (typeof protocol != "string" || !subprotocolRegex.test(protocol) || protocolSet.has(protocol))
@@ -2165,21 +2161,23 @@ var require_websocket = __commonJS({
2165
2161
  return;
2166
2162
  }
2167
2163
  let extensionNames = Object.keys(extensions);
2168
- if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate.extensionName) {
2164
+ if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate2.extensionName) {
2169
2165
  abortHandshake(websocket, socket, "Server indicated an extension that was not requested");
2170
2166
  return;
2171
2167
  }
2172
2168
  try {
2173
- perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]);
2169
+ perMessageDeflate.accept(extensions[PerMessageDeflate2.extensionName]);
2174
2170
  } catch {
2175
2171
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Extensions header");
2176
2172
  return;
2177
2173
  }
2178
- websocket._extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
2174
+ websocket._extensions[PerMessageDeflate2.extensionName] = perMessageDeflate;
2179
2175
  }
2180
2176
  websocket.setSocket(socket, head, {
2181
2177
  allowSynchronousEvents: opts.allowSynchronousEvents,
2182
2178
  generateMask: opts.generateMask,
2179
+ maxBufferedChunks: opts.maxBufferedChunks,
2180
+ maxFragments: opts.maxFragments,
2183
2181
  maxPayload: opts.maxPayload,
2184
2182
  skipUTF8Validation: opts.skipUTF8Validation
2185
2183
  });
@@ -2246,14 +2244,16 @@ var require_websocket = __commonJS({
2246
2244
  function setCloseTimer(websocket) {
2247
2245
  websocket._closeTimer = setTimeout(
2248
2246
  websocket._socket.destroy.bind(websocket._socket),
2249
- closeTimeout
2247
+ websocket._closeTimeout
2250
2248
  );
2251
2249
  }
2252
2250
  function socketOnClose() {
2253
2251
  let websocket = this[kWebSocket];
2254
- this.removeListener("close", socketOnClose), this.removeListener("data", socketOnData), this.removeListener("end", socketOnEnd), websocket._readyState = WebSocket2.CLOSING;
2255
- let chunk;
2256
- !this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && (chunk = websocket._socket.read()) !== null && websocket._receiver.write(chunk), websocket._receiver.end(), this[kWebSocket] = void 0, clearTimeout(websocket._closeTimer), websocket._receiver._writableState.finished || websocket._receiver._writableState.errorEmitted ? websocket.emitClose() : (websocket._receiver.on("error", receiverOnFinish), websocket._receiver.on("finish", receiverOnFinish));
2252
+ if (this.removeListener("close", socketOnClose), this.removeListener("data", socketOnData), this.removeListener("end", socketOnEnd), websocket._readyState = WebSocket2.CLOSING, !this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && this._readableState.length !== 0) {
2253
+ let chunk = this.read(this._readableState.length);
2254
+ websocket._receiver.write(chunk);
2255
+ }
2256
+ websocket._receiver.end(), this[kWebSocket] = void 0, clearTimeout(websocket._closeTimer), websocket._receiver._writableState.finished || websocket._receiver._writableState.errorEmitted ? websocket.emitClose() : (websocket._receiver.on("error", receiverOnFinish), websocket._receiver.on("finish", receiverOnFinish));
2257
2257
  }
2258
2258
  function socketOnData(chunk) {
2259
2259
  this[kWebSocket]._receiver.write(chunk) || this.pause();
@@ -2269,9 +2269,76 @@ var require_websocket = __commonJS({
2269
2269
  }
2270
2270
  });
2271
2271
 
2272
- // ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/subprotocol.js
2272
+ // ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/stream.js
2273
+ var require_stream = __commonJS({
2274
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/stream.js"(exports, module) {
2275
+ "use strict";
2276
+ init_cjs_shims();
2277
+ var WebSocket2 = require_websocket(), { Duplex } = __require("stream");
2278
+ function emitClose(stream) {
2279
+ stream.emit("close");
2280
+ }
2281
+ function duplexOnEnd() {
2282
+ !this.destroyed && this._writableState.finished && this.destroy();
2283
+ }
2284
+ function duplexOnError(err) {
2285
+ this.removeListener("error", duplexOnError), this.destroy(), this.listenerCount("error") === 0 && this.emit("error", err);
2286
+ }
2287
+ function createWebSocketStream2(ws, options) {
2288
+ let terminateOnDestroy = !0, duplex = new Duplex({
2289
+ ...options,
2290
+ autoDestroy: !1,
2291
+ emitClose: !1,
2292
+ objectMode: !1,
2293
+ writableObjectMode: !1
2294
+ });
2295
+ return ws.on("message", function(msg, isBinary) {
2296
+ let data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
2297
+ duplex.push(data) || ws.pause();
2298
+ }), ws.once("error", function(err) {
2299
+ duplex.destroyed || (terminateOnDestroy = !1, duplex.destroy(err));
2300
+ }), ws.once("close", function() {
2301
+ duplex.destroyed || duplex.push(null);
2302
+ }), duplex._destroy = function(err, callback) {
2303
+ if (ws.readyState === ws.CLOSED) {
2304
+ callback(err), process.nextTick(emitClose, duplex);
2305
+ return;
2306
+ }
2307
+ let called = !1;
2308
+ ws.once("error", function(err2) {
2309
+ called = !0, callback(err2);
2310
+ }), ws.once("close", function() {
2311
+ called || callback(err), process.nextTick(emitClose, duplex);
2312
+ }), terminateOnDestroy && ws.terminate();
2313
+ }, duplex._final = function(callback) {
2314
+ if (ws.readyState === ws.CONNECTING) {
2315
+ ws.once("open", function() {
2316
+ duplex._final(callback);
2317
+ });
2318
+ return;
2319
+ }
2320
+ ws._socket !== null && (ws._socket._writableState.finished ? (callback(), duplex._readableState.endEmitted && duplex.destroy()) : (ws._socket.once("finish", function() {
2321
+ callback();
2322
+ }), ws.close()));
2323
+ }, duplex._read = function() {
2324
+ ws.isPaused && ws.resume();
2325
+ }, duplex._write = function(chunk, encoding, callback) {
2326
+ if (ws.readyState === ws.CONNECTING) {
2327
+ ws.once("open", function() {
2328
+ duplex._write(chunk, encoding, callback);
2329
+ });
2330
+ return;
2331
+ }
2332
+ ws.send(chunk, callback);
2333
+ }, duplex.on("end", duplexOnEnd), duplex.on("error", duplexOnError), duplex;
2334
+ }
2335
+ module.exports = createWebSocketStream2;
2336
+ }
2337
+ });
2338
+
2339
+ // ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/subprotocol.js
2273
2340
  var require_subprotocol = __commonJS({
2274
- "../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/subprotocol.js"(exports, module) {
2341
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/subprotocol.js"(exports, module) {
2275
2342
  "use strict";
2276
2343
  init_cjs_shims();
2277
2344
  var { tokenChars } = require_validation();
@@ -2305,12 +2372,12 @@ var require_subprotocol = __commonJS({
2305
2372
  }
2306
2373
  });
2307
2374
 
2308
- // ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/websocket-server.js
2375
+ // ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket-server.js
2309
2376
  var require_websocket_server = __commonJS({
2310
- "../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/lib/websocket-server.js"(exports, module) {
2377
+ "../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket-server.js"(exports, module) {
2311
2378
  "use strict";
2312
2379
  init_cjs_shims();
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 {
2380
+ var EventEmitter = __require("events"), http = __require("http"), { Duplex } = __require("stream"), { createHash } = __require("crypto"), extension2 = require_extension(), PerMessageDeflate2 = require_permessage_deflate(), subprotocol2 = require_subprotocol(), WebSocket2 = require_websocket(), { CLOSE_TIMEOUT, GUID, kWebSocket } = require_constants(), keyRegex = /^[+/0-9A-Za-z]{22}==$/, RUNNING = 0, CLOSING = 1, CLOSED = 2, WebSocketServer2 = class extends EventEmitter {
2314
2381
  /**
2315
2382
  * Create a `WebSocketServer` instance.
2316
2383
  *
@@ -2324,8 +2391,15 @@ var require_websocket_server = __commonJS({
2324
2391
  * pending connections
2325
2392
  * @param {Boolean} [options.clientTracking=true] Specifies whether or not to
2326
2393
  * track clients
2394
+ * @param {Number} [options.closeTimeout=30000] Duration in milliseconds to
2395
+ * wait for the closing handshake to finish after `websocket.close()` is
2396
+ * called
2327
2397
  * @param {Function} [options.handleProtocols] A hook to handle protocols
2328
2398
  * @param {String} [options.host] The hostname where to bind the server
2399
+ * @param {Number} [options.maxBufferedChunks=1048576] The maximum number of
2400
+ * buffered data chunks
2401
+ * @param {Number} [options.maxFragments=131072] The maximum number of message
2402
+ * fragments
2329
2403
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
2330
2404
  * size
2331
2405
  * @param {Boolean} [options.noServer=false] Enable no server mode
@@ -2346,11 +2420,14 @@ var require_websocket_server = __commonJS({
2346
2420
  if (super(), options = {
2347
2421
  allowSynchronousEvents: !0,
2348
2422
  autoPong: !0,
2423
+ maxBufferedChunks: 1024 * 1024,
2424
+ maxFragments: 128 * 1024,
2349
2425
  maxPayload: 100 * 1024 * 1024,
2350
2426
  skipUTF8Validation: !1,
2351
2427
  perMessageDeflate: !1,
2352
2428
  handleProtocols: null,
2353
2429
  clientTracking: !0,
2430
+ closeTimeout: CLOSE_TIMEOUT,
2354
2431
  verifyClient: null,
2355
2432
  noServer: !1,
2356
2433
  backlog: null,
@@ -2464,8 +2541,10 @@ var require_websocket_server = __commonJS({
2464
2541
  abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Missing or invalid Sec-WebSocket-Key header");
2465
2542
  return;
2466
2543
  }
2467
- if (version !== 8 && version !== 13) {
2468
- abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Missing or invalid Sec-WebSocket-Version header");
2544
+ if (version !== 13 && version !== 8) {
2545
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Missing or invalid Sec-WebSocket-Version header", {
2546
+ "Sec-WebSocket-Version": "13, 8"
2547
+ });
2469
2548
  return;
2470
2549
  }
2471
2550
  if (!this.shouldHandle(req)) {
@@ -2475,21 +2554,21 @@ var require_websocket_server = __commonJS({
2475
2554
  let secWebSocketProtocol = req.headers["sec-websocket-protocol"], protocols = /* @__PURE__ */ new Set();
2476
2555
  if (secWebSocketProtocol !== void 0)
2477
2556
  try {
2478
- protocols = subprotocol.parse(secWebSocketProtocol);
2557
+ protocols = subprotocol2.parse(secWebSocketProtocol);
2479
2558
  } catch {
2480
2559
  abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Invalid Sec-WebSocket-Protocol header");
2481
2560
  return;
2482
2561
  }
2483
2562
  let secWebSocketExtensions = req.headers["sec-websocket-extensions"], extensions = {};
2484
2563
  if (this.options.perMessageDeflate && secWebSocketExtensions !== void 0) {
2485
- let perMessageDeflate = new PerMessageDeflate(
2486
- this.options.perMessageDeflate,
2487
- !0,
2488
- this.options.maxPayload
2489
- );
2564
+ let perMessageDeflate = new PerMessageDeflate2({
2565
+ ...this.options.perMessageDeflate,
2566
+ isServer: !0,
2567
+ maxPayload: this.options.maxPayload
2568
+ });
2490
2569
  try {
2491
- let offers = extension.parse(secWebSocketExtensions);
2492
- offers[PerMessageDeflate.extensionName] && (perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]), extensions[PerMessageDeflate.extensionName] = perMessageDeflate);
2570
+ let offers = extension2.parse(secWebSocketExtensions);
2571
+ offers[PerMessageDeflate2.extensionName] && (perMessageDeflate.accept(offers[PerMessageDeflate2.extensionName]), extensions[PerMessageDeflate2.extensionName] = perMessageDeflate);
2493
2572
  } catch {
2494
2573
  abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Invalid or unacceptable Sec-WebSocket-Extensions header");
2495
2574
  return;
@@ -2551,9 +2630,9 @@ var require_websocket_server = __commonJS({
2551
2630
  let protocol = this.options.handleProtocols ? this.options.handleProtocols(protocols, req) : protocols.values().next().value;
2552
2631
  protocol && (headers.push(`Sec-WebSocket-Protocol: ${protocol}`), ws._protocol = protocol);
2553
2632
  }
2554
- if (extensions[PerMessageDeflate.extensionName]) {
2555
- let params = extensions[PerMessageDeflate.extensionName].params, value = extension.format({
2556
- [PerMessageDeflate.extensionName]: [params]
2633
+ if (extensions[PerMessageDeflate2.extensionName]) {
2634
+ let params = extensions[PerMessageDeflate2.extensionName].params, value = extension2.format({
2635
+ [PerMessageDeflate2.extensionName]: [params]
2557
2636
  });
2558
2637
  headers.push(`Sec-WebSocket-Extensions: ${value}`), ws._extensions = extensions;
2559
2638
  }
@@ -2561,6 +2640,8 @@ var require_websocket_server = __commonJS({
2561
2640
  `).join(`\r
2562
2641
  `)), socket.removeListener("error", socketOnError), ws.setSocket(socket, head, {
2563
2642
  allowSynchronousEvents: this.options.allowSynchronousEvents,
2643
+ maxBufferedChunks: this.options.maxBufferedChunks,
2644
+ maxFragments: this.options.maxFragments,
2564
2645
  maxPayload: this.options.maxPayload,
2565
2646
  skipUTF8Validation: this.options.skipUTF8Validation
2566
2647
  }), this.clients && (this.clients.add(ws), ws.on("close", () => {
@@ -2596,23 +2677,23 @@ var require_websocket_server = __commonJS({
2596
2677
  ` + message
2597
2678
  );
2598
2679
  }
2599
- function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
2680
+ function abortHandshakeOrEmitwsClientError(server, req, socket, code, message, headers) {
2600
2681
  if (server.listenerCount("wsClientError")) {
2601
2682
  let err = new Error(message);
2602
2683
  Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError), server.emit("wsClientError", err, socket, req);
2603
2684
  } else
2604
- abortHandshake(socket, code, message);
2685
+ abortHandshake(socket, code, message, headers);
2605
2686
  }
2606
2687
  }
2607
2688
  });
2608
2689
 
2609
- // ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/wrapper.mjs
2690
+ // ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/wrapper.mjs
2610
2691
  init_cjs_shims();
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);
2692
+ var import_stream = __toESM(require_stream(), 1), import_extension = __toESM(require_extension(), 1), import_permessage_deflate = __toESM(require_permessage_deflate(), 1), import_receiver = __toESM(require_receiver(), 1), import_sender = __toESM(require_sender(), 1), import_subprotocol = __toESM(require_subprotocol(), 1), import_websocket = __toESM(require_websocket(), 1), import_websocket_server = __toESM(require_websocket_server(), 1);
2612
2693
  var wrapper_default = import_websocket.default;
2613
2694
 
2614
2695
  export {
2615
2696
  import_websocket_server,
2616
2697
  wrapper_default
2617
2698
  };
2618
- //# sourceMappingURL=chunk-CE4S2SGM.js.map
2699
+ //# sourceMappingURL=chunk-LDYT4FTV.js.map