@vastblast/capnweb 0.7.4 → 0.7.5

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.cjs CHANGED
@@ -2248,6 +2248,11 @@ var RpcSessionImpl = class {
2248
2248
  this.transport.send(msgText).catch((err) => this.abort(err, false));
2249
2249
  return msgText.length;
2250
2250
  }
2251
+ isDirectFunctionCall(expression) {
2252
+ if (!(expression instanceof Array)) return false;
2253
+ let [kind, _id, path, args] = expression;
2254
+ return kind === "pipeline" && expression.length === 4 && path instanceof Array && path.length === 0 && args instanceof Array;
2255
+ }
2251
2256
  sendCall(id, path, args) {
2252
2257
  if (this.abortReason) throw this.abortReason;
2253
2258
  let value = ["pipeline", id, path];
@@ -2376,7 +2381,11 @@ var RpcSessionImpl = class {
2376
2381
  let payload = new Evaluator(this).evaluate(msg[1]);
2377
2382
  let hook = new PayloadStubHook(payload);
2378
2383
  hook.ignoreUnhandledRejections();
2384
+ let exportId = this.exports.length;
2379
2385
  this.exports.push({ hook, refcount: 1 });
2386
+ if (this.isDirectFunctionCall(msg[1])) {
2387
+ this.ensureResolvingExport(exportId);
2388
+ }
2380
2389
  continue;
2381
2390
  }
2382
2391
  break;