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-workers.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as cfw from 'cloudflare:workers';
|
|
2
2
|
|
|
3
3
|
// src/symbols.ts
|
|
4
|
-
var WORKERS_MODULE_SYMBOL = Symbol("workers-module");
|
|
4
|
+
var WORKERS_MODULE_SYMBOL = /* @__PURE__ */ Symbol("workers-module");
|
|
5
5
|
globalThis[WORKERS_MODULE_SYMBOL] = cfw;
|
|
6
6
|
|
|
7
7
|
// src/core.ts
|
|
8
8
|
if (!Symbol.dispose) {
|
|
9
|
-
Symbol.dispose = Symbol.for("dispose");
|
|
9
|
+
Symbol.dispose = /* @__PURE__ */ Symbol.for("dispose");
|
|
10
10
|
}
|
|
11
11
|
if (!Symbol.asyncDispose) {
|
|
12
|
-
Symbol.asyncDispose = Symbol.for("asyncDispose");
|
|
12
|
+
Symbol.asyncDispose = /* @__PURE__ */ Symbol.for("asyncDispose");
|
|
13
13
|
}
|
|
14
14
|
if (!Promise.withResolvers) {
|
|
15
15
|
Promise.withResolvers = function() {
|
|
@@ -25,6 +25,8 @@ if (!Promise.withResolvers) {
|
|
|
25
25
|
var workersModule = globalThis[WORKERS_MODULE_SYMBOL];
|
|
26
26
|
var RpcTarget = workersModule ? workersModule.RpcTarget : class {
|
|
27
27
|
};
|
|
28
|
+
var AsyncFunction = (async function() {
|
|
29
|
+
}).constructor;
|
|
28
30
|
function typeForRpc(value) {
|
|
29
31
|
switch (typeof value) {
|
|
30
32
|
case "boolean":
|
|
@@ -49,6 +51,7 @@ function typeForRpc(value) {
|
|
|
49
51
|
case Object.prototype:
|
|
50
52
|
return "object";
|
|
51
53
|
case Function.prototype:
|
|
54
|
+
case AsyncFunction.prototype:
|
|
52
55
|
return "function";
|
|
53
56
|
case Array.prototype:
|
|
54
57
|
return "array";
|
|
@@ -132,7 +135,7 @@ function withCallInterceptor(interceptor, callback) {
|
|
|
132
135
|
doCall = oldValue;
|
|
133
136
|
}
|
|
134
137
|
}
|
|
135
|
-
var RAW_STUB = Symbol("realStub");
|
|
138
|
+
var RAW_STUB = /* @__PURE__ */ Symbol("realStub");
|
|
136
139
|
var PROXY_HANDLERS = {
|
|
137
140
|
apply(target, thisArg, argumentsList) {
|
|
138
141
|
let stub = target.raw;
|
|
@@ -400,6 +403,12 @@ var RpcPayload = class _RpcPayload {
|
|
|
400
403
|
// Get the StubHook representing the given RpcTarget found inside this payload.
|
|
401
404
|
getHookForRpcTarget(target, parent, dupStubs = true) {
|
|
402
405
|
if (this.source === "params") {
|
|
406
|
+
if (dupStubs) {
|
|
407
|
+
let dupable = target;
|
|
408
|
+
if (typeof dupable.dup === "function") {
|
|
409
|
+
target = dupable.dup();
|
|
410
|
+
}
|
|
411
|
+
}
|
|
403
412
|
return TargetStubHook.create(target, parent);
|
|
404
413
|
} else if (this.source === "return") {
|
|
405
414
|
let hook = this.rpcTargets?.get(target);
|