@mojir/dvala 0.0.26 → 0.0.28

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.
Files changed (2) hide show
  1. package/dist/cli/cli.js +9 -7
  2. package/package.json +1 -1
package/dist/cli/cli.js CHANGED
@@ -478,7 +478,7 @@ function findAllOccurrences(input, pattern) {
478
478
  }
479
479
  //#endregion
480
480
  //#region package.json
481
- var version = "0.0.26";
481
+ var version = "0.0.28";
482
482
  //#endregion
483
483
  //#region src/typeGuards/string.ts
484
484
  function isString(value, options = {}) {
@@ -31819,9 +31819,9 @@ function evaluate(ast, contextStack) {
31819
31819
  * is passed to every host handler. Used for `race()` cancellation (Phase 6)
31820
31820
  * and host-side timeouts.
31821
31821
  */
31822
- async function evaluateWithEffects(ast, contextStack, handlers, maxSnapshots, deserializeOptions, autoCheckpoint) {
31822
+ async function evaluateWithEffects(ast, contextStack, handlers, maxSnapshots, deserializeOptions, autoCheckpoint, terminalSnapshot) {
31823
31823
  const signal = new AbortController().signal;
31824
- return runEffectLoop(buildInitialStep(ast.body, contextStack), handlers, signal, void 0, maxSnapshots, deserializeOptions, autoCheckpoint);
31824
+ return runEffectLoop(buildInitialStep(ast.body, contextStack), handlers, signal, void 0, maxSnapshots, deserializeOptions, autoCheckpoint, terminalSnapshot);
31825
31825
  }
31826
31826
  /**
31827
31827
  * Evaluate an AST synchronously with effect handler support.
@@ -31851,18 +31851,19 @@ function evaluateWithSyncEffects(ast, contextStack, effectHandlers) {
31851
31851
  * to fire a `perform(dvala.debug.step, stepInfo)` after evaluation,
31852
31852
  * enabling the time-travel debugger.
31853
31853
  */
31854
- async function runEffectLoop(initial, handlers, signal, initialSnapshotState, maxSnapshots, deserializeOptions, autoCheckpoint) {
31854
+ async function runEffectLoop(initial, handlers, signal, initialSnapshotState, maxSnapshots, deserializeOptions, autoCheckpoint, terminalSnapshot) {
31855
31855
  const debugMode = Array.isArray(handlers) && handlers.some((h) => h.pattern === "dvala.debug.step");
31856
31856
  const snapshotState = {
31857
31857
  snapshots: initialSnapshotState ? initialSnapshotState.snapshots : [],
31858
31858
  nextSnapshotIndex: initialSnapshotState ? initialSnapshotState.nextSnapshotIndex : 0,
31859
31859
  executionId: generateUUID(),
31860
31860
  ...maxSnapshots !== void 0 ? { maxSnapshots } : {},
31861
- ...autoCheckpoint ? { autoCheckpoint } : {}
31861
+ ...autoCheckpoint ? { autoCheckpoint } : {},
31862
+ ...terminalSnapshot ? { terminalSnapshot } : {}
31862
31863
  };
31863
31864
  let step = initial;
31864
31865
  function createTerminalSnapshot(options) {
31865
- if (!snapshotState.autoCheckpoint) return;
31866
+ if (!snapshotState.autoCheckpoint && !snapshotState.terminalSnapshot) return;
31866
31867
  const continuation = serializeTerminalSnapshot(snapshotState.snapshots, snapshotState.nextSnapshotIndex);
31867
31868
  const meta = {};
31868
31869
  if (options?.error) meta.error = options.error.toJSON();
@@ -32194,10 +32195,11 @@ function createDvala(options) {
32194
32195
  }
32195
32196
  const ast = buildAst(isDvalaBundle(source) ? source.program : source);
32196
32197
  const disableAutoCheckpoint = runOptions?.disableAutoCheckpoint ?? factoryDisableTimeTravel;
32198
+ const terminalSnapshot = runOptions?.terminalSnapshot;
32197
32199
  const result = await evaluateWithEffects(ast, contextStack, effectHandlers, runOptions?.maxSnapshots, {
32198
32200
  values: bindings,
32199
32201
  modules
32200
- }, !disableAutoCheckpoint);
32202
+ }, !disableAutoCheckpoint, terminalSnapshot);
32201
32203
  if (result.type === "completed") return {
32202
32204
  ...result,
32203
32205
  definedBindings: contextStack.getModuleScopeBindings()
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "overrides": {
4
4
  "file-type": "^21.3.2"
5
5
  },
6
- "version": "0.0.26",
6
+ "version": "0.0.28",
7
7
  "description": "A suspendable, time-traveling functional language for JavaScript with algebraic effects",
8
8
  "author": "Albert Mojir",
9
9
  "license": "MIT",