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.d.cts
CHANGED
|
@@ -164,7 +164,9 @@ type TupleProvider<T extends ReadonlyArray<unknown>> = { [K in TupleIndexKeys<T>
|
|
|
164
164
|
// `__RPC_TARGET_BRAND` deliberately flows through the key mapping (as a `never` property) so
|
|
165
165
|
// stubs of branded targets stay assignable to workers-types' `Stubable`. Such stubs match our
|
|
166
166
|
// `Stubable` too — harmless, since all machinery checks `StubBase` before `Stubable`.
|
|
167
|
-
|
|
167
|
+
// Mapping over `keyof T` keeps "Go to Definition" working; `-?` because reading a stub
|
|
168
|
+
// member never yields `undefined`.
|
|
169
|
+
type Provider<T> = MaybeCallableProvider<T> & (T extends ReadonlyArray<unknown> ? number extends T["length"] ? ArrayProvider<T[number]> : TupleProvider<T> : Pick<{ [K in keyof T]-?: MethodOrProperty<T[K]>; }, Exclude<keyof T, symbol | keyof StubBase<never>>> & {
|
|
168
170
|
map<V>(callback: (value: MapCallbackValue<NonNullable<T>>) => MapCallbackReturn<V>): Result<Array<V>>;
|
|
169
171
|
});
|
|
170
172
|
//#endregion
|
package/dist/index-bun.d.ts
CHANGED
|
@@ -164,7 +164,9 @@ type TupleProvider<T extends ReadonlyArray<unknown>> = { [K in TupleIndexKeys<T>
|
|
|
164
164
|
// `__RPC_TARGET_BRAND` deliberately flows through the key mapping (as a `never` property) so
|
|
165
165
|
// stubs of branded targets stay assignable to workers-types' `Stubable`. Such stubs match our
|
|
166
166
|
// `Stubable` too — harmless, since all machinery checks `StubBase` before `Stubable`.
|
|
167
|
-
|
|
167
|
+
// Mapping over `keyof T` keeps "Go to Definition" working; `-?` because reading a stub
|
|
168
|
+
// member never yields `undefined`.
|
|
169
|
+
type Provider<T> = MaybeCallableProvider<T> & (T extends ReadonlyArray<unknown> ? number extends T["length"] ? ArrayProvider<T[number]> : TupleProvider<T> : Pick<{ [K in keyof T]-?: MethodOrProperty<T[K]>; }, Exclude<keyof T, symbol | keyof StubBase<never>>> & {
|
|
168
170
|
map<V>(callback: (value: MapCallbackValue<NonNullable<T>>) => MapCallbackReturn<V>): Result<Array<V>>;
|
|
169
171
|
});
|
|
170
172
|
//#endregion
|
package/dist/index-bun.js
CHANGED
|
@@ -417,7 +417,7 @@ var RpcPayload = class RpcPayload {
|
|
|
417
417
|
return hook.dup();
|
|
418
418
|
} else return hook;
|
|
419
419
|
}
|
|
420
|
-
} else
|
|
420
|
+
} else return streamImpl.createReadableStreamHook(stream);
|
|
421
421
|
}
|
|
422
422
|
deepCopy(value, oldParent, property, parent, dupStubs, owner) {
|
|
423
423
|
switch (typeForRpc(value)) {
|
|
@@ -524,8 +524,10 @@ var RpcPayload = class RpcPayload {
|
|
|
524
524
|
case "readable": {
|
|
525
525
|
let stream = value;
|
|
526
526
|
let hook;
|
|
527
|
-
if (owner)
|
|
528
|
-
|
|
527
|
+
if (owner) {
|
|
528
|
+
if (owner.source === "owned") throw new Error("Can't copy a ReadableStream.");
|
|
529
|
+
hook = owner.getHookForReadableStream(stream, oldParent, dupStubs);
|
|
530
|
+
} else hook = streamImpl.createReadableStreamHook(stream);
|
|
529
531
|
this.hooks.push(hook);
|
|
530
532
|
return stream;
|
|
531
533
|
}
|
|
@@ -1886,10 +1888,11 @@ function estimateEncodedSize(value, seen, depth = 0) {
|
|
|
1886
1888
|
var ImportTableEntry = class {
|
|
1887
1889
|
session;
|
|
1888
1890
|
importId;
|
|
1891
|
+
pulling;
|
|
1889
1892
|
constructor(session, importId, pulling) {
|
|
1890
1893
|
this.session = session;
|
|
1891
1894
|
this.importId = importId;
|
|
1892
|
-
|
|
1895
|
+
this.pulling = pulling;
|
|
1893
1896
|
}
|
|
1894
1897
|
localRefcount = 0;
|
|
1895
1898
|
remoteRefcount = 1;
|
|
@@ -1920,7 +1923,7 @@ var ImportTableEntry = class {
|
|
|
1920
1923
|
}
|
|
1921
1924
|
async awaitResolution() {
|
|
1922
1925
|
if (!this.activePull) {
|
|
1923
|
-
this.session.sendPull(this.importId);
|
|
1926
|
+
if (!this.pulling) this.session.sendPull(this.importId);
|
|
1924
1927
|
this.activePull = Promise.withResolvers();
|
|
1925
1928
|
}
|
|
1926
1929
|
await this.activePull.promise;
|
|
@@ -2150,6 +2153,7 @@ var RpcSessionImpl = class {
|
|
|
2150
2153
|
let autoRelease = exp.autoRelease;
|
|
2151
2154
|
++this.pullCount;
|
|
2152
2155
|
exp.pull = resolve().then((payload) => {
|
|
2156
|
+
if (this.exports[exportId] !== exp) return;
|
|
2153
2157
|
let value = Devaluator.devaluate(payload.value, void 0, this, payload, this.encodingLevel);
|
|
2154
2158
|
this.send([
|
|
2155
2159
|
"resolve",
|
|
@@ -2158,6 +2162,7 @@ var RpcSessionImpl = class {
|
|
|
2158
2162
|
]);
|
|
2159
2163
|
if (autoRelease) this.releaseExport(exportId, 1);
|
|
2160
2164
|
}, (error) => {
|
|
2165
|
+
if (this.exports[exportId] !== exp) return;
|
|
2161
2166
|
this.send([
|
|
2162
2167
|
"reject",
|
|
2163
2168
|
exportId,
|
|
@@ -2277,6 +2282,7 @@ var RpcSessionImpl = class {
|
|
|
2277
2282
|
value.push(devalue[0]);
|
|
2278
2283
|
}
|
|
2279
2284
|
this.send(["push", value]);
|
|
2285
|
+
args?.dispose();
|
|
2280
2286
|
let entry = new ImportTableEntry(this, this.imports.length, false);
|
|
2281
2287
|
this.imports.push(entry);
|
|
2282
2288
|
return new RpcImportHook(true, entry);
|
|
@@ -2301,6 +2307,7 @@ var RpcSessionImpl = class {
|
|
|
2301
2307
|
value.push(devalue[0]);
|
|
2302
2308
|
let msg = ["stream", value];
|
|
2303
2309
|
let size = this.send(msg);
|
|
2310
|
+
args.dispose();
|
|
2304
2311
|
if (size === void 0) size = estimateEncodedSize(msg);
|
|
2305
2312
|
let importId = this.imports.length;
|
|
2306
2313
|
let entry = new ImportTableEntry(this, importId, true);
|