@systemfsoftware/stryker-js-vitest-runner 0.1.2 → 0.1.3

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 (3) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/index.mjs +585 -217
  3. package/package.json +10 -10
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { PluginKind, commonTokens, declareFactoryPlugin, tokens } from "@systemfsoftware/stryker-js-plugin-api/plugin";
2
- import { errorToString, escapeRegExp, normalizeFileName, notEmpty, testFilesProvided } from "@stryker-mutator/util";
3
2
  import { INSTRUMENTER_CONSTANTS } from "@systemfsoftware/stryker-js-plugin-api/core";
4
3
  import { DryRunStatus, TestStatus, determineHitLimitReached, toMutantRunResult } from "@systemfsoftware/stryker-js-plugin-api/test-runner";
4
+ import { errorToString, escapeRegExp, normalizeFileName, notEmpty, testFilesProvided } from "@systemfsoftware/stryker-js-util";
5
5
  import fs from "fs";
6
6
  import path from "path";
7
7
  import semver from "semver";
@@ -9,7 +9,7 @@ import { fileURLToPath } from "url";
9
9
  import { createRequire } from "module";
10
10
  import { pathToFileURL } from "node:url";
11
11
  import { createVitest } from "vitest/node";
12
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Pipeable.js
12
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Pipeable.js
13
13
  /**
14
14
  * The `Pipeable` module defines the shared interface and implementation helpers
15
15
  * for values that support Effect-style method chaining with `.pipe(...)`.
@@ -111,7 +111,7 @@ const Class$1 = /*#__PURE__*/ function() {
111
111
  return PipeableBase;
112
112
  }();
113
113
  //#endregion
114
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Function.js
114
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Function.js
115
115
  /**
116
116
  * Creates a function that can be called in data-first style or data-last
117
117
  * (`pipe`-friendly) style.
@@ -356,7 +356,7 @@ function memoizeIdempotent(f) {
356
356
  };
357
357
  }
358
358
  //#endregion
359
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/internal/equal.js
359
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/equal.js
360
360
  /** @internal */
