capnweb 0.0.0-d21e4ca → 0.0.0-e3fa093
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 +12 -0
- package/dist/index-workers.cjs +13 -4
- package/dist/index-workers.cjs.map +1 -1
- package/dist/index-workers.js +13 -4
- package/dist/index-workers.js.map +1 -1
- package/dist/index.cjs +13 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.d.cts
CHANGED
|
@@ -35,7 +35,7 @@ type RpcCompatible<T> =
|
|
|
35
35
|
| Array<T extends Array<infer U> ? RpcCompatible<U> : never>
|
|
36
36
|
| ReadonlyArray<T extends ReadonlyArray<infer U> ? RpcCompatible<U> : never>
|
|
37
37
|
| {
|
|
38
|
-
[K in keyof T
|
|
38
|
+
[K in keyof T as K extends string | number ? K : never]: RpcCompatible<T[K]>;
|
|
39
39
|
}
|
|
40
40
|
| Promise<T extends Promise<infer U> ? RpcCompatible<U> : never>
|
|
41
41
|
// Special types
|
package/dist/index.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ type RpcCompatible<T> =
|
|
|
35
35
|
| Array<T extends Array<infer U> ? RpcCompatible<U> : never>
|
|
36
36
|
| ReadonlyArray<T extends ReadonlyArray<infer U> ? RpcCompatible<U> : never>
|
|
37
37
|
| {
|
|
38
|
-
[K in keyof T
|
|
38
|
+
[K in keyof T as K extends string | number ? K : never]: RpcCompatible<T[K]>;
|
|
39
39
|
}
|
|
40
40
|
| Promise<T extends Promise<infer U> ? RpcCompatible<U> : never>
|
|
41
41
|
// Special types
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// src/symbols.ts
|
|
2
|
-
var WORKERS_MODULE_SYMBOL = Symbol("workers-module");
|
|
2
|
+
var WORKERS_MODULE_SYMBOL = /* @__PURE__ */ Symbol("workers-module");
|
|
3
3
|
|
|
4
4
|
// src/core.ts
|
|
5
5
|
if (!Symbol.dispose) {
|
|
6
|
-
Symbol.dispose = Symbol.for("dispose");
|
|
6
|
+
Symbol.dispose = /* @__PURE__ */ Symbol.for("dispose");
|
|
7
7
|
}
|
|
8
8
|
if (!Symbol.asyncDispose) {
|
|
9
|
-
Symbol.asyncDispose = Symbol.for("asyncDispose");
|
|
9
|
+
Symbol.asyncDispose = /* @__PURE__ */ Symbol.for("asyncDispose");
|
|
10
10
|
}
|
|
11
11
|
if (!Promise.withResolvers) {
|
|
12
12
|
Promise.withResolvers = function() {
|
|
@@ -22,6 +22,8 @@ if (!Promise.withResolvers) {
|
|
|
22
22
|
var workersModule = globalThis[WORKERS_MODULE_SYMBOL];
|
|
23
23
|
var RpcTarget = workersModule ? workersModule.RpcTarget : class {
|
|
24
24
|
};
|
|
25
|
+
var AsyncFunction = (async function() {
|
|
26
|
+
}).constructor;
|
|
25
27
|
function typeForRpc(value) {
|
|
26
28
|
switch (typeof value) {
|
|
27
29
|
case "boolean":
|
|
@@ -46,6 +48,7 @@ function typeForRpc(value) {
|
|
|
46
48
|
case Object.prototype:
|
|
47
49
|
return "object";
|
|
48
50
|
case Function.prototype:
|
|
51
|
+
case AsyncFunction.prototype:
|
|
49
52
|
return "function";
|
|
50
53
|
case Array.prototype:
|
|
51
54
|
return "array";
|
|
@@ -129,7 +132,7 @@ function withCallInterceptor(interceptor, callback) {
|
|
|
129
132
|
doCall = oldValue;
|
|
130
133
|
}
|
|
131
134
|
}
|
|
132
|
-
var RAW_STUB = Symbol("realStub");
|
|
135
|
+
var RAW_STUB = /* @__PURE__ */ Symbol("realStub");
|
|
133
136
|
var PROXY_HANDLERS = {
|
|
134
137
|
apply(target, thisArg, argumentsList) {
|
|
135
138
|
let stub = target.raw;
|
|
@@ -397,6 +400,12 @@ var RpcPayload = class _RpcPayload {
|
|
|
397
400
|
// Get the StubHook representing the given RpcTarget found inside this payload.
|
|
398
401
|
getHookForRpcTarget(target, parent, dupStubs = true) {
|
|
399
402
|
if (this.source === "params") {
|
|
403
|
+
if (dupStubs) {
|
|
404
|
+
let dupable = target;
|
|
405
|
+
if (typeof dupable.dup === "function") {
|
|
406
|
+
target = dupable.dup();
|
|
407
|
+
}
|
|
408
|
+
}
|
|
400
409
|
return TargetStubHook.create(target, parent);
|
|
401
410
|
} else if (this.source === "return") {
|
|
402
411
|
let hook = this.rpcTargets?.get(target);
|