@zoralabs/protocol-deployments 0.2.0 → 0.2.1
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/.turbo/turbo-build.log +43 -34
- package/CHANGELOG.md +6 -0
- package/LICENSE +21 -0
- package/dist/{_esm-ZN7ZVJVO.js → _esm-PPK7XFKN.js} +278 -382
- package/dist/_esm-PPK7XFKN.js.map +1 -0
- package/dist/{ccip-IGMHQQR7.js → ccip-6BNOCQCH.js} +3 -3
- package/dist/{chunk-2FDPSBOH.js → chunk-5JV63AHR.js} +58 -47
- package/dist/chunk-5JV63AHR.js.map +1 -0
- package/dist/{chunk-KIPP2F4J.js → chunk-6M375I5V.js} +956 -216
- package/dist/chunk-6M375I5V.js.map +1 -0
- package/dist/generated/wagmi.d.ts +24 -24
- package/dist/index.cjs +104 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/{secp256k1-R7PEGLZR.js → secp256k1-5CEPNAX3.js} +109 -87
- package/dist/secp256k1-5CEPNAX3.js.map +1 -0
- package/dist/typedData.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/generated/wagmi.ts +24 -24
- package/src/index.ts +1 -1
- package/tsconfig.build.json +1 -1
- package/tsconfig.json +1 -1
- package/dist/_esm-ZN7ZVJVO.js.map +0 -1
- package/dist/chunk-2FDPSBOH.js.map +0 -1
- package/dist/chunk-KIPP2F4J.js.map +0 -1
- package/dist/secp256k1-R7PEGLZR.js.map +0 -1
- /package/dist/{ccip-IGMHQQR7.js.map → ccip-6BNOCQCH.js.map} +0 -0
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
__toESM
|
|
6
6
|
} from "./chunk-3EJPJMEH.js";
|
|
7
7
|
|
|
8
|
-
// ../../node_modules/ws/lib/stream.js
|
|
8
|
+
// ../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/stream.js
|
|
9
9
|
var require_stream = __commonJS({
|
|
10
|
-
"../../node_modules/ws/lib/stream.js"(exports, module) {
|
|
10
|
+
"../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/stream.js"(exports, module) {
|
|
11
11
|
"use strict";
|
|
12
12
|
var { Duplex } = __require("stream");
|
|
13
13
|
function emitClose(stream) {
|
|
@@ -110,9 +110,9 @@ var require_stream = __commonJS({
|
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
|
|
113
|
-
// ../../node_modules/ws/lib/constants.js
|
|
113
|
+
// ../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/constants.js
|
|
114
114
|
var require_constants = __commonJS({
|
|
115
|
-
"../../node_modules/ws/lib/constants.js"(exports, module) {
|
|
115
|
+
"../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/constants.js"(exports, module) {
|
|
116
116
|
"use strict";
|
|
117
117
|
module.exports = {
|
|
118
118
|
BINARY_TYPES: ["nodebuffer", "arraybuffer", "fragments"],
|
|
@@ -128,9 +128,9 @@ var require_constants = __commonJS({
|
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
130
|
|
|
131
|
-
// ../../node_modules/
|
|
131
|
+
// ../../node_modules/.pnpm/node-gyp-build@4.8.1/node_modules/node-gyp-build/node-gyp-build.js
|
|
132
132
|
var require_node_gyp_build = __commonJS({
|
|
133
|
-
"../../node_modules/
|
|
133
|
+
"../../node_modules/.pnpm/node-gyp-build@4.8.1/node_modules/node-gyp-build/node-gyp-build.js"(exports, module) {
|
|
134
134
|
"use strict";
|
|
135
135
|
var fs = __require("fs");
|
|
136
136
|
var path = __require("path");
|
|
@@ -320,9 +320,9 @@ var require_node_gyp_build = __commonJS({
|
|
|
320
320
|
}
|
|
321
321
|
});
|
|
322
322
|
|
|
323
|
-
// ../../node_modules/
|
|
323
|
+
// ../../node_modules/.pnpm/node-gyp-build@4.8.1/node_modules/node-gyp-build/index.js
|
|
324
324
|
var require_node_gyp_build2 = __commonJS({
|
|
325
|
-
"../../node_modules/
|
|
325
|
+
"../../node_modules/.pnpm/node-gyp-build@4.8.1/node_modules/node-gyp-build/index.js"(exports, module) {
|
|
326
326
|
"use strict";
|
|
327
327
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
328
328
|
if (typeof runtimeRequire.addon === "function") {
|
|
@@ -333,9 +333,9 @@ var require_node_gyp_build2 = __commonJS({
|
|
|
333
333
|
}
|
|
334
334
|
});
|
|
335
335
|
|
|
336
|
-
// ../../node_modules/bufferutil/fallback.js
|
|
336
|
+
// ../../node_modules/.pnpm/bufferutil@4.0.8/node_modules/bufferutil/fallback.js
|
|
337
337
|
var require_fallback = __commonJS({
|
|
338
|
-
"../../node_modules/bufferutil/fallback.js"(exports, module) {
|
|
338
|
+
"../../node_modules/.pnpm/bufferutil@4.0.8/node_modules/bufferutil/fallback.js"(exports, module) {
|
|
339
339
|
"use strict";
|
|
340
340
|
var mask = (source, mask2, output, offset, length) => {
|
|
341
341
|
for (var i = 0; i < length; i++) {
|
|
@@ -352,9 +352,9 @@ var require_fallback = __commonJS({
|
|
|
352
352
|
}
|
|
353
353
|
});
|
|
354
354
|
|
|
355
|
-
// ../../node_modules/bufferutil/index.js
|
|
355
|
+
// ../../node_modules/.pnpm/bufferutil@4.0.8/node_modules/bufferutil/index.js
|
|
356
356
|
var require_bufferutil = __commonJS({
|
|
357
|
-
"../../node_modules/bufferutil/index.js"(exports, module) {
|
|
357
|
+
"../../node_modules/.pnpm/bufferutil@4.0.8/node_modules/bufferutil/index.js"(exports, module) {
|
|
358
358
|
"use strict";
|
|
359
359
|
try {
|
|
360
360
|
module.exports = require_node_gyp_build2()(__dirname);
|
|
@@ -364,9 +364,9 @@ var require_bufferutil = __commonJS({
|
|
|
364
364
|
}
|
|
365
365
|
});
|
|
366
366
|
|
|
367
|
-
// ../../node_modules/ws/lib/buffer-util.js
|
|
367
|
+
// ../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/buffer-util.js
|
|
368
368
|
var require_buffer_util = __commonJS({
|
|
369
|
-
"../../node_modules/ws/lib/buffer-util.js"(exports, module) {
|
|
369
|
+
"../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/buffer-util.js"(exports, module) {
|
|
370
370
|
"use strict";
|
|
371
371
|
var { EMPTY_BUFFER } = require_constants();
|
|
372
372
|
var FastBuffer = Buffer[Symbol.species];
|
|
@@ -446,9 +446,9 @@ var require_buffer_util = __commonJS({
|
|
|
446
446
|
}
|
|
447
447
|
});
|
|
448
448
|
|
|
449
|
-
// ../../node_modules/ws/lib/limiter.js
|
|
449
|
+
// ../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/limiter.js
|
|
450
450
|
var require_limiter = __commonJS({
|
|
451
|
-
"../../node_modules/ws/lib/limiter.js"(exports, module) {
|
|
451
|
+
"../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/limiter.js"(exports, module) {
|
|
452
452
|
"use strict";
|
|
453
453
|
var kDone = Symbol("kDone");
|
|
454
454
|
var kRun = Symbol("kRun");
|
|
@@ -497,9 +497,9 @@ var require_limiter = __commonJS({
|
|
|
497
497
|
}
|
|
498
498
|
});
|
|
499
499
|
|
|
500
|
-
// ../../node_modules/ws/lib/permessage-deflate.js
|
|
500
|
+
// ../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/permessage-deflate.js
|
|
501
501
|
var require_permessage_deflate = __commonJS({
|
|
502
|
-
"../../node_modules/ws/lib/permessage-deflate.js"(exports, module) {
|
|
502
|
+
"../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/permessage-deflate.js"(exports, module) {
|
|
503
503
|
"use strict";
|
|
504
504
|
var zlib = __require("zlib");
|
|
505
505
|
var bufferUtil = require_buffer_util();
|
|
@@ -877,214 +877,9 @@ var require_permessage_deflate = __commonJS({
|
|
|
877
877
|
}
|
|
878
878
|
});
|
|
879
879
|
|
|
880
|
-
// ../../node_modules/utf-8-validate/node_modules/
|
|
881
|
-
var require_node_gyp_build3 = __commonJS({
|
|
882
|
-
"../../node_modules/utf-8-validate/node_modules/node-gyp-build/node-gyp-build.js"(exports, module) {
|
|
883
|
-
"use strict";
|
|
884
|
-
var fs = __require("fs");
|
|
885
|
-
var path = __require("path");
|
|
886
|
-
var os = __require("os");
|
|
887
|
-
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
888
|
-
var vars = process.config && process.config.variables || {};
|
|
889
|
-
var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
|
|
890
|
-
var abi = process.versions.modules;
|
|
891
|
-
var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
|
|
892
|
-
var arch = process.env.npm_config_arch || os.arch();
|
|
893
|
-
var platform = process.env.npm_config_platform || os.platform();
|
|
894
|
-
var libc = process.env.LIBC || (isAlpine(platform) ? "musl" : "glibc");
|
|
895
|
-
var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || "";
|
|
896
|
-
var uv = (process.versions.uv || "").split(".")[0];
|
|
897
|
-
module.exports = load;
|
|
898
|
-
function load(dir) {
|
|
899
|
-
return runtimeRequire(load.resolve(dir));
|
|
900
|
-
}
|
|
901
|
-
load.resolve = load.path = function(dir) {
|
|
902
|
-
dir = path.resolve(dir || ".");
|
|
903
|
-
try {
|
|
904
|
-
var name = runtimeRequire(path.join(dir, "package.json")).name.toUpperCase().replace(/-/g, "_");
|
|
905
|
-
if (process.env[name + "_PREBUILD"])
|
|
906
|
-
dir = process.env[name + "_PREBUILD"];
|
|
907
|
-
} catch (err) {
|
|
908
|
-
}
|
|
909
|
-
if (!prebuildsOnly) {
|
|
910
|
-
var release = getFirst(path.join(dir, "build/Release"), matchBuild);
|
|
911
|
-
if (release)
|
|
912
|
-
return release;
|
|
913
|
-
var debug = getFirst(path.join(dir, "build/Debug"), matchBuild);
|
|
914
|
-
if (debug)
|
|
915
|
-
return debug;
|
|
916
|
-
}
|
|
917
|
-
var prebuild = resolve(dir);
|
|
918
|
-
if (prebuild)
|
|
919
|
-
return prebuild;
|
|
920
|
-
var nearby = resolve(path.dirname(process.execPath));
|
|
921
|
-
if (nearby)
|
|
922
|
-
return nearby;
|
|
923
|
-
var target = [
|
|
924
|
-
"platform=" + platform,
|
|
925
|
-
"arch=" + arch,
|
|
926
|
-
"runtime=" + runtime,
|
|
927
|
-
"abi=" + abi,
|
|
928
|
-
"uv=" + uv,
|
|
929
|
-
armv ? "armv=" + armv : "",
|
|
930
|
-
"libc=" + libc,
|
|
931
|
-
"node=" + process.versions.node,
|
|
932
|
-
process.versions.electron ? "electron=" + process.versions.electron : "",
|
|
933
|
-
typeof __webpack_require__ === "function" ? "webpack=true" : ""
|
|
934
|
-
// eslint-disable-line
|
|
935
|
-
].filter(Boolean).join(" ");
|
|
936
|
-
throw new Error("No native build was found for " + target + "\n loaded from: " + dir + "\n");
|
|
937
|
-
function resolve(dir2) {
|
|
938
|
-
var tuples = readdirSync(path.join(dir2, "prebuilds")).map(parseTuple);
|
|
939
|
-
var tuple = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
|
|
940
|
-
if (!tuple)
|
|
941
|
-
return;
|
|
942
|
-
var prebuilds = path.join(dir2, "prebuilds", tuple.name);
|
|
943
|
-
var parsed = readdirSync(prebuilds).map(parseTags);
|
|
944
|
-
var candidates = parsed.filter(matchTags(runtime, abi));
|
|
945
|
-
var winner = candidates.sort(compareTags(runtime))[0];
|
|
946
|
-
if (winner)
|
|
947
|
-
return path.join(prebuilds, winner.file);
|
|
948
|
-
}
|
|
949
|
-
};
|
|
950
|
-
function readdirSync(dir) {
|
|
951
|
-
try {
|
|
952
|
-
return fs.readdirSync(dir);
|
|
953
|
-
} catch (err) {
|
|
954
|
-
return [];
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
function getFirst(dir, filter) {
|
|
958
|
-
var files = readdirSync(dir).filter(filter);
|
|
959
|
-
return files[0] && path.join(dir, files[0]);
|
|
960
|
-
}
|
|
961
|
-
function matchBuild(name) {
|
|
962
|
-
return /\.node$/.test(name);
|
|
963
|
-
}
|
|
964
|
-
function parseTuple(name) {
|
|
965
|
-
var arr = name.split("-");
|
|
966
|
-
if (arr.length !== 2)
|
|
967
|
-
return;
|
|
968
|
-
var platform2 = arr[0];
|
|
969
|
-
var architectures = arr[1].split("+");
|
|
970
|
-
if (!platform2)
|
|
971
|
-
return;
|
|
972
|
-
if (!architectures.length)
|
|
973
|
-
return;
|
|
974
|
-
if (!architectures.every(Boolean))
|
|
975
|
-
return;
|
|
976
|
-
return { name, platform: platform2, architectures };
|
|
977
|
-
}
|
|
978
|
-
function matchTuple(platform2, arch2) {
|
|
979
|
-
return function(tuple) {
|
|
980
|
-
if (tuple == null)
|
|
981
|
-
return false;
|
|
982
|
-
if (tuple.platform !== platform2)
|
|
983
|
-
return false;
|
|
984
|
-
return tuple.architectures.includes(arch2);
|
|
985
|
-
};
|
|
986
|
-
}
|
|
987
|
-
function compareTuples(a, b) {
|
|
988
|
-
return a.architectures.length - b.architectures.length;
|
|
989
|
-
}
|
|
990
|
-
function parseTags(file) {
|
|
991
|
-
var arr = file.split(".");
|
|
992
|
-
var extension = arr.pop();
|
|
993
|
-
var tags = { file, specificity: 0 };
|
|
994
|
-
if (extension !== "node")
|
|
995
|
-
return;
|
|
996
|
-
for (var i = 0; i < arr.length; i++) {
|
|
997
|
-
var tag = arr[i];
|
|
998
|
-
if (tag === "node" || tag === "electron" || tag === "node-webkit") {
|
|
999
|
-
tags.runtime = tag;
|
|
1000
|
-
} else if (tag === "napi") {
|
|
1001
|
-
tags.napi = true;
|
|
1002
|
-
} else if (tag.slice(0, 3) === "abi") {
|
|
1003
|
-
tags.abi = tag.slice(3);
|
|
1004
|
-
} else if (tag.slice(0, 2) === "uv") {
|
|
1005
|
-
tags.uv = tag.slice(2);
|
|
1006
|
-
} else if (tag.slice(0, 4) === "armv") {
|
|
1007
|
-
tags.armv = tag.slice(4);
|
|
1008
|
-
} else if (tag === "glibc" || tag === "musl") {
|
|
1009
|
-
tags.libc = tag;
|
|
1010
|
-
} else {
|
|
1011
|
-
continue;
|
|
1012
|
-
}
|
|
1013
|
-
tags.specificity++;
|
|
1014
|
-
}
|
|
1015
|
-
return tags;
|
|
1016
|
-
}
|
|
1017
|
-
function matchTags(runtime2, abi2) {
|
|
1018
|
-
return function(tags) {
|
|
1019
|
-
if (tags == null)
|
|
1020
|
-
return false;
|
|
1021
|
-
if (tags.runtime && tags.runtime !== runtime2 && !runtimeAgnostic(tags))
|
|
1022
|
-
return false;
|
|
1023
|
-
if (tags.abi && tags.abi !== abi2 && !tags.napi)
|
|
1024
|
-
return false;
|
|
1025
|
-
if (tags.uv && tags.uv !== uv)
|
|
1026
|
-
return false;
|
|
1027
|
-
if (tags.armv && tags.armv !== armv)
|
|
1028
|
-
return false;
|
|
1029
|
-
if (tags.libc && tags.libc !== libc)
|
|
1030
|
-
return false;
|
|
1031
|
-
return true;
|
|
1032
|
-
};
|
|
1033
|
-
}
|
|
1034
|
-
function runtimeAgnostic(tags) {
|
|
1035
|
-
return tags.runtime === "node" && tags.napi;
|
|
1036
|
-
}
|
|
1037
|
-
function compareTags(runtime2) {
|
|
1038
|
-
return function(a, b) {
|
|
1039
|
-
if (a.runtime !== b.runtime) {
|
|
1040
|
-
return a.runtime === runtime2 ? -1 : 1;
|
|
1041
|
-
} else if (a.abi !== b.abi) {
|
|
1042
|
-
return a.abi ? -1 : 1;
|
|
1043
|
-
} else if (a.specificity !== b.specificity) {
|
|
1044
|
-
return a.specificity > b.specificity ? -1 : 1;
|
|
1045
|
-
} else {
|
|
1046
|
-
return 0;
|
|
1047
|
-
}
|
|
1048
|
-
};
|
|
1049
|
-
}
|
|
1050
|
-
function isNwjs() {
|
|
1051
|
-
return !!(process.versions && process.versions.nw);
|
|
1052
|
-
}
|
|
1053
|
-
function isElectron() {
|
|
1054
|
-
if (process.versions && process.versions.electron)
|
|
1055
|
-
return true;
|
|
1056
|
-
if (process.env.ELECTRON_RUN_AS_NODE)
|
|
1057
|
-
return true;
|
|
1058
|
-
return typeof window !== "undefined" && window.process && window.process.type === "renderer";
|
|
1059
|
-
}
|
|
1060
|
-
function isAlpine(platform2) {
|
|
1061
|
-
return platform2 === "linux" && fs.existsSync("/etc/alpine-release");
|
|
1062
|
-
}
|
|
1063
|
-
load.parseTags = parseTags;
|
|
1064
|
-
load.matchTags = matchTags;
|
|
1065
|
-
load.compareTags = compareTags;
|
|
1066
|
-
load.parseTuple = parseTuple;
|
|
1067
|
-
load.matchTuple = matchTuple;
|
|
1068
|
-
load.compareTuples = compareTuples;
|
|
1069
|
-
}
|
|
1070
|
-
});
|
|
1071
|
-
|
|
1072
|
-
// ../../node_modules/utf-8-validate/node_modules/node-gyp-build/index.js
|
|
1073
|
-
var require_node_gyp_build4 = __commonJS({
|
|
1074
|
-
"../../node_modules/utf-8-validate/node_modules/node-gyp-build/index.js"(exports, module) {
|
|
1075
|
-
"use strict";
|
|
1076
|
-
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
1077
|
-
if (typeof runtimeRequire.addon === "function") {
|
|
1078
|
-
module.exports = runtimeRequire.addon.bind(runtimeRequire);
|
|
1079
|
-
} else {
|
|
1080
|
-
module.exports = require_node_gyp_build3();
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
});
|
|
1084
|
-
|
|
1085
|
-
// ../../node_modules/utf-8-validate/fallback.js
|
|
880
|
+
// ../../node_modules/.pnpm/utf-8-validate@5.0.10/node_modules/utf-8-validate/fallback.js
|
|
1086
881
|
var require_fallback2 = __commonJS({
|
|
1087
|
-
"../../node_modules/utf-8-validate/fallback.js"(exports, module) {
|
|
882
|
+
"../../node_modules/.pnpm/utf-8-validate@5.0.10/node_modules/utf-8-validate/fallback.js"(exports, module) {
|
|
1088
883
|
"use strict";
|
|
1089
884
|
function isValidUTF8(buf) {
|
|
1090
885
|
const len = buf.length;
|
|
@@ -1119,21 +914,21 @@ var require_fallback2 = __commonJS({
|
|
|
1119
914
|
}
|
|
1120
915
|
});
|
|
1121
916
|
|
|
1122
|
-
// ../../node_modules/utf-8-validate/index.js
|
|
917
|
+
// ../../node_modules/.pnpm/utf-8-validate@5.0.10/node_modules/utf-8-validate/index.js
|
|
1123
918
|
var require_utf_8_validate = __commonJS({
|
|
1124
|
-
"../../node_modules/utf-8-validate/index.js"(exports, module) {
|
|
919
|
+
"../../node_modules/.pnpm/utf-8-validate@5.0.10/node_modules/utf-8-validate/index.js"(exports, module) {
|
|
1125
920
|
"use strict";
|
|
1126
921
|
try {
|
|
1127
|
-
module.exports =
|
|
922
|
+
module.exports = require_node_gyp_build2()(__dirname);
|
|
1128
923
|
} catch (e) {
|
|
1129
924
|
module.exports = require_fallback2();
|
|
1130
925
|
}
|
|
1131
926
|
}
|
|
1132
927
|
});
|
|
1133
928
|
|
|
1134
|
-
// ../../node_modules/ws/lib/validation.js
|
|
929
|
+
// ../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/validation.js
|
|
1135
930
|
var require_validation = __commonJS({
|
|
1136
|
-
"../../node_modules/ws/lib/validation.js"(exports, module) {
|
|
931
|
+
"../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/validation.js"(exports, module) {
|
|
1137
932
|
"use strict";
|
|
1138
933
|
var { isUtf8 } = __require("buffer");
|
|
1139
934
|
var tokenChars = [
|
|
@@ -1327,9 +1122,9 @@ var require_validation = __commonJS({
|
|
|
1327
1122
|
}
|
|
1328
1123
|
});
|
|
1329
1124
|
|
|
1330
|
-
// ../../node_modules/ws/lib/receiver.js
|
|
1125
|
+
// ../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/receiver.js
|
|
1331
1126
|
var require_receiver = __commonJS({
|
|
1332
|
-
"../../node_modules/ws/lib/receiver.js"(exports, module) {
|
|
1127
|
+
"../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/receiver.js"(exports, module) {
|
|
1333
1128
|
"use strict";
|
|
1334
1129
|
var { Writable } = __require("stream");
|
|
1335
1130
|
var PerMessageDeflate = require_permessage_deflate();
|
|
@@ -1348,11 +1143,15 @@ var require_receiver = __commonJS({
|
|
|
1348
1143
|
var GET_MASK = 3;
|
|
1349
1144
|
var GET_DATA = 4;
|
|
1350
1145
|
var INFLATING = 5;
|
|
1146
|
+
var DEFER_EVENT = 6;
|
|
1351
1147
|
var Receiver2 = class extends Writable {
|
|
1352
1148
|
/**
|
|
1353
1149
|
* Creates a Receiver instance.
|
|
1354
1150
|
*
|
|
1355
1151
|
* @param {Object} [options] Options object
|
|
1152
|
+
* @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether
|
|
1153
|
+
* any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
|
|
1154
|
+
* multiple times in the same tick
|
|
1356
1155
|
* @param {String} [options.binaryType=nodebuffer] The type for binary data
|
|
1357
1156
|
* @param {Object} [options.extensions] An object containing the negotiated
|
|
1358
1157
|
* extensions
|
|
@@ -1364,6 +1163,7 @@ var require_receiver = __commonJS({
|
|
|
1364
1163
|
*/
|
|
1365
1164
|
constructor(options = {}) {
|
|
1366
1165
|
super();
|
|
1166
|
+
this._allowSynchronousEvents = options.allowSynchronousEvents !== void 0 ? options.allowSynchronousEvents : true;
|
|
1367
1167
|
this._binaryType = options.binaryType || BINARY_TYPES[0];
|
|
1368
1168
|
this._extensions = options.extensions || {};
|
|
1369
1169
|
this._isServer = !!options.isServer;
|
|
@@ -1382,8 +1182,9 @@ var require_receiver = __commonJS({
|
|
|
1382
1182
|
this._totalPayloadLength = 0;
|
|
1383
1183
|
this._messageLength = 0;
|
|
1384
1184
|
this._fragments = [];
|
|
1385
|
-
this.
|
|
1185
|
+
this._errored = false;
|
|
1386
1186
|
this._loop = false;
|
|
1187
|
+
this._state = GET_INFO;
|
|
1387
1188
|
}
|
|
1388
1189
|
/**
|
|
1389
1190
|
* Implements `Writable.prototype._write()`.
|
|
@@ -1445,195 +1246,207 @@ var require_receiver = __commonJS({
|
|
|
1445
1246
|
* @private
|
|
1446
1247
|
*/
|
|
1447
1248
|
startLoop(cb) {
|
|
1448
|
-
let err;
|
|
1449
1249
|
this._loop = true;
|
|
1450
1250
|
do {
|
|
1451
1251
|
switch (this._state) {
|
|
1452
1252
|
case GET_INFO:
|
|
1453
|
-
|
|
1253
|
+
this.getInfo(cb);
|
|
1454
1254
|
break;
|
|
1455
1255
|
case GET_PAYLOAD_LENGTH_16:
|
|
1456
|
-
|
|
1256
|
+
this.getPayloadLength16(cb);
|
|
1457
1257
|
break;
|
|
1458
1258
|
case GET_PAYLOAD_LENGTH_64:
|
|
1459
|
-
|
|
1259
|
+
this.getPayloadLength64(cb);
|
|
1460
1260
|
break;
|
|
1461
1261
|
case GET_MASK:
|
|
1462
1262
|
this.getMask();
|
|
1463
1263
|
break;
|
|
1464
1264
|
case GET_DATA:
|
|
1465
|
-
|
|
1265
|
+
this.getData(cb);
|
|
1466
1266
|
break;
|
|
1467
|
-
|
|
1267
|
+
case INFLATING:
|
|
1268
|
+
case DEFER_EVENT:
|
|
1468
1269
|
this._loop = false;
|
|
1469
1270
|
return;
|
|
1470
1271
|
}
|
|
1471
1272
|
} while (this._loop);
|
|
1472
|
-
|
|
1273
|
+
if (!this._errored)
|
|
1274
|
+
cb();
|
|
1473
1275
|
}
|
|
1474
1276
|
/**
|
|
1475
1277
|
* Reads the first two bytes of a frame.
|
|
1476
1278
|
*
|
|
1477
|
-
* @
|
|
1279
|
+
* @param {Function} cb Callback
|
|
1478
1280
|
* @private
|
|
1479
1281
|
*/
|
|
1480
|
-
getInfo() {
|
|
1282
|
+
getInfo(cb) {
|
|
1481
1283
|
if (this._bufferedBytes < 2) {
|
|
1482
1284
|
this._loop = false;
|
|
1483
1285
|
return;
|
|
1484
1286
|
}
|
|
1485
1287
|
const buf = this.consume(2);
|
|
1486
1288
|
if ((buf[0] & 48) !== 0) {
|
|
1487
|
-
|
|
1488
|
-
return error(
|
|
1289
|
+
const error = this.createError(
|
|
1489
1290
|
RangeError,
|
|
1490
1291
|
"RSV2 and RSV3 must be clear",
|
|
1491
1292
|
true,
|
|
1492
1293
|
1002,
|
|
1493
1294
|
"WS_ERR_UNEXPECTED_RSV_2_3"
|
|
1494
1295
|
);
|
|
1296
|
+
cb(error);
|
|
1297
|
+
return;
|
|
1495
1298
|
}
|
|
1496
1299
|
const compressed = (buf[0] & 64) === 64;
|
|
1497
1300
|
if (compressed && !this._extensions[PerMessageDeflate.extensionName]) {
|
|
1498
|
-
|
|
1499
|
-
return error(
|
|
1301
|
+
const error = this.createError(
|
|
1500
1302
|
RangeError,
|
|
1501
1303
|
"RSV1 must be clear",
|
|
1502
1304
|
true,
|
|
1503
1305
|
1002,
|
|
1504
1306
|
"WS_ERR_UNEXPECTED_RSV_1"
|
|
1505
1307
|
);
|
|
1308
|
+
cb(error);
|
|
1309
|
+
return;
|
|
1506
1310
|
}
|
|
1507
1311
|
this._fin = (buf[0] & 128) === 128;
|
|
1508
1312
|
this._opcode = buf[0] & 15;
|
|
1509
1313
|
this._payloadLength = buf[1] & 127;
|
|
1510
1314
|
if (this._opcode === 0) {
|
|
1511
1315
|
if (compressed) {
|
|
1512
|
-
|
|
1513
|
-
return error(
|
|
1316
|
+
const error = this.createError(
|
|
1514
1317
|
RangeError,
|
|
1515
1318
|
"RSV1 must be clear",
|
|
1516
1319
|
true,
|
|
1517
1320
|
1002,
|
|
1518
1321
|
"WS_ERR_UNEXPECTED_RSV_1"
|
|
1519
1322
|
);
|
|
1323
|
+
cb(error);
|
|
1324
|
+
return;
|
|
1520
1325
|
}
|
|
1521
1326
|
if (!this._fragmented) {
|
|
1522
|
-
|
|
1523
|
-
return error(
|
|
1327
|
+
const error = this.createError(
|
|
1524
1328
|
RangeError,
|
|
1525
1329
|
"invalid opcode 0",
|
|
1526
1330
|
true,
|
|
1527
1331
|
1002,
|
|
1528
1332
|
"WS_ERR_INVALID_OPCODE"
|
|
1529
1333
|
);
|
|
1334
|
+
cb(error);
|
|
1335
|
+
return;
|
|
1530
1336
|
}
|
|
1531
1337
|
this._opcode = this._fragmented;
|
|
1532
1338
|
} else if (this._opcode === 1 || this._opcode === 2) {
|
|
1533
1339
|
if (this._fragmented) {
|
|
1534
|
-
|
|
1535
|
-
return error(
|
|
1340
|
+
const error = this.createError(
|
|
1536
1341
|
RangeError,
|
|
1537
1342
|
`invalid opcode ${this._opcode}`,
|
|
1538
1343
|
true,
|
|
1539
1344
|
1002,
|
|
1540
1345
|
"WS_ERR_INVALID_OPCODE"
|
|
1541
1346
|
);
|
|
1347
|
+
cb(error);
|
|
1348
|
+
return;
|
|
1542
1349
|
}
|
|
1543
1350
|
this._compressed = compressed;
|
|
1544
1351
|
} else if (this._opcode > 7 && this._opcode < 11) {
|
|
1545
1352
|
if (!this._fin) {
|
|
1546
|
-
|
|
1547
|
-
return error(
|
|
1353
|
+
const error = this.createError(
|
|
1548
1354
|
RangeError,
|
|
1549
1355
|
"FIN must be set",
|
|
1550
1356
|
true,
|
|
1551
1357
|
1002,
|
|
1552
1358
|
"WS_ERR_EXPECTED_FIN"
|
|
1553
1359
|
);
|
|
1360
|
+
cb(error);
|
|
1361
|
+
return;
|
|
1554
1362
|
}
|
|
1555
1363
|
if (compressed) {
|
|
1556
|
-
|
|
1557
|
-
return error(
|
|
1364
|
+
const error = this.createError(
|
|
1558
1365
|
RangeError,
|
|
1559
1366
|
"RSV1 must be clear",
|
|
1560
1367
|
true,
|
|
1561
1368
|
1002,
|
|
1562
1369
|
"WS_ERR_UNEXPECTED_RSV_1"
|
|
1563
1370
|
);
|
|
1371
|
+
cb(error);
|
|
1372
|
+
return;
|
|
1564
1373
|
}
|
|
1565
1374
|
if (this._payloadLength > 125 || this._opcode === 8 && this._payloadLength === 1) {
|
|
1566
|
-
|
|
1567
|
-
return error(
|
|
1375
|
+
const error = this.createError(
|
|
1568
1376
|
RangeError,
|
|
1569
1377
|
`invalid payload length ${this._payloadLength}`,
|
|
1570
1378
|
true,
|
|
1571
1379
|
1002,
|
|
1572
1380
|
"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"
|
|
1573
1381
|
);
|
|
1382
|
+
cb(error);
|
|
1383
|
+
return;
|
|
1574
1384
|
}
|
|
1575
1385
|
} else {
|
|
1576
|
-
|
|
1577
|
-
return error(
|
|
1386
|
+
const error = this.createError(
|
|
1578
1387
|
RangeError,
|
|
1579
1388
|
`invalid opcode ${this._opcode}`,
|
|
1580
1389
|
true,
|
|
1581
1390
|
1002,
|
|
1582
1391
|
"WS_ERR_INVALID_OPCODE"
|
|
1583
1392
|
);
|
|
1393
|
+
cb(error);
|
|
1394
|
+
return;
|
|
1584
1395
|
}
|
|
1585
1396
|
if (!this._fin && !this._fragmented)
|
|
1586
1397
|
this._fragmented = this._opcode;
|
|
1587
1398
|
this._masked = (buf[1] & 128) === 128;
|
|
1588
1399
|
if (this._isServer) {
|
|
1589
1400
|
if (!this._masked) {
|
|
1590
|
-
|
|
1591
|
-
return error(
|
|
1401
|
+
const error = this.createError(
|
|
1592
1402
|
RangeError,
|
|
1593
1403
|
"MASK must be set",
|
|
1594
1404
|
true,
|
|
1595
1405
|
1002,
|
|
1596
1406
|
"WS_ERR_EXPECTED_MASK"
|
|
1597
1407
|
);
|
|
1408
|
+
cb(error);
|
|
1409
|
+
return;
|
|
1598
1410
|
}
|
|
1599
1411
|
} else if (this._masked) {
|
|
1600
|
-
|
|
1601
|
-
return error(
|
|
1412
|
+
const error = this.createError(
|
|
1602
1413
|
RangeError,
|
|
1603
1414
|
"MASK must be clear",
|
|
1604
1415
|
true,
|
|
1605
1416
|
1002,
|
|
1606
1417
|
"WS_ERR_UNEXPECTED_MASK"
|
|
1607
1418
|
);
|
|
1419
|
+
cb(error);
|
|
1420
|
+
return;
|
|
1608
1421
|
}
|
|
1609
1422
|
if (this._payloadLength === 126)
|
|
1610
1423
|
this._state = GET_PAYLOAD_LENGTH_16;
|
|
1611
1424
|
else if (this._payloadLength === 127)
|
|
1612
1425
|
this._state = GET_PAYLOAD_LENGTH_64;
|
|
1613
1426
|
else
|
|
1614
|
-
|
|
1427
|
+
this.haveLength(cb);
|
|
1615
1428
|
}
|
|
1616
1429
|
/**
|
|
1617
1430
|
* Gets extended payload length (7+16).
|
|
1618
1431
|
*
|
|
1619
|
-
* @
|
|
1432
|
+
* @param {Function} cb Callback
|
|
1620
1433
|
* @private
|
|
1621
1434
|
*/
|
|
1622
|
-
getPayloadLength16() {
|
|
1435
|
+
getPayloadLength16(cb) {
|
|
1623
1436
|
if (this._bufferedBytes < 2) {
|
|
1624
1437
|
this._loop = false;
|
|
1625
1438
|
return;
|
|
1626
1439
|
}
|
|
1627
1440
|
this._payloadLength = this.consume(2).readUInt16BE(0);
|
|
1628
|
-
|
|
1441
|
+
this.haveLength(cb);
|
|
1629
1442
|
}
|
|
1630
1443
|
/**
|
|
1631
1444
|
* Gets extended payload length (7+64).
|
|
1632
1445
|
*
|
|
1633
|
-
* @
|
|
1446
|
+
* @param {Function} cb Callback
|
|
1634
1447
|
* @private
|
|
1635
1448
|
*/
|
|
1636
|
-
getPayloadLength64() {
|
|
1449
|
+
getPayloadLength64(cb) {
|
|
1637
1450
|
if (this._bufferedBytes < 8) {
|
|
1638
1451
|
this._loop = false;
|
|
1639
1452
|
return;
|
|
@@ -1641,36 +1454,38 @@ var require_receiver = __commonJS({
|
|
|
1641
1454
|
const buf = this.consume(8);
|
|
1642
1455
|
const num = buf.readUInt32BE(0);
|
|
1643
1456
|
if (num > Math.pow(2, 53 - 32) - 1) {
|
|
1644
|
-
|
|
1645
|
-
return error(
|
|
1457
|
+
const error = this.createError(
|
|
1646
1458
|
RangeError,
|
|
1647
1459
|
"Unsupported WebSocket frame: payload length > 2^53 - 1",
|
|
1648
1460
|
false,
|
|
1649
1461
|
1009,
|
|
1650
1462
|
"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH"
|
|
1651
1463
|
);
|
|
1464
|
+
cb(error);
|
|
1465
|
+
return;
|
|
1652
1466
|
}
|
|
1653
1467
|
this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);
|
|
1654
|
-
|
|
1468
|
+
this.haveLength(cb);
|
|
1655
1469
|
}
|
|
1656
1470
|
/**
|
|
1657
1471
|
* Payload length has been read.
|
|
1658
1472
|
*
|
|
1659
|
-
* @
|
|
1473
|
+
* @param {Function} cb Callback
|
|
1660
1474
|
* @private
|
|
1661
1475
|
*/
|
|
1662
|
-
haveLength() {
|
|
1476
|
+
haveLength(cb) {
|
|
1663
1477
|
if (this._payloadLength && this._opcode < 8) {
|
|
1664
1478
|
this._totalPayloadLength += this._payloadLength;
|
|
1665
1479
|
if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {
|
|
1666
|
-
|
|
1667
|
-
return error(
|
|
1480
|
+
const error = this.createError(
|
|
1668
1481
|
RangeError,
|
|
1669
1482
|
"Max payload size exceeded",
|
|
1670
1483
|
false,
|
|
1671
1484
|
1009,
|
|
1672
1485
|
"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"
|
|
1673
1486
|
);
|
|
1487
|
+
cb(error);
|
|
1488
|
+
return;
|
|
1674
1489
|
}
|
|
1675
1490
|
}
|
|
1676
1491
|
if (this._masked)
|
|
@@ -1695,7 +1510,6 @@ var require_receiver = __commonJS({
|
|
|
1695
1510
|
* Reads data bytes.
|
|
1696
1511
|
*
|
|
1697
1512
|
* @param {Function} cb Callback
|
|
1698
|
-
* @return {(Error|RangeError|undefined)} A possible error
|
|
1699
1513
|
* @private
|
|
1700
1514
|
*/
|
|
1701
1515
|
getData(cb) {
|
|
@@ -1710,8 +1524,10 @@ var require_receiver = __commonJS({
|
|
|
1710
1524
|
unmask(data, this._mask);
|
|
1711
1525
|
}
|
|
1712
1526
|
}
|
|
1713
|
-
if (this._opcode > 7)
|
|
1714
|
-
|
|
1527
|
+
if (this._opcode > 7) {
|
|
1528
|
+
this.controlMessage(data, cb);
|
|
1529
|
+
return;
|
|
1530
|
+
}
|
|
1715
1531
|
if (this._compressed) {
|
|
1716
1532
|
this._state = INFLATING;
|
|
1717
1533
|
this.decompress(data, cb);
|
|
@@ -1721,7 +1537,7 @@ var require_receiver = __commonJS({
|
|
|
1721
1537
|
this._messageLength = this._totalPayloadLength;
|
|
1722
1538
|
this._fragments.push(data);
|
|
1723
1539
|
}
|
|
1724
|
-
|
|
1540
|
+
this.dataMessage(cb);
|
|
1725
1541
|
}
|
|
1726
1542
|
/**
|
|
1727
1543
|
* Decompresses data.
|
|
@@ -1738,64 +1554,85 @@ var require_receiver = __commonJS({
|
|
|
1738
1554
|
if (buf.length) {
|
|
1739
1555
|
this._messageLength += buf.length;
|
|
1740
1556
|
if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"
|
|
1748
|
-
)
|
|
1557
|
+
const error = this.createError(
|
|
1558
|
+
RangeError,
|
|
1559
|
+
"Max payload size exceeded",
|
|
1560
|
+
false,
|
|
1561
|
+
1009,
|
|
1562
|
+
"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"
|
|
1749
1563
|
);
|
|
1564
|
+
cb(error);
|
|
1565
|
+
return;
|
|
1750
1566
|
}
|
|
1751
1567
|
this._fragments.push(buf);
|
|
1752
1568
|
}
|
|
1753
|
-
|
|
1754
|
-
if (
|
|
1755
|
-
|
|
1756
|
-
this.startLoop(cb);
|
|
1569
|
+
this.dataMessage(cb);
|
|
1570
|
+
if (this._state === GET_INFO)
|
|
1571
|
+
this.startLoop(cb);
|
|
1757
1572
|
});
|
|
1758
1573
|
}
|
|
1759
1574
|
/**
|
|
1760
1575
|
* Handles a data message.
|
|
1761
1576
|
*
|
|
1762
|
-
* @
|
|
1577
|
+
* @param {Function} cb Callback
|
|
1763
1578
|
* @private
|
|
1764
1579
|
*/
|
|
1765
|
-
dataMessage() {
|
|
1766
|
-
if (this._fin) {
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1580
|
+
dataMessage(cb) {
|
|
1581
|
+
if (!this._fin) {
|
|
1582
|
+
this._state = GET_INFO;
|
|
1583
|
+
return;
|
|
1584
|
+
}
|
|
1585
|
+
const messageLength = this._messageLength;
|
|
1586
|
+
const fragments = this._fragments;
|
|
1587
|
+
this._totalPayloadLength = 0;
|
|
1588
|
+
this._messageLength = 0;
|
|
1589
|
+
this._fragmented = 0;
|
|
1590
|
+
this._fragments = [];
|
|
1591
|
+
if (this._opcode === 2) {
|
|
1592
|
+
let data;
|
|
1593
|
+
if (this._binaryType === "nodebuffer") {
|
|
1594
|
+
data = concat(fragments, messageLength);
|
|
1595
|
+
} else if (this._binaryType === "arraybuffer") {
|
|
1596
|
+
data = toArrayBuffer(concat(fragments, messageLength));
|
|
1597
|
+
} else {
|
|
1598
|
+
data = fragments;
|
|
1599
|
+
}
|
|
1600
|
+
if (this._allowSynchronousEvents) {
|
|
1782
1601
|
this.emit("message", data, true);
|
|
1602
|
+
this._state = GET_INFO;
|
|
1783
1603
|
} else {
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
this.
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1604
|
+
this._state = DEFER_EVENT;
|
|
1605
|
+
setImmediate(() => {
|
|
1606
|
+
this.emit("message", data, true);
|
|
1607
|
+
this._state = GET_INFO;
|
|
1608
|
+
this.startLoop(cb);
|
|
1609
|
+
});
|
|
1610
|
+
}
|
|
1611
|
+
} else {
|
|
1612
|
+
const buf = concat(fragments, messageLength);
|
|
1613
|
+
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
1614
|
+
const error = this.createError(
|
|
1615
|
+
Error,
|
|
1616
|
+
"invalid UTF-8 sequence",
|
|
1617
|
+
true,
|
|
1618
|
+
1007,
|
|
1619
|
+
"WS_ERR_INVALID_UTF8"
|
|
1620
|
+
);
|
|
1621
|
+
cb(error);
|
|
1622
|
+
return;
|
|
1623
|
+
}
|
|
1624
|
+
if (this._state === INFLATING || this._allowSynchronousEvents) {
|
|
1795
1625
|
this.emit("message", buf, false);
|
|
1626
|
+
this._state = GET_INFO;
|
|
1627
|
+
} else {
|
|
1628
|
+
this._state = DEFER_EVENT;
|
|
1629
|
+
setImmediate(() => {
|
|
1630
|
+
this.emit("message", buf, false);
|
|
1631
|
+
this._state = GET_INFO;
|
|
1632
|
+
this.startLoop(cb);
|
|
1633
|
+
});
|
|
1796
1634
|
}
|
|
1797
1635
|
}
|
|
1798
|
-
this._state = GET_INFO;
|
|
1799
1636
|
}
|
|
1800
1637
|
/**
|
|
1801
1638
|
* Handles a control message.
|
|
@@ -1804,22 +1641,24 @@ var require_receiver = __commonJS({
|
|
|
1804
1641
|
* @return {(Error|RangeError|undefined)} A possible error
|
|
1805
1642
|
* @private
|
|
1806
1643
|
*/
|
|
1807
|
-
controlMessage(data) {
|
|
1644
|
+
controlMessage(data, cb) {
|
|
1808
1645
|
if (this._opcode === 8) {
|
|
1809
|
-
this._loop = false;
|
|
1810
1646
|
if (data.length === 0) {
|
|
1647
|
+
this._loop = false;
|
|
1811
1648
|
this.emit("conclude", 1005, EMPTY_BUFFER);
|
|
1812
1649
|
this.end();
|
|
1813
1650
|
} else {
|
|
1814
1651
|
const code = data.readUInt16BE(0);
|
|
1815
1652
|
if (!isValidStatusCode(code)) {
|
|
1816
|
-
|
|
1653
|
+
const error = this.createError(
|
|
1817
1654
|
RangeError,
|
|
1818
1655
|
`invalid status code ${code}`,
|
|
1819
1656
|
true,
|
|
1820
1657
|
1002,
|
|
1821
1658
|
"WS_ERR_INVALID_CLOSE_CODE"
|
|
1822
1659
|
);
|
|
1660
|
+
cb(error);
|
|
1661
|
+
return;
|
|
1823
1662
|
}
|
|
1824
1663
|
const buf = new FastBuffer(
|
|
1825
1664
|
data.buffer,
|
|
@@ -1827,44 +1666,68 @@ var require_receiver = __commonJS({
|
|
|
1827
1666
|
data.length - 2
|
|
1828
1667
|
);
|
|
1829
1668
|
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
1830
|
-
|
|
1669
|
+
const error = this.createError(
|
|
1831
1670
|
Error,
|
|
1832
1671
|
"invalid UTF-8 sequence",
|
|
1833
1672
|
true,
|
|
1834
1673
|
1007,
|
|
1835
1674
|
"WS_ERR_INVALID_UTF8"
|
|
1836
1675
|
);
|
|
1676
|
+
cb(error);
|
|
1677
|
+
return;
|
|
1837
1678
|
}
|
|
1679
|
+
this._loop = false;
|
|
1838
1680
|
this.emit("conclude", code, buf);
|
|
1839
1681
|
this.end();
|
|
1840
1682
|
}
|
|
1841
|
-
|
|
1842
|
-
|
|
1683
|
+
this._state = GET_INFO;
|
|
1684
|
+
return;
|
|
1685
|
+
}
|
|
1686
|
+
if (this._allowSynchronousEvents) {
|
|
1687
|
+
this.emit(this._opcode === 9 ? "ping" : "pong", data);
|
|
1688
|
+
this._state = GET_INFO;
|
|
1843
1689
|
} else {
|
|
1844
|
-
this.
|
|
1690
|
+
this._state = DEFER_EVENT;
|
|
1691
|
+
setImmediate(() => {
|
|
1692
|
+
this.emit(this._opcode === 9 ? "ping" : "pong", data);
|
|
1693
|
+
this._state = GET_INFO;
|
|
1694
|
+
this.startLoop(cb);
|
|
1695
|
+
});
|
|
1845
1696
|
}
|
|
1846
|
-
|
|
1697
|
+
}
|
|
1698
|
+
/**
|
|
1699
|
+
* Builds an error object.
|
|
1700
|
+
*
|
|
1701
|
+
* @param {function(new:Error|RangeError)} ErrorCtor The error constructor
|
|
1702
|
+
* @param {String} message The error message
|
|
1703
|
+
* @param {Boolean} prefix Specifies whether or not to add a default prefix to
|
|
1704
|
+
* `message`
|
|
1705
|
+
* @param {Number} statusCode The status code
|
|
1706
|
+
* @param {String} errorCode The exposed error code
|
|
1707
|
+
* @return {(Error|RangeError)} The error
|
|
1708
|
+
* @private
|
|
1709
|
+
*/
|
|
1710
|
+
createError(ErrorCtor, message, prefix, statusCode, errorCode) {
|
|
1711
|
+
this._loop = false;
|
|
1712
|
+
this._errored = true;
|
|
1713
|
+
const err = new ErrorCtor(
|
|
1714
|
+
prefix ? `Invalid WebSocket frame: ${message}` : message
|
|
1715
|
+
);
|
|
1716
|
+
Error.captureStackTrace(err, this.createError);
|
|
1717
|
+
err.code = errorCode;
|
|
1718
|
+
err[kStatusCode] = statusCode;
|
|
1719
|
+
return err;
|
|
1847
1720
|
}
|
|
1848
1721
|
};
|
|
1849
1722
|
module.exports = Receiver2;
|
|
1850
|
-
function error(ErrorCtor, message, prefix, statusCode, errorCode) {
|
|
1851
|
-
const err = new ErrorCtor(
|
|
1852
|
-
prefix ? `Invalid WebSocket frame: ${message}` : message
|
|
1853
|
-
);
|
|
1854
|
-
Error.captureStackTrace(err, error);
|
|
1855
|
-
err.code = errorCode;
|
|
1856
|
-
err[kStatusCode] = statusCode;
|
|
1857
|
-
return err;
|
|
1858
|
-
}
|
|
1859
1723
|
}
|
|
1860
1724
|
});
|
|
1861
1725
|
|
|
1862
|
-
// ../../node_modules/ws/lib/sender.js
|
|
1726
|
+
// ../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/sender.js
|
|
1863
1727
|
var require_sender = __commonJS({
|
|
1864
|
-
"../../node_modules/ws/lib/sender.js"(exports, module) {
|
|
1728
|
+
"../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/sender.js"(exports, module) {
|
|
1865
1729
|
"use strict";
|
|
1866
|
-
var
|
|
1867
|
-
var tls = __require("tls");
|
|
1730
|
+
var { Duplex } = __require("stream");
|
|
1868
1731
|
var { randomFillSync } = __require("crypto");
|
|
1869
1732
|
var PerMessageDeflate = require_permessage_deflate();
|
|
1870
1733
|
var { EMPTY_BUFFER } = require_constants();
|
|
@@ -1872,11 +1735,14 @@ var require_sender = __commonJS({
|
|
|
1872
1735
|
var { mask: applyMask, toBuffer } = require_buffer_util();
|
|
1873
1736
|
var kByteLength = Symbol("kByteLength");
|
|
1874
1737
|
var maskBuffer = Buffer.alloc(4);
|
|
1738
|
+
var RANDOM_POOL_SIZE = 8 * 1024;
|
|
1739
|
+
var randomPool;
|
|
1740
|
+
var randomPoolPointer = RANDOM_POOL_SIZE;
|
|
1875
1741
|
var Sender2 = class _Sender {
|
|
1876
1742
|
/**
|
|
1877
1743
|
* Creates a Sender instance.
|
|
1878
1744
|
*
|
|
1879
|
-
* @param {
|
|
1745
|
+
* @param {Duplex} socket The connection socket
|
|
1880
1746
|
* @param {Object} [extensions] An object containing the negotiated extensions
|
|
1881
1747
|
* @param {Function} [generateMask] The function used to generate the masking
|
|
1882
1748
|
* key
|
|
@@ -1925,7 +1791,17 @@ var require_sender = __commonJS({
|
|
|
1925
1791
|
if (options.generateMask) {
|
|
1926
1792
|
options.generateMask(mask);
|
|
1927
1793
|
} else {
|
|
1928
|
-
|
|
1794
|
+
if (randomPoolPointer === RANDOM_POOL_SIZE) {
|
|
1795
|
+
if (randomPool === void 0) {
|
|
1796
|
+
randomPool = Buffer.alloc(RANDOM_POOL_SIZE);
|
|
1797
|
+
}
|
|
1798
|
+
randomFillSync(randomPool, 0, RANDOM_POOL_SIZE);
|
|
1799
|
+
randomPoolPointer = 0;
|
|
1800
|
+
}
|
|
1801
|
+
mask[0] = randomPool[randomPoolPointer++];
|
|
1802
|
+
mask[1] = randomPool[randomPoolPointer++];
|
|
1803
|
+
mask[2] = randomPool[randomPoolPointer++];
|
|
1804
|
+
mask[3] = randomPool[randomPoolPointer++];
|
|
1929
1805
|
}
|
|
1930
1806
|
skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0;
|
|
1931
1807
|
offset = 6;
|
|
@@ -2271,9 +2147,9 @@ var require_sender = __commonJS({
|
|
|
2271
2147
|
}
|
|
2272
2148
|
});
|
|
2273
2149
|
|
|
2274
|
-
// ../../node_modules/ws/lib/event-target.js
|
|
2150
|
+
// ../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/event-target.js
|
|
2275
2151
|
var require_event_target = __commonJS({
|
|
2276
|
-
"../../node_modules/ws/lib/event-target.js"(exports, module) {
|
|
2152
|
+
"../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/event-target.js"(exports, module) {
|
|
2277
2153
|
"use strict";
|
|
2278
2154
|
var { kForOnEventAttribute, kListener } = require_constants();
|
|
2279
2155
|
var kCode = Symbol("kCode");
|
|
@@ -2500,9 +2376,9 @@ var require_event_target = __commonJS({
|
|
|
2500
2376
|
}
|
|
2501
2377
|
});
|
|
2502
2378
|
|
|
2503
|
-
// ../../node_modules/ws/lib/extension.js
|
|
2379
|
+
// ../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/extension.js
|
|
2504
2380
|
var require_extension = __commonJS({
|
|
2505
|
-
"../../node_modules/ws/lib/extension.js"(exports, module) {
|
|
2381
|
+
"../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/extension.js"(exports, module) {
|
|
2506
2382
|
"use strict";
|
|
2507
2383
|
var { tokenChars } = require_validation();
|
|
2508
2384
|
function push(dest, name, elem) {
|
|
@@ -2670,9 +2546,9 @@ var require_extension = __commonJS({
|
|
|
2670
2546
|
}
|
|
2671
2547
|
});
|
|
2672
2548
|
|
|
2673
|
-
// ../../node_modules/ws/lib/websocket.js
|
|
2549
|
+
// ../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/websocket.js
|
|
2674
2550
|
var require_websocket = __commonJS({
|
|
2675
|
-
"../../node_modules/ws/lib/websocket.js"(exports, module) {
|
|
2551
|
+
"../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/websocket.js"(exports, module) {
|
|
2676
2552
|
"use strict";
|
|
2677
2553
|
var EventEmitter = __require("events");
|
|
2678
2554
|
var https = __require("https");
|
|
@@ -2680,7 +2556,7 @@ var require_websocket = __commonJS({
|
|
|
2680
2556
|
var net = __require("net");
|
|
2681
2557
|
var tls = __require("tls");
|
|
2682
2558
|
var { randomBytes, createHash } = __require("crypto");
|
|
2683
|
-
var { Readable } = __require("stream");
|
|
2559
|
+
var { Duplex, Readable } = __require("stream");
|
|
2684
2560
|
var { URL } = __require("url");
|
|
2685
2561
|
var PerMessageDeflate = require_permessage_deflate();
|
|
2686
2562
|
var Receiver2 = require_receiver();
|
|
@@ -2744,6 +2620,7 @@ var require_websocket = __commonJS({
|
|
|
2744
2620
|
}
|
|
2745
2621
|
initAsClient(this, address, protocols, options);
|
|
2746
2622
|
} else {
|
|
2623
|
+
this._autoPong = options.autoPong;
|
|
2747
2624
|
this._isServer = true;
|
|
2748
2625
|
}
|
|
2749
2626
|
}
|
|
@@ -2833,10 +2710,12 @@ var require_websocket = __commonJS({
|
|
|
2833
2710
|
/**
|
|
2834
2711
|
* Set up the socket and the internal resources.
|
|
2835
2712
|
*
|
|
2836
|
-
* @param {
|
|
2837
|
-
* server and client
|
|
2713
|
+
* @param {Duplex} socket The network socket between the server and client
|
|
2838
2714
|
* @param {Buffer} head The first packet of the upgraded stream
|
|
2839
2715
|
* @param {Object} options Options object
|
|
2716
|
+
* @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether
|
|
2717
|
+
* any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
|
|
2718
|
+
* multiple times in the same tick
|
|
2840
2719
|
* @param {Function} [options.generateMask] The function used to generate the
|
|
2841
2720
|
* masking key
|
|
2842
2721
|
* @param {Number} [options.maxPayload=0] The maximum allowed message size
|
|
@@ -2846,6 +2725,7 @@ var require_websocket = __commonJS({
|
|
|
2846
2725
|
*/
|
|
2847
2726
|
setSocket(socket, head, options) {
|
|
2848
2727
|
const receiver = new Receiver2({
|
|
2728
|
+
allowSynchronousEvents: options.allowSynchronousEvents,
|
|
2849
2729
|
binaryType: this.binaryType,
|
|
2850
2730
|
extensions: this._extensions,
|
|
2851
2731
|
isServer: this._isServer,
|
|
@@ -2863,8 +2743,10 @@ var require_websocket = __commonJS({
|
|
|
2863
2743
|
receiver.on("message", receiverOnMessage);
|
|
2864
2744
|
receiver.on("ping", receiverOnPing);
|
|
2865
2745
|
receiver.on("pong", receiverOnPong);
|
|
2866
|
-
socket.setTimeout
|
|
2867
|
-
|
|
2746
|
+
if (socket.setTimeout)
|
|
2747
|
+
socket.setTimeout(0);
|
|
2748
|
+
if (socket.setNoDelay)
|
|
2749
|
+
socket.setNoDelay();
|
|
2868
2750
|
if (head.length > 0)
|
|
2869
2751
|
socket.unshift(head);
|
|
2870
2752
|
socket.on("close", socketOnClose);
|
|
@@ -3156,6 +3038,8 @@ var require_websocket = __commonJS({
|
|
|
3156
3038
|
module.exports = WebSocket4;
|
|
3157
3039
|
function initAsClient(websocket, address, protocols, options) {
|
|
3158
3040
|
const opts = {
|
|
3041
|
+
allowSynchronousEvents: true,
|
|
3042
|
+
autoPong: true,
|
|
3159
3043
|
protocolVersion: protocolVersions[1],
|
|
3160
3044
|
maxPayload: 100 * 1024 * 1024,
|
|
3161
3045
|
skipUTF8Validation: false,
|
|
@@ -3163,7 +3047,6 @@ var require_websocket = __commonJS({
|
|
|
3163
3047
|
followRedirects: false,
|
|
3164
3048
|
maxRedirects: 10,
|
|
3165
3049
|
...options,
|
|
3166
|
-
createConnection: void 0,
|
|
3167
3050
|
socketPath: void 0,
|
|
3168
3051
|
hostname: void 0,
|
|
3169
3052
|
protocol: void 0,
|
|
@@ -3173,6 +3056,7 @@ var require_websocket = __commonJS({
|
|
|
3173
3056
|
path: void 0,
|
|
3174
3057
|
port: void 0
|
|
3175
3058
|
};
|
|
3059
|
+
websocket._autoPong = opts.autoPong;
|
|
3176
3060
|
if (!protocolVersions.includes(opts.protocolVersion)) {
|
|
3177
3061
|
throw new RangeError(
|
|
3178
3062
|
`Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})`
|
|
@@ -3181,20 +3065,24 @@ var require_websocket = __commonJS({
|
|
|
3181
3065
|
let parsedUrl;
|
|
3182
3066
|
if (address instanceof URL) {
|
|
3183
3067
|
parsedUrl = address;
|
|
3184
|
-
websocket._url = address.href;
|
|
3185
3068
|
} else {
|
|
3186
3069
|
try {
|
|
3187
3070
|
parsedUrl = new URL(address);
|
|
3188
3071
|
} catch (e) {
|
|
3189
3072
|
throw new SyntaxError(`Invalid URL: ${address}`);
|
|
3190
3073
|
}
|
|
3191
|
-
websocket._url = address;
|
|
3192
3074
|
}
|
|
3075
|
+
if (parsedUrl.protocol === "http:") {
|
|
3076
|
+
parsedUrl.protocol = "ws:";
|
|
3077
|
+
} else if (parsedUrl.protocol === "https:") {
|
|
3078
|
+
parsedUrl.protocol = "wss:";
|
|
3079
|
+
}
|
|
3080
|
+
websocket._url = parsedUrl.href;
|
|
3193
3081
|
const isSecure = parsedUrl.protocol === "wss:";
|
|
3194
3082
|
const isIpcUrl = parsedUrl.protocol === "ws+unix:";
|
|
3195
3083
|
let invalidUrlMessage;
|
|
3196
3084
|
if (parsedUrl.protocol !== "ws:" && !isSecure && !isIpcUrl) {
|
|
3197
|
-
invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"`;
|
|
3085
|
+
invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"`;
|
|
3198
3086
|
} else if (isIpcUrl && !parsedUrl.pathname) {
|
|
3199
3087
|
invalidUrlMessage = "The URL's pathname is empty";
|
|
3200
3088
|
} else if (parsedUrl.hash) {
|
|
@@ -3214,7 +3102,7 @@ var require_websocket = __commonJS({
|
|
|
3214
3102
|
const request = isSecure ? https.request : http.request;
|
|
3215
3103
|
const protocolSet = /* @__PURE__ */ new Set();
|
|
3216
3104
|
let perMessageDeflate;
|
|
3217
|
-
opts.createConnection = isSecure ? tlsConnect : netConnect;
|
|
3105
|
+
opts.createConnection = opts.createConnection || (isSecure ? tlsConnect : netConnect);
|
|
3218
3106
|
opts.defaultPort = opts.defaultPort || defaultPort;
|
|
3219
3107
|
opts.port = parsedUrl.port || defaultPort;
|
|
3220
3108
|
opts.host = parsedUrl.hostname.startsWith("[") ? parsedUrl.hostname.slice(1, -1) : parsedUrl.hostname;
|
|
@@ -3338,7 +3226,8 @@ var require_websocket = __commonJS({
|
|
|
3338
3226
|
if (websocket.readyState !== WebSocket4.CONNECTING)
|
|
3339
3227
|
return;
|
|
3340
3228
|
req = websocket._req = null;
|
|
3341
|
-
|
|
3229
|
+
const upgrade = res.headers.upgrade;
|
|
3230
|
+
if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
|
|
3342
3231
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
3343
3232
|
return;
|
|
3344
3233
|
}
|
|
@@ -3395,6 +3284,7 @@ var require_websocket = __commonJS({
|
|
|
3395
3284
|
websocket._extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
|
|
3396
3285
|
}
|
|
3397
3286
|
websocket.setSocket(socket, head, {
|
|
3287
|
+
allowSynchronousEvents: opts.allowSynchronousEvents,
|
|
3398
3288
|
generateMask: opts.generateMask,
|
|
3399
3289
|
maxPayload: opts.maxPayload,
|
|
3400
3290
|
skipUTF8Validation: opts.skipUTF8Validation
|
|
@@ -3490,7 +3380,8 @@ var require_websocket = __commonJS({
|
|
|
3490
3380
|
}
|
|
3491
3381
|
function receiverOnPing(data) {
|
|
3492
3382
|
const websocket = this[kWebSocket];
|
|
3493
|
-
|
|
3383
|
+
if (websocket._autoPong)
|
|
3384
|
+
websocket.pong(data, !this._isServer, NOOP);
|
|
3494
3385
|
websocket.emit("ping", data);
|
|
3495
3386
|
}
|
|
3496
3387
|
function receiverOnPong(data) {
|
|
@@ -3542,9 +3433,9 @@ var require_websocket = __commonJS({
|
|
|
3542
3433
|
}
|
|
3543
3434
|
});
|
|
3544
3435
|
|
|
3545
|
-
// ../../node_modules/ws/lib/subprotocol.js
|
|
3436
|
+
// ../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/subprotocol.js
|
|
3546
3437
|
var require_subprotocol = __commonJS({
|
|
3547
|
-
"../../node_modules/ws/lib/subprotocol.js"(exports, module) {
|
|
3438
|
+
"../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/subprotocol.js"(exports, module) {
|
|
3548
3439
|
"use strict";
|
|
3549
3440
|
var { tokenChars } = require_validation();
|
|
3550
3441
|
function parse(header) {
|
|
@@ -3590,15 +3481,13 @@ var require_subprotocol = __commonJS({
|
|
|
3590
3481
|
}
|
|
3591
3482
|
});
|
|
3592
3483
|
|
|
3593
|
-
// ../../node_modules/ws/lib/websocket-server.js
|
|
3484
|
+
// ../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/websocket-server.js
|
|
3594
3485
|
var require_websocket_server = __commonJS({
|
|
3595
|
-
"../../node_modules/ws/lib/websocket-server.js"(exports, module) {
|
|
3486
|
+
"../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/lib/websocket-server.js"(exports, module) {
|
|
3596
3487
|
"use strict";
|
|
3597
3488
|
var EventEmitter = __require("events");
|
|
3598
3489
|
var http = __require("http");
|
|
3599
|
-
var
|
|
3600
|
-
var net = __require("net");
|
|
3601
|
-
var tls = __require("tls");
|
|
3490
|
+
var { Duplex } = __require("stream");
|
|
3602
3491
|
var { createHash } = __require("crypto");
|
|
3603
3492
|
var extension = require_extension();
|
|
3604
3493
|
var PerMessageDeflate = require_permessage_deflate();
|
|
@@ -3614,6 +3503,11 @@ var require_websocket_server = __commonJS({
|
|
|
3614
3503
|
* Create a `WebSocketServer` instance.
|
|
3615
3504
|
*
|
|
3616
3505
|
* @param {Object} options Configuration options
|
|
3506
|
+
* @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether
|
|
3507
|
+
* any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
|
|
3508
|
+
* multiple times in the same tick
|
|
3509
|
+
* @param {Boolean} [options.autoPong=true] Specifies whether or not to
|
|
3510
|
+
* automatically send a pong in response to a ping
|
|
3617
3511
|
* @param {Number} [options.backlog=511] The maximum length of the queue of
|
|
3618
3512
|
* pending connections
|
|
3619
3513
|
* @param {Boolean} [options.clientTracking=true] Specifies whether or not to
|
|
@@ -3639,6 +3533,8 @@ var require_websocket_server = __commonJS({
|
|
|
3639
3533
|
constructor(options, callback) {
|
|
3640
3534
|
super();
|
|
3641
3535
|
options = {
|
|
3536
|
+
allowSynchronousEvents: true,
|
|
3537
|
+
autoPong: true,
|
|
3642
3538
|
maxPayload: 100 * 1024 * 1024,
|
|
3643
3539
|
skipUTF8Validation: false,
|
|
3644
3540
|
perMessageDeflate: false,
|
|
@@ -3779,8 +3675,7 @@ var require_websocket_server = __commonJS({
|
|
|
3779
3675
|
* Handle a HTTP Upgrade request.
|
|
3780
3676
|
*
|
|
3781
3677
|
* @param {http.IncomingMessage} req The request object
|
|
3782
|
-
* @param {
|
|
3783
|
-
* server and client
|
|
3678
|
+
* @param {Duplex} socket The network socket between the server and client
|
|
3784
3679
|
* @param {Buffer} head The first packet of the upgraded stream
|
|
3785
3680
|
* @param {Function} cb Callback
|
|
3786
3681
|
* @public
|
|
@@ -3788,18 +3683,19 @@ var require_websocket_server = __commonJS({
|
|
|
3788
3683
|
handleUpgrade(req, socket, head, cb) {
|
|
3789
3684
|
socket.on("error", socketOnError);
|
|
3790
3685
|
const key = req.headers["sec-websocket-key"];
|
|
3686
|
+
const upgrade = req.headers.upgrade;
|
|
3791
3687
|
const version = +req.headers["sec-websocket-version"];
|
|
3792
3688
|
if (req.method !== "GET") {
|
|
3793
3689
|
const message = "Invalid HTTP method";
|
|
3794
3690
|
abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);
|
|
3795
3691
|
return;
|
|
3796
3692
|
}
|
|
3797
|
-
if (
|
|
3693
|
+
if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
|
|
3798
3694
|
const message = "Invalid Upgrade header";
|
|
3799
3695
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
3800
3696
|
return;
|
|
3801
3697
|
}
|
|
3802
|
-
if (
|
|
3698
|
+
if (key === void 0 || !keyRegex.test(key)) {
|
|
3803
3699
|
const message = "Missing or invalid Sec-WebSocket-Key header";
|
|
3804
3700
|
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
|
|
3805
3701
|
return;
|
|
@@ -3879,8 +3775,7 @@ var require_websocket_server = __commonJS({
|
|
|
3879
3775
|
* @param {String} key The value of the `Sec-WebSocket-Key` header
|
|
3880
3776
|
* @param {Set} protocols The subprotocols
|
|
3881
3777
|
* @param {http.IncomingMessage} req The request object
|
|
3882
|
-
* @param {
|
|
3883
|
-
* server and client
|
|
3778
|
+
* @param {Duplex} socket The network socket between the server and client
|
|
3884
3779
|
* @param {Buffer} head The first packet of the upgraded stream
|
|
3885
3780
|
* @param {Function} cb Callback
|
|
3886
3781
|
* @throws {Error} If called more than once with the same socket
|
|
@@ -3903,7 +3798,7 @@ var require_websocket_server = __commonJS({
|
|
|
3903
3798
|
"Connection: Upgrade",
|
|
3904
3799
|
`Sec-WebSocket-Accept: ${digest}`
|
|
3905
3800
|
];
|
|
3906
|
-
const ws = new this.options.WebSocket(null);
|
|
3801
|
+
const ws = new this.options.WebSocket(null, void 0, this.options);
|
|
3907
3802
|
if (protocols.size) {
|
|
3908
3803
|
const protocol = this.options.handleProtocols ? this.options.handleProtocols(protocols, req) : protocols.values().next().value;
|
|
3909
3804
|
if (protocol) {
|
|
@@ -3923,6 +3818,7 @@ var require_websocket_server = __commonJS({
|
|
|
3923
3818
|
socket.write(headers.concat("\r\n").join("\r\n"));
|
|
3924
3819
|
socket.removeListener("error", socketOnError);
|
|
3925
3820
|
ws.setSocket(socket, head, {
|
|
3821
|
+
allowSynchronousEvents: this.options.allowSynchronousEvents,
|
|
3926
3822
|
maxPayload: this.options.maxPayload,
|
|
3927
3823
|
skipUTF8Validation: this.options.skipUTF8Validation
|
|
3928
3824
|
});
|
|
@@ -3981,7 +3877,7 @@ var require_websocket_server = __commonJS({
|
|
|
3981
3877
|
}
|
|
3982
3878
|
});
|
|
3983
3879
|
|
|
3984
|
-
// ../../node_modules/ws/wrapper.mjs
|
|
3880
|
+
// ../../node_modules/.pnpm/ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ws/wrapper.mjs
|
|
3985
3881
|
var wrapper_exports = {};
|
|
3986
3882
|
__export(wrapper_exports, {
|
|
3987
3883
|
Receiver: () => import_receiver.default,
|
|
@@ -3998,7 +3894,7 @@ var import_websocket = __toESM(require_websocket(), 1);
|
|
|
3998
3894
|
var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
3999
3895
|
var wrapper_default = import_websocket.default;
|
|
4000
3896
|
|
|
4001
|
-
// ../../node_modules/
|
|
3897
|
+
// ../../node_modules/.pnpm/isows@1.0.4_ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10_/node_modules/isows/_esm/utils.js
|
|
4002
3898
|
function getNativeWebSocket() {
|
|
4003
3899
|
if (typeof WebSocket !== "undefined")
|
|
4004
3900
|
return WebSocket;
|
|
@@ -4011,7 +3907,7 @@ function getNativeWebSocket() {
|
|
|
4011
3907
|
throw new Error("`WebSocket` is not supported in this environment");
|
|
4012
3908
|
}
|
|
4013
3909
|
|
|
4014
|
-
// ../../node_modules/
|
|
3910
|
+
// ../../node_modules/.pnpm/isows@1.0.4_ws@8.17.1_bufferutil@4.0.8_utf-8-validate@5.0.10_/node_modules/isows/_esm/index.js
|
|
4015
3911
|
var WebSocket3 = (() => {
|
|
4016
3912
|
try {
|
|
4017
3913
|
return getNativeWebSocket();
|
|
@@ -4024,4 +3920,4 @@ var WebSocket3 = (() => {
|
|
|
4024
3920
|
export {
|
|
4025
3921
|
WebSocket3 as WebSocket
|
|
4026
3922
|
};
|
|
4027
|
-
//# sourceMappingURL=_esm-
|
|
3923
|
+
//# sourceMappingURL=_esm-PPK7XFKN.js.map
|