poe-code 14.0.14 → 14.0.16

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
@@ -148659,7 +148659,7 @@ function wrapCallerInjectedFunction(name, value, options, state) {
148659
148659
  throw error3;
148660
148660
  }
148661
148661
  if (options.realm.awaitResult(callable)) {
148662
- return Promise.resolve(result).then((value2) => copyHostResultToSandbox(value2, stackFrames, options));
148662
+ return wrapHostPromiseWithSignal(Promise.resolve(result), options.signal).then((value2) => copyHostResultToSandbox(value2, stackFrames, options));
148663
148663
  }
148664
148664
  return copyHostResultToSandbox(result, stackFrames, options);
148665
148665
  }
@@ -149169,6 +149169,7 @@ function wrapHostPromiseWithSignal(promise, signal) {
149169
149169
  return promise;
149170
149170
  }
149171
149171
  if (signal.aborted) {
149172
+ void promise.catch(() => void 0);
149172
149173
  return Promise.reject(readAbortReason2(signal));
149173
149174
  }
149174
149175
  return new Promise((resolve16, reject) => {
@@ -151367,7 +151368,20 @@ var init_realm = __esm({
151367
151368
  this.compilation
151368
151369
  );
151369
151370
  };
151370
- invokeCallback = async (callback, options = {}) => {
151371
+ startCallback = (callback, options = {}) => {
151372
+ let complete;
151373
+ let fail3;
151374
+ const synchronous = new Promise((resolve16, reject) => {
151375
+ complete = resolve16;
151376
+ fail3 = reject;
151377
+ });
151378
+ const result = this.executeCallback(callback, options, complete);
151379
+ void result.catch(fail3);
151380
+ void synchronous.catch(() => void 0);
151381
+ return Object.freeze({ synchronous, result });
151382
+ };
151383
+ invokeCallback = this.executeCallback.bind(this);
151384
+ async executeCallback(callback, options = {}, completeSynchronous) {
151371
151385
  if (this.closed || this.failure !== void 0) await this.dispose();
151372
151386
  this.assertOpen();
151373
151387
  const closure = readGuestCallback(callback, this);
@@ -151389,9 +151403,13 @@ var init_realm = __esm({
151389
151403
  compilation: this.compilation,
151390
151404
  stack: []
151391
151405
  });
151392
- const settled = await suspendJob(
151393
- awaitSandboxValue(value, this.controller.signal, this.budget)
151394
- );
151406
+ const settlement = awaitSandboxValue(value, this.controller.signal, this.budget);
151407
+ void settlement.catch(() => void 0);
151408
+ if (isSandboxPromise(value) && value.synchronousPrefix !== void 0)
151409
+ await value.synchronousPrefix;
151410
+ this.assertOpen();
151411
+ completeSynchronous?.();
151412
+ const settled = await suspendJob(settlement);
151395
151413
  return this.exportValue(settled);
151396
151414
  } finally {
151397
151415
  leaveCall();
@@ -151399,20 +151417,18 @@ var init_realm = __esm({
151399
151417
  }
151400
151418
  };
151401
151419
  try {
151402
- if (this.active !== void 0) {
151403
- record2.promise = withSandboxPromiseRejectionTracker(
151404
- this.tracker,
151405
- () => runResources.run(
151406
- { signal: this.controller.signal, add: this.onCleanup },
151407
- () => withCancellationSignal(
151408
- this.controller.signal,
151409
- () => this.phase.getStore()?.active ? runAsyncPrefix(invoke2) : this.queue.run(invoke2)
151410
- )
151420
+ const active = this.active !== void 0;
151421
+ const pending = withSandboxPromiseRejectionTracker(
151422
+ this.tracker,
151423
+ () => runResources.run(
151424
+ { signal: this.controller.signal, add: this.onCleanup },
151425
+ () => withCancellationSignal(
151426
+ this.controller.signal,
151427
+ () => active && this.phase.getStore()?.active ? runAsyncPrefix(invoke2) : this.queue.run(invoke2)
151411
151428
  )
151412
- );
151413
- } else {
151414
- record2.promise = this.perform(() => this.queue.run(invoke2));
151415
- }
151429
+ )
151430
+ );
151431
+ record2.promise = active ? pending : this.perform(() => pending);
151416
151432
  return await record2.promise;
151417
151433
  } catch (error3) {
151418
151434
  if (error3 instanceof SandboxError) this.poison(error3);
@@ -151426,7 +151442,7 @@ var init_realm = __esm({
151426
151442
  this.compilation
151427
151443
  );
151428
151444
  }
151429
- };
151445
+ }
151430
151446
  initialize() {
151431
151447
  if (this.initialized) return;
151432
151448
  this.assertOpen();
@@ -151437,6 +151453,7 @@ var init_realm = __esm({
151437
151453
  onCleanup: this.onCleanup,
151438
151454
  chargeWork: this.chargeWork,
151439
151455
  createHostObject: this.createHostObject,
151456
+ startCallback: this.startCallback,
151440
151457
  invokeCallback: this.invokeCallback,
151441
151458
  releaseCallback: this.releaseCallback,
151442
151459
  releaseGuestReference: this.releaseGuestReference,
@@ -159678,7 +159695,7 @@ var init_package2 = __esm({
159678
159695
  "package.json"() {
159679
159696
  package_default2 = {
159680
159697
  name: "poe-code",
159681
- version: "14.0.14",
159698
+ version: "14.0.16",
159682
159699
  description: "CLI tool to configure Poe API for developer workflows.",
159683
159700
  license: "MIT",
159684
159701
  type: "module",