@systemfsoftware/stryker-js-vitest-runner 7.2.1 → 7.3.0

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/main.mjs CHANGED
@@ -11,7 +11,7 @@ import * as Path from "node:path";
11
11
  import * as NodeUrl from "node:url";
12
12
  import * as fs from "fs";
13
13
  import * as path from "path";
14
- import { createVitest } from "vitest/node";
14
+ import { ThreadsPoolWorker, createVitest } from "vitest/node";
15
15
  //#region \0rolldown/runtime.js
16
16
  var __create = Object.create;
17
17
  var __defProp$4 = Object.defineProperty;
@@ -11518,9 +11518,9 @@ const strictEqual = () => isStrictEquivalent;
11518
11518
  /**
11519
11519
  * @since 2.0.0
11520
11520
  */
11521
- const TypeId$37 = "~effect/Option";
11521
+ const TypeId$38 = "~effect/Option";
11522
11522
  const CommonProto$1 = {
11523
- [TypeId$37]: { _A: (_) => _ },
11523
+ [TypeId$38]: { _A: (_) => _ },
11524
11524
  ...PipeInspectableProto,
11525
11525
  [Symbol.iterator]() {
11526
11526
  return new SingleShotGen(this);
@@ -11570,7 +11570,7 @@ const NoneProto = /*#__PURE__*/ Object.assign(/*#__PURE__*/ Object.create(Common
11570
11570
  }
11571
11571
  });
11572
11572
  /** @internal */
11573
- const isOption = (input) => hasProperty(input, TypeId$37);
11573
+ const isOption = (input) => hasProperty(input, TypeId$38);
11574
11574
  /** @internal */
11575
11575
  const isNone$1 = (fa) => fa._tag === "None";
11576
11576
  /** @internal */
@@ -11586,9 +11586,9 @@ SomeImpl.prototype = SomeProto;
11586
11586
  const some$1 = (value) => new SomeImpl(value);
11587
11587
  //#endregion
11588
11588
  //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/result.js
11589
- const TypeId$36 = "~effect/Result";
11589
+ const TypeId$37 = "~effect/Result";
11590
11590
  const CommonProto = {
11591
- [TypeId$36]: {
11591
+ [TypeId$37]: {
11592
11592
  /* v8 ignore next 2 */
11593
11593
  _A: (_) => _,
11594
11594
  _E: (_) => _
@@ -11639,7 +11639,7 @@ const FailureProto = /*#__PURE__*/ Object.assign(/*#__PURE__*/ Object.create(Com
11639
11639
  }
11640
11640
  });
11641
11641
  /** @internal */
11642
- const isResult$1 = (input) => hasProperty(input, TypeId$36);
11642
+ const isResult$1 = (input) => hasProperty(input, TypeId$37);
11643
11643
  /** @internal */
11644
11644
  const isFailure$1 = (result) => result._tag === "Failure";
11645
11645
  /** @internal */
@@ -12326,6 +12326,30 @@ const getOrThrow$1 = /*#__PURE__*/ getOrThrowWith$1(() => /* @__PURE__ */ new Er
12326
12326
  */
12327
12327
  const map$8 = /*#__PURE__*/ dual(2, (self, f) => isNone(self) ? none() : some(f(self.value)));
12328
12328
  /**
12329
+ * Replaces the value inside a `Some` with a constant, leaving `None` unchanged.
12330
+ *
12331
+ * **When to use**
12332
+ *
12333
+ * Use when you need to replace a present `Option` value while preserving
12334
+ * whether it was `Some` or `None`.
12335
+ *
12336
+ * **Example** (Replacing a value)
12337
+ *
12338
+ * ```ts import.meta.vitest
12339
+ * import { Option } from "effect"
12340
+ *
12341
+ * Option.as(Option.some(42), "new value") // => Option.some("new value")
12342
+ * Option.as(Option.none(), "new value") // => Option.none()
12343
+ * ```
12344
+ *
12345
+ * @see {@link asVoid} to replace with `undefined`
12346
+ * @see {@link map} for a general transformation
12347
+ *
12348
+ * @category mapping
12349
+ * @since 2.0.0
12350
+ */
12351
+ const as$2 = /*#__PURE__*/ dual(2, (self, b) => map$8(self, () => b));
12352
+ /**
12329
12353
  * Applies a function that returns an `Option` to the value of a `Some`,
12330
12354
  * flattening the result. Returns `None` if the input is `None`.
12331
12355
  *
@@ -12687,7 +12711,7 @@ const ServiceProto = {
12687
12711
  };
12688
12712
  const cacheKeys = /*#__PURE__*/ new Set();
12689
12713
  const ReferenceTypeId = "~effect/Context/Reference";
12690
- const TypeId$35 = "~effect/Context";
12714
+ const TypeId$36 = "~effect/Context";
12691
12715
  const MaxDepth = 8;
12692
12716
  const FlattenAfterBaseHits = 8;
12693
12717
  const makeImpl = (cacheRoot, base, overlay, depth) => {
@@ -12767,7 +12791,7 @@ const Proto$8 = {
12767
12791
  return flatten(this);
12768
12792
  },
12769
12793
  ...PipeInspectableProto,
12770
- [TypeId$35]: { _Services: (_) => _ },
12794
+ [TypeId$36]: { _Services: (_) => _ },
12771
12795
  toJSON() {
12772
12796
  return {
12773
12797
  _id: "Context",
@@ -12822,7 +12846,7 @@ const hasSameCache = (self, that) => self.cacheRoot === that.cacheRoot;
12822
12846
  * @category guards
12823
12847
  * @since 2.0.0
12824
12848
  */
12825
- const isContext = (u) => hasProperty(u, TypeId$35);
12849
+ const isContext = (u) => hasProperty(u, TypeId$36);
12826
12850
  /**
12827
12851
  * Checks whether the provided argument is a `Reference`.
12828
12852
  *
@@ -13253,7 +13277,7 @@ const omit$1 = (...keys) => (self) => withFlat(self, (map) => {
13253
13277
  const Reference = Service$1;
13254
13278
  //#endregion
13255
13279
  //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Duration.js
13256
- const TypeId$34 = "~effect/Duration";
13280
+ const TypeId$35 = "~effect/Duration";
13257
13281
  const bigint0$3 = /*#__PURE__*/ BigInt(0);
13258
13282
  const bigint1$2 = /*#__PURE__*/ BigInt(1);
13259
13283
  const bigint2 = /*#__PURE__*/ BigInt(2);
@@ -13329,7 +13353,7 @@ const fromInputUnsafe$1 = (input) => {
13329
13353
  }
13330
13354
  case "object": {
13331
13355
  if (input === null) break;
13332
- if (TypeId$34 in input) return input;
13356
+ if (TypeId$35 in input) return input;
13333
13357
  if (Array.isArray(input)) {
13334
13358
  if (input.length !== 2 || !input.every(isNumber)) return invalid$2(input);
13335
13359
  if (Number.isNaN(input[0]) || Number.isNaN(input[1])) return zero$1;
@@ -13361,7 +13385,7 @@ const zeroDurationValue = {
13361
13385
  const infinityDurationValue = { _tag: "Infinity" };
13362
13386
  const negativeInfinityDurationValue = { _tag: "NegativeInfinity" };
13363
13387
  const DurationProto = {
13364
- [TypeId$34]: TypeId$34,
13388
+ [TypeId$35]: TypeId$35,
13365
13389
  [symbol$2]() {
13366
13390
  switch (this.value._tag) {
13367
13391
  case "Millis": {
@@ -13447,7 +13471,7 @@ const make$36 = (input) => {
13447
13471
  * @category guards
13448
13472
  * @since 2.0.0
13449
13473
  */
13450
- const isDuration = (u) => hasProperty(u, TypeId$34);
13474
+ const isDuration = (u) => hasProperty(u, TypeId$35);
13451
13475
  /**
13452
13476
  * A Duration representing zero time.
13453
13477
  *
@@ -16895,6 +16919,8 @@ const exitInterrupt$1 = (fiberId) => exitFailCause(causeInterrupt(fiberId));
16895
16919
  /** @internal */
16896
16920
  const exitIsSuccess = (self) => self._tag === "Success";
16897
16921
  /** @internal */
16922
+ const exitFilterCause = (self) => self._tag === "Failure" ? succeed$6(self.cause) : fail$6(self);
16923
+ /** @internal */
16898
16924
  const exitVoid = /*#__PURE__*/ exitSucceed(void 0);
16899
16925
  /** @internal */
16900
16926
  const exitMap = /*#__PURE__*/ dual(2, (self, f) => self._tag === "Success" ? exitSucceed(f(self.value)) : self);
@@ -17257,6 +17283,13 @@ const onExit$1 = /*#__PURE__*/ dual(2, onExitPrimitive);
17257
17283
  /** @internal */
17258
17284
  const ensuring$1 = /*#__PURE__*/ dual(2, (self, finalizer) => onExit$1(self, (_) => finalizer));
17259
17285
  /** @internal */
17286
+ const onExitFilter = /*#__PURE__*/ dual(3, (self, filter, f) => onExit$1(self, (exit) => {
17287
+ const b = filter(exit);
17288
+ return isFailure(b) ? void_$3 : f(b.success, exit);
17289
+ }));
17290
+ /** @internal */
17291
+ const onError$1 = /*#__PURE__*/ dual(2, (self, f) => onExitFilter(self, exitFilterCause, f));
17292
+ /** @internal */
17260
17293
  const cached$1 = (self) => sync$1(() => {
17261
17294
  const latch = makeLatchUnsafe(false);
17262
17295
  let started = false;
@@ -18203,7 +18236,7 @@ const void_$2 = exitVoid;
18203
18236
  const isSuccess = exitIsSuccess;
18204
18237
  //#endregion
18205
18238
  //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Deferred.js
18206
- const TypeId$33 = "~effect/Deferred";
18239
+ const TypeId$34 = "~effect/Deferred";
18207
18240
  /**
18208
18241
  * Checks whether a value is a `Deferred`.
18209
18242
  *
@@ -18215,9 +18248,9 @@ const TypeId$33 = "~effect/Deferred";
18215
18248
  * @category guards
18216
18249
  * @since 4.0.0
18217
18250
  */
18218
- const isDeferred = (u) => hasProperty(u, TypeId$33);
18251
+ const isDeferred = (u) => hasProperty(u, TypeId$34);
18219
18252
  const DeferredProto = {
18220
- [TypeId$33]: {
18253
+ [TypeId$34]: {
18221
18254
  _A: identity,
18222
18255
  _E: identity
18223
18256
  },
@@ -18781,14 +18814,14 @@ const close$1 = scopeClose;
18781
18814
  const closeUnsafe = scopeCloseUnsafe;
18782
18815
  //#endregion
18783
18816
  //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Layer.js
18784
- const TypeId$32 = "~effect/Layer";
18817
+ const TypeId$33 = "~effect/Layer";
18785
18818
  const MemoMapTypeId = "~effect/Layer/MemoMap";
18786
18819
  const memoMapReuse = (entry, scope) => {
18787
18820
  entry.observers++;
18788
18821
  return andThen$2(scopeAddFinalizerExit(scope, (exit) => entry.finalizer(exit)), entry.effect);
18789
18822
  };
18790
18823
  const LayerProto = {
18791
- [TypeId$32]: {
18824
+ [TypeId$33]: {
18792
18825
  _ROut: identity,
18793
18826
  _E: identity,
18794
18827
  _RIn: identity
@@ -20312,11 +20345,11 @@ const monotonicTimeNanos = monotonicTimeNanos$1;
20312
20345
  init_esm$1();
20313
20346
  var import_src$9 = /* @__PURE__ */ __toESM(require_src$7(), 1);
20314
20347
  /** @internal */
20315
- const TypeId$31 = "~effect/DateTime";
20348
+ const TypeId$32 = "~effect/DateTime";
20316
20349
  /** @internal */
20317
20350
  const TimeZoneTypeId = "~effect/DateTime/TimeZone";
20318
20351
  const Proto$7 = {
20319
- [TypeId$31]: TypeId$31,
20352
+ [TypeId$32]: TypeId$32,
20320
20353
  pipe() {
20321
20354
  return pipeArguments(this, arguments);
20322
20355
  },
@@ -20542,9 +20575,9 @@ const CurrentMetricAttributes = /*#__PURE__*/ Reference("effect/Metric/CurrentMe
20542
20575
  * @since 4.0.0
20543
20576
  */
20544
20577
  const MetricRegistry = /*#__PURE__*/ Reference("effect/Metric/MetricRegistry", { defaultValue: () => /* @__PURE__ */ new Map() });
20545
- const TypeId$30 = "~effect/Metric";
20578
+ const TypeId$31 = "~effect/Metric";
20546
20579
  var Metric$ = class {
20547
- [TypeId$30] = TypeId$30;
20580
+ [TypeId$31] = TypeId$31;
20548
20581
  #metadata = /*#__PURE__*/ new WeakMap();
20549
20582
  id;
20550
20583
  description;
@@ -23257,6 +23290,34 @@ const addFinalizer = addFinalizer$2;
23257
23290
  */
23258
23291
  const ensuring = ensuring$1;
23259
23292
  /**
23293
+ * Runs the specified effect if this effect fails, providing the error to the
23294
+ * effect if it exists. The provided effect will not be interrupted.
23295
+ *
23296
+ * **Example** (Running cleanup on failure)
23297
+ *
23298
+ * ```ts import.meta.vitest
23299
+ * import { Cause, Data, Effect, Exit } from "effect"
23300
+ * const output: Array<unknown> = []
23301
+ *
23302
+ * class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
23303
+ *
23304
+ * const error = new TaskError({ message: "Something went wrong" })
23305
+ * const task = Effect.fail(error)
23306
+ *
23307
+ * const program = Effect.onError(
23308
+ * task,
23309
+ * (cause) => Effect.sync(() => { output.push(`Cleanup on error: ${Cause.squash(cause)}`) })
23310
+ * )
23311
+ *
23312
+ * void output.push(Effect.runSyncExit(program))
23313
+ * output // => ["Cleanup on error: TaskError: Something went wrong", Exit.fail(error)]
23314
+ * ```
23315
+ *
23316
+ * @category resource management
23317
+ * @since 2.0.0
23318
+ */
23319
+ const onError = onError$1;
23320
+ /**
23260
23321
  * Ensures that a cleanup function runs whether this effect succeeds, fails, or
23261
23322
  * is interrupted.
23262
23323
  *
@@ -26165,7 +26226,7 @@ const bytes = (value) => typeof value === "bigint" ? fromInputUnsafe(value) : fr
26165
26226
  *
26166
26227
  * @since 4.0.0
26167
26228
  */
26168
- const TypeId$29 = "~effect/PlatformError";
26229
+ const TypeId$30 = "~effect/PlatformError";
26169
26230
  /**
26170
26231
  * Error data for an invalid argument passed to a platform API.
26171
26232
  *
@@ -26275,7 +26336,7 @@ var PlatformError = class extends (/*#__PURE__*/ TaggedError$1("PlatformError"))
26275
26336
  *
26276
26337
  * @since 4.0.0
26277
26338
  */
26278
- [TypeId$29] = TypeId$29;
26339
+ [TypeId$30] = TypeId$30;
26279
26340
  get message() {
26280
26341
  return this.reason.message;
26281
26342
  }
@@ -26400,9 +26461,9 @@ const runIn = fiberRunIn;
26400
26461
  const makeUnsafe$3 = makeLatchUnsafe;
26401
26462
  //#endregion
26402
26463
  //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/MutableRef.js
26403
- const TypeId$28 = "~effect/MutableRef";
26464
+ const TypeId$29 = "~effect/MutableRef";
26404
26465
  const MutableRefProto = {
26405
- [TypeId$28]: TypeId$28,
26466
+ [TypeId$29]: TypeId$29,
26406
26467
  ...PipeInspectableProto,
26407
26468
  toJSON() {
26408
26469
  return {
@@ -26703,7 +26764,7 @@ const take$1 = (self) => {
26703
26764
  };
26704
26765
  //#endregion
26705
26766
  //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Queue.js
26706
- const TypeId$27 = "~effect/Queue";
26767
+ const TypeId$28 = "~effect/Queue";
26707
26768
  const EnqueueTypeId = "~effect/Queue/Enqueue";
26708
26769
  const DequeueTypeId = "~effect/Queue/Dequeue";
26709
26770
  const variance = {
@@ -26711,7 +26772,7 @@ const variance = {
26711
26772
  _E: identity
26712
26773
  };
26713
26774
  const QueueProto = {
26714
- [TypeId$27]: variance,
26775
+ [TypeId$28]: variance,
26715
26776
  [EnqueueTypeId]: variance,
26716
26777
  [DequeueTypeId]: variance,
26717
26778
  ...PipeInspectableProto,
@@ -27732,7 +27793,7 @@ const provideContext$2 = /*#__PURE__*/ dual(2, (self, context) => fromTransform$
27732
27793
  const runForEach = /*#__PURE__*/ dual(2, (self, f) => runWith(self, (pull) => forever(flatMap$1(pull, f), { disableYield: true })));
27733
27794
  //#endregion
27734
27795
  //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/stream.js
27735
- const TypeId$25 = "~effect/Stream";
27796
+ const TypeId$26 = "~effect/Stream";
27736
27797
  const streamVariance = {
27737
27798
  _R: identity,
27738
27799
  _E: identity,
@@ -27742,7 +27803,7 @@ const Stream$1 = function(channel) {
27742
27803
  this.channel = channel;
27743
27804
  };
27744
27805
  Stream$1.prototype = {
27745
- [TypeId$25]: streamVariance,
27806
+ [TypeId$26]: streamVariance,
27746
27807
  pipe() {
27747
27808
  return pipeArguments(this, arguments);
27748
27809
  }
@@ -27751,7 +27812,7 @@ Stream$1.prototype = {
27751
27812
  const fromChannel$2 = (channel) => new Stream$1(channel);
27752
27813
  //#endregion
27753
27814
  //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Sink.js
27754
- const TypeId$24 = "~effect/Sink";
27815
+ const TypeId$25 = "~effect/Sink";
27755
27816
  const endVoid = /*#__PURE__*/ succeed$2([void 0]);
27756
27817
  const sinkVariance = {
27757
27818
  _A: identity,
@@ -27761,7 +27822,7 @@ const sinkVariance = {
27761
27822
  _R: identity
27762
27823
  };
27763
27824
  const SinkProto = {
27764
- [TypeId$24]: sinkVariance,
27825
+ [TypeId$25]: sinkVariance,
27765
27826
  pipe() {
27766
27827
  return pipeArguments(this, arguments);
27767
27828
  }
@@ -27914,7 +27975,7 @@ const unwrap$1 = (effect) => fromChannel$1(unwrap$2(map$2(effect, toChannel$1)))
27914
27975
  * @category type IDs
27915
27976
  * @since 4.0.0
27916
27977
  */
27917
- const TypeId$23 = "~effect/Stream";
27978
+ const TypeId$24 = "~effect/Stream";
27918
27979
  /**
27919
27980
  * Checks whether a value is a Stream.
27920
27981
  *
@@ -27930,7 +27991,7 @@ const TypeId$23 = "~effect/Stream";
27930
27991
  * @category guards
27931
27992
  * @since 4.0.0
27932
27993
  */
27933
- const isStream = (u) => hasProperty(u, TypeId$23);
27994
+ const isStream = (u) => hasProperty(u, TypeId$24);
27934
27995
  /**
27935
27996
  * Creates a stream from a array-emitting `Channel`.
27936
27997
  *
@@ -28126,7 +28187,7 @@ const runForEachArray = /*#__PURE__*/ dual(2, (self, f) => runForEach(self.chann
28126
28187
  *
28127
28188
  * @since 4.0.0
28128
28189
  */
28129
- const TypeId$22 = "~effect/FileSystem";
28190
+ const TypeId$23 = "~effect/FileSystem";
28130
28191
  /**
28131
28192
  * Service tag for platform file-system operations.
28132
28193
  *
@@ -28192,7 +28253,7 @@ const FileSystem = /*#__PURE__*/ Service$1("effect/FileSystem");
28192
28253
  */
28193
28254
  const make$26 = (impl) => FileSystem.of({
28194
28255
  ...impl,
28195
- [TypeId$22]: TypeId$22,
28256
+ [TypeId$23]: TypeId$23,
28196
28257
  exists: (path) => pipe(impl.access(path), as(true), catchTag("PlatformError", (e) => e.reason._tag === "NotFound" ? succeed$2(false) : fail$2(e))),
28197
28258
  readFileString: (path, encoding) => flatMap$1(impl.readFile(path), (_) => try_({
28198
28259
  try: () => new TextDecoder(encoding).decode(_),
@@ -28462,7 +28523,7 @@ const unknownToAttributeValue = (value) => {
28462
28523
  * @category type IDs
28463
28524
  * @since 4.0.0
28464
28525
  */
28465
- const TypeId$21 = "~effect/Path";
28526
+ const TypeId$22 = "~effect/Path";
28466
28527
  /**
28467
28528
  * Service tag for accessing the current `Path` implementation.
28468
28529
  *
@@ -28886,9 +28947,9 @@ function trieNodeAt(root, path) {
28886
28947
  *
28887
28948
  * @since 2.0.0
28888
28949
  */
28889
- const TypeId$20 = "~effect/BigDecimal";
28950
+ const TypeId$21 = "~effect/BigDecimal";
28890
28951
  const BigDecimalProto = {
28891
- [TypeId$20]: TypeId$20,
28952
+ [TypeId$21]: TypeId$21,
28892
28953
  [symbol$2]() {
28893
28954
  const normalized = normalize(this);
28894
28955
  return combine(hash(normalized.value), number$2(normalized.scale));
@@ -28935,7 +28996,7 @@ const BigDecimalProto = {
28935
28996
  * @category guards
28936
28997
  * @since 2.0.0
28937
28998
  */
28938
- const isBigDecimal = (u) => hasProperty(u, TypeId$20);
28999
+ const isBigDecimal = (u) => hasProperty(u, TypeId$21);
28939
29000
  /**
28940
29001
  * Creates a `BigDecimal` from a `bigint` value and a safe integer scale.
28941
29002
  *
@@ -29326,7 +29387,7 @@ const fromOptionExit = (option) => option._tag === "None" ? missingExit : succee
29326
29387
  *
29327
29388
  * @since 4.0.0
29328
29389
  */
29329
- const TypeId$19 = "~effect/SchemaIssue/Issue";
29390
+ const TypeId$20 = "~effect/SchemaIssue/Issue";
29330
29391
  /**
29331
29392
  * Returns `true` if the given value is an {@link Issue}.
29332
29393
  *
@@ -29356,7 +29417,7 @@ const TypeId$19 = "~effect/SchemaIssue/Issue";
29356
29417
  * @since 4.0.0
29357
29418
  */
29358
29419
  function isIssue(u) {
29359
- return hasProperty(u, TypeId$19) && u[TypeId$19] === TypeId$19;
29420
+ return hasProperty(u, TypeId$20) && u[TypeId$20] === TypeId$20;
29360
29421
  }
29361
29422
  /**
29362
29423
  * Returns `true` when an issue contains an input reported by the schema parser.
@@ -29391,7 +29452,7 @@ function hasInput(issue) {
29391
29452
  return Object.hasOwn(issue, "input");
29392
29453
  }
29393
29454
  var IssueNodeImpl = class {
29394
- [TypeId$19] = TypeId$19;
29455
+ [TypeId$20] = TypeId$20;
29395
29456
  constructor(input, options) {
29396
29457
  if (options?.reportInput === true && input !== missing) this.input = input;
29397
29458
  }
@@ -30223,7 +30284,7 @@ const Middleware = class extends Class$2 {
30223
30284
  return new Middleware(this.encode, this.decode);
30224
30285
  }
30225
30286
  };
30226
- const TypeId$18 = "~effect/SchemaTransformation/Transformation";
30287
+ const TypeId$19 = "~effect/SchemaTransformation/Transformation";
30227
30288
  /**
30228
30289
  * Constructs a bidirectional schema transformation from its decode and encode getters.
30229
30290
  *
@@ -30231,7 +30292,7 @@ const TypeId$18 = "~effect/SchemaTransformation/Transformation";
30231
30292
  * @since 4.0.0
30232
30293
  */
30233
30294
  const Transformation = class extends Class$2 {
30234
- [TypeId$18] = TypeId$18;
30295
+ [TypeId$19] = TypeId$19;
30235
30296
  _tag = "Transformation";
30236
30297
  decode;
30237
30298
  encode;
@@ -30273,7 +30334,7 @@ const Transformation = class extends Class$2 {
30273
30334
  * @since 4.0.0
30274
30335
  */
30275
30336
  function isTransformation(u) {
30276
- return hasProperty(u, TypeId$18) && u[TypeId$18] === TypeId$18;
30337
+ return hasProperty(u, TypeId$19) && u[TypeId$19] === TypeId$19;
30277
30338
  }
30278
30339
  /**
30279
30340
  * Constructs a `Transformation` from an object with `decode` and `encode`
@@ -30562,6 +30623,13 @@ const isArrays = /*#__PURE__*/ makeGuard("Arrays");
30562
30623
  */
30563
30624
  const isObjects = /*#__PURE__*/ makeGuard("Objects");
30564
30625
  /**
30626
+ * Narrows an {@link AST} to {@link Union}.
30627
+ *
30628
+ * @category guards
30629
+ * @since 3.10.0
30630
+ */
30631
+ const isUnion = /*#__PURE__*/ makeGuard("Union");
30632
+ /**
30565
30633
  * Narrows an {@link AST} to {@link Suspend}.
30566
30634
  *
30567
30635
  * @category guards
@@ -30603,9 +30671,9 @@ const Context = class {
30603
30671
  this.annotations = annotations;
30604
30672
  }
30605
30673
  };
30606
- const TypeId$17 = "~effect/Schema";
30674
+ const TypeId$18 = "~effect/Schema";
30607
30675
  var ASTNodeImpl = class {
30608
- [TypeId$17] = TypeId$17;
30676
+ [TypeId$18] = TypeId$18;
30609
30677
  annotations;
30610
30678
  checks;
30611
30679
  encoding;
@@ -32229,10 +32297,10 @@ function extractStructuralChecks(checks) {
32229
32297
  * @category transforming
32230
32298
  * @since 4.0.0
32231
32299
  */
32232
- const toType = /*#__PURE__*/ memoizeIdempotent((ast) => {
32233
- if (ast.encoding) return toType(replaceEncoding(ast, void 0));
32300
+ const toType$1 = /*#__PURE__*/ memoizeIdempotent((ast) => {
32301
+ if (ast.encoding) return toType$1(replaceEncoding(ast, void 0));
32234
32302
  const out = ast;
32235
- const type = out.recur?.(toType) ?? out;
32303
+ const type = out.recur?.(toType$1) ?? out;
32236
32304
  const encodingChecks = type.encodingChecks;
32237
32305
  if (encodingChecks) {
32238
32306
  const checks = type === ast ? encodingChecks : isArrays(type) || isObjects(type) || isDeclaration(type) && type.typeParameters.length > 0 ? extractStructuralChecks(encodingChecks) : void 0;
@@ -32270,7 +32338,7 @@ const toType = /*#__PURE__*/ memoizeIdempotent((ast) => {
32270
32338
  * @since 4.0.0
32271
32339
  */
32272
32340
  const toEncoded$1 = /*#__PURE__*/ memoizeIdempotent((ast) => {
32273
- return toType(flip(ast));
32341
+ return toType$1(flip(ast));
32274
32342
  });
32275
32343
  function flipEncoding(ast, encoding) {
32276
32344
  const links = encoding;
@@ -32674,7 +32742,7 @@ function makeEffect(schema) {
32674
32742
  const ast = schema.ast;
32675
32743
  let parser;
32676
32744
  return (input, options) => {
32677
- return (parser ??= runWithCompiler(constructorCompiler, toType(ast)))(input, options?.disableChecks ? options?.parseOptions ? {
32745
+ return (parser ??= runWithCompiler(constructorCompiler, toType$1(ast)))(input, options?.disableChecks ? options?.parseOptions ? {
32678
32746
  ...options.parseOptions,
32679
32747
  disableChecks: true
32680
32748
  } : { disableChecks: true } : options?.parseOptions);
@@ -32733,7 +32801,7 @@ function makeOption(schema) {
32733
32801
  * @since 4.0.0
32734
32802
  */
32735
32803
  function make$21(schema) {
32736
- return makeConstructorSync(toType(schema.ast));
32804
+ return makeConstructorSync(toType$1(schema.ast));
32737
32805
  }
32738
32806
  /**
32739
32807
  * Creates a type guard that checks whether an input satisfies the schema's decoded
@@ -32774,7 +32842,7 @@ function makeIs(ast) {
32774
32842
  }
32775
32843
  /** @internal */
32776
32844
  function _is(ast) {
32777
- const typeAST = toType(ast);
32845
+ const typeAST = toType$1(ast);
32778
32846
  let guard = (input) => {
32779
32847
  guard = makeIs(typeAST);
32780
32848
  return guard(input);
@@ -32986,9 +33054,9 @@ const constructorCompiler = (ast) => resolve(ast).makeEffect;
32986
33054
  //#endregion
32987
33055
  //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/schema/make.js
32988
33056
  /** @internal */
32989
- const TypeId$16 = "~effect/Schema/Schema";
33057
+ const TypeId$17 = "~effect/Schema/Schema";
32990
33058
  const SchemaProto = {
32991
- [TypeId$16]: TypeId$16,
33059
+ [TypeId$17]: TypeId$17,
32992
33060
  pipe() {
32993
33061
  return pipeArguments(this, arguments);
32994
33062
  },
@@ -33281,7 +33349,7 @@ const value$3 = (self) => {
33281
33349
  *
33282
33350
  * @since 3.3.0
33283
33351
  */
33284
- const TypeId$15 = "~effect/Redacted";
33352
+ const TypeId$16 = "~effect/Redacted";
33285
33353
  /**
33286
33354
  * Returns `true` if a value is a `Redacted` wrapper.
33287
33355
  *
@@ -33309,7 +33377,7 @@ const TypeId$15 = "~effect/Redacted";
33309
33377
  * @category guards
33310
33378
  * @since 3.3.0
33311
33379
  */
33312
- const isRedacted = (u) => hasProperty(u, TypeId$15);
33380
+ const isRedacted = (u) => hasProperty(u, TypeId$16);
33313
33381
  /**
33314
33382
  * Creates a `Redacted` wrapper for a sensitive value.
33315
33383
  *
@@ -33343,7 +33411,7 @@ const make$19 = (value, options) => {
33343
33411
  return self;
33344
33412
  };
33345
33413
  const Proto$5 = {
33346
- [TypeId$15]: { _A: (_) => _ },
33414
+ [TypeId$16]: { _A: (_) => _ },
33347
33415
  label: void 0,
33348
33416
  ...PipeInspectableProto,
33349
33417
  toJSON() {
@@ -33401,9 +33469,9 @@ const value$2 = value$3;
33401
33469
  * @category type IDs
33402
33470
  * @since 4.0.0
33403
33471
  */
33404
- const TypeId$13 = /*#__PURE__*/ Symbol.for("~effect/http/Headers");
33472
+ const TypeId$14 = /*#__PURE__*/ Symbol.for("~effect/http/Headers");
33405
33473
  const Proto$3 = /*#__PURE__*/ Object.defineProperties(/*#__PURE__*/ Object.create(null), {
33406
- [TypeId$13]: { value: TypeId$13 },
33474
+ [TypeId$14]: { value: TypeId$14 },
33407
33475
  [symbolRedactable]: { value(context) {
33408
33476
  return redact(this, get$3(context, CurrentRedactedNames));
33409
33477
  } },
@@ -33539,7 +33607,7 @@ const CurrentRedactedNames = /*#__PURE__*/ Reference("effect/Headers/CurrentReda
33539
33607
  ({ ...PipeInspectableProto });
33540
33608
  //#endregion
33541
33609
  //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/unstable/net/NetAddress.js
33542
- const TypeId$11 = "~effect/net/NetAddress";
33610
+ const TypeId$12 = "~effect/net/NetAddress";
33543
33611
  const getBytes = (self) => self.bytes;
33544
33612
  /**
33545
33613
  * A checked network-address operation failure retaining the address or supplied input.
@@ -33555,7 +33623,7 @@ const getBytes = (self) => self.bytes;
33555
33623
  * @since 4.0.0
33556
33624
  */
33557
33625
  var NetAddressError = class extends (/*#__PURE__*/ TaggedError$1("NetAddressError")) {};
33558
- const isAddress = (u) => hasProperty(u, TypeId$11);
33626
+ const isAddress = (u) => hasProperty(u, TypeId$12);
33559
33627
  /**
33560
33628
  * Returns `true` when a value is an IPv4 address.
33561
33629
  *
@@ -33593,7 +33661,7 @@ const isInetAddressV6 = (u) => isAddress(u) && u._tag === "InetAddressV6";
33593
33661
  const isUnixPathAddress = (u) => isAddress(u) && u._tag === "UnixPathAddress";
33594
33662
  const Ipv4Proto = {
33595
33663
  _tag: "Ipv4Address",
33596
- [TypeId$11]: TypeId$11,
33664
+ [TypeId$12]: TypeId$12,
33597
33665
  [symbol$1](that) {
33598
33666
  return isIpv4Address(that) && bytesEqual(getBytes(this), getBytes(that));
33599
33667
  },
@@ -33612,7 +33680,7 @@ const Ipv4Proto = {
33612
33680
  };
33613
33681
  const Ipv6Proto = {
33614
33682
  _tag: "Ipv6Address",
33615
- [TypeId$11]: TypeId$11,
33683
+ [TypeId$12]: TypeId$12,
33616
33684
  [symbol$1](that) {
33617
33685
  return isIpv6Address(that) && bytesEqual(getBytes(this), getBytes(that));
33618
33686
  },
@@ -33813,7 +33881,7 @@ const isIpv4Mapped = (self) => {
33813
33881
  };
33814
33882
  const InetV4Proto = {
33815
33883
  _tag: "InetAddressV4",
33816
- [TypeId$11]: TypeId$11,
33884
+ [TypeId$12]: TypeId$12,
33817
33885
  [symbol$1](that) {
33818
33886
  return isInetAddressV4(that) && this.port === that.port && equals$2(this.address, that.address);
33819
33887
  },
@@ -33832,7 +33900,7 @@ const InetV4Proto = {
33832
33900
  };
33833
33901
  const InetV6Proto = {
33834
33902
  _tag: "InetAddressV6",
33835
- [TypeId$11]: TypeId$11,
33903
+ [TypeId$12]: TypeId$12,
33836
33904
  [symbol$1](that) {
33837
33905
  return isInetAddressV6(that) && this.port === that.port && this.scopeId === that.scopeId && equals$2(this.address, that.address);
33838
33906
  },
@@ -33926,7 +33994,7 @@ const formatInet = (self) => {
33926
33994
  };
33927
33995
  const UnixPathProto = {
33928
33996
  _tag: "UnixPathAddress",
33929
- [TypeId$11]: TypeId$11,
33997
+ [TypeId$12]: TypeId$12,
33930
33998
  [symbol$1](that) {
33931
33999
  return isUnixPathAddress(that) && this.path === that.path;
33932
34000
  },
@@ -33956,7 +34024,7 @@ const unixPathAddress = (path) => {
33956
34024
  };
33957
34025
  //#endregion
33958
34026
  //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Schema.js
33959
- const TypeId$10 = TypeId$16;
34027
+ const TypeId$11 = TypeId$17;
33960
34028
  /**
33961
34029
  * Creates a schema for a **parametric** type (a generic container such as
33962
34030
  * `Array<A>`, `Option<A>`, etc.) by accepting a list of type-parameter schemas
@@ -34627,7 +34695,7 @@ const make$16 = make$20;
34627
34695
  * @since 3.10.0
34628
34696
  */
34629
34697
  function isSchema(u) {
34630
- return hasProperty(u, TypeId$10) && u[TypeId$10] === TypeId$10;
34698
+ return hasProperty(u, TypeId$11) && u[TypeId$11] === TypeId$11;
34631
34699
  }
34632
34700
  /**
34633
34701
  * Creates an exact optional key schema for struct fields. Unlike `optional`,
@@ -34686,6 +34754,14 @@ const optional = /*#__PURE__*/ lambda((self) => {
34686
34754
  return make$16(optional$1(self.ast), { schema });
34687
34755
  });
34688
34756
  /**
34757
+ * Extracts the type-side schema: sets `Encoded` to equal the decoded `Type`,
34758
+ * discarding the encoding transformation path.
34759
+ *
34760
+ * @category transforming
34761
+ * @since 4.0.0
34762
+ */
34763
+ const toType = /*#__PURE__*/ lambda((schema) => make$16(toType$1(schema.ast), { schema }));
34764
+ /**
34689
34765
  * Extracts the encoded-side schema: sets `Type` to equal the `Encoded`,
34690
34766
  * discarding the decoding transformation path.
34691
34767
  *
@@ -35309,6 +35385,145 @@ function TaggedStruct(value, fields) {
35309
35385
  });
35310
35386
  }
35311
35387
  /**
35388
+ * Augments an existing {@link Union} of tagged structs with utility methods and an ordered tuple of discriminant
35389
+ * values.
35390
+ *
35391
+ * **Gotchas**
35392
+ *
35393
+ * Throws if multiple members use the same discriminant property key.
35394
+ *
35395
+ * **Example** (Adding tagged-union utilities to an existing union)
35396
+ *
35397
+ * ```ts import.meta.vitest
35398
+ * import { Schema } from "effect"
35399
+ *
35400
+ * const A = Schema.TaggedStruct("A", { value: Schema.Number })
35401
+ * const B = Schema.TaggedStruct("B", { name: Schema.String })
35402
+ *
35403
+ * const MyUnion = Schema.Union([A, B]).pipe(Schema.toTaggedUnion("_tag"))
35404
+ *
35405
+ * // Pattern-match on the union
35406
+ * const result = MyUnion.match({ _tag: "A", value: 1 }, {
35407
+ * A: (a) => `number: ${a.value}`,
35408
+ * B: (b) => `name: ${b.name}`
35409
+ * })
35410
+ * result // => "number: 1"
35411
+ * ```
35412
+ *
35413
+ * @see {@link TaggedUnion} for a shorthand that builds the union from scratch
35414
+ * @category combinators
35415
+ * @since 4.0.0
35416
+ */
35417
+ function toTaggedUnion(tag) {
35418
+ return (self) => {
35419
+ const cases = {};
35420
+ const discriminants = [];
35421
+ const discriminantKeys = /* @__PURE__ */ new Set();
35422
+ const guards = {};
35423
+ const isAnyOf = (keys) => (value) => keys.includes(value[tag]);
35424
+ walk(self);
35425
+ return Object.assign(self, {
35426
+ cases,
35427
+ discriminants,
35428
+ isAnyOf,
35429
+ guards,
35430
+ match,
35431
+ matchOrElse
35432
+ });
35433
+ function walk(schema) {
35434
+ const ast = schema.ast;
35435
+ if (isUnion(ast) && "members" in schema && globalThis.Array.isArray(schema.members) && schema.members.every(isSchema)) return schema.members.forEach(walk);
35436
+ const sentinels = collectSentinels(ast);
35437
+ if (sentinels.length > 0) {
35438
+ const literal = sentinels.find((s) => s.key === tag)?.literal;
35439
+ if (isPropertyKey(literal)) {
35440
+ const key = typeof literal === "number" ? globalThis.String(literal) : literal;
35441
+ if (discriminantKeys.has(key)) throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(literal)}`);
35442
+ discriminantKeys.add(key);
35443
+ discriminants.push(literal);
35444
+ assignProperty$1(cases, literal, schema);
35445
+ assignProperty$1(guards, literal, is$1(toType(schema)));
35446
+ return;
35447
+ }
35448
+ }
35449
+ throw new globalThis.Error("No literal or unique symbol found");
35450
+ }
35451
+ function match() {
35452
+ if (arguments.length === 1) {
35453
+ const cases = arguments[0];
35454
+ return function(value) {
35455
+ const key = value[tag];
35456
+ return (Object.hasOwn(cases, key) ? cases[key] : void 0)(value);
35457
+ };
35458
+ }
35459
+ const value = arguments[0];
35460
+ const cases = arguments[1];
35461
+ const key = value[tag];
35462
+ return (Object.hasOwn(cases, key) ? cases[key] : void 0)(value);
35463
+ }
35464
+ function matchOrElse() {
35465
+ if (arguments.length === 2) {
35466
+ const cases = arguments[0];
35467
+ const orElse = arguments[1];
35468
+ return function(value) {
35469
+ const key = value[tag];
35470
+ return (Object.hasOwn(cases, key) ? cases[key] ?? orElse : orElse)(value);
35471
+ };
35472
+ }
35473
+ const value = arguments[0];
35474
+ const cases = arguments[1];
35475
+ const orElse = arguments[2];
35476
+ const key = value[tag];
35477
+ return (Object.hasOwn(cases, key) ? cases[key] ?? orElse : orElse)(value);
35478
+ }
35479
+ };
35480
+ }
35481
+ /**
35482
+ * Builds a discriminated union from a record of field sets, one per variant.
35483
+ * Each key becomes the `_tag` literal and the value is passed to {@link TaggedStruct}.
35484
+ * The result includes `cases`, `guards`, `isAnyOf`, `match`, and `matchOrElse` utilities.
35485
+ *
35486
+ * **Example** (Pattern matching a discriminated union)
35487
+ *
35488
+ * ```ts import.meta.vitest
35489
+ * import { Schema } from "effect"
35490
+ *
35491
+ * const Shape = Schema.TaggedUnion({
35492
+ * Circle: { radius: Schema.Number },
35493
+ * Rectangle: { width: Schema.Number, height: Schema.Number }
35494
+ * })
35495
+ *
35496
+ * // Pattern-match on a decoded value
35497
+ * const area = Shape.match({ _tag: "Circle", radius: 5 }, {
35498
+ * Circle: (c) => Math.PI * c.radius ** 2,
35499
+ * Rectangle: (r) => r.width * r.height
35500
+ * })
35501
+ * Math.round(area * 100) / 100 // => 78.54
35502
+ * ```
35503
+ *
35504
+ * @see {@link toTaggedUnion} to augment an existing union instead
35505
+ * @category constructors
35506
+ * @since 4.0.0
35507
+ */
35508
+ function TaggedUnion(casesByTag) {
35509
+ const cases = {};
35510
+ const members = [];
35511
+ for (const key of Object.keys(casesByTag)) {
35512
+ const member = TaggedStruct(key, casesByTag[key]);
35513
+ assignProperty$1(cases, key, member);
35514
+ members.push(member);
35515
+ }
35516
+ const union = Union(members);
35517
+ const { guards, isAnyOf, match, matchOrElse } = toTaggedUnion("_tag")(union);
35518
+ return make$16(union.ast, {
35519
+ cases,
35520
+ isAnyOf,
35521
+ guards,
35522
+ match,
35523
+ matchOrElse
35524
+ });
35525
+ }
35526
+ /**
35312
35527
  * Constructs an `SchemaAST.Link` that describes how a value of type `T` encodes to and decodes from a `To` schema.
35313
35528
  * Used when building low-level AST transformations that bridge two schema types.
35314
35529
  *
@@ -36072,7 +36287,7 @@ function makeClass(Inherited, identifier, struct$1, annotations, proto) {
36072
36287
  }
36073
36288
  });
36074
36289
  }
36075
- static [TypeId$10] = TypeId$10;
36290
+ static [TypeId$11] = TypeId$11;
36076
36291
  get [ClassTypeId]() {
36077
36292
  return ClassTypeId;
36078
36293
  }
@@ -36406,7 +36621,7 @@ const Json = /*#__PURE__*/ make$16(/*#__PURE__*/ annotate(Json$1, { toCode: () =
36406
36621
  }) }));
36407
36622
  //#endregion
36408
36623
  //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/Config.js
36409
- const TypeId$9 = "~effect/Config";
36624
+ const TypeId$10 = "~effect/Config";
36410
36625
  /**
36411
36626
  * Represents the error type produced when config loading or validation fails.
36412
36627
  *
@@ -36448,7 +36663,7 @@ const Proto$1 = {
36448
36663
  return this.parse(fiber.getRef(ConfigProvider));
36449
36664
  }
36450
36665
  }),
36451
- [TypeId$9]: TypeId$9,
36666
+ [TypeId$10]: TypeId$10,
36452
36667
  toJSON() {
36453
36668
  return { _id: "Config" };
36454
36669
  }
@@ -41691,7 +41906,7 @@ const set = /*#__PURE__*/ dual(2, (self, value) => sync(() => set$2(self.ref, va
41691
41906
  * @category type IDs
41692
41907
  * @since 4.0.0
41693
41908
  */
41694
- const TypeId$8 = "~effect/socket/Socket";
41909
+ const TypeId$9 = "~effect/socket/Socket";
41695
41910
  /**
41696
41911
  * Service tag for bidirectional socket transports.
41697
41912
  *
@@ -41717,7 +41932,7 @@ const Socket = /*#__PURE__*/ Service$1("effect/socket/Socket");
41717
41932
  * @since 4.0.0
41718
41933
  */
41719
41934
  const make$11 = (options) => Socket.of({
41720
- [TypeId$8]: TypeId$8,
41935
+ [TypeId$9]: TypeId$9,
41721
41936
  reader: options.reader,
41722
41937
  writer: options.writer
41723
41938
  });
@@ -42047,7 +42262,7 @@ var ClientAbort = class extends (/*#__PURE__*/ Service$1()("effect/rpc/RpcSchema
42047
42262
  };
42048
42263
  //#endregion
42049
42264
  //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/unstable/rpc/Rpc.js
42050
- const TypeId$7 = "~effect/rpc/Rpc";
42265
+ const TypeId$8 = "~effect/rpc/Rpc";
42051
42266
  /**
42052
42267
  * Represents server-side metadata for the client associated with an RPC request.
42053
42268
  *
@@ -42077,7 +42292,7 @@ var ServerClient = class {
42077
42292
  }
42078
42293
  };
42079
42294
  const Proto = {
42080
- [TypeId$7]: TypeId$7,
42295
+ [TypeId$8]: TypeId$8,
42081
42296
  pipe() {
42082
42297
  return pipeArguments(this, arguments);
42083
42298
  },
@@ -43233,7 +43448,7 @@ const v7String = (timestampMillis, bytes) => stringify(bytes === void 0 ? v7Byte
43233
43448
  *
43234
43449
  * @since 4.0.0
43235
43450
  */
43236
- const TypeId$6 = "~effect/Crypto";
43451
+ const TypeId$7 = "~effect/Crypto";
43237
43452
  /**
43238
43453
  * Service tag for platform cryptography.
43239
43454
  *
@@ -43304,7 +43519,7 @@ const make$7 = (impl) => {
43304
43519
  }
43305
43520
  };
43306
43521
  return Crypto.of({
43307
- [TypeId$6]: TypeId$6,
43522
+ [TypeId$7]: TypeId$7,
43308
43523
  randomBytes,
43309
43524
  nextDoubleUnsafe,
43310
43525
  nextIntUnsafe,
@@ -47800,7 +48015,7 @@ const fileUrlOps = (windows) => ({
47800
48015
  * @since 4.0.0
47801
48016
  */
47802
48017
  const layer$1 = /* @__PURE__ */ succeed$3(Path$1)({
47803
- [TypeId$21]: TypeId$21,
48018
+ [TypeId$22]: TypeId$22,
47804
48019
  ...Path,
47805
48020
  .../*#__PURE__*/ fileUrlOps(void 0)
47806
48021
  });
@@ -51524,9 +51739,9 @@ const and = /*#__PURE__*/ dual(2, (self, that) => self && that);
51524
51739
  //#endregion
51525
51740
  //#region ../../node_modules/.pnpm/effect@4.0.0-rc.117/node_modules/effect/dist/internal/matcher.js
51526
51741
  /** @internal */
51527
- const TypeId$5 = "~effect/Match/Matcher";
51742
+ const TypeId$6 = "~effect/Match/Matcher";
51528
51743
  const TypeMatcherProto = {
51529
- [TypeId$5]: {
51744
+ [TypeId$6]: {
51530
51745
  _input: identity,
51531
51746
  _filters: identity,
51532
51747
  _remaining: identity,
@@ -51549,7 +51764,7 @@ function makeTypeMatcher(select, cases) {
51549
51764
  return matcher;
51550
51765
  }
51551
51766
  const ValueMatcherProto = {
51552
- [TypeId$5]: {
51767
+ [TypeId$6]: {
51553
51768
  _input: identity,
51554
51769
  _filters: identity,
51555
51770
  _result: identity,
@@ -52429,7 +52644,7 @@ var Cell_exports = /* @__PURE__ */ __exportAll$1({
52429
52644
  * The nominal brand every `Cell` carries. The `Sandwich` chain's `write` is the only door that applies it.
52430
52645
  */
52431
52646
  const CellTypeId = Symbol.for("@systemfsoftware/effect-cell-types/Cell");
52432
- const make$2 = (run) => ({
52647
+ const make$2$1 = (run) => ({
52433
52648
  [CellTypeId]: CellTypeId,
52434
52649
  run,
52435
52650
  ...Prototype$1
@@ -52437,36 +52652,36 @@ const make$2 = (run) => ({
52437
52652
  /**
52438
52653
  * A constant response for any input; the error and service channels are never.
52439
52654
  */
52440
- const succeed = (response) => make$2(() => succeed$2(response));
52655
+ const succeed = (response) => make$2$1(() => succeed$2(response));
52441
52656
  /**
52442
52657
  * A constant infrastructure failure for any input.
52443
52658
  */
52444
- const fail = (error) => make$2(() => fail$2(error));
52659
+ const fail = (error) => make$2$1(() => fail$2(error));
52445
52660
  /**
52446
52661
  * The lifted effect's response, failure, and services carried for any input.
52447
52662
  */
52448
- const fromEffect = (effect) => make$2(() => effect);
52663
+ const fromEffect = (effect) => make$2$1(() => effect);
52449
52664
  /**
52450
52665
  * The thunked cell built afresh on each run; construction never happens at wrap time.
52451
52666
  */
52452
- const suspend = (thunk) => make$2((input) => suspend$2(() => thunk().run(input)));
52667
+ const suspend = (thunk) => make$2$1((input) => suspend$2(() => thunk().run(input)));
52453
52668
  /**
52454
52669
  * The response is the input; the identity for `andThen`.
52455
52670
  */
52456
- const id = () => make$2((input) => succeed$2(input));
52671
+ const id = () => make$2$1((input) => succeed$2(input));
52457
52672
  /**
52458
52673
  * Transforms the Cell's response.
52459
52674
  */
52460
- const map = dual(2, (self, f) => make$2((input) => map$2(self.run(input), f)));
52675
+ const map = dual(2, (self, f) => make$2$1((input) => map$2(self.run(input), f)));
52461
52676
  /**
52462
52677
  * Transforms the Cell's input.
52463
52678
  */
52464
- const mapInput = dual(2, (self, f) => make$2((input) => self.run(f(input))));
52679
+ const mapInput = dual(2, (self, f) => make$2$1((input) => self.run(f(input))));
52465
52680
  /**
52466
52681
  * Feeds this Cell's response to the next Cell as its input. The error and service channels
52467
52682
  * union.
52468
52683
  */
52469
- const andThen = dual(2, (self, that) => make$2((input) => flatMap$1(self.run(input), (response) => {
52684
+ const andThen = dual(2, (self, that) => make$2$1((input) => flatMap$1(self.run(input), (response) => {
52470
52685
  if (typeof that === "function") return that(response).run(response);
52471
52686
  return that.run(response);
52472
52687
  })));
@@ -52474,12 +52689,12 @@ const andThen = dual(2, (self, that) => make$2((input) => flatMap$1(self.run(inp
52474
52689
  * Runs both Cells against the same input and tuples the responses. Fails fast: when one
52475
52690
  * side refuses, the other's write never runs.
52476
52691
  */
52477
- const zip = dual(2, (self, that) => make$2((input) => zipWith$1(self.run(input), that.run(input), (a, b) => [a, b])));
52692
+ const zip = dual(2, (self, that) => make$2$1((input) => zipWith$1(self.run(input), that.run(input), (a, b) => [a, b])));
52478
52693
  /**
52479
52694
  * Runs the inner Cell on the value this Cell read, yielding `Option.none` when it read none.
52480
52695
  * A skip is an absence, never a refusal; the error and service channels union.
52481
52696
  */
52482
- const gate = dual(2, (self, inner) => make$2((input) => flatMap$1(self.run(input), (read) => match$6(read, {
52697
+ const gate = dual(2, (self, inner) => make$2$1((input) => flatMap$1(self.run(input), (read) => match$6(read, {
52483
52698
  onNone: () => succeed$2(none()),
52484
52699
  onSome: (raw) => asSome(inner.run(raw))
52485
52700
  }))));
@@ -52487,31 +52702,31 @@ const gate = dual(2, (self, inner) => make$2((input) => flatMap$1(self.run(input
52487
52702
  * Runs the Cell once per item, in order, and folds the responses into one value. The error
52488
52703
  * and service channels are unchanged; the first refusal ends the run.
52489
52704
  */
52490
- const collect = dual(2, (self, fold) => make$2((items) => map$2(forEach$1(items, (item) => self.run(item)), (responses) => fold(responses))));
52705
+ const collect = dual(2, (self, fold) => make$2$1((items) => map$2(forEach$1(items, (item) => self.run(item)), (responses) => fold(responses))));
52491
52706
  /**
52492
52707
  * Runs the Cell once per item, in order, and folds every outcome — each a `Result.Result` —
52493
52708
  * into one value. Unlike {@link collect}, no refusal ends the run: every item is attempted
52494
52709
  * and its failure travels to the fold.
52495
52710
  */
52496
- const collectAll = dual(2, (self, fold) => make$2((items) => map$2(forEach$1(items, (item) => result$1(self.run(item))), (results) => fold(results))));
52711
+ const collectAll = dual(2, (self, fold) => make$2$1((items) => map$2(forEach$1(items, (item) => result$1(self.run(item))), (results) => fold(results))));
52497
52712
  /**
52498
52713
  * Provides a Context to the Cell, eliminating the services the context carries from `R`. The
52499
52714
  * composition root builds the context once — `Layer.build` under the root scope, or a
52500
52715
  * `ManagedRuntime` — so nothing is rebuilt per run. A missing provideContext is a compile
52501
52716
  * error at the run site.
52502
52717
  */
52503
- const provideContext = dual(2, (self, context) => make$2((input) => provideContext$3(self.run(input), context)));
52718
+ const provideContext = dual(2, (self, context) => make$2$1((input) => provideContext$3(self.run(input), context)));
52504
52719
  /**
52505
52720
  * Remaps the Cell's infrastructure failure.
52506
52721
  */
52507
- const mapError = dual(2, (self, f) => make$2((input) => mapError$1(self.run(input), f)));
52722
+ const mapError = dual(2, (self, f) => make$2$1((input) => mapError$1(self.run(input), f)));
52508
52723
  /**
52509
52724
  * Recovers from the Cell's infrastructure failure by running the fallback cell for the
52510
52725
  * same input. The fallback answers the same response, so the error narrows to the
52511
52726
  * fallback's. A decide refusal is success-channel data by the time run answers, so it
52512
52727
  * passes through untouched and the fallback never runs for it.
52513
52728
  */
52514
- const orElse = dual(2, (self, fallback) => make$2((input) => matchEffect(self.run(input), {
52729
+ const orElse = dual(2, (self, fallback) => make$2$1((input) => matchEffect(self.run(input), {
52515
52730
  onFailure: () => fallback.run(input),
52516
52731
  onSuccess: (value) => succeed$2(value)
52517
52732
  })));
@@ -52519,24 +52734,24 @@ const orElse = dual(2, (self, fallback) => make$2((input) => matchEffect(self.ru
52519
52734
  * Observes the Cell's response with an effect and preserves it. The observer never runs
52520
52735
  * on an infrastructure failure.
52521
52736
  */
52522
- const tap = dual(2, (self, f) => make$2((input) => tap$1(self.run(input), f)));
52737
+ const tap = dual(2, (self, f) => make$2$1((input) => tap$1(self.run(input), f)));
52523
52738
  /**
52524
52739
  * Threads the response through the function's cell on the original input. Both cells
52525
52740
  * observe the identical input; the error and service channels union.
52526
52741
  */
52527
- const flatMap = dual(2, (self, f) => make$2((input) => flatMap$1(self.run(input), (response) => f(response).run(input))));
52742
+ const flatMap = dual(2, (self, f) => make$2$1((input) => flatMap$1(self.run(input), (response) => f(response).run(input))));
52528
52743
  /**
52529
52744
  * Combines two cells over one input with the given function. Fail-fast: when one side
52530
52745
  * refuses, the run fails and the error and service channels union.
52531
52746
  */
52532
- const zipWith = dual(3, (self, that, f) => make$2((input) => zipWith$1(self.run(input), that.run(input), f)));
52747
+ const zipWith = dual(3, (self, that, f) => make$2$1((input) => zipWith$1(self.run(input), that.run(input), f)));
52533
52748
  /**
52534
52749
  * Folds the run outcome with pure handlers. A decide refusal is success-channel data by
52535
52750
  * the time run answers, so it reaches the success arm; the resulting error channel is
52536
52751
  * never.
52537
52752
  */
52538
- const match = dual(2, (self, options) => make$2((input) => match$2(self.run(input), options)));
52539
- const Do = make$2(() => succeed$2({}));
52753
+ const match = dual(2, (self, options) => make$2$1((input) => match$2(self.run(input), options)));
52754
+ const Do = make$2$1(() => succeed$2({}));
52540
52755
  /**
52541
52756
  * Adds a named field to the Do accumulator by running the cell the function
52542
52757
  * builds from the accumulated scope. Both cells observe the identical input,
@@ -55450,10 +55665,10 @@ var MutantNotApplied = class extends TaggedError()("MutantNotApplied", {
55450
55665
  mutatorName: String$2
55451
55666
  }) {};
55452
55667
  const formatKeyOf = (ast) => ast.format === "embedded" ? ast.formatId : ast.format;
55453
- const TypeId$4 = Symbol.for("~systemfsoftware/stryker-js-instrumenter/Ast");
55454
- const AstHandleDef = Handle_exports.make()(TypeId$4);
55668
+ const TypeId$5 = Symbol.for("~systemfsoftware/stryker-js-instrumenter/Ast");
55669
+ const AstHandleDef = Handle_exports.make()(TypeId$5);
55455
55670
  AstHandleDef.is;
55456
- const make$1 = (root) => AstHandleDef.make({ root });
55671
+ const make$2 = (root) => AstHandleDef.make({ root });
55457
55672
  const EXPRESSION_KINDS = {
55458
55673
  ArrayExpression: true,
55459
55674
  ArrowFunctionExpression: true,
@@ -56194,7 +56409,7 @@ const moduleExportName = (name) => getOrElse$1(identifierText(name), () => "");
56194
56409
  const staticMemberName = (member) => value(member.computed).pipe(when(false, () => identifierText(member.property)), orElse$1(() => none()));
56195
56410
  const nodesOutsideFunctions = (root) => {
56196
56411
  const collected = [];
56197
- traverse(make$1(root), { enter(path) {
56412
+ traverse(make$2(root), { enter(path) {
56198
56413
  collected.push(path.node);
56199
56414
  pruneAtFunction(path);
56200
56415
  } });
@@ -56202,7 +56417,7 @@ const nodesOutsideFunctions = (root) => {
56202
56417
  };
56203
56418
  const allNodesUnder = (root) => {
56204
56419
  const collected = [];
56205
- traverse(make$1(root), { enter(path) {
56420
+ traverse(make$2(root), { enter(path) {
56206
56421
  collected.push(path.node);
56207
56422
  } });
56208
56423
  return collected;
@@ -56504,7 +56719,7 @@ function cloneWithReplacement(mutant, originalTree) {
56504
56719
  }
56505
56720
  function hasReplaced(root, original, replacement) {
56506
56721
  let applied = false;
56507
- traverse(make$1(root), { enter(path) {
56722
+ traverse(make$2(root), { enter(path) {
56508
56723
  if (!applied) applied = replaceFirstMatch(path, original, replacement);
56509
56724
  } });
56510
56725
  return applied;
@@ -59185,7 +59400,7 @@ const transformScriptDataFirst = ({ root, originFileName, rawContent, offset, co
59185
59400
  const placementMap = /* @__PURE__ */ new Map();
59186
59401
  return gen(function* () {
59187
59402
  const lineTable = yield* orDie(decodeEffect(LineTableFromText)(rawContent));
59188
- attachComments(make$1(root), comments, lineTable);
59403
+ attachComments(make$2(root), comments, lineTable);
59189
59404
  let directiveRule = [];
59190
59405
  let hasLiveMutants = false;
59191
59406
  const selection = selectMutators(DEFAULT_MUTATOR_REGISTRY, options.optInMutations);
@@ -59193,7 +59408,7 @@ const transformScriptDataFirst = ({ root, originFileName, rawContent, offset, co
59193
59408
  const allMutatorNames = selection.known.map((name) => name.toLowerCase());
59194
59409
  const warnings = [];
59195
59410
  yield* try_({
59196
- try: () => traverse(make$1(root), {
59411
+ try: () => traverse(make$2(root), {
59197
59412
  enter(path) {
59198
59413
  const directives = directivesOf(path.node, (node) => getNodeLocation(node).start.line);
59199
59414
  directiveRule = directives.reduce(foldInto, directiveRule);
@@ -59901,7 +60116,7 @@ var Mutant_exports = /* @__PURE__ */ __exportAll$2({
59901
60116
  * @category type IDs
59902
60117
  * @since 4.0.0
59903
60118
  */
59904
- const TypeId$3 = "~effect/rpc/RpcMiddleware";
60119
+ const TypeId$4 = "~effect/rpc/RpcMiddleware";
59905
60120
  /**
59906
60121
  * Creates a typed RPC middleware service class, with optional service
59907
60122
  * requirements, provided services, error schema, and client-side requirement
@@ -59925,7 +60140,7 @@ const Service = () => (id, options) => {
59925
60140
  Object.defineProperty(ServiceClass, "stack", { get() {
59926
60141
  return creationError?.stack;
59927
60142
  } });
59928
- ServiceClass_[TypeId$3] = TypeId$3;
60143
+ ServiceClass_[TypeId$4] = TypeId$4;
59929
60144
  ServiceClass_.error = options?.error ?? Never;
59930
60145
  ServiceClass_.requiredForClient = options?.requiredForClient ?? false;
59931
60146
  return ServiceClass;
@@ -59975,6 +60190,10 @@ const Percentage = Finite.pipe(check(isBetween({
59975
60190
  minimum: 0,
59976
60191
  maximum: 100
59977
60192
  })));
60193
+ const MutationScore = TaggedUnion({
60194
+ Scored: { percentage: Percentage },
60195
+ Unscored: {}
60196
+ });
59978
60197
  var Metrics = class Metrics extends Class("Metrics")({
59979
60198
  pending: NonNegativeInt,
59980
60199
  killed: NonNegativeInt,
@@ -60004,10 +60223,10 @@ var Metrics = class Metrics extends Class("Metrics")({
60004
60223
  return this.totalValid + this.totalInvalid + this.ignored + this.pending;
60005
60224
  }
60006
60225
  get mutationScore() {
60007
- return Math.min(100, Math.max(0, this.totalDetected / this.totalValid * 100));
60226
+ return scoreOf(this.totalDetected, this.totalValid);
60008
60227
  }
60009
60228
  get mutationScoreBasedOnCoveredCode() {
60010
- return Math.min(100, Math.max(0, this.totalDetected / this.totalCovered * 100));
60229
+ return scoreOf(this.totalDetected, this.totalCovered);
60011
60230
  }
60012
60231
  static fromMutants(mutants) {
60013
60232
  return Metrics.make({
@@ -60023,6 +60242,10 @@ var Metrics = class Metrics extends Class("Metrics")({
60023
60242
  }
60024
60243
  };
60025
60244
  const metricCountOf = (mutants, status) => mutants.filter((mutant) => mutant.status === status).length;
60245
+ const scoreOf = (detected, counted) => match$1(counted > 0, {
60246
+ onTrue: () => MutationScore.cases.Scored.make({ percentage: detected / counted * 100 }),
60247
+ onFalse: () => MutationScore.cases.Unscored.make({})
60248
+ });
60026
60249
  const MetricsResultSchema = Struct({
60027
60250
  name: String$2,
60028
60251
  metrics: Metrics,
@@ -60859,13 +61082,13 @@ const restrictSocket = (address) => value(address).pipe(tag("UnixPathAddress", (
60859
61082
  onTrue: () => void_$1,
60860
61083
  onFalse: () => flatMap$1(FileSystem, (fs) => fs.chmod(path, 384))
60861
61084
  })), orElse$1(() => void_$1));
60862
- const TypeId$2 = Symbol.for("~systemfsoftware/stryker-js-plugin-runtime/WorkerServer");
61085
+ const TypeId$3 = Symbol.for("~systemfsoftware/stryker-js-plugin-runtime/WorkerServer");
60863
61086
  const workerServerLayerOf = (params) => unwrap$3(gen(function* () {
60864
61087
  const socket = yield* SocketServer;
60865
61088
  yield* restrictSocket(socket.address);
60866
61089
  return layer$8(params.rpcs).pipe(provide$2(params.handlers), provide$2(params.schemaServices), provide$2(layerProtocolSocketServer), provide$2(layerNdjson), provide$2(traceContextServer));
60867
61090
  }));
60868
- Blueprint_exports.make()(TypeId$2).steps({
61091
+ Blueprint_exports.make()(TypeId$3).steps({
60869
61092
  steps: {},
60870
61093
  targets: { layer: workerServerLayerOf }
60871
61094
  }).is;
@@ -61008,7 +61231,7 @@ const normalizeTestIdRaw = (id, projectRoot) => {
61008
61231
  return `${toProjectRelativePath(stripProjectRoot(id.slice(0, hash), projectRoot))}#${id.slice(hash + 1)}`;
61009
61232
  }), exhaustive);
61010
61233
  };
61011
- const toTestStatus = (taskState, mode) => value(mode === "skip").pipe(when(true, () => "skipped"), when(false, () => value(taskState).pipe(when("pass", () => "success"), when("skip", () => "skipped"), when("todo", () => "skipped"), orElse$1(() => "failed"))), exhaustive);
61234
+ const toTestStatus = (taskState, mode) => value(mode === "skip" || mode === "todo").pipe(when(true, () => "skipped"), when(false, () => value(taskState).pipe(when("pass", () => "success"), when("skip", () => "skipped"), when("todo", () => "skipped"), orElse$1(() => "failed"))), exhaustive);
61012
61235
  const findSuiteErrorRaw = (suite) => match$6(fromNullishOr(suite), {
61013
61236
  onNone: () => void 0,
61014
61237
  onSome: (current) => match$6(recordOption(current), {
@@ -61074,12 +61297,29 @@ const convertTestRaw = (test, projectRoot) => {
61074
61297
  status: "success"
61075
61298
  })));
61076
61299
  };
61300
+ const VitestFileFailure = Struct({
61301
+ fileName: String$2,
61302
+ message: String$2
61303
+ });
61304
+ const fileFailureTest = (failure, projectRoot) => ({
61305
+ id: normalizeTestIdRaw(`${failure.fileName}#${failure.fileName}`, projectRoot),
61306
+ name: failure.fileName,
61307
+ timeSpentMs: 0,
61308
+ status: "failed",
61309
+ failureMessage: failure.message,
61310
+ fileName: failure.fileName
61311
+ });
61077
61312
  const VitestTestRun = Unknown.pipe(decodeTo(ArraySchema(TestRunner_exports.TestResultSchema), transform$1({
61078
61313
  decode: (payload) => match$6(recordOption(payload), {
61079
61314
  onNone: () => [],
61080
61315
  onSome: (run) => {
61081
61316
  const projectRoot = getOrElse$1(getStringField(run, "projectRoot"), () => "");
61082
- return getOrElse$1(asArrayOption(run["records"]), () => []).map((record) => convertTestRaw(record, projectRoot));
61317
+ const records = getOrElse$1(asArrayOption(run["records"]), () => []);
61318
+ const fileFailures = getOrElse$1(asArrayOption(run["fileFailures"]), () => []).flatMap((value) => match$6(decodeUnknownOption(VitestFileFailure)(value), {
61319
+ onNone: () => [],
61320
+ onSome: (failure) => [fileFailureTest(failure, projectRoot)]
61321
+ }));
61322
+ return [...records.map((record) => convertTestRaw(record, projectRoot)), ...fileFailures];
61083
61323
  }
61084
61324
  }),
61085
61325
  encode: (tests) => tests
@@ -61240,6 +61480,7 @@ const VitestRunnerOptionsSchema = Struct({
61240
61480
  dir: optional(String$2),
61241
61481
  related: Boolean$3.pipe(withDecodingDefaultKey(succeed$2(true))),
61242
61482
  configFile: optional(String$2),
61483
+ pool: optional(Literal("threads")),
61243
61484
  timeoutTrapFile: optional(String$2),
61244
61485
  timeoutTrapMutantId: optional(String$2)
61245
61486
  });
@@ -61259,15 +61500,111 @@ const PackageManifest = StructWithRest(Struct({
61259
61500
  exports: optional(Record(String$2, ExportEntry))
61260
61501
  }), [Record(String$2, Unknown)]);
61261
61502
  //#endregion
61503
+ //#region src/StandbyThreadsPool.handle.ts
61504
+ const TypeId$2 = Symbol.for("~systemfsoftware/stryker-js-vitest-runner/StandbyThreadsPool");
61505
+ const POOL_NAME = "strykerThreads";
61506
+ const StandbyThreadsPool = Handle_exports.make()(TypeId$2);
61507
+ StandbyThreadsPool.is;
61508
+ const spawnThreadsPoolWorker = (options) => new ThreadsPoolWorker(options);
61509
+ const make$1 = (spawn = spawnThreadsPoolWorker) => StandbyThreadsPool.make({ name: POOL_NAME }, {
61510
+ slots: [],
61511
+ spawn
61512
+ });
61513
+ const sameEnv = (left, right) => {
61514
+ const names = Object.keys(left);
61515
+ return names.length === Object.keys(right).length && names.every((name) => left[name] === right[name]);
61516
+ };
61517
+ const sameExecArgv = (left, right) => left.length === right.length && left.every((arg, index) => arg === right[index]);
61518
+ const sameLaunchOptions = (slot, options) => sameEnv(slot.env, options.env) && sameExecArgv(slot.execArgv, options.execArgv);
61519
+ const sameSpareRequest = (slot, options) => slot.project === options.project && sameLaunchOptions(slot, options);
61520
+ const reusesThread = (slot, options) => slot.state === "spare" && sameSpareRequest(slot, options);
61521
+ const spareFor = (slots, options) => fromNullishOr(slots.find((slot) => reusesThread(slot, options)));
61522
+ const bootFailed = () => /* @__PURE__ */ new Error("[stryker-js-vitest-runner]: the standby worker thread died before a runner claimed it");
61523
+ const deathFailure = (slot) => slot.state === "claimed" ? /* @__PURE__ */ new Error("[stryker-js-vitest-runner]: the standby worker thread died after a runner claimed it") : bootFailed();
61524
+ const dieSlot = (slot, failure) => {
61525
+ slot.state = "failed";
61526
+ slot.failure = some(failure);
61527
+ };
61528
+ const failureOf = (slot) => getOrElse$1(slot.failure, bootFailed);
61529
+ const deathOf = (slot, cause) => getOrElse$1(liftPredicate(cause, isError), () => deathFailure(slot));
61530
+ const guardSlot = (slot) => {
61531
+ slot.worker.on("error", (cause) => dieSlot(slot, deathOf(slot, cause)));
61532
+ slot.worker.on("exit", () => dieSlot(slot, deathFailure(slot)));
61533
+ };
61534
+ const spawnSlot = (registry, options) => {
61535
+ const worker = registry.spawn(options);
61536
+ const slot = {
61537
+ project: options.project,
61538
+ env: { ...options.env },
61539
+ execArgv: [...options.execArgv],
61540
+ worker,
61541
+ state: "spare",
61542
+ failure: none(),
61543
+ started: worker.start().then(() => guardSlot(slot), (cause) => dieSlot(slot, deathOf(slot, cause)))
61544
+ };
61545
+ registry.slots.push(slot);
61546
+ return slot;
61547
+ };
61548
+ const claimedSlot = (slot) => {
61549
+ slot.state = "claimed";
61550
+ return slot;
61551
+ };
61552
+ const stopWorker = (slot) => slot.worker.stop().then(() => {
61553
+ slot.state = "stopped";
61554
+ }, (cause) => {
61555
+ const failure = deathOf(slot, cause);
61556
+ dieSlot(slot, failure);
61557
+ return Promise.reject(failure);
61558
+ });
61559
+ const stopSlot = (slot) => value(slot.state).pipe(when("spare", () => stopWorker(slot)), when("claimed", () => stopWorker(slot)), orElse$1(() => Promise.resolve()));
61560
+ const startSlot = (slot) => value(slot.state).pipe(when("failed", () => Promise.reject(failureOf(slot))), orElse$1(() => slot.started.then(() => slot.state === "failed" ? Promise.reject(failureOf(slot)) : void 0)));
61561
+ const poolWorkerOf = (slot) => ({
61562
+ name: POOL_NAME,
61563
+ on: (event, callback) => slot.worker.on(event, callback),
61564
+ off: (event, callback) => slot.worker.off(event, callback),
61565
+ send: (message) => slot.worker.send(message),
61566
+ deserialize: (data) => slot.worker.deserialize(data),
61567
+ start: () => startSlot(slot),
61568
+ stop: () => stopSlot(slot)
61569
+ });
61570
+ const isLive = (slot) => slot.state === "spare" || slot.state === "claimed";
61571
+ const pruneFinished = (registry) => {
61572
+ registry.slots.splice(0, registry.slots.length, ...registry.slots.filter(isLive));
61573
+ };
61574
+ const claim = (self, options) => {
61575
+ const registry = StandbyThreadsPool.slot(self);
61576
+ pruneFinished(registry);
61577
+ const claimed = getOrElse$1(map$8(spareFor(registry.slots, options), claimedSlot), () => claimedSlot(spawnSlot(registry, options)));
61578
+ spawnSlot(registry, options);
61579
+ return poolWorkerOf(claimed);
61580
+ };
61581
+ const initializer = (self) => ({
61582
+ name: self.name,
61583
+ createPoolWorker: (options) => claim(self, options)
61584
+ });
61585
+ const failedStopOf = (slots, results) => fromNullishOr(slots.find((_slot, index) => results[index].status === "rejected"));
61586
+ const dispose = (self) => {
61587
+ const slots = [...StandbyThreadsPool.slot(self).slots];
61588
+ return Promise.allSettled(slots.map(stopSlot)).then((results) => match$6(failedStopOf(slots, results), {
61589
+ onNone: () => void 0,
61590
+ onSome: (slot) => Promise.reject(failureOf(slot))
61591
+ }));
61592
+ };
61593
+ //#endregion
61262
61594
  //#region src/VitestRuntime.handle.ts
61263
61595
  const TypeId$1 = Symbol.for("~systemfsoftware/stryker-js-vitest-runner/VitestRuntime");
61264
61596
  const VitestRuntime = Handle_exports.make()(TypeId$1);
61265
61597
  VitestRuntime.is;
61266
61598
  const driverOf = (self) => VitestRuntime.slot(self);
61599
+ const isErrorWithCode = (value) => typeof Reflect.get(Object(value), "code") === "string";
61600
+ const errorCodeOf = (cause) => map$8(liftPredicate(cause, isErrorWithCode), (value) => value.code);
61267
61601
  const failRuntime$1 = (phase) => (cause) => new TestRunner_exports.TestRunnerFailed({
61268
61602
  runnerName: "vitest",
61269
61603
  phase,
61270
- cause: getOrElse$1(map$8(ErrorText_exports.ErrorText.fromCause(cause), (rendered) => rendered.text), () => "")
61604
+ cause: `${getOrElse$1(map$8(ErrorText_exports.ErrorText.fromCause(cause), (rendered) => rendered.text), () => "")}${match$6(errorCodeOf(cause), {
61605
+ onNone: () => "",
61606
+ onSome: (code) => ` (code: ${code})`
61607
+ })}`
61271
61608
  });
61272
61609
  const disableScreenshotFailures = (value) => map$8(filter$1(fromNullishOr(value), isObject), (browser) => {
61273
61610
  Reflect.set(browser, "screenshotFailures", false);
@@ -61285,9 +61622,19 @@ const withApplicationSetup = (self, namespace) => {
61285
61622
  };
61286
61623
  const make = (options) => withApplicationSetup(VitestRuntime.make({
61287
61624
  projectRoot: options.projectRoot,
61288
- localSetupFile: options.localSetupFile
61625
+ localSetupFile: options.localSetupFile,
61626
+ mutantBail: options.mutantBail
61289
61627
  }, options.driver), options.namespace);
61290
- const setMode = dual(2, (self, mode) => driverOf(self).provide("mode", mode));
61628
+ const DRY_RUN_REPORTS_EVERY_FAILURE = 0;
61629
+ const workerBailFor = (self, mode) => mode === "dry-run" ? DRY_RUN_REPORTS_EVERY_FAILURE : self.mutantBail;
61630
+ const setMode = dual(2, (self, mode) => {
61631
+ const driver = driverOf(self);
61632
+ const bail = workerBailFor(self, mode);
61633
+ driver.projects.forEach((project) => {
61634
+ project.config.bail = bail;
61635
+ });
61636
+ driver.provide("mode", mode);
61637
+ });
61291
61638
  const provideValue = dual(3, (self, key, value$4) => value(key).pipe(when("hitLimit", () => {
61292
61639
  driverOf(self).provide("hitLimit", getOrUndefined$1(filter$1(fromNullishOr(value$4), isNumber)));
61293
61640
  }), when("mutantActivation", () => {
@@ -61433,7 +61780,7 @@ const resolveVitest = (_dir) => {
61433
61780
  });
61434
61781
  }).pipe(catchCause(() => fallback), catchDefect(() => fallback), orDie);
61435
61782
  };
61436
- const createVitestConfig = (input) => ({
61783
+ const createVitestConfig = (input, standbyThreads) => ({
61437
61784
  config: input.vitestOptions.configFile,
61438
61785
  coverage: { enabled: false },
61439
61786
  maxWorkers: 1,
@@ -61444,24 +61791,29 @@ const createVitestConfig = (input) => ({
61444
61791
  onNone: () => ({}),
61445
61792
  onSome: (dir) => ({ dir })
61446
61793
  }),
61794
+ ...match$6(fromNullishOr(input.vitestOptions.pool), {
61795
+ onNone: () => ({}),
61796
+ onSome: () => ({ pool: initializer(standbyThreads) })
61797
+ }),
61447
61798
  bail: input.bail,
61448
61799
  onConsoleLog: () => false,
61449
61800
  silent: true,
61450
61801
  reporters: [{ onInit(_vitest) {} }]
61451
61802
  });
61452
- const acquire = (input) => gen(function* () {
61453
- const { crypto, fileSystem: fs, path } = input;
61454
- const suffix = yield* crypto.randomUUIDv4.pipe(mapError$1(failRuntime("init")));
61455
- const localSetupFile = path.resolve(input.projectRoot, "stryker-setup-" + suffix + ".js");
61456
- const setupFilePath = yield* match$6(fromNullishOr(input.setupFilePath), {
61457
- onNone: () => path.fromFileUrl(STRYKER_SETUP_URL).pipe(mapError$1(failRuntime("init"))),
61458
- onSome: succeed$2
61459
- });
61460
- yield* fs.copyFile(setupFilePath, localSetupFile).pipe(mapError$1(failRuntime("init")));
61803
+ const BROWSER_REFUSAL = "the vm runner runs Vitest's isolated `threads` pool, which cannot run browser-mode projects; set `testRunner: 'vitest'` to run them";
61804
+ const browserRefusalOf = (driver) => liftPredicate(driver.config.browser.enabled || driver.projects.some((project) => project.config.browser.enabled), (enabled) => enabled).pipe(as$2(BROWSER_REFUSAL));
61805
+ const closeAfterFailure = (runtime, fs) => close(runtime).pipe(provideService(FileSystem, fs), orElseSucceed(() => void 0), catchDefect(() => void_$1));
61806
+ const refuseBrowser = (input, driver) => match$6(input.vitestOptions.pool === void 0 ? none() : browserRefusalOf(driver), {
61807
+ onNone: () => void_$1,
61808
+ onSome: (reason) => fail$2(failRuntime("init")(reason))
61809
+ });
61810
+ const openRuntime = (input, localSetupFile) => gen(function* () {
61811
+ const { fileSystem: fs, path } = input;
61461
61812
  const aliases = yield* readSandboxSelfAliases(input.projectRoot, fs, path);
61462
61813
  const { createVitest } = yield* input.resolver(input.projectRoot).pipe(catchDefect((cause) => fail$2(failRuntime("init")(cause))));
61814
+ const standbyThreads = make$1();
61463
61815
  const driver = yield* tryPromise({
61464
- try: () => createVitest("test", createVitestConfig(input), {
61816
+ try: () => createVitest("test", createVitestConfig(input, standbyThreads), {
61465
61817
  resolve: {
61466
61818
  alias: [...aliases],
61467
61819
  conditions: ["import"]
@@ -61470,12 +61822,30 @@ const acquire = (input) => gen(function* () {
61470
61822
  }),
61471
61823
  catch: (cause) => failRuntime("init")(cause)
61472
61824
  });
61473
- return make({
61825
+ driver.onClose(() => dispose(standbyThreads));
61826
+ const runtime = make({
61474
61827
  driver,
61475
61828
  projectRoot: input.projectRoot,
61476
61829
  localSetupFile,
61477
- namespace: input.namespace
61830
+ namespace: input.namespace,
61831
+ mutantBail: input.bail
61832
+ });
61833
+ yield* refuseBrowser(input, driver).pipe(onError(() => closeAfterFailure(runtime, fs)));
61834
+ return runtime;
61835
+ });
61836
+ const acquire = (input) => gen(function* () {
61837
+ const { crypto, fileSystem: fs, path } = input;
61838
+ const suffix = yield* crypto.randomUUIDv4.pipe(mapError$1(failRuntime("init")));
61839
+ const localSetupFile = path.resolve(input.projectRoot, "stryker-setup-" + suffix + ".js");
61840
+ const setupFilePath = yield* match$6(fromNullishOr(input.setupFilePath), {
61841
+ onNone: () => path.fromFileUrl(STRYKER_SETUP_URL).pipe(mapError$1(failRuntime("init"))),
61842
+ onSome: succeed$2
61478
61843
  });
61844
+ yield* fs.copyFile(setupFilePath, localSetupFile).pipe(mapError$1(failRuntime("init")));
61845
+ return yield* openRuntime(input, localSetupFile).pipe(onError(() => fs.remove(localSetupFile, {
61846
+ recursive: true,
61847
+ force: true
61848
+ }).pipe(orElseSucceed(() => void 0))));
61479
61849
  });
61480
61850
  const of = Blueprint_exports.make()(TypeId).steps({
61481
61851
  steps: {},
@@ -61543,7 +61913,7 @@ const makeMutantRunCell = (deps) => Sandwich_exports.named("stryker.vitest.mutan
61543
61913
  yield* session.provide("hitLimit", command.hitLimit);
61544
61914
  yield* session.provide("mutantActivation", command.mutantActivation);
61545
61915
  yield* session.provide("activeMutant", command.activeMutant.id);
61546
- const { rawTests, hasExternalError, externalErrorText } = yield* deps.collectRaw({
61916
+ const { rawTests, fileFailures, hasExternalError, externalErrorText } = yield* deps.collectRaw({
61547
61917
  testIds: getOrUndefined$1(map$8(fromNullishOr(command.testFilter), (ids) => [...ids])),
61548
61918
  relatedFiles: [command.sandboxFileName]
61549
61919
  });
@@ -61554,7 +61924,8 @@ const makeMutantRunCell = (deps) => Sandwich_exports.named("stryker.vitest.mutan
61554
61924
  _tag: "VitestMutantRunCommand",
61555
61925
  tests: {
61556
61926
  projectRoot: deps.projectRoot,
61557
- records: rawTests
61927
+ records: rawTests,
61928
+ fileFailures
61558
61929
  },
61559
61930
  hasExternalError,
61560
61931
  externalErrorText,
@@ -61626,8 +61997,22 @@ const collectTestsFromSuite = (suite) => suite.tasks.flatMap((task) => match$6(l
61626
61997
  onNone: () => toArray(liftPredicate(task, isTestTask)),
61627
61998
  onSome: (nested) => collectTestsFromSuite(nested)
61628
61999
  }));
62000
+ const messageOfError = (error) => filter$1(fromNullishOr(error.message), (message) => message.length > 0);
62001
+ const fileFailureMessages = (file) => match$6(fromNullishOr(file.result?.errors), {
62002
+ onNone: () => [],
62003
+ onSome: (errors) => errors.flatMap((error) => toArray(messageOfError(error)))
62004
+ });
62005
+ const fileFailureMessage = (file) => {
62006
+ const messages = fileFailureMessages(file);
62007
+ return messages.length === 0 ? "StrykerJS: the test file failed to load" : messages.join("\n");
62008
+ };
62009
+ const SKIPPED_TEST_MODES = /* @__PURE__ */ new Set(["skip", "todo"]);
62010
+ const isCollectableTest = (test) => value(test.result !== void 0).pipe(when(true, () => true), orElse$1(() => SKIPPED_TEST_MODES.has(test.mode)));
62011
+ const fileFailedWithoutFailingTest = (file, tests) => match$1(file.result?.state === "fail", {
62012
+ onTrue: () => !tests.some((test) => test.result?.state === "fail"),
62013
+ onFalse: () => false
62014
+ });
61629
62015
  const VITEST_ERROR_CODES = Object.freeze({ FILES_NOT_FOUND: "VITEST_FILES_NOT_FOUND" });
61630
- const isErrorCodeError = (error) => error instanceof Error && typeof Reflect.get(error, "code") === "string";
61631
62016
  /** Vitest matches related files against absolute module ids, and only resolves them when the config is first built. */
61632
62017
  const relatedFilesOf = (relatedValue, relatedFiles, projectRoot, pathService) => match$1(relatedValue !== false, {
61633
62018
  onFalse: () => void 0,
@@ -61648,7 +62033,7 @@ const runFilterPlan = (filter, projectRoot, pathService) => {
61648
62033
  })
61649
62034
  };
61650
62035
  };
61651
- const isMissingTestFilesCause = (cause) => isErrorCodeError(cause) && cause.code.includes(VITEST_ERROR_CODES.FILES_NOT_FOUND);
62036
+ const isMissingTestFilesCause = (cause) => cause.includes(VITEST_ERROR_CODES.FILES_NOT_FOUND);
61652
62037
  const mergeHitCount = (to, mutantId, hitCount) => match$6(fromNullishOr(to[mutantId]), {
61653
62038
  onNone: () => {
61654
62039
  to[mutantId] = hitCount;
@@ -61718,15 +62103,25 @@ const makeRunner = (input) => gen(function* () {
61718
62103
  yield* start(self, plan.testFiles).pipe(catchIf((error) => isMissingTestFilesCause(error.cause), () => annotateCurrentSpan({ "stryker.vitest.start_missing_files": true }).pipe(asVoid)), catchIf((error) => !isMissingTestFilesCause(error.cause), (error) => annotateCurrentSpan({ "stryker.vitest.start_errored": true }).pipe(flatMap$1(() => fail$2(error)))));
61719
62104
  yield* annotateCurrentSpan({ "stryker.vitest.start_filter_count": plan.testFiles === void 0 ? -1 : plan.testFiles.length });
61720
62105
  const allFiles = files(self);
61721
- const rawTests = allFiles.flatMap((file) => getOrElse$1(map$8(liftPredicate(file, isRunnerTestSuite), collectTestsFromSuite), () => [])).filter((test) => test.result !== void 0);
62106
+ const collected = allFiles.map((file) => ({
62107
+ file,
62108
+ tests: getOrElse$1(map$8(liftPredicate(file, isRunnerTestSuite), collectTestsFromSuite), () => []).filter(isCollectableTest)
62109
+ }));
62110
+ const rawTests = collected.flatMap((entry) => entry.tests);
62111
+ const fileFailures = collected.flatMap(({ file, tests }) => fileFailedWithoutFailingTest(file, tests) ? [{
62112
+ fileName: file.filepath,
62113
+ message: fileFailureMessage(file)
62114
+ }] : []);
61722
62115
  const externalError = hasExternalErrors(self);
61723
62116
  yield* annotateCurrentSpan({
61724
62117
  "stryker.vitest.file_count": allFiles.length,
61725
62118
  "stryker.vitest.raw_test_count": rawTests.length,
62119
+ "stryker.vitest.failed_file_count": fileFailures.length,
61726
62120
  "stryker.vitest.has_external_error": externalError
61727
62121
  });
61728
62122
  return {
61729
62123
  rawTests,
62124
+ fileFailures,
61730
62125
  hasExternalError: externalError,
61731
62126
  externalErrorText: match$1(externalError, {
61732
62127
  onTrue: () => externalErrorText(self),
@@ -61742,7 +62137,7 @@ const makeRunner = (input) => gen(function* () {
61742
62137
  vitestOptions
61743
62138
  }), make$37(VitestSession, session));
61744
62139
  const dryRunFilter = (options) => {
61745
- const relatedFiles = getOrUndefined$1(map$8(fromNullishOr(options.files), (files) => [...files]));
62140
+ const relatedFiles = getOrUndefined$1(map$8(filter$1(fromNullishOr(options.files), (files) => files.length > 0), (files) => [...files]));
61746
62141
  return match$1(options.testFiles !== void 0 && options.testFiles.length > 0, {
61747
62142
  onFalse: () => ({ relatedFiles }),
61748
62143
  onTrue: () => ({
@@ -61770,13 +62165,14 @@ const makeRunner = (input) => gen(function* () {
61770
62165
  });
61771
62166
  });
61772
62167
  const dryRun = (options) => session.setMode("dry-run").pipe(andThen$1(gen(function* () {
61773
- const { rawTests, hasExternalError, externalErrorText: errorText } = yield* collectRaw(dryRunFilter(options));
62168
+ const { rawTests, fileFailures, hasExternalError, externalErrorText: errorText } = yield* collectRaw(dryRunFilter(options));
61774
62169
  const decision = interpretVitestDryRun(yield* decodeEffect(VitestDryRunCommand)({
61775
62170
  _tag: "VitestDryRunCommand",
61776
62171
  projectRoot,
61777
62172
  tests: {
61778
62173
  projectRoot,
61779
- records: rawTests
62174
+ records: rawTests,
62175
+ fileFailures
61780
62176
  },
61781
62177
  hasExternalError,
61782
62178
  externalErrorText: errorText