@poe-platform/safe-js 0.1.86 → 0.1.88

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.
@@ -25840,6 +25840,7 @@ async function interpret(node, options = {}) {
25840
25840
  budget,
25841
25841
  callStack: [],
25842
25842
  onYield: options.onYield,
25843
+ onSuspend: options.onSuspend,
25843
25844
  captureReplayState: options.captureReplayState,
25844
25845
  rootNode: node,
25845
25846
  scope,
@@ -28559,44 +28560,51 @@ function createInterpretedClosure(node, context, evaluateNode2) {
28559
28560
  };
28560
28561
  if (!node.async)
28561
28562
  return executeClosure(node, args, callContext?.thisValue, invocationContext, evaluateNode2);
28562
- let completePrefix;
28563
- const synchronousPrefix = new Promise((resolve) => {
28564
- completePrefix = resolve;
28565
- });
28566
- const promise = new Promise((resolve, reject) => {
28567
- runAsyncPrefix(async () => {
28568
- try {
28569
- const value = await executeClosure(
28570
- node,
28571
- args,
28572
- callContext?.thisValue,
28573
- { ...invocationContext, onSuspend: completePrefix },
28574
- evaluateNode2
28575
- );
28576
- resolve(
28577
- isSandboxPromise(value) || getThenable(value) !== void 0 ? awaitSandboxValue(
28578
- createSandboxPromise(resolveSandboxValue(value, { budget: context.budget }), {
28579
- trackReplay: false
28580
- }),
28581
- context.signal,
28582
- context.budget
28583
- ) : allocateProducedSandboxValue(value, context.budget)
28584
- );
28585
- } catch (error) {
28586
- reject(error);
28587
- } finally {
28588
- completePrefix();
28589
- }
28590
- }).catch((error) => {
28591
- reject(error);
28592
- completePrefix();
28593
- });
28594
- });
28595
- return createSandboxPromise(promise, { synchronousPrefix });
28563
+ return executeAsyncFunction(
28564
+ (onSuspend) => executeClosure(
28565
+ node,
28566
+ args,
28567
+ callContext?.thisValue,
28568
+ { ...invocationContext, onSuspend },
28569
+ evaluateNode2
28570
+ ),
28571
+ context.budget,
28572
+ context.signal
28573
+ );
28596
28574
  }
28597
28575
  });
28598
28576
  return closure;
28599
28577
  }
28578
+ function executeAsyncFunction(execute, budget, signal) {
28579
+ let completePrefix;
28580
+ const synchronousPrefix = new Promise((resolve) => {
28581
+ completePrefix = resolve;
28582
+ });
28583
+ const promise = new Promise((resolve, reject) => {
28584
+ runAsyncPrefix(async () => {
28585
+ try {
28586
+ const value = await execute(completePrefix);
28587
+ resolve(
28588
+ isSandboxPromise(value) || getThenable(value) !== void 0 ? awaitSandboxValue(
28589
+ createSandboxPromise(resolveSandboxValue(value, { budget }), {
28590
+ trackReplay: false
28591
+ }),
28592
+ signal,
28593
+ budget
28594
+ ) : allocateProducedSandboxValue(value, budget)
28595
+ );
28596
+ } catch (error) {
28597
+ reject(error);
28598
+ } finally {
28599
+ completePrefix();
28600
+ }
28601
+ }).catch((error) => {
28602
+ reject(error);
28603
+ completePrefix();
28604
+ });
28605
+ });
28606
+ return createSandboxPromise(promise, { synchronousPrefix });
28607
+ }
28600
28608
  function createGeneratorClosure(node, context, evaluateNode2) {
28601
28609
  return createSandboxClosure({
28602
28610
  guest: true,
@@ -32810,4 +32818,4 @@ export {
32810
32818
  FileSnapshotBackend,
32811
32819
  run
32812
32820
  };
32813
- //# sourceMappingURL=chunk-GO774BRE.js.map
32821
+ //# sourceMappingURL=chunk-5J6BX3HD.js.map