@effect/language-service 0.10.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -7
- package/index.js +353 -1936
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -70,8 +70,6 @@ var dual = function(arity, body) {
|
|
|
70
70
|
};
|
|
71
71
|
var identity = (a) => a;
|
|
72
72
|
var constant = (value) => () => value;
|
|
73
|
-
var constTrue = /* @__PURE__ */ constant(true);
|
|
74
|
-
var constFalse = /* @__PURE__ */ constant(false);
|
|
75
73
|
var constNull = /* @__PURE__ */ constant(null);
|
|
76
74
|
var constUndefined = /* @__PURE__ */ constant(void 0);
|
|
77
75
|
function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
|
|
@@ -161,13 +159,13 @@ var array = (item) => make((self, that) => {
|
|
|
161
159
|
});
|
|
162
160
|
|
|
163
161
|
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/doNotation.js
|
|
164
|
-
var let_ = (
|
|
162
|
+
var let_ = (map4) => dual(3, (self, name, f) => map4(self, (a) => Object.assign({}, a, {
|
|
165
163
|
[name]: f(a)
|
|
166
164
|
})));
|
|
167
|
-
var bindTo = (
|
|
165
|
+
var bindTo = (map4) => dual(2, (self, name) => map4(self, (a) => ({
|
|
168
166
|
[name]: a
|
|
169
167
|
})));
|
|
170
|
-
var bind = (
|
|
168
|
+
var bind = (map4, flatMap4) => dual(3, (self, name, f) => flatMap4(self, (a) => map4(f(a), (b) => Object.assign({}, a, {
|
|
171
169
|
[name]: b
|
|
172
170
|
}))));
|
|
173
171
|
|
|
@@ -194,7 +192,6 @@ var isFunction2 = isFunction;
|
|
|
194
192
|
var isRecordOrArray = (input) => typeof input === "object" && input !== null;
|
|
195
193
|
var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
|
|
196
194
|
var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
|
|
197
|
-
var isTagged = /* @__PURE__ */ dual(2, (self, tag) => hasProperty(self, "_tag") && self["_tag"] === tag);
|
|
198
195
|
|
|
199
196
|
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/errors.js
|
|
200
197
|
var getBugErrorMessage = (message) => `BUG: ${message} - please report an issue at https://github.com/Effect-TS/effect/issues`;
|
|
@@ -385,21 +382,14 @@ var string = (str) => {
|
|
|
385
382
|
}
|
|
386
383
|
return optimize(h);
|
|
387
384
|
};
|
|
388
|
-
var structureKeys = (o,
|
|
385
|
+
var structureKeys = (o, keys) => {
|
|
389
386
|
let h = 12289;
|
|
390
|
-
for (let i = 0; i <
|
|
391
|
-
h ^= pipe(string(
|
|
387
|
+
for (let i = 0; i < keys.length; i++) {
|
|
388
|
+
h ^= pipe(string(keys[i]), combine(hash(o[keys[i]])));
|
|
392
389
|
}
|
|
393
390
|
return optimize(h);
|
|
394
391
|
};
|
|
395
392
|
var structure = (o) => structureKeys(o, Object.keys(o));
|
|
396
|
-
var array2 = (arr) => {
|
|
397
|
-
let h = 6151;
|
|
398
|
-
for (let i = 0; i < arr.length; i++) {
|
|
399
|
-
h = pipe(h, combine(hash(arr[i])));
|
|
400
|
-
}
|
|
401
|
-
return optimize(h);
|
|
402
|
-
};
|
|
403
393
|
var cached = function() {
|
|
404
394
|
if (arguments.length === 1) {
|
|
405
395
|
const self2 = arguments[0];
|
|
@@ -515,12 +505,6 @@ var Class = class {
|
|
|
515
505
|
return format(this.toJSON());
|
|
516
506
|
}
|
|
517
507
|
};
|
|
518
|
-
var stringifyCircular = (obj, whitespace) => {
|
|
519
|
-
let cache = [];
|
|
520
|
-
const retVal = JSON.stringify(obj, (_key, value) => typeof value === "object" && value !== null ? cache.includes(value) ? void 0 : cache.push(value) && (redactableState.fiberRefs !== void 0 && isRedactable(value) ? value[symbolRedactable](redactableState.fiberRefs) : value) : value, whitespace);
|
|
521
|
-
cache = void 0;
|
|
522
|
-
return retVal;
|
|
523
|
-
};
|
|
524
508
|
var symbolRedactable = /* @__PURE__ */ Symbol.for("effect/Inspectable/Redactable");
|
|
525
509
|
var isRedactable = (u) => typeof u === "object" && u !== null && symbolRedactable in u;
|
|
526
510
|
var redactableState = /* @__PURE__ */ globalValue("effect/Inspectable/redactableState", () => ({
|
|
@@ -568,8 +552,6 @@ var pipeArguments = (self, args) => {
|
|
|
568
552
|
|
|
569
553
|
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/opCodes/effect.js
|
|
570
554
|
var OP_COMMIT = "Commit";
|
|
571
|
-
var OP_FAILURE = "Failure";
|
|
572
|
-
var OP_WITH_RUNTIME = "WithRuntime";
|
|
573
555
|
|
|
574
556
|
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/effectable.js
|
|
575
557
|
var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
|
|
@@ -843,1839 +825,164 @@ var andThen = /* @__PURE__ */ dual(2, (self, f) => flatMap(self, (a) => {
|
|
|
843
825
|
const b = isFunction2(f) ? f(a) : f;
|
|
844
826
|
return isEither2(b) ? b : right2(b);
|
|
845
827
|
}));
|
|
846
|
-
var zipWith = /* @__PURE__ */ dual(3, (self, that, f) => flatMap(self, (r) => map(that, (r2) => f(r, r2))));
|
|
847
|
-
var ap = /* @__PURE__ */ dual(2, (self, that) => zipWith(self, that, (f, a) => f(a)));
|
|
848
|
-
var all = (input) => {
|
|
849
|
-
if (Symbol.iterator in input) {
|
|
850
|
-
const out2 = [];
|
|
851
|
-
for (const e of input) {
|
|
852
|
-
if (isLeft2(e)) {
|
|
853
|
-
return e;
|
|
854
|
-
}
|
|
855
|
-
out2.push(e.right);
|
|
856
|
-
}
|
|
857
|
-
return right2(out2);
|
|
858
|
-
}
|
|
859
|
-
const out = {};
|
|
860
|
-
for (const key of Object.keys(input)) {
|
|
861
|
-
const e = input[key];
|
|
862
|
-
if (isLeft2(e)) {
|
|
863
|
-
return e;
|
|
864
|
-
}
|
|
865
|
-
out[key] = e.right;
|
|
866
|
-
}
|
|
867
|
-
return right2(out);
|
|
868
|
-
};
|
|
869
|
-
var flip = (self) => isLeft2(self) ? right2(self.left) : left2(self.right);
|
|
870
|
-
var adapter2 = /* @__PURE__ */ adapter();
|
|
871
|
-
var gen = (...args) => {
|
|
872
|
-
const f = args.length === 1 ? args[0] : args[1].bind(args[0]);
|
|
873
|
-
const iterator = f(adapter2);
|
|
874
|
-
let state = iterator.next();
|
|
875
|
-
if (state.done) {
|
|
876
|
-
return right2(state.value);
|
|
877
|
-
} else {
|
|
878
|
-
let current = state.value;
|
|
879
|
-
if (isGenKind(current)) {
|
|
880
|
-
current = current.value;
|
|
881
|
-
} else {
|
|
882
|
-
current = yieldWrapGet(current);
|
|
883
|
-
}
|
|
884
|
-
if (isLeft2(current)) {
|
|
885
|
-
return current;
|
|
886
|
-
}
|
|
887
|
-
while (!state.done) {
|
|
888
|
-
state = iterator.next(current.right);
|
|
889
|
-
if (!state.done) {
|
|
890
|
-
current = state.value;
|
|
891
|
-
if (isGenKind(current)) {
|
|
892
|
-
current = current.value;
|
|
893
|
-
} else {
|
|
894
|
-
current = yieldWrapGet(current);
|
|
895
|
-
}
|
|
896
|
-
if (isLeft2(current)) {
|
|
897
|
-
return current;
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
return right2(state.value);
|
|
902
|
-
}
|
|
903
|
-
};
|
|
904
|
-
var Do = /* @__PURE__ */ right2({});
|
|
905
|
-
var bind2 = /* @__PURE__ */ bind(map, flatMap);
|
|
906
|
-
var bindTo2 = /* @__PURE__ */ bindTo(map);
|
|
907
|
-
var let_2 = /* @__PURE__ */ let_(map);
|
|
908
|
-
|
|
909
|
-
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/array.js
|
|
910
|
-
var isNonEmptyArray = (self) => self.length > 0;
|
|
911
|
-
|
|
912
|
-
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/Order.js
|
|
913
|
-
var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
|
|
914
|
-
|
|
915
|
-
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/Option.js
|
|
916
|
-
var none2 = () => none;
|
|
917
|
-
var some2 = some;
|
|
918
|
-
var isNone2 = isNone;
|
|
919
|
-
var isSome2 = isSome;
|
|
920
|
-
var match2 = /* @__PURE__ */ dual(2, (self, {
|
|
921
|
-
onNone,
|
|
922
|
-
onSome
|
|
923
|
-
}) => isNone2(self) ? onNone() : onSome(self.value));
|
|
924
|
-
var getOrElse2 = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? onNone() : self.value);
|
|
925
|
-
var orElse2 = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? that() : self);
|
|
926
|
-
var fromNullable2 = (nullableValue) => nullableValue == null ? none2() : some2(nullableValue);
|
|
927
|
-
var getOrUndefined2 = /* @__PURE__ */ getOrElse2(constUndefined);
|
|
928
|
-
|
|
929
|
-
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/Array.js
|
|
930
|
-
var fromIterable = (collection) => Array.isArray(collection) ? collection : Array.from(collection);
|
|
931
|
-
var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
|
|
932
|
-
var isArray = Array.isArray;
|
|
933
|
-
var isEmptyArray = (self) => self.length === 0;
|
|
934
|
-
var isEmptyReadonlyArray = isEmptyArray;
|
|
935
|
-
var isNonEmptyReadonlyArray = isNonEmptyArray;
|
|
936
|
-
var isOutOfBound = (i, as) => i < 0 || i >= as.length;
|
|
937
|
-
var get = /* @__PURE__ */ dual(2, (self, index) => {
|
|
938
|
-
const i = Math.floor(index);
|
|
939
|
-
return isOutOfBound(i, self) ? none2() : some2(self[i]);
|
|
940
|
-
});
|
|
941
|
-
var unsafeGet = /* @__PURE__ */ dual(2, (self, index) => {
|
|
942
|
-
const i = Math.floor(index);
|
|
943
|
-
if (isOutOfBound(i, self)) {
|
|
944
|
-
throw new Error(`Index ${i} out of bounds`);
|
|
945
|
-
}
|
|
946
|
-
return self[i];
|
|
947
|
-
});
|
|
948
|
-
var head = /* @__PURE__ */ get(0);
|
|
949
|
-
var headNonEmpty = /* @__PURE__ */ unsafeGet(0);
|
|
950
|
-
var tailNonEmpty = (self) => self.slice(1);
|
|
951
|
-
var reverse = (self) => Array.from(self).reverse();
|
|
952
|
-
var sort = /* @__PURE__ */ dual(2, (self, O) => {
|
|
953
|
-
const out = Array.from(self);
|
|
954
|
-
out.sort(O);
|
|
955
|
-
return out;
|
|
956
|
-
});
|
|
957
|
-
var empty = () => [];
|
|
958
|
-
var map2 = /* @__PURE__ */ dual(2, (self, f) => self.map(f));
|
|
959
|
-
var flatMap2 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
960
|
-
if (isEmptyReadonlyArray(self)) {
|
|
961
|
-
return [];
|
|
962
|
-
}
|
|
963
|
-
const out = [];
|
|
964
|
-
for (let i = 0; i < self.length; i++) {
|
|
965
|
-
const inner = f(self[i], i);
|
|
966
|
-
for (let j = 0; j < inner.length; j++) {
|
|
967
|
-
out.push(inner[j]);
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
return out;
|
|
971
|
-
});
|
|
972
|
-
var flatten = /* @__PURE__ */ flatMap2(identity);
|
|
973
|
-
var filter = /* @__PURE__ */ dual(2, (self, predicate) => {
|
|
974
|
-
const as = fromIterable(self);
|
|
975
|
-
const out = [];
|
|
976
|
-
for (let i = 0; i < as.length; i++) {
|
|
977
|
-
if (predicate(as[i], i)) {
|
|
978
|
-
out.push(as[i]);
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
return out;
|
|
982
|
-
});
|
|
983
|
-
var reduce = /* @__PURE__ */ dual(3, (self, b, f) => fromIterable(self).reduce((b2, a, i) => f(b2, a, i), b));
|
|
984
|
-
var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
|
|
985
|
-
const input = fromIterable(self);
|
|
986
|
-
if (isNonEmptyReadonlyArray(input)) {
|
|
987
|
-
const out = [headNonEmpty(input)];
|
|
988
|
-
const rest = tailNonEmpty(input);
|
|
989
|
-
for (const r of rest) {
|
|
990
|
-
if (out.every((a) => !isEquivalent(r, a))) {
|
|
991
|
-
out.push(r);
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
return out;
|
|
995
|
-
}
|
|
996
|
-
return [];
|
|
997
|
-
});
|
|
998
|
-
|
|
999
|
-
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/Chunk.js
|
|
1000
|
-
var TypeId4 = /* @__PURE__ */ Symbol.for("effect/Chunk");
|
|
1001
|
-
function copy(src, srcPos, dest, destPos, len) {
|
|
1002
|
-
for (let i = srcPos; i < Math.min(src.length, srcPos + len); i++) {
|
|
1003
|
-
dest[destPos + i - srcPos] = src[i];
|
|
1004
|
-
}
|
|
1005
|
-
return dest;
|
|
1006
|
-
}
|
|
1007
|
-
var emptyArray = [];
|
|
1008
|
-
var getEquivalence2 = (isEquivalent) => make((self, that) => self.length === that.length && toReadonlyArray(self).every((value, i) => isEquivalent(value, unsafeGet2(that, i))));
|
|
1009
|
-
var _equivalence = /* @__PURE__ */ getEquivalence2(equals);
|
|
1010
|
-
var ChunkProto = {
|
|
1011
|
-
[TypeId4]: {
|
|
1012
|
-
_A: (_) => _
|
|
1013
|
-
},
|
|
1014
|
-
toString() {
|
|
1015
|
-
return format(this.toJSON());
|
|
1016
|
-
},
|
|
1017
|
-
toJSON() {
|
|
1018
|
-
return {
|
|
1019
|
-
_id: "Chunk",
|
|
1020
|
-
values: toReadonlyArray(this).map(toJSON)
|
|
1021
|
-
};
|
|
1022
|
-
},
|
|
1023
|
-
[NodeInspectSymbol]() {
|
|
1024
|
-
return this.toJSON();
|
|
1025
|
-
},
|
|
1026
|
-
[symbol2](that) {
|
|
1027
|
-
return isChunk(that) && _equivalence(this, that);
|
|
1028
|
-
},
|
|
1029
|
-
[symbol]() {
|
|
1030
|
-
return cached(this, array2(toReadonlyArray(this)));
|
|
1031
|
-
},
|
|
1032
|
-
[Symbol.iterator]() {
|
|
1033
|
-
switch (this.backing._tag) {
|
|
1034
|
-
case "IArray": {
|
|
1035
|
-
return this.backing.array[Symbol.iterator]();
|
|
1036
|
-
}
|
|
1037
|
-
case "IEmpty": {
|
|
1038
|
-
return emptyArray[Symbol.iterator]();
|
|
1039
|
-
}
|
|
1040
|
-
default: {
|
|
1041
|
-
return toReadonlyArray(this)[Symbol.iterator]();
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
},
|
|
1045
|
-
pipe() {
|
|
1046
|
-
return pipeArguments(this, arguments);
|
|
1047
|
-
}
|
|
1048
|
-
};
|
|
1049
|
-
var makeChunk = (backing) => {
|
|
1050
|
-
const chunk = Object.create(ChunkProto);
|
|
1051
|
-
chunk.backing = backing;
|
|
1052
|
-
switch (backing._tag) {
|
|
1053
|
-
case "IEmpty": {
|
|
1054
|
-
chunk.length = 0;
|
|
1055
|
-
chunk.depth = 0;
|
|
1056
|
-
chunk.left = chunk;
|
|
1057
|
-
chunk.right = chunk;
|
|
1058
|
-
break;
|
|
1059
|
-
}
|
|
1060
|
-
case "IConcat": {
|
|
1061
|
-
chunk.length = backing.left.length + backing.right.length;
|
|
1062
|
-
chunk.depth = 1 + Math.max(backing.left.depth, backing.right.depth);
|
|
1063
|
-
chunk.left = backing.left;
|
|
1064
|
-
chunk.right = backing.right;
|
|
1065
|
-
break;
|
|
1066
|
-
}
|
|
1067
|
-
case "IArray": {
|
|
1068
|
-
chunk.length = backing.array.length;
|
|
1069
|
-
chunk.depth = 0;
|
|
1070
|
-
chunk.left = _empty;
|
|
1071
|
-
chunk.right = _empty;
|
|
1072
|
-
break;
|
|
1073
|
-
}
|
|
1074
|
-
case "ISingleton": {
|
|
1075
|
-
chunk.length = 1;
|
|
1076
|
-
chunk.depth = 0;
|
|
1077
|
-
chunk.left = _empty;
|
|
1078
|
-
chunk.right = _empty;
|
|
1079
|
-
break;
|
|
1080
|
-
}
|
|
1081
|
-
case "ISlice": {
|
|
1082
|
-
chunk.length = backing.length;
|
|
1083
|
-
chunk.depth = backing.chunk.depth + 1;
|
|
1084
|
-
chunk.left = _empty;
|
|
1085
|
-
chunk.right = _empty;
|
|
1086
|
-
break;
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
return chunk;
|
|
1090
|
-
};
|
|
1091
|
-
var isChunk = (u) => hasProperty(u, TypeId4);
|
|
1092
|
-
var _empty = /* @__PURE__ */ makeChunk({
|
|
1093
|
-
_tag: "IEmpty"
|
|
1094
|
-
});
|
|
1095
|
-
var empty2 = () => _empty;
|
|
1096
|
-
var make3 = (...as) => as.length === 1 ? of(as[0]) : unsafeFromNonEmptyArray(as);
|
|
1097
|
-
var of = (a) => makeChunk({
|
|
1098
|
-
_tag: "ISingleton",
|
|
1099
|
-
a
|
|
1100
|
-
});
|
|
1101
|
-
var fromIterable2 = (self) => isChunk(self) ? self : makeChunk({
|
|
1102
|
-
_tag: "IArray",
|
|
1103
|
-
array: fromIterable(self)
|
|
1104
|
-
});
|
|
1105
|
-
var copyToArray = (self, array3, initial) => {
|
|
1106
|
-
switch (self.backing._tag) {
|
|
1107
|
-
case "IArray": {
|
|
1108
|
-
copy(self.backing.array, 0, array3, initial, self.length);
|
|
1109
|
-
break;
|
|
1110
|
-
}
|
|
1111
|
-
case "IConcat": {
|
|
1112
|
-
copyToArray(self.left, array3, initial);
|
|
1113
|
-
copyToArray(self.right, array3, initial + self.left.length);
|
|
1114
|
-
break;
|
|
1115
|
-
}
|
|
1116
|
-
case "ISingleton": {
|
|
1117
|
-
array3[initial] = self.backing.a;
|
|
1118
|
-
break;
|
|
1119
|
-
}
|
|
1120
|
-
case "ISlice": {
|
|
1121
|
-
let i = 0;
|
|
1122
|
-
let j = initial;
|
|
1123
|
-
while (i < self.length) {
|
|
1124
|
-
array3[j] = unsafeGet2(self, i);
|
|
1125
|
-
i += 1;
|
|
1126
|
-
j += 1;
|
|
1127
|
-
}
|
|
1128
|
-
break;
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
};
|
|
1132
|
-
var toReadonlyArray_ = (self) => {
|
|
1133
|
-
switch (self.backing._tag) {
|
|
1134
|
-
case "IEmpty": {
|
|
1135
|
-
return emptyArray;
|
|
1136
|
-
}
|
|
1137
|
-
case "IArray": {
|
|
1138
|
-
return self.backing.array;
|
|
1139
|
-
}
|
|
1140
|
-
default: {
|
|
1141
|
-
const arr = new Array(self.length);
|
|
1142
|
-
copyToArray(self, arr, 0);
|
|
1143
|
-
self.backing = {
|
|
1144
|
-
_tag: "IArray",
|
|
1145
|
-
array: arr
|
|
1146
|
-
};
|
|
1147
|
-
self.left = _empty;
|
|
1148
|
-
self.right = _empty;
|
|
1149
|
-
self.depth = 0;
|
|
1150
|
-
return arr;
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
};
|
|
1154
|
-
var toReadonlyArray = toReadonlyArray_;
|
|
1155
|
-
var reverseChunk = (self) => {
|
|
1156
|
-
switch (self.backing._tag) {
|
|
1157
|
-
case "IEmpty":
|
|
1158
|
-
case "ISingleton":
|
|
1159
|
-
return self;
|
|
1160
|
-
case "IArray": {
|
|
1161
|
-
return makeChunk({
|
|
1162
|
-
_tag: "IArray",
|
|
1163
|
-
array: reverse(self.backing.array)
|
|
1164
|
-
});
|
|
1165
|
-
}
|
|
1166
|
-
case "IConcat": {
|
|
1167
|
-
return makeChunk({
|
|
1168
|
-
_tag: "IConcat",
|
|
1169
|
-
left: reverse2(self.backing.right),
|
|
1170
|
-
right: reverse2(self.backing.left)
|
|
1171
|
-
});
|
|
1172
|
-
}
|
|
1173
|
-
case "ISlice":
|
|
1174
|
-
return unsafeFromArray(reverse(toReadonlyArray(self)));
|
|
1175
|
-
}
|
|
1176
|
-
};
|
|
1177
|
-
var reverse2 = reverseChunk;
|
|
1178
|
-
var unsafeFromArray = (self) => makeChunk({
|
|
1179
|
-
_tag: "IArray",
|
|
1180
|
-
array: self
|
|
1181
|
-
});
|
|
1182
|
-
var unsafeFromNonEmptyArray = (self) => unsafeFromArray(self);
|
|
1183
|
-
var unsafeGet2 = /* @__PURE__ */ dual(2, (self, index) => {
|
|
1184
|
-
switch (self.backing._tag) {
|
|
1185
|
-
case "IEmpty": {
|
|
1186
|
-
throw new Error(`Index out of bounds`);
|
|
1187
|
-
}
|
|
1188
|
-
case "ISingleton": {
|
|
1189
|
-
if (index !== 0) {
|
|
1190
|
-
throw new Error(`Index out of bounds`);
|
|
1191
|
-
}
|
|
1192
|
-
return self.backing.a;
|
|
1193
|
-
}
|
|
1194
|
-
case "IArray": {
|
|
1195
|
-
if (index >= self.length || index < 0) {
|
|
1196
|
-
throw new Error(`Index out of bounds`);
|
|
1197
|
-
}
|
|
1198
|
-
return self.backing.array[index];
|
|
1199
|
-
}
|
|
1200
|
-
case "IConcat": {
|
|
1201
|
-
return index < self.left.length ? unsafeGet2(self.left, index) : unsafeGet2(self.right, index - self.left.length);
|
|
1202
|
-
}
|
|
1203
|
-
case "ISlice": {
|
|
1204
|
-
return unsafeGet2(self.backing.chunk, index + self.backing.offset);
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
});
|
|
1208
|
-
var prepend = /* @__PURE__ */ dual(2, (self, elem) => appendAll(of(elem), self));
|
|
1209
|
-
var appendAll = /* @__PURE__ */ dual(2, (self, that) => {
|
|
1210
|
-
if (self.backing._tag === "IEmpty") {
|
|
1211
|
-
return that;
|
|
1212
|
-
}
|
|
1213
|
-
if (that.backing._tag === "IEmpty") {
|
|
1214
|
-
return self;
|
|
1215
|
-
}
|
|
1216
|
-
const diff = that.depth - self.depth;
|
|
1217
|
-
if (Math.abs(diff) <= 1) {
|
|
1218
|
-
return makeChunk({
|
|
1219
|
-
_tag: "IConcat",
|
|
1220
|
-
left: self,
|
|
1221
|
-
right: that
|
|
1222
|
-
});
|
|
1223
|
-
} else if (diff < -1) {
|
|
1224
|
-
if (self.left.depth >= self.right.depth) {
|
|
1225
|
-
const nr = appendAll(self.right, that);
|
|
1226
|
-
return makeChunk({
|
|
1227
|
-
_tag: "IConcat",
|
|
1228
|
-
left: self.left,
|
|
1229
|
-
right: nr
|
|
1230
|
-
});
|
|
1231
|
-
} else {
|
|
1232
|
-
const nrr = appendAll(self.right.right, that);
|
|
1233
|
-
if (nrr.depth === self.depth - 3) {
|
|
1234
|
-
const nr = makeChunk({
|
|
1235
|
-
_tag: "IConcat",
|
|
1236
|
-
left: self.right.left,
|
|
1237
|
-
right: nrr
|
|
1238
|
-
});
|
|
1239
|
-
return makeChunk({
|
|
1240
|
-
_tag: "IConcat",
|
|
1241
|
-
left: self.left,
|
|
1242
|
-
right: nr
|
|
1243
|
-
});
|
|
1244
|
-
} else {
|
|
1245
|
-
const nl = makeChunk({
|
|
1246
|
-
_tag: "IConcat",
|
|
1247
|
-
left: self.left,
|
|
1248
|
-
right: self.right.left
|
|
1249
|
-
});
|
|
1250
|
-
return makeChunk({
|
|
1251
|
-
_tag: "IConcat",
|
|
1252
|
-
left: nl,
|
|
1253
|
-
right: nrr
|
|
1254
|
-
});
|
|
1255
|
-
}
|
|
1256
|
-
}
|
|
1257
|
-
} else {
|
|
1258
|
-
if (that.right.depth >= that.left.depth) {
|
|
1259
|
-
const nl = appendAll(self, that.left);
|
|
1260
|
-
return makeChunk({
|
|
1261
|
-
_tag: "IConcat",
|
|
1262
|
-
left: nl,
|
|
1263
|
-
right: that.right
|
|
1264
|
-
});
|
|
1265
|
-
} else {
|
|
1266
|
-
const nll = appendAll(self, that.left.left);
|
|
1267
|
-
if (nll.depth === that.depth - 3) {
|
|
1268
|
-
const nl = makeChunk({
|
|
1269
|
-
_tag: "IConcat",
|
|
1270
|
-
left: nll,
|
|
1271
|
-
right: that.left.right
|
|
1272
|
-
});
|
|
1273
|
-
return makeChunk({
|
|
1274
|
-
_tag: "IConcat",
|
|
1275
|
-
left: nl,
|
|
1276
|
-
right: that.right
|
|
1277
|
-
});
|
|
1278
|
-
} else {
|
|
1279
|
-
const nr = makeChunk({
|
|
1280
|
-
_tag: "IConcat",
|
|
1281
|
-
left: that.left.right,
|
|
1282
|
-
right: that.right
|
|
1283
|
-
});
|
|
1284
|
-
return makeChunk({
|
|
1285
|
-
_tag: "IConcat",
|
|
1286
|
-
left: nll,
|
|
1287
|
-
right: nr
|
|
1288
|
-
});
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
});
|
|
1293
|
-
var isEmpty = (self) => self.length === 0;
|
|
1294
|
-
var isNonEmpty = (self) => self.length > 0;
|
|
1295
|
-
var unsafeHead = (self) => unsafeGet2(self, 0);
|
|
1296
|
-
var headNonEmpty2 = unsafeHead;
|
|
1297
|
-
|
|
1298
|
-
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/hashMap/config.js
|
|
1299
|
-
var SIZE = 5;
|
|
1300
|
-
var BUCKET_SIZE = /* @__PURE__ */ Math.pow(2, SIZE);
|
|
1301
|
-
var MASK = BUCKET_SIZE - 1;
|
|
1302
|
-
var MAX_INDEX_NODE = BUCKET_SIZE / 2;
|
|
1303
|
-
var MIN_ARRAY_NODE = BUCKET_SIZE / 4;
|
|
1304
|
-
|
|
1305
|
-
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/hashMap/bitwise.js
|
|
1306
|
-
function popcount(x) {
|
|
1307
|
-
x -= x >> 1 & 1431655765;
|
|
1308
|
-
x = (x & 858993459) + (x >> 2 & 858993459);
|
|
1309
|
-
x = x + (x >> 4) & 252645135;
|
|
1310
|
-
x += x >> 8;
|
|
1311
|
-
x += x >> 16;
|
|
1312
|
-
return x & 127;
|
|
1313
|
-
}
|
|
1314
|
-
function hashFragment(shift, h) {
|
|
1315
|
-
return h >>> shift & MASK;
|
|
1316
|
-
}
|
|
1317
|
-
function toBitmap(x) {
|
|
1318
|
-
return 1 << x;
|
|
1319
|
-
}
|
|
1320
|
-
function fromBitmap(bitmap, bit) {
|
|
1321
|
-
return popcount(bitmap & bit - 1);
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
|
-
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/stack.js
|
|
1325
|
-
var make4 = (value, previous) => ({
|
|
1326
|
-
value,
|
|
1327
|
-
previous
|
|
1328
|
-
});
|
|
1329
|
-
|
|
1330
|
-
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/hashMap/array.js
|
|
1331
|
-
function arrayUpdate(mutate2, at, v, arr) {
|
|
1332
|
-
let out = arr;
|
|
1333
|
-
if (!mutate2) {
|
|
1334
|
-
const len = arr.length;
|
|
1335
|
-
out = new Array(len);
|
|
1336
|
-
for (let i = 0; i < len; ++i) out[i] = arr[i];
|
|
1337
|
-
}
|
|
1338
|
-
out[at] = v;
|
|
1339
|
-
return out;
|
|
1340
|
-
}
|
|
1341
|
-
function arraySpliceOut(mutate2, at, arr) {
|
|
1342
|
-
const newLen = arr.length - 1;
|
|
1343
|
-
let i = 0;
|
|
1344
|
-
let g = 0;
|
|
1345
|
-
let out = arr;
|
|
1346
|
-
if (mutate2) {
|
|
1347
|
-
i = g = at;
|
|
1348
|
-
} else {
|
|
1349
|
-
out = new Array(newLen);
|
|
1350
|
-
while (i < at) out[g++] = arr[i++];
|
|
1351
|
-
}
|
|
1352
|
-
;
|
|
1353
|
-
++i;
|
|
1354
|
-
while (i <= newLen) out[g++] = arr[i++];
|
|
1355
|
-
if (mutate2) {
|
|
1356
|
-
out.length = newLen;
|
|
1357
|
-
}
|
|
1358
|
-
return out;
|
|
1359
|
-
}
|
|
1360
|
-
function arraySpliceIn(mutate2, at, v, arr) {
|
|
1361
|
-
const len = arr.length;
|
|
1362
|
-
if (mutate2) {
|
|
1363
|
-
let i2 = len;
|
|
1364
|
-
while (i2 >= at) arr[i2--] = arr[i2];
|
|
1365
|
-
arr[at] = v;
|
|
1366
|
-
return arr;
|
|
1367
|
-
}
|
|
1368
|
-
let i = 0, g = 0;
|
|
1369
|
-
const out = new Array(len + 1);
|
|
1370
|
-
while (i < at) out[g++] = arr[i++];
|
|
1371
|
-
out[at] = v;
|
|
1372
|
-
while (i < len) out[++g] = arr[i++];
|
|
1373
|
-
return out;
|
|
1374
|
-
}
|
|
1375
|
-
|
|
1376
|
-
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/hashMap/node.js
|
|
1377
|
-
var EmptyNode = class _EmptyNode {
|
|
1378
|
-
_tag = "EmptyNode";
|
|
1379
|
-
modify(edit, _shift, f, hash2, key, size4) {
|
|
1380
|
-
const v = f(none2());
|
|
1381
|
-
if (isNone2(v)) return new _EmptyNode();
|
|
1382
|
-
++size4.value;
|
|
1383
|
-
return new LeafNode(edit, hash2, key, v);
|
|
1384
|
-
}
|
|
1385
|
-
};
|
|
1386
|
-
function isEmptyNode(a) {
|
|
1387
|
-
return isTagged(a, "EmptyNode");
|
|
1388
|
-
}
|
|
1389
|
-
function isLeafNode(node) {
|
|
1390
|
-
return isEmptyNode(node) || node._tag === "LeafNode" || node._tag === "CollisionNode";
|
|
1391
|
-
}
|
|
1392
|
-
function canEditNode(node, edit) {
|
|
1393
|
-
return isEmptyNode(node) ? false : edit === node.edit;
|
|
1394
|
-
}
|
|
1395
|
-
var LeafNode = class _LeafNode {
|
|
1396
|
-
edit;
|
|
1397
|
-
hash;
|
|
1398
|
-
key;
|
|
1399
|
-
value;
|
|
1400
|
-
_tag = "LeafNode";
|
|
1401
|
-
constructor(edit, hash2, key, value) {
|
|
1402
|
-
this.edit = edit;
|
|
1403
|
-
this.hash = hash2;
|
|
1404
|
-
this.key = key;
|
|
1405
|
-
this.value = value;
|
|
1406
|
-
}
|
|
1407
|
-
modify(edit, shift, f, hash2, key, size4) {
|
|
1408
|
-
if (equals(key, this.key)) {
|
|
1409
|
-
const v2 = f(this.value);
|
|
1410
|
-
if (v2 === this.value) return this;
|
|
1411
|
-
else if (isNone2(v2)) {
|
|
1412
|
-
;
|
|
1413
|
-
--size4.value;
|
|
1414
|
-
return new EmptyNode();
|
|
1415
|
-
}
|
|
1416
|
-
if (canEditNode(this, edit)) {
|
|
1417
|
-
this.value = v2;
|
|
1418
|
-
return this;
|
|
1419
|
-
}
|
|
1420
|
-
return new _LeafNode(edit, hash2, key, v2);
|
|
1421
|
-
}
|
|
1422
|
-
const v = f(none2());
|
|
1423
|
-
if (isNone2(v)) return this;
|
|
1424
|
-
++size4.value;
|
|
1425
|
-
return mergeLeaves(edit, shift, this.hash, this, hash2, new _LeafNode(edit, hash2, key, v));
|
|
1426
|
-
}
|
|
1427
|
-
};
|
|
1428
|
-
var CollisionNode = class _CollisionNode {
|
|
1429
|
-
edit;
|
|
1430
|
-
hash;
|
|
1431
|
-
children;
|
|
1432
|
-
_tag = "CollisionNode";
|
|
1433
|
-
constructor(edit, hash2, children) {
|
|
1434
|
-
this.edit = edit;
|
|
1435
|
-
this.hash = hash2;
|
|
1436
|
-
this.children = children;
|
|
1437
|
-
}
|
|
1438
|
-
modify(edit, shift, f, hash2, key, size4) {
|
|
1439
|
-
if (hash2 === this.hash) {
|
|
1440
|
-
const canEdit = canEditNode(this, edit);
|
|
1441
|
-
const list = this.updateCollisionList(canEdit, edit, this.hash, this.children, f, key, size4);
|
|
1442
|
-
if (list === this.children) return this;
|
|
1443
|
-
return list.length > 1 ? new _CollisionNode(edit, this.hash, list) : list[0];
|
|
1444
|
-
}
|
|
1445
|
-
const v = f(none2());
|
|
1446
|
-
if (isNone2(v)) return this;
|
|
1447
|
-
++size4.value;
|
|
1448
|
-
return mergeLeaves(edit, shift, this.hash, this, hash2, new LeafNode(edit, hash2, key, v));
|
|
1449
|
-
}
|
|
1450
|
-
updateCollisionList(mutate2, edit, hash2, list, f, key, size4) {
|
|
1451
|
-
const len = list.length;
|
|
1452
|
-
for (let i = 0; i < len; ++i) {
|
|
1453
|
-
const child = list[i];
|
|
1454
|
-
if ("key" in child && equals(key, child.key)) {
|
|
1455
|
-
const value = child.value;
|
|
1456
|
-
const newValue2 = f(value);
|
|
1457
|
-
if (newValue2 === value) return list;
|
|
1458
|
-
if (isNone2(newValue2)) {
|
|
1459
|
-
;
|
|
1460
|
-
--size4.value;
|
|
1461
|
-
return arraySpliceOut(mutate2, i, list);
|
|
1462
|
-
}
|
|
1463
|
-
return arrayUpdate(mutate2, i, new LeafNode(edit, hash2, key, newValue2), list);
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1466
|
-
const newValue = f(none2());
|
|
1467
|
-
if (isNone2(newValue)) return list;
|
|
1468
|
-
++size4.value;
|
|
1469
|
-
return arrayUpdate(mutate2, len, new LeafNode(edit, hash2, key, newValue), list);
|
|
1470
|
-
}
|
|
1471
|
-
};
|
|
1472
|
-
var IndexedNode = class _IndexedNode {
|
|
1473
|
-
edit;
|
|
1474
|
-
mask;
|
|
1475
|
-
children;
|
|
1476
|
-
_tag = "IndexedNode";
|
|
1477
|
-
constructor(edit, mask, children) {
|
|
1478
|
-
this.edit = edit;
|
|
1479
|
-
this.mask = mask;
|
|
1480
|
-
this.children = children;
|
|
1481
|
-
}
|
|
1482
|
-
modify(edit, shift, f, hash2, key, size4) {
|
|
1483
|
-
const mask = this.mask;
|
|
1484
|
-
const children = this.children;
|
|
1485
|
-
const frag = hashFragment(shift, hash2);
|
|
1486
|
-
const bit = toBitmap(frag);
|
|
1487
|
-
const indx = fromBitmap(mask, bit);
|
|
1488
|
-
const exists = mask & bit;
|
|
1489
|
-
const canEdit = canEditNode(this, edit);
|
|
1490
|
-
if (!exists) {
|
|
1491
|
-
const _newChild = new EmptyNode().modify(edit, shift + SIZE, f, hash2, key, size4);
|
|
1492
|
-
if (!_newChild) return this;
|
|
1493
|
-
return children.length >= MAX_INDEX_NODE ? expand(edit, frag, _newChild, mask, children) : new _IndexedNode(edit, mask | bit, arraySpliceIn(canEdit, indx, _newChild, children));
|
|
1494
|
-
}
|
|
1495
|
-
const current = children[indx];
|
|
1496
|
-
const child = current.modify(edit, shift + SIZE, f, hash2, key, size4);
|
|
1497
|
-
if (current === child) return this;
|
|
1498
|
-
let bitmap = mask;
|
|
1499
|
-
let newChildren;
|
|
1500
|
-
if (isEmptyNode(child)) {
|
|
1501
|
-
bitmap &= ~bit;
|
|
1502
|
-
if (!bitmap) return new EmptyNode();
|
|
1503
|
-
if (children.length <= 2 && isLeafNode(children[indx ^ 1])) {
|
|
1504
|
-
return children[indx ^ 1];
|
|
1505
|
-
}
|
|
1506
|
-
newChildren = arraySpliceOut(canEdit, indx, children);
|
|
1507
|
-
} else {
|
|
1508
|
-
newChildren = arrayUpdate(canEdit, indx, child, children);
|
|
1509
|
-
}
|
|
1510
|
-
if (canEdit) {
|
|
1511
|
-
this.mask = bitmap;
|
|
1512
|
-
this.children = newChildren;
|
|
1513
|
-
return this;
|
|
1514
|
-
}
|
|
1515
|
-
return new _IndexedNode(edit, bitmap, newChildren);
|
|
1516
|
-
}
|
|
1517
|
-
};
|
|
1518
|
-
var ArrayNode = class _ArrayNode {
|
|
1519
|
-
edit;
|
|
1520
|
-
size;
|
|
1521
|
-
children;
|
|
1522
|
-
_tag = "ArrayNode";
|
|
1523
|
-
constructor(edit, size4, children) {
|
|
1524
|
-
this.edit = edit;
|
|
1525
|
-
this.size = size4;
|
|
1526
|
-
this.children = children;
|
|
1527
|
-
}
|
|
1528
|
-
modify(edit, shift, f, hash2, key, size4) {
|
|
1529
|
-
let count = this.size;
|
|
1530
|
-
const children = this.children;
|
|
1531
|
-
const frag = hashFragment(shift, hash2);
|
|
1532
|
-
const child = children[frag];
|
|
1533
|
-
const newChild = (child || new EmptyNode()).modify(edit, shift + SIZE, f, hash2, key, size4);
|
|
1534
|
-
if (child === newChild) return this;
|
|
1535
|
-
const canEdit = canEditNode(this, edit);
|
|
1536
|
-
let newChildren;
|
|
1537
|
-
if (isEmptyNode(child) && !isEmptyNode(newChild)) {
|
|
1538
|
-
;
|
|
1539
|
-
++count;
|
|
1540
|
-
newChildren = arrayUpdate(canEdit, frag, newChild, children);
|
|
1541
|
-
} else if (!isEmptyNode(child) && isEmptyNode(newChild)) {
|
|
1542
|
-
;
|
|
1543
|
-
--count;
|
|
1544
|
-
if (count <= MIN_ARRAY_NODE) {
|
|
1545
|
-
return pack(edit, count, frag, children);
|
|
1546
|
-
}
|
|
1547
|
-
newChildren = arrayUpdate(canEdit, frag, new EmptyNode(), children);
|
|
1548
|
-
} else {
|
|
1549
|
-
newChildren = arrayUpdate(canEdit, frag, newChild, children);
|
|
1550
|
-
}
|
|
1551
|
-
if (canEdit) {
|
|
1552
|
-
this.size = count;
|
|
1553
|
-
this.children = newChildren;
|
|
1554
|
-
return this;
|
|
1555
|
-
}
|
|
1556
|
-
return new _ArrayNode(edit, count, newChildren);
|
|
1557
|
-
}
|
|
1558
|
-
};
|
|
1559
|
-
function pack(edit, count, removed, elements) {
|
|
1560
|
-
const children = new Array(count - 1);
|
|
1561
|
-
let g = 0;
|
|
1562
|
-
let bitmap = 0;
|
|
1563
|
-
for (let i = 0, len = elements.length; i < len; ++i) {
|
|
1564
|
-
if (i !== removed) {
|
|
1565
|
-
const elem = elements[i];
|
|
1566
|
-
if (elem && !isEmptyNode(elem)) {
|
|
1567
|
-
children[g++] = elem;
|
|
1568
|
-
bitmap |= 1 << i;
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
}
|
|
1572
|
-
return new IndexedNode(edit, bitmap, children);
|
|
1573
|
-
}
|
|
1574
|
-
function expand(edit, frag, child, bitmap, subNodes) {
|
|
1575
|
-
const arr = [];
|
|
1576
|
-
let bit = bitmap;
|
|
1577
|
-
let count = 0;
|
|
1578
|
-
for (let i = 0; bit; ++i) {
|
|
1579
|
-
if (bit & 1) arr[i] = subNodes[count++];
|
|
1580
|
-
bit >>>= 1;
|
|
1581
|
-
}
|
|
1582
|
-
arr[frag] = child;
|
|
1583
|
-
return new ArrayNode(edit, count + 1, arr);
|
|
1584
|
-
}
|
|
1585
|
-
function mergeLeavesInner(edit, shift, h1, n1, h2, n2) {
|
|
1586
|
-
if (h1 === h2) return new CollisionNode(edit, h1, [n2, n1]);
|
|
1587
|
-
const subH1 = hashFragment(shift, h1);
|
|
1588
|
-
const subH2 = hashFragment(shift, h2);
|
|
1589
|
-
if (subH1 === subH2) {
|
|
1590
|
-
return (child) => new IndexedNode(edit, toBitmap(subH1) | toBitmap(subH2), [child]);
|
|
1591
|
-
} else {
|
|
1592
|
-
const children = subH1 < subH2 ? [n1, n2] : [n2, n1];
|
|
1593
|
-
return new IndexedNode(edit, toBitmap(subH1) | toBitmap(subH2), children);
|
|
1594
|
-
}
|
|
1595
|
-
}
|
|
1596
|
-
function mergeLeaves(edit, shift, h1, n1, h2, n2) {
|
|
1597
|
-
let stack = void 0;
|
|
1598
|
-
let currentShift = shift;
|
|
1599
|
-
while (true) {
|
|
1600
|
-
const res = mergeLeavesInner(edit, currentShift, h1, n1, h2, n2);
|
|
1601
|
-
if (typeof res === "function") {
|
|
1602
|
-
stack = make4(res, stack);
|
|
1603
|
-
currentShift = currentShift + SIZE;
|
|
1604
|
-
} else {
|
|
1605
|
-
let final = res;
|
|
1606
|
-
while (stack != null) {
|
|
1607
|
-
final = stack.value(final);
|
|
1608
|
-
stack = stack.previous;
|
|
1609
|
-
}
|
|
1610
|
-
return final;
|
|
1611
|
-
}
|
|
1612
|
-
}
|
|
1613
|
-
}
|
|
1614
|
-
|
|
1615
|
-
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/hashMap.js
|
|
1616
|
-
var HashMapSymbolKey = "effect/HashMap";
|
|
1617
|
-
var HashMapTypeId = /* @__PURE__ */ Symbol.for(HashMapSymbolKey);
|
|
1618
|
-
var HashMapProto = {
|
|
1619
|
-
[HashMapTypeId]: HashMapTypeId,
|
|
1620
|
-
[Symbol.iterator]() {
|
|
1621
|
-
return new HashMapIterator(this, (k, v) => [k, v]);
|
|
1622
|
-
},
|
|
1623
|
-
[symbol]() {
|
|
1624
|
-
let hash2 = hash(HashMapSymbolKey);
|
|
1625
|
-
for (const item of this) {
|
|
1626
|
-
hash2 ^= pipe(hash(item[0]), combine(hash(item[1])));
|
|
1627
|
-
}
|
|
1628
|
-
return cached(this, hash2);
|
|
1629
|
-
},
|
|
1630
|
-
[symbol2](that) {
|
|
1631
|
-
if (isHashMap(that)) {
|
|
1632
|
-
if (that._size !== this._size) {
|
|
1633
|
-
return false;
|
|
1634
|
-
}
|
|
1635
|
-
for (const item of this) {
|
|
1636
|
-
const elem = pipe(that, getHash(item[0], hash(item[0])));
|
|
1637
|
-
if (isNone2(elem)) {
|
|
1638
|
-
return false;
|
|
1639
|
-
} else {
|
|
1640
|
-
if (!equals(item[1], elem.value)) {
|
|
1641
|
-
return false;
|
|
1642
|
-
}
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1645
|
-
return true;
|
|
1646
|
-
}
|
|
1647
|
-
return false;
|
|
1648
|
-
},
|
|
1649
|
-
toString() {
|
|
1650
|
-
return format(this.toJSON());
|
|
1651
|
-
},
|
|
1652
|
-
toJSON() {
|
|
1653
|
-
return {
|
|
1654
|
-
_id: "HashMap",
|
|
1655
|
-
values: Array.from(this).map(toJSON)
|
|
1656
|
-
};
|
|
1657
|
-
},
|
|
1658
|
-
[NodeInspectSymbol]() {
|
|
1659
|
-
return this.toJSON();
|
|
1660
|
-
},
|
|
1661
|
-
pipe() {
|
|
1662
|
-
return pipeArguments(this, arguments);
|
|
1663
|
-
}
|
|
1664
|
-
};
|
|
1665
|
-
var makeImpl = (editable, edit, root, size4) => {
|
|
1666
|
-
const map8 = Object.create(HashMapProto);
|
|
1667
|
-
map8._editable = editable;
|
|
1668
|
-
map8._edit = edit;
|
|
1669
|
-
map8._root = root;
|
|
1670
|
-
map8._size = size4;
|
|
1671
|
-
return map8;
|
|
1672
|
-
};
|
|
1673
|
-
var HashMapIterator = class _HashMapIterator {
|
|
1674
|
-
map;
|
|
1675
|
-
f;
|
|
1676
|
-
v;
|
|
1677
|
-
constructor(map8, f) {
|
|
1678
|
-
this.map = map8;
|
|
1679
|
-
this.f = f;
|
|
1680
|
-
this.v = visitLazy(this.map._root, this.f, void 0);
|
|
1681
|
-
}
|
|
1682
|
-
next() {
|
|
1683
|
-
if (isNone2(this.v)) {
|
|
1684
|
-
return {
|
|
1685
|
-
done: true,
|
|
1686
|
-
value: void 0
|
|
1687
|
-
};
|
|
1688
|
-
}
|
|
1689
|
-
const v0 = this.v.value;
|
|
1690
|
-
this.v = applyCont(v0.cont);
|
|
1691
|
-
return {
|
|
1692
|
-
done: false,
|
|
1693
|
-
value: v0.value
|
|
1694
|
-
};
|
|
1695
|
-
}
|
|
1696
|
-
[Symbol.iterator]() {
|
|
1697
|
-
return new _HashMapIterator(this.map, this.f);
|
|
1698
|
-
}
|
|
1699
|
-
};
|
|
1700
|
-
var applyCont = (cont) => cont ? visitLazyChildren(cont[0], cont[1], cont[2], cont[3], cont[4]) : none2();
|
|
1701
|
-
var visitLazy = (node, f, cont = void 0) => {
|
|
1702
|
-
switch (node._tag) {
|
|
1703
|
-
case "LeafNode": {
|
|
1704
|
-
if (isSome2(node.value)) {
|
|
1705
|
-
return some2({
|
|
1706
|
-
value: f(node.key, node.value.value),
|
|
1707
|
-
cont
|
|
1708
|
-
});
|
|
1709
|
-
}
|
|
1710
|
-
return applyCont(cont);
|
|
1711
|
-
}
|
|
1712
|
-
case "CollisionNode":
|
|
1713
|
-
case "ArrayNode":
|
|
1714
|
-
case "IndexedNode": {
|
|
1715
|
-
const children = node.children;
|
|
1716
|
-
return visitLazyChildren(children.length, children, 0, f, cont);
|
|
1717
|
-
}
|
|
1718
|
-
default: {
|
|
1719
|
-
return applyCont(cont);
|
|
1720
|
-
}
|
|
1721
|
-
}
|
|
1722
|
-
};
|
|
1723
|
-
var visitLazyChildren = (len, children, i, f, cont) => {
|
|
1724
|
-
while (i < len) {
|
|
1725
|
-
const child = children[i++];
|
|
1726
|
-
if (child && !isEmptyNode(child)) {
|
|
1727
|
-
return visitLazy(child, f, [len, children, i, f, cont]);
|
|
1728
|
-
}
|
|
1729
|
-
}
|
|
1730
|
-
return applyCont(cont);
|
|
1731
|
-
};
|
|
1732
|
-
var _empty2 = /* @__PURE__ */ makeImpl(false, 0, /* @__PURE__ */ new EmptyNode(), 0);
|
|
1733
|
-
var empty3 = () => _empty2;
|
|
1734
|
-
var isHashMap = (u) => hasProperty(u, HashMapTypeId);
|
|
1735
|
-
var getHash = /* @__PURE__ */ dual(3, (self, key, hash2) => {
|
|
1736
|
-
let node = self._root;
|
|
1737
|
-
let shift = 0;
|
|
1738
|
-
while (true) {
|
|
1739
|
-
switch (node._tag) {
|
|
1740
|
-
case "LeafNode": {
|
|
1741
|
-
return equals(key, node.key) ? node.value : none2();
|
|
1742
|
-
}
|
|
1743
|
-
case "CollisionNode": {
|
|
1744
|
-
if (hash2 === node.hash) {
|
|
1745
|
-
const children = node.children;
|
|
1746
|
-
for (let i = 0, len = children.length; i < len; ++i) {
|
|
1747
|
-
const child = children[i];
|
|
1748
|
-
if ("key" in child && equals(key, child.key)) {
|
|
1749
|
-
return child.value;
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
}
|
|
1753
|
-
return none2();
|
|
1754
|
-
}
|
|
1755
|
-
case "IndexedNode": {
|
|
1756
|
-
const frag = hashFragment(shift, hash2);
|
|
1757
|
-
const bit = toBitmap(frag);
|
|
1758
|
-
if (node.mask & bit) {
|
|
1759
|
-
node = node.children[fromBitmap(node.mask, bit)];
|
|
1760
|
-
shift += SIZE;
|
|
1761
|
-
break;
|
|
1762
|
-
}
|
|
1763
|
-
return none2();
|
|
1764
|
-
}
|
|
1765
|
-
case "ArrayNode": {
|
|
1766
|
-
node = node.children[hashFragment(shift, hash2)];
|
|
1767
|
-
if (node) {
|
|
1768
|
-
shift += SIZE;
|
|
1769
|
-
break;
|
|
1770
|
-
}
|
|
1771
|
-
return none2();
|
|
1772
|
-
}
|
|
1773
|
-
default:
|
|
1774
|
-
return none2();
|
|
1775
|
-
}
|
|
1776
|
-
}
|
|
1777
|
-
});
|
|
1778
|
-
var set = /* @__PURE__ */ dual(3, (self, key, value) => modifyAt(self, key, () => some2(value)));
|
|
1779
|
-
var setTree = /* @__PURE__ */ dual(3, (self, newRoot, newSize) => {
|
|
1780
|
-
if (self._editable) {
|
|
1781
|
-
;
|
|
1782
|
-
self._root = newRoot;
|
|
1783
|
-
self._size = newSize;
|
|
1784
|
-
return self;
|
|
1785
|
-
}
|
|
1786
|
-
return newRoot === self._root ? self : makeImpl(self._editable, self._edit, newRoot, newSize);
|
|
1787
|
-
});
|
|
1788
|
-
var keys = (self) => new HashMapIterator(self, (key) => key);
|
|
1789
|
-
var size = (self) => self._size;
|
|
1790
|
-
var beginMutation = (self) => makeImpl(true, self._edit + 1, self._root, self._size);
|
|
1791
|
-
var modifyAt = /* @__PURE__ */ dual(3, (self, key, f) => modifyHash(self, key, hash(key), f));
|
|
1792
|
-
var modifyHash = /* @__PURE__ */ dual(4, (self, key, hash2, f) => {
|
|
1793
|
-
const size4 = {
|
|
1794
|
-
value: self._size
|
|
1795
|
-
};
|
|
1796
|
-
const newRoot = self._root.modify(self._editable ? self._edit : NaN, 0, f, hash2, key, size4);
|
|
1797
|
-
return pipe(self, setTree(newRoot, size4.value));
|
|
1798
|
-
});
|
|
1799
|
-
var forEach = /* @__PURE__ */ dual(2, (self, f) => reduce2(self, void 0, (_, value, key) => f(value, key)));
|
|
1800
|
-
var reduce2 = /* @__PURE__ */ dual(3, (self, zero, f) => {
|
|
1801
|
-
const root = self._root;
|
|
1802
|
-
if (root._tag === "LeafNode") {
|
|
1803
|
-
return isSome2(root.value) ? f(zero, root.value.value, root.key) : zero;
|
|
1804
|
-
}
|
|
1805
|
-
if (root._tag === "EmptyNode") {
|
|
1806
|
-
return zero;
|
|
1807
|
-
}
|
|
1808
|
-
const toVisit = [root.children];
|
|
1809
|
-
let children;
|
|
1810
|
-
while (children = toVisit.pop()) {
|
|
1811
|
-
for (let i = 0, len = children.length; i < len; ) {
|
|
1812
|
-
const child = children[i++];
|
|
1813
|
-
if (child && !isEmptyNode(child)) {
|
|
1814
|
-
if (child._tag === "LeafNode") {
|
|
1815
|
-
if (isSome2(child.value)) {
|
|
1816
|
-
zero = f(zero, child.value.value, child.key);
|
|
1817
|
-
}
|
|
1818
|
-
} else {
|
|
1819
|
-
toVisit.push(child.children);
|
|
1820
|
-
}
|
|
1821
|
-
}
|
|
1822
|
-
}
|
|
1823
|
-
}
|
|
1824
|
-
return zero;
|
|
1825
|
-
});
|
|
1826
|
-
|
|
1827
|
-
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/hashSet.js
|
|
1828
|
-
var HashSetSymbolKey = "effect/HashSet";
|
|
1829
|
-
var HashSetTypeId = /* @__PURE__ */ Symbol.for(HashSetSymbolKey);
|
|
1830
|
-
var HashSetProto = {
|
|
1831
|
-
[HashSetTypeId]: HashSetTypeId,
|
|
1832
|
-
[Symbol.iterator]() {
|
|
1833
|
-
return keys(this._keyMap);
|
|
1834
|
-
},
|
|
1835
|
-
[symbol]() {
|
|
1836
|
-
return cached(this, combine(hash(this._keyMap))(hash(HashSetSymbolKey)));
|
|
1837
|
-
},
|
|
1838
|
-
[symbol2](that) {
|
|
1839
|
-
if (isHashSet(that)) {
|
|
1840
|
-
return size(this._keyMap) === size(that._keyMap) && equals(this._keyMap, that._keyMap);
|
|
1841
|
-
}
|
|
1842
|
-
return false;
|
|
1843
|
-
},
|
|
1844
|
-
toString() {
|
|
1845
|
-
return format(this.toJSON());
|
|
1846
|
-
},
|
|
1847
|
-
toJSON() {
|
|
1848
|
-
return {
|
|
1849
|
-
_id: "HashSet",
|
|
1850
|
-
values: Array.from(this).map(toJSON)
|
|
1851
|
-
};
|
|
1852
|
-
},
|
|
1853
|
-
[NodeInspectSymbol]() {
|
|
1854
|
-
return this.toJSON();
|
|
1855
|
-
},
|
|
1856
|
-
pipe() {
|
|
1857
|
-
return pipeArguments(this, arguments);
|
|
1858
|
-
}
|
|
1859
|
-
};
|
|
1860
|
-
var makeImpl2 = (keyMap) => {
|
|
1861
|
-
const set2 = Object.create(HashSetProto);
|
|
1862
|
-
set2._keyMap = keyMap;
|
|
1863
|
-
return set2;
|
|
1864
|
-
};
|
|
1865
|
-
var isHashSet = (u) => hasProperty(u, HashSetTypeId);
|
|
1866
|
-
var _empty3 = /* @__PURE__ */ makeImpl2(/* @__PURE__ */ empty3());
|
|
1867
|
-
var empty4 = () => _empty3;
|
|
1868
|
-
var size2 = (self) => size(self._keyMap);
|
|
1869
|
-
var beginMutation2 = (self) => makeImpl2(beginMutation(self._keyMap));
|
|
1870
|
-
var endMutation = (self) => {
|
|
1871
|
-
;
|
|
1872
|
-
self._keyMap._editable = false;
|
|
1873
|
-
return self;
|
|
1874
|
-
};
|
|
1875
|
-
var mutate = /* @__PURE__ */ dual(2, (self, f) => {
|
|
1876
|
-
const transient = beginMutation2(self);
|
|
1877
|
-
f(transient);
|
|
1878
|
-
return endMutation(transient);
|
|
1879
|
-
});
|
|
1880
|
-
var add = /* @__PURE__ */ dual(2, (self, value) => self._keyMap._editable ? (set(value, true)(self._keyMap), self) : makeImpl2(set(value, true)(self._keyMap)));
|
|
1881
|
-
var union2 = /* @__PURE__ */ dual(2, (self, that) => mutate(empty4(), (set2) => {
|
|
1882
|
-
forEach2(self, (value) => add(set2, value));
|
|
1883
|
-
for (const value of that) {
|
|
1884
|
-
add(set2, value);
|
|
1885
|
-
}
|
|
1886
|
-
}));
|
|
1887
|
-
var forEach2 = /* @__PURE__ */ dual(2, (self, f) => forEach(self._keyMap, (_, k) => f(k)));
|
|
1888
|
-
|
|
1889
|
-
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/HashSet.js
|
|
1890
|
-
var empty5 = empty4;
|
|
1891
|
-
var size3 = size2;
|
|
1892
|
-
var add2 = add;
|
|
1893
|
-
var union3 = union2;
|
|
1894
|
-
|
|
1895
|
-
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/opCodes/cause.js
|
|
1896
|
-
var OP_DIE = "Die";
|
|
1897
|
-
var OP_EMPTY = "Empty";
|
|
1898
|
-
var OP_FAIL = "Fail";
|
|
1899
|
-
var OP_INTERRUPT = "Interrupt";
|
|
1900
|
-
var OP_PARALLEL = "Parallel";
|
|
1901
|
-
var OP_SEQUENTIAL = "Sequential";
|
|
1902
|
-
|
|
1903
|
-
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/cause.js
|
|
1904
|
-
var CauseSymbolKey = "effect/Cause";
|
|
1905
|
-
var CauseTypeId = /* @__PURE__ */ Symbol.for(CauseSymbolKey);
|
|
1906
|
-
var variance = {
|
|
1907
|
-
/* c8 ignore next */
|
|
1908
|
-
_E: (_) => _
|
|
1909
|
-
};
|
|
1910
|
-
var proto = {
|
|
1911
|
-
[CauseTypeId]: variance,
|
|
1912
|
-
[symbol]() {
|
|
1913
|
-
return pipe(hash(CauseSymbolKey), combine(hash(flattenCause(this))), cached(this));
|
|
1914
|
-
},
|
|
1915
|
-
[symbol2](that) {
|
|
1916
|
-
return isCause(that) && causeEquals(this, that);
|
|
1917
|
-
},
|
|
1918
|
-
pipe() {
|
|
1919
|
-
return pipeArguments(this, arguments);
|
|
1920
|
-
},
|
|
1921
|
-
toJSON() {
|
|
1922
|
-
switch (this._tag) {
|
|
1923
|
-
case "Empty":
|
|
1924
|
-
return {
|
|
1925
|
-
_id: "Cause",
|
|
1926
|
-
_tag: this._tag
|
|
1927
|
-
};
|
|
1928
|
-
case "Die":
|
|
1929
|
-
return {
|
|
1930
|
-
_id: "Cause",
|
|
1931
|
-
_tag: this._tag,
|
|
1932
|
-
defect: toJSON(this.defect)
|
|
1933
|
-
};
|
|
1934
|
-
case "Interrupt":
|
|
1935
|
-
return {
|
|
1936
|
-
_id: "Cause",
|
|
1937
|
-
_tag: this._tag,
|
|
1938
|
-
fiberId: this.fiberId.toJSON()
|
|
1939
|
-
};
|
|
1940
|
-
case "Fail":
|
|
1941
|
-
return {
|
|
1942
|
-
_id: "Cause",
|
|
1943
|
-
_tag: this._tag,
|
|
1944
|
-
failure: toJSON(this.error)
|
|
1945
|
-
};
|
|
1946
|
-
case "Sequential":
|
|
1947
|
-
case "Parallel":
|
|
1948
|
-
return {
|
|
1949
|
-
_id: "Cause",
|
|
1950
|
-
_tag: this._tag,
|
|
1951
|
-
left: toJSON(this.left),
|
|
1952
|
-
right: toJSON(this.right)
|
|
1953
|
-
};
|
|
1954
|
-
}
|
|
1955
|
-
},
|
|
1956
|
-
toString() {
|
|
1957
|
-
return pretty(this);
|
|
1958
|
-
},
|
|
1959
|
-
[NodeInspectSymbol]() {
|
|
1960
|
-
return this.toJSON();
|
|
1961
|
-
}
|
|
1962
|
-
};
|
|
1963
|
-
var fail = (error) => {
|
|
1964
|
-
const o = Object.create(proto);
|
|
1965
|
-
o._tag = OP_FAIL;
|
|
1966
|
-
o.error = error;
|
|
1967
|
-
return o;
|
|
1968
|
-
};
|
|
1969
|
-
var parallel = (left3, right3) => {
|
|
1970
|
-
const o = Object.create(proto);
|
|
1971
|
-
o._tag = OP_PARALLEL;
|
|
1972
|
-
o.left = left3;
|
|
1973
|
-
o.right = right3;
|
|
1974
|
-
return o;
|
|
1975
|
-
};
|
|
1976
|
-
var sequential = (left3, right3) => {
|
|
1977
|
-
const o = Object.create(proto);
|
|
1978
|
-
o._tag = OP_SEQUENTIAL;
|
|
1979
|
-
o.left = left3;
|
|
1980
|
-
o.right = right3;
|
|
1981
|
-
return o;
|
|
1982
|
-
};
|
|
1983
|
-
var isCause = (u) => hasProperty(u, CauseTypeId);
|
|
1984
|
-
var isInterruptedOnly = (self) => reduceWithContext(void 0, IsInterruptedOnlyCauseReducer)(self);
|
|
1985
|
-
var causeEquals = (left3, right3) => {
|
|
1986
|
-
let leftStack = of(left3);
|
|
1987
|
-
let rightStack = of(right3);
|
|
1988
|
-
while (isNonEmpty(leftStack) && isNonEmpty(rightStack)) {
|
|
1989
|
-
const [leftParallel, leftSequential] = pipe(headNonEmpty2(leftStack), reduce4([empty5(), empty2()], ([parallel2, sequential2], cause) => {
|
|
1990
|
-
const [par, seq] = evaluateCause(cause);
|
|
1991
|
-
return some2([pipe(parallel2, union3(par)), pipe(sequential2, appendAll(seq))]);
|
|
1992
|
-
}));
|
|
1993
|
-
const [rightParallel, rightSequential] = pipe(headNonEmpty2(rightStack), reduce4([empty5(), empty2()], ([parallel2, sequential2], cause) => {
|
|
1994
|
-
const [par, seq] = evaluateCause(cause);
|
|
1995
|
-
return some2([pipe(parallel2, union3(par)), pipe(sequential2, appendAll(seq))]);
|
|
1996
|
-
}));
|
|
1997
|
-
if (!equals(leftParallel, rightParallel)) {
|
|
1998
|
-
return false;
|
|
1999
|
-
}
|
|
2000
|
-
leftStack = leftSequential;
|
|
2001
|
-
rightStack = rightSequential;
|
|
2002
|
-
}
|
|
2003
|
-
return true;
|
|
2004
|
-
};
|
|
2005
|
-
var flattenCause = (cause) => {
|
|
2006
|
-
return flattenCauseLoop(of(cause), empty2());
|
|
2007
|
-
};
|
|
2008
|
-
var flattenCauseLoop = (causes, flattened) => {
|
|
2009
|
-
while (1) {
|
|
2010
|
-
const [parallel2, sequential2] = pipe(causes, reduce([empty5(), empty2()], ([parallel3, sequential3], cause) => {
|
|
2011
|
-
const [par, seq] = evaluateCause(cause);
|
|
2012
|
-
return [pipe(parallel3, union3(par)), pipe(sequential3, appendAll(seq))];
|
|
2013
|
-
}));
|
|
2014
|
-
const updated = size3(parallel2) > 0 ? pipe(flattened, prepend(parallel2)) : flattened;
|
|
2015
|
-
if (isEmpty(sequential2)) {
|
|
2016
|
-
return reverse2(updated);
|
|
2017
|
-
}
|
|
2018
|
-
causes = sequential2;
|
|
2019
|
-
flattened = updated;
|
|
2020
|
-
}
|
|
2021
|
-
throw new Error(getBugErrorMessage("Cause.flattenCauseLoop"));
|
|
2022
|
-
};
|
|
2023
|
-
var evaluateCause = (self) => {
|
|
2024
|
-
let cause = self;
|
|
2025
|
-
const stack = [];
|
|
2026
|
-
let _parallel = empty5();
|
|
2027
|
-
let _sequential = empty2();
|
|
2028
|
-
while (cause !== void 0) {
|
|
2029
|
-
switch (cause._tag) {
|
|
2030
|
-
case OP_EMPTY: {
|
|
2031
|
-
if (stack.length === 0) {
|
|
2032
|
-
return [_parallel, _sequential];
|
|
2033
|
-
}
|
|
2034
|
-
cause = stack.pop();
|
|
2035
|
-
break;
|
|
2036
|
-
}
|
|
2037
|
-
case OP_FAIL: {
|
|
2038
|
-
_parallel = add2(_parallel, make3(cause._tag, cause.error));
|
|
2039
|
-
if (stack.length === 0) {
|
|
2040
|
-
return [_parallel, _sequential];
|
|
2041
|
-
}
|
|
2042
|
-
cause = stack.pop();
|
|
2043
|
-
break;
|
|
2044
|
-
}
|
|
2045
|
-
case OP_DIE: {
|
|
2046
|
-
_parallel = add2(_parallel, make3(cause._tag, cause.defect));
|
|
2047
|
-
if (stack.length === 0) {
|
|
2048
|
-
return [_parallel, _sequential];
|
|
2049
|
-
}
|
|
2050
|
-
cause = stack.pop();
|
|
2051
|
-
break;
|
|
2052
|
-
}
|
|
2053
|
-
case OP_INTERRUPT: {
|
|
2054
|
-
_parallel = add2(_parallel, make3(cause._tag, cause.fiberId));
|
|
2055
|
-
if (stack.length === 0) {
|
|
2056
|
-
return [_parallel, _sequential];
|
|
2057
|
-
}
|
|
2058
|
-
cause = stack.pop();
|
|
2059
|
-
break;
|
|
2060
|
-
}
|
|
2061
|
-
case OP_SEQUENTIAL: {
|
|
2062
|
-
switch (cause.left._tag) {
|
|
2063
|
-
case OP_EMPTY: {
|
|
2064
|
-
cause = cause.right;
|
|
2065
|
-
break;
|
|
2066
|
-
}
|
|
2067
|
-
case OP_SEQUENTIAL: {
|
|
2068
|
-
cause = sequential(cause.left.left, sequential(cause.left.right, cause.right));
|
|
2069
|
-
break;
|
|
2070
|
-
}
|
|
2071
|
-
case OP_PARALLEL: {
|
|
2072
|
-
cause = parallel(sequential(cause.left.left, cause.right), sequential(cause.left.right, cause.right));
|
|
2073
|
-
break;
|
|
2074
|
-
}
|
|
2075
|
-
default: {
|
|
2076
|
-
_sequential = prepend(_sequential, cause.right);
|
|
2077
|
-
cause = cause.left;
|
|
2078
|
-
break;
|
|
2079
|
-
}
|
|
2080
|
-
}
|
|
2081
|
-
break;
|
|
2082
|
-
}
|
|
2083
|
-
case OP_PARALLEL: {
|
|
2084
|
-
stack.push(cause.right);
|
|
2085
|
-
cause = cause.left;
|
|
2086
|
-
break;
|
|
2087
|
-
}
|
|
2088
|
-
}
|
|
2089
|
-
}
|
|
2090
|
-
throw new Error(getBugErrorMessage("Cause.evaluateCauseLoop"));
|
|
2091
|
-
};
|
|
2092
|
-
var IsInterruptedOnlyCauseReducer = {
|
|
2093
|
-
emptyCase: constTrue,
|
|
2094
|
-
failCase: constFalse,
|
|
2095
|
-
dieCase: constFalse,
|
|
2096
|
-
interruptCase: constTrue,
|
|
2097
|
-
sequentialCase: (_, left3, right3) => left3 && right3,
|
|
2098
|
-
parallelCase: (_, left3, right3) => left3 && right3
|
|
2099
|
-
};
|
|
2100
|
-
var OP_SEQUENTIAL_CASE = "SequentialCase";
|
|
2101
|
-
var OP_PARALLEL_CASE = "ParallelCase";
|
|
2102
|
-
var reduce4 = /* @__PURE__ */ dual(3, (self, zero, pf) => {
|
|
2103
|
-
let accumulator = zero;
|
|
2104
|
-
let cause = self;
|
|
2105
|
-
const causes = [];
|
|
2106
|
-
while (cause !== void 0) {
|
|
2107
|
-
const option2 = pf(accumulator, cause);
|
|
2108
|
-
accumulator = isSome2(option2) ? option2.value : accumulator;
|
|
2109
|
-
switch (cause._tag) {
|
|
2110
|
-
case OP_SEQUENTIAL: {
|
|
2111
|
-
causes.push(cause.right);
|
|
2112
|
-
cause = cause.left;
|
|
2113
|
-
break;
|
|
2114
|
-
}
|
|
2115
|
-
case OP_PARALLEL: {
|
|
2116
|
-
causes.push(cause.right);
|
|
2117
|
-
cause = cause.left;
|
|
2118
|
-
break;
|
|
2119
|
-
}
|
|
2120
|
-
default: {
|
|
2121
|
-
cause = void 0;
|
|
2122
|
-
break;
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
if (cause === void 0 && causes.length > 0) {
|
|
2126
|
-
cause = causes.pop();
|
|
2127
|
-
}
|
|
2128
|
-
}
|
|
2129
|
-
return accumulator;
|
|
2130
|
-
});
|
|
2131
|
-
var reduceWithContext = /* @__PURE__ */ dual(3, (self, context, reducer) => {
|
|
2132
|
-
const input = [self];
|
|
2133
|
-
const output = [];
|
|
2134
|
-
while (input.length > 0) {
|
|
2135
|
-
const cause = input.pop();
|
|
2136
|
-
switch (cause._tag) {
|
|
2137
|
-
case OP_EMPTY: {
|
|
2138
|
-
output.push(right2(reducer.emptyCase(context)));
|
|
2139
|
-
break;
|
|
2140
|
-
}
|
|
2141
|
-
case OP_FAIL: {
|
|
2142
|
-
output.push(right2(reducer.failCase(context, cause.error)));
|
|
2143
|
-
break;
|
|
2144
|
-
}
|
|
2145
|
-
case OP_DIE: {
|
|
2146
|
-
output.push(right2(reducer.dieCase(context, cause.defect)));
|
|
2147
|
-
break;
|
|
2148
|
-
}
|
|
2149
|
-
case OP_INTERRUPT: {
|
|
2150
|
-
output.push(right2(reducer.interruptCase(context, cause.fiberId)));
|
|
2151
|
-
break;
|
|
2152
|
-
}
|
|
2153
|
-
case OP_SEQUENTIAL: {
|
|
2154
|
-
input.push(cause.right);
|
|
2155
|
-
input.push(cause.left);
|
|
2156
|
-
output.push(left2({
|
|
2157
|
-
_tag: OP_SEQUENTIAL_CASE
|
|
2158
|
-
}));
|
|
2159
|
-
break;
|
|
2160
|
-
}
|
|
2161
|
-
case OP_PARALLEL: {
|
|
2162
|
-
input.push(cause.right);
|
|
2163
|
-
input.push(cause.left);
|
|
2164
|
-
output.push(left2({
|
|
2165
|
-
_tag: OP_PARALLEL_CASE
|
|
2166
|
-
}));
|
|
2167
|
-
break;
|
|
2168
|
-
}
|
|
2169
|
-
}
|
|
2170
|
-
}
|
|
2171
|
-
const accumulator = [];
|
|
2172
|
-
while (output.length > 0) {
|
|
2173
|
-
const either = output.pop();
|
|
2174
|
-
switch (either._tag) {
|
|
2175
|
-
case "Left": {
|
|
2176
|
-
switch (either.left._tag) {
|
|
2177
|
-
case OP_SEQUENTIAL_CASE: {
|
|
2178
|
-
const left3 = accumulator.pop();
|
|
2179
|
-
const right3 = accumulator.pop();
|
|
2180
|
-
const value = reducer.sequentialCase(context, left3, right3);
|
|
2181
|
-
accumulator.push(value);
|
|
2182
|
-
break;
|
|
2183
|
-
}
|
|
2184
|
-
case OP_PARALLEL_CASE: {
|
|
2185
|
-
const left3 = accumulator.pop();
|
|
2186
|
-
const right3 = accumulator.pop();
|
|
2187
|
-
const value = reducer.parallelCase(context, left3, right3);
|
|
2188
|
-
accumulator.push(value);
|
|
2189
|
-
break;
|
|
2190
|
-
}
|
|
2191
|
-
}
|
|
2192
|
-
break;
|
|
2193
|
-
}
|
|
2194
|
-
case "Right": {
|
|
2195
|
-
accumulator.push(either.right);
|
|
2196
|
-
break;
|
|
2197
|
-
}
|
|
2198
|
-
}
|
|
2199
|
-
}
|
|
2200
|
-
if (accumulator.length === 0) {
|
|
2201
|
-
throw new Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");
|
|
2202
|
-
}
|
|
2203
|
-
return accumulator.pop();
|
|
2204
|
-
});
|
|
2205
|
-
var pretty = (cause, options) => {
|
|
2206
|
-
if (isInterruptedOnly(cause)) {
|
|
2207
|
-
return "All fibers interrupted without errors.";
|
|
2208
|
-
}
|
|
2209
|
-
return prettyErrors(cause).map(function(e) {
|
|
2210
|
-
if (options?.renderErrorCause !== true || e.cause === void 0) {
|
|
2211
|
-
return e.stack;
|
|
2212
|
-
}
|
|
2213
|
-
return `${e.stack} {
|
|
2214
|
-
${renderErrorCause(e.cause, " ")}
|
|
2215
|
-
}`;
|
|
2216
|
-
}).join("\n");
|
|
2217
|
-
};
|
|
2218
|
-
var renderErrorCause = (cause, prefix) => {
|
|
2219
|
-
const lines = cause.stack.split("\n");
|
|
2220
|
-
let stack = `${prefix}[cause]: ${lines[0]}`;
|
|
2221
|
-
for (let i = 1, len = lines.length; i < len; i++) {
|
|
2222
|
-
stack += `
|
|
2223
|
-
${prefix}${lines[i]}`;
|
|
2224
|
-
}
|
|
2225
|
-
if (cause.cause) {
|
|
2226
|
-
stack += ` {
|
|
2227
|
-
${renderErrorCause(cause.cause, `${prefix} `)}
|
|
2228
|
-
${prefix}}`;
|
|
2229
|
-
}
|
|
2230
|
-
return stack;
|
|
2231
|
-
};
|
|
2232
|
-
var PrettyError = class _PrettyError extends globalThis.Error {
|
|
2233
|
-
span = void 0;
|
|
2234
|
-
constructor(originalError) {
|
|
2235
|
-
const originalErrorIsObject = typeof originalError === "object" && originalError !== null;
|
|
2236
|
-
const prevLimit = Error.stackTraceLimit;
|
|
2237
|
-
Error.stackTraceLimit = 1;
|
|
2238
|
-
super(prettyErrorMessage(originalError), originalErrorIsObject && "cause" in originalError && typeof originalError.cause !== "undefined" ? {
|
|
2239
|
-
cause: new _PrettyError(originalError.cause)
|
|
2240
|
-
} : void 0);
|
|
2241
|
-
if (this.message === "") {
|
|
2242
|
-
this.message = "An error has occurred";
|
|
2243
|
-
}
|
|
2244
|
-
Error.stackTraceLimit = prevLimit;
|
|
2245
|
-
this.name = originalError instanceof Error ? originalError.name : "Error";
|
|
2246
|
-
if (originalErrorIsObject) {
|
|
2247
|
-
if (spanSymbol in originalError) {
|
|
2248
|
-
this.span = originalError[spanSymbol];
|
|
2249
|
-
}
|
|
2250
|
-
Object.keys(originalError).forEach((key) => {
|
|
2251
|
-
if (!(key in this)) {
|
|
2252
|
-
this[key] = originalError[key];
|
|
2253
|
-
}
|
|
2254
|
-
});
|
|
2255
|
-
}
|
|
2256
|
-
this.stack = prettyErrorStack(`${this.name}: ${this.message}`, originalError instanceof Error && originalError.stack ? originalError.stack : "", this.span);
|
|
2257
|
-
}
|
|
2258
|
-
};
|
|
2259
|
-
var prettyErrorMessage = (u) => {
|
|
2260
|
-
if (typeof u === "string") {
|
|
2261
|
-
return u;
|
|
2262
|
-
}
|
|
2263
|
-
if (typeof u === "object" && u !== null && u instanceof Error) {
|
|
2264
|
-
return u.message;
|
|
2265
|
-
}
|
|
2266
|
-
try {
|
|
2267
|
-
if (hasProperty(u, "toString") && isFunction2(u["toString"]) && u["toString"] !== Object.prototype.toString && u["toString"] !== globalThis.Array.prototype.toString) {
|
|
2268
|
-
return u["toString"]();
|
|
2269
|
-
}
|
|
2270
|
-
} catch {
|
|
2271
|
-
}
|
|
2272
|
-
return stringifyCircular(u);
|
|
2273
|
-
};
|
|
2274
|
-
var locationRegex = /\((.*)\)/g;
|
|
2275
|
-
var spanToTrace = /* @__PURE__ */ globalValue("effect/Tracer/spanToTrace", () => /* @__PURE__ */ new WeakMap());
|
|
2276
|
-
var prettyErrorStack = (message, stack, span) => {
|
|
2277
|
-
const out = [message];
|
|
2278
|
-
const lines = stack.startsWith(message) ? stack.slice(message.length).split("\n") : stack.split("\n");
|
|
2279
|
-
for (let i = 1; i < lines.length; i++) {
|
|
2280
|
-
if (lines[i].includes("Generator.next")) {
|
|
2281
|
-
break;
|
|
2282
|
-
}
|
|
2283
|
-
if (lines[i].includes("effect_internal_function")) {
|
|
2284
|
-
out.pop();
|
|
2285
|
-
break;
|
|
2286
|
-
}
|
|
2287
|
-
out.push(lines[i].replace(/at .*effect_instruction_i.*\((.*)\)/, "at $1").replace(/EffectPrimitive\.\w+/, "<anonymous>"));
|
|
2288
|
-
}
|
|
2289
|
-
if (span) {
|
|
2290
|
-
let current = span;
|
|
2291
|
-
let i = 0;
|
|
2292
|
-
while (current && current._tag === "Span" && i < 10) {
|
|
2293
|
-
const stackFn = spanToTrace.get(current);
|
|
2294
|
-
if (typeof stackFn === "function") {
|
|
2295
|
-
const stack2 = stackFn();
|
|
2296
|
-
if (typeof stack2 === "string") {
|
|
2297
|
-
const locationMatchAll = stack2.matchAll(locationRegex);
|
|
2298
|
-
let match3 = false;
|
|
2299
|
-
for (const [, location] of locationMatchAll) {
|
|
2300
|
-
match3 = true;
|
|
2301
|
-
out.push(` at ${current.name} (${location})`);
|
|
2302
|
-
}
|
|
2303
|
-
if (!match3) {
|
|
2304
|
-
out.push(` at ${current.name} (${stack2.replace(/^at /, "")})`);
|
|
2305
|
-
}
|
|
2306
|
-
} else {
|
|
2307
|
-
out.push(` at ${current.name}`);
|
|
2308
|
-
}
|
|
2309
|
-
} else {
|
|
2310
|
-
out.push(` at ${current.name}`);
|
|
2311
|
-
}
|
|
2312
|
-
current = getOrUndefined2(current.parent);
|
|
2313
|
-
i++;
|
|
2314
|
-
}
|
|
2315
|
-
}
|
|
2316
|
-
return out.join("\n");
|
|
2317
|
-
};
|
|
2318
|
-
var spanSymbol = /* @__PURE__ */ Symbol.for("effect/SpanAnnotation");
|
|
2319
|
-
var prettyErrors = (cause) => reduceWithContext(cause, void 0, {
|
|
2320
|
-
emptyCase: () => [],
|
|
2321
|
-
dieCase: (_, unknownError) => {
|
|
2322
|
-
return [new PrettyError(unknownError)];
|
|
2323
|
-
},
|
|
2324
|
-
failCase: (_, error) => {
|
|
2325
|
-
return [new PrettyError(error)];
|
|
2326
|
-
},
|
|
2327
|
-
interruptCase: () => [],
|
|
2328
|
-
parallelCase: (_, l, r) => [...l, ...r],
|
|
2329
|
-
sequentialCase: (_, l, r) => [...l, ...r]
|
|
2330
|
-
});
|
|
2331
|
-
|
|
2332
|
-
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/singleShotGen.js
|
|
2333
|
-
var SingleShotGen2 = class _SingleShotGen {
|
|
2334
|
-
self;
|
|
2335
|
-
called = false;
|
|
2336
|
-
constructor(self) {
|
|
2337
|
-
this.self = self;
|
|
2338
|
-
}
|
|
2339
|
-
next(a) {
|
|
2340
|
-
return this.called ? {
|
|
2341
|
-
value: a,
|
|
2342
|
-
done: true
|
|
2343
|
-
} : (this.called = true, {
|
|
2344
|
-
value: this.self,
|
|
2345
|
-
done: false
|
|
2346
|
-
});
|
|
2347
|
-
}
|
|
2348
|
-
return(a) {
|
|
2349
|
-
return {
|
|
2350
|
-
value: a,
|
|
2351
|
-
done: true
|
|
2352
|
-
};
|
|
2353
|
-
}
|
|
2354
|
-
throw(e) {
|
|
2355
|
-
throw e;
|
|
2356
|
-
}
|
|
2357
|
-
[Symbol.iterator]() {
|
|
2358
|
-
return new _SingleShotGen(this.self);
|
|
2359
|
-
}
|
|
2360
|
-
};
|
|
2361
|
-
|
|
2362
|
-
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/core.js
|
|
2363
|
-
var EffectTypeId2 = /* @__PURE__ */ Symbol.for("effect/Effect");
|
|
2364
|
-
var EffectPrimitive = class {
|
|
2365
|
-
_op;
|
|
2366
|
-
effect_instruction_i0 = void 0;
|
|
2367
|
-
effect_instruction_i1 = void 0;
|
|
2368
|
-
effect_instruction_i2 = void 0;
|
|
2369
|
-
trace = void 0;
|
|
2370
|
-
[EffectTypeId2] = effectVariance;
|
|
2371
|
-
constructor(_op) {
|
|
2372
|
-
this._op = _op;
|
|
2373
|
-
}
|
|
2374
|
-
[symbol2](that) {
|
|
2375
|
-
return this === that;
|
|
2376
|
-
}
|
|
2377
|
-
[symbol]() {
|
|
2378
|
-
return cached(this, random(this));
|
|
2379
|
-
}
|
|
2380
|
-
pipe() {
|
|
2381
|
-
return pipeArguments(this, arguments);
|
|
2382
|
-
}
|
|
2383
|
-
toJSON() {
|
|
2384
|
-
return {
|
|
2385
|
-
_id: "Effect",
|
|
2386
|
-
_op: this._op,
|
|
2387
|
-
effect_instruction_i0: toJSON(this.effect_instruction_i0),
|
|
2388
|
-
effect_instruction_i1: toJSON(this.effect_instruction_i1),
|
|
2389
|
-
effect_instruction_i2: toJSON(this.effect_instruction_i2)
|
|
2390
|
-
};
|
|
2391
|
-
}
|
|
2392
|
-
toString() {
|
|
2393
|
-
return format(this.toJSON());
|
|
2394
|
-
}
|
|
2395
|
-
[NodeInspectSymbol]() {
|
|
2396
|
-
return this.toJSON();
|
|
2397
|
-
}
|
|
2398
|
-
[Symbol.iterator]() {
|
|
2399
|
-
return new SingleShotGen2(new YieldWrap(this));
|
|
2400
|
-
}
|
|
2401
|
-
};
|
|
2402
|
-
var EffectPrimitiveFailure = class {
|
|
2403
|
-
_op;
|
|
2404
|
-
effect_instruction_i0 = void 0;
|
|
2405
|
-
effect_instruction_i1 = void 0;
|
|
2406
|
-
effect_instruction_i2 = void 0;
|
|
2407
|
-
trace = void 0;
|
|
2408
|
-
[EffectTypeId2] = effectVariance;
|
|
2409
|
-
constructor(_op) {
|
|
2410
|
-
this._op = _op;
|
|
2411
|
-
this._tag = _op;
|
|
2412
|
-
}
|
|
2413
|
-
[symbol2](that) {
|
|
2414
|
-
return exitIsExit(that) && that._op === "Failure" && // @ts-expect-error
|
|
2415
|
-
equals(this.effect_instruction_i0, that.effect_instruction_i0);
|
|
2416
|
-
}
|
|
2417
|
-
[symbol]() {
|
|
2418
|
-
return pipe(
|
|
2419
|
-
// @ts-expect-error
|
|
2420
|
-
string(this._tag),
|
|
2421
|
-
// @ts-expect-error
|
|
2422
|
-
combine(hash(this.effect_instruction_i0)),
|
|
2423
|
-
cached(this)
|
|
2424
|
-
);
|
|
2425
|
-
}
|
|
2426
|
-
get cause() {
|
|
2427
|
-
return this.effect_instruction_i0;
|
|
2428
|
-
}
|
|
2429
|
-
pipe() {
|
|
2430
|
-
return pipeArguments(this, arguments);
|
|
2431
|
-
}
|
|
2432
|
-
toJSON() {
|
|
2433
|
-
return {
|
|
2434
|
-
_id: "Exit",
|
|
2435
|
-
_tag: this._op,
|
|
2436
|
-
cause: this.cause.toJSON()
|
|
2437
|
-
};
|
|
2438
|
-
}
|
|
2439
|
-
toString() {
|
|
2440
|
-
return format(this.toJSON());
|
|
2441
|
-
}
|
|
2442
|
-
[NodeInspectSymbol]() {
|
|
2443
|
-
return this.toJSON();
|
|
2444
|
-
}
|
|
2445
|
-
[Symbol.iterator]() {
|
|
2446
|
-
return new SingleShotGen2(new YieldWrap(this));
|
|
2447
|
-
}
|
|
2448
|
-
};
|
|
2449
|
-
var EffectPrimitiveSuccess = class {
|
|
2450
|
-
_op;
|
|
2451
|
-
effect_instruction_i0 = void 0;
|
|
2452
|
-
effect_instruction_i1 = void 0;
|
|
2453
|
-
effect_instruction_i2 = void 0;
|
|
2454
|
-
trace = void 0;
|
|
2455
|
-
[EffectTypeId2] = effectVariance;
|
|
2456
|
-
constructor(_op) {
|
|
2457
|
-
this._op = _op;
|
|
2458
|
-
this._tag = _op;
|
|
2459
|
-
}
|
|
2460
|
-
[symbol2](that) {
|
|
2461
|
-
return exitIsExit(that) && that._op === "Success" && // @ts-expect-error
|
|
2462
|
-
equals(this.effect_instruction_i0, that.effect_instruction_i0);
|
|
2463
|
-
}
|
|
2464
|
-
[symbol]() {
|
|
2465
|
-
return pipe(
|
|
2466
|
-
// @ts-expect-error
|
|
2467
|
-
string(this._tag),
|
|
2468
|
-
// @ts-expect-error
|
|
2469
|
-
combine(hash(this.effect_instruction_i0)),
|
|
2470
|
-
cached(this)
|
|
2471
|
-
);
|
|
2472
|
-
}
|
|
2473
|
-
get value() {
|
|
2474
|
-
return this.effect_instruction_i0;
|
|
2475
|
-
}
|
|
2476
|
-
pipe() {
|
|
2477
|
-
return pipeArguments(this, arguments);
|
|
2478
|
-
}
|
|
2479
|
-
toJSON() {
|
|
2480
|
-
return {
|
|
2481
|
-
_id: "Exit",
|
|
2482
|
-
_tag: this._op,
|
|
2483
|
-
value: toJSON(this.value)
|
|
2484
|
-
};
|
|
2485
|
-
}
|
|
2486
|
-
toString() {
|
|
2487
|
-
return format(this.toJSON());
|
|
2488
|
-
}
|
|
2489
|
-
[NodeInspectSymbol]() {
|
|
2490
|
-
return this.toJSON();
|
|
828
|
+
var zipWith = /* @__PURE__ */ dual(3, (self, that, f) => flatMap(self, (r) => map(that, (r2) => f(r, r2))));
|
|
829
|
+
var ap = /* @__PURE__ */ dual(2, (self, that) => zipWith(self, that, (f, a) => f(a)));
|
|
830
|
+
var all = (input) => {
|
|
831
|
+
if (Symbol.iterator in input) {
|
|
832
|
+
const out2 = [];
|
|
833
|
+
for (const e of input) {
|
|
834
|
+
if (isLeft2(e)) {
|
|
835
|
+
return e;
|
|
836
|
+
}
|
|
837
|
+
out2.push(e.right);
|
|
838
|
+
}
|
|
839
|
+
return right2(out2);
|
|
2491
840
|
}
|
|
2492
|
-
|
|
2493
|
-
|
|
841
|
+
const out = {};
|
|
842
|
+
for (const key of Object.keys(input)) {
|
|
843
|
+
const e = input[key];
|
|
844
|
+
if (isLeft2(e)) {
|
|
845
|
+
return e;
|
|
846
|
+
}
|
|
847
|
+
out[key] = e.right;
|
|
2494
848
|
}
|
|
849
|
+
return right2(out);
|
|
2495
850
|
};
|
|
2496
|
-
var
|
|
2497
|
-
var
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
851
|
+
var flip = (self) => isLeft2(self) ? right2(self.left) : left2(self.right);
|
|
852
|
+
var adapter2 = /* @__PURE__ */ adapter();
|
|
853
|
+
var gen = (...args) => {
|
|
854
|
+
const f = args.length === 1 ? args[0] : args[1].bind(args[0]);
|
|
855
|
+
const iterator = f(adapter2);
|
|
856
|
+
let state = iterator.next();
|
|
857
|
+
if (state.done) {
|
|
858
|
+
return right2(state.value);
|
|
859
|
+
} else {
|
|
860
|
+
let current = state.value;
|
|
861
|
+
if (isGenKind(current)) {
|
|
862
|
+
current = current.value;
|
|
863
|
+
} else {
|
|
864
|
+
current = yieldWrapGet(current);
|
|
865
|
+
}
|
|
866
|
+
if (isLeft2(current)) {
|
|
867
|
+
return current;
|
|
868
|
+
}
|
|
869
|
+
while (!state.done) {
|
|
870
|
+
state = iterator.next(current.right);
|
|
871
|
+
if (!state.done) {
|
|
872
|
+
current = state.value;
|
|
873
|
+
if (isGenKind(current)) {
|
|
874
|
+
current = current.value;
|
|
875
|
+
} else {
|
|
876
|
+
current = yieldWrapGet(current);
|
|
2513
877
|
}
|
|
2514
|
-
if (
|
|
2515
|
-
return
|
|
878
|
+
if (isLeft2(current)) {
|
|
879
|
+
return current;
|
|
2516
880
|
}
|
|
2517
|
-
return target[p];
|
|
2518
881
|
}
|
|
2519
|
-
}
|
|
2520
|
-
|
|
2521
|
-
return obj;
|
|
2522
|
-
};
|
|
2523
|
-
var fail2 = (error) => isObject(error) && !(spanSymbol2 in error) ? withFiberRuntime((fiber) => failCause(fail(capture(error, currentSpanFromFiber(fiber))))) : failCause(fail(error));
|
|
2524
|
-
var failCause = (cause) => {
|
|
2525
|
-
const effect = new EffectPrimitiveFailure(OP_FAILURE);
|
|
2526
|
-
effect.effect_instruction_i0 = cause;
|
|
2527
|
-
return effect;
|
|
2528
|
-
};
|
|
2529
|
-
var logLevelAll = {
|
|
2530
|
-
_tag: "All",
|
|
2531
|
-
syslog: 0,
|
|
2532
|
-
label: "ALL",
|
|
2533
|
-
ordinal: Number.MIN_SAFE_INTEGER,
|
|
2534
|
-
pipe() {
|
|
2535
|
-
return pipeArguments(this, arguments);
|
|
2536
|
-
}
|
|
2537
|
-
};
|
|
2538
|
-
var logLevelNone = {
|
|
2539
|
-
_tag: "None",
|
|
2540
|
-
syslog: 7,
|
|
2541
|
-
label: "OFF",
|
|
2542
|
-
ordinal: Number.MAX_SAFE_INTEGER,
|
|
2543
|
-
pipe() {
|
|
2544
|
-
return pipeArguments(this, arguments);
|
|
882
|
+
}
|
|
883
|
+
return right2(state.value);
|
|
2545
884
|
}
|
|
2546
885
|
};
|
|
2547
|
-
var
|
|
2548
|
-
var
|
|
2549
|
-
var
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
886
|
+
var Do = /* @__PURE__ */ right2({});
|
|
887
|
+
var bind2 = /* @__PURE__ */ bind(map, flatMap);
|
|
888
|
+
var bindTo2 = /* @__PURE__ */ bindTo(map);
|
|
889
|
+
var let_2 = /* @__PURE__ */ let_(map);
|
|
890
|
+
|
|
891
|
+
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/internal/array.js
|
|
892
|
+
var isNonEmptyArray = (self) => self.length > 0;
|
|
893
|
+
|
|
894
|
+
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/Order.js
|
|
895
|
+
var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
|
|
896
|
+
|
|
897
|
+
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/Option.js
|
|
898
|
+
var none2 = () => none;
|
|
899
|
+
var some2 = some;
|
|
900
|
+
var isNone2 = isNone;
|
|
901
|
+
var isSome2 = isSome;
|
|
902
|
+
var match2 = /* @__PURE__ */ dual(2, (self, {
|
|
903
|
+
onNone,
|
|
904
|
+
onSome
|
|
905
|
+
}) => isNone2(self) ? onNone() : onSome(self.value));
|
|
906
|
+
var getOrElse2 = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? onNone() : self.value);
|
|
907
|
+
var orElse2 = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? that() : self);
|
|
908
|
+
var fromNullable2 = (nullableValue) => nullableValue == null ? none2() : some2(nullableValue);
|
|
909
|
+
var getOrUndefined2 = /* @__PURE__ */ getOrElse2(constUndefined);
|
|
910
|
+
|
|
911
|
+
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/Array.js
|
|
912
|
+
var fromIterable = (collection) => Array.isArray(collection) ? collection : Array.from(collection);
|
|
913
|
+
var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
|
|
914
|
+
var isArray = Array.isArray;
|
|
915
|
+
var isEmptyArray = (self) => self.length === 0;
|
|
916
|
+
var isEmptyReadonlyArray = isEmptyArray;
|
|
917
|
+
var isNonEmptyReadonlyArray = isNonEmptyArray;
|
|
918
|
+
var isOutOfBound = (i, as) => i < 0 || i >= as.length;
|
|
919
|
+
var get = /* @__PURE__ */ dual(2, (self, index) => {
|
|
920
|
+
const i = Math.floor(index);
|
|
921
|
+
return isOutOfBound(i, self) ? none2() : some2(self[i]);
|
|
922
|
+
});
|
|
923
|
+
var unsafeGet = /* @__PURE__ */ dual(2, (self, index) => {
|
|
924
|
+
const i = Math.floor(index);
|
|
925
|
+
if (isOutOfBound(i, self)) {
|
|
926
|
+
throw new Error(`Index ${i} out of bounds`);
|
|
2571
927
|
}
|
|
2572
|
-
|
|
2573
|
-
|
|
928
|
+
return self[i];
|
|
929
|
+
});
|
|
930
|
+
var head = /* @__PURE__ */ get(0);
|
|
931
|
+
var headNonEmpty = /* @__PURE__ */ unsafeGet(0);
|
|
932
|
+
var tailNonEmpty = (self) => self.slice(1);
|
|
933
|
+
var sort = /* @__PURE__ */ dual(2, (self, O) => {
|
|
934
|
+
const out = Array.from(self);
|
|
935
|
+
out.sort(O);
|
|
936
|
+
return out;
|
|
937
|
+
});
|
|
938
|
+
var empty = () => [];
|
|
939
|
+
var map2 = /* @__PURE__ */ dual(2, (self, f) => self.map(f));
|
|
940
|
+
var flatMap2 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
941
|
+
if (isEmptyReadonlyArray(self)) {
|
|
942
|
+
return [];
|
|
2574
943
|
}
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
return fail2(this);
|
|
2581
|
-
}
|
|
2582
|
-
toJSON() {
|
|
2583
|
-
return {
|
|
2584
|
-
...this
|
|
2585
|
-
};
|
|
2586
|
-
}
|
|
2587
|
-
[NodeInspectSymbol]() {
|
|
2588
|
-
if (this.toString !== globalThis.Error.prototype.toString) {
|
|
2589
|
-
return this.stack ? `${this.toString()}
|
|
2590
|
-
${this.stack.split("\n").slice(1).join("\n")}` : this.toString();
|
|
2591
|
-
} else if ("Bun" in globalThis) {
|
|
2592
|
-
return pretty(fail(this), {
|
|
2593
|
-
renderErrorCause: true
|
|
2594
|
-
});
|
|
2595
|
-
}
|
|
2596
|
-
return this;
|
|
944
|
+
const out = [];
|
|
945
|
+
for (let i = 0; i < self.length; i++) {
|
|
946
|
+
const inner = f(self[i], i);
|
|
947
|
+
for (let j = 0; j < inner.length; j++) {
|
|
948
|
+
out.push(inner[j]);
|
|
2597
949
|
}
|
|
2598
950
|
}
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
var
|
|
2603
|
-
|
|
2604
|
-
|
|
951
|
+
return out;
|
|
952
|
+
});
|
|
953
|
+
var flatten = /* @__PURE__ */ flatMap2(identity);
|
|
954
|
+
var filter = /* @__PURE__ */ dual(2, (self, predicate) => {
|
|
955
|
+
const as = fromIterable(self);
|
|
956
|
+
const out = [];
|
|
957
|
+
for (let i = 0; i < as.length; i++) {
|
|
958
|
+
if (predicate(as[i], i)) {
|
|
959
|
+
out.push(as[i]);
|
|
960
|
+
}
|
|
2605
961
|
}
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
}, "InterruptedException");
|
|
2618
|
-
var IllegalArgumentExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/IllegalArgument");
|
|
2619
|
-
var IllegalArgumentException = /* @__PURE__ */ makeException({
|
|
2620
|
-
[IllegalArgumentExceptionTypeId]: IllegalArgumentExceptionTypeId
|
|
2621
|
-
}, "IllegalArgumentException");
|
|
2622
|
-
var NoSuchElementExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/NoSuchElement");
|
|
2623
|
-
var NoSuchElementException = /* @__PURE__ */ makeException({
|
|
2624
|
-
[NoSuchElementExceptionTypeId]: NoSuchElementExceptionTypeId
|
|
2625
|
-
}, "NoSuchElementException");
|
|
2626
|
-
var InvalidPubSubCapacityExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/InvalidPubSubCapacityException");
|
|
2627
|
-
var InvalidPubSubCapacityException = /* @__PURE__ */ makeException({
|
|
2628
|
-
[InvalidPubSubCapacityExceptionTypeId]: InvalidPubSubCapacityExceptionTypeId
|
|
2629
|
-
}, "InvalidPubSubCapacityException");
|
|
2630
|
-
var ExceededCapacityExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/ExceededCapacityException");
|
|
2631
|
-
var ExceededCapacityException = /* @__PURE__ */ makeException({
|
|
2632
|
-
[ExceededCapacityExceptionTypeId]: ExceededCapacityExceptionTypeId
|
|
2633
|
-
}, "ExceededCapacityException");
|
|
2634
|
-
var TimeoutExceptionTypeId = /* @__PURE__ */ Symbol.for("effect/Cause/errors/Timeout");
|
|
2635
|
-
var TimeoutException = /* @__PURE__ */ makeException({
|
|
2636
|
-
[TimeoutExceptionTypeId]: TimeoutExceptionTypeId
|
|
2637
|
-
}, "TimeoutException");
|
|
2638
|
-
var exitIsExit = (u) => isEffect(u) && "_tag" in u && (u._tag === "Success" || u._tag === "Failure");
|
|
2639
|
-
var currentSpanFromFiber = (fiber) => {
|
|
2640
|
-
const span = fiber.currentSpan;
|
|
2641
|
-
return span !== void 0 && span._tag === "Span" ? some2(span) : none2();
|
|
2642
|
-
};
|
|
2643
|
-
|
|
2644
|
-
// node_modules/.pnpm/effect@3.12.5/node_modules/effect/dist/esm/Data.js
|
|
2645
|
-
var Error2 = /* @__PURE__ */ function() {
|
|
2646
|
-
const plainArgsSymbol = /* @__PURE__ */ Symbol.for("effect/Data/Error/plainArgs");
|
|
2647
|
-
return class Base extends YieldableError {
|
|
2648
|
-
constructor(args) {
|
|
2649
|
-
super(args?.message, args?.cause ? {
|
|
2650
|
-
cause: args.cause
|
|
2651
|
-
} : void 0);
|
|
2652
|
-
if (args) {
|
|
2653
|
-
Object.assign(this, args);
|
|
2654
|
-
Object.defineProperty(this, plainArgsSymbol, {
|
|
2655
|
-
value: args,
|
|
2656
|
-
enumerable: false
|
|
2657
|
-
});
|
|
962
|
+
return out;
|
|
963
|
+
});
|
|
964
|
+
var reduce = /* @__PURE__ */ dual(3, (self, b, f) => fromIterable(self).reduce((b2, a, i) => f(b2, a, i), b));
|
|
965
|
+
var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
|
|
966
|
+
const input = fromIterable(self);
|
|
967
|
+
if (isNonEmptyReadonlyArray(input)) {
|
|
968
|
+
const out = [headNonEmpty(input)];
|
|
969
|
+
const rest = tailNonEmpty(input);
|
|
970
|
+
for (const r of rest) {
|
|
971
|
+
if (out.every((a) => !isEquivalent(r, a))) {
|
|
972
|
+
out.push(r);
|
|
2658
973
|
}
|
|
2659
974
|
}
|
|
2660
|
-
|
|
2661
|
-
return {
|
|
2662
|
-
...this[plainArgsSymbol],
|
|
2663
|
-
...this
|
|
2664
|
-
};
|
|
2665
|
-
}
|
|
2666
|
-
};
|
|
2667
|
-
}();
|
|
2668
|
-
var TaggedError = (tag) => {
|
|
2669
|
-
class Base extends Error2 {
|
|
2670
|
-
_tag = tag;
|
|
975
|
+
return out;
|
|
2671
976
|
}
|
|
2672
|
-
;
|
|
2673
|
-
|
|
2674
|
-
return Base;
|
|
2675
|
-
};
|
|
977
|
+
return [];
|
|
978
|
+
});
|
|
2676
979
|
|
|
2677
980
|
// src/core/Nano.ts
|
|
2678
|
-
var NanoDefectException = class
|
|
981
|
+
var NanoDefectException = class {
|
|
982
|
+
constructor(message) {
|
|
983
|
+
this.message = message;
|
|
984
|
+
}
|
|
985
|
+
_tag = "@effect/language-service/NanoDefectException";
|
|
2679
986
|
};
|
|
2680
987
|
var NanoTag = class {
|
|
2681
988
|
constructor(key) {
|
|
@@ -2712,23 +1019,23 @@ var run = (fa) => {
|
|
|
2712
1019
|
case "Left":
|
|
2713
1020
|
return left2(result.left);
|
|
2714
1021
|
case "Defect":
|
|
2715
|
-
return left2(new NanoDefectException(
|
|
1022
|
+
return left2(new NanoDefectException(result.defect));
|
|
2716
1023
|
case "Right":
|
|
2717
1024
|
return right2(result.right);
|
|
2718
1025
|
}
|
|
2719
1026
|
} catch (e) {
|
|
2720
|
-
return left2(new NanoDefectException(
|
|
1027
|
+
return left2(new NanoDefectException(e));
|
|
2721
1028
|
}
|
|
2722
1029
|
};
|
|
2723
1030
|
var succeed = (value) => new Nano(() => ({ _tag: "Right", right: value }));
|
|
2724
|
-
var
|
|
1031
|
+
var fail = (value) => new Nano(() => ({ _tag: "Left", left: value }));
|
|
2725
1032
|
var sync = (value) => new Nano(() => ({ _tag: "Right", right: value() }));
|
|
2726
|
-
var
|
|
1033
|
+
var flatMap3 = dual(2, (fa, f) => new Nano((ctx) => {
|
|
2727
1034
|
const result = fa.run(ctx);
|
|
2728
1035
|
if (result._tag !== "Right") return result;
|
|
2729
1036
|
return f(result.right).run(ctx);
|
|
2730
1037
|
}));
|
|
2731
|
-
var
|
|
1038
|
+
var map3 = dual(2, (fa, f) => new Nano((ctx) => {
|
|
2732
1039
|
const result = fa.run(ctx);
|
|
2733
1040
|
if (result._tag !== "Right") return result;
|
|
2734
1041
|
return { _tag: "Right", right: f(result.right) };
|
|
@@ -2809,7 +1116,8 @@ var getAncestorNodesInRange = fn("AST.getAncestorNodesInRange")(function* (sourc
|
|
|
2809
1116
|
if (isNone2(nodeAtPosition)) return empty();
|
|
2810
1117
|
return yield* collectSelfAndAncestorNodesInRange(nodeAtPosition.value, textRange);
|
|
2811
1118
|
});
|
|
2812
|
-
var NodeNotFoundError = class
|
|
1119
|
+
var NodeNotFoundError = class {
|
|
1120
|
+
_tag = "@effect/language-service/NodeNotFoundError";
|
|
2813
1121
|
};
|
|
2814
1122
|
var findNodeAtPosition = fn("AST.findNodeAtPosition")(function* (sourceFile, position) {
|
|
2815
1123
|
const ts = yield* service(TypeScriptApi);
|
|
@@ -2820,19 +1128,19 @@ var findNodeAtPosition = fn("AST.findNodeAtPosition")(function* (sourceFile, pos
|
|
|
2820
1128
|
return void 0;
|
|
2821
1129
|
}
|
|
2822
1130
|
const result = find(sourceFile);
|
|
2823
|
-
if (!result) return yield*
|
|
1131
|
+
if (!result) return yield* fail(new NodeNotFoundError());
|
|
2824
1132
|
return result;
|
|
2825
1133
|
});
|
|
2826
1134
|
var getCommentAtPosition = fn("TypeScriptApi.getCommentAtPosition")(function* (sourceFile, pos) {
|
|
2827
1135
|
const ts = yield* service(TypeScriptApi);
|
|
2828
1136
|
const token = yield* findNodeAtPosition(sourceFile, pos);
|
|
2829
1137
|
if (token === void 0 || token.kind === ts.SyntaxKind.JsxText || pos >= token.end - (ts.tokenToString(token.kind) || "").length) {
|
|
2830
|
-
return yield*
|
|
1138
|
+
return yield* fail(new NodeNotFoundError());
|
|
2831
1139
|
}
|
|
2832
1140
|
const startPos = token.pos === 0 ? (ts.getShebang(sourceFile.text) || "").length : token.pos;
|
|
2833
|
-
if (startPos === 0) return yield*
|
|
1141
|
+
if (startPos === 0) return yield* fail(new NodeNotFoundError());
|
|
2834
1142
|
const result = ts.forEachTrailingCommentRange(sourceFile.text, startPos, isCommentInRange, pos) || ts.forEachLeadingCommentRange(sourceFile.text, startPos, isCommentInRange, pos);
|
|
2835
|
-
if (!result) return yield*
|
|
1143
|
+
if (!result) return yield* fail(new NodeNotFoundError());
|
|
2836
1144
|
return result;
|
|
2837
1145
|
});
|
|
2838
1146
|
function isCommentInRange(pos, end, kind, _nl, at) {
|
|
@@ -2858,24 +1166,7 @@ var transformAsyncAwaitToEffectGen = fn("AST.transformAsyncAwaitToEffectGen")(
|
|
|
2858
1166
|
return ts.visitEachChild(_, visitor, ts.nullTransformationContext);
|
|
2859
1167
|
}
|
|
2860
1168
|
const generatorBody = visitor(node.body);
|
|
2861
|
-
const
|
|
2862
|
-
void 0,
|
|
2863
|
-
ts.factory.createToken(ts.SyntaxKind.AsteriskToken),
|
|
2864
|
-
void 0,
|
|
2865
|
-
[],
|
|
2866
|
-
[],
|
|
2867
|
-
void 0,
|
|
2868
|
-
generatorBody
|
|
2869
|
-
// NOTE(mattia): intended, to use same routine for both ConciseBody and Body
|
|
2870
|
-
);
|
|
2871
|
-
const effectGenCallExp = ts.factory.createCallExpression(
|
|
2872
|
-
ts.factory.createPropertyAccessExpression(
|
|
2873
|
-
ts.factory.createIdentifier(effectModuleName),
|
|
2874
|
-
"gen"
|
|
2875
|
-
),
|
|
2876
|
-
void 0,
|
|
2877
|
-
[generator]
|
|
2878
|
-
);
|
|
1169
|
+
const effectGenCallExp = yield* createEffectGenCallExpression(effectModuleName, generatorBody);
|
|
2879
1170
|
let currentFlags = ts.getCombinedModifierFlags(node);
|
|
2880
1171
|
currentFlags &= ~ts.ModifierFlags.Async;
|
|
2881
1172
|
const newModifiers = ts.factory.createModifiersFromModifierFlags(currentFlags);
|
|
@@ -2946,7 +1237,8 @@ var removeReturnTypeAnnotation = fn("AST.removeReturnTypeAnnotation")(function*
|
|
|
2946
1237
|
changes.deleteRange(sourceFile, { pos: endNode.end, end: declaration.type.end });
|
|
2947
1238
|
}
|
|
2948
1239
|
});
|
|
2949
|
-
var ImportModuleIdentifierNotFoundError = class
|
|
1240
|
+
var ImportModuleIdentifierNotFoundError = class {
|
|
1241
|
+
_tag = "@effect/language-service/ImportModuleIdentifierNotFoundError";
|
|
2950
1242
|
};
|
|
2951
1243
|
var findImportedModuleIdentifier = fn("AST.findImportedModuleIdentifier")(
|
|
2952
1244
|
function* (sourceFile, test) {
|
|
@@ -2972,7 +1264,7 @@ var findImportedModuleIdentifier = fn("AST.findImportedModuleIdentifier")(
|
|
|
2972
1264
|
}
|
|
2973
1265
|
}
|
|
2974
1266
|
}
|
|
2975
|
-
return yield*
|
|
1267
|
+
return yield* fail(new ImportModuleIdentifierNotFoundError());
|
|
2976
1268
|
}
|
|
2977
1269
|
);
|
|
2978
1270
|
function findImportedModuleIdentifierByPackageAndNameOrBarrel(sourceFile, packageName, moduleName) {
|
|
@@ -3096,9 +1388,51 @@ var parseDataForExtendsClassCompletion = fn(
|
|
|
3096
1388
|
{ accessedObject, classDeclaration, className: classDeclaration.name, replacementSpan }
|
|
3097
1389
|
);
|
|
3098
1390
|
});
|
|
1391
|
+
var createEffectGenCallExpression = fn("AST.createEffectGenCallExpression")(function* (effectModuleIdentifierName, node) {
|
|
1392
|
+
const ts = yield* service(TypeScriptApi);
|
|
1393
|
+
const generator = ts.factory.createFunctionExpression(
|
|
1394
|
+
void 0,
|
|
1395
|
+
ts.factory.createToken(ts.SyntaxKind.AsteriskToken),
|
|
1396
|
+
void 0,
|
|
1397
|
+
[],
|
|
1398
|
+
[],
|
|
1399
|
+
void 0,
|
|
1400
|
+
node
|
|
1401
|
+
// NOTE(mattia): intended, to use same routine for both ConciseBody and Body
|
|
1402
|
+
);
|
|
1403
|
+
return ts.factory.createCallExpression(
|
|
1404
|
+
ts.factory.createPropertyAccessExpression(
|
|
1405
|
+
ts.factory.createIdentifier(effectModuleIdentifierName),
|
|
1406
|
+
"gen"
|
|
1407
|
+
),
|
|
1408
|
+
void 0,
|
|
1409
|
+
[generator]
|
|
1410
|
+
);
|
|
1411
|
+
});
|
|
1412
|
+
var createEffectGenCallExpressionWithBlock = fn(
|
|
1413
|
+
"AST.createEffectGenCallExpressionWithBlock"
|
|
1414
|
+
)(function* (effectModuleIdentifierName, statement) {
|
|
1415
|
+
const ts = yield* service(TypeScriptApi);
|
|
1416
|
+
return yield* createEffectGenCallExpression(
|
|
1417
|
+
effectModuleIdentifierName,
|
|
1418
|
+
ts.factory.createBlock(Array.isArray(statement) ? statement : [statement], false)
|
|
1419
|
+
);
|
|
1420
|
+
});
|
|
1421
|
+
var createReturnYieldStarStatement = fn("AST.createReturnYieldStarStatement")(
|
|
1422
|
+
function* (expr) {
|
|
1423
|
+
const ts = yield* service(TypeScriptApi);
|
|
1424
|
+
return ts.factory.createReturnStatement(
|
|
1425
|
+
ts.factory.createYieldExpression(
|
|
1426
|
+
ts.factory.createToken(ts.SyntaxKind.AsteriskToken),
|
|
1427
|
+
expr
|
|
1428
|
+
)
|
|
1429
|
+
);
|
|
1430
|
+
}
|
|
1431
|
+
);
|
|
3099
1432
|
|
|
3100
1433
|
// src/core/LSP.ts
|
|
3101
|
-
var RefactorNotApplicableError = class
|
|
1434
|
+
var RefactorNotApplicableError = class {
|
|
1435
|
+
_tag = "@effect/language-service/RefactorNotApplicableError";
|
|
3102
1436
|
};
|
|
3103
1437
|
function createRefactor(definition) {
|
|
3104
1438
|
return definition;
|
|
@@ -3110,8 +1444,6 @@ function createCompletion(definition) {
|
|
|
3110
1444
|
return definition;
|
|
3111
1445
|
}
|
|
3112
1446
|
var PluginOptions = Tag("PluginOptions");
|
|
3113
|
-
var SourceFileNotFoundError = class extends TaggedError("SourceFileNotFoundError") {
|
|
3114
|
-
};
|
|
3115
1447
|
var getSemanticDiagnosticsWithCodeFixes = fn("LSP.getSemanticDiagnostics")(function* (rules, sourceFile) {
|
|
3116
1448
|
const effectDiagnostics = [];
|
|
3117
1449
|
const effectCodeFixes = [];
|
|
@@ -3179,7 +1511,7 @@ var getApplicableRefactors = fn("LSP.getApplicableRefactors")(function* (refacto
|
|
|
3179
1511
|
var getEditsForRefactor = fn("LSP.getEditsForRefactor")(function* (refactors2, sourceFile, positionOrRange, refactorName) {
|
|
3180
1512
|
const refactor = refactors2.find((refactor2) => refactor2.name === refactorName);
|
|
3181
1513
|
if (!refactor) {
|
|
3182
|
-
return yield*
|
|
1514
|
+
return yield* fail(new RefactorNotApplicableError());
|
|
3183
1515
|
}
|
|
3184
1516
|
const textRange = typeof positionOrRange === "number" ? { pos: positionOrRange, end: positionOrRange } : positionOrRange;
|
|
3185
1517
|
return yield* refactor.apply(sourceFile, textRange);
|
|
@@ -3249,7 +1581,7 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
|
|
|
3249
1581
|
const fixByDisableEntireFile = {
|
|
3250
1582
|
fixName: rule.name + "_skipFile",
|
|
3251
1583
|
description: "Disable " + rule.name + " for this file",
|
|
3252
|
-
apply:
|
|
1584
|
+
apply: flatMap3(
|
|
3253
1585
|
service(ChangeTracker),
|
|
3254
1586
|
(changeTracker) => sync(
|
|
3255
1587
|
() => changeTracker.insertText(
|
|
@@ -3467,7 +1799,11 @@ var getMissingTypeEntriesInTargetType = fn(
|
|
|
3467
1799
|
return result;
|
|
3468
1800
|
}
|
|
3469
1801
|
);
|
|
3470
|
-
var CannotFindAncestorConvertibleDeclarationError = class
|
|
1802
|
+
var CannotFindAncestorConvertibleDeclarationError = class {
|
|
1803
|
+
constructor(node) {
|
|
1804
|
+
this.node = node;
|
|
1805
|
+
}
|
|
1806
|
+
_tag = "@effect/language-service/CannotFindAncestorConvertibleDeclarationError";
|
|
3471
1807
|
};
|
|
3472
1808
|
var getAncestorConvertibleDeclaration = fn(
|
|
3473
1809
|
"TypeCheckerApi.getAncestorConvertibleDeclaration"
|
|
@@ -3480,17 +1816,25 @@ var getAncestorConvertibleDeclaration = fn(
|
|
|
3480
1816
|
}
|
|
3481
1817
|
current = current.parent;
|
|
3482
1818
|
}
|
|
3483
|
-
return yield*
|
|
1819
|
+
return yield* fail(new CannotFindAncestorConvertibleDeclarationError(node));
|
|
3484
1820
|
});
|
|
3485
|
-
var CannotInferReturnTypeFromEmptyBody = class
|
|
1821
|
+
var CannotInferReturnTypeFromEmptyBody = class {
|
|
1822
|
+
constructor(declaration) {
|
|
1823
|
+
this.declaration = declaration;
|
|
1824
|
+
}
|
|
1825
|
+
_tag = "@effect/language-service/CannotInferReturnTypeFromEmptyBody";
|
|
3486
1826
|
};
|
|
3487
|
-
var CannotInferReturnType = class
|
|
1827
|
+
var CannotInferReturnType = class {
|
|
1828
|
+
constructor(declaration) {
|
|
1829
|
+
this.declaration = declaration;
|
|
1830
|
+
}
|
|
1831
|
+
_tag = "@effect/language-service/CannotInferReturnType";
|
|
3488
1832
|
};
|
|
3489
1833
|
var getInferredReturnType = fn("TypeCheckerApi.getInferredReturnType")(function* (declaration) {
|
|
3490
1834
|
const typeChecker = yield* service(TypeCheckerApi);
|
|
3491
1835
|
if (!declaration.body) {
|
|
3492
|
-
return yield*
|
|
3493
|
-
new CannotInferReturnTypeFromEmptyBody(
|
|
1836
|
+
return yield* fail(
|
|
1837
|
+
new CannotInferReturnTypeFromEmptyBody(declaration)
|
|
3494
1838
|
);
|
|
3495
1839
|
}
|
|
3496
1840
|
let returnType;
|
|
@@ -3514,8 +1858,8 @@ var getInferredReturnType = fn("TypeCheckerApi.getInferredReturnType")(function*
|
|
|
3514
1858
|
}
|
|
3515
1859
|
}
|
|
3516
1860
|
if (!returnType) {
|
|
3517
|
-
return yield*
|
|
3518
|
-
new CannotInferReturnType(
|
|
1861
|
+
return yield* fail(
|
|
1862
|
+
new CannotInferReturnType(declaration)
|
|
3519
1863
|
);
|
|
3520
1864
|
}
|
|
3521
1865
|
return returnType;
|
|
@@ -3607,10 +1951,16 @@ var expectedAndRealType = fn("TypeCheckerApi.expectedAndRealType")(function* (so
|
|
|
3607
1951
|
});
|
|
3608
1952
|
|
|
3609
1953
|
// src/utils/TypeParser.ts
|
|
3610
|
-
var TypeParserIssue = class
|
|
1954
|
+
var TypeParserIssue = class {
|
|
1955
|
+
constructor(type, node, message) {
|
|
1956
|
+
this.type = type;
|
|
1957
|
+
this.node = node;
|
|
1958
|
+
this.message = message;
|
|
1959
|
+
}
|
|
1960
|
+
_tag = "@effect/language-service/TypeParserIssue";
|
|
3611
1961
|
};
|
|
3612
1962
|
function typeParserIssue(message, type, node) {
|
|
3613
|
-
return
|
|
1963
|
+
return fail(new TypeParserIssue(type, node, message));
|
|
3614
1964
|
}
|
|
3615
1965
|
function covariantTypeArgument(type) {
|
|
3616
1966
|
const signatures = type.getCallSignatures();
|
|
@@ -4007,41 +2357,38 @@ var missingStarInYieldEffectGen = createDiagnostic({
|
|
|
4007
2357
|
code: 4,
|
|
4008
2358
|
apply: fn("missingStarInYieldEffectGen.apply")(function* (sourceFile) {
|
|
4009
2359
|
const ts = yield* service(TypeScriptApi);
|
|
4010
|
-
const typeChecker = yield* service(TypeCheckerApi);
|
|
4011
2360
|
const effectDiagnostics = [];
|
|
4012
2361
|
const brokenGenerators = /* @__PURE__ */ new Set();
|
|
4013
2362
|
const brokenYields = /* @__PURE__ */ new Set();
|
|
4014
2363
|
const nodeToVisit = [];
|
|
4015
|
-
const appendNodeToVisit = (
|
|
4016
|
-
nodeToVisit.push(
|
|
2364
|
+
const appendNodeToVisit = (node) => {
|
|
2365
|
+
nodeToVisit.push(node);
|
|
4017
2366
|
return void 0;
|
|
4018
2367
|
};
|
|
4019
|
-
ts.forEachChild(sourceFile, appendNodeToVisit
|
|
2368
|
+
ts.forEachChild(sourceFile, appendNodeToVisit);
|
|
4020
2369
|
while (nodeToVisit.length > 0) {
|
|
4021
|
-
const
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
const
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
brokenYields.add(node);
|
|
4028
|
-
}
|
|
4029
|
-
}
|
|
4030
|
-
const effectGenLike = yield* pipe(
|
|
4031
|
-
effectGen(node),
|
|
4032
|
-
orElse3(() => effectFnUntracedGen(node)),
|
|
4033
|
-
orElse3(() => effectFnGen(node)),
|
|
4034
|
-
option
|
|
4035
|
-
);
|
|
4036
|
-
if (isSome2(effectGenLike)) {
|
|
4037
|
-
ts.forEachChild(
|
|
4038
|
-
effectGenLike.value.body,
|
|
4039
|
-
appendNodeToVisit(effectGenLike.value.functionStar)
|
|
2370
|
+
const node = nodeToVisit.shift();
|
|
2371
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
2372
|
+
if (ts.isYieldExpression(node) && node.expression && node.asteriskToken === void 0) {
|
|
2373
|
+
const functionStarNode = ts.findAncestor(
|
|
2374
|
+
node,
|
|
2375
|
+
(_) => (ts.isFunctionExpression(_) || ts.isMethodDeclaration(_)) && _.asteriskToken !== void 0
|
|
4040
2376
|
);
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
2377
|
+
if (functionStarNode && functionStarNode.parent) {
|
|
2378
|
+
const effectGenNode = functionStarNode.parent;
|
|
2379
|
+
const effectGenLike = yield* pipe(
|
|
2380
|
+
effectGen(effectGenNode),
|
|
2381
|
+
orElse3(() => effectFnUntracedGen(effectGenNode)),
|
|
2382
|
+
orElse3(() => effectFnGen(effectGenNode)),
|
|
2383
|
+
option
|
|
2384
|
+
);
|
|
2385
|
+
if (isSome2(effectGenLike)) {
|
|
2386
|
+
if (effectGenLike.value.functionStar) {
|
|
2387
|
+
brokenGenerators.add(effectGenLike.value.functionStar);
|
|
2388
|
+
}
|
|
2389
|
+
brokenYields.add(node);
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
4045
2392
|
}
|
|
4046
2393
|
}
|
|
4047
2394
|
brokenGenerators.forEach(
|
|
@@ -4096,18 +2443,28 @@ var unnecessaryEffectGen = createDiagnostic({
|
|
|
4096
2443
|
while (nodeToVisit.length > 0) {
|
|
4097
2444
|
const node = nodeToVisit.shift();
|
|
4098
2445
|
ts.forEachChild(node, appendNodeToVisit);
|
|
4099
|
-
const
|
|
4100
|
-
|
|
4101
|
-
flatMap5(({ body }) => returnYieldEffectBlock(body)),
|
|
4102
|
-
option
|
|
2446
|
+
const maybeUnnecessaryYield = yield* option(
|
|
2447
|
+
returnYieldEffectBlock(node)
|
|
4103
2448
|
);
|
|
4104
|
-
if (isSome2(
|
|
4105
|
-
|
|
2449
|
+
if (isSome2(maybeUnnecessaryYield)) {
|
|
2450
|
+
const functionStarNode = ts.findAncestor(
|
|
2451
|
+
node,
|
|
2452
|
+
(_) => (ts.isFunctionExpression(_) || ts.isMethodDeclaration(_)) && _.asteriskToken !== void 0
|
|
2453
|
+
);
|
|
2454
|
+
if (functionStarNode && functionStarNode.parent) {
|
|
2455
|
+
const effectGenNode = functionStarNode.parent;
|
|
2456
|
+
const maybeUnnecessaryGen = yield* option(
|
|
2457
|
+
effectGen(effectGenNode)
|
|
2458
|
+
);
|
|
2459
|
+
if (isSome2(maybeUnnecessaryGen)) {
|
|
2460
|
+
unnecessaryGenerators.set(maybeUnnecessaryGen.value.node, maybeUnnecessaryYield.value);
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
4106
2463
|
}
|
|
4107
2464
|
}
|
|
4108
2465
|
unnecessaryGenerators.forEach(
|
|
4109
|
-
(
|
|
4110
|
-
node,
|
|
2466
|
+
(yieldedResult, effectGenCall) => effectDiagnostics.push({
|
|
2467
|
+
node: effectGenCall,
|
|
4111
2468
|
category: ts.DiagnosticCategory.Suggestion,
|
|
4112
2469
|
messageText: `This Effect.gen is useless here because it only contains a single return statement.`,
|
|
4113
2470
|
fixes: [{
|
|
@@ -4117,7 +2474,7 @@ var unnecessaryEffectGen = createDiagnostic({
|
|
|
4117
2474
|
const textChanges = yield* service(
|
|
4118
2475
|
ChangeTracker
|
|
4119
2476
|
);
|
|
4120
|
-
textChanges.replaceNode(sourceFile,
|
|
2477
|
+
textChanges.replaceNode(sourceFile, effectGenCall, yieldedResult);
|
|
4121
2478
|
})
|
|
4122
2479
|
}]
|
|
4123
2480
|
})
|
|
@@ -4216,7 +2573,7 @@ var asyncAwaitToGen = createRefactor({
|
|
|
4216
2573
|
),
|
|
4217
2574
|
head
|
|
4218
2575
|
);
|
|
4219
|
-
if (isNone2(maybeNode)) return yield*
|
|
2576
|
+
if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
|
|
4220
2577
|
const node = maybeNode.value;
|
|
4221
2578
|
return {
|
|
4222
2579
|
kind: "refactor.rewrite.effect.asyncAwaitToGen",
|
|
@@ -4231,7 +2588,7 @@ var asyncAwaitToGen = createRefactor({
|
|
|
4231
2588
|
(node2) => pipe(
|
|
4232
2589
|
importedEffectModule(node2),
|
|
4233
2590
|
option,
|
|
4234
|
-
|
|
2591
|
+
map3(isSome2)
|
|
4235
2592
|
)
|
|
4236
2593
|
)
|
|
4237
2594
|
),
|
|
@@ -4288,7 +2645,7 @@ var asyncAwaitToGenTryPromise = createRefactor({
|
|
|
4288
2645
|
),
|
|
4289
2646
|
head
|
|
4290
2647
|
);
|
|
4291
|
-
if (isNone2(maybeNode)) return yield*
|
|
2648
|
+
if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
|
|
4292
2649
|
const node = maybeNode.value;
|
|
4293
2650
|
return {
|
|
4294
2651
|
kind: "refactor.rewrite.effect.asyncAwaitToGenTryPromise",
|
|
@@ -4303,7 +2660,7 @@ var asyncAwaitToGenTryPromise = createRefactor({
|
|
|
4303
2660
|
(node2) => pipe(
|
|
4304
2661
|
importedEffectModule(node2),
|
|
4305
2662
|
option,
|
|
4306
|
-
|
|
2663
|
+
map3(isSome2)
|
|
4307
2664
|
)
|
|
4308
2665
|
)
|
|
4309
2666
|
),
|
|
@@ -4401,7 +2758,7 @@ var effectGenToFn = createRefactor({
|
|
|
4401
2758
|
}
|
|
4402
2759
|
break;
|
|
4403
2760
|
}
|
|
4404
|
-
return yield*
|
|
2761
|
+
return yield* fail(new RefactorNotApplicableError());
|
|
4405
2762
|
});
|
|
4406
2763
|
}
|
|
4407
2764
|
const maybeNode = yield* pipe(
|
|
@@ -4410,7 +2767,7 @@ var effectGenToFn = createRefactor({
|
|
|
4410
2767
|
firstSuccessOf,
|
|
4411
2768
|
option
|
|
4412
2769
|
);
|
|
4413
|
-
if (isNone2(maybeNode)) return yield*
|
|
2770
|
+
if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
|
|
4414
2771
|
const { effectModule, generatorFunction, nodeToReplace, pipeArgs } = maybeNode.value;
|
|
4415
2772
|
return {
|
|
4416
2773
|
kind: "refactor.rewrite.effect.effectGenToFn",
|
|
@@ -4467,7 +2824,7 @@ var functionToArrow = createRefactor({
|
|
|
4467
2824
|
filter((_) => !!_.name && isNodeInRange(textRange)(_.name)),
|
|
4468
2825
|
head
|
|
4469
2826
|
);
|
|
4470
|
-
if (isNone2(maybeNode)) return yield*
|
|
2827
|
+
if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
|
|
4471
2828
|
const node = maybeNode.value;
|
|
4472
2829
|
return {
|
|
4473
2830
|
kind: "refactor.rewrite.effect.functionToArrow",
|
|
@@ -4580,7 +2937,7 @@ var pipeableToDatafirst = createRefactor({
|
|
|
4580
2937
|
map2((_) => _.value),
|
|
4581
2938
|
head
|
|
4582
2939
|
);
|
|
4583
|
-
if (isNone2(maybeNode)) return yield*
|
|
2940
|
+
if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
|
|
4584
2941
|
const [node, newNode] = maybeNode.value;
|
|
4585
2942
|
return {
|
|
4586
2943
|
kind: "refactor.rewrite.effect.pipeableToDatafirst",
|
|
@@ -4601,7 +2958,7 @@ var removeUnnecessaryEffectGen = createRefactor({
|
|
|
4601
2958
|
for (const nodeToReplace of yield* getAncestorNodesInRange(sourceFile, textRange)) {
|
|
4602
2959
|
const maybeNode = yield* pipe(
|
|
4603
2960
|
effectGen(nodeToReplace),
|
|
4604
|
-
|
|
2961
|
+
flatMap3(({ body }) => returnYieldEffectBlock(body)),
|
|
4605
2962
|
option
|
|
4606
2963
|
);
|
|
4607
2964
|
if (isNone2(maybeNode)) continue;
|
|
@@ -4615,7 +2972,7 @@ var removeUnnecessaryEffectGen = createRefactor({
|
|
|
4615
2972
|
})
|
|
4616
2973
|
};
|
|
4617
2974
|
}
|
|
4618
|
-
return yield*
|
|
2975
|
+
return yield* fail(new RefactorNotApplicableError());
|
|
4619
2976
|
})
|
|
4620
2977
|
});
|
|
4621
2978
|
|
|
@@ -4634,7 +2991,7 @@ var toggleLazyConst = createRefactor({
|
|
|
4634
2991
|
),
|
|
4635
2992
|
head
|
|
4636
2993
|
);
|
|
4637
|
-
if (isNone2(maybeNode)) return yield*
|
|
2994
|
+
if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
|
|
4638
2995
|
const node = maybeNode.value;
|
|
4639
2996
|
return {
|
|
4640
2997
|
kind: "refactor.rewrite.effect.toggleLazyConst",
|
|
@@ -4673,7 +3030,7 @@ var toggleReturnTypeAnnotation = createRefactor({
|
|
|
4673
3030
|
),
|
|
4674
3031
|
head
|
|
4675
3032
|
);
|
|
4676
|
-
if (isNone2(maybeNode)) return yield*
|
|
3033
|
+
if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
|
|
4677
3034
|
const node = maybeNode.value;
|
|
4678
3035
|
if (node.type) {
|
|
4679
3036
|
return {
|
|
@@ -4686,13 +3043,13 @@ var toggleReturnTypeAnnotation = createRefactor({
|
|
|
4686
3043
|
};
|
|
4687
3044
|
}
|
|
4688
3045
|
const returnType = yield* option(getInferredReturnType(node));
|
|
4689
|
-
if (isNone2(returnType)) return yield*
|
|
3046
|
+
if (isNone2(returnType)) return yield* fail(new RefactorNotApplicableError());
|
|
4690
3047
|
const returnTypeNode = typeChecker.typeToTypeNode(
|
|
4691
3048
|
returnType.value,
|
|
4692
3049
|
node,
|
|
4693
3050
|
ts.NodeBuilderFlags.NoTruncation
|
|
4694
3051
|
);
|
|
4695
|
-
if (!returnTypeNode) return yield*
|
|
3052
|
+
if (!returnTypeNode) return yield* fail(new RefactorNotApplicableError());
|
|
4696
3053
|
return {
|
|
4697
3054
|
kind: "refactor.rewrite.effect.toggleReturnTypeAnnotation",
|
|
4698
3055
|
description: "Toggle return type annotation",
|
|
@@ -4725,7 +3082,7 @@ var toggleTypeAnnotation = createRefactor({
|
|
|
4725
3082
|
filter((node2) => !!node2.initializer),
|
|
4726
3083
|
head
|
|
4727
3084
|
);
|
|
4728
|
-
if (isNone2(maybeNode)) return yield*
|
|
3085
|
+
if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
|
|
4729
3086
|
const node = maybeNode.value;
|
|
4730
3087
|
return {
|
|
4731
3088
|
kind: "refactor.rewrite.effect.toggleTypeAnnotation",
|
|
@@ -4770,13 +3127,72 @@ var toggleTypeAnnotation = createRefactor({
|
|
|
4770
3127
|
})
|
|
4771
3128
|
});
|
|
4772
3129
|
|
|
3130
|
+
// src/refactors/wrapWithEffectGen.ts
|
|
3131
|
+
var wrapWithEffectGen = createRefactor({
|
|
3132
|
+
name: "effect/wrapWithEffectGen",
|
|
3133
|
+
description: "Wrap with Effect.gen",
|
|
3134
|
+
apply: (sourceFile, textRange) => gen2(function* () {
|
|
3135
|
+
const ts = yield* service(TypeScriptApi);
|
|
3136
|
+
const typeChecker = yield* service(TypeCheckerApi);
|
|
3137
|
+
const findEffectToWrap = fn("findEffectToWrap")(function* (node2) {
|
|
3138
|
+
if (!ts.isExpression(node2)) return yield* fail("is not an expression");
|
|
3139
|
+
const parent = node2.parent;
|
|
3140
|
+
if (parent != null && ts.isVariableDeclaration(parent) && parent.initializer !== node2) return yield* fail("is LHS of variable declaration");
|
|
3141
|
+
const type = typeChecker.getTypeAtLocation(node2);
|
|
3142
|
+
yield* effectType(type, node2);
|
|
3143
|
+
return node2;
|
|
3144
|
+
});
|
|
3145
|
+
const maybeNode = yield* pipe(
|
|
3146
|
+
yield* getAncestorNodesInRange(sourceFile, textRange),
|
|
3147
|
+
map2(findEffectToWrap),
|
|
3148
|
+
firstSuccessOf,
|
|
3149
|
+
option
|
|
3150
|
+
);
|
|
3151
|
+
if (isNone2(maybeNode)) return yield* fail(new RefactorNotApplicableError());
|
|
3152
|
+
const node = maybeNode.value;
|
|
3153
|
+
if (!ts.isExpression(node)) return yield* fail(new RefactorNotApplicableError());
|
|
3154
|
+
const effectGen2 = yield* createEffectGenCallExpressionWithBlock(
|
|
3155
|
+
yield* getEffectModuleIdentifierName(sourceFile),
|
|
3156
|
+
yield* createReturnYieldStarStatement(node)
|
|
3157
|
+
);
|
|
3158
|
+
return {
|
|
3159
|
+
kind: "refactor.rewrite.effect.wrapWithEffectGen",
|
|
3160
|
+
description: `Wrap with Effect.gen`,
|
|
3161
|
+
apply: gen2(function* () {
|
|
3162
|
+
const changeTracker = yield* service(ChangeTracker);
|
|
3163
|
+
changeTracker.replaceNode(sourceFile, node, effectGen2);
|
|
3164
|
+
})
|
|
3165
|
+
};
|
|
3166
|
+
})
|
|
3167
|
+
});
|
|
3168
|
+
var getEffectModuleIdentifierName = fn("getEffectModuleIdentifierName")(
|
|
3169
|
+
function* (sourceFile) {
|
|
3170
|
+
return match2(
|
|
3171
|
+
yield* option(
|
|
3172
|
+
findImportedModuleIdentifier(
|
|
3173
|
+
sourceFile,
|
|
3174
|
+
(node) => pipe(
|
|
3175
|
+
importedEffectModule(node),
|
|
3176
|
+
option,
|
|
3177
|
+
map3(isSome2)
|
|
3178
|
+
)
|
|
3179
|
+
)
|
|
3180
|
+
),
|
|
3181
|
+
{
|
|
3182
|
+
onNone: () => "Effect",
|
|
3183
|
+
onSome: (node) => node.text
|
|
3184
|
+
}
|
|
3185
|
+
);
|
|
3186
|
+
}
|
|
3187
|
+
);
|
|
3188
|
+
|
|
4773
3189
|
// src/refactors/wrapWithPipe.ts
|
|
4774
3190
|
var wrapWithPipe = createRefactor({
|
|
4775
3191
|
name: "effect/wrapWithPipe",
|
|
4776
3192
|
description: "Wrap with pipe",
|
|
4777
3193
|
apply: (sourceFile, textRange) => gen2(function* () {
|
|
4778
3194
|
if (textRange.end - textRange.pos === 0) {
|
|
4779
|
-
return yield*
|
|
3195
|
+
return yield* fail(new RefactorNotApplicableError());
|
|
4780
3196
|
}
|
|
4781
3197
|
return {
|
|
4782
3198
|
kind: "refactor.rewrite.effect.wrapWithPipe",
|
|
@@ -4800,6 +3216,7 @@ var refactors = [
|
|
|
4800
3216
|
toggleLazyConst,
|
|
4801
3217
|
toggleReturnTypeAnnotation,
|
|
4802
3218
|
toggleTypeAnnotation,
|
|
3219
|
+
wrapWithEffectGen,
|
|
4803
3220
|
wrapWithPipe,
|
|
4804
3221
|
effectGenToFn
|
|
4805
3222
|
];
|