361
361
  const getAllObjectKeys = (obj) => {
362
362
  const keys = new Set(Reflect.ownKeys(obj));
@@ -375,7 +375,7 @@ const getAllObjectKeys = (obj) => {
375
375
  /** @internal */
376
376
  const byReferenceInstances = /*#__PURE__*/ new WeakSet();
377
377
  //#endregion
378
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Predicate.js
378
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Predicate.js
379
379
  /**
380
380
  * Defines runtime checks for values.
381
381
  *
@@ -485,6 +485,71 @@ function isBoolean(input) {
485
485
  return typeof input === "boolean";
486
486
  }
487
487
  /**
488
+ * Checks whether a value is a `symbol`.
489
+ *
490
+ * **When to use**
491
+ *
492
+ * Use when you need a `Predicate` guard to narrow an `unknown` value to a
493
+ * symbol.
494
+ *
495
+ * **Details**
496
+ *
497
+ * Uses `typeof input === "symbol"`.
498
+ *
499
+ * **Example** (Guarding symbols)
500
+ *
501
+ * ```ts import.meta.vitest
502
+ * import { Predicate } from "effect"
503
+ *
504
+ * const data: unknown = Symbol.for("id")
505
+ *
506
+ * if (Predicate.isSymbol(data)) {
507
+ * data.description // => "id"
508
+ * }
509
+ * ```
510
+ *
511
+ * @see {@link isPropertyKey}
512
+ * @category guards
513
+ * @since 2.0.0
514
+ */
515
+ function isSymbol(input) {
516
+ return typeof input === "symbol";
517
+ }
518
+ /**
519
+ * Checks whether a value is a valid `PropertyKey` (string, number, or symbol).
520
+ *
521
+ * **When to use**
522
+ *
523
+ * Use when you need a `Predicate` guard for unknown property keys before
524
+ * indexing.
525
+ *
526
+ * **Details**
527
+ *
528
+ * Uses `isString`, `isNumber`, and `isSymbol`.
529
+ *
530
+ * **Example** (Guarding property keys)
531
+ *
532
+ * ```ts import.meta.vitest
533
+ * import { Predicate } from "effect"
534
+ *
535
+ * const key: unknown = "name"
536
+ * const obj: Record<PropertyKey, unknown> = { name: "Ada" }
537
+ *
538
+ * if (Predicate.isPropertyKey(key) && key in obj) {
539
+ * obj[key] // => "Ada"
540
+ * }
541
+ * ```
542
+ *
543
+ * @see {@link isString}
544
+ * @see {@link isNumber}
545
+ * @see {@link isSymbol}
546
+ * @category guards
547
+ * @since 4.0.0
548
+ */
549
+ function isPropertyKey(u) {
550
+ return isString(u) || isNumber(u) || isSymbol(u);
551
+ }
552
+ /**
488
553
  * Checks whether a value is a `function`.
489
554
  *
490
555
  * **When to use**
@@ -689,7 +754,7 @@ function isObjectKeyword(input) {
689
754
  */
690
755
  const hasProperty = /*#__PURE__*/ dual(2, (self, property) => isObjectKeyword(self) && property in self);
691
756
  //#endregion
692
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Hash.js
757
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Hash.js
693
758
  /**
694
759
  * Computes Effect hash values and defines the interface for objects that want
695
760
  * to provide their own hash implementation. Hashes are small numeric
@@ -1102,7 +1167,7 @@ function withVisitedTracking$1(obj, fn) {
1102
1167
  return result;
1103
1168
  }
1104
1169
  //#endregion
1105
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Equal.js
1170
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Equal.js
1106
1171
  /**
1107
1172
  * Defines the unique string identifier for the `Equal` interface.
1108
1173
  *
@@ -1328,7 +1393,7 @@ const compareSets = /*#__PURE__*/ makeCompareSet(compareBoth);
1328
1393
  */
1329
1394
  const isEqual = (u) => hasProperty(u, symbol);
1330
1395
  //#endregion
1331
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Equivalence.js
1396
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Equivalence.js
1332
1397
  /**
1333
1398
  * Creates a custom equivalence relation with an optimized reference equality check.
1334
1399
  *
@@ -1379,14 +1444,14 @@ const isEqual = (u) => hasProperty(u, symbol);
1379
1444
  */
1380
1445
  const make$9 = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
1381
1446
  //#endregion
1382
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/internal/array.js
1447
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/array.js
1383
1448
  /**
1384
1449
  * @since 2.0.0
1385
1450
  */
1386
1451
  /** @internal */
1387
1452
  const isArrayNonEmpty$1 = (self) => self.length > 0;
1388
1453
  //#endregion
1389
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/internal/record.js
1454
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/record.js
1390
1455
  /** @internal */
1391
1456
  function assignProperty(self, key, value) {
1392
1457
  if (key === "__proto__") Object.defineProperty(self, key, {
@@ -1402,7 +1467,7 @@ function assignProperties(self, source) {
1402
1467
  for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProperty(self, key, source[key]);
1403
1468
  }
1404
1469
  //#endregion
1405
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Redactable.js
1470
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Redactable.js
1406
1471
  /**
1407
1472
  * Defines the symbol used to identify objects that implement the {@link Redactable}
1408
1473
  * protocol.
@@ -1521,7 +1586,7 @@ const emptyContext$1 = {
1521
1586
  }
1522
1587
  };
1523
1588
  //#endregion
1524
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Formatter.js
1589
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Formatter.js
1525
1590
  /**
1526
1591
  * Formats JavaScript values into readable strings.
1527
1592
  *
@@ -1680,7 +1745,7 @@ function safeToString(input) {
1680
1745
  }
1681
1746
  }
1682
1747
  //#endregion
1683
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Inspectable.js
1748
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Inspectable.js
1684
1749
  /**
1685
1750
  * Defines the symbol used by Node.js for custom object inspection.
1686
1751
  *
@@ -1747,7 +1812,7 @@ const toJson = (input) => {
1747
1812
  }
1748
1813
  };
1749
1814
  //#endregion
1750
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Utils.js
1815
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Utils.js
1751
1816
  /**
1752
1817
  * Yields its wrapped value exactly once through an `IterableIterator`.
1753
1818
  *
@@ -1834,7 +1899,7 @@ const pickInternalCall = () => {
1834
1899
  /** @internal */
1835
1900
  const internalCall = /*#__PURE__*/ pickInternalCall();
1836
1901
  //#endregion
1837
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/internal/core.js
1902
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/core.js
1838
1903
  /** @internal */
1839
1904
  const EffectTypeId = `~effect/Effect`;
1840
1905
  /** @internal */
@@ -2169,7 +2234,7 @@ const TaggedError$1 = (tag) => {
2169
2234
  };
2170
2235
  TaggedError$1("NoSuchElementError");
2171
2236
  //#endregion
2172
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/internal/option.js
2237
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/option.js
2173
2238
  /**
2174
2239
  * @since 2.0.0
2175
2240
  */
@@ -2239,11 +2304,11 @@ const some$1 = (value) => {
2239
2304
  return a;
2240
2305
  };
2241
2306
  //#endregion
2242
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/internal/result.js
2307
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/result.js
2243
2308
  const TypeId$7 = "~effect/data/Result";
2244
2309
  ({ ...PipeInspectableProto });
2245
2310
  //#endregion
2246
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Option.js
2311
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Option.js
2247
2312
  /**
2248
2313
  * Creates an `Option` representing the absence of a value.
2249
2314
  *
@@ -2355,6 +2420,37 @@ const isNone = isNone$1;
2355
2420
  */
2356
2421
  const isSome = isSome$1;
2357
2422
  /**
2423
+ * Pattern-matches on an `Option`, handling both `None` and `Some` cases.
2424
+ *
2425
+ * **When to use**
2426
+ *
2427
+ * Use when you need to handle both `Some` and `None` in one expression and
2428
+ * transform an `Option` into a plain value.
2429
+ *
2430
+ * **Details**
2431
+ *
2432
+ * - If `None`, calls `onNone` and returns its result
2433
+ * - If `Some`, calls `onSome` with the value and returns its result
2434
+ * - Supports the `dual` API (data-last and data-first)
2435
+ *
2436
+ * **Example** (Matching on an Option)
2437
+ *
2438
+ * ```ts import.meta.vitest
2439
+ * import { Option } from "effect"
2440
+ *
2441
+ * Option.match(Option.some(1), {
2442
+ * onNone: () => "Option is empty",
2443
+ * onSome: (value) => `Option has a value: ${value}`
2444
+ * }) // => "Option has a value: 1"
2445
+ * ```
2446
+ *
2447
+ * @see {@link getOrElse} for unwrapping with a default
2448
+ *
2449
+ * @category pattern matching
2450
+ * @since 2.0.0
2451
+ */
2452
+ const match$1 = /*#__PURE__*/ dual(2, (self, { onNone, onSome }) => isNone(self) ? onNone() : onSome(self.value));
2453
+ /**
2358
2454
  * Transforms the value inside a `Some` using the provided function, leaving
2359
2455
  * `None` unchanged.
2360
2456
  *
@@ -2421,7 +2517,7 @@ const map$4 = /*#__PURE__*/ dual(2, (self, f) => isNone(self) ? none() : some(f(
2421
2517
  */
2422
2518
  const filter = /*#__PURE__*/ dual(2, (self, predicate) => isNone(self) ? none() : predicate(self.value) ? some(self.value) : none());
2423
2519
  //#endregion
2424
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Record.js
2520
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Record.js
2425
2521
  /**
2426
2522
  * Maps a record into another record by applying a transformation function to each of its values.
2427
2523
  *
@@ -2463,7 +2559,7 @@ const map$3 = /*#__PURE__*/ dual(2, (self, f) => {
2463
2559
  */
2464
2560
  const keys = (self) => Object.keys(self);
2465
2561
  //#endregion
2466
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Array.js
2562
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Array.js
2467
2563
  /**
2468
2564
  * Works with JavaScript arrays, readonly arrays, and non-empty arrays.
2469
2565
  *
@@ -2740,7 +2836,7 @@ const dedupe = (self) => {
2740
2836
  return out;
2741
2837
  };
2742
2838
  //#endregion
2743
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/BigDecimal.js
2839
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/BigDecimal.js
2744
2840
  /**
2745
2841
  * Decimal numbers and arithmetic for cases where JavaScript `number` rounding
2746
2842
  * is not precise enough. A `BigDecimal` stores digits as a `bigint` plus a
@@ -3128,7 +3224,7 @@ const isZero = (n) => n.value === bigint0;
3128
3224
  */
3129
3225
  const isNegative = (n) => n.value < bigint0;
3130
3226
  //#endregion
3131
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Effectable.js
3227
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Effectable.js
3132
3228
  /**
3133
3229
  * Create a low-level `Effect` prototype.
3134
3230
  *
@@ -3152,7 +3248,7 @@ const Prototype = (options) => makePrimitiveProto({
3152
3248
  [evaluate]: options.evaluate
3153
3249
  });
3154
3250
  //#endregion
3155
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Context.js
3251
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Context.js
3156
3252
  /**
3157
3253
  * Runtime type identifier attached to `Context` service keys and used by
3158
3254
  * `isKey` to recognize them.
@@ -3327,11 +3423,11 @@ const lookup = (self, key) => {
3327
3423
  */
3328
3424
  const makeUnsafe$1 = (mapUnsafe) => makeImpl(void 0, mapUnsafe, void 0, 0);
3329
3425
  const Proto$1 = {
3330
- ...PipeInspectableProto,
3331
- [TypeId$5]: { _Services: (_) => _ },
3332
3426
  get mapUnsafe() {
3333
3427
  return flatten(this);
3334
3428
  },
3429
+ ...PipeInspectableProto,
3430
+ [TypeId$5]: { _Services: (_) => _ },
3335
3431
  toJSON() {
3336
3432
  return {
3337
3433
  _id: "Context",
@@ -3477,20 +3573,27 @@ const make$6 = (key, service) => makeUnsafe$1(/* @__PURE__ */ new Map([[key.key,
3477
3573
  * @category combining
3478
3574
  * @since 2.0.0
3479
3575
  */
3480
- const add = /*#__PURE__*/ dual(3, (self, key, service) => {
3576
+ const add = /*#__PURE__*/ dual(3, (self, key, service) => addUnsafe(self, key.key, service));
3577
+ /**
3578
+ * Adds a service by key to a given `Context` using a string key.
3579
+ *
3580
+ * @category combining
3581
+ * @since 4.0.0
3582
+ */
3583
+ const addUnsafe = (self, key, service) => {
3481
3584
  const impl = self;
3482
- const cacheRoot = cacheKeys.has(key.key) ? void 0 : impl.cacheRoot;
3585
+ const cacheRoot = cacheKeys.has(key) ? void 0 : impl.cacheRoot;
3483
3586
  if (impl.depth >= MaxDepth) {
3484
3587
  const map = new Map(impl.mapUnsafe);
3485
- map.set(key.key, service);
3588
+ map.set(key, service);
3486
3589
  return makeImpl(cacheRoot, map, void 0, 0);
3487
3590
  }
3488
3591
  return makeImpl(cacheRoot, impl.base, {
3489
- key: key.key,
3592
+ key,
3490
3593
  value: service,
3491
3594
  parent: impl.overlay
3492
3595
  }, impl.depth + 1);
3493
- });
3596
+ };
3494
3597
  /** @internal */
3495
3598
  const getOrUndefinedUnsafe = (self, key) => {
3496
3599
  const value = lookup(self, key);
@@ -3596,7 +3699,7 @@ const serviceNotFoundError = (service) => {
3596
3699
  */
3597
3700
  const Reference = Service;
3598
3701
  //#endregion
3599
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Scheduler.js
3702
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Scheduler.js
3600
3703
  /**
3601
3704
  * Controls how runnable Effect fiber tasks are dispatched.
3602
3705
  *
@@ -3811,8 +3914,57 @@ const PreventSchedulerYield = /*#__PURE__*/ Reference("effect/Scheduler/PreventS
3811
3914
  fiberCached: true,
3812
3915
  defaultValue: () => false
3813
3916
  });
3917
+ /**
3918
+ * Creates a tagged error class with a `_tag` discriminator.
3919
+ *
3920
+ * **When to use**
3921
+ *
3922
+ * Use when you need domain errors with discriminated-union handling.
3923
+ *
3924
+ * **Details**
3925
+ *
3926
+ * Like {@link Error}, but instances also carry a `readonly _tag` property,
3927
+ * enabling `Effect.catchTag` and `Effect.catchTags` for tag-based recovery.
3928
+ * The `_tag` is excluded from the constructor argument. Yielding an instance
3929
+ * inside `Effect.gen` fails the effect with this error.
3930
+ *
3931
+ * **Example** (Recovering by tag)
3932
+ *
3933
+ * ```ts import.meta.vitest
3934
+ * import { Data, Effect } from "effect"
3935
+ *
3936
+ * class NotFound extends Data.TaggedError("NotFound")<{
3937
+ * readonly resource: string
3938
+ * }> {}
3939
+ *
3940
+ * class Forbidden extends Data.TaggedError("Forbidden")<{
3941
+ * readonly reason: string
3942
+ * }> {}
3943
+ *
3944
+ * const program = Effect.gen(function*() {
3945
+ * return yield* new NotFound({ resource: "/users/42" })
3946
+ * })
3947
+ *
3948
+ * const recovered = program.pipe(
3949
+ * Effect.catchTag("NotFound", (e) =>
3950
+ * Effect.succeed(`missing: ${e.resource}`))
3951
+ * )
3952
+ *
3953
+ * await Effect.runPromise(recovered) // => "missing: /users/42"
3954
+ * ```
3955
+ *
3956
+ * @see {@link Error} — without a `_tag`
3957
+ * @see {@link TaggedClass} — tagged class that is not an error
3958
+ *
3959
+ * @category constructors
3960
+ * @since 2.0.0
3961
+ */
3962
+ const TaggedError = TaggedError$1;
3963
+ TaggedError("EncodingError");
3964
+ const byteToHex = [];
3965
+ for (let i = 0; i < 256; i++) byteToHex.push(i.toString(16).padStart(2, "0"));
3814
3966
  //#endregion
3815
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Tracer.js
3967
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Tracer.js
3816
3968
  /**
3817
3969
  * Defines the low-level tracing model used by Effect.
3818
3970
  *
@@ -3859,11 +4011,11 @@ Service()(ParentSpanKey, { fiberCached: true });
3859
4011
  */
3860
4012
  const TracerKey = "effect/Tracer";
3861
4013
  //#endregion
3862
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/internal/metric.js
4014
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/metric.js
3863
4015
  /** @internal */
3864
4016
  const FiberRuntimeMetricsKey = "effect/observability/Metric/FiberRuntimeMetricsKey";
3865
4017
  //#endregion
3866
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/internal/references.js
4018
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/references.js
3867
4019
  /** @internal */
3868
4020
  const CurrentStackFrame = /*#__PURE__*/ Reference("effect/References/CurrentStackFrame", {
3869
4021
  fiberCached: true,
@@ -3880,7 +4032,7 @@ const MinimumLogLevel = /*#__PURE__*/ Reference("effect/References/MinimumLogLev
3880
4032
  defaultValue: () => "Info"
3881
4033
  });
3882
4034
  //#endregion
3883
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/internal/effect.js
4035
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/effect.js
3884
4036
  /** @internal */
3885
4037
  var Interrupt = class extends ReasonBase {
3886
4038
  fiberId;
@@ -3990,6 +4142,7 @@ var FiberImpl = class {
3990
4142
  }
3991
4143
  this._observers.push(cb);
3992
4144
  return () => {
4145
+ if (this._exit) return;
3993
4146
  const index = this._observers.indexOf(cb);
3994
4147
  if (index >= 0) this._observers.splice(index, 1);
3995
4148
  };
@@ -4588,7 +4741,7 @@ const colors = {
4588
4741
  };
4589
4742
  colors.gray, colors.blue, colors.green, colors.yellow, colors.red, colors.bgBrightRed, colors.black;
4590
4743
  //#endregion
4591
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Cause.js
4744
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Cause.js
4592
4745
  /**
4593
4746
  * Records the full reason an `Effect` failed.
4594
4747
  *
@@ -4660,54 +4813,8 @@ const isFailReason = isFailReason$1;
4660
4813
  const map = causeMap;
4661
4814
  Service()("effect/Cause/StackTrace");
4662
4815
  Service()("effect/Cause/InterruptorStackTrace");
4663
- /**
4664
- * Creates a tagged error class with a `_tag` discriminator.
4665
- *
4666
- * **When to use**
4667
- *
4668
- * Use when you need domain errors with discriminated-union handling.
4669
- *
4670
- * **Details**
4671
- *
4672
- * Like {@link Error}, but instances also carry a `readonly _tag` property,
4673
- * enabling `Effect.catchTag` and `Effect.catchTags` for tag-based recovery.
4674
- * The `_tag` is excluded from the constructor argument. Yielding an instance
4675
- * inside `Effect.gen` fails the effect with this error.
4676
- *
4677
- * **Example** (Recovering by tag)
4678
- *
4679
- * ```ts import.meta.vitest
4680
- * import { Data, Effect } from "effect"
4681
- *
4682
- * class NotFound extends Data.TaggedError("NotFound")<{
4683
- * readonly resource: string
4684
- * }> {}
4685
- *
4686
- * class Forbidden extends Data.TaggedError("Forbidden")<{
4687
- * readonly reason: string
4688
- * }> {}
4689
- *
4690
- * const program = Effect.gen(function*() {
4691
- * return yield* new NotFound({ resource: "/users/42" })
4692
- * })
4693
- *
4694
- * const recovered = program.pipe(
4695
- * Effect.catchTag("NotFound", (e) =>
4696
- * Effect.succeed(`missing: ${e.resource}`))
4697
- * )
4698
- *
4699
- * await Effect.runPromise(recovered) // => "missing: /users/42"
4700
- * ```
4701
- *
4702
- * @see {@link Error} — without a `_tag`
4703
- * @see {@link TaggedClass} — tagged class that is not an error
4704
- *
4705
- * @category constructors
4706
- * @since 2.0.0
4707
- */
4708
- const TaggedError = TaggedError$1;
4709
4816
  //#endregion
4710
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Exit.js
4817
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Exit.js
4711
4818
  /**
4712
4819
  * Creates a successful Exit containing the given value.
4713
4820
  *
@@ -4822,7 +4929,7 @@ const void_ = exitVoid;
4822
4929
  */
4823
4930
  const isSuccess = exitIsSuccess;
4824
4931
  //#endregion
4825
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/internal/dateTime.js
4932
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/dateTime.js
4826
4933
  /** @internal */
4827
4934
  const TypeId$4 = "~effect/time/DateTime";
4828
4935
  /** @internal */
@@ -5260,9 +5367,8 @@ const flatMapEager = flatMapEager$1;
5260
5367
  */
5261
5368
  const fnUntracedEager = fnUntracedEager$1;
5262
5369
  Service()("effect/DateTime/CurrentTimeZone");
5263
- TaggedError("EncodingError");
5264
5370
  //#endregion
5265
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/internal/schema/annotations.js
5371
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/schema/annotations.js
5266
5372
  /** @internal */
5267
5373
  function resolve(ast) {
5268
5374
  return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
@@ -5320,7 +5426,7 @@ const annotationExcludedKeys = /*#__PURE__*/ new Set([
5320
5426
  "toCodecIso"
5321
5427
  ]);
5322
5428
  //#endregion
5323
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/internal/schema/parser.js
5429
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/schema/parser.js
5324
5430
  const missing = /*#__PURE__*/ Symbol();
5325
5431
  const succeed = succeed$2;
5326
5432
  const missingExit = /*#__PURE__*/ succeed(missing);
@@ -5328,7 +5434,7 @@ const sameExit = /*#__PURE__*/ succeed(missing);
5328
5434
  const toOption = (value) => value === missing ? none() : some(value);
5329
5435
  const fromOptionExit = (option) => option._tag === "None" ? missingExit : succeed(option.value);
5330
5436
  //#endregion
5331
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/SchemaIssue.js
5437
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/SchemaIssue.js
5332
5438
  const TypeId$3 = "~effect/SchemaIssue/Issue";
5333
5439
  /**
5334
5440
  * Returns `true` if the given value is an {@link Issue}.
@@ -5988,7 +6094,7 @@ function findMessage(issue) {
5988
6094
  if (typeof message === "string") return message;
5989
6095
  }
5990
6096
  //#endregion
5991
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/internal/schema/cause.js
6097
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/schema/cause.js
5992
6098
  /** @internal */
5993
6099
  function getSchemaIssue(cause) {
5994
6100
  let issue;
@@ -6005,7 +6111,7 @@ function getSchemaIssueOrThrow(cause, message) {
6005
6111
  return issue;
6006
6112
  }
6007
6113
  //#endregion
6008
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/SchemaGetter.js
6114
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/SchemaGetter.js
6009
6115
  /**
6010
6116
  * Builds one-way conversions used by schemas.
6011
6117
  *
@@ -6277,7 +6383,7 @@ function Number$3() {
6277
6383
  return transform$1(globalThis.Number);
6278
6384
  }
6279
6385
  //#endregion
6280
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/SchemaTransformation.js
6386
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/SchemaTransformation.js
6281
6387
  const TypeId$2 = "~effect/SchemaTransformation/Transformation";
6282
6388
  /**
6283
6389
  * Represents a bidirectional transformation between a decoded type `T` and an encoded
@@ -6443,7 +6549,7 @@ function passthrough() {
6443
6549
  */
6444
6550
  const numberFromString = /*#__PURE__*/ new Transformation(/*#__PURE__*/ Number$3(), /*#__PURE__*/ String$3());
6445
6551
  //#endregion
6446
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/SchemaAST.js
6552
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/SchemaAST.js
6447
6553
  /**
6448
6554
  * Represents Effect schemas as runtime trees.
6449
6555
  *
@@ -6760,7 +6866,7 @@ const undefined_ = /*#__PURE__*/ new Undefined$1();
6760
6866
  * @category models
6761
6867
  * @since 4.0.0
6762
6868
  */
6763
- var Unknown = class extends Base {
6869
+ var Unknown$1 = class extends Base {
6764
6870
  _tag = "Unknown";
6765
6871
  /** @internal */
6766
6872
  getParser() {
@@ -6784,7 +6890,7 @@ var Unknown = class extends Base {
6784
6890
  * @category constructors
6785
6891
  * @since 4.0.0
6786
6892
  */
6787
- const unknown = /*#__PURE__*/ new Unknown();
6893
+ const unknown = /*#__PURE__*/ new Unknown$1();
6788
6894
  /**
6789
6895
  * AST node matching an exact primitive value (string, number, boolean, or
6790
6896
  * bigint).
@@ -6923,7 +7029,7 @@ var Number$2 = class extends Base {
6923
7029
  /** @internal */
6924
7030
  toCodecJson() {
6925
7031
  if (this.checks && (hasCheck(this.checks, "effect/schema/isFinite") || hasCheck(this.checks, "effect/schema/isInt"))) return this;
6926
- return replaceEncoding(this, [numberToJson(this.checks)]);
7032
+ return replaceEncoding(this, [numberToJson]);
6927
7033
  }
6928
7034
  /** @internal */
6929
7035
  toCodecStringTree() {
@@ -6938,9 +7044,6 @@ var Number$2 = class extends Base {
6938
7044
  function hasCheck(checks, id) {
6939
7045
  return checks.some((check) => check.annotations?.representation?.id === id || check._tag === "FilterGroup" && hasCheck(check.checks, id));
6940
7046
  }
6941
- function numberToJson(checks) {
6942
- return new Link(new Union$1([!checks ? finite : appendChecks(finite, checks), nonFiniteLiterals], "anyOf"), new Transformation(Number$3(), transform$1((n) => globalThis.Number.isFinite(n) ? n : globalThis.String(n))));
6943
- }
6944
7047
  /**
6945
7048
  * Provides the singleton {@link Number} AST instance.
6946
7049
  *
@@ -7497,6 +7600,19 @@ function getAST(self) {
7497
7600
  function union(members, mode, checks) {
7498
7601
  return new Union$1(members.map(getAST), mode, void 0, checks);
7499
7602
  }
7603
+ /** @internal */
7604
+ function structWithRest(ast, records) {
7605
+ if (ast.encoding || records.some((r) => r.encoding)) throw new Error("StructWithRest does not support encodings");
7606
+ let propertySignatures = ast.propertySignatures;
7607
+ let indexSignatures = ast.indexSignatures;
7608
+ let checks = ast.checks;
7609
+ for (const record of records) {
7610
+ propertySignatures = propertySignatures.concat(record.propertySignatures);
7611
+ indexSignatures = indexSignatures.concat(record.indexSignatures);
7612
+ checks = combineChecks(checks, record.checks);
7613
+ }
7614
+ return new Objects(propertySignatures, indexSignatures, void 0, checks);
7615
+ }
7500
7616
  const toCandidate = /*#__PURE__*/ memoizeIdempotent((ast) => {
7501
7617
  while (true) {
7502
7618
  if (isSuspend(ast)) return unknown;
@@ -7967,8 +8083,7 @@ function isFinite(annotations) {
7967
8083
  ...annotations
7968
8084
  });
7969
8085
  }
7970
- /** @internal */
7971
- const finite = /*#__PURE__*/ appendChecks(number, [/*#__PURE__*/ isFinite()]);
8086
+ const numberToJson = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([/* @__PURE__ */ appendChecks(number, [/*#__PURE__*/ isFinite()]), nonFiniteLiterals], "anyOf"), /*#__PURE__*/ new Transformation(/*#__PURE__*/ Number$3(), /*#__PURE__*/ transform$1((n) => globalThis.Number.isFinite(n) ? n : globalThis.String(n))));
7972
8087
  /**
7973
8088
  * Creates a {@link Filter} that validates strings by running `RegExp.test`.
7974
8089
  *
@@ -8163,6 +8278,35 @@ const optional$1 = /*#__PURE__*/ memoize((ast) => optionalKey(new Union$1([ast,
8163
8278
  function decodeTo$1(from, to, transformation) {
8164
8279
  return appendTransformation(from, transformation, to);
8165
8280
  }
8281
+ function parseParameter(ast) {
8282
+ const literals = [];
8283
+ const parameters = [];
8284
+ function go(ast) {
8285
+ switch (ast._tag) {
8286
+ case "Literal":
8287
+ if (isPropertyKey(ast.literal)) literals.push(ast.literal);
8288
+ return;
8289
+ case "UniqueSymbol":
8290
+ literals.push(ast.symbol);
8291
+ return;
8292
+ case "Never": return;
8293
+ case "Union":
8294
+ for (let i = 0; i < ast.types.length; i++) go(ast.types[i]);
8295
+ return;
8296
+ default: parameters.push(ast);
8297
+ }
8298
+ }
8299
+ go(ast);
8300
+ return {
8301
+ literals,
8302
+ parameters
8303
+ };
8304
+ }
8305
+ /** @internal */
8306
+ function record(key, value) {
8307
+ const { literals, parameters: indexSignatures } = parseParameter(key);
8308
+ return new Objects(literals.map((literal) => new PropertySignature(literal, value)), indexSignatures.map((parameter) => new IndexSignature(parameter, value)));
8309
+ }
8166
8310
  /**
8167
8311
  * Returns `true` if the AST node represents an optional property.
8168
8312
  *
@@ -8303,10 +8447,10 @@ function containsUndefined(ast) {
8303
8447
  }
8304
8448
  }
8305
8449
  function fromConst(ast, value) {
8306
- const succeed$7 = succeed(value);
8450
+ const succeed$6 = succeed(value);
8307
8451
  return (input, options) => {
8308
8452
  if (input === missing) return missingExit;
8309
- if (input === value) return succeed$7;
8453
+ if (input === value) return succeed$6;
8310
8454
  return fail(new InvalidType(ast, input, options));
8311
8455
  };
8312
8456
  }
@@ -8469,7 +8613,7 @@ const unknownToStringTree = /*#__PURE__*/ new Link(/* @__PURE__ */ new Declarati
8469
8613
  toCodecStringTree: () => void 0
8470
8614
  }), /*#__PURE__*/ passthrough());
8471
8615
  //#endregion
8472
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/SchemaParser.js
8616
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/SchemaParser.js
8473
8617
  /**
8474
8618
  * Runs schemas against real values.
8475
8619
  *
@@ -8594,6 +8738,10 @@ function decodeUnknownEffect$1(schema, options) {
8594
8738
  const parser = run(schema.ast);
8595
8739
  return options === void 0 ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));
8596
8740
  }
8741
+ /** @internal */
8742
+ function decodeUnknownOption$1(schema, options) {
8743
+ return asOption(decodeUnknownEffect$1(schema, options));
8744
+ }
8597
8745
  const mergeParseOptions = (options, overrideOptions) => overrideOptions ? {
8598
8746
  ...options,
8599
8747
  ...overrideOptions
@@ -8615,6 +8763,19 @@ function runWithCompiler(compiler, ast) {
8615
8763
  return result[args] === missing ? getValue(missing) : result;
8616
8764
  };
8617
8765
  }
8766
+ function asExit(parser) {
8767
+ return (input, options) => runSyncExit(parser(input, options));
8768
+ }
8769
+ /** @internal */
8770
+ function asOption(parser) {
8771
+ const parserExit = asExit(parser);
8772
+ return (input, options) => {
8773
+ const exit = parserExit(input, options);
8774
+ if (isSuccess(exit)) return some(exit.value);
8775
+ getSchemaIssueOrThrow(exit.cause, "Option adapter can only return none for schema issues");
8776
+ return none();
8777
+ };
8778
+ }
8618
8779
  const normalCompiler = /*#__PURE__*/ memoize((ast) => makeParser(ast, normalCompiler));
8619
8780
  const constructorCompiler = /*#__PURE__*/ memoize((ast) => makeParser(ast, constructorCompiler, compileConstructorDefault));
8620
8781
  const compileDefaulted = /*#__PURE__*/ memoize((ast) => makeParser(ast, constructorCompiler, compileConstructorDefault, ast.context?.constructorDefault));
@@ -8719,7 +8880,7 @@ function makeParser(ast, compile, compileConstructorDefault, constructorDefault)
8719
8880
  };
8720
8881
  }
8721
8882
  //#endregion
8722
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/internal/schema/schema.js
8883
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/schema/schema.js
8723
8884
  /** @internal */
8724
8885
  const TypeId = "~effect/Schema/Schema";
8725
8886
  const SchemaProto = {
@@ -8749,7 +8910,7 @@ function make$1(ast, options) {
8749
8910
  return self;
8750
8911
  }
8751
8912
  //#endregion
8752
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Struct.js
8913
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Struct.js
8753
8914
  /**
8754
8915
  * Wraps a plain function as a {@link Lambda} value so it can be used with
8755
8916
  * {@link map}, {@link mapPick}, and {@link mapOmit}.
@@ -8788,14 +8949,14 @@ function make$1(ast, options) {
8788
8949
  */
8789
8950
  const lambda = (f) => f;
8790
8951
  //#endregion
8791
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/internal/errors.js
8952
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/errors.js
8792
8953
  /** @internal */
8793
8954
  function errorWithPath(message, path) {
8794
8955
  if (path.length > 0) message += `\n at ${formatPath(path)}`;
8795
8956
  return new Error(message);
8796
8957
  }
8797
8958
  //#endregion
8798
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/JsonPointer.js
8959
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/JsonPointer.js
8799
8960
  /**
8800
8961
  * Helpers for escaping and unescaping JSON Pointer path segments. JSON Pointer
8801
8962
  * uses `/` to separate path tokens inside a JSON document, so token text must
@@ -8963,14 +9124,12 @@ globalThis.RegExp;
8963
9124
  */
8964
9125
  const escape = (string) => string.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
8965
9126
  //#endregion
8966
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/internal/schema/toJsonSchemaDocument.js
9127
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/schema/toJsonSchemaDocument.js
8967
9128
  const jsonSchemaAnnotationExcludedKeys = /*#__PURE__*/ new Set([
8968
9129
  ...annotationExcludedKeys,
8969
9130
  IDENTIFIER_FALLBACK_KEY,
8970
9131
  ...jsonSchemaAnnotationKeys
8971
9132
  ]);
8972
- /** @internal */
8973
- const toRepresentationOptions = { isAnonymousReferenceAllowed: (ast) => !isDeclaration(ast) };
8974
9133
  function collectJsonSchemaAnnotations(annotations, options) {
8975
9134
  if (annotations === void 0) return void 0;
8976
9135
  const out = {};
@@ -9036,7 +9195,16 @@ function extractJsonSchemaNumberType(schema) {
9036
9195
  function isJsonSchemaNumberEncoding(schema) {
9037
9196
  return Array.isArray(schema.anyOf) && schema.anyOf.length === 4 && schema.anyOf[0]?.type === "number" && schema.anyOf.slice(1).every((member) => member.type === "string");
9038
9197
  }
9039
- function appendJsonSchema(left, right) {
9198
+ const inlineableCheckKeywords = "|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|";
9199
+ function hasOnlyKeywords(schema, allowed) {
9200
+ return Object.keys(schema).every((key) => allowed.includes(`|${key}|`));
9201
+ }
9202
+ function hasNoCollisions(left, rightKeys) {
9203
+ return typeof left.$ref !== "string" && rightKeys.every((key) => !Object.hasOwn(left, key));
9204
+ }
9205
+ const promotableAnnotationKeywords = "|title|description|default|examples|readOnly|writeOnly|";
9206
+ const inlineableAnnotatedCheckKeywords = "|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames||title|description|default|examples|readOnly|writeOnly|";
9207
+ function appendJsonSchema(left, right, inlineCheck) {
9040
9208
  if (Object.keys(left).length === 0) return right;
9041
9209
  const rightKeys = Object.keys(right);
9042
9210
  if (rightKeys.length === 0) return left;
@@ -9051,9 +9219,18 @@ function appendJsonSchema(left, right) {
9051
9219
  type
9052
9220
  };
9053
9221
  if (isNumberEncoding) delete base.anyOf;
9054
- return Object.keys(extracted.schema).length === 0 ? base : appendJsonSchema(base, extracted.schema);
9222
+ const extractedKeys = Object.keys(extracted.schema);
9223
+ if (extractedKeys.length === 0) return base;
9224
+ return hasOnlyKeywords(extracted.schema, promotableAnnotationKeywords) && hasNoCollisions(base, extractedKeys) ? {
9225
+ ...base,
9226
+ ...extracted.schema
9227
+ } : appendJsonSchema(base, extracted.schema, inlineCheck);
9055
9228
  }
9056
9229
  }
9230
+ if (inlineCheck && hasNoCollisions(left, rightKeys)) return {
9231
+ ...left,
9232
+ ...right
9233
+ };
9057
9234
  const members = Array.isArray(right.allOf) && rightKeys.length === 1 ? right.allOf : [right];
9058
9235
  if (Array.isArray(left.allOf)) return {
9059
9236
  ...left,
@@ -9134,10 +9311,12 @@ function compileJsonSchema(representations, rootPaths, references, options) {
9134
9311
  schemas: annotationSchemas(check.representation, [...path, "representation"])
9135
9312
  });
9136
9313
  const ordinary = collectJsonSchemaAnnotations(annotations, options);
9137
- return ordinary === void 0 ? fragment : {
9314
+ const schema = ordinary === void 0 ? fragment : {
9138
9315
  ...fragment,
9139
9316
  ...ordinary
9140
9317
  };
9318
+ const allowed = ordinary === void 0 ? inlineableCheckKeywords : inlineableAnnotatedCheckKeywords;
9319
+ return check._tag === "Filter" && hasOnlyKeywords(schema, allowed) && (ordinary === void 0 || hasOnlyKeywords(ordinary, promotableAnnotationKeywords)) ? [schema, true] : [schema];
9141
9320
  }
9142
9321
  if (check._tag === "Filter") return void 0;
9143
9322
  const children = check.checks.map((child, index) => compileCheck(child, type, [
@@ -9147,10 +9326,11 @@ function compileJsonSchema(representations, rootPaths, references, options) {
9147
9326
  ])).filter((child) => child !== void 0);
9148
9327
  if (children.length === 0) return void 0;
9149
9328
  const ordinary = collectJsonSchemaAnnotations(annotations, options);
9150
- return ordinary === void 0 ? { allOf: children } : {
9151
- allOf: children,
9329
+ const allOf = children.map(([schema]) => schema);
9330
+ return [ordinary === void 0 ? { allOf } : {
9331
+ allOf,
9152
9332
  ...ordinary
9153
- };
9333
+ }];
9154
9334
  }
9155
9335
  function recur(representation, path) {
9156
9336
  if (representation._tag === "Reference") return { $ref: `#/$defs/${escapeToken(compileDefinition(representation.$ref, path))}` };
@@ -9169,7 +9349,7 @@ function compileJsonSchema(representations, rootPaths, references, options) {
9169
9349
  "checks",
9170
9350
  index
9171
9351
  ]);
9172
- if (check !== void 0) output = appendJsonSchema(output, check);
9352
+ if (check !== void 0) output = appendJsonSchema(output, ...check);
9173
9353
  }
9174
9354
  compiledRepresentations.set(representation, output);
9175
9355
  return output;
@@ -9295,8 +9475,8 @@ function compileJsonSchema(representations, rootPaths, references, options) {
9295
9475
  }
9296
9476
  if (representation.propertySignatures.length > 0) out.properties = properties;
9297
9477
  if (required.length > 0) out.required = required;
9298
- out.additionalProperties = options?.additionalProperties ?? false;
9299
9478
  const patternProperties = {};
9479
+ const additionalProperties = [];
9300
9480
  for (let index = 0; index < representation.indexSignatures.length; index++) {
9301
9481
  const signature = representation.indexSignatures[index];
9302
9482
  let type = recur(signature.type, [
@@ -9312,13 +9492,20 @@ function compileJsonSchema(representations, rootPaths, references, options) {
9312
9492
  index,
9313
9493
  "parameter"
9314
9494
  ], /* @__PURE__ */ new Set());
9315
- if (patterns.length === 0) out.additionalProperties = type;
9316
- else for (const pattern of patterns) assignProperty(patternProperties, pattern, type);
9317
- }
9318
- if (Object.keys(patternProperties).length > 0) {
9319
- out.patternProperties = patternProperties;
9320
- delete out.additionalProperties;
9495
+ if (patterns.length === 0) additionalProperties.push(type);
9496
+ else for (const pattern of patterns) {
9497
+ const previous = patternProperties[pattern];
9498
+ assignProperty(patternProperties, pattern, previous === void 0 ? type : previous === false || type === false ? false : appendJsonSchema(previous, type));
9499
+ }
9321
9500
  }
9501
+ const hasPatternProperties = Object.keys(patternProperties).length > 0;
9502
+ if (hasPatternProperties) out.patternProperties = patternProperties;
9503
+ if (representation.indexSignatures.length === 0) out.additionalProperties = options?.additionalProperties ?? false;
9504
+ else if (additionalProperties.length === 1 && representation.propertySignatures.length === 0 && !hasPatternProperties) out.additionalProperties = additionalProperties[0];
9505
+ else if (additionalProperties.length > 0) out.allOf = additionalProperties.map((type) => ({
9506
+ type: "object",
9507
+ additionalProperties: type
9508
+ }));
9322
9509
  if (typeof out.additionalProperties === "object" && out.additionalProperties !== null && Object.keys(out.additionalProperties).length === 0) delete out.additionalProperties;
9323
9510
  return out;
9324
9511
  }
@@ -9409,7 +9596,11 @@ function toJsonSchemaDocument$1(document, options) {
9409
9596
  };
9410
9597
  }
9411
9598
  //#endregion
9412
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/internal/schema/toRepresentation.js
9599
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/schema/toRepresentation.js
9600
+ const defaultReferencePolicy = ({ identifier }) => identifier;
9601
+ function annotationsField(annotations) {
9602
+ return annotations === void 0 ? void 0 : { annotations };
9603
+ }
9413
9604
  /** @internal */
9414
9605
  function toRepresentation(ast, options) {
9415
9606
  const { references, representations } = toRepresentations([ast], options);
@@ -9420,54 +9611,22 @@ function toRepresentation(ast, options) {
9420
9611
  }
9421
9612
  /** @internal */
9422
9613
  function toRepresentations(asts, options) {
9423
- return fromASTs(asts, options);
9424
- }
9425
- function annotationsField(annotations) {
9426
- return annotations === void 0 ? void 0 : { annotations };
9427
- }
9428
- function hasShareableStructure(ast, isAnonymousReferenceAllowed) {
9429
- if (isAnonymousReferenceAllowed?.(ast) === false) return false;
9430
- switch (ast._tag) {
9431
- case "Arrays":
9432
- case "Objects":
9433
- case "Suspend": return true;
9434
- case "Declaration": return true;
9435
- case "Union": return ast.types.some((ast) => hasShareableStructure(ast, isAnonymousReferenceAllowed));
9436
- default: return false;
9437
- }
9438
- }
9439
- function isWorthReferencing(bodyCost, occurrences) {
9440
- return occurrences * bodyCost > bodyCost + occurrences + 1;
9441
- }
9442
- function isAnonymousReferenceEligible(ast, occurrences, isAnonymousReferenceAllowed) {
9443
- if (isAnonymousReferenceAllowed?.(ast) === false) return false;
9444
- if (hasShareableStructure(ast, isAnonymousReferenceAllowed)) return true;
9445
- switch (ast._tag) {
9446
- case "Union": return isWorthReferencing(ast.types.length + 1, occurrences);
9447
- case "Enum": return isWorthReferencing(ast.enums.length + 1, occurrences);
9448
- case "TemplateLiteral": return isWorthReferencing(ast.parts.length + 1, occurrences);
9449
- case "Literal": return typeof ast.literal === "string" && isWorthReferencing(ast.literal.length / 32 + 1, occurrences);
9450
- default: return false;
9451
- }
9452
- }
9453
- function resolveReferenceIdentifier(input, encoded) {
9454
- const identifier = resolveIdentifier(encoded);
9455
- if (identifier !== void 0) return { identifier };
9456
- const fallback = (encoded !== input ? resolveIdentifier(input) : void 0) ?? resolveIdentifierFallback(encoded);
9457
- return fallback === void 0 ? void 0 : {
9458
- identifier: `${fallback}Encoded`,
9459
- fallback
9460
- };
9461
- }
9462
- function fromASTs(asts, options) {
9463
9614
  const references = {};
9464
- const anonymousReferences = /* @__PURE__ */ new Map();
9465
9615
  const referenceOwners = /* @__PURE__ */ new Map();
9466
9616
  const buildingReferences = /* @__PURE__ */ new Set();
9467
- const visiting = /* @__PURE__ */ new Set();
9468
- const occurrences = /* @__PURE__ */ new Map();
9469
- const shared = /* @__PURE__ */ new Set();
9617
+ const candidates = /* @__PURE__ */ new Map();
9618
+ const visitingCandidates = /* @__PURE__ */ new Set();
9470
9619
  for (const ast of asts) visit(ast);
9620
+ const referencePolicy = options?.referencePolicy ?? defaultReferencePolicy;
9621
+ for (const candidatesByIdentifier of candidates.values()) for (const candidate of candidatesByIdentifier.values()) {
9622
+ const requestedReference = referencePolicy({
9623
+ ast: candidate.ast,
9624
+ occurrences: candidate.occurrences,
9625
+ identifier: candidate.identifier
9626
+ });
9627
+ if (requestedReference !== void 0) candidate.reference = getReference(requestedReference, candidate, requestedReference === candidate.identifier || !requestedReference.endsWith("_") ? "_" : "");
9628
+ else if (candidate.isRecursive) candidate.reference = getReference(`${candidate.ast._tag}_`, candidate, "");
9629
+ }
9471
9630
  return {
9472
9631
  representations: map$2(asts, (ast) => recur(ast)),
9473
9632
  references
@@ -9482,10 +9641,10 @@ function fromASTs(asts, options) {
9482
9641
  referenceOwners.set(candidate, owner);
9483
9642
  return candidate;
9484
9643
  }
9485
- function annotateReference(ast, referenceIdentifier, reference) {
9486
- const fallback = referenceIdentifier.fallback;
9644
+ function annotateReference(ast, candidate, reference) {
9645
+ const fallback = candidate.fallback;
9487
9646
  if (fallback !== void 0) return resolveIdentifierFallback(ast) === fallback ? ast : annotate(ast, { [IDENTIFIER_FALLBACK_KEY]: fallback });
9488
- return reference === referenceIdentifier.identifier ? ast : annotate(ast, { identifier: reference });
9647
+ return reference === candidate.identifier ? ast : annotate(ast, { identifier: reference });
9489
9648
  }
9490
9649
  function makeReference(reference, ast) {
9491
9650
  if (!Object.hasOwn(references, reference) && !buildingReferences.has(reference)) {
@@ -9499,15 +9658,41 @@ function fromASTs(asts, options) {
9499
9658
  $ref: reference
9500
9659
  };
9501
9660
  }
9502
- function visit(input) {
9661
+ function getCandidate(input) {
9503
9662
  const ast = getLastEncoding(input);
9504
9663
  const owner = getContextOwner(ast);
9505
- const count = (occurrences.get(owner) ?? 0) + 1;
9506
- occurrences.set(owner, count);
9507
- if (count > 1) {
9508
- if (!shared.has(owner) && isAnonymousReferenceEligible(owner, count, options?.isAnonymousReferenceAllowed)) shared.add(owner);
9664
+ let identifier = resolveIdentifier(ast);
9665
+ const fallback = identifier === void 0 ? (ast !== input ? resolveIdentifier(input) : void 0) ?? resolveIdentifierFallback(ast) : void 0;
9666
+ if (fallback !== void 0) identifier = `${fallback}Encoded`;
9667
+ let candidatesByIdentifier = candidates.get(owner);
9668
+ if (candidatesByIdentifier === void 0) {
9669
+ candidatesByIdentifier = /* @__PURE__ */ new Map();
9670
+ candidates.set(owner, candidatesByIdentifier);
9671
+ }
9672
+ let candidate = candidatesByIdentifier.get(identifier);
9673
+ if (candidate === void 0) {
9674
+ candidate = {
9675
+ ast: owner,
9676
+ identifier,
9677
+ fallback,
9678
+ occurrences: 0,
9679
+ isRecursive: false,
9680
+ reference: void 0
9681
+ };
9682
+ candidatesByIdentifier.set(identifier, candidate);
9683
+ }
9684
+ return candidate;
9685
+ }
9686
+ function visit(input) {
9687
+ const candidate = getCandidate(input);
9688
+ const ast = candidate.ast;
9689
+ candidate.occurrences++;
9690
+ if (visitingCandidates.has(candidate)) {
9691
+ candidate.isRecursive = true;
9509
9692
  return;
9510
9693
  }
9694
+ if (candidate.occurrences > 1) return;
9695
+ visitingCandidates.add(candidate);
9511
9696
  visitChecks(ast.checks);
9512
9697
  switch (ast._tag) {
9513
9698
  case "Declaration":
@@ -9524,6 +9709,7 @@ function fromASTs(asts, options) {
9524
9709
  break;
9525
9710
  case "Suspend": visit(ast.thunk());
9526
9711
  }
9712
+ visitingCandidates.delete(candidate);
9527
9713
  }
9528
9714
  function visitChecks(checks) {
9529
9715
  checks?.forEach((check) => {
@@ -9532,39 +9718,11 @@ function fromASTs(asts, options) {
9532
9718
  });
9533
9719
  }
9534
9720
  function recur(input) {
9535
- const ast = getLastEncoding(input);
9536
- const owner = getContextOwner(ast);
9537
- const referenceIdentifier = resolveReferenceIdentifier(input, ast);
9538
- if (referenceIdentifier !== void 0) {
9539
- const reference = getReference(referenceIdentifier.identifier, owner);
9540
- return makeReference(reference, annotateReference(ast, referenceIdentifier, reference));
9541
- }
9542
- const found = anonymousReferences.get(owner);
9543
- if (found !== void 0) return {
9544
- _tag: "Reference",
9545
- $ref: found
9546
- };
9547
- const isShared = shared.has(owner);
9548
- if (isShared || visiting.has(owner)) {
9549
- const reference = getReference(`${ast._tag}_`, owner, "");
9550
- anonymousReferences.set(owner, reference);
9551
- return isShared ? makeReference(reference, ast) : {
9552
- _tag: "Reference",
9553
- $ref: reference
9554
- };
9555
- }
9556
- visiting.add(owner);
9557
- const representation = on(ast);
9558
- visiting.delete(owner);
9559
- const reference = anonymousReferences.get(owner);
9560
- if (reference !== void 0) {
9561
- assignProperty(references, reference, representation);
9562
- return {
9563
- _tag: "Reference",
9564
- $ref: reference
9565
- };
9566
- }
9567
- return representation;
9721
+ const candidate = getCandidate(input);
9722
+ const ast = candidate.ast;
9723
+ const reference = candidate.reference;
9724
+ if (reference !== void 0) return makeReference(reference, candidate.identifier === void 0 ? ast : annotateReference(ast, candidate, reference));
9725
+ return on(ast);
9568
9726
  }
9569
9727
  function on(ast) {
9570
9728
  const checks = fromChecks(ast.checks);
@@ -9704,7 +9862,7 @@ function fromASTs(asts, options) {
9704
9862
  }
9705
9863
  }
9706
9864
  //#endregion
9707
- //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.108/node_modules/effect/dist/Schema.js
9865
+ //#region ../../../../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Schema.js
9708
9866
  /**
9709
9867
  * Creates a schema for a **parametric** type (a generic container such as
9710
9868
  * `Array<A>`, `Option<A>`, etc.) by accepting a list of type-parameter schemas
@@ -9911,6 +10069,33 @@ function runSchemaErrorSync(self) {
9911
10069
  throw getSchemaErrorOrThrow(exit.cause, "Sync adapter can only throw schema errors");
9912
10070
  }
9913
10071
  /**
10072
+ * Decodes an `unknown` input against a schema, returning an `Option` that is
10073
+ * `Some` with the decoded value on success or `None` for schema mismatches.
10074
+ *
10075
+ * **When to use**
10076
+ *
10077
+ * Use when you do not know the input type statically and only need to know
10078
+ * whether decoding succeeded.
10079
+ *
10080
+ * **Details**
10081
+ *
10082
+ * Prefer this over {@link decodeUnknownExit} or {@link decodeUnknownEffect}
10083
+ * when you don't need error details. For input already typed as the schema's
10084
+ * `Encoded` type use {@link decodeOption}.
10085
+ * Options may be provided either when creating the decoder or when applying it;
10086
+ * application options override creation options.
10087
+ *
10088
+ * **Gotchas**
10089
+ *
10090
+ * Only causes made entirely of schema issues are converted to `None`. Causes
10091
+ * that contain defects, interruptions, or other non-schema reasons throw
10092
+ * instead.
10093
+ *
10094
+ * @category decoding
10095
+ * @since 3.10.0
10096
+ */
10097
+ const decodeUnknownOption = decodeUnknownOption$1;
10098
+ /**
9914
10099
  * Decodes an `unknown` input against a schema synchronously, returning the
9915
10100
  * decoded value or throwing a {@link SchemaError} for schema mismatches.
9916
10101
  *
@@ -10013,6 +10198,19 @@ const optional = /*#__PURE__*/ lambda((self) => {
10013
10198
  */
10014
10199
  const toEncoded = /*#__PURE__*/ lambda((schema) => make(toEncoded$1(schema.ast), { schema }));
10015
10200
  /**
10201
+ * Schema for the `unknown` type. Accepts any value without validation.
10202
+ *
10203
+ * **When to use**
10204
+ *
10205
+ * Use as a top schema when you need to accept any input while preserving
10206
+ * TypeScript's `unknown` safety at use sites.
10207
+ *
10208
+ * @see {@link Any} for the `any` variant.
10209
+ * @category schemas
10210
+ * @since 3.10.0
10211
+ */
10212
+ const Unknown = /*#__PURE__*/ make(unknown);
10213
+ /**
10016
10214
  * Schema for the `undefined` literal. Validates that the input is strictly `undefined`.
10017
10215
  *
10018
10216
  * @see {@link UndefinedOr} for a union with another schema.
@@ -10083,6 +10281,83 @@ function makeStruct(ast, fields) {
10083
10281
  function Struct(fields) {
10084
10282
  return makeStruct(struct(fields, void 0), fields);
10085
10283
  }
10284
+ /**
10285
+ * Defines a record schema whose dynamic properties are selected by a key schema
10286
+ * and decoded with a value schema.
10287
+ *
10288
+ * **Details**
10289
+ *
10290
+ * For dynamic keys, the key schema selects matching own properties and the
10291
+ * value schema decodes or encodes only those selected properties. Checks on
10292
+ * string, number, symbol, and template literal key schemas narrow which
10293
+ * properties are selected.
10294
+ *
10295
+ * For transformed key schemas, property selection is based on encoded property
10296
+ * names before the selected key is decoded.
10297
+ *
10298
+ * **Gotchas**
10299
+ *
10300
+ * When decoded or encoded key transformations produce the same property key,
10301
+ * sequential parsing applies selected own properties in selection order, so
10302
+ * the later selected property overwrites the earlier value. With concurrency
10303
+ * greater than `1`, completion order determines which value is retained.
10304
+ *
10305
+ * **Example** (Defining a string-keyed record of numbers)
10306
+ *
10307
+ * ```ts import.meta.vitest
10308
+ * import { Schema } from "effect"
10309
+ *
10310
+ * const schema = Schema.Record(Schema.String, Schema.Number)
10311
+ *
10312
+ * // { readonly [x: string]: number }
10313
+ * type R = typeof schema.Type
10314
+ *
10315
+ * Schema.decodeUnknownSync(schema)({ a: 1, b: 2 }) // => { a: 1, b: 2 }
10316
+ * ```
10317
+ *
10318
+ * @category constructors
10319
+ * @since 3.10.0
10320
+ */
10321
+ function Record(key, value) {
10322
+ return make(record(key.ast, value.ast), {
10323
+ key,
10324
+ value
10325
+ });
10326
+ }
10327
+ /**
10328
+ * Extends a struct schema with one or more record (index-signature) schemas,
10329
+ * producing a schema whose decoded type intersects the struct and all records.
10330
+ *
10331
+ * **Gotchas**
10332
+ *
10333
+ * TypeScript index signatures also apply to fixed keys. `StructWithRest` does
10334
+ * not reject incompatible fixed fields at the call site; use
10335
+ * `StructWithRest.ValidateRecords` when you want an explicit type-level
10336
+ * compatibility check.
10337
+ *
10338
+ * **Example** (Defining structs with string-indexed extra keys)
10339
+ *
10340
+ * ```ts import.meta.vitest
10341
+ * import { Schema } from "effect"
10342
+ *
10343
+ * const schema = Schema.StructWithRest(
10344
+ * Schema.Struct({ id: Schema.Number }),
10345
+ * [Schema.Record(Schema.String, Schema.Number)]
10346
+ * )
10347
+ *
10348
+ * // { readonly id: number, readonly [x: string]: number }
10349
+ * type T = typeof schema.Type
10350
+ * ```
10351
+ *
10352
+ * @category constructors
10353
+ * @since 4.0.0
10354
+ */
10355
+ function StructWithRest(schema, records) {
10356
+ return make(structWithRest(schema.ast, records.map(getAST)), {
10357
+ schema,
10358
+ records
10359
+ });
10360
+ }
10086
10361
  function makeUnion(ast, members) {
10087
10362
  return make(ast, {
10088
10363
  members,
@@ -10193,26 +10468,43 @@ globalThis.Uint8Array;
10193
10468
  /**
10194
10469
  * Returns a JSON Schema document using draft 2020-12.
10195
10470
  *
10471
+ * **When to use**
10472
+ *
10473
+ * Use when you need a draft-2020-12 description of the canonical JSON form of a runtime schema.
10474
+ *
10196
10475
  * **Details**
10197
10476
  *
10198
- * The `options` parameter controls generation details such as additional
10199
- * properties and synthesized check descriptions; it does not change the draft
10200
- * target. Declarations are lowered through their `toCodecJson` or `toCodec`
10477
+ * The `options` parameter controls reference extraction and generation details
10478
+ * such as additional properties and synthesized check descriptions; it does
10479
+ * not change the draft target. The reference policy receives canonical JSON
10480
+ * encoded ASTs. By default, anonymous non-recursive candidates remain inline, while candidates with resolved identifiers
10481
+ * become definitions. Declarations are lowered through their `toCodecJson` or `toCodec`
10201
10482
  * annotation when available before the representation document is compiled.
10483
+ * For schemas whose codec JSON AST can be represented exactly in JSON Schema,
10484
+ * importing the emitted document reconstructs a schema that accepts the same
10485
+ * JSON values. This is a semantic round-trip guarantee; the reconstructed AST
10486
+ * may have a different shape.
10202
10487
  *
10203
10488
  * **Gotchas**
10204
10489
  *
10205
10490
  * JSON Schema generation is best-effort. Some Effect schema semantics cannot
10206
10491
  * be represented exactly in JSON Schema, and importing an emitted JSON Schema
10207
10492
  * may produce an equivalent approximation rather than the original schema
10208
- * shape. Opaque declarations without a structural codec are represented by an
10209
- * unconstrained JSON Schema.
10493
+ * shape. Such schemas are outside the exact round-trip subset. When canonical
10494
+ * JSON derivation adds an artificial transformation, checks and annotations on
10495
+ * its source node are not copied to the JSON target, so they do not appear in
10496
+ * the emitted document. Opaque declarations without a structural codec are
10497
+ * represented by an unconstrained JSON Schema. Effect decoding may discard
10498
+ * excess object properties by default; use `onExcessProperty: "error"` when
10499
+ * comparing validation semantics with an emitted JSON Schema.
10500
+ *
10501
+ * @see {@link SchemaRepresentation.toJsonSchemaDocument} for compiling an existing live representation document
10210
10502
  *
10211
10503
  * @category converting
10212
10504
  * @since 4.0.0
10213
10505
  */
10214
10506
  function toJsonSchemaDocument(schema, options) {
10215
- return toJsonSchemaDocument$1(toRepresentation(toCodecJsonAST(schema.ast), toRepresentationOptions), options);
10507
+ return toJsonSchemaDocument$1(toRepresentation(toCodecJsonAST(schema.ast), options), options);
10216
10508
  }
10217
10509
  /** @internal */
10218
10510
  const toCodecJsonAST = /*#__PURE__*/ applyToSelfOrLastLinkEncodingIdempotent((ast) => {
@@ -10298,6 +10590,76 @@ const VitestRunnerOptionsSchema = Struct({
10298
10590
  */
10299
10591
  const VitestSectionSchema = optional(VitestRunnerOptionsSchema).pipe(withDecodingDefault(succeed$1({ related: true })));
10300
10592
  //#endregion
10593
+ //#region src/sandbox-self-aliases.schema.ts
10594
+ const ExportEntry = Union([String$1, Record(String$1, Unknown)]);
10595
+ const PackageManifest = StructWithRest(Struct({
10596
+ name: optional(String$1),
10597
+ exports: optional(Record(String$1, ExportEntry))
10598
+ }), [Record(String$1, Unknown)]);
10599
+ //#endregion
10600
+ //#region src/sandbox-self-aliases.ts
10601
+ const SOURCE_CONDITION = "@systemfsoftware/source";
10602
+ const sourceTargetOf = (entry) => {
10603
+ if (typeof entry === "string") return entry.endsWith(".ts") || entry.endsWith(".tsx") || entry.endsWith(".mts") ? entry : void 0;
10604
+ const source = entry[SOURCE_CONDITION];
10605
+ return typeof source === "string" ? source : void 0;
10606
+ };
10607
+ const specifierForExport = (packageName, exportKey) => {
10608
+ if (exportKey === ".") return packageName;
10609
+ if (exportKey === "./package.json" || !exportKey.startsWith("./")) return;
10610
+ return `${packageName}/${exportKey.slice(2)}`;
10611
+ };
10612
+ const sandboxSelfAliases = (manifest, projectRoot) => {
10613
+ const name = manifest.name;
10614
+ const exports = manifest.exports;
10615
+ if (name === void 0 || name.length === 0 || exports === void 0) return [];
10616
+ const aliases = [];
10617
+ for (const [key, value] of Object.entries(exports)) {
10618
+ const spec = specifierForExport(name, key);
10619
+ const target = sourceTargetOf(value);
10620
+ if (spec === void 0 || target === void 0) continue;
10621
+ aliases.push({
10622
+ find: new RegExp(`^${escapeRegExp(spec)}$`),
10623
+ replacement: path.resolve(projectRoot, target)
10624
+ });
10625
+ }
10626
+ return aliases;
10627
+ };
10628
+ const readSandboxSelfAliases = (projectRoot) => {
10629
+ let raw;
10630
+ try {
10631
+ raw = fs.readFileSync(path.join(projectRoot, "package.json"), "utf8");
10632
+ } catch {
10633
+ return [];
10634
+ }
10635
+ let parsed;
10636
+ try {
10637
+ parsed = JSON.parse(raw);
10638
+ } catch {
10639
+ return [];
10640
+ }
10641
+ return match$1(decodeUnknownOption(PackageManifest)(parsed), {
10642
+ onNone: () => [],
10643
+ onSome: (manifest) => sandboxSelfAliases(manifest, projectRoot)
10644
+ });
10645
+ };
10646
+ /**
10647
+ * Vite records a package specifier as a bare dep. Vitest related-mode then
10648
+ * joins that specifier onto the project root, misses the file, and reports
10649
+ * zero tests. Returning the sandbox source path from `resolveId` makes the
10650
+ * dep a real filesystem path related-mode can walk.
10651
+ */
10652
+ const sandboxSelfPlugin = (projectRoot) => {
10653
+ const aliases = readSandboxSelfAliases(projectRoot);
10654
+ return {
10655
+ name: "stryker-sandbox-self-exports",
10656
+ enforce: "pre",
10657
+ resolveId(source) {
10658
+ for (const alias of aliases) if (alias.find.test(source)) return alias.replacement;
10659
+ }
10660
+ };
10661
+ };
10662
+ //#endregion
10301
10663
  //#region src/test-helpers.ts
10302
10664
  function collectTestName({ name, suite }) {
10303
10665
  const nameParts = [name];
@@ -10488,6 +10850,12 @@ var VitestTestRunner = class {
10488
10850
  ...scanDir === void 0 ? {} : { dir: scanDir },
10489
10851
  bail: this.options.disableBail ? 0 : 1,
10490
10852
  onConsoleLog: () => false
10853
+ }, {
10854
+ resolve: {
10855
+ alias: [...readSandboxSelfAliases(projectRoot)],
10856
+ conditions: ["@systemfsoftware/source", "import"]
10857
+ },
10858
+ plugins: [sandboxSelfPlugin(projectRoot)]
10491
10859
  });
10492
10860
  this.ctx.provide("globalNamespace", this.globalNamespace);
10493
10861
  this.ctx.provide("isGreaterThanVitest4Point1", semver.satisfies(version, ">=4.1.0"));