capnweb 0.0.0-99ecb6b → 0.0.0-aa4fe30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index-workers.cjs +2652 -0
- package/dist/index-workers.cjs.map +1 -0
- package/dist/index-workers.d.cts +2 -0
- package/dist/index-workers.js +37 -2
- package/dist/index-workers.js.map +1 -1
- package/dist/index.cjs +2629 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +364 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +37 -2
- package/dist/index.js.map +1 -1
- package/package.json +12 -8
package/dist/index-workers.js
CHANGED
|
@@ -11,6 +11,17 @@ if (!Symbol.dispose) {
|
|
|
11
11
|
if (!Symbol.asyncDispose) {
|
|
12
12
|
Symbol.asyncDispose = Symbol.for("asyncDispose");
|
|
13
13
|
}
|
|
14
|
+
if (!Promise.withResolvers) {
|
|
15
|
+
Promise.withResolvers = function() {
|
|
16
|
+
let resolve;
|
|
17
|
+
let reject;
|
|
18
|
+
const promise = new Promise((res, rej) => {
|
|
19
|
+
resolve = res;
|
|
20
|
+
reject = rej;
|
|
21
|
+
});
|
|
22
|
+
return { promise, resolve, reject };
|
|
23
|
+
};
|
|
24
|
+
}
|
|
14
25
|
var workersModule = globalThis[WORKERS_MODULE_SYMBOL];
|
|
15
26
|
var RpcTarget = workersModule ? workersModule.RpcTarget : class {
|
|
16
27
|
};
|
|
@@ -236,6 +247,9 @@ var RpcStub = class _RpcStub extends RpcTarget {
|
|
|
236
247
|
let { hook, pathIfPromise } = this[RAW_STUB];
|
|
237
248
|
return mapImpl.sendMap(hook, pathIfPromise || [], func);
|
|
238
249
|
}
|
|
250
|
+
toString() {
|
|
251
|
+
return "[object RpcStub]";
|
|
252
|
+
}
|
|
239
253
|
};
|
|
240
254
|
var RpcPromise = class extends RpcStub {
|
|
241
255
|
// TODO: Support passing target value or promise to constructor.
|
|
@@ -251,6 +265,9 @@ var RpcPromise = class extends RpcStub {
|
|
|
251
265
|
finally(onfinally) {
|
|
252
266
|
return pullPromise(this).finally(...arguments);
|
|
253
267
|
}
|
|
268
|
+
toString() {
|
|
269
|
+
return "[object RpcPromise]";
|
|
270
|
+
}
|
|
254
271
|
};
|
|
255
272
|
function unwrapStubTakingOwnership(stub) {
|
|
256
273
|
let { hook, pathIfPromise } = stub[RAW_STUB];
|
|
@@ -748,7 +765,9 @@ function followPath(value, parent, path, owner) {
|
|
|
748
765
|
case "rpc-target":
|
|
749
766
|
case "rpc-thenable": {
|
|
750
767
|
if (Object.hasOwn(value, part)) {
|
|
751
|
-
|
|
768
|
+
throw new TypeError(
|
|
769
|
+
`Attempted to access property '${part}', which is an instance property of the RpcTarget. To avoid leaking private internals, instance properties cannot be accessed over RPC. If you want to make this property available over RPC, define it as a method or getter on the class, instead of an instance property.`
|
|
770
|
+
);
|
|
752
771
|
} else {
|
|
753
772
|
value = value[part];
|
|
754
773
|
}
|
|
@@ -1132,7 +1151,17 @@ var Devaluator = class _Devaluator {
|
|
|
1132
1151
|
throw new TypeError(msg);
|
|
1133
1152
|
}
|
|
1134
1153
|
case "primitive":
|
|
1135
|
-
|
|
1154
|
+
if (typeof value === "number" && !isFinite(value)) {
|
|
1155
|
+
if (value === Infinity) {
|
|
1156
|
+
return ["inf"];
|
|
1157
|
+
} else if (value === -Infinity) {
|
|
1158
|
+
return ["-inf"];
|
|
1159
|
+
} else {
|
|
1160
|
+
return ["nan"];
|
|
1161
|
+
}
|
|
1162
|
+
} else {
|
|
1163
|
+
return value;
|
|
1164
|
+
}
|
|
1136
1165
|
case "object": {
|
|
1137
1166
|
let object = value;
|
|
1138
1167
|
let result = {};
|
|
@@ -1316,6 +1345,12 @@ var Evaluator = class _Evaluator {
|
|
|
1316
1345
|
return void 0;
|
|
1317
1346
|
}
|
|
1318
1347
|
break;
|
|
1348
|
+
case "inf":
|
|
1349
|
+
return Infinity;
|
|
1350
|
+
case "-inf":
|
|
1351
|
+
return -Infinity;
|
|
1352
|
+
case "nan":
|
|
1353
|
+
return NaN;
|
|
1319
1354
|
case "import":
|
|
1320
1355
|
case "pipeline": {
|
|
1321
1356
|
if (value.length < 2 || value.length > 4) {
|