capnweb 0.0.0-952a541 → 0.0.0-9751a4e
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/README.md +67 -2
- package/dist/index-bun.cjs +475 -109
- package/dist/index-bun.cjs.map +1 -1
- package/dist/index-bun.d.cts +158 -19
- package/dist/index-bun.d.ts +158 -19
- package/dist/index-bun.js +473 -110
- package/dist/index-bun.js.map +1 -1
- package/dist/index-workers.cjs +475 -109
- package/dist/index-workers.cjs.map +1 -1
- package/dist/index-workers.d.cts +154 -18
- package/dist/index-workers.d.ts +154 -18
- package/dist/index-workers.js +473 -110
- package/dist/index-workers.js.map +1 -1
- package/dist/index.cjs +475 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +154 -18
- package/dist/index.d.ts +154 -18
- package/dist/index.js +473 -110
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
package/dist/index-bun.js
CHANGED
|
@@ -41,9 +41,22 @@ function typeForRpc(value) {
|
|
|
41
41
|
case Array.prototype: return "array";
|
|
42
42
|
case Date.prototype: return "date";
|
|
43
43
|
case Uint8Array.prototype:
|
|
44
|
-
case BUFFER_PROTOTYPE:
|
|
44
|
+
case BUFFER_PROTOTYPE:
|
|
45
|
+
case ArrayBuffer.prototype:
|
|
46
|
+
case DataView.prototype:
|
|
47
|
+
case Int8Array.prototype:
|
|
48
|
+
case Uint8ClampedArray.prototype:
|
|
49
|
+
case Int16Array.prototype:
|
|
50
|
+
case Uint16Array.prototype:
|
|
51
|
+
case Int32Array.prototype:
|
|
52
|
+
case Uint32Array.prototype:
|
|
53
|
+
case BigInt64Array.prototype:
|
|
54
|
+
case BigUint64Array.prototype:
|
|
55
|
+
case Float32Array.prototype:
|
|
56
|
+
case Float64Array.prototype: return "bytes";
|
|
45
57
|
case WritableStream.prototype: return "writable";
|
|
46
58
|
case ReadableStream.prototype: return "readable";
|
|
59
|
+
case URL.prototype: return "url";
|
|
47
60
|
case Headers.prototype: return "headers";
|
|
48
61
|
case Request.prototype: return "request";
|
|
49
62
|
case Response.prototype: return "response";
|
|
@@ -77,7 +90,14 @@ let streamImpl = {
|
|
|
77
90
|
};
|
|
78
91
|
var StubHook = class {
|
|
79
92
|
stream(path, args) {
|
|
80
|
-
let
|
|
93
|
+
let hook = this.call(path, args);
|
|
94
|
+
let pulled;
|
|
95
|
+
try {
|
|
96
|
+
pulled = hook.pull();
|
|
97
|
+
} catch (err) {
|
|
98
|
+
hook.dispose();
|
|
99
|
+
throw err;
|
|
100
|
+
}
|
|
81
101
|
let promise;
|
|
82
102
|
if (pulled instanceof Promise) promise = pulled.then((p) => {
|
|
83
103
|
p.dispose();
|
|
@@ -96,9 +116,11 @@ var ErrorStubHook = class extends StubHook {
|
|
|
96
116
|
this.error = error;
|
|
97
117
|
}
|
|
98
118
|
call(path, args) {
|
|
119
|
+
args.dispose();
|
|
99
120
|
return this;
|
|
100
121
|
}
|
|
101
122
|
map(path, captures, instructions) {
|
|
123
|
+
for (let cap of captures) cap.dispose();
|
|
102
124
|
return this;
|
|
103
125
|
}
|
|
104
126
|
get(path) {
|
|
@@ -222,7 +244,25 @@ var RpcStub$1 = class RpcStub$1 extends RpcTarget$1 {
|
|
|
222
244
|
};
|
|
223
245
|
var RpcPromise$1 = class extends RpcStub$1 {
|
|
224
246
|
constructor(hook, pathIfPromise) {
|
|
225
|
-
super(hook, pathIfPromise);
|
|
247
|
+
if (hook instanceof StubHook) super(hook, pathIfPromise ?? []);
|
|
248
|
+
else {
|
|
249
|
+
if (pathIfPromise !== void 0) throw new TypeError("RpcPromise constructor expected one argument, received two.");
|
|
250
|
+
let kind = typeForRpc(hook);
|
|
251
|
+
if (kind === "rpc-promise") {
|
|
252
|
+
let raw = unwrapStubAndPath(hook);
|
|
253
|
+
if (raw.pathIfPromise.length > 0) super(raw.hook, raw.pathIfPromise);
|
|
254
|
+
else {
|
|
255
|
+
let adopted = raw.hook;
|
|
256
|
+
raw.hook = DISPOSED_HOOK;
|
|
257
|
+
super(adopted, []);
|
|
258
|
+
}
|
|
259
|
+
} else if (kind === "rpc-thenable") super(TargetStubHook.create(hook, void 0), []);
|
|
260
|
+
else {
|
|
261
|
+
let promiseHook = new PromiseStubHook(Promise.resolve(hook).then((value) => new PayloadStubHook(RpcPayload.fromAppReturn(value))));
|
|
262
|
+
promiseHook.ignoreUnhandledRejections();
|
|
263
|
+
super(promiseHook, []);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
226
266
|
}
|
|
227
267
|
then(onfulfilled, onrejected) {
|
|
228
268
|
return pullPromise(this).then(...arguments);
|
|
@@ -378,6 +418,7 @@ var RpcPayload = class RpcPayload {
|
|
|
378
418
|
case "date":
|
|
379
419
|
case "bytes":
|
|
380
420
|
case "blob":
|
|
421
|
+
case "url":
|
|
381
422
|
case "error":
|
|
382
423
|
case "undefined": return value;
|
|
383
424
|
case "array": {
|
|
@@ -511,6 +552,30 @@ var RpcPayload = class RpcPayload {
|
|
|
511
552
|
this.dispose();
|
|
512
553
|
}
|
|
513
554
|
}
|
|
555
|
+
async deliverStreamWrite(writer) {
|
|
556
|
+
try {
|
|
557
|
+
let promises = [];
|
|
558
|
+
this.deliverTo(this, "value", promises);
|
|
559
|
+
if (promises.length > 0) await Promise.all(promises);
|
|
560
|
+
let chunk = this.value[0];
|
|
561
|
+
if ((this.hooks.length > 0 || this.promises.length > 0) && chunk instanceof Object) {
|
|
562
|
+
if (!(Symbol.dispose in chunk)) Object.defineProperty(chunk, Symbol.dispose, {
|
|
563
|
+
value: () => this.dispose(),
|
|
564
|
+
writable: true,
|
|
565
|
+
enumerable: false,
|
|
566
|
+
configurable: true
|
|
567
|
+
});
|
|
568
|
+
await writer.write(chunk);
|
|
569
|
+
return RpcPayload.fromAppReturn(void 0);
|
|
570
|
+
}
|
|
571
|
+
await writer.write(chunk);
|
|
572
|
+
this.dispose();
|
|
573
|
+
return RpcPayload.fromAppReturn(void 0);
|
|
574
|
+
} catch (err) {
|
|
575
|
+
this.dispose();
|
|
576
|
+
throw err;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
514
579
|
async deliverResolve() {
|
|
515
580
|
try {
|
|
516
581
|
let promises = [];
|
|
@@ -551,6 +616,7 @@ var RpcPayload = class RpcPayload {
|
|
|
551
616
|
case "bytes":
|
|
552
617
|
case "blob":
|
|
553
618
|
case "date":
|
|
619
|
+
case "url":
|
|
554
620
|
case "error":
|
|
555
621
|
case "undefined": return;
|
|
556
622
|
case "array": {
|
|
@@ -633,6 +699,7 @@ var RpcPayload = class RpcPayload {
|
|
|
633
699
|
case "rpc-target":
|
|
634
700
|
case "writable":
|
|
635
701
|
case "readable":
|
|
702
|
+
case "url":
|
|
636
703
|
case "headers":
|
|
637
704
|
case "request":
|
|
638
705
|
case "response": return;
|
|
@@ -702,6 +769,7 @@ function followPath(value, parent, path, owner) {
|
|
|
702
769
|
case "blob":
|
|
703
770
|
case "date":
|
|
704
771
|
case "error":
|
|
772
|
+
case "url":
|
|
705
773
|
case "headers":
|
|
706
774
|
case "request":
|
|
707
775
|
case "response":
|
|
@@ -734,17 +802,22 @@ function followPath(value, parent, path, owner) {
|
|
|
734
802
|
}
|
|
735
803
|
var ValueStubHook = class extends StubHook {
|
|
736
804
|
call(path, args) {
|
|
805
|
+
let followResult;
|
|
737
806
|
try {
|
|
738
807
|
let { value, owner } = this.getValue();
|
|
739
|
-
|
|
740
|
-
if (followResult.hook) return followResult.hook.call(followResult.remainingPath, args);
|
|
741
|
-
if (typeof followResult.value != "function") throw new TypeError(`'${path.join(".")}' is not a function.`);
|
|
742
|
-
return new PromiseStubHook(args.deliverCall(followResult.value, followResult.parent).then((payload) => {
|
|
743
|
-
return new PayloadStubHook(payload);
|
|
744
|
-
}));
|
|
808
|
+
followResult = followPath(value, void 0, path, owner);
|
|
745
809
|
} catch (err) {
|
|
810
|
+
args.dispose();
|
|
746
811
|
return new ErrorStubHook(err);
|
|
747
812
|
}
|
|
813
|
+
if (followResult.hook) return followResult.hook.call(followResult.remainingPath, args);
|
|
814
|
+
if (typeof followResult.value != "function") {
|
|
815
|
+
args.dispose();
|
|
816
|
+
return new ErrorStubHook(/* @__PURE__ */ new TypeError(`'${path.join(".")}' is not a function.`));
|
|
817
|
+
}
|
|
818
|
+
return new PromiseStubHook(args.deliverCall(followResult.value, followResult.parent).then((payload) => {
|
|
819
|
+
return new PayloadStubHook(payload);
|
|
820
|
+
}));
|
|
748
821
|
}
|
|
749
822
|
map(path, captures, instructions) {
|
|
750
823
|
try {
|
|
@@ -765,7 +838,10 @@ var ValueStubHook = class extends StubHook {
|
|
|
765
838
|
get(path) {
|
|
766
839
|
try {
|
|
767
840
|
let { value, owner } = this.getValue();
|
|
768
|
-
if (path.length === 0 && owner === null)
|
|
841
|
+
if (path.length === 0 && owner === null) {
|
|
842
|
+
if (value instanceof Object && "then" in value) return this.dup();
|
|
843
|
+
throw new Error("Can't dup an RpcTarget stub as a promise.");
|
|
844
|
+
}
|
|
769
845
|
let followResult = followPath(value, void 0, path, owner);
|
|
770
846
|
if (followResult.hook) return followResult.hook.get(followResult.remainingPath);
|
|
771
847
|
return new PayloadStubHook(RpcPayload.deepCopyFrom(followResult.value, followResult.parent, followResult.owner));
|
|
@@ -868,7 +944,10 @@ var TargetStubHook = class TargetStubHook extends ValueStubHook {
|
|
|
868
944
|
this.target = void 0;
|
|
869
945
|
}
|
|
870
946
|
}
|
|
871
|
-
onBroken(callback) {
|
|
947
|
+
onBroken(callback) {
|
|
948
|
+
let target = this.target;
|
|
949
|
+
if (target && "then" in target) Promise.resolve(target).then(() => {}, callback);
|
|
950
|
+
}
|
|
872
951
|
};
|
|
873
952
|
var PromiseStubHook = class PromiseStubHook extends StubHook {
|
|
874
953
|
promise;
|
|
@@ -882,12 +961,16 @@ var PromiseStubHook = class PromiseStubHook extends StubHook {
|
|
|
882
961
|
}
|
|
883
962
|
call(path, args) {
|
|
884
963
|
args.ensureDeepCopied();
|
|
885
|
-
return new PromiseStubHook(this.promise.then((hook) => hook.call(path, args))
|
|
964
|
+
return new PromiseStubHook(this.promise.then((hook) => hook.call(path, args), (err) => {
|
|
965
|
+
args.dispose();
|
|
966
|
+
throw err;
|
|
967
|
+
}));
|
|
886
968
|
}
|
|
887
969
|
stream(path, args) {
|
|
888
970
|
args.ensureDeepCopied();
|
|
889
|
-
return { promise: this.promise.then((hook) => {
|
|
890
|
-
|
|
971
|
+
return { promise: this.promise.then((hook) => hook.stream(path, args).promise, (err) => {
|
|
972
|
+
args.dispose();
|
|
973
|
+
throw err;
|
|
891
974
|
}) };
|
|
892
975
|
}
|
|
893
976
|
map(path, captures, instructions) {
|
|
@@ -914,10 +997,7 @@ var PromiseStubHook = class PromiseStubHook extends StubHook {
|
|
|
914
997
|
}, (err) => {});
|
|
915
998
|
}
|
|
916
999
|
dispose() {
|
|
917
|
-
|
|
918
|
-
else this.promise.then((hook) => {
|
|
919
|
-
hook.dispose();
|
|
920
|
-
}, (err) => {});
|
|
1000
|
+
this.promise.then((hook) => hook.dispose(), () => {});
|
|
921
1001
|
}
|
|
922
1002
|
onBroken(callback) {
|
|
923
1003
|
if (this.resolution) this.resolution.onBroken(callback);
|
|
@@ -929,6 +1009,77 @@ var PromiseStubHook = class PromiseStubHook extends StubHook {
|
|
|
929
1009
|
|
|
930
1010
|
//#endregion
|
|
931
1011
|
//#region src/serialize.ts
|
|
1012
|
+
const DEFAULT_MAX_DEPTH = 256;
|
|
1013
|
+
const DEFAULT_LIMITS = {
|
|
1014
|
+
maxBigIntDigits: 16384,
|
|
1015
|
+
maxDepth: 256,
|
|
1016
|
+
maxMessageSize: 32 * 1024 * 1024
|
|
1017
|
+
};
|
|
1018
|
+
const NATIVE_LITTLE_ENDIAN = new Uint8Array(new Uint16Array([1]).buffer)[0] === 1;
|
|
1019
|
+
const BYTE_CONTAINER_TYPE_NAMES = [
|
|
1020
|
+
"ArrayBuffer",
|
|
1021
|
+
"DataView",
|
|
1022
|
+
"Int8Array",
|
|
1023
|
+
"Uint8Array",
|
|
1024
|
+
"Uint8ClampedArray",
|
|
1025
|
+
"Int16Array",
|
|
1026
|
+
"Uint16Array",
|
|
1027
|
+
"Int32Array",
|
|
1028
|
+
"Uint32Array",
|
|
1029
|
+
"BigInt64Array",
|
|
1030
|
+
"BigUint64Array",
|
|
1031
|
+
"Float32Array",
|
|
1032
|
+
"Float64Array"
|
|
1033
|
+
];
|
|
1034
|
+
function isValidByteContainerName(value) {
|
|
1035
|
+
return BYTE_CONTAINER_TYPE_NAMES.includes(value);
|
|
1036
|
+
}
|
|
1037
|
+
const TYPED_ARRAY_ELEMENT_SIZE = {
|
|
1038
|
+
ArrayBuffer: void 0,
|
|
1039
|
+
DataView: void 0,
|
|
1040
|
+
Int8Array: void 0,
|
|
1041
|
+
Uint8Array: void 0,
|
|
1042
|
+
Uint8ClampedArray: void 0,
|
|
1043
|
+
Int16Array: 2,
|
|
1044
|
+
Uint16Array: 2,
|
|
1045
|
+
Int32Array: 4,
|
|
1046
|
+
Uint32Array: 4,
|
|
1047
|
+
BigInt64Array: 8,
|
|
1048
|
+
BigUint64Array: 8,
|
|
1049
|
+
Float32Array: 4,
|
|
1050
|
+
Float64Array: 8
|
|
1051
|
+
};
|
|
1052
|
+
const BYTE_CONTAINER_PROTOTYPES = {
|
|
1053
|
+
ArrayBuffer: ArrayBuffer.prototype,
|
|
1054
|
+
DataView: DataView.prototype,
|
|
1055
|
+
Int8Array: Int8Array.prototype,
|
|
1056
|
+
Uint8ClampedArray: Uint8ClampedArray.prototype,
|
|
1057
|
+
Int16Array: Int16Array.prototype,
|
|
1058
|
+
Uint16Array: Uint16Array.prototype,
|
|
1059
|
+
Int32Array: Int32Array.prototype,
|
|
1060
|
+
Uint32Array: Uint32Array.prototype,
|
|
1061
|
+
BigInt64Array: BigInt64Array.prototype,
|
|
1062
|
+
BigUint64Array: BigUint64Array.prototype,
|
|
1063
|
+
Float32Array: Float32Array.prototype,
|
|
1064
|
+
Float64Array: Float64Array.prototype
|
|
1065
|
+
};
|
|
1066
|
+
const BYTE_CONTAINER_TYPE_BY_PROTOTYPE = /* @__PURE__ */ new Map();
|
|
1067
|
+
for (let type of Object.keys(BYTE_CONTAINER_PROTOTYPES)) BYTE_CONTAINER_TYPE_BY_PROTOTYPE.set(BYTE_CONTAINER_PROTOTYPES[type], type);
|
|
1068
|
+
function swapByteOrder(bytes, elementSize) {
|
|
1069
|
+
if (elementSize !== 2 && elementSize !== 4 && elementSize !== 8) throw new RangeError(`Unsupported element size: ${elementSize}`);
|
|
1070
|
+
let view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
1071
|
+
for (let offset = 0; offset < bytes.byteLength; offset += elementSize) switch (elementSize) {
|
|
1072
|
+
case 2:
|
|
1073
|
+
view.setUint16(offset, view.getUint16(offset, false), true);
|
|
1074
|
+
break;
|
|
1075
|
+
case 4:
|
|
1076
|
+
view.setUint32(offset, view.getUint32(offset, false), true);
|
|
1077
|
+
break;
|
|
1078
|
+
case 8:
|
|
1079
|
+
view.setBigUint64(offset, view.getBigUint64(offset, false), true);
|
|
1080
|
+
break;
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
932
1083
|
var NullExporter = class {
|
|
933
1084
|
exportStub(stub) {
|
|
934
1085
|
throw new Error("Cannot serialize RPC stubs without an RPC session.");
|
|
@@ -949,6 +1100,7 @@ async function streamToBlob(stream, type) {
|
|
|
949
1100
|
return b.type === type ? b : b.slice(0, b.size, type);
|
|
950
1101
|
}
|
|
951
1102
|
const ERROR_TYPES = {
|
|
1103
|
+
__proto__: null,
|
|
952
1104
|
Error,
|
|
953
1105
|
EvalError,
|
|
954
1106
|
RangeError,
|
|
@@ -961,12 +1113,14 @@ const ERROR_TYPES = {
|
|
|
961
1113
|
var Devaluator = class Devaluator {
|
|
962
1114
|
exporter;
|
|
963
1115
|
source;
|
|
964
|
-
|
|
1116
|
+
encodingLevel;
|
|
1117
|
+
constructor(exporter, source, encodingLevel) {
|
|
965
1118
|
this.exporter = exporter;
|
|
966
1119
|
this.source = source;
|
|
1120
|
+
this.encodingLevel = encodingLevel;
|
|
967
1121
|
}
|
|
968
|
-
static devaluate(value, parent, exporter = NULL_EXPORTER, source) {
|
|
969
|
-
let devaluator = new Devaluator(exporter, source);
|
|
1122
|
+
static devaluate(value, parent, exporter = NULL_EXPORTER, source, encodingLevel = "string") {
|
|
1123
|
+
let devaluator = new Devaluator(exporter, source, encodingLevel);
|
|
970
1124
|
try {
|
|
971
1125
|
return devaluator.devaluateImpl(value, parent, 0);
|
|
972
1126
|
} catch (err) {
|
|
@@ -978,7 +1132,7 @@ var Devaluator = class Devaluator {
|
|
|
978
1132
|
}
|
|
979
1133
|
exports;
|
|
980
1134
|
devaluateImpl(value, parent, depth) {
|
|
981
|
-
if (depth >=
|
|
1135
|
+
if (depth >= 256) throw new Error("Serialization exceeded maximum allowed depth. (Does the message contain cycles?)");
|
|
982
1136
|
switch (typeForRpc(value)) {
|
|
983
1137
|
case "unsupported": {
|
|
984
1138
|
let msg;
|
|
@@ -989,10 +1143,12 @@ var Devaluator = class Devaluator {
|
|
|
989
1143
|
}
|
|
990
1144
|
throw new TypeError(msg);
|
|
991
1145
|
}
|
|
992
|
-
case "primitive": if (typeof value === "number" && !isFinite(value))
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
1146
|
+
case "primitive": if (typeof value === "number" && !isFinite(value)) {
|
|
1147
|
+
if (this.encodingLevel === "structuredClonable") return value;
|
|
1148
|
+
if (value === Infinity) return ["inf"];
|
|
1149
|
+
else if (value === -Infinity) return ["-inf"];
|
|
1150
|
+
else return ["nan"];
|
|
1151
|
+
} else return value;
|
|
996
1152
|
case "object": {
|
|
997
1153
|
let object = value;
|
|
998
1154
|
let result = {};
|
|
@@ -1006,23 +1162,49 @@ var Devaluator = class Devaluator {
|
|
|
1006
1162
|
for (let i = 0; i < len; i++) result[i] = this.devaluateImpl(array[i], array, depth + 1);
|
|
1007
1163
|
return [result];
|
|
1008
1164
|
}
|
|
1009
|
-
case "bigint":
|
|
1165
|
+
case "bigint":
|
|
1166
|
+
if (this.encodingLevel === "structuredClonable") return value;
|
|
1167
|
+
return ["bigint", value.toString()];
|
|
1010
1168
|
case "date": {
|
|
1169
|
+
if (this.encodingLevel === "structuredClonable") return value;
|
|
1011
1170
|
const time = value.getTime();
|
|
1012
1171
|
return ["date", Number.isNaN(time) ? null : time];
|
|
1013
1172
|
}
|
|
1014
1173
|
case "bytes": {
|
|
1015
|
-
let
|
|
1016
|
-
|
|
1174
|
+
let alternateTypeName = BYTE_CONTAINER_TYPE_BY_PROTOTYPE.get(Object.getPrototypeOf(value));
|
|
1175
|
+
let bytes;
|
|
1176
|
+
if (alternateTypeName === "ArrayBuffer") bytes = new Uint8Array(value);
|
|
1177
|
+
else if (alternateTypeName === void 0) bytes = value;
|
|
1178
|
+
else {
|
|
1179
|
+
let view = value;
|
|
1180
|
+
bytes = new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
|
|
1181
|
+
let elementSize = TYPED_ARRAY_ELEMENT_SIZE[alternateTypeName];
|
|
1182
|
+
if (!NATIVE_LITTLE_ENDIAN && elementSize) {
|
|
1183
|
+
bytes = bytes.slice();
|
|
1184
|
+
swapByteOrder(bytes, elementSize);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
if (this.encodingLevel === "structuredClonable" || this.encodingLevel === "jsonCompatibleWithBytes") return alternateTypeName === void 0 ? ["bytes", bytes] : [
|
|
1188
|
+
"bytes",
|
|
1189
|
+
bytes,
|
|
1190
|
+
alternateTypeName
|
|
1191
|
+
];
|
|
1017
1192
|
let b64;
|
|
1018
|
-
if (
|
|
1193
|
+
if (bytes.toBase64) b64 = bytes.toBase64({ omitPadding: true });
|
|
1194
|
+
else if (typeof Buffer !== "undefined") b64 = (bytes instanceof Buffer ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength)).toString("base64");
|
|
1019
1195
|
else {
|
|
1020
1196
|
let binary = "";
|
|
1021
1197
|
for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
|
|
1022
1198
|
b64 = btoa(binary);
|
|
1023
1199
|
}
|
|
1024
|
-
|
|
1200
|
+
b64 = b64.replace(/=+$/, "");
|
|
1201
|
+
return alternateTypeName === void 0 ? ["bytes", b64] : [
|
|
1202
|
+
"bytes",
|
|
1203
|
+
b64,
|
|
1204
|
+
alternateTypeName
|
|
1205
|
+
];
|
|
1025
1206
|
}
|
|
1207
|
+
case "url": return ["url", value.href];
|
|
1026
1208
|
case "headers": return ["headers", [...value]];
|
|
1027
1209
|
case "request": {
|
|
1028
1210
|
let req = value;
|
|
@@ -1137,7 +1319,9 @@ var Devaluator = class Devaluator {
|
|
|
1137
1319
|
} else if (rewritten && rewritten.stack) result.push(rewritten.stack);
|
|
1138
1320
|
return result;
|
|
1139
1321
|
}
|
|
1140
|
-
case "undefined":
|
|
1322
|
+
case "undefined":
|
|
1323
|
+
if (this.encodingLevel === "structuredClonable") return;
|
|
1324
|
+
return ["undefined"];
|
|
1141
1325
|
case "stub":
|
|
1142
1326
|
case "rpc-promise": {
|
|
1143
1327
|
if (!this.source) throw new Error("Can't serialize RPC stubs in this context.");
|
|
@@ -1204,6 +1388,9 @@ var NullImporter = class {
|
|
|
1204
1388
|
getPipeReadable(exportId) {
|
|
1205
1389
|
throw new Error("Cannot retrieve pipe readable without an RPC session.");
|
|
1206
1390
|
}
|
|
1391
|
+
getLimits() {
|
|
1392
|
+
return DEFAULT_LIMITS;
|
|
1393
|
+
}
|
|
1207
1394
|
};
|
|
1208
1395
|
const NULL_IMPORTER = new NullImporter();
|
|
1209
1396
|
function fixBrokenRequestBody(request, body) {
|
|
@@ -1220,15 +1407,22 @@ function streamToBlobPromise(stream, type) {
|
|
|
1220
1407
|
}
|
|
1221
1408
|
var Evaluator = class Evaluator {
|
|
1222
1409
|
importer;
|
|
1223
|
-
|
|
1410
|
+
encodingLevel;
|
|
1411
|
+
limits;
|
|
1412
|
+
constructor(importer, encodingLevel = "string") {
|
|
1224
1413
|
this.importer = importer;
|
|
1414
|
+
this.encodingLevel = encodingLevel;
|
|
1415
|
+
this.limits = importer.getLimits();
|
|
1225
1416
|
}
|
|
1226
1417
|
hooks = [];
|
|
1227
1418
|
promises = [];
|
|
1228
1419
|
evaluate(value) {
|
|
1420
|
+
return this.evaluateWithDepth(value, 0);
|
|
1421
|
+
}
|
|
1422
|
+
evaluateWithDepth(value, depth) {
|
|
1229
1423
|
let payload = RpcPayload.forEvaluate(this.hooks, this.promises);
|
|
1230
1424
|
try {
|
|
1231
|
-
payload.value = this.evaluateImpl(value, payload, "value");
|
|
1425
|
+
payload.value = this.evaluateImpl(value, payload, "value", depth);
|
|
1232
1426
|
return payload;
|
|
1233
1427
|
} catch (err) {
|
|
1234
1428
|
payload.dispose();
|
|
@@ -1238,31 +1432,70 @@ var Evaluator = class Evaluator {
|
|
|
1238
1432
|
evaluateCopy(value) {
|
|
1239
1433
|
return this.evaluate(structuredClone(value));
|
|
1240
1434
|
}
|
|
1241
|
-
evaluateImpl(value, parent, property) {
|
|
1435
|
+
evaluateImpl(value, parent, property, depth) {
|
|
1436
|
+
let maxDepth = this.limits.maxDepth;
|
|
1437
|
+
if (depth >= maxDepth) throw new TypeError(`Deserialization exceeded maximum allowed message depth of ${maxDepth}.`);
|
|
1438
|
+
if (this.encodingLevel === "structuredClonable") {
|
|
1439
|
+
if (value instanceof Date || typeof value === "bigint") return value;
|
|
1440
|
+
}
|
|
1242
1441
|
if (value instanceof Array) {
|
|
1243
1442
|
if (value.length == 1 && value[0] instanceof Array) {
|
|
1244
1443
|
let result = value[0];
|
|
1245
|
-
for (let i = 0; i < result.length; i++) result[i] = this.evaluateImpl(result[i], result, i);
|
|
1444
|
+
for (let i = 0; i < result.length; i++) result[i] = this.evaluateImpl(result[i], result, i, depth + 1);
|
|
1246
1445
|
return result;
|
|
1247
1446
|
} else switch (value[0]) {
|
|
1248
1447
|
case "bigint":
|
|
1249
|
-
if (typeof value[1] == "string")
|
|
1448
|
+
if (typeof value[1] == "string") {
|
|
1449
|
+
let digits = value[1];
|
|
1450
|
+
let maxBigIntDigits = this.limits.maxBigIntDigits;
|
|
1451
|
+
if (digits.length > maxBigIntDigits) throw new TypeError(`Deserialized bigint exceeds maximum length of ${maxBigIntDigits} digits.`);
|
|
1452
|
+
return BigInt(digits);
|
|
1453
|
+
}
|
|
1250
1454
|
break;
|
|
1251
1455
|
case "date":
|
|
1252
1456
|
if (value[1] === null) return /* @__PURE__ */ new Date(NaN);
|
|
1253
1457
|
if (typeof value[1] == "number") return new Date(value[1]);
|
|
1254
1458
|
break;
|
|
1255
|
-
case "bytes":
|
|
1256
|
-
|
|
1257
|
-
|
|
1459
|
+
case "bytes": {
|
|
1460
|
+
let bytes;
|
|
1461
|
+
if (value[1] instanceof Uint8Array) bytes = value[1];
|
|
1462
|
+
else if (typeof value[1] == "string") if (typeof Buffer !== "undefined") bytes = Buffer.from(value[1], "base64");
|
|
1463
|
+
else if (Uint8Array.fromBase64) bytes = Uint8Array.fromBase64(value[1]);
|
|
1258
1464
|
else {
|
|
1259
1465
|
let bs = atob(value[1]);
|
|
1260
1466
|
let len = bs.length;
|
|
1261
|
-
|
|
1467
|
+
bytes = new Uint8Array(len);
|
|
1262
1468
|
for (let i = 0; i < len; i++) bytes[i] = bs.charCodeAt(i);
|
|
1263
|
-
return bytes;
|
|
1264
1469
|
}
|
|
1265
|
-
break;
|
|
1470
|
+
else break;
|
|
1471
|
+
if (value.length === 2) return bytes;
|
|
1472
|
+
if (typeof value[2] !== "string") throw new TypeError(`Unknown bytes type marker type: ${typeof value[2]}`);
|
|
1473
|
+
if (!isValidByteContainerName(value[2])) {
|
|
1474
|
+
let marker = value[2].slice(0, 64);
|
|
1475
|
+
throw new TypeError(`Unknown bytes type marker: ${marker}`);
|
|
1476
|
+
}
|
|
1477
|
+
let marker = value[2];
|
|
1478
|
+
let elementSize = TYPED_ARRAY_ELEMENT_SIZE[marker];
|
|
1479
|
+
if (elementSize !== void 0 && bytes.byteLength % elementSize !== 0) throw new TypeError(`Invalid byte length ${bytes.byteLength} for ${marker}; expected a multiple of ${elementSize}`);
|
|
1480
|
+
let buffer = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
1481
|
+
if (!NATIVE_LITTLE_ENDIAN && elementSize !== void 0) swapByteOrder(new Uint8Array(buffer), elementSize);
|
|
1482
|
+
switch (marker) {
|
|
1483
|
+
case "ArrayBuffer": return buffer;
|
|
1484
|
+
case "DataView": return new DataView(buffer);
|
|
1485
|
+
case "Int8Array": return new Int8Array(buffer);
|
|
1486
|
+
case "Uint8Array": return new Uint8Array(buffer);
|
|
1487
|
+
case "Uint8ClampedArray": return new Uint8ClampedArray(buffer);
|
|
1488
|
+
case "Int16Array": return new Int16Array(buffer);
|
|
1489
|
+
case "Uint16Array": return new Uint16Array(buffer);
|
|
1490
|
+
case "Int32Array": return new Int32Array(buffer);
|
|
1491
|
+
case "Uint32Array": return new Uint32Array(buffer);
|
|
1492
|
+
case "BigInt64Array": return new BigInt64Array(buffer);
|
|
1493
|
+
case "BigUint64Array": return new BigUint64Array(buffer);
|
|
1494
|
+
case "Float32Array": return new Float32Array(buffer);
|
|
1495
|
+
case "Float64Array": return new Float64Array(buffer);
|
|
1496
|
+
default:
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1266
1499
|
case "error":
|
|
1267
1500
|
if (value.length >= 3 && typeof value[1] === "string" && typeof value[2] === "string") {
|
|
1268
1501
|
let cls = ERROR_TYPES[value[1]] || Error;
|
|
@@ -1275,7 +1508,11 @@ var Evaluator = class Evaluator {
|
|
|
1275
1508
|
let propsObj = props;
|
|
1276
1509
|
for (let key of Object.keys(propsObj)) {
|
|
1277
1510
|
if (key === "name" || key === "message" || key === "stack") continue;
|
|
1278
|
-
|
|
1511
|
+
if (key in Object.prototype || key === "toJSON") {
|
|
1512
|
+
this.evaluateImpl(propsObj[key], result, key, depth + 1);
|
|
1513
|
+
continue;
|
|
1514
|
+
}
|
|
1515
|
+
anyResult[key] = this.evaluateImpl(propsObj[key], result, key, depth + 1);
|
|
1279
1516
|
}
|
|
1280
1517
|
}
|
|
1281
1518
|
return result;
|
|
@@ -1287,6 +1524,9 @@ var Evaluator = class Evaluator {
|
|
|
1287
1524
|
case "inf": return Infinity;
|
|
1288
1525
|
case "-inf": return -Infinity;
|
|
1289
1526
|
case "nan": return NaN;
|
|
1527
|
+
case "url":
|
|
1528
|
+
if (value.length === 2 && typeof value[1] === "string") return new URL(value[1]);
|
|
1529
|
+
break;
|
|
1290
1530
|
case "headers":
|
|
1291
1531
|
if (value.length === 2 && value[1] instanceof Array) return new Headers(value[1]);
|
|
1292
1532
|
break;
|
|
@@ -1296,11 +1536,11 @@ var Evaluator = class Evaluator {
|
|
|
1296
1536
|
let init = value[2];
|
|
1297
1537
|
if (typeof init !== "object" || init === null) break;
|
|
1298
1538
|
if (init.body) {
|
|
1299
|
-
init.body = this.evaluateImpl(init.body, init, "body");
|
|
1539
|
+
init.body = this.evaluateImpl(init.body, init, "body", depth + 1);
|
|
1300
1540
|
if (init.body === null || typeof init.body === "string" || init.body instanceof Uint8Array || init.body instanceof ReadableStream) {} else throw new TypeError("Request body must be of type ReadableStream.");
|
|
1301
1541
|
}
|
|
1302
1542
|
if (init.signal) {
|
|
1303
|
-
init.signal = this.evaluateImpl(init.signal, init, "signal");
|
|
1543
|
+
init.signal = this.evaluateImpl(init.signal, init, "signal", depth + 1);
|
|
1304
1544
|
if (!(init.signal instanceof AbortSignal)) throw new TypeError("Request siganl must be of type AbortSignal.");
|
|
1305
1545
|
}
|
|
1306
1546
|
if (init.headers && !(init.headers instanceof Array)) throw new TypeError("Request headers must be serialized as an array of pairs.");
|
|
@@ -1317,7 +1557,7 @@ var Evaluator = class Evaluator {
|
|
|
1317
1557
|
}
|
|
1318
1558
|
case "response": {
|
|
1319
1559
|
if (value.length !== 3) break;
|
|
1320
|
-
let body = this.evaluateImpl(value[1], parent, property);
|
|
1560
|
+
let body = this.evaluateImpl(value[1], parent, property, depth + 1);
|
|
1321
1561
|
if (body === null || typeof body === "string" || body instanceof Uint8Array || body instanceof ReadableStream) {} else throw new TypeError("Response body must be of type ReadableStream.");
|
|
1322
1562
|
let init = value[2];
|
|
1323
1563
|
if (typeof init !== "object" || init === null) break;
|
|
@@ -1328,7 +1568,7 @@ var Evaluator = class Evaluator {
|
|
|
1328
1568
|
case "blob": {
|
|
1329
1569
|
if (value.length !== 3 || typeof value[1] !== "string") break;
|
|
1330
1570
|
let contentType = value[1];
|
|
1331
|
-
let content = this.evaluateImpl(value[2], parent, property);
|
|
1571
|
+
let content = this.evaluateImpl(value[2], parent, property, depth + 1);
|
|
1332
1572
|
if (!(content instanceof ReadableStream)) throw new TypeError("Blob content must be serialized as a ReadableStream.");
|
|
1333
1573
|
let promise = streamToBlobPromise(content, contentType);
|
|
1334
1574
|
this.promises.push({
|
|
@@ -1369,7 +1609,7 @@ var Evaluator = class Evaluator {
|
|
|
1369
1609
|
if (value.length == 3) return addStub(hook.get(path));
|
|
1370
1610
|
let args = value[3];
|
|
1371
1611
|
if (!(args instanceof Array)) break;
|
|
1372
|
-
args = new Evaluator(this.importer).
|
|
1612
|
+
args = new Evaluator(this.importer).evaluateWithDepth([args], depth);
|
|
1373
1613
|
return addStub(hook.call(path, args));
|
|
1374
1614
|
}
|
|
1375
1615
|
case "remap": {
|
|
@@ -1435,9 +1675,9 @@ var Evaluator = class Evaluator {
|
|
|
1435
1675
|
} else if (value instanceof Object) {
|
|
1436
1676
|
let result = value;
|
|
1437
1677
|
for (let key in result) if (key in Object.prototype || key === "toJSON") {
|
|
1438
|
-
this.evaluateImpl(result[key], result, key);
|
|
1678
|
+
this.evaluateImpl(result[key], result, key, depth + 1);
|
|
1439
1679
|
delete result[key];
|
|
1440
|
-
} else result[key] = this.evaluateImpl(result[key], result, key);
|
|
1680
|
+
} else result[key] = this.evaluateImpl(result[key], result, key, depth + 1);
|
|
1441
1681
|
return result;
|
|
1442
1682
|
} else return value;
|
|
1443
1683
|
}
|
|
@@ -1453,6 +1693,47 @@ function deserialize(value) {
|
|
|
1453
1693
|
|
|
1454
1694
|
//#endregion
|
|
1455
1695
|
//#region src/rpc.ts
|
|
1696
|
+
const ESTIMATED_OBJECT_OVERHEAD = 16;
|
|
1697
|
+
const ESTIMATED_ENTRY_OVERHEAD = 8;
|
|
1698
|
+
const ESTIMATED_BINARY_OVERHEAD = 16;
|
|
1699
|
+
const MAX_ESTIMATE_DEPTH = 64;
|
|
1700
|
+
function estimateStringSize(value) {
|
|
1701
|
+
return 2 + value.length * 3;
|
|
1702
|
+
}
|
|
1703
|
+
function estimateEncodedSize(value, seen, depth = 0) {
|
|
1704
|
+
if (depth >= MAX_ESTIMATE_DEPTH) return ESTIMATED_ENTRY_OVERHEAD;
|
|
1705
|
+
switch (typeof value) {
|
|
1706
|
+
case "string": return estimateStringSize(value);
|
|
1707
|
+
case "number": return 16;
|
|
1708
|
+
case "bigint": return 16;
|
|
1709
|
+
case "boolean": return 8;
|
|
1710
|
+
case "undefined": return 16;
|
|
1711
|
+
case "object": {
|
|
1712
|
+
if (value === null) return 8;
|
|
1713
|
+
if (ArrayBuffer.isView(value)) return ESTIMATED_BINARY_OVERHEAD + value.byteLength;
|
|
1714
|
+
if (value instanceof ArrayBuffer) return ESTIMATED_BINARY_OVERHEAD + value.byteLength;
|
|
1715
|
+
if (typeof Blob !== "undefined" && value instanceof Blob) return ESTIMATED_BINARY_OVERHEAD + value.size;
|
|
1716
|
+
if (value instanceof Date) return 16;
|
|
1717
|
+
seen ??= /* @__PURE__ */ new WeakSet();
|
|
1718
|
+
if (seen.has(value)) return ESTIMATED_ENTRY_OVERHEAD;
|
|
1719
|
+
seen.add(value);
|
|
1720
|
+
if (value instanceof Array) {
|
|
1721
|
+
let size = ESTIMATED_OBJECT_OVERHEAD;
|
|
1722
|
+
for (let item of value) size += ESTIMATED_ENTRY_OVERHEAD + estimateEncodedSize(item, seen, depth + 1);
|
|
1723
|
+
return size;
|
|
1724
|
+
}
|
|
1725
|
+
if (value instanceof Error) {
|
|
1726
|
+
let size = ESTIMATED_OBJECT_OVERHEAD + estimateStringSize(value.name) + estimateStringSize(value.message) + estimateStringSize(value.stack ?? "");
|
|
1727
|
+
for (let key of Object.keys(value)) size += ESTIMATED_ENTRY_OVERHEAD + estimateStringSize(key) + estimateEncodedSize(value[key], seen, depth + 1);
|
|
1728
|
+
return size;
|
|
1729
|
+
}
|
|
1730
|
+
let size = ESTIMATED_OBJECT_OVERHEAD;
|
|
1731
|
+
for (let key of Object.keys(value)) size += ESTIMATED_ENTRY_OVERHEAD + estimateStringSize(key) + estimateEncodedSize(value[key], seen, depth + 1);
|
|
1732
|
+
return size;
|
|
1733
|
+
}
|
|
1734
|
+
default: return 16;
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1456
1737
|
var ImportTableEntry = class {
|
|
1457
1738
|
session;
|
|
1458
1739
|
importId;
|
|
@@ -1545,24 +1826,28 @@ var RpcImportHook = class RpcImportHook extends StubHook {
|
|
|
1545
1826
|
if (this.entry) return this.entry;
|
|
1546
1827
|
else throw new Error("This RpcImportHook was already disposed.");
|
|
1547
1828
|
}
|
|
1829
|
+
getEntryTakingOwnership(disposeOwned) {
|
|
1830
|
+
try {
|
|
1831
|
+
return this.getEntry();
|
|
1832
|
+
} catch (err) {
|
|
1833
|
+
disposeOwned();
|
|
1834
|
+
throw err;
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1548
1837
|
call(path, args) {
|
|
1549
|
-
let entry = this.
|
|
1838
|
+
let entry = this.getEntryTakingOwnership(() => args.dispose());
|
|
1550
1839
|
if (entry.resolution) return entry.resolution.call(path, args);
|
|
1551
1840
|
else return entry.session.sendCall(entry.importId, path, args);
|
|
1552
1841
|
}
|
|
1553
1842
|
stream(path, args) {
|
|
1554
|
-
let entry = this.
|
|
1843
|
+
let entry = this.getEntryTakingOwnership(() => args.dispose());
|
|
1555
1844
|
if (entry.resolution) return entry.resolution.stream(path, args);
|
|
1556
1845
|
else return entry.session.sendStream(entry.importId, path, args);
|
|
1557
1846
|
}
|
|
1558
1847
|
map(path, captures, instructions) {
|
|
1559
|
-
let entry
|
|
1560
|
-
try {
|
|
1561
|
-
entry = this.getEntry();
|
|
1562
|
-
} catch (err) {
|
|
1848
|
+
let entry = this.getEntryTakingOwnership(() => {
|
|
1563
1849
|
for (let cap of captures) cap.dispose();
|
|
1564
|
-
|
|
1565
|
-
}
|
|
1850
|
+
});
|
|
1566
1851
|
if (entry.resolution) return entry.resolution.map(path, captures, instructions);
|
|
1567
1852
|
else return entry.session.sendMap(entry.importId, path, captures, instructions);
|
|
1568
1853
|
}
|
|
@@ -1618,9 +1903,24 @@ var RpcSessionImpl = class {
|
|
|
1618
1903
|
onBatchDone;
|
|
1619
1904
|
pullCount = 0;
|
|
1620
1905
|
onBrokenCallbacks = [];
|
|
1906
|
+
encodingLevel;
|
|
1907
|
+
limits;
|
|
1621
1908
|
constructor(transport, mainHook, options) {
|
|
1622
1909
|
this.transport = transport;
|
|
1623
1910
|
this.options = options;
|
|
1911
|
+
let level = "string";
|
|
1912
|
+
if ("encodingLevel" in transport) {
|
|
1913
|
+
let raw = transport.encodingLevel;
|
|
1914
|
+
if (raw !== void 0) {
|
|
1915
|
+
if (raw !== "string" && raw !== "jsonCompatible" && raw !== "jsonCompatibleWithBytes" && raw !== "structuredClonable") throw new TypeError(`Unknown transport encodingLevel: ${String(raw)}`);
|
|
1916
|
+
level = raw;
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
this.encodingLevel = level;
|
|
1920
|
+
this.limits = {
|
|
1921
|
+
...DEFAULT_LIMITS,
|
|
1922
|
+
...options.limits
|
|
1923
|
+
};
|
|
1624
1924
|
this.exports.push({
|
|
1625
1925
|
hook: mainHook,
|
|
1626
1926
|
refcount: 1
|
|
@@ -1701,7 +2001,7 @@ var RpcSessionImpl = class {
|
|
|
1701
2001
|
let autoRelease = exp.autoRelease;
|
|
1702
2002
|
++this.pullCount;
|
|
1703
2003
|
exp.pull = resolve().then((payload) => {
|
|
1704
|
-
let value = Devaluator.devaluate(payload.value, void 0, this, payload);
|
|
2004
|
+
let value = Devaluator.devaluate(payload.value, void 0, this, payload, this.encodingLevel);
|
|
1705
2005
|
this.send([
|
|
1706
2006
|
"resolve",
|
|
1707
2007
|
exportId,
|
|
@@ -1712,7 +2012,7 @@ var RpcSessionImpl = class {
|
|
|
1712
2012
|
this.send([
|
|
1713
2013
|
"reject",
|
|
1714
2014
|
exportId,
|
|
1715
|
-
Devaluator.devaluate(error, void 0, this)
|
|
2015
|
+
Devaluator.devaluate(error, void 0, this, void 0, this.encodingLevel)
|
|
1716
2016
|
]);
|
|
1717
2017
|
if (autoRelease) this.releaseExport(exportId, 1);
|
|
1718
2018
|
}).catch((error) => {
|
|
@@ -1720,7 +2020,7 @@ var RpcSessionImpl = class {
|
|
|
1720
2020
|
this.send([
|
|
1721
2021
|
"reject",
|
|
1722
2022
|
exportId,
|
|
1723
|
-
Devaluator.devaluate(error, void 0, this)
|
|
2023
|
+
Devaluator.devaluate(error, void 0, this, void 0, this.encodingLevel)
|
|
1724
2024
|
]);
|
|
1725
2025
|
if (autoRelease) this.releaseExport(exportId, 1);
|
|
1726
2026
|
} catch (error2) {
|
|
@@ -1763,6 +2063,9 @@ var RpcSessionImpl = class {
|
|
|
1763
2063
|
entry.pipeReadable = void 0;
|
|
1764
2064
|
return readable;
|
|
1765
2065
|
}
|
|
2066
|
+
getLimits() {
|
|
2067
|
+
return this.limits;
|
|
2068
|
+
}
|
|
1766
2069
|
createPipe(readable, readableHook) {
|
|
1767
2070
|
if (this.abortReason) throw this.abortReason;
|
|
1768
2071
|
this.send(["pipe"]);
|
|
@@ -1776,27 +2079,52 @@ var RpcSessionImpl = class {
|
|
|
1776
2079
|
}
|
|
1777
2080
|
send(msg) {
|
|
1778
2081
|
if (this.abortReason !== void 0) return 0;
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
msgText = JSON.stringify(msg);
|
|
1782
|
-
} catch (err) {
|
|
2082
|
+
if (this.encodingLevel === "string") {
|
|
2083
|
+
let msgText;
|
|
1783
2084
|
try {
|
|
1784
|
-
|
|
1785
|
-
} catch (
|
|
1786
|
-
|
|
2085
|
+
msgText = JSON.stringify(msg);
|
|
2086
|
+
} catch (err) {
|
|
2087
|
+
try {
|
|
2088
|
+
this.abort(err);
|
|
2089
|
+
} catch (err2) {}
|
|
2090
|
+
throw err;
|
|
2091
|
+
}
|
|
2092
|
+
try {
|
|
2093
|
+
let sent = this.transport.send(msgText);
|
|
2094
|
+
if (sent !== void 0 && typeof sent.catch === "function") sent.catch((err) => this.abort(err, false));
|
|
2095
|
+
} catch (err) {
|
|
2096
|
+
queueMicrotask(() => this.abort(err, false));
|
|
2097
|
+
}
|
|
2098
|
+
return msgText.length;
|
|
2099
|
+
} else try {
|
|
2100
|
+
let size = this.transport.send(msg);
|
|
2101
|
+
if (typeof size === "number") return size;
|
|
2102
|
+
let thenable = size;
|
|
2103
|
+
if (thenable && typeof thenable.then === "function") Promise.resolve(thenable).catch((err) => this.abort(err, false));
|
|
2104
|
+
return;
|
|
2105
|
+
} catch (err) {
|
|
2106
|
+
queueMicrotask(() => this.abort(err, false));
|
|
2107
|
+
return;
|
|
1787
2108
|
}
|
|
1788
|
-
this.transport.send(msgText).catch((err) => this.abort(err, false));
|
|
1789
|
-
return msgText.length;
|
|
1790
2109
|
}
|
|
1791
2110
|
sendCall(id, path, args) {
|
|
1792
|
-
if (this.abortReason)
|
|
2111
|
+
if (this.abortReason) {
|
|
2112
|
+
args?.dispose();
|
|
2113
|
+
throw this.abortReason;
|
|
2114
|
+
}
|
|
1793
2115
|
let value = [
|
|
1794
2116
|
"pipeline",
|
|
1795
2117
|
id,
|
|
1796
2118
|
path
|
|
1797
2119
|
];
|
|
1798
2120
|
if (args) {
|
|
1799
|
-
let devalue
|
|
2121
|
+
let devalue;
|
|
2122
|
+
try {
|
|
2123
|
+
devalue = Devaluator.devaluate(args.value, void 0, this, args, this.encodingLevel);
|
|
2124
|
+
} catch (err) {
|
|
2125
|
+
args.dispose();
|
|
2126
|
+
throw err;
|
|
2127
|
+
}
|
|
1800
2128
|
value.push(devalue[0]);
|
|
1801
2129
|
}
|
|
1802
2130
|
this.send(["push", value]);
|
|
@@ -1805,15 +2133,26 @@ var RpcSessionImpl = class {
|
|
|
1805
2133
|
return new RpcImportHook(true, entry);
|
|
1806
2134
|
}
|
|
1807
2135
|
sendStream(id, path, args) {
|
|
1808
|
-
if (this.abortReason)
|
|
2136
|
+
if (this.abortReason) {
|
|
2137
|
+
args.dispose();
|
|
2138
|
+
throw this.abortReason;
|
|
2139
|
+
}
|
|
1809
2140
|
let value = [
|
|
1810
2141
|
"pipeline",
|
|
1811
2142
|
id,
|
|
1812
2143
|
path
|
|
1813
2144
|
];
|
|
1814
|
-
let devalue
|
|
2145
|
+
let devalue;
|
|
2146
|
+
try {
|
|
2147
|
+
devalue = Devaluator.devaluate(args.value, void 0, this, args, this.encodingLevel);
|
|
2148
|
+
} catch (err) {
|
|
2149
|
+
args.dispose();
|
|
2150
|
+
throw err;
|
|
2151
|
+
}
|
|
1815
2152
|
value.push(devalue[0]);
|
|
1816
|
-
let
|
|
2153
|
+
let msg = ["stream", value];
|
|
2154
|
+
let size = this.send(msg);
|
|
2155
|
+
if (size === void 0) size = estimateEncodedSize(msg);
|
|
1817
2156
|
let importId = this.imports.length;
|
|
1818
2157
|
let entry = new ImportTableEntry(this, importId, true);
|
|
1819
2158
|
entry.remoteRefcount = 0;
|
|
@@ -1869,7 +2208,14 @@ var RpcSessionImpl = class {
|
|
|
1869
2208
|
this.cancelReadLoop?.(error);
|
|
1870
2209
|
this.cancelReadLoop = void 0;
|
|
1871
2210
|
if (trySendAbortMessage) try {
|
|
1872
|
-
|
|
2211
|
+
let abortMsg = ["abort", Devaluator.devaluate(error, void 0, this, void 0, this.encodingLevel)];
|
|
2212
|
+
if (this.encodingLevel === "string") {
|
|
2213
|
+
let sent = this.transport.send(JSON.stringify(abortMsg));
|
|
2214
|
+
if (sent !== void 0 && typeof sent.catch === "function") sent.catch((err) => {});
|
|
2215
|
+
} else {
|
|
2216
|
+
let result = this.transport.send(abortMsg);
|
|
2217
|
+
if (result && typeof result.then === "function") Promise.resolve(result).catch((err) => {});
|
|
2218
|
+
}
|
|
1873
2219
|
} catch (err) {}
|
|
1874
2220
|
if (error === void 0) error = "undefined";
|
|
1875
2221
|
this.abortReason = error;
|
|
@@ -1891,18 +2237,19 @@ var RpcSessionImpl = class {
|
|
|
1891
2237
|
while (!this.abortReason) {
|
|
1892
2238
|
let readCanceled = Promise.withResolvers();
|
|
1893
2239
|
this.cancelReadLoop = readCanceled.reject;
|
|
1894
|
-
let
|
|
2240
|
+
let raw;
|
|
1895
2241
|
try {
|
|
1896
|
-
|
|
2242
|
+
raw = await Promise.race([this.transport.receive(), readCanceled.promise]);
|
|
1897
2243
|
} finally {
|
|
1898
2244
|
if (this.cancelReadLoop === readCanceled.reject) this.cancelReadLoop = void 0;
|
|
1899
2245
|
}
|
|
1900
|
-
|
|
2246
|
+
if (this.encodingLevel === "string" && raw.length > this.limits.maxMessageSize) throw new TypeError(`Incoming message exceeds maximum size of ${this.limits.maxMessageSize} UTF-16 code units.`);
|
|
1901
2247
|
if (this.abortReason) break;
|
|
2248
|
+
let msg = this.encodingLevel === "string" ? JSON.parse(raw) : raw;
|
|
1902
2249
|
if (msg instanceof Array) switch (msg[0]) {
|
|
1903
2250
|
case "push":
|
|
1904
2251
|
if (msg.length > 1) {
|
|
1905
|
-
let hook = new PayloadStubHook(new Evaluator(this).evaluate(msg[1]));
|
|
2252
|
+
let hook = new PayloadStubHook(new Evaluator(this, this.encodingLevel).evaluate(msg[1]));
|
|
1906
2253
|
hook.ignoreUnhandledRejections();
|
|
1907
2254
|
this.exports.push({
|
|
1908
2255
|
hook,
|
|
@@ -1913,7 +2260,7 @@ var RpcSessionImpl = class {
|
|
|
1913
2260
|
break;
|
|
1914
2261
|
case "stream":
|
|
1915
2262
|
if (msg.length > 1) {
|
|
1916
|
-
let hook = new PayloadStubHook(new Evaluator(this).evaluate(msg[1]));
|
|
2263
|
+
let hook = new PayloadStubHook(new Evaluator(this, this.encodingLevel).evaluate(msg[1]));
|
|
1917
2264
|
hook.ignoreUnhandledRejections();
|
|
1918
2265
|
let exportId = this.exports.length;
|
|
1919
2266
|
this.exports.push({
|
|
@@ -1948,13 +2295,13 @@ var RpcSessionImpl = class {
|
|
|
1948
2295
|
let importId = msg[1];
|
|
1949
2296
|
if (typeof importId == "number" && msg.length > 2) {
|
|
1950
2297
|
let imp = this.imports[importId];
|
|
1951
|
-
if (imp) if (msg[0] == "resolve") imp.resolve(new PayloadStubHook(new Evaluator(this).evaluate(msg[2])));
|
|
2298
|
+
if (imp) if (msg[0] == "resolve") imp.resolve(new PayloadStubHook(new Evaluator(this, this.encodingLevel).evaluate(msg[2])));
|
|
1952
2299
|
else {
|
|
1953
|
-
let payload = new Evaluator(this).evaluate(msg[2]);
|
|
2300
|
+
let payload = new Evaluator(this, this.encodingLevel).evaluate(msg[2]);
|
|
1954
2301
|
payload.dispose();
|
|
1955
2302
|
imp.resolve(new ErrorStubHook(payload.value));
|
|
1956
2303
|
}
|
|
1957
|
-
else if (msg[0] == "resolve") new Evaluator(this).evaluate(msg[2]).dispose();
|
|
2304
|
+
else if (msg[0] == "resolve") new Evaluator(this, this.encodingLevel).evaluate(msg[2]).dispose();
|
|
1958
2305
|
continue;
|
|
1959
2306
|
}
|
|
1960
2307
|
break;
|
|
@@ -1969,9 +2316,9 @@ var RpcSessionImpl = class {
|
|
|
1969
2316
|
break;
|
|
1970
2317
|
}
|
|
1971
2318
|
case "abort": {
|
|
1972
|
-
let payload = new Evaluator(this).evaluate(msg[1]);
|
|
2319
|
+
let payload = new Evaluator(this, this.encodingLevel).evaluate(msg[1]);
|
|
1973
2320
|
payload.dispose();
|
|
1974
|
-
this.abort(payload, false);
|
|
2321
|
+
this.abort(payload.value, false);
|
|
1975
2322
|
break;
|
|
1976
2323
|
}
|
|
1977
2324
|
}
|
|
@@ -2022,6 +2369,8 @@ var RpcSession$1 = class {
|
|
|
2022
2369
|
|
|
2023
2370
|
//#endregion
|
|
2024
2371
|
//#region src/websocket.ts
|
|
2372
|
+
/** Close-frame reason max UTF-8 bytes: 125 payload - 2-byte status (RFC 6455 section 5.5). */
|
|
2373
|
+
const MAX_CLOSE_REASON_BYTES = 123;
|
|
2025
2374
|
function newWebSocketRpcSession$1(webSocket, localMain, options) {
|
|
2026
2375
|
if (typeof webSocket === "string") webSocket = new WebSocket(webSocket);
|
|
2027
2376
|
return new RpcSession$1(new WebSocketTransport(webSocket), localMain, options).getRemoteMain();
|
|
@@ -2041,9 +2390,14 @@ function newWorkersWebSocketRpcResponse(request, localMain, options) {
|
|
|
2041
2390
|
webSocket: pair[1]
|
|
2042
2391
|
});
|
|
2043
2392
|
}
|
|
2393
|
+
/**
|
|
2394
|
+
* Generic WebSocket transport. Default `T = string` is backward-compatible and satisfies
|
|
2395
|
+
* `RpcTransport`. Use `T = ArrayBuffer` as a building block for binary transports.
|
|
2396
|
+
*/
|
|
2044
2397
|
var WebSocketTransport = class {
|
|
2045
2398
|
constructor(webSocket) {
|
|
2046
2399
|
this.#webSocket = webSocket;
|
|
2400
|
+
webSocket.binaryType = "arraybuffer";
|
|
2047
2401
|
if (webSocket.readyState === WebSocket.CONNECTING) {
|
|
2048
2402
|
this.#sendQueue = [];
|
|
2049
2403
|
webSocket.addEventListener("open", (event) => {
|
|
@@ -2056,12 +2410,12 @@ var WebSocketTransport = class {
|
|
|
2056
2410
|
});
|
|
2057
2411
|
}
|
|
2058
2412
|
webSocket.addEventListener("message", (event) => {
|
|
2059
|
-
if (this.#error) {} else if (typeof event.data === "string") if (this.#receiveResolver) {
|
|
2413
|
+
if (this.#error) {} else if (typeof event.data === "string" || event.data instanceof ArrayBuffer) if (this.#receiveResolver) {
|
|
2060
2414
|
this.#receiveResolver(event.data);
|
|
2061
2415
|
this.#receiveResolver = void 0;
|
|
2062
2416
|
this.#receiveRejecter = void 0;
|
|
2063
2417
|
} else this.#receiveQueue.push(event.data);
|
|
2064
|
-
else this.#receivedError(/* @__PURE__ */ new TypeError("Received
|
|
2418
|
+
else this.#receivedError(/* @__PURE__ */ new TypeError("Received unexpected message type from WebSocket."));
|
|
2065
2419
|
});
|
|
2066
2420
|
webSocket.addEventListener("close", (event) => {
|
|
2067
2421
|
this.#receivedError(/* @__PURE__ */ new Error(`Peer closed WebSocket: ${event.code} ${event.reason}`));
|
|
@@ -2076,13 +2430,13 @@ var WebSocketTransport = class {
|
|
|
2076
2430
|
#receiveRejecter;
|
|
2077
2431
|
#receiveQueue = [];
|
|
2078
2432
|
#error;
|
|
2079
|
-
|
|
2433
|
+
send(message) {
|
|
2080
2434
|
if (this.#sendQueue === void 0) this.#webSocket.send(message);
|
|
2081
2435
|
else this.#sendQueue.push(message);
|
|
2082
2436
|
}
|
|
2083
|
-
|
|
2084
|
-
if (this.#receiveQueue.length > 0) return this.#receiveQueue.shift();
|
|
2085
|
-
else if (this.#error)
|
|
2437
|
+
receive() {
|
|
2438
|
+
if (this.#receiveQueue.length > 0) return Promise.resolve(this.#receiveQueue.shift());
|
|
2439
|
+
else if (this.#error) return Promise.reject(this.#error);
|
|
2086
2440
|
else return new Promise((resolve, reject) => {
|
|
2087
2441
|
this.#receiveResolver = resolve;
|
|
2088
2442
|
this.#receiveRejecter = reject;
|
|
@@ -2092,6 +2446,8 @@ var WebSocketTransport = class {
|
|
|
2092
2446
|
let message;
|
|
2093
2447
|
if (reason instanceof Error) message = reason.message;
|
|
2094
2448
|
else message = `${reason}`;
|
|
2449
|
+
let reasonBytes = new TextEncoder().encode(message);
|
|
2450
|
+
if (reasonBytes.length > 123) message = new TextDecoder().decode(reasonBytes.subarray(0, 123), { stream: true });
|
|
2095
2451
|
this.#webSocket.close(3e3, message);
|
|
2096
2452
|
if (!this.#error) this.#error = reason;
|
|
2097
2453
|
}
|
|
@@ -2109,6 +2465,7 @@ var WebSocketTransport = class {
|
|
|
2109
2465
|
|
|
2110
2466
|
//#endregion
|
|
2111
2467
|
//#region src/batch.ts
|
|
2468
|
+
const yieldToMacrotask = typeof setImmediate === "function" ? () => new Promise((resolve) => setImmediate(resolve)) : () => new Promise((resolve) => setTimeout(resolve, 0));
|
|
2112
2469
|
var BatchClientTransport = class {
|
|
2113
2470
|
constructor(sendBatch) {
|
|
2114
2471
|
this.#promise = this.#scheduleBatch(sendBatch);
|
|
@@ -2117,7 +2474,7 @@ var BatchClientTransport = class {
|
|
|
2117
2474
|
#aborted;
|
|
2118
2475
|
#batchToSend = [];
|
|
2119
2476
|
#batchToReceive = null;
|
|
2120
|
-
|
|
2477
|
+
send(message) {
|
|
2121
2478
|
if (this.#batchToSend !== null) this.#batchToSend.push(message);
|
|
2122
2479
|
}
|
|
2123
2480
|
async receive() {
|
|
@@ -2130,7 +2487,7 @@ var BatchClientTransport = class {
|
|
|
2130
2487
|
this.#aborted = reason;
|
|
2131
2488
|
}
|
|
2132
2489
|
async #scheduleBatch(sendBatch) {
|
|
2133
|
-
await
|
|
2490
|
+
await yieldToMacrotask();
|
|
2134
2491
|
if (this.#aborted !== void 0) throw this.#aborted;
|
|
2135
2492
|
let batch = this.#batchToSend;
|
|
2136
2493
|
this.#batchToSend = null;
|
|
@@ -2159,7 +2516,7 @@ var BatchServerTransport = class {
|
|
|
2159
2516
|
#batchToSend = [];
|
|
2160
2517
|
#batchToReceive;
|
|
2161
2518
|
#allReceived = Promise.withResolvers();
|
|
2162
|
-
|
|
2519
|
+
send(message) {
|
|
2163
2520
|
this.#batchToSend.push(message);
|
|
2164
2521
|
}
|
|
2165
2522
|
async receive() {
|
|
@@ -2208,7 +2565,11 @@ async function newHttpBatchRpcResponse(request, localMain, options) {
|
|
|
2208
2565
|
* @param options Optional RPC session options. You can also pass headers to set on the response.
|
|
2209
2566
|
*/
|
|
2210
2567
|
async function nodeHttpBatchRpcResponse(request, response, localMain, options) {
|
|
2211
|
-
if (request.method !== "POST")
|
|
2568
|
+
if (request.method !== "POST") {
|
|
2569
|
+
response.writeHead(405, "This endpoint only accepts POST requests.", options?.headers);
|
|
2570
|
+
response.end();
|
|
2571
|
+
return;
|
|
2572
|
+
}
|
|
2212
2573
|
let body = await new Promise((resolve, reject) => {
|
|
2213
2574
|
let chunks = [];
|
|
2214
2575
|
request.on("data", (chunk) => {
|
|
@@ -2233,17 +2594,17 @@ function newMessagePortRpcSession$1(port, localMain, options) {
|
|
|
2233
2594
|
return new RpcSession$1(new MessagePortTransport(port), localMain, options).getRemoteMain();
|
|
2234
2595
|
}
|
|
2235
2596
|
var MessagePortTransport = class {
|
|
2597
|
+
encodingLevel = "structuredClonable";
|
|
2236
2598
|
constructor(port) {
|
|
2237
2599
|
this.#port = port;
|
|
2238
2600
|
port.start();
|
|
2239
2601
|
port.addEventListener("message", (event) => {
|
|
2240
2602
|
if (this.#error) {} else if (event.data === null) this.#receivedError(/* @__PURE__ */ new Error("Peer closed MessagePort connection."));
|
|
2241
|
-
else if (
|
|
2603
|
+
else if (this.#receiveResolver) {
|
|
2242
2604
|
this.#receiveResolver(event.data);
|
|
2243
2605
|
this.#receiveResolver = void 0;
|
|
2244
2606
|
this.#receiveRejecter = void 0;
|
|
2245
2607
|
} else this.#receiveQueue.push(event.data);
|
|
2246
|
-
else this.#receivedError(/* @__PURE__ */ new TypeError("Received non-string message from MessagePort."));
|
|
2247
2608
|
});
|
|
2248
2609
|
port.addEventListener("messageerror", (event) => {
|
|
2249
2610
|
this.#receivedError(/* @__PURE__ */ new Error("MessagePort message error."));
|
|
@@ -2254,7 +2615,7 @@ var MessagePortTransport = class {
|
|
|
2254
2615
|
#receiveRejecter;
|
|
2255
2616
|
#receiveQueue = [];
|
|
2256
2617
|
#error;
|
|
2257
|
-
|
|
2618
|
+
send(message) {
|
|
2258
2619
|
if (this.#error) throw this.#error;
|
|
2259
2620
|
this.#port.postMessage(message);
|
|
2260
2621
|
}
|
|
@@ -2418,9 +2779,11 @@ var MapVariableHook = class extends StubHook {
|
|
|
2418
2779
|
else throwMapperBuilderUseError();
|
|
2419
2780
|
}
|
|
2420
2781
|
call(path, args) {
|
|
2782
|
+
args.dispose();
|
|
2421
2783
|
throwMapperBuilderUseError();
|
|
2422
2784
|
}
|
|
2423
2785
|
map(path, captures, instructions) {
|
|
2786
|
+
for (let cap of captures) cap.dispose();
|
|
2424
2787
|
throwMapperBuilderUseError();
|
|
2425
2788
|
}
|
|
2426
2789
|
pull() {
|
|
@@ -2473,6 +2836,9 @@ var MapApplicator = class {
|
|
|
2473
2836
|
getPipeReadable(exportId) {
|
|
2474
2837
|
throw new Error("A mapper function cannot use pipe readables.");
|
|
2475
2838
|
}
|
|
2839
|
+
getLimits() {
|
|
2840
|
+
return DEFAULT_LIMITS;
|
|
2841
|
+
}
|
|
2476
2842
|
};
|
|
2477
2843
|
function applyMapToElement(input, parent, owner, captures, instructions) {
|
|
2478
2844
|
let mapper = new MapApplicator(captures, new PayloadStubHook(RpcPayload.deepCopyFrom(input, parent, owner)));
|
|
@@ -2528,14 +2894,11 @@ var WritableStreamStubHook = class WritableStreamStubHook extends StubHook {
|
|
|
2528
2894
|
let state = this.getState();
|
|
2529
2895
|
if (path.length !== 1 || typeof path[0] !== "string") throw new Error("WritableStream stub only supports direct method calls");
|
|
2530
2896
|
const method = path[0];
|
|
2531
|
-
if (method !== "write" && method !== "close" && method !== "abort") {
|
|
2532
|
-
args.dispose();
|
|
2533
|
-
throw new Error(`Unknown WritableStream method: ${method}`);
|
|
2534
|
-
}
|
|
2897
|
+
if (method !== "write" && method !== "close" && method !== "abort") throw new Error(`Unknown WritableStream method: ${method}`);
|
|
2535
2898
|
if (method === "close" || method === "abort") state.closed = true;
|
|
2536
|
-
|
|
2537
|
-
return new PromiseStubHook(args.deliverCall(func, state.writer).then((payload) => new PayloadStubHook(payload)));
|
|
2899
|
+
return new PromiseStubHook((method === "write" ? args.deliverStreamWrite(state.writer) : args.deliverCall(state.writer[method], state.writer)).then((payload) => new PayloadStubHook(payload)));
|
|
2538
2900
|
} catch (err) {
|
|
2901
|
+
args.dispose();
|
|
2539
2902
|
return new ErrorStubHook(err);
|
|
2540
2903
|
}
|
|
2541
2904
|
}
|
|
@@ -2811,12 +3174,12 @@ let newMessagePortRpcSession = newMessagePortRpcSession$1;
|
|
|
2811
3174
|
* credentials as parameters and returns the authorized API), then cross-origin requests should
|
|
2812
3175
|
* be safe.
|
|
2813
3176
|
*/
|
|
2814
|
-
async function newWorkersRpcResponse(request, localMain) {
|
|
3177
|
+
async function newWorkersRpcResponse(request, localMain, options) {
|
|
2815
3178
|
if (request.method === "POST") {
|
|
2816
|
-
let response = await newHttpBatchRpcResponse(request, localMain);
|
|
3179
|
+
let response = await newHttpBatchRpcResponse(request, localMain, options);
|
|
2817
3180
|
response.headers.set("Access-Control-Allow-Origin", "*");
|
|
2818
3181
|
return response;
|
|
2819
|
-
} else if (request.headers.get("Upgrade")?.toLowerCase() === "websocket") return newWorkersWebSocketRpcResponse(request, localMain);
|
|
3182
|
+
} else if (request.headers.get("Upgrade")?.toLowerCase() === "websocket") return newWorkersWebSocketRpcResponse(request, localMain, options);
|
|
2820
3183
|
else return new Response("This endpoint only accepts POST or WebSocket requests.", { status: 400 });
|
|
2821
3184
|
}
|
|
2822
3185
|
|
|
@@ -2937,5 +3300,5 @@ var BunWebSocketTransport = class {
|
|
|
2937
3300
|
let newBunWebSocketRpcSession = newBunWebSocketRpcSession$1;
|
|
2938
3301
|
|
|
2939
3302
|
//#endregion
|
|
2940
|
-
export { BunWebSocketTransport, RpcPromise, RpcSession, RpcStub, RpcTarget, deserialize, newBunWebSocketRpcHandler, newBunWebSocketRpcSession, newHttpBatchRpcResponse, newHttpBatchRpcSession, newMessagePortRpcSession, newWebSocketRpcSession, newWorkersRpcResponse, newWorkersWebSocketRpcResponse, nodeHttpBatchRpcResponse, serialize };
|
|
3303
|
+
export { BunWebSocketTransport, DEFAULT_LIMITS, DEFAULT_MAX_DEPTH, RpcPromise, RpcSession, RpcStub, RpcTarget, WebSocketTransport, deserialize, newBunWebSocketRpcHandler, newBunWebSocketRpcSession, newHttpBatchRpcResponse, newHttpBatchRpcSession, newMessagePortRpcSession, newWebSocketRpcSession, newWorkersRpcResponse, newWorkersWebSocketRpcResponse, nodeHttpBatchRpcResponse, serialize };
|
|
2941
3304
|
//# sourceMappingURL=index-bun.js.map
|