@effect/language-service 0.71.2 → 0.72.1

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/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Function.js
3
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Function.js
4
4
  var isFunction = (input) => typeof input === "function";
5
5
  var dual = function(arity, body) {
6
6
  if (typeof arity === "function") {
@@ -98,7 +98,7 @@ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
98
98
  }
99
99
  }
100
100
 
101
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Equivalence.js
101
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Equivalence.js
102
102
  var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
103
103
  var array = (item) => make((self, that) => {
104
104
  if (self.length !== that.length) {
@@ -113,7 +113,7 @@ var array = (item) => make((self, that) => {
113
113
  return true;
114
114
  });
115
115
 
116
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/GlobalValue.js
116
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/GlobalValue.js
117
117
  var globalStoreId = `effect/GlobalValue`;
118
118
  var globalStore;
119
119
  var globalValue = (id, compute) => {
@@ -127,7 +127,7 @@ var globalValue = (id, compute) => {
127
127
  return globalStore.get(id);
128
128
  };
129
129
 
130
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Predicate.js
130
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Predicate.js
131
131
  var isString = (input) => typeof input === "string";
132
132
  var isNumber = (input) => typeof input === "number";
133
133
  var isBoolean = (input) => typeof input === "boolean";
@@ -138,10 +138,10 @@ var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) &&
138
138
  var isTagged = /* @__PURE__ */ dual(2, (self, tag) => hasProperty(self, "_tag") && self["_tag"] === tag);
139
139
  var isRecord = (input) => isRecordOrArray(input) && !Array.isArray(input);
140
140
 
141
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/errors.js
141
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/errors.js
142
142
  var getBugErrorMessage = (message) => `BUG: ${message} - please report an issue at https://github.com/Effect-TS/effect/issues`;
143
143
 
144
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Utils.js
144
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Utils.js
145
145
  var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
146
146
  var GenKindImpl = class {
147
147
  value;
@@ -263,7 +263,7 @@ var internalCall = isNotOptimizedAway ? standard.effect_internal_function : forc
263
263
  var genConstructor = function* () {
264
264
  }.constructor;
265
265
 
266
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Hash.js
266
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Hash.js
267
267
  var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
268
268
  var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
269
269
  var hash = (self) => {
@@ -372,7 +372,7 @@ var cached = function() {
372
372
  return hash2;
373
373
  };
374
374
 
375
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Equal.js
375
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Equal.js
376
376
  var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
377
377
  function equals() {
378
378
  if (arguments.length === 1) {
@@ -428,7 +428,7 @@ function compareBoth(self, that) {
428
428
  var isEqual = (u) => hasProperty(u, symbol2);
429
429
  var equivalence = () => equals;
430
430
 
431
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Inspectable.js
431
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Inspectable.js
432
432
  var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
433
433
  var toJSON = (x) => {
434
434
  try {
@@ -486,7 +486,7 @@ var redact = (u) => {
486
486
  return u;
487
487
  };
488
488
 
489
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Pipeable.js
489
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Pipeable.js
490
490
  var pipeArguments = (self, args2) => {
491
491
  switch (args2.length) {
492
492
  case 0:
@@ -519,16 +519,16 @@ var pipeArguments = (self, args2) => {
519
519
  }
520
520
  };
521
521
 
522
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/opCodes/effect.js
522
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/opCodes/effect.js
523
523
  var OP_COMMIT = "Commit";
524
524
  var OP_FAILURE = "Failure";
525
525
  var OP_WITH_RUNTIME = "WithRuntime";
526
526
 
527
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/version.js
527
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/version.js
528
528
  var moduleVersion = "3.19.14";
529
529
  var getCurrentVersion = () => moduleVersion;
530
530
 
531
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/effectable.js
531
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/effectable.js
532
532
  var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
533
533
  var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
534
534
  var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
@@ -615,7 +615,7 @@ var StructuralCommitPrototype = {
615
615
  ...StructuralPrototype
616
616
  };
617
617
 
618
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/option.js
618
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/option.js
619
619
  var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
620
620
  var CommonProto = {
621
621
  ...EffectPrototype,
@@ -673,7 +673,7 @@ var some = (value) => {
673
673
  return a;
674
674
  };
675
675
 
676
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/either.js
676
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/either.js
677
677
  var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
678
678
  var CommonProto2 = {
679
679
  ...EffectPrototype,
@@ -735,7 +735,7 @@ var right = (right3) => {
735
735
  return a;
736
736
  };
737
737
 
738
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Either.js
738
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Either.js
739
739
  var right2 = right;
740
740
  var left2 = left;
741
741
  var isLeft2 = isLeft;
@@ -743,10 +743,10 @@ var isRight2 = isRight;
743
743
  var map = /* @__PURE__ */ dual(2, (self, f) => isRight2(self) ? right2(f(self.right)) : left2(self.left));
744
744
  var getOrElse = /* @__PURE__ */ dual(2, (self, onLeft) => isLeft2(self) ? onLeft(self.left) : self.right);
745
745
 
746
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/array.js
746
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/array.js
747
747
  var isNonEmptyArray = (self) => self.length > 0;
748
748
 
749
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Order.js
749
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Order.js
750
750
  var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
751
751
  var string2 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
752
752
  var number2 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
@@ -760,7 +760,7 @@ var combine2 = /* @__PURE__ */ dual(2, (self, that) => make2((a1, a2) => {
760
760
  }));
761
761
  var mapInput = /* @__PURE__ */ dual(2, (self, f) => make2((b1, b2) => self(f(b1), f(b2))));
762
762
 
763
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Option.js
763
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Option.js
764
764
  var none2 = () => none;
765
765
  var some2 = some;
766
766
  var isNone2 = isNone;
@@ -771,7 +771,7 @@ var fromNullable = (nullableValue) => nullableValue == null ? none2() : some2(nu
771
771
  var getOrUndefined = /* @__PURE__ */ getOrElse2(constUndefined);
772
772
  var map2 = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : some2(f(self.value)));
773
773
 
774
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Record.js
774
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Record.js
775
775
  var map3 = /* @__PURE__ */ dual(2, (self, f) => {
776
776
  const out = {
777
777
  ...self
@@ -783,7 +783,7 @@ var map3 = /* @__PURE__ */ dual(2, (self, f) => {
783
783
  });
784
784
  var keys = (self) => Object.keys(self);
785
785
 
786
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Array.js
786
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Array.js
787
787
  var fromIterable = (collection) => Array.isArray(collection) ? collection : Array.from(collection);
788
788
  var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
789
789
  var appendAll = /* @__PURE__ */ dual(2, (self, that) => fromIterable(self).concat(fromIterable(that)));
@@ -887,7 +887,7 @@ var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
887
887
  var dedupe = (self) => dedupeWith(self, equivalence());
888
888
  var join = /* @__PURE__ */ dual(2, (self, sep) => fromIterable(self).join(sep));
889
889
 
890
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Chunk.js
890
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Chunk.js
891
891
  var TypeId3 = /* @__PURE__ */ Symbol.for("effect/Chunk");
892
892
  function copy(src, srcPos, dest, destPos, len) {
893
893
  for (let i = srcPos; i < Math.min(src.length, srcPos + len); i++) {
@@ -1183,14 +1183,14 @@ var isNonEmpty = (self) => self.length > 0;
1183
1183
  var unsafeHead = (self) => unsafeGet2(self, 0);
1184
1184
  var headNonEmpty2 = unsafeHead;
1185
1185
 
1186
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/hashMap/config.js
1186
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/hashMap/config.js
1187
1187
  var SIZE = 5;
1188
1188
  var BUCKET_SIZE = /* @__PURE__ */ Math.pow(2, SIZE);
1189
1189
  var MASK = BUCKET_SIZE - 1;
1190
1190
  var MAX_INDEX_NODE = BUCKET_SIZE / 2;
1191
1191
  var MIN_ARRAY_NODE = BUCKET_SIZE / 4;
1192
1192
 
1193
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/hashMap/bitwise.js
1193
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/hashMap/bitwise.js
1194
1194
  function popcount(x) {
1195
1195
  x -= x >> 1 & 1431655765;
1196
1196
  x = (x & 858993459) + (x >> 2 & 858993459);
@@ -1209,13 +1209,13 @@ function fromBitmap(bitmap, bit) {
1209
1209
  return popcount(bitmap & bit - 1);
1210
1210
  }
1211
1211
 
1212
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/stack.js
1212
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/stack.js
1213
1213
  var make4 = (value, previous) => ({
1214
1214
  value,
1215
1215
  previous
1216
1216
  });
1217
1217
 
1218
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/hashMap/array.js
1218
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/hashMap/array.js
1219
1219
  function arrayUpdate(mutate3, at, v, arr) {
1220
1220
  let out = arr;
1221
1221
  if (!mutate3) {
@@ -1260,7 +1260,7 @@ function arraySpliceIn(mutate3, at, v, arr) {
1260
1260
  return out;
1261
1261
  }
1262
1262
 
1263
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/hashMap/node.js
1263
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/hashMap/node.js
1264
1264
  var EmptyNode = class _EmptyNode {
1265
1265
  _tag = "EmptyNode";
1266
1266
  modify(edit, _shift, f, hash2, key, size4) {
@@ -1495,7 +1495,7 @@ function mergeLeaves(edit, shift, h1, n1, h2, n2) {
1495
1495
  }
1496
1496
  }
1497
1497
 
1498
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/hashMap.js
1498
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/hashMap.js
1499
1499
  var HashMapSymbolKey = "effect/HashMap";
1500
1500
  var HashMapTypeId = /* @__PURE__ */ Symbol.for(HashMapSymbolKey);
1501
1501
  var HashMapProto = {
@@ -1707,7 +1707,7 @@ var reduce2 = /* @__PURE__ */ dual(3, (self, zero2, f) => {
1707
1707
  return zero2;
1708
1708
  });
1709
1709
 
1710
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/hashSet.js
1710
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/hashSet.js
1711
1711
  var HashSetSymbolKey = "effect/HashSet";
1712
1712
  var HashSetTypeId = /* @__PURE__ */ Symbol.for(HashSetSymbolKey);
1713
1713
  var HashSetProto = {
@@ -1769,13 +1769,13 @@ var union2 = /* @__PURE__ */ dual(2, (self, that) => mutate(empty4(), (set2) =>
1769
1769
  }));
1770
1770
  var forEach2 = /* @__PURE__ */ dual(2, (self, f) => forEach(self._keyMap, (_, k) => f(k)));
1771
1771
 
1772
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/HashSet.js
1772
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/HashSet.js
1773
1773
  var empty5 = empty4;
1774
1774
  var size3 = size2;
1775
1775
  var add2 = add;
1776
1776
  var union3 = union2;
1777
1777
 
1778
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/data.js
1778
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/data.js
1779
1779
  var ArrayProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(Array.prototype), {
1780
1780
  [symbol]() {
1781
1781
  return cached(this, array2(this));
@@ -1798,7 +1798,7 @@ var Structural = /* @__PURE__ */ (function() {
1798
1798
  return Structural2;
1799
1799
  })();
1800
1800
 
1801
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/opCodes/cause.js
1801
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/opCodes/cause.js
1802
1802
  var OP_DIE = "Die";
1803
1803
  var OP_EMPTY = "Empty";
1804
1804
  var OP_FAIL = "Fail";
@@ -1806,7 +1806,7 @@ var OP_INTERRUPT = "Interrupt";
1806
1806
  var OP_PARALLEL = "Parallel";
1807
1807
  var OP_SEQUENTIAL = "Sequential";
1808
1808
 
1809
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/cause.js
1809
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/cause.js
1810
1810
  var CauseSymbolKey = "effect/Cause";
1811
1811
  var CauseTypeId = /* @__PURE__ */ Symbol.for(CauseSymbolKey);
1812
1812
  var variance = {
@@ -2238,7 +2238,7 @@ var prettyErrors = (cause) => reduceWithContext(cause, void 0, {
2238
2238
  sequentialCase: (_, l, r) => [...l, ...r]
2239
2239
  });
2240
2240
 
2241
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/singleShotGen.js
2241
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/singleShotGen.js
2242
2242
  var SingleShotGen2 = class _SingleShotGen {
2243
2243
  self;
2244
2244
  called = false;
@@ -2268,7 +2268,7 @@ var SingleShotGen2 = class _SingleShotGen {
2268
2268
  }
2269
2269
  };
2270
2270
 
2271
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/core.js
2271
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/core.js
2272
2272
  var EffectTypeId2 = /* @__PURE__ */ Symbol.for("effect/Effect");
2273
2273
  var EffectPrimitive = class {
2274
2274
  _op;
@@ -2552,7 +2552,7 @@ var currentSpanFromFiber = (fiber) => {
2552
2552
  return span !== void 0 && span._tag === "Span" ? some2(span) : none2();
2553
2553
  };
2554
2554
 
2555
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Data.js
2555
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Data.js
2556
2556
  var Class2 = Structural;
2557
2557
  var Error2 = /* @__PURE__ */ (function() {
2558
2558
  const plainArgsSymbol = /* @__PURE__ */ Symbol.for("effect/Data/Error/plainArgs");
@@ -2590,10 +2590,10 @@ var TaggedError = (tag) => {
2590
2590
  return O.BaseEffectError;
2591
2591
  };
2592
2592
 
2593
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/encoding/common.js
2593
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/encoding/common.js
2594
2594
  var encoder = /* @__PURE__ */ new TextEncoder();
2595
2595
 
2596
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/encoding/base64.js
2596
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/encoding/base64.js
2597
2597
  var encode = (bytes) => {
2598
2598
  const length = bytes.length;
2599
2599
  let result = "";
@@ -2619,13 +2619,13 @@ var encode = (bytes) => {
2619
2619
  };
2620
2620
  var base64abc = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/"];
2621
2621
 
2622
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/encoding/base64Url.js
2622
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/internal/encoding/base64Url.js
2623
2623
  var encode2 = (data) => encode(data).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
2624
2624
 
2625
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Encoding.js
2625
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Encoding.js
2626
2626
  var encodeBase64Url = (input) => typeof input === "string" ? encode2(encoder.encode(input)) : encode2(input);
2627
2627
 
2628
- // node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Graph.js
2628
+ // ../../node_modules/.pnpm/effect@3.19.14/node_modules/effect/dist/esm/Graph.js
2629
2629
  var TypeId4 = "~effect/Graph";
2630
2630
  var Edge = class extends Class2 {
2631
2631
  };
@@ -3414,6 +3414,13 @@ var option = (fa) => {
3414
3414
  nano[contE] = (_) => _ instanceof NanoDefectException ? fail3(_) : succeed(none2());
3415
3415
  return nano;
3416
3416
  };
3417
+ var orUndefined = (fa) => {
3418
+ const nano = Object.create(MatchProto);
3419
+ nano[args] = fa;
3420
+ nano[contA] = (_) => succeed(_);
3421
+ nano[contE] = (_) => _ instanceof NanoDefectException ? fail3(_) : succeed(void 0);
3422
+ return nano;
3423
+ };
3417
3424
  var ignore = (fa) => {
3418
3425
  const nano = Object.create(MatchProto);
3419
3426
  nano[args] = fa;
@@ -3617,7 +3624,7 @@ function makeTypeScriptUtils(ts) {
3617
3624
  if (!hasProperty(packageJsonScope, "packageDirectory")) return;
3618
3625
  if (!isString(packageJsonScope.packageDirectory)) return;
3619
3626
  const { name } = packageJsonContent;
3620
- const version = hasProperty(packageJsonScope, "version") ? packageJsonScope.version : "";
3627
+ const version = hasProperty(packageJsonContent, "version") ? packageJsonContent.version : "unknown";
3621
3628
  if (!isString(name)) return;
3622
3629
  if (!isString(version)) return;
3623
3630
  const hasEffectInPeerDependencies = hasProperty(packageJsonContent, "peerDependencies") && isObject(packageJsonContent.peerDependencies) && hasProperty(packageJsonContent.peerDependencies, "effect");
@@ -4909,6 +4916,8 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
4909
4916
  }
4910
4917
 
4911
4918
  // src/core/TypeParser.ts
4919
+ var checkedPackagesCache = /* @__PURE__ */ new Map();
4920
+ var programResolvedCacheSize = /* @__PURE__ */ new Map();
4912
4921
  var TypeParser = Tag("@effect/language-service/TypeParser");
4913
4922
  var nanoLayer3 = (fa) => gen(function* () {
4914
4923
  const ts = yield* service(TypeScriptApi);
@@ -4929,6 +4938,40 @@ function typeParserIssue(_message, _type, _node) {
4929
4938
  return TypeParserIssue.issue;
4930
4939
  }
4931
4940
  function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
4941
+ function supportedEffect() {
4942
+ for (const fileName of program.getRootFileNames()) {
4943
+ const sourceFile = program.getSourceFile(fileName);
4944
+ if (!sourceFile) continue;
4945
+ const resolvedPackages = getEffectRelatedPackages(sourceFile);
4946
+ for (const version of Object.keys(resolvedPackages["effect"])) {
4947
+ if (String(version).startsWith("4")) return "v4";
4948
+ if (String(version).startsWith("3")) return "v3";
4949
+ }
4950
+ }
4951
+ return "v3";
4952
+ }
4953
+ function getEffectRelatedPackages(sourceFile) {
4954
+ let resolvedPackages = checkedPackagesCache.get(sourceFile.fileName) || {};
4955
+ const newResolvedModuleSize = hasProperty(program, "resolvedModules") && hasProperty(program.resolvedModules, "size") && isNumber(program.resolvedModules.size) ? program.resolvedModules.size : 0;
4956
+ const oldResolvedSize = programResolvedCacheSize.get(sourceFile.fileName) || -1;
4957
+ if (newResolvedModuleSize !== oldResolvedSize) {
4958
+ const seenPackages = /* @__PURE__ */ new Set();
4959
+ resolvedPackages = {};
4960
+ program.getSourceFiles().map((_) => {
4961
+ const packageInfo = tsUtils.parsePackageContentNameAndVersionFromScope(_);
4962
+ if (!packageInfo) return;
4963
+ const packageNameAndVersion = packageInfo.name + "@" + packageInfo.version;
4964
+ if (seenPackages.has(packageNameAndVersion)) return;
4965
+ seenPackages.add(packageNameAndVersion);
4966
+ if (!(packageInfo.name === "effect" || packageInfo.hasEffectInPeerDependencies)) return;
4967
+ resolvedPackages[packageInfo.name] = resolvedPackages[packageInfo.name] || {};
4968
+ resolvedPackages[packageInfo.name][packageInfo.version] = packageInfo.packageDirectory;
4969
+ });
4970
+ checkedPackagesCache.set(sourceFile.fileName, resolvedPackages);
4971
+ programResolvedCacheSize.set(sourceFile.fileName, newResolvedModuleSize);
4972
+ }
4973
+ return resolvedPackages;
4974
+ }
4932
4975
  const getSourceFilePackageInfo = cachedBy(
4933
4976
  fn("TypeParser.getSourceFilePackageInfo")(function* (sourceFile) {
4934
4977
  return tsUtils.resolveModuleWithPackageInfoFromSourceFile(program, sourceFile);
@@ -5157,19 +5200,28 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
5157
5200
  );
5158
5201
  const effectType = cachedBy(
5159
5202
  fn("TypeParser.effectType")(function* (type, atLocation) {
5160
- const propertiesSymbols = typeChecker.getPropertiesOfType(type).filter(
5161
- (_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration
5162
- );
5163
- if (propertiesSymbols.length === 0) {
5164
- return yield* typeParserIssue("Type has no effect variance struct", type, atLocation);
5203
+ if (supportedEffect() === "v4") {
5204
+ const typeIdSymbol = typeChecker.getPropertyOfType(type, "~effect/Effect");
5205
+ if (typeIdSymbol) {
5206
+ const typeIdType = typeChecker.getTypeOfSymbolAtLocation(typeIdSymbol, atLocation);
5207
+ return yield* effectVarianceStruct(typeIdType, atLocation);
5208
+ }
5209
+ return yield* typeParserIssue("Type is not an effect", type, atLocation);
5210
+ } else {
5211
+ const propertiesSymbols = typeChecker.getPropertiesOfType(type).filter(
5212
+ (_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration
5213
+ );
5214
+ if (propertiesSymbols.length === 0) {
5215
+ return yield* typeParserIssue("Type has no effect variance struct", type, atLocation);
5216
+ }
5217
+ propertiesSymbols.sort(
5218
+ (a, b) => ts.symbolName(b).indexOf("EffectTypeId") - ts.symbolName(a).indexOf("EffectTypeId")
5219
+ );
5220
+ return yield* firstSuccessOf(propertiesSymbols.map((propertySymbol) => {
5221
+ const propertyType = typeChecker.getTypeOfSymbolAtLocation(propertySymbol, atLocation);
5222
+ return effectVarianceStruct(propertyType, atLocation);
5223
+ }));
5165
5224
  }
5166
- propertiesSymbols.sort(
5167
- (a, b) => ts.symbolName(b).indexOf("EffectTypeId") - ts.symbolName(a).indexOf("EffectTypeId")
5168
- );
5169
- return yield* firstSuccessOf(propertiesSymbols.map((propertySymbol) => {
5170
- const propertyType = typeChecker.getTypeOfSymbolAtLocation(propertySymbol, atLocation);
5171
- return effectVarianceStruct(propertyType, atLocation);
5172
- }));
5173
5225
  }),
5174
5226
  "TypeParser.effectType",
5175
5227
  (type) => type
@@ -5489,10 +5541,10 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
5489
5541
  }))
5490
5542
  )
5491
5543
  ),
5492
- option
5544
+ orUndefined
5493
5545
  );
5494
- if (isSome2(isEffectGen)) {
5495
- effectGenResult = isEffectGen.value;
5546
+ if (isEffectGen) {
5547
+ effectGenResult = isEffectGen;
5496
5548
  }
5497
5549
  }
5498
5550
  if (scopeNode && effectGenResult) {
@@ -5612,6 +5664,21 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
5612
5664
  const effectSchemaType = cachedBy(
5613
5665
  fn("TypeParser.effectSchemaType")(function* (type, atLocation) {
5614
5666
  yield* pipeableType(type, atLocation);
5667
+ const typeId = typeChecker.getPropertyOfType(type, "~effect/Schema/Schema");
5668
+ if (typeId) {
5669
+ const typeKey = typeChecker.getPropertyOfType(type, "Type");
5670
+ const encodedKey = typeChecker.getPropertyOfType(type, "Encoded");
5671
+ if (typeKey && encodedKey) {
5672
+ const typeType = typeChecker.getTypeOfSymbolAtLocation(typeKey, atLocation);
5673
+ const encodedType = typeChecker.getTypeOfSymbolAtLocation(encodedKey, atLocation);
5674
+ return {
5675
+ A: typeType,
5676
+ I: encodedType,
5677
+ R: typeChecker.getNeverType()
5678
+ };
5679
+ }
5680
+ return yield* typeParserIssue("missing Type and Encoded");
5681
+ }
5615
5682
  const ast = typeChecker.getPropertyOfType(type, "ast");
5616
5683
  if (!ast) return yield* typeParserIssue("Has no 'ast' property", type, atLocation);
5617
5684
  const propertiesSymbols = typeChecker.getPropertiesOfType(type).filter(
@@ -5830,9 +5897,9 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
5830
5897
  if (ts.isCallExpression(schemaCall) && schemaCall.typeArguments && schemaCall.typeArguments.length > 0) {
5831
5898
  const isEffectSchemaModuleApi = yield* pipe(
5832
5899
  isNodeReferenceToEffectSchemaModuleApi("Class")(schemaCall.expression),
5833
- option
5900
+ orUndefined
5834
5901
  );
5835
- if (isSome2(isEffectSchemaModuleApi)) {
5902
+ if (isEffectSchemaModuleApi) {
5836
5903
  return {
5837
5904
  className: atLocation.name,
5838
5905
  selfTypeNode: schemaCall.typeArguments[0]
@@ -5867,9 +5934,9 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
5867
5934
  const selfTypeNode = schemaTaggedClassTCall.typeArguments[0];
5868
5935
  const isEffectSchemaModuleApi = yield* pipe(
5869
5936
  isNodeReferenceToEffectSchemaModuleApi("TaggedClass")(schemaTaggedClassTCall.expression),
5870
- option
5937
+ orUndefined
5871
5938
  );
5872
- if (isSome2(isEffectSchemaModuleApi)) {
5939
+ if (isEffectSchemaModuleApi) {
5873
5940
  return {
5874
5941
  className: atLocation.name,
5875
5942
  selfTypeNode,
@@ -5906,9 +5973,9 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
5906
5973
  const selfTypeNode = schemaTaggedErrorTCall.typeArguments[0];
5907
5974
  const isEffectSchemaModuleApi = yield* pipe(
5908
5975
  isNodeReferenceToEffectSchemaModuleApi("TaggedError")(schemaTaggedErrorTCall.expression),
5909
- option
5976
+ orUndefined
5910
5977
  );
5911
- if (isSome2(isEffectSchemaModuleApi)) {
5978
+ if (isEffectSchemaModuleApi) {
5912
5979
  return {
5913
5980
  className: atLocation.name,
5914
5981
  selfTypeNode,
@@ -5928,6 +5995,9 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
5928
5995
  );
5929
5996
  const extendsSchemaTaggedRequest = cachedBy(
5930
5997
  fn("TypeParser.extendsSchemaTaggedRequest")(function* (atLocation) {
5998
+ if (supportedEffect() === "v4") {
5999
+ return yield* typeParserIssue("Schema.TaggedClass is not supported in Effect v4", void 0, atLocation);
6000
+ }
5931
6001
  if (!atLocation.name) {
5932
6002
  return yield* typeParserIssue("Class has no name", void 0, atLocation);
5933
6003
  }
@@ -5945,9 +6015,9 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
5945
6015
  const selfTypeNode = schemaTaggedRequestTCall.typeArguments[0];
5946
6016
  const isEffectSchemaModuleApi = yield* pipe(
5947
6017
  isNodeReferenceToEffectSchemaModuleApi("TaggedRequest")(schemaTaggedRequestTCall.expression),
5948
- option
6018
+ orUndefined
5949
6019
  );
5950
- if (isSome2(isEffectSchemaModuleApi)) {
6020
+ if (isEffectSchemaModuleApi) {
5951
6021
  return {
5952
6022
  className: atLocation.name,
5953
6023
  selfTypeNode,
@@ -5965,6 +6035,48 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
5965
6035
  "TypeParser.extendsSchemaTaggedRequest",
5966
6036
  (atLocation) => atLocation
5967
6037
  );
6038
+ const extendsSchemaRequestClass = cachedBy(
6039
+ fn("TypeParser.extendsSchemaRequestClass")(function* (atLocation) {
6040
+ if (supportedEffect() === "v3") {
6041
+ return yield* typeParserIssue("Schema.RequestClass is not supported in Effect v3", void 0, atLocation);
6042
+ }
6043
+ if (!atLocation.name) {
6044
+ return yield* typeParserIssue("Class has no name", void 0, atLocation);
6045
+ }
6046
+ const heritageClauses = atLocation.heritageClauses;
6047
+ if (!heritageClauses) {
6048
+ return yield* typeParserIssue("Class has no heritage clauses", void 0, atLocation);
6049
+ }
6050
+ for (const heritageClause of heritageClauses) {
6051
+ for (const typeX of heritageClause.types) {
6052
+ if (ts.isExpressionWithTypeArguments(typeX)) {
6053
+ const expression = typeX.expression;
6054
+ if (ts.isCallExpression(expression)) {
6055
+ const schemaTaggedRequestTCall = expression.expression;
6056
+ if (ts.isCallExpression(schemaTaggedRequestTCall) && schemaTaggedRequestTCall.typeArguments && schemaTaggedRequestTCall.typeArguments.length > 0) {
6057
+ const selfTypeNode = schemaTaggedRequestTCall.typeArguments[0];
6058
+ const isEffectSchemaModuleApi = yield* pipe(
6059
+ isNodeReferenceToEffectSchemaModuleApi("RequestClass")(schemaTaggedRequestTCall.expression),
6060
+ orUndefined
6061
+ );
6062
+ if (isEffectSchemaModuleApi) {
6063
+ return {
6064
+ className: atLocation.name,
6065
+ selfTypeNode,
6066
+ tagStringLiteral: void 0,
6067
+ keyStringLiteral: schemaTaggedRequestTCall.arguments.length > 0 && ts.isStringLiteral(schemaTaggedRequestTCall.arguments[0]) ? schemaTaggedRequestTCall.arguments[0] : void 0
6068
+ };
6069
+ }
6070
+ }
6071
+ }
6072
+ }
6073
+ }
6074
+ }
6075
+ return yield* typeParserIssue("Class does not extend Schema.RequestClass", void 0, atLocation);
6076
+ }),
6077
+ "TypeParser.extendsSchemaRequestClass",
6078
+ (atLocation) => atLocation
6079
+ );
5968
6080
  const extendsDataTaggedError = cachedBy(
5969
6081
  fn("TypeParser.extendsDataTaggedError")(function* (atLocation) {
5970
6082
  if (!atLocation.name) {
@@ -5984,13 +6096,13 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
5984
6096
  if (ts.isPropertyAccessExpression(dataIdentifier) && ts.isIdentifier(dataIdentifier.name) && ts.idText(dataIdentifier.name) === "TaggedError") {
5985
6097
  const parsedDataModule = yield* pipe(
5986
6098
  importedDataModule(dataIdentifier.expression),
5987
- option
6099
+ orUndefined
5988
6100
  );
5989
- if (isSome2(parsedDataModule)) {
6101
+ if (parsedDataModule) {
5990
6102
  return {
5991
6103
  className: atLocation.name,
5992
6104
  keyStringLiteral: dataTaggedErrorCall.arguments.length > 0 && ts.isStringLiteral(dataTaggedErrorCall.arguments[0]) ? dataTaggedErrorCall.arguments[0] : void 0,
5993
- Data: parsedDataModule.value
6105
+ Data: parsedDataModule
5994
6106
  };
5995
6107
  }
5996
6108
  }
@@ -6022,13 +6134,13 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
6022
6134
  if (ts.isPropertyAccessExpression(dataIdentifier) && ts.isIdentifier(dataIdentifier.name) && ts.idText(dataIdentifier.name) === "TaggedClass") {
6023
6135
  const parsedDataModule = yield* pipe(
6024
6136
  importedDataModule(dataIdentifier.expression),
6025
- option
6137
+ orUndefined
6026
6138
  );
6027
- if (isSome2(parsedDataModule)) {
6139
+ if (parsedDataModule) {
6028
6140
  return {
6029
6141
  className: atLocation.name,
6030
6142
  keyStringLiteral: dataTaggedClassCall.arguments.length > 0 && ts.isStringLiteral(dataTaggedClassCall.arguments[0]) ? dataTaggedClassCall.arguments[0] : void 0,
6031
- Data: parsedDataModule.value
6143
+ Data: parsedDataModule
6032
6144
  };
6033
6145
  }
6034
6146
  }
@@ -6062,9 +6174,9 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
6062
6174
  if (ts.isPropertyAccessExpression(contextTagIdentifier) && ts.isIdentifier(contextTagIdentifier.name) && ts.idText(contextTagIdentifier.name) === "Tag") {
6063
6175
  const parsedContextModule = yield* pipe(
6064
6176
  importedContextModule(contextTagIdentifier.expression),
6065
- option
6177
+ orUndefined
6066
6178
  );
6067
- if (isSome2(parsedContextModule)) {
6179
+ if (parsedContextModule) {
6068
6180
  const classSym = typeChecker.getSymbolAtLocation(atLocation.name);
6069
6181
  if (!classSym) return yield* typeParserIssue("Class has no symbol", void 0, atLocation);
6070
6182
  const type = typeChecker.getTypeOfSymbol(classSym);
@@ -6075,7 +6187,7 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
6075
6187
  keyStringLiteral: ts.isStringLiteral(contextTagCall.arguments[0]) ? contextTagCall.arguments[0] : void 0,
6076
6188
  args: contextTagCall.arguments,
6077
6189
  Identifier: tagType.Identifier,
6078
- Tag: parsedContextModule.value
6190
+ Tag: parsedContextModule
6079
6191
  };
6080
6192
  }
6081
6193
  }
@@ -6113,9 +6225,9 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
6113
6225
  const selfTypeNode = wholeCall.typeArguments[0];
6114
6226
  const isEffectTag = yield* pipe(
6115
6227
  isNodeReferenceToEffectModuleApi("Tag")(effectTagIdentifier),
6116
- option
6228
+ orUndefined
6117
6229
  );
6118
- if (isSome2(isEffectTag)) {
6230
+ if (isEffectTag) {
6119
6231
  return {
6120
6232
  className: atLocation.name,
6121
6233
  selfTypeNode,
@@ -6155,17 +6267,17 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
6155
6267
  const selfTypeNode = effectServiceCall.typeArguments[0];
6156
6268
  const isEffectService = yield* pipe(
6157
6269
  isNodeReferenceToEffectModuleApi("Service")(effectServiceIdentifier),
6158
- option
6270
+ orUndefined
6159
6271
  );
6160
- if (isSome2(isEffectService)) {
6272
+ if (isEffectService) {
6161
6273
  const classSym = typeChecker.getSymbolAtLocation(atLocation.name);
6162
6274
  if (!classSym) return yield* typeParserIssue("Class has no symbol", void 0, atLocation);
6163
6275
  const type = typeChecker.getTypeOfSymbol(classSym);
6164
6276
  const parsedContextTag = yield* pipe(
6165
6277
  contextTag(type, atLocation),
6166
- option
6278
+ orUndefined
6167
6279
  );
6168
- if (isSome2(parsedContextTag)) {
6280
+ if (parsedContextTag) {
6169
6281
  let accessors2 = void 0;
6170
6282
  let dependencies = void 0;
6171
6283
  if (wholeCall.arguments.length >= 2) {
@@ -6182,7 +6294,7 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
6182
6294
  }
6183
6295
  }
6184
6296
  return {
6185
- ...parsedContextTag.value,
6297
+ ...parsedContextTag,
6186
6298
  className: atLocation.name,
6187
6299
  selfTypeNode,
6188
6300
  args: wholeCall.arguments,
@@ -6252,9 +6364,9 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
6252
6364
  if (ts.isCallExpression(schemaCall) && schemaCall.typeArguments && schemaCall.typeArguments.length > 0) {
6253
6365
  const isEffectSchemaModuleApi = yield* pipe(
6254
6366
  isNodeReferenceToEffectSqlModelModuleApi("Class")(schemaCall.expression),
6255
- option
6367
+ orUndefined
6256
6368
  );
6257
- if (isSome2(isEffectSchemaModuleApi)) {
6369
+ if (isEffectSchemaModuleApi) {
6258
6370
  return {
6259
6371
  className: atLocation.name,
6260
6372
  selfTypeNode: schemaCall.typeArguments[0]
@@ -6377,19 +6489,18 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
6377
6489
  map8((s) => ({ _tag: "call", ...s }))
6378
6490
  )
6379
6491
  ),
6380
- option
6492
+ orUndefined
6381
6493
  );
6382
- if (isSome2(parsed)) {
6383
- const result2 = parsed.value;
6494
+ if (parsed) {
6384
6495
  let transformations;
6385
6496
  let flowNode;
6386
6497
  let childrenToTraverse = [];
6387
- if (result2._tag === "pipe") {
6388
- const signature = typeChecker.getResolvedSignature(result2.node);
6498
+ if (parsed._tag === "pipe") {
6499
+ const signature = typeChecker.getResolvedSignature(parsed.node);
6389
6500
  const typeArguments = signature ? typeChecker.getTypeArgumentsForResolvedSignature(signature) : void 0;
6390
6501
  transformations = [];
6391
- for (let i = 0; i < result2.args.length; i++) {
6392
- const arg = result2.args[i];
6502
+ for (let i = 0; i < parsed.args.length; i++) {
6503
+ const arg = parsed.args[i];
6393
6504
  const outType = typeArguments?.[i + 1];
6394
6505
  if (ts.isCallExpression(arg)) {
6395
6506
  transformations.push({
@@ -6398,7 +6509,7 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
6398
6509
  args: Array.from(arg.arguments),
6399
6510
  // e.g., [(x) => x + 1]
6400
6511
  outType,
6401
- kind: result2.kind
6512
+ kind: parsed.kind
6402
6513
  });
6403
6514
  } else {
6404
6515
  transformations.push({
@@ -6406,17 +6517,17 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
6406
6517
  // e.g., Effect.asVoid
6407
6518
  args: void 0,
6408
6519
  outType,
6409
- kind: result2.kind
6520
+ kind: parsed.kind
6410
6521
  });
6411
6522
  }
6412
6523
  }
6413
- flowNode = result2.node;
6414
- childrenToTraverse = result2.args;
6524
+ flowNode = parsed.node;
6525
+ childrenToTraverse = parsed.args;
6415
6526
  } else {
6416
6527
  const callSignature = typeChecker.getResolvedSignature(node);
6417
6528
  const outType = callSignature ? typeChecker.getReturnTypeOfSignature(callSignature) : void 0;
6418
6529
  transformations = [{
6419
- callee: result2.callee,
6530
+ callee: parsed.callee,
6420
6531
  args: void 0,
6421
6532
  outType,
6422
6533
  kind: "call"
@@ -6426,20 +6537,20 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
6426
6537
  if (parentFlow) {
6427
6538
  parentFlow.transformations.unshift(...transformations);
6428
6539
  parentFlow.subject = {
6429
- node: result2.subject,
6430
- outType: typeCheckerUtils.getTypeAtLocation(result2.subject)
6540
+ node: parsed.subject,
6541
+ outType: typeCheckerUtils.getTypeAtLocation(parsed.subject)
6431
6542
  };
6432
- workQueue.push([result2.subject, parentFlow]);
6543
+ workQueue.push([parsed.subject, parentFlow]);
6433
6544
  } else {
6434
6545
  const newFlow = {
6435
6546
  node: flowNode,
6436
6547
  subject: {
6437
- node: result2.subject,
6438
- outType: typeCheckerUtils.getTypeAtLocation(result2.subject)
6548
+ node: parsed.subject,
6549
+ outType: typeCheckerUtils.getTypeAtLocation(parsed.subject)
6439
6550
  },
6440
6551
  transformations
6441
6552
  };
6442
- workQueue.push([result2.subject, newFlow]);
6553
+ workQueue.push([parsed.subject, newFlow]);
6443
6554
  }
6444
6555
  for (const child of childrenToTraverse) {
6445
6556
  ts.forEachChild(child, (c) => {
@@ -6449,17 +6560,17 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
6449
6560
  continue;
6450
6561
  }
6451
6562
  if (includeEffectFn) {
6452
- const effectFnGenParsed = yield* pipe(effectFnGen(node), option);
6453
- const effectFnUntracedGenParsed = isNone2(effectFnGenParsed) ? yield* pipe(effectFnUntracedGen(node), option) : none2();
6454
- const effectFnNonGenParsed = isNone2(effectFnGenParsed) && isNone2(effectFnUntracedGenParsed) ? yield* pipe(effectFn(node), option) : none2();
6455
- const isEffectFnGen = isSome2(effectFnGenParsed);
6456
- const isEffectFnUntracedGen = isSome2(effectFnUntracedGenParsed);
6457
- const isEffectFnNonGen = isSome2(effectFnNonGenParsed);
6458
- const transformationKind = isEffectFnUntracedGen ? "effectFnUntraced" : "effectFn";
6459
- if (isEffectFnGen || isEffectFnUntracedGen) {
6460
- const effectFnParsed = isEffectFnGen ? effectFnGenParsed : effectFnUntracedGenParsed;
6461
- if (isSome2(effectFnParsed) && effectFnParsed.value.pipeArguments.length > 0) {
6462
- const fnResult = effectFnParsed.value;
6563
+ const effectFnKind = yield* pipe(
6564
+ map8(effectFnGen(node), (_) => ({ kind: "effectFnGen", ..._ })),
6565
+ orElse2(
6566
+ () => map8(effectFnUntracedGen(node), (_) => ({ kind: "effectFnUntracedGen", ..._ }))
6567
+ ),
6568
+ orElse2(() => map8(effectFn(node), (_) => ({ kind: "effectFn", ..._ }))),
6569
+ orUndefined
6570
+ );
6571
+ if (effectFnKind && (effectFnKind.kind === "effectFnGen" || effectFnKind.kind === "effectFnUntracedGen")) {
6572
+ if (effectFnKind.pipeArguments.length > 0) {
6573
+ const fnResult = effectFnKind;
6463
6574
  const pipeArgs = fnResult.pipeArguments;
6464
6575
  const transformations = [];
6465
6576
  let subjectType;
@@ -6479,14 +6590,14 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
6479
6590
  callee: arg.expression,
6480
6591
  args: Array.from(arg.arguments),
6481
6592
  outType,
6482
- kind: transformationKind
6593
+ kind: effectFnKind.kind === "effectFnUntracedGen" ? "effectFnUntraced" : "effectFn"
6483
6594
  });
6484
6595
  } else {
6485
6596
  transformations.push({
6486
6597
  callee: arg,
6487
6598
  args: void 0,
6488
6599
  outType,
6489
- kind: transformationKind
6600
+ kind: effectFnKind.kind === "effectFnUntracedGen" ? "effectFnUntraced" : "effectFn"
6490
6601
  });
6491
6602
  }
6492
6603
  }
@@ -6508,8 +6619,8 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
6508
6619
  continue;
6509
6620
  }
6510
6621
  }
6511
- if (isEffectFnNonGen && isSome2(effectFnNonGenParsed) && effectFnNonGenParsed.value.pipeArguments.length > 0) {
6512
- const fnResult = effectFnNonGenParsed.value;
6622
+ if (effectFnKind && effectFnKind.kind === "effectFn" && effectFnKind.pipeArguments.length > 0) {
6623
+ const fnResult = effectFnKind;
6513
6624
  const pipeArgs = fnResult.pipeArguments;
6514
6625
  const transformations = [];
6515
6626
  let subjectType;
@@ -6655,11 +6766,14 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
6655
6766
  extendsDataTaggedError,
6656
6767
  extendsDataTaggedClass,
6657
6768
  extendsSchemaTaggedRequest,
6769
+ extendsSchemaRequestClass,
6658
6770
  extendsEffectSqlModelClass,
6659
6771
  lazyExpression,
6660
6772
  emptyFunction,
6661
6773
  pipingFlows,
6662
- reconstructPipingFlow
6774
+ reconstructPipingFlow,
6775
+ getEffectRelatedPackages,
6776
+ supportedEffect
6663
6777
  };
6664
6778
  }
6665
6779
 
@@ -7969,6 +8083,7 @@ var catchAllToMapError = createDiagnostic({
7969
8083
  apply: fn("catchAllToMapError.apply")(function* (sourceFile, report) {
7970
8084
  const ts = yield* service(TypeScriptApi);
7971
8085
  const typeParser = yield* service(TypeParser);
8086
+ const catchAllName = typeParser.supportedEffect() === "v3" ? "catchAll" : "catch";
7972
8087
  const getFunctionBody = (node) => {
7973
8088
  if (ts.isArrowFunction(node)) {
7974
8089
  return node.body;
@@ -7983,10 +8098,10 @@ var catchAllToMapError = createDiagnostic({
7983
8098
  if (ts.isCallExpression(body)) {
7984
8099
  const isFailCall = yield* pipe(
7985
8100
  typeParser.isNodeReferenceToEffectModuleApi("fail")(body.expression),
7986
- option
8101
+ orUndefined
7987
8102
  );
7988
- if (isSome2(isFailCall) && body.arguments.length >= 1) {
7989
- return some2({ failCall: body, failArg: body.arguments[0] });
8103
+ if (isFailCall && body.arguments.length >= 1) {
8104
+ return { failCall: body, failArg: body.arguments[0] };
7990
8105
  }
7991
8106
  }
7992
8107
  if (ts.isBlock(body)) {
@@ -7996,15 +8111,14 @@ var catchAllToMapError = createDiagnostic({
7996
8111
  if (ts.isReturnStatement(stmt) && stmt.expression && ts.isCallExpression(stmt.expression)) {
7997
8112
  const isFailCall = yield* pipe(
7998
8113
  typeParser.isNodeReferenceToEffectModuleApi("fail")(stmt.expression.expression),
7999
- option
8114
+ orUndefined
8000
8115
  );
8001
- if (isSome2(isFailCall) && stmt.expression.arguments.length >= 1) {
8002
- return some2({ failCall: stmt.expression, failArg: stmt.expression.arguments[0] });
8116
+ if (isFailCall && stmt.expression.arguments.length >= 1) {
8117
+ return { failCall: stmt.expression, failArg: stmt.expression.arguments[0] };
8003
8118
  }
8004
8119
  }
8005
8120
  }
8006
8121
  }
8007
- return none2();
8008
8122
  });
8009
8123
  };
8010
8124
  const flows = yield* typeParser.pipingFlows(true)(sourceFile);
@@ -8014,10 +8128,10 @@ var catchAllToMapError = createDiagnostic({
8014
8128
  continue;
8015
8129
  }
8016
8130
  const isCatchAllCall = yield* pipe(
8017
- typeParser.isNodeReferenceToEffectModuleApi("catchAll")(transformation.callee),
8018
- option
8131
+ typeParser.isNodeReferenceToEffectModuleApi(catchAllName)(transformation.callee),
8132
+ orUndefined
8019
8133
  );
8020
- if (isNone2(isCatchAllCall)) {
8134
+ if (!isCatchAllCall) {
8021
8135
  continue;
8022
8136
  }
8023
8137
  const callback = transformation.args[0];
@@ -8025,11 +8139,11 @@ var catchAllToMapError = createDiagnostic({
8025
8139
  const functionBody = getFunctionBody(callback);
8026
8140
  if (!functionBody) continue;
8027
8141
  const failCallInfo = yield* getEffectFailCallInfo(functionBody);
8028
- if (isNone2(failCallInfo)) continue;
8029
- const { failArg, failCall } = failCallInfo.value;
8142
+ if (!failCallInfo) continue;
8143
+ const { failArg, failCall } = failCallInfo;
8030
8144
  report({
8031
8145
  location: transformation.callee,
8032
- messageText: `You can use Effect.mapError instead of Effect.catchAll + Effect.fail to transform the error type.`,
8146
+ messageText: `You can use Effect.mapError instead of Effect.${catchAllName} + Effect.fail to transform the error type.`,
8033
8147
  fixes: [{
8034
8148
  fixName: "catchAllToMapError_fix",
8035
8149
  description: "Replace with Effect.mapError",
@@ -8060,7 +8174,7 @@ var catchUnfailableEffect = createDiagnostic({
8060
8174
  apply: fn("catchUnfailableEffect.apply")(function* (sourceFile, report) {
8061
8175
  const ts = yield* service(TypeScriptApi);
8062
8176
  const typeParser = yield* service(TypeParser);
8063
- const catchFunctions = ["catchAll", "catch", "catchIf", "catchSome", "catchTag", "catchTags"];
8177
+ const catchFunctions = typeParser.supportedEffect() === "v3" ? ["catchAll", "catch", "catchIf", "catchSome", "catchTag", "catchTags"] : ["catch", "catchIf", "catchTag", "catchTags"];
8064
8178
  const flows = yield* typeParser.pipingFlows(true)(sourceFile);
8065
8179
  for (const flow2 of flows) {
8066
8180
  for (let i = 0; i < flow2.transformations.length; i++) {
@@ -8125,7 +8239,12 @@ var classSelfMismatch = createDiagnostic({
8125
8239
  orElse2(() => typeParser.extendsSchemaClass(node)),
8126
8240
  orElse2(() => typeParser.extendsSchemaTaggedClass(node)),
8127
8241
  orElse2(() => typeParser.extendsSchemaTaggedError(node)),
8128
- orElse2(() => typeParser.extendsSchemaTaggedRequest(node)),
8242
+ orElse2(
8243
+ () => pipe(
8244
+ typeParser.extendsSchemaTaggedRequest(node),
8245
+ orElse2(() => typeParser.extendsSchemaRequestClass(node))
8246
+ )
8247
+ ),
8129
8248
  orElse2(() => typeParser.extendsEffectSqlModelClass(node)),
8130
8249
  orElse2(() => void_)
8131
8250
  );
@@ -8286,39 +8405,18 @@ var deterministicKeys = createDiagnostic({
8286
8405
  });
8287
8406
 
8288
8407
  // src/diagnostics/duplicatePackage.ts
8289
- var checkedPackagesCache = /* @__PURE__ */ new Map();
8290
- var programResolvedCacheSize = /* @__PURE__ */ new Map();
8291
8408
  var duplicatePackage = createDiagnostic({
8292
8409
  name: "duplicatePackage",
8293
8410
  code: 6,
8294
8411
  description: "Detects when multiple versions of the same Effect package are loaded",
8295
8412
  severity: "warning",
8296
8413
  apply: fn("duplicatePackage.apply")(function* (sourceFile, report) {
8297
- const program = yield* service(TypeScriptProgram);
8298
- const tsUtils = yield* service(TypeScriptUtils);
8414
+ const typeParser = yield* service(TypeParser);
8299
8415
  const options = yield* service(LanguageServicePluginOptions);
8300
8416
  if (sourceFile.statements.length < 1) return;
8301
- let resolvedPackages = checkedPackagesCache.get(sourceFile.fileName) || {};
8302
- const newResolvedModuleSize = hasProperty(program, "resolvedModules") && hasProperty(program.resolvedModules, "size") && isNumber(program.resolvedModules.size) ? program.resolvedModules.size : 0;
8303
- const oldResolvedSize = programResolvedCacheSize.get(sourceFile.fileName) || -1;
8304
- if (newResolvedModuleSize !== oldResolvedSize) {
8305
- const seenPackages = /* @__PURE__ */ new Set();
8306
- resolvedPackages = {};
8307
- program.getSourceFiles().map((_) => {
8308
- const packageInfo = tsUtils.parsePackageContentNameAndVersionFromScope(_);
8309
- if (!packageInfo) return;
8310
- const packageNameAndVersion = packageInfo.name + "@" + packageInfo.version;
8311
- if (seenPackages.has(packageNameAndVersion)) return;
8312
- seenPackages.add(packageNameAndVersion);
8313
- if (!(packageInfo.name === "effect" || packageInfo.hasEffectInPeerDependencies)) return;
8314
- if (options.allowedDuplicatedPackages.indexOf(packageInfo.name) > -1) return;
8315
- resolvedPackages[packageInfo.name] = resolvedPackages[packageInfo.name] || {};
8316
- resolvedPackages[packageInfo.name][packageInfo.version] = packageInfo.packageDirectory;
8317
- });
8318
- checkedPackagesCache.set(sourceFile.fileName, resolvedPackages);
8319
- programResolvedCacheSize.set(sourceFile.fileName, newResolvedModuleSize);
8320
- }
8417
+ const resolvedPackages = typeParser.getEffectRelatedPackages(sourceFile);
8321
8418
  for (const packageName of Object.keys(resolvedPackages)) {
8419
+ if (options.allowedDuplicatedPackages.indexOf(packageName) > -1) return;
8322
8420
  if (Object.keys(resolvedPackages[packageName]).length > 1) {
8323
8421
  const versions = Object.keys(resolvedPackages[packageName]);
8324
8422
  report({
@@ -9142,23 +9240,25 @@ var globalErrorInEffectCatch = createDiagnostic({
9142
9240
  if (isEffectWithCatch) {
9143
9241
  const signature = typeChecker.getResolvedSignature(node);
9144
9242
  if (signature) {
9145
- const objectType = typeChecker.getParameterType(signature, 0);
9146
- const catchFunctionSymbol = typeChecker.getPropertyOfType(objectType, "catch");
9147
- if (catchFunctionSymbol) {
9148
- const catchFunctionType = typeChecker.getTypeOfSymbolAtLocation(catchFunctionSymbol, node);
9149
- const signatures = typeChecker.getSignaturesOfType(catchFunctionType, ts.SignatureKind.Call);
9150
- if (signatures.length > 0) {
9151
- const returnType = typeChecker.getReturnTypeOfSignature(signatures[0]);
9152
- if (returnType && typeCheckerUtils.isGlobalErrorType(returnType)) {
9153
- const nodeText = sourceFile.text.substring(
9154
- ts.getTokenPosOfNode(node.expression, sourceFile),
9155
- node.expression.end
9156
- );
9157
- report({
9158
- location: node.expression,
9159
- messageText: `The 'catch' callback in ${nodeText} returns global 'Error', which loses type safety as untagged errors merge together. Consider using a tagged error and optionally wrapping the original in a 'cause' property.`,
9160
- fixes: []
9161
- });
9243
+ const firstParameterType = typeChecker.getParameterType(signature, 0);
9244
+ for (const objectType of typeCheckerUtils.unrollUnionMembers(firstParameterType)) {
9245
+ const catchFunctionSymbol = typeChecker.getPropertyOfType(objectType, "catch");
9246
+ if (catchFunctionSymbol) {
9247
+ const catchFunctionType = typeChecker.getTypeOfSymbolAtLocation(catchFunctionSymbol, node);
9248
+ const signatures = typeChecker.getSignaturesOfType(catchFunctionType, ts.SignatureKind.Call);
9249
+ if (signatures.length > 0) {
9250
+ const returnType = typeChecker.getReturnTypeOfSignature(signatures[0]);
9251
+ if (returnType && typeCheckerUtils.isGlobalErrorType(returnType)) {
9252
+ const nodeText = sourceFile.text.substring(
9253
+ ts.getTokenPosOfNode(node.expression, sourceFile),
9254
+ node.expression.end
9255
+ );
9256
+ report({
9257
+ location: node.expression,
9258
+ messageText: `The 'catch' callback in ${nodeText} returns global 'Error', which loses type safety as untagged errors merge together. Consider using a tagged error and optionally wrapping the original in a 'cause' property.`,
9259
+ fixes: []
9260
+ });
9261
+ }
9162
9262
  }
9163
9263
  }
9164
9264
  }
@@ -9971,22 +10071,23 @@ var missingEffectError = createDiagnostic({
9971
10071
  map8((result) => {
9972
10072
  if (result.missingErrorTypes.length === 0) return;
9973
10073
  const fixes = [];
9974
- if (ts.isExpression(valueNode) && result.expectedErrorType.flags & ts.TypeFlags.Never) {
10074
+ const catchAllErrorsName = typeParser.supportedEffect() === "v3" ? "catchAll" : "catch";
10075
+ if (ts.isExpression(valueNode) && result.expectedErrorType.flags & ts.TypeFlags.Never && catchAllErrorsName) {
9975
10076
  fixes.push({
9976
- fixName: "missingEffectError_catchAll",
9977
- description: "Catch all errors with Effect.catchAll",
10077
+ fixName: `missingEffectError_${catchAllErrorsName}`,
10078
+ description: `Catch all errors with Effect.${catchAllErrorsName}`,
9978
10079
  apply: gen(function* () {
9979
10080
  const changeTracker = yield* service(ChangeTracker);
9980
10081
  changeTracker.insertText(
9981
10082
  sourceFile,
9982
10083
  ts.getTokenPosOfNode(valueNode, sourceFile),
9983
- effectModuleIdentifier + ".catchAll("
10084
+ effectModuleIdentifier + `.${catchAllErrorsName}(`
9984
10085
  );
9985
10086
  changeTracker.insertText(sourceFile, valueNode.end, ", () => ");
9986
10087
  changeTracker.insertNodeAt(
9987
10088
  sourceFile,
9988
10089
  valueNode.end,
9989
- createDieMessage("TODO: catchAll not implemented")
10090
+ createDieMessage(`TODO: ${catchAllErrorsName} not implemented`)
9990
10091
  );
9991
10092
  changeTracker.insertText(sourceFile, valueNode.end, ")");
9992
10093
  })
@@ -10068,6 +10169,7 @@ var missingEffectServiceDependency = createDiagnostic({
10068
10169
  const typeChecker = yield* service(TypeCheckerApi);
10069
10170
  const typeCheckerUtils = yield* service(TypeCheckerUtils);
10070
10171
  const typeParser = yield* service(TypeParser);
10172
+ if (typeParser.supportedEffect() !== "v3") return;
10071
10173
  const nodeToVisit = [];
10072
10174
  const appendNodeToVisit = (node) => {
10073
10175
  nodeToVisit.push(node);
@@ -11254,6 +11356,7 @@ var scopeInLayerEffect = createDiagnostic({
11254
11356
  const typeChecker = yield* service(TypeCheckerApi);
11255
11357
  const typeParser = yield* service(TypeParser);
11256
11358
  const typeCheckerUtils = yield* service(TypeCheckerUtils);
11359
+ if (typeParser.supportedEffect() !== "v3") return;
11257
11360
  const layerModuleIdentifier = tsUtils.findImportedModuleIdentifierByPackageAndNameOrBarrel(
11258
11361
  sourceFile,
11259
11362
  "effect",
@@ -11462,6 +11565,17 @@ var tryCatchInEffectGen = createDiagnostic({
11462
11565
  apply: fn("tryCatchInEffectGen.apply")(function* (sourceFile, report) {
11463
11566
  const ts = yield* service(TypeScriptApi);
11464
11567
  const typeParser = yield* service(TypeParser);
11568
+ const alternatives = typeParser.supportedEffect() === "v4" ? [
11569
+ "Effect.try",
11570
+ "Effect.tryPromise",
11571
+ "Effect.catch",
11572
+ "Effect.catchTag"
11573
+ ] : [
11574
+ "Effect.try",
11575
+ "Effect.tryPromise",
11576
+ "Effect.catchAll",
11577
+ "Effect.catchTag"
11578
+ ];
11465
11579
  const nodeToVisit = [];
11466
11580
  const appendNodeToVisit = (node) => {
11467
11581
  nodeToVisit.push(node);
@@ -11487,7 +11601,7 @@ var tryCatchInEffectGen = createDiagnostic({
11487
11601
  map8(() => {
11488
11602
  report({
11489
11603
  location: node,
11490
- messageText: "Avoid using try/catch inside Effect generators. Use Effect's error handling mechanisms instead (e.g., Effect.try, Effect.tryPromise, Effect.catchAll, Effect.catchTag).",
11604
+ messageText: `Avoid using try/catch inside Effect generators. Use Effect's error handling mechanisms instead (e.g. ${alternatives.join(", ")}).`,
11491
11605
  fixes: []
11492
11606
  });
11493
11607
  }),
@@ -11509,6 +11623,7 @@ var unknownInEffectCatch = createDiagnostic({
11509
11623
  const ts = yield* service(TypeScriptApi);
11510
11624
  const typeParser = yield* service(TypeParser);
11511
11625
  const typeChecker = yield* service(TypeCheckerApi);
11626
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
11512
11627
  const nodeToVisit = [];
11513
11628
  const appendNodeToVisit = (node) => {
11514
11629
  nodeToVisit.push(node);
@@ -11529,24 +11644,26 @@ var unknownInEffectCatch = createDiagnostic({
11529
11644
  if (isEffectWithCatch) {
11530
11645
  const signature = typeChecker.getResolvedSignature(node);
11531
11646
  if (signature) {
11532
- const objectType = typeChecker.getParameterType(signature, 0);
11533
- const catchFunctionSymbol = typeChecker.getPropertyOfType(objectType, "catch");
11534
- if (catchFunctionSymbol) {
11535
- const catchFunctionType = typeChecker.getTypeOfSymbolAtLocation(catchFunctionSymbol, node);
11536
- const signatures = typeChecker.getSignaturesOfType(catchFunctionType, ts.SignatureKind.Call);
11537
- if (signatures.length > 0) {
11538
- const returnType = typeChecker.getReturnTypeOfSignature(signatures[0]);
11539
- if (returnType && (returnType.flags & ts.TypeFlags.Unknown || returnType.flags & ts.TypeFlags.Any)) {
11540
- const nodeText = sourceFile.text.substring(
11541
- ts.getTokenPosOfNode(node.expression, sourceFile),
11542
- node.expression.end
11543
- );
11544
- report({
11545
- location: node.expression,
11546
- messageText: `The 'catch' callback in ${nodeText} returns 'unknown'. The catch callback should be used to provide typed errors.
11647
+ const parameterType = typeChecker.getParameterType(signature, 0);
11648
+ for (const objectType of typeCheckerUtils.unrollUnionMembers(parameterType)) {
11649
+ const catchFunctionSymbol = typeChecker.getPropertyOfType(objectType, "catch");
11650
+ if (catchFunctionSymbol) {
11651
+ const catchFunctionType = typeChecker.getTypeOfSymbolAtLocation(catchFunctionSymbol, node);
11652
+ const signatures = typeChecker.getSignaturesOfType(catchFunctionType, ts.SignatureKind.Call);
11653
+ if (signatures.length > 0) {
11654
+ const returnType = typeChecker.getReturnTypeOfSignature(signatures[0]);
11655
+ if (returnType && (returnType.flags & ts.TypeFlags.Unknown || returnType.flags & ts.TypeFlags.Any)) {
11656
+ const nodeText = sourceFile.text.substring(
11657
+ ts.getTokenPosOfNode(node.expression, sourceFile),
11658
+ node.expression.end
11659
+ );
11660
+ report({
11661
+ location: node.expression,
11662
+ messageText: `The 'catch' callback in ${nodeText} returns 'unknown'. The catch callback should be used to provide typed errors.
11547
11663
  Consider wrapping unknown errors into Effect's Data.TaggedError for example, or narrow down the type to the specific error raised.`,
11548
- fixes: []
11549
- });
11664
+ fixes: []
11665
+ });
11666
+ }
11550
11667
  }
11551
11668
  }
11552
11669
  }
@@ -13256,7 +13373,7 @@ function effectTypeArgs(sourceFile, position, quickInfo2) {
13256
13373
  );
13257
13374
  }
13258
13375
 
13259
- // node_modules/.pnpm/pako@2.1.0/node_modules/pako/dist/pako.esm.mjs
13376
+ // ../../node_modules/.pnpm/pako@2.1.0/node_modules/pako/dist/pako.esm.mjs
13260
13377
  var Z_FIXED$1 = 4;
13261
13378
  var Z_BINARY = 0;
13262
13379
  var Z_TEXT = 1;
@@ -18500,6 +18617,12 @@ var effectGenToFn = createRefactor({
18500
18617
  const ts = yield* service(TypeScriptApi);
18501
18618
  const tsUtils = yield* service(TypeScriptUtils);
18502
18619
  const typeParser = yield* service(TypeParser);
18620
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
18621
+ const effectIdentifier = tsUtils.findImportedModuleIdentifierByPackageAndNameOrBarrel(
18622
+ sourceFile,
18623
+ "effect",
18624
+ "Effect"
18625
+ ) || "Effect";
18503
18626
  const skipReturnBlock = (node) => ts.isBlock(node) && node.statements.length === 1 && ts.isReturnStatement(node.statements[0]) && node.statements[0].expression ? node.statements[0].expression : node;
18504
18627
  const parseFunctionLikeReturnEffectGen = fn("parseFunctionLikeReturnEffect.apply")(function* (node) {
18505
18628
  if ((ts.isArrowFunction(node) || ts.isMethodDeclaration(node) || ts.isFunctionDeclaration(node)) && node.body) {
@@ -18550,6 +18673,45 @@ var effectGenToFn = createRefactor({
18550
18673
  effectModule,
18551
18674
  "fn"
18552
18675
  );
18676
+ let returnType = void 0;
18677
+ if (nodeToReplace.type) {
18678
+ const actualType = typeCheckerUtils.getTypeAtLocation(nodeToReplace.type);
18679
+ if (actualType) {
18680
+ const maybeType = yield* pipe(
18681
+ typeParser.strictEffectType(actualType, nodeToReplace.type),
18682
+ orUndefined
18683
+ );
18684
+ if (maybeType) {
18685
+ const aType = typeCheckerUtils.typeToSimplifiedTypeNode(
18686
+ maybeType.A,
18687
+ nodeToReplace,
18688
+ ts.NodeBuilderFlags.NoTruncation
18689
+ );
18690
+ const eType = typeCheckerUtils.typeToSimplifiedTypeNode(
18691
+ maybeType.E,
18692
+ nodeToReplace,
18693
+ ts.NodeBuilderFlags.NoTruncation
18694
+ );
18695
+ const rType = typeCheckerUtils.typeToSimplifiedTypeNode(
18696
+ maybeType.R,
18697
+ nodeToReplace,
18698
+ ts.NodeBuilderFlags.NoTruncation
18699
+ );
18700
+ if (aType && eType && rType) {
18701
+ returnType = ts.factory.createTypeReferenceNode(
18702
+ ts.factory.createQualifiedName(
18703
+ ts.factory.createQualifiedName(
18704
+ ts.factory.createIdentifier(effectIdentifier),
18705
+ ts.factory.createIdentifier("fn")
18706
+ ),
18707
+ ts.factory.createIdentifier("Return")
18708
+ ),
18709
+ [aType, eType, rType]
18710
+ );
18711
+ }
18712
+ }
18713
+ }
18714
+ }
18553
18715
  const effectFnCallWithGenerator = ts.factory.createCallExpression(
18554
18716
  effectFn,
18555
18717
  void 0,
@@ -18559,7 +18721,7 @@ var effectGenToFn = createRefactor({
18559
18721
  void 0,
18560
18722
  nodeToReplace.typeParameters,
18561
18723
  nodeToReplace.parameters,
18562
- nodeToReplace.type,
18724
+ returnType,
18563
18725
  generatorFunction.body
18564
18726
  )].concat(pipeArgs)
18565
18727
  );