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