capnweb 0.0.0-098dca7 → 0.0.0-0b19df9
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-bun.cjs +12 -5
- package/dist/index-bun.cjs.map +1 -1
- package/dist/index-bun.d.cts +3 -1
- package/dist/index-bun.d.ts +3 -1
- package/dist/index-bun.js +12 -5
- package/dist/index-bun.js.map +1 -1
- package/dist/index-workers.cjs +12 -5
- package/dist/index-workers.cjs.map +1 -1
- package/dist/index-workers.d.cts +3 -1
- package/dist/index-workers.d.ts +3 -1
- package/dist/index-workers.js +12 -5
- package/dist/index-workers.js.map +1 -1
- package/dist/index.cjs +12 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index-bun.cjs
CHANGED
|
@@ -418,7 +418,7 @@ var RpcPayload = class RpcPayload {
|
|
|
418
418
|
return hook.dup();
|
|
419
419
|
} else return hook;
|
|
420
420
|
}
|
|
421
|
-
} else
|
|
421
|
+
} else return streamImpl.createReadableStreamHook(stream);
|
|
422
422
|
}
|
|
423
423
|
deepCopy(value, oldParent, property, parent, dupStubs, owner) {
|
|
424
424
|
switch (typeForRpc(value)) {
|
|
@@ -525,8 +525,10 @@ var RpcPayload = class RpcPayload {
|
|
|
525
525
|
case "readable": {
|
|
526
526
|
let stream = value;
|
|
527
527
|
let hook;
|
|
528
|
-
if (owner)
|
|
529
|
-
|
|
528
|
+
if (owner) {
|
|
529
|
+
if (owner.source === "owned") throw new Error("Can't copy a ReadableStream.");
|
|
530
|
+
hook = owner.getHookForReadableStream(stream, oldParent, dupStubs);
|
|
531
|
+
} else hook = streamImpl.createReadableStreamHook(stream);
|
|
530
532
|
this.hooks.push(hook);
|
|
531
533
|
return stream;
|
|
532
534
|
}
|
|
@@ -1887,10 +1889,11 @@ function estimateEncodedSize(value, seen, depth = 0) {
|
|
|
1887
1889
|
var ImportTableEntry = class {
|
|
1888
1890
|
session;
|
|
1889
1891
|
importId;
|
|
1892
|
+
pulling;
|
|
1890
1893
|
constructor(session, importId, pulling) {
|
|
1891
1894
|
this.session = session;
|
|
1892
1895
|
this.importId = importId;
|
|
1893
|
-
|
|
1896
|
+
this.pulling = pulling;
|
|
1894
1897
|
}
|
|
1895
1898
|
localRefcount = 0;
|
|
1896
1899
|
remoteRefcount = 1;
|
|
@@ -1921,7 +1924,7 @@ var ImportTableEntry = class {
|
|
|
1921
1924
|
}
|
|
1922
1925
|
async awaitResolution() {
|
|
1923
1926
|
if (!this.activePull) {
|
|
1924
|
-
this.session.sendPull(this.importId);
|
|
1927
|
+
if (!this.pulling) this.session.sendPull(this.importId);
|
|
1925
1928
|
this.activePull = Promise.withResolvers();
|
|
1926
1929
|
}
|
|
1927
1930
|
await this.activePull.promise;
|
|
@@ -2151,6 +2154,7 @@ var RpcSessionImpl = class {
|
|
|
2151
2154
|
let autoRelease = exp.autoRelease;
|
|
2152
2155
|
++this.pullCount;
|
|
2153
2156
|
exp.pull = resolve().then((payload) => {
|
|
2157
|
+
if (this.exports[exportId] !== exp) return;
|
|
2154
2158
|
let value = Devaluator.devaluate(payload.value, void 0, this, payload, this.encodingLevel);
|
|
2155
2159
|
this.send([
|
|
2156
2160
|
"resolve",
|
|
@@ -2159,6 +2163,7 @@ var RpcSessionImpl = class {
|
|
|
2159
2163
|
]);
|
|
2160
2164
|
if (autoRelease) this.releaseExport(exportId, 1);
|
|
2161
2165
|
}, (error) => {
|
|
2166
|
+
if (this.exports[exportId] !== exp) return;
|
|
2162
2167
|
this.send([
|
|
2163
2168
|
"reject",
|
|
2164
2169
|
exportId,
|
|
@@ -2278,6 +2283,7 @@ var RpcSessionImpl = class {
|
|
|
2278
2283
|
value.push(devalue[0]);
|
|
2279
2284
|
}
|
|
2280
2285
|
this.send(["push", value]);
|
|
2286
|
+
args?.dispose();
|
|
2281
2287
|
let entry = new ImportTableEntry(this, this.imports.length, false);
|
|
2282
2288
|
this.imports.push(entry);
|
|
2283
2289
|
return new RpcImportHook(true, entry);
|
|
@@ -2302,6 +2308,7 @@ var RpcSessionImpl = class {
|
|
|
2302
2308
|
value.push(devalue[0]);
|
|
2303
2309
|
let msg = ["stream", value];
|
|
2304
2310
|
let size = this.send(msg);
|
|
2311
|
+
args.dispose();
|
|
2305
2312
|
if (size === void 0) size = estimateEncodedSize(msg);
|
|
2306
2313
|
let importId = this.imports.length;
|
|
2307
2314
|
let entry = new ImportTableEntry(this, importId, true);
|