@effect/language-service 0.63.2 → 0.64.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -0
- package/cli.js +1250 -402
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +424 -62
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +452 -77
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +424 -62
- package/transform.js.map +1 -1
package/cli.js
CHANGED
|
@@ -906,7 +906,7 @@ var require_dist = __commonJS({
|
|
|
906
906
|
o[k2] = m[k];
|
|
907
907
|
}));
|
|
908
908
|
var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
909
|
-
for (var
|
|
909
|
+
for (var p3 in m) if (p3 !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p3)) __createBinding(exports3, m, p3);
|
|
910
910
|
};
|
|
911
911
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
912
912
|
__exportStar(require_compilerOptions(), exports2);
|
|
@@ -942,7 +942,7 @@ var require_createProjectService = __commonJS({
|
|
|
942
942
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
943
943
|
};
|
|
944
944
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
945
|
-
exports2.createProjectService =
|
|
945
|
+
exports2.createProjectService = createProjectService4;
|
|
946
946
|
var debug_1 = __importDefault(require_src());
|
|
947
947
|
var getParsedConfigFileFromTSServer_js_1 = require_getParsedConfigFileFromTSServer();
|
|
948
948
|
var DEFAULT_PROJECT_MATCHED_FILES_THRESHOLD = 8;
|
|
@@ -956,7 +956,7 @@ var require_createProjectService = __commonJS({
|
|
|
956
956
|
var createStubFileWatcher = () => ({
|
|
957
957
|
close: doNothing
|
|
958
958
|
});
|
|
959
|
-
function
|
|
959
|
+
function createProjectService4({ jsDocParsingMode, options: optionsRaw = {}, tsconfigRootDir } = {}) {
|
|
960
960
|
const options3 = {
|
|
961
961
|
defaultProject: "tsconfig.json",
|
|
962
962
|
...optionsRaw
|
|
@@ -1071,7 +1071,7 @@ var require_dist2 = __commonJS({
|
|
|
1071
1071
|
o[k2] = m[k];
|
|
1072
1072
|
}));
|
|
1073
1073
|
var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
1074
|
-
for (var
|
|
1074
|
+
for (var p3 in m) if (p3 !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p3)) __createBinding(exports3, m, p3);
|
|
1075
1075
|
};
|
|
1076
1076
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1077
1077
|
__exportStar(require_createProjectService(), exports2);
|
|
@@ -2127,6 +2127,13 @@ var make2 = (compare2) => (self, that) => self === that ? 0 : compare2(self, tha
|
|
|
2127
2127
|
var string2 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
|
|
2128
2128
|
var number3 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
|
|
2129
2129
|
var boolean = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
|
|
2130
|
+
var combine2 = /* @__PURE__ */ dual(2, (self, that) => make2((a1, a2) => {
|
|
2131
|
+
const out = self(a1, a2);
|
|
2132
|
+
if (out !== 0) {
|
|
2133
|
+
return out;
|
|
2134
|
+
}
|
|
2135
|
+
return that(a1, a2);
|
|
2136
|
+
}));
|
|
2130
2137
|
var mapInput2 = /* @__PURE__ */ dual(2, (self, f) => make2((b1, b2) => self(f(b1), f(b2))));
|
|
2131
2138
|
var greaterThan = (O) => dual(2, (self, that) => O(self, that) === 1);
|
|
2132
2139
|
|
|
@@ -3366,10 +3373,10 @@ function expand(edit, frag, child, bitmap, subNodes) {
|
|
|
3366
3373
|
arr[frag] = child;
|
|
3367
3374
|
return new ArrayNode(edit, count4 + 1, arr);
|
|
3368
3375
|
}
|
|
3369
|
-
function mergeLeavesInner(edit, shift2, h12, n1,
|
|
3370
|
-
if (h12 ===
|
|
3376
|
+
function mergeLeavesInner(edit, shift2, h12, n1, h22, n2) {
|
|
3377
|
+
if (h12 === h22) return new CollisionNode(edit, h12, [n2, n1]);
|
|
3371
3378
|
const subH1 = hashFragment(shift2, h12);
|
|
3372
|
-
const subH2 = hashFragment(shift2,
|
|
3379
|
+
const subH2 = hashFragment(shift2, h22);
|
|
3373
3380
|
if (subH1 === subH2) {
|
|
3374
3381
|
return (child) => new IndexedNode(edit, toBitmap(subH1) | toBitmap(subH2), [child]);
|
|
3375
3382
|
} else {
|
|
@@ -3377,11 +3384,11 @@ function mergeLeavesInner(edit, shift2, h12, n1, h2, n2) {
|
|
|
3377
3384
|
return new IndexedNode(edit, toBitmap(subH1) | toBitmap(subH2), children2);
|
|
3378
3385
|
}
|
|
3379
3386
|
}
|
|
3380
|
-
function mergeLeaves(edit, shift2, h12, n1,
|
|
3387
|
+
function mergeLeaves(edit, shift2, h12, n1, h22, n2) {
|
|
3381
3388
|
let stack = void 0;
|
|
3382
3389
|
let currentShift = shift2;
|
|
3383
3390
|
while (true) {
|
|
3384
|
-
const res = mergeLeavesInner(edit, currentShift, h12, n1,
|
|
3391
|
+
const res = mergeLeavesInner(edit, currentShift, h12, n1, h22, n2);
|
|
3385
3392
|
if (typeof res === "function") {
|
|
3386
3393
|
stack = make8(res, stack);
|
|
3387
3394
|
currentShift = currentShift + SIZE;
|
|
@@ -3851,6 +3858,7 @@ var isEmpty3 = (self) => {
|
|
|
3851
3858
|
}
|
|
3852
3859
|
});
|
|
3853
3860
|
};
|
|
3861
|
+
var isDie = (self) => isSome2(dieOption(self));
|
|
3854
3862
|
var isInterrupted = (self) => isSome2(interruptOption(self));
|
|
3855
3863
|
var isInterruptedOnly = (self) => reduceWithContext(void 0, IsInterruptedOnlyCauseReducer)(self);
|
|
3856
3864
|
var failures = (self) => reverse2(reduce6(self, empty5(), (list4, cause2) => cause2._tag === OP_FAIL ? some2(pipe(list4, prepend2(cause2.error))) : none2()));
|
|
@@ -3868,6 +3876,7 @@ var failureOrCause = (self) => {
|
|
|
3868
3876
|
}
|
|
3869
3877
|
}
|
|
3870
3878
|
};
|
|
3879
|
+
var dieOption = (self) => find(self, (cause2) => cause2._tag === OP_DIE ? some2(cause2.defect) : none2());
|
|
3871
3880
|
var flipCauseOption = (self) => match4(self, {
|
|
3872
3881
|
onEmpty: some2(empty9),
|
|
3873
3882
|
onFail: map2(fail),
|
|
@@ -4721,7 +4730,7 @@ var composite = (left3, right3) => {
|
|
|
4721
4730
|
return new Composite(left3, right3);
|
|
4722
4731
|
};
|
|
4723
4732
|
var isFiberId = (self) => hasProperty(self, FiberIdTypeId);
|
|
4724
|
-
var
|
|
4733
|
+
var combine3 = /* @__PURE__ */ dual(2, (self, that) => {
|
|
4725
4734
|
if (self._tag === OP_NONE) {
|
|
4726
4735
|
return that;
|
|
4727
4736
|
}
|
|
@@ -4731,7 +4740,7 @@ var combine2 = /* @__PURE__ */ dual(2, (self, that) => {
|
|
|
4731
4740
|
return new Composite(self, that);
|
|
4732
4741
|
});
|
|
4733
4742
|
var combineAll = (fiberIds) => {
|
|
4734
|
-
return pipe(fiberIds, reduce5(none3, (a, b) =>
|
|
4743
|
+
return pipe(fiberIds, reduce5(none3, (a, b) => combine3(b)(a)));
|
|
4735
4744
|
};
|
|
4736
4745
|
var ids = (self) => {
|
|
4737
4746
|
switch (self._tag) {
|
|
@@ -4764,7 +4773,7 @@ var unsafeMake = () => {
|
|
|
4764
4773
|
var none4 = none3;
|
|
4765
4774
|
var runtime2 = runtime;
|
|
4766
4775
|
var composite2 = composite;
|
|
4767
|
-
var
|
|
4776
|
+
var combine4 = combine3;
|
|
4768
4777
|
var combineAll2 = combineAll;
|
|
4769
4778
|
var ids2 = ids;
|
|
4770
4779
|
var make15 = make14;
|
|
@@ -5020,19 +5029,19 @@ var diff = (oldValue, newValue) => {
|
|
|
5020
5029
|
const old = missingServices.get(tag4);
|
|
5021
5030
|
missingServices.delete(tag4);
|
|
5022
5031
|
if (!equals(old, newService)) {
|
|
5023
|
-
patch10 =
|
|
5032
|
+
patch10 = combine5(makeUpdateService(tag4, () => newService))(patch10);
|
|
5024
5033
|
}
|
|
5025
5034
|
} else {
|
|
5026
5035
|
missingServices.delete(tag4);
|
|
5027
|
-
patch10 =
|
|
5036
|
+
patch10 = combine5(makeAddService(tag4, newService))(patch10);
|
|
5028
5037
|
}
|
|
5029
5038
|
}
|
|
5030
5039
|
for (const [tag4] of missingServices.entries()) {
|
|
5031
|
-
patch10 =
|
|
5040
|
+
patch10 = combine5(makeRemoveService(tag4))(patch10);
|
|
5032
5041
|
}
|
|
5033
5042
|
return patch10;
|
|
5034
5043
|
};
|
|
5035
|
-
var
|
|
5044
|
+
var combine5 = /* @__PURE__ */ dual(2, (self, that) => makeAndThen(self, that));
|
|
5036
5045
|
var patch = /* @__PURE__ */ dual(2, (self, context7) => {
|
|
5037
5046
|
if (self._tag === "Empty") {
|
|
5038
5047
|
return context7;
|
|
@@ -5134,11 +5143,11 @@ var diff2 = (oldValue, newValue) => {
|
|
|
5134
5143
|
if (has3(value5)(set7)) {
|
|
5135
5144
|
return [remove4(value5)(set7), patch11];
|
|
5136
5145
|
}
|
|
5137
|
-
return [set7,
|
|
5146
|
+
return [set7, combine6(makeAdd(value5))(patch11)];
|
|
5138
5147
|
})(newValue);
|
|
5139
|
-
return reduce5(patch10, (patch11, value5) =>
|
|
5148
|
+
return reduce5(patch10, (patch11, value5) => combine6(makeRemove(value5))(patch11))(removed);
|
|
5140
5149
|
};
|
|
5141
|
-
var
|
|
5150
|
+
var combine6 = /* @__PURE__ */ dual(2, (self, that) => makeAndThen2(self, that));
|
|
5142
5151
|
var patch2 = /* @__PURE__ */ dual(2, (self, oldValue) => {
|
|
5143
5152
|
if (self._tag === "Empty") {
|
|
5144
5153
|
return oldValue;
|
|
@@ -5231,19 +5240,19 @@ var diff3 = (options3) => {
|
|
|
5231
5240
|
const newElement = options3.newValue[i];
|
|
5232
5241
|
const valuePatch = options3.differ.diff(oldElement, newElement);
|
|
5233
5242
|
if (!equals(valuePatch, options3.differ.empty)) {
|
|
5234
|
-
patch10 =
|
|
5243
|
+
patch10 = combine7(patch10, makeUpdate(i, valuePatch));
|
|
5235
5244
|
}
|
|
5236
5245
|
i = i + 1;
|
|
5237
5246
|
}
|
|
5238
5247
|
if (i < options3.oldValue.length) {
|
|
5239
|
-
patch10 =
|
|
5248
|
+
patch10 = combine7(patch10, makeSlice(0, i));
|
|
5240
5249
|
}
|
|
5241
5250
|
if (i < options3.newValue.length) {
|
|
5242
|
-
patch10 =
|
|
5251
|
+
patch10 = combine7(patch10, makeAppend(drop(i)(options3.newValue)));
|
|
5243
5252
|
}
|
|
5244
5253
|
return patch10;
|
|
5245
5254
|
};
|
|
5246
|
-
var
|
|
5255
|
+
var combine7 = /* @__PURE__ */ dual(2, (self, that) => makeAndThen3(self, that));
|
|
5247
5256
|
var patch3 = /* @__PURE__ */ dual(3, (self, oldValue, differ3) => {
|
|
5248
5257
|
if (self._tag === "Empty") {
|
|
5249
5258
|
return oldValue;
|
|
@@ -5306,19 +5315,19 @@ var make17 = (params) => {
|
|
|
5306
5315
|
};
|
|
5307
5316
|
var environment = () => make17({
|
|
5308
5317
|
empty: empty12(),
|
|
5309
|
-
combine: (first3, second) =>
|
|
5318
|
+
combine: (first3, second) => combine5(second)(first3),
|
|
5310
5319
|
diff: (oldValue, newValue) => diff(oldValue, newValue),
|
|
5311
5320
|
patch: (patch10, oldValue) => patch(oldValue)(patch10)
|
|
5312
5321
|
});
|
|
5313
5322
|
var hashSet = () => make17({
|
|
5314
5323
|
empty: empty13(),
|
|
5315
|
-
combine: (first3, second) =>
|
|
5324
|
+
combine: (first3, second) => combine6(second)(first3),
|
|
5316
5325
|
diff: (oldValue, newValue) => diff2(oldValue, newValue),
|
|
5317
5326
|
patch: (patch10, oldValue) => patch2(oldValue)(patch10)
|
|
5318
5327
|
});
|
|
5319
5328
|
var readonlyArray = (differ3) => make17({
|
|
5320
5329
|
empty: empty14(),
|
|
5321
|
-
combine: (first3, second) =>
|
|
5330
|
+
combine: (first3, second) => combine7(first3, second),
|
|
5322
5331
|
diff: (oldValue, newValue) => diff3({
|
|
5323
5332
|
oldValue,
|
|
5324
5333
|
newValue,
|
|
@@ -5889,17 +5898,17 @@ var originalSymbol = /* @__PURE__ */ Symbol.for("effect/OriginalAnnotation");
|
|
|
5889
5898
|
var capture = (obj, span2) => {
|
|
5890
5899
|
if (isSome2(span2)) {
|
|
5891
5900
|
return new Proxy(obj, {
|
|
5892
|
-
has(target,
|
|
5893
|
-
return
|
|
5901
|
+
has(target, p3) {
|
|
5902
|
+
return p3 === spanSymbol || p3 === originalSymbol || p3 in target;
|
|
5894
5903
|
},
|
|
5895
|
-
get(target,
|
|
5896
|
-
if (
|
|
5904
|
+
get(target, p3) {
|
|
5905
|
+
if (p3 === spanSymbol) {
|
|
5897
5906
|
return span2.value;
|
|
5898
5907
|
}
|
|
5899
|
-
if (
|
|
5908
|
+
if (p3 === originalSymbol) {
|
|
5900
5909
|
return obj;
|
|
5901
5910
|
}
|
|
5902
|
-
return target[
|
|
5911
|
+
return target[p3];
|
|
5903
5912
|
}
|
|
5904
5913
|
});
|
|
5905
5914
|
}
|
|
@@ -7774,14 +7783,14 @@ var diff5 = (oldValue, newValue) => {
|
|
|
7774
7783
|
if (old !== void 0) {
|
|
7775
7784
|
const oldValue2 = headNonEmpty(old)[1];
|
|
7776
7785
|
if (!equals(oldValue2, newValue2)) {
|
|
7777
|
-
patch10 =
|
|
7786
|
+
patch10 = combine8({
|
|
7778
7787
|
_tag: OP_UPDATE,
|
|
7779
7788
|
fiberRef,
|
|
7780
7789
|
patch: fiberRef.diff(oldValue2, newValue2)
|
|
7781
7790
|
})(patch10);
|
|
7782
7791
|
}
|
|
7783
7792
|
} else {
|
|
7784
|
-
patch10 =
|
|
7793
|
+
patch10 = combine8({
|
|
7785
7794
|
_tag: OP_ADD,
|
|
7786
7795
|
fiberRef,
|
|
7787
7796
|
value: newValue2
|
|
@@ -7790,14 +7799,14 @@ var diff5 = (oldValue, newValue) => {
|
|
|
7790
7799
|
missingLocals.delete(fiberRef);
|
|
7791
7800
|
}
|
|
7792
7801
|
for (const [fiberRef] of missingLocals.entries()) {
|
|
7793
|
-
patch10 =
|
|
7802
|
+
patch10 = combine8({
|
|
7794
7803
|
_tag: OP_REMOVE,
|
|
7795
7804
|
fiberRef
|
|
7796
7805
|
})(patch10);
|
|
7797
7806
|
}
|
|
7798
7807
|
return patch10;
|
|
7799
7808
|
};
|
|
7800
|
-
var
|
|
7809
|
+
var combine8 = /* @__PURE__ */ dual(2, (self, that) => ({
|
|
7801
7810
|
_tag: OP_AND_THEN,
|
|
7802
7811
|
first: self,
|
|
7803
7812
|
second: that
|
|
@@ -8968,7 +8977,7 @@ var diffFiberRefs = (self) => summarized(self, fiberRefs2, diff5);
|
|
|
8968
8977
|
var bind2 = /* @__PURE__ */ bind(map11, flatMap7);
|
|
8969
8978
|
var bindTo2 = /* @__PURE__ */ bindTo(map11);
|
|
8970
8979
|
var filterOrDieMessage = /* @__PURE__ */ dual(3, (self, predicate, message) => filterOrElse(self, predicate, () => dieMessage(message)));
|
|
8971
|
-
var filterOrElse = /* @__PURE__ */ dual(3, (self, predicate,
|
|
8980
|
+
var filterOrElse = /* @__PURE__ */ dual(3, (self, predicate, orElse16) => flatMap7(self, (a) => predicate(a) ? succeed(a) : orElse16(a)));
|
|
8972
8981
|
var match8 = /* @__PURE__ */ dual(2, (self, options3) => matchEffect(self, {
|
|
8973
8982
|
onFailure: (e) => succeed(options3.onFailure(e)),
|
|
8974
8983
|
onSuccess: (a) => succeed(options3.onSuccess(a))
|
|
@@ -10806,35 +10815,35 @@ var insert = /* @__PURE__ */ dual(3, (self, key, value5) => {
|
|
|
10806
10815
|
}
|
|
10807
10816
|
}
|
|
10808
10817
|
for (let s = n_stack.length - 1; s > 1; --s) {
|
|
10809
|
-
const
|
|
10818
|
+
const p3 = n_stack[s - 1];
|
|
10810
10819
|
const n3 = n_stack[s];
|
|
10811
|
-
if (
|
|
10820
|
+
if (p3.color === Color.Black || n3.color === Color.Black) {
|
|
10812
10821
|
break;
|
|
10813
10822
|
}
|
|
10814
10823
|
const pp = n_stack[s - 2];
|
|
10815
|
-
if (pp.left ===
|
|
10816
|
-
if (
|
|
10824
|
+
if (pp.left === p3) {
|
|
10825
|
+
if (p3.left === n3) {
|
|
10817
10826
|
const y = pp.right;
|
|
10818
10827
|
if (y && y.color === Color.Red) {
|
|
10819
|
-
|
|
10828
|
+
p3.color = Color.Black;
|
|
10820
10829
|
pp.right = repaint(y, Color.Black);
|
|
10821
10830
|
pp.color = Color.Red;
|
|
10822
10831
|
s -= 1;
|
|
10823
10832
|
} else {
|
|
10824
10833
|
pp.color = Color.Red;
|
|
10825
|
-
pp.left =
|
|
10826
|
-
|
|
10827
|
-
|
|
10828
|
-
n_stack[s - 2] =
|
|
10834
|
+
pp.left = p3.right;
|
|
10835
|
+
p3.color = Color.Black;
|
|
10836
|
+
p3.right = pp;
|
|
10837
|
+
n_stack[s - 2] = p3;
|
|
10829
10838
|
n_stack[s - 1] = n3;
|
|
10830
10839
|
recount(pp);
|
|
10831
|
-
recount(
|
|
10840
|
+
recount(p3);
|
|
10832
10841
|
if (s >= 3) {
|
|
10833
10842
|
const ppp = n_stack[s - 3];
|
|
10834
10843
|
if (ppp.left === pp) {
|
|
10835
|
-
ppp.left =
|
|
10844
|
+
ppp.left = p3;
|
|
10836
10845
|
} else {
|
|
10837
|
-
ppp.right =
|
|
10846
|
+
ppp.right = p3;
|
|
10838
10847
|
}
|
|
10839
10848
|
}
|
|
10840
10849
|
break;
|
|
@@ -10842,21 +10851,21 @@ var insert = /* @__PURE__ */ dual(3, (self, key, value5) => {
|
|
|
10842
10851
|
} else {
|
|
10843
10852
|
const y = pp.right;
|
|
10844
10853
|
if (y && y.color === Color.Red) {
|
|
10845
|
-
|
|
10854
|
+
p3.color = Color.Black;
|
|
10846
10855
|
pp.right = repaint(y, Color.Black);
|
|
10847
10856
|
pp.color = Color.Red;
|
|
10848
10857
|
s -= 1;
|
|
10849
10858
|
} else {
|
|
10850
|
-
|
|
10859
|
+
p3.right = n3.left;
|
|
10851
10860
|
pp.color = Color.Red;
|
|
10852
10861
|
pp.left = n3.right;
|
|
10853
10862
|
n3.color = Color.Black;
|
|
10854
|
-
n3.left =
|
|
10863
|
+
n3.left = p3;
|
|
10855
10864
|
n3.right = pp;
|
|
10856
10865
|
n_stack[s - 2] = n3;
|
|
10857
|
-
n_stack[s - 1] =
|
|
10866
|
+
n_stack[s - 1] = p3;
|
|
10858
10867
|
recount(pp);
|
|
10859
|
-
recount(
|
|
10868
|
+
recount(p3);
|
|
10860
10869
|
recount(n3);
|
|
10861
10870
|
if (s >= 3) {
|
|
10862
10871
|
const ppp = n_stack[s - 3];
|
|
@@ -10870,28 +10879,28 @@ var insert = /* @__PURE__ */ dual(3, (self, key, value5) => {
|
|
|
10870
10879
|
}
|
|
10871
10880
|
}
|
|
10872
10881
|
} else {
|
|
10873
|
-
if (
|
|
10882
|
+
if (p3.right === n3) {
|
|
10874
10883
|
const y = pp.left;
|
|
10875
10884
|
if (y && y.color === Color.Red) {
|
|
10876
|
-
|
|
10885
|
+
p3.color = Color.Black;
|
|
10877
10886
|
pp.left = repaint(y, Color.Black);
|
|
10878
10887
|
pp.color = Color.Red;
|
|
10879
10888
|
s -= 1;
|
|
10880
10889
|
} else {
|
|
10881
10890
|
pp.color = Color.Red;
|
|
10882
|
-
pp.right =
|
|
10883
|
-
|
|
10884
|
-
|
|
10885
|
-
n_stack[s - 2] =
|
|
10891
|
+
pp.right = p3.left;
|
|
10892
|
+
p3.color = Color.Black;
|
|
10893
|
+
p3.left = pp;
|
|
10894
|
+
n_stack[s - 2] = p3;
|
|
10886
10895
|
n_stack[s - 1] = n3;
|
|
10887
10896
|
recount(pp);
|
|
10888
|
-
recount(
|
|
10897
|
+
recount(p3);
|
|
10889
10898
|
if (s >= 3) {
|
|
10890
10899
|
const ppp = n_stack[s - 3];
|
|
10891
10900
|
if (ppp.right === pp) {
|
|
10892
|
-
ppp.right =
|
|
10901
|
+
ppp.right = p3;
|
|
10893
10902
|
} else {
|
|
10894
|
-
ppp.left =
|
|
10903
|
+
ppp.left = p3;
|
|
10895
10904
|
}
|
|
10896
10905
|
}
|
|
10897
10906
|
break;
|
|
@@ -10899,21 +10908,21 @@ var insert = /* @__PURE__ */ dual(3, (self, key, value5) => {
|
|
|
10899
10908
|
} else {
|
|
10900
10909
|
const y = pp.left;
|
|
10901
10910
|
if (y && y.color === Color.Red) {
|
|
10902
|
-
|
|
10911
|
+
p3.color = Color.Black;
|
|
10903
10912
|
pp.left = repaint(y, Color.Black);
|
|
10904
10913
|
pp.color = Color.Red;
|
|
10905
10914
|
s -= 1;
|
|
10906
10915
|
} else {
|
|
10907
|
-
|
|
10916
|
+
p3.left = n3.right;
|
|
10908
10917
|
pp.color = Color.Red;
|
|
10909
10918
|
pp.right = n3.left;
|
|
10910
10919
|
n3.color = Color.Black;
|
|
10911
|
-
n3.right =
|
|
10920
|
+
n3.right = p3;
|
|
10912
10921
|
n3.left = pp;
|
|
10913
10922
|
n_stack[s - 2] = n3;
|
|
10914
|
-
n_stack[s - 1] =
|
|
10923
|
+
n_stack[s - 1] = p3;
|
|
10915
10924
|
recount(pp);
|
|
10916
|
-
recount(
|
|
10925
|
+
recount(p3);
|
|
10917
10926
|
recount(n3);
|
|
10918
10927
|
if (s >= 3) {
|
|
10919
10928
|
const ppp = n_stack[s - 3];
|
|
@@ -11050,11 +11059,11 @@ var removeFirst = /* @__PURE__ */ dual(2, (self, key) => {
|
|
|
11050
11059
|
}
|
|
11051
11060
|
n = cstack[cstack.length - 1];
|
|
11052
11061
|
if (n.color === Color.Red) {
|
|
11053
|
-
const
|
|
11054
|
-
if (
|
|
11055
|
-
|
|
11056
|
-
} else if (
|
|
11057
|
-
|
|
11062
|
+
const p3 = cstack[cstack.length - 2];
|
|
11063
|
+
if (p3.left === n) {
|
|
11064
|
+
p3.left = void 0;
|
|
11065
|
+
} else if (p3.right === n) {
|
|
11066
|
+
p3.right = void 0;
|
|
11058
11067
|
}
|
|
11059
11068
|
cstack.pop();
|
|
11060
11069
|
for (let i = 0; i < cstack.length; ++i) {
|
|
@@ -11091,31 +11100,31 @@ var removeFirst = /* @__PURE__ */ dual(2, (self, key) => {
|
|
|
11091
11100
|
return makeImpl3(ord, cstack[0]);
|
|
11092
11101
|
});
|
|
11093
11102
|
var fixDoubleBlack = (stack) => {
|
|
11094
|
-
let n,
|
|
11103
|
+
let n, p3, s, z;
|
|
11095
11104
|
for (let i = stack.length - 1; i >= 0; --i) {
|
|
11096
11105
|
n = stack[i];
|
|
11097
11106
|
if (i === 0) {
|
|
11098
11107
|
n.color = Color.Black;
|
|
11099
11108
|
return;
|
|
11100
11109
|
}
|
|
11101
|
-
|
|
11102
|
-
if (
|
|
11103
|
-
s =
|
|
11110
|
+
p3 = stack[i - 1];
|
|
11111
|
+
if (p3.left === n) {
|
|
11112
|
+
s = p3.right;
|
|
11104
11113
|
if (s !== void 0 && s.right !== void 0 && s.right.color === Color.Red) {
|
|
11105
|
-
s =
|
|
11114
|
+
s = p3.right = clone(s);
|
|
11106
11115
|
z = s.right = clone(s.right);
|
|
11107
|
-
|
|
11108
|
-
s.left =
|
|
11116
|
+
p3.right = s.left;
|
|
11117
|
+
s.left = p3;
|
|
11109
11118
|
s.right = z;
|
|
11110
|
-
s.color =
|
|
11119
|
+
s.color = p3.color;
|
|
11111
11120
|
n.color = Color.Black;
|
|
11112
|
-
|
|
11121
|
+
p3.color = Color.Black;
|
|
11113
11122
|
z.color = Color.Black;
|
|
11114
|
-
recount(
|
|
11123
|
+
recount(p3);
|
|
11115
11124
|
recount(s);
|
|
11116
11125
|
if (i > 1) {
|
|
11117
11126
|
const pp = stack[i - 2];
|
|
11118
|
-
if (pp.left ===
|
|
11127
|
+
if (pp.left === p3) {
|
|
11119
11128
|
pp.left = s;
|
|
11120
11129
|
} else {
|
|
11121
11130
|
pp.right = s;
|
|
@@ -11124,22 +11133,22 @@ var fixDoubleBlack = (stack) => {
|
|
|
11124
11133
|
stack[i - 1] = s;
|
|
11125
11134
|
return;
|
|
11126
11135
|
} else if (s !== void 0 && s.left !== void 0 && s.left.color === Color.Red) {
|
|
11127
|
-
s =
|
|
11136
|
+
s = p3.right = clone(s);
|
|
11128
11137
|
z = s.left = clone(s.left);
|
|
11129
|
-
|
|
11138
|
+
p3.right = z.left;
|
|
11130
11139
|
s.left = z.right;
|
|
11131
|
-
z.left =
|
|
11140
|
+
z.left = p3;
|
|
11132
11141
|
z.right = s;
|
|
11133
|
-
z.color =
|
|
11134
|
-
|
|
11142
|
+
z.color = p3.color;
|
|
11143
|
+
p3.color = Color.Black;
|
|
11135
11144
|
s.color = Color.Black;
|
|
11136
11145
|
n.color = Color.Black;
|
|
11137
|
-
recount(
|
|
11146
|
+
recount(p3);
|
|
11138
11147
|
recount(s);
|
|
11139
11148
|
recount(z);
|
|
11140
11149
|
if (i > 1) {
|
|
11141
11150
|
const pp = stack[i - 2];
|
|
11142
|
-
if (pp.left ===
|
|
11151
|
+
if (pp.left === p3) {
|
|
11143
11152
|
pp.left = z;
|
|
11144
11153
|
} else {
|
|
11145
11154
|
pp.right = z;
|
|
@@ -11149,32 +11158,32 @@ var fixDoubleBlack = (stack) => {
|
|
|
11149
11158
|
return;
|
|
11150
11159
|
}
|
|
11151
11160
|
if (s !== void 0 && s.color === Color.Black) {
|
|
11152
|
-
if (
|
|
11153
|
-
|
|
11154
|
-
|
|
11161
|
+
if (p3.color === Color.Red) {
|
|
11162
|
+
p3.color = Color.Black;
|
|
11163
|
+
p3.right = repaint(s, Color.Red);
|
|
11155
11164
|
return;
|
|
11156
11165
|
} else {
|
|
11157
|
-
|
|
11166
|
+
p3.right = repaint(s, Color.Red);
|
|
11158
11167
|
continue;
|
|
11159
11168
|
}
|
|
11160
11169
|
} else if (s !== void 0) {
|
|
11161
11170
|
s = clone(s);
|
|
11162
|
-
|
|
11163
|
-
s.left =
|
|
11164
|
-
s.color =
|
|
11165
|
-
|
|
11166
|
-
recount(
|
|
11171
|
+
p3.right = s.left;
|
|
11172
|
+
s.left = p3;
|
|
11173
|
+
s.color = p3.color;
|
|
11174
|
+
p3.color = Color.Red;
|
|
11175
|
+
recount(p3);
|
|
11167
11176
|
recount(s);
|
|
11168
11177
|
if (i > 1) {
|
|
11169
11178
|
const pp = stack[i - 2];
|
|
11170
|
-
if (pp.left ===
|
|
11179
|
+
if (pp.left === p3) {
|
|
11171
11180
|
pp.left = s;
|
|
11172
11181
|
} else {
|
|
11173
11182
|
pp.right = s;
|
|
11174
11183
|
}
|
|
11175
11184
|
}
|
|
11176
11185
|
stack[i - 1] = s;
|
|
11177
|
-
stack[i] =
|
|
11186
|
+
stack[i] = p3;
|
|
11178
11187
|
if (i + 1 < stack.length) {
|
|
11179
11188
|
stack[i + 1] = n;
|
|
11180
11189
|
} else {
|
|
@@ -11183,22 +11192,22 @@ var fixDoubleBlack = (stack) => {
|
|
|
11183
11192
|
i = i + 2;
|
|
11184
11193
|
}
|
|
11185
11194
|
} else {
|
|
11186
|
-
s =
|
|
11195
|
+
s = p3.left;
|
|
11187
11196
|
if (s !== void 0 && s.left !== void 0 && s.left.color === Color.Red) {
|
|
11188
|
-
s =
|
|
11197
|
+
s = p3.left = clone(s);
|
|
11189
11198
|
z = s.left = clone(s.left);
|
|
11190
|
-
|
|
11191
|
-
s.right =
|
|
11199
|
+
p3.left = s.right;
|
|
11200
|
+
s.right = p3;
|
|
11192
11201
|
s.left = z;
|
|
11193
|
-
s.color =
|
|
11202
|
+
s.color = p3.color;
|
|
11194
11203
|
n.color = Color.Black;
|
|
11195
|
-
|
|
11204
|
+
p3.color = Color.Black;
|
|
11196
11205
|
z.color = Color.Black;
|
|
11197
|
-
recount(
|
|
11206
|
+
recount(p3);
|
|
11198
11207
|
recount(s);
|
|
11199
11208
|
if (i > 1) {
|
|
11200
11209
|
const pp = stack[i - 2];
|
|
11201
|
-
if (pp.right ===
|
|
11210
|
+
if (pp.right === p3) {
|
|
11202
11211
|
pp.right = s;
|
|
11203
11212
|
} else {
|
|
11204
11213
|
pp.left = s;
|
|
@@ -11207,22 +11216,22 @@ var fixDoubleBlack = (stack) => {
|
|
|
11207
11216
|
stack[i - 1] = s;
|
|
11208
11217
|
return;
|
|
11209
11218
|
} else if (s !== void 0 && s.right !== void 0 && s.right.color === Color.Red) {
|
|
11210
|
-
s =
|
|
11219
|
+
s = p3.left = clone(s);
|
|
11211
11220
|
z = s.right = clone(s.right);
|
|
11212
|
-
|
|
11221
|
+
p3.left = z.right;
|
|
11213
11222
|
s.right = z.left;
|
|
11214
|
-
z.right =
|
|
11223
|
+
z.right = p3;
|
|
11215
11224
|
z.left = s;
|
|
11216
|
-
z.color =
|
|
11217
|
-
|
|
11225
|
+
z.color = p3.color;
|
|
11226
|
+
p3.color = Color.Black;
|
|
11218
11227
|
s.color = Color.Black;
|
|
11219
11228
|
n.color = Color.Black;
|
|
11220
|
-
recount(
|
|
11229
|
+
recount(p3);
|
|
11221
11230
|
recount(s);
|
|
11222
11231
|
recount(z);
|
|
11223
11232
|
if (i > 1) {
|
|
11224
11233
|
const pp = stack[i - 2];
|
|
11225
|
-
if (pp.right ===
|
|
11234
|
+
if (pp.right === p3) {
|
|
11226
11235
|
pp.right = z;
|
|
11227
11236
|
} else {
|
|
11228
11237
|
pp.left = z;
|
|
@@ -11232,32 +11241,32 @@ var fixDoubleBlack = (stack) => {
|
|
|
11232
11241
|
return;
|
|
11233
11242
|
}
|
|
11234
11243
|
if (s !== void 0 && s.color === Color.Black) {
|
|
11235
|
-
if (
|
|
11236
|
-
|
|
11237
|
-
|
|
11244
|
+
if (p3.color === Color.Red) {
|
|
11245
|
+
p3.color = Color.Black;
|
|
11246
|
+
p3.left = repaint(s, Color.Red);
|
|
11238
11247
|
return;
|
|
11239
11248
|
} else {
|
|
11240
|
-
|
|
11249
|
+
p3.left = repaint(s, Color.Red);
|
|
11241
11250
|
continue;
|
|
11242
11251
|
}
|
|
11243
11252
|
} else if (s !== void 0) {
|
|
11244
11253
|
s = clone(s);
|
|
11245
|
-
|
|
11246
|
-
s.right =
|
|
11247
|
-
s.color =
|
|
11248
|
-
|
|
11249
|
-
recount(
|
|
11254
|
+
p3.left = s.right;
|
|
11255
|
+
s.right = p3;
|
|
11256
|
+
s.color = p3.color;
|
|
11257
|
+
p3.color = Color.Red;
|
|
11258
|
+
recount(p3);
|
|
11250
11259
|
recount(s);
|
|
11251
11260
|
if (i > 1) {
|
|
11252
11261
|
const pp = stack[i - 2];
|
|
11253
|
-
if (pp.right ===
|
|
11262
|
+
if (pp.right === p3) {
|
|
11254
11263
|
pp.right = s;
|
|
11255
11264
|
} else {
|
|
11256
11265
|
pp.left = s;
|
|
11257
11266
|
}
|
|
11258
11267
|
}
|
|
11259
11268
|
stack[i - 1] = s;
|
|
11260
|
-
stack[i] =
|
|
11269
|
+
stack[i] = p3;
|
|
11261
11270
|
if (i + 1 < stack.length) {
|
|
11262
11271
|
stack[i + 1] = n;
|
|
11263
11272
|
} else {
|
|
@@ -11499,7 +11508,7 @@ var OP_AND_THEN2 = "AndThen";
|
|
|
11499
11508
|
var empty23 = {
|
|
11500
11509
|
_tag: OP_EMPTY3
|
|
11501
11510
|
};
|
|
11502
|
-
var
|
|
11511
|
+
var combine9 = (self, that) => {
|
|
11503
11512
|
return {
|
|
11504
11513
|
_tag: OP_AND_THEN2,
|
|
11505
11514
|
first: self,
|
|
@@ -11565,20 +11574,20 @@ var diff7 = (oldValue, newValue) => {
|
|
|
11565
11574
|
}
|
|
11566
11575
|
const oldSupervisors = toSet2(oldValue);
|
|
11567
11576
|
const newSupervisors = toSet2(newValue);
|
|
11568
|
-
const added = pipe(newSupervisors, difference3(oldSupervisors), reduce5(empty23, (patch10, supervisor) =>
|
|
11577
|
+
const added = pipe(newSupervisors, difference3(oldSupervisors), reduce5(empty23, (patch10, supervisor) => combine9(patch10, {
|
|
11569
11578
|
_tag: OP_ADD_SUPERVISOR,
|
|
11570
11579
|
supervisor
|
|
11571
11580
|
})));
|
|
11572
|
-
const removed = pipe(oldSupervisors, difference3(newSupervisors), reduce5(empty23, (patch10, supervisor) =>
|
|
11581
|
+
const removed = pipe(oldSupervisors, difference3(newSupervisors), reduce5(empty23, (patch10, supervisor) => combine9(patch10, {
|
|
11573
11582
|
_tag: OP_REMOVE_SUPERVISOR,
|
|
11574
11583
|
supervisor
|
|
11575
11584
|
})));
|
|
11576
|
-
return
|
|
11585
|
+
return combine9(added, removed);
|
|
11577
11586
|
};
|
|
11578
11587
|
var differ2 = /* @__PURE__ */ make31({
|
|
11579
11588
|
empty: empty23,
|
|
11580
11589
|
patch: patch8,
|
|
11581
|
-
combine:
|
|
11590
|
+
combine: combine9,
|
|
11582
11591
|
diff: diff7
|
|
11583
11592
|
});
|
|
11584
11593
|
|
|
@@ -13174,7 +13183,7 @@ var raceFibersWith = /* @__PURE__ */ dual(3, (self, other, options3) => withFibe
|
|
|
13174
13183
|
rightFiber.addObserver(() => completeRace(rightFiber, leftFiber, options3.onOtherWin, raceIndicator, cb));
|
|
13175
13184
|
leftFiber.startFork(self);
|
|
13176
13185
|
rightFiber.startFork(other);
|
|
13177
|
-
},
|
|
13186
|
+
}, combine4(leftFiber.id(), rightFiber.id()));
|
|
13178
13187
|
}));
|
|
13179
13188
|
var completeRace = (winner, loser, cont, ab, cb) => {
|
|
13180
13189
|
if (compareAndSet(true, false)(ab)) {
|
|
@@ -13243,9 +13252,11 @@ var sequential4 = sequential;
|
|
|
13243
13252
|
var isCause2 = isCause;
|
|
13244
13253
|
var isFailType2 = isFailType;
|
|
13245
13254
|
var isDieType2 = isDieType;
|
|
13255
|
+
var isDie2 = isDie;
|
|
13246
13256
|
var isInterrupted2 = isInterrupted;
|
|
13247
13257
|
var isInterruptedOnly2 = isInterruptedOnly;
|
|
13248
13258
|
var interruptors2 = interruptors;
|
|
13259
|
+
var failureOption2 = failureOption;
|
|
13249
13260
|
var failureOrCause2 = failureOrCause;
|
|
13250
13261
|
var flipCauseOption2 = flipCauseOption;
|
|
13251
13262
|
var map14 = map9;
|
|
@@ -14163,6 +14174,9 @@ var TaggedError = (tag4) => {
|
|
|
14163
14174
|
return O.BaseEffectError;
|
|
14164
14175
|
};
|
|
14165
14176
|
|
|
14177
|
+
// node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/String.js
|
|
14178
|
+
var Order4 = string2;
|
|
14179
|
+
|
|
14166
14180
|
// node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/schedule.js
|
|
14167
14181
|
var ScheduleSymbolKey = "effect/Schedule";
|
|
14168
14182
|
var ScheduleTypeId = /* @__PURE__ */ Symbol.for(ScheduleSymbolKey);
|
|
@@ -14370,15 +14384,15 @@ var repeat_combined = /* @__PURE__ */ dual(2, (self, options3) => {
|
|
|
14370
14384
|
const withTimes = options3.times ? intersect5(withUntil, recurs(options3.times)).pipe(map16((intersectionPair) => intersectionPair[0])) : withUntil;
|
|
14371
14385
|
return scheduleDefectRefail(repeat_Effect(self, withTimes));
|
|
14372
14386
|
});
|
|
14373
|
-
var repeatOrElse_Effect = /* @__PURE__ */ dual(3, (self, schedule2,
|
|
14374
|
-
onFailure: (error4) =>
|
|
14375
|
-
onSuccess: (value5) => repeatOrElseEffectLoop(provideServiceEffect(self, CurrentIterationMetadata, get10(driver2.iterationMeta)), driver2, (error4, option5) => provideServiceEffect(
|
|
14387
|
+
var repeatOrElse_Effect = /* @__PURE__ */ dual(3, (self, schedule2, orElse16) => flatMap7(driver(schedule2), (driver2) => matchEffect(self, {
|
|
14388
|
+
onFailure: (error4) => orElse16(error4, none2()),
|
|
14389
|
+
onSuccess: (value5) => repeatOrElseEffectLoop(provideServiceEffect(self, CurrentIterationMetadata, get10(driver2.iterationMeta)), driver2, (error4, option5) => provideServiceEffect(orElse16(error4, option5), CurrentIterationMetadata, get10(driver2.iterationMeta)), value5)
|
|
14376
14390
|
})));
|
|
14377
|
-
var repeatOrElseEffectLoop = (self, driver2,
|
|
14391
|
+
var repeatOrElseEffectLoop = (self, driver2, orElse16, value5) => matchEffect(driver2.next(value5), {
|
|
14378
14392
|
onFailure: () => orDie(driver2.last),
|
|
14379
14393
|
onSuccess: (b) => matchEffect(self, {
|
|
14380
|
-
onFailure: (error4) =>
|
|
14381
|
-
onSuccess: (value6) => repeatOrElseEffectLoop(self, driver2,
|
|
14394
|
+
onFailure: (error4) => orElse16(error4, some2(b)),
|
|
14395
|
+
onSuccess: (value6) => repeatOrElseEffectLoop(self, driver2, orElse16, value6)
|
|
14382
14396
|
})
|
|
14383
14397
|
});
|
|
14384
14398
|
var retry_Effect = /* @__PURE__ */ dual(2, (self, policy) => retryOrElse_Effect(self, policy, (e, _) => fail2(e)));
|
|
@@ -14406,11 +14420,11 @@ var fromRetryOptions = (options3) => {
|
|
|
14406
14420
|
}) : withWhile;
|
|
14407
14421
|
return options3.times ? intersect5(withUntil, recurs(options3.times)) : withUntil;
|
|
14408
14422
|
};
|
|
14409
|
-
var retryOrElse_Effect = /* @__PURE__ */ dual(3, (self, policy,
|
|
14410
|
-
var retryOrElse_EffectLoop = (self, driver2,
|
|
14423
|
+
var retryOrElse_Effect = /* @__PURE__ */ dual(3, (self, policy, orElse16) => flatMap7(driver(policy), (driver2) => retryOrElse_EffectLoop(provideServiceEffect(self, CurrentIterationMetadata, get10(driver2.iterationMeta)), driver2, (e, out) => provideServiceEffect(orElse16(e, out), CurrentIterationMetadata, get10(driver2.iterationMeta)))));
|
|
14424
|
+
var retryOrElse_EffectLoop = (self, driver2, orElse16) => {
|
|
14411
14425
|
return catchAll(self, (e) => matchEffect(driver2.next(e), {
|
|
14412
|
-
onFailure: () => pipe(driver2.last, orDie, flatMap7((out) =>
|
|
14413
|
-
onSuccess: () => retryOrElse_EffectLoop(self, driver2,
|
|
14426
|
+
onFailure: () => pipe(driver2.last, orDie, flatMap7((out) => orElse16(e, out))),
|
|
14427
|
+
onSuccess: () => retryOrElse_EffectLoop(self, driver2, orElse16)
|
|
14414
14428
|
}));
|
|
14415
14429
|
};
|
|
14416
14430
|
var forever2 = /* @__PURE__ */ unfold2(0, (n) => n + 1);
|
|
@@ -14922,8 +14936,8 @@ var struct3 = (F) => (fields) => {
|
|
|
14922
14936
|
};
|
|
14923
14937
|
|
|
14924
14938
|
// node_modules/.pnpm/@effect+typeclass@0.38.0_effect@3.19.13/node_modules/@effect/typeclass/dist/esm/Semigroup.js
|
|
14925
|
-
var make41 = (
|
|
14926
|
-
combine:
|
|
14939
|
+
var make41 = (combine13, combineMany = (self, collection) => reduce11(self, combine13)(collection)) => ({
|
|
14940
|
+
combine: combine13,
|
|
14927
14941
|
combineMany
|
|
14928
14942
|
});
|
|
14929
14943
|
var constant2 = (a) => make41(() => a, () => a);
|
|
@@ -15102,6 +15116,7 @@ var black2 = /* @__PURE__ */ color(black);
|
|
|
15102
15116
|
var red3 = /* @__PURE__ */ color(red);
|
|
15103
15117
|
var green2 = /* @__PURE__ */ color(green);
|
|
15104
15118
|
var yellow2 = /* @__PURE__ */ color(yellow);
|
|
15119
|
+
var blue2 = /* @__PURE__ */ color(blue);
|
|
15105
15120
|
var cyan3 = /* @__PURE__ */ color(cyan);
|
|
15106
15121
|
var white3 = /* @__PURE__ */ color(white);
|
|
15107
15122
|
var blackBright = /* @__PURE__ */ brightColor(black);
|
|
@@ -15196,7 +15211,7 @@ var eraseScreen = /* @__PURE__ */ make42({
|
|
|
15196
15211
|
commands: /* @__PURE__ */ of(`${ESC}2J`)
|
|
15197
15212
|
});
|
|
15198
15213
|
var stringify = (self) => stringifyInternal(self);
|
|
15199
|
-
var
|
|
15214
|
+
var combine10 = /* @__PURE__ */ dual(2, (self, that) => combineInternal(self, that));
|
|
15200
15215
|
var combineInternal = (self, that) => AnsiSemigroup.combine(self, that);
|
|
15201
15216
|
var stringifyInternal = (self) => {
|
|
15202
15217
|
const displaySequence = toEscapeSequence(getSomes([some2(reset), self.foreground, self.background, self.bold, self.italicized, self.strikethrough, self.underlined]));
|
|
@@ -15214,6 +15229,7 @@ var black3 = black2;
|
|
|
15214
15229
|
var red4 = red3;
|
|
15215
15230
|
var green3 = green2;
|
|
15216
15231
|
var yellow3 = yellow2;
|
|
15232
|
+
var blue3 = blue2;
|
|
15217
15233
|
var cyan4 = cyan3;
|
|
15218
15234
|
var white4 = white3;
|
|
15219
15235
|
var blackBright2 = blackBright;
|
|
@@ -15223,7 +15239,7 @@ var bgYellow2 = bgYellow;
|
|
|
15223
15239
|
var bgBlue2 = bgBlue;
|
|
15224
15240
|
var bgCyan2 = bgCyan;
|
|
15225
15241
|
var bgBlackBright2 = bgBlackBright;
|
|
15226
|
-
var
|
|
15242
|
+
var combine11 = combine10;
|
|
15227
15243
|
|
|
15228
15244
|
// node_modules/.pnpm/@effect+printer@0.47.0_@effect+typeclass@0.38.0_effect@3.19.13/node_modules/@effect/printer/dist/esm/internal/flatten.js
|
|
15229
15245
|
var FlattenSymbolKey = "@effect/printer/Flatten";
|
|
@@ -16108,7 +16124,7 @@ var renderSafe = (self, stack) => {
|
|
|
16108
16124
|
}
|
|
16109
16125
|
case "PushAnnotationStream": {
|
|
16110
16126
|
const currentStyle = unsafePeek(stack);
|
|
16111
|
-
const nextStyle =
|
|
16127
|
+
const nextStyle = combine10(self.annotation, currentStyle);
|
|
16112
16128
|
return map17(suspend4(() => renderSafe(self.stream, cons(self.annotation, stack))), (rest) => stringify(nextStyle) + rest);
|
|
16113
16129
|
}
|
|
16114
16130
|
case "PopAnnotationStream": {
|
|
@@ -16389,6 +16405,9 @@ var toAnsiDocInternal = (self) => {
|
|
|
16389
16405
|
}
|
|
16390
16406
|
};
|
|
16391
16407
|
|
|
16408
|
+
// node_modules/.pnpm/@effect+cli@0.73.0_@effect+platform@0.94.0_@effect+printer-ansi@0.47.0_@effect+printer@0.47.0_effect@3.19.13/node_modules/@effect/cli/dist/esm/HelpDoc.js
|
|
16409
|
+
var p2 = p;
|
|
16410
|
+
|
|
16392
16411
|
// node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/ConfigError.js
|
|
16393
16412
|
var isConfigError2 = isConfigError;
|
|
16394
16413
|
var isMissingDataOnly2 = isMissingDataOnly;
|
|
@@ -17706,9 +17725,9 @@ var typeAST = (ast) => {
|
|
|
17706
17725
|
return elements === ast.elements && rest === restASTs ? ast : new TupleType(elements, rest.map((type2) => new Type(type2)), ast.isReadonly, ast.annotations);
|
|
17707
17726
|
}
|
|
17708
17727
|
case "TypeLiteral": {
|
|
17709
|
-
const propertySignatures = changeMap(ast.propertySignatures, (
|
|
17710
|
-
const type2 = typeAST(
|
|
17711
|
-
return type2 ===
|
|
17728
|
+
const propertySignatures = changeMap(ast.propertySignatures, (p3) => {
|
|
17729
|
+
const type2 = typeAST(p3.type);
|
|
17730
|
+
return type2 === p3.type ? p3 : new PropertySignature(p3.name, type2, p3.isOptional, p3.isReadonly);
|
|
17712
17731
|
});
|
|
17713
17732
|
const indexSignatures = changeMap(ast.indexSignatures, (is3) => {
|
|
17714
17733
|
const type2 = typeAST(is3.type);
|
|
@@ -18019,7 +18038,7 @@ var mapBoth5 = /* @__PURE__ */ dual(2, (self, options3) => {
|
|
|
18019
18038
|
onRight: options3.onSuccess
|
|
18020
18039
|
}) : mapBoth4(self, options3);
|
|
18021
18040
|
});
|
|
18022
|
-
var
|
|
18041
|
+
var orElse7 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
18023
18042
|
return isEither3(self) ? match(self, {
|
|
18024
18043
|
onLeft: f,
|
|
18025
18044
|
onRight: right2
|
|
@@ -18078,7 +18097,7 @@ var goMemo = (ast, isDecoding) => {
|
|
|
18078
18097
|
const parseOptionsAnnotation = getParseOptionsAnnotation(ast);
|
|
18079
18098
|
const parserWithOptions = isSome2(parseOptionsAnnotation) ? (i, options3) => raw(i, mergeInternalOptions(options3, parseOptionsAnnotation.value)) : raw;
|
|
18080
18099
|
const decodingFallbackAnnotation = getDecodingFallbackAnnotation(ast);
|
|
18081
|
-
const parser = isDecoding && isSome2(decodingFallbackAnnotation) ? (i, options3) => handleForbidden(
|
|
18100
|
+
const parser = isDecoding && isSome2(decodingFallbackAnnotation) ? (i, options3) => handleForbidden(orElse7(parserWithOptions(i, options3), decodingFallbackAnnotation.value), ast, i, options3) : parserWithOptions;
|
|
18082
18101
|
memoMap.set(ast, parser);
|
|
18083
18102
|
return parser;
|
|
18084
18103
|
};
|
|
@@ -18092,7 +18111,7 @@ var go = (ast, isDecoding) => {
|
|
|
18092
18111
|
return (i, options3) => {
|
|
18093
18112
|
options3 = options3 ?? defaultParseOption;
|
|
18094
18113
|
const allErrors = options3?.errors === "all";
|
|
18095
|
-
const result = flatMap10(
|
|
18114
|
+
const result = flatMap10(orElse7(from(i, options3), (ef) => {
|
|
18096
18115
|
const issue = new Refinement2(ast, i, "From", ef);
|
|
18097
18116
|
if (allErrors && hasStableFilter(ast) && isComposite2(ef)) {
|
|
18098
18117
|
return match2(ast.filter(i, options3, ast), {
|
|
@@ -21839,14 +21858,14 @@ var ToPropertySignature = class extends OptionalType {
|
|
|
21839
21858
|
this.defaultValue = defaultValue;
|
|
21840
21859
|
}
|
|
21841
21860
|
};
|
|
21842
|
-
var formatPropertyKey2 = (
|
|
21843
|
-
if (
|
|
21861
|
+
var formatPropertyKey2 = (p3) => {
|
|
21862
|
+
if (p3 === void 0) {
|
|
21844
21863
|
return "never";
|
|
21845
21864
|
}
|
|
21846
|
-
if (isString(
|
|
21847
|
-
return JSON.stringify(
|
|
21865
|
+
if (isString(p3)) {
|
|
21866
|
+
return JSON.stringify(p3);
|
|
21848
21867
|
}
|
|
21849
|
-
return String(
|
|
21868
|
+
return String(p3);
|
|
21850
21869
|
};
|
|
21851
21870
|
var PropertySignatureTransformation2 = class {
|
|
21852
21871
|
from;
|
|
@@ -22412,7 +22431,7 @@ var TaggedError2 = (identifier2) => (tag4, fieldsOr, annotations2) => {
|
|
|
22412
22431
|
if (!hasMessageField) {
|
|
22413
22432
|
Object.defineProperty(TaggedErrorClass.prototype, "message", {
|
|
22414
22433
|
get() {
|
|
22415
|
-
return `{ ${Reflect.ownKeys(fields).map((
|
|
22434
|
+
return `{ ${Reflect.ownKeys(fields).map((p3) => `${formatPropertyKey(p3)}: ${formatUnknown(this[p3])}`).join(", ")} }`;
|
|
22416
22435
|
},
|
|
22417
22436
|
enumerable: false,
|
|
22418
22437
|
// mirrors the built-in Error.prototype.message, whose descriptor is also non-enumerable
|
|
@@ -22596,7 +22615,7 @@ var makeClass = ({
|
|
|
22596
22615
|
if (disableToString !== true) {
|
|
22597
22616
|
Object.defineProperty(klass.prototype, "toString", {
|
|
22598
22617
|
value() {
|
|
22599
|
-
return `${identifier2}({ ${Reflect.ownKeys(fields).map((
|
|
22618
|
+
return `${identifier2}({ ${Reflect.ownKeys(fields).map((p3) => `${formatPropertyKey(p3)}: ${formatUnknown(this[p3])}`).join(", ")} })`;
|
|
22600
22619
|
},
|
|
22601
22620
|
configurable: true,
|
|
22602
22621
|
writable: true
|
|
@@ -23149,7 +23168,7 @@ var makePredicate = (pattern2) => {
|
|
|
23149
23168
|
return true;
|
|
23150
23169
|
};
|
|
23151
23170
|
} else if (pattern2 !== null && typeof pattern2 === "object") {
|
|
23152
|
-
const keysAndPredicates = Object.entries(pattern2).map(([k,
|
|
23171
|
+
const keysAndPredicates = Object.entries(pattern2).map(([k, p3]) => [k, makePredicate(p3)]);
|
|
23153
23172
|
const len = keysAndPredicates.length;
|
|
23154
23173
|
return (u) => {
|
|
23155
23174
|
if (typeof u !== "object" || u === null) {
|
|
@@ -23168,7 +23187,7 @@ var makePredicate = (pattern2) => {
|
|
|
23168
23187
|
};
|
|
23169
23188
|
var value3 = (i) => makeValueMatcher(i, left2(i));
|
|
23170
23189
|
var when4 = (pattern2, f) => (self) => self.add(makeWhen(makePredicate(pattern2), f));
|
|
23171
|
-
var
|
|
23190
|
+
var orElse12 = (f) => (self) => {
|
|
23172
23191
|
const result = either6(self);
|
|
23173
23192
|
if (isEither2(result)) {
|
|
23174
23193
|
return result._tag === "Right" ? result.right : f(result.left);
|
|
@@ -23210,7 +23229,7 @@ var either6 = (self) => {
|
|
|
23210
23229
|
// node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/Match.js
|
|
23211
23230
|
var value4 = value3;
|
|
23212
23231
|
var when5 = when4;
|
|
23213
|
-
var
|
|
23232
|
+
var orElse13 = orElse12;
|
|
23214
23233
|
|
|
23215
23234
|
// node_modules/.pnpm/@effect+cli@0.73.0_@effect+platform@0.94.0_@effect+printer-ansi@0.47.0_@effect+printer@0.47.0_effect@3.19.13/node_modules/@effect/cli/dist/esm/internal/prompt/ansi-utils.js
|
|
23216
23235
|
var defaultFigures = {
|
|
@@ -23245,7 +23264,7 @@ var windowsFigures = {
|
|
|
23245
23264
|
line: /* @__PURE__ */ text3("\u2500"),
|
|
23246
23265
|
pointer: /* @__PURE__ */ text3(">")
|
|
23247
23266
|
};
|
|
23248
|
-
var figures = /* @__PURE__ */ map17(/* @__PURE__ */ sync4(() => process.platform === "win32"), (
|
|
23267
|
+
var figures = /* @__PURE__ */ map17(/* @__PURE__ */ sync4(() => process.platform === "win32"), (isWindows2) => isWindows2 ? windowsFigures : defaultFigures);
|
|
23249
23268
|
function eraseText(text10, columns) {
|
|
23250
23269
|
if (columns === 0) {
|
|
23251
23270
|
return cat2(eraseLine3, cursorTo3(0));
|
|
@@ -23294,7 +23313,7 @@ function renderError(state, pointer) {
|
|
|
23294
23313
|
onSome: (error4) => {
|
|
23295
23314
|
const errorLines = error4.split(NEWLINE_REGEX);
|
|
23296
23315
|
if (isNonEmptyReadonlyArray(errorLines)) {
|
|
23297
|
-
const annotateLine = (line4) => annotate2(text3(line4),
|
|
23316
|
+
const annotateLine = (line4) => annotate2(text3(line4), combine11(italicized2, red4));
|
|
23298
23317
|
const prefix = cat2(annotate2(pointer, red4), space2);
|
|
23299
23318
|
const lines3 = map4(errorLines, (str) => annotateLine(str));
|
|
23300
23319
|
return cursorSavePosition3.pipe(cat2(hardLine2), cat2(prefix), cat2(align2(vsep2(lines3))), cat2(cursorRestorePosition3));
|
|
@@ -23307,7 +23326,7 @@ function renderParts(state, submitted = false) {
|
|
|
23307
23326
|
return reduce(state.dateParts, empty32, (doc, part, currentIndex) => {
|
|
23308
23327
|
const partDoc = text3(part.toString());
|
|
23309
23328
|
if (currentIndex === state.cursor && !submitted) {
|
|
23310
|
-
const annotation =
|
|
23329
|
+
const annotation = combine11(underlined2, cyanBright2);
|
|
23311
23330
|
return cat2(doc, annotate2(partDoc, annotation));
|
|
23312
23331
|
}
|
|
23313
23332
|
return cat2(doc, partDoc);
|
|
@@ -23328,12 +23347,12 @@ function renderNextFrame(state, options3) {
|
|
|
23328
23347
|
return gen2(function* () {
|
|
23329
23348
|
const terminal = yield* Terminal;
|
|
23330
23349
|
const columns = yield* terminal.columns;
|
|
23331
|
-
const
|
|
23350
|
+
const figures4 = yield* figures;
|
|
23332
23351
|
const leadingSymbol = annotate2(text3("?"), cyanBright2);
|
|
23333
|
-
const trailingSymbol = annotate2(
|
|
23352
|
+
const trailingSymbol = annotate2(figures4.pointerSmall, blackBright2);
|
|
23334
23353
|
const parts2 = renderParts(state);
|
|
23335
23354
|
const promptMsg = renderOutput(leadingSymbol, trailingSymbol, parts2, options3);
|
|
23336
|
-
const errorMsg = renderError(state,
|
|
23355
|
+
const errorMsg = renderError(state, figures4.pointerSmall);
|
|
23337
23356
|
return cursorHide3.pipe(cat2(promptMsg), cat2(errorMsg), optimize3(Deep), render3({
|
|
23338
23357
|
style: "pretty",
|
|
23339
23358
|
options: {
|
|
@@ -23346,9 +23365,9 @@ function renderSubmission(state, options3) {
|
|
|
23346
23365
|
return gen2(function* () {
|
|
23347
23366
|
const terminal = yield* Terminal;
|
|
23348
23367
|
const columns = yield* terminal.columns;
|
|
23349
|
-
const
|
|
23350
|
-
const leadingSymbol = annotate2(
|
|
23351
|
-
const trailingSymbol = annotate2(
|
|
23368
|
+
const figures4 = yield* figures;
|
|
23369
|
+
const leadingSymbol = annotate2(figures4.tick, green3);
|
|
23370
|
+
const trailingSymbol = annotate2(figures4.ellipsis, blackBright2);
|
|
23352
23371
|
const parts2 = renderParts(state, true);
|
|
23353
23372
|
const promptMsg = renderOutput(leadingSymbol, trailingSymbol, parts2, options3);
|
|
23354
23373
|
return promptMsg.pipe(cat2(hardLine2), optimize3(Deep), render3({
|
|
@@ -23687,10 +23706,10 @@ var Day = class extends DatePart {
|
|
|
23687
23706
|
toString() {
|
|
23688
23707
|
const date5 = this.date.getDate();
|
|
23689
23708
|
const day = this.date.getDay();
|
|
23690
|
-
return value4(this.token).pipe(when5("DD", () => `${date5}`.padStart(2, "0")), when5("Do", () => `${date5}${this.ordinalIndicator(date5)}`), when5("d", () => `${day + 1}`), when5("ddd", () => this.locales.weekdaysShort[day]), when5("dddd", () => this.locales.weekdays[day]),
|
|
23709
|
+
return value4(this.token).pipe(when5("DD", () => `${date5}`.padStart(2, "0")), when5("Do", () => `${date5}${this.ordinalIndicator(date5)}`), when5("d", () => `${day + 1}`), when5("ddd", () => this.locales.weekdaysShort[day]), when5("dddd", () => this.locales.weekdays[day]), orElse13(() => `${date5}`));
|
|
23691
23710
|
}
|
|
23692
23711
|
ordinalIndicator(day) {
|
|
23693
|
-
return value4(day % 10).pipe(when5(1, () => "st"), when5(2, () => "nd"), when5(3, () => "rd"),
|
|
23712
|
+
return value4(day % 10).pipe(when5(1, () => "st"), when5(2, () => "nd"), when5(3, () => "rd"), orElse13(() => "th"));
|
|
23694
23713
|
}
|
|
23695
23714
|
};
|
|
23696
23715
|
var Month = class extends DatePart {
|
|
@@ -23706,7 +23725,7 @@ var Month = class extends DatePart {
|
|
|
23706
23725
|
}
|
|
23707
23726
|
toString() {
|
|
23708
23727
|
const month = this.date.getMonth();
|
|
23709
|
-
return value4(this.token.length).pipe(when5(2, () => `${month + 1}`.padStart(2, "0")), when5(3, () => this.locales.monthsShort[month]), when5(4, () => this.locales.months[month]),
|
|
23728
|
+
return value4(this.token.length).pipe(when5(2, () => `${month + 1}`.padStart(2, "0")), when5(3, () => this.locales.monthsShort[month]), when5(4, () => this.locales.months[month]), orElse13(() => `${month + 1}`));
|
|
23710
23729
|
}
|
|
23711
23730
|
};
|
|
23712
23731
|
var Year = class extends DatePart {
|
|
@@ -24296,25 +24315,25 @@ function renderPrompt(confirm3, message, leadingSymbol, trailingSymbol) {
|
|
|
24296
24315
|
}
|
|
24297
24316
|
});
|
|
24298
24317
|
}
|
|
24299
|
-
function renderPrefix(state, toDisplay, currentIndex, length3,
|
|
24318
|
+
function renderPrefix(state, toDisplay, currentIndex, length3, figures4) {
|
|
24300
24319
|
let prefix = space2;
|
|
24301
24320
|
if (currentIndex === toDisplay.startIndex && toDisplay.startIndex > 0) {
|
|
24302
|
-
prefix =
|
|
24321
|
+
prefix = figures4.arrowUp;
|
|
24303
24322
|
} else if (currentIndex === toDisplay.endIndex - 1 && toDisplay.endIndex < length3) {
|
|
24304
|
-
prefix =
|
|
24323
|
+
prefix = figures4.arrowDown;
|
|
24305
24324
|
}
|
|
24306
|
-
return state.cursor === currentIndex ?
|
|
24325
|
+
return state.cursor === currentIndex ? figures4.pointer.pipe(annotate2(cyanBright2), cat2(prefix)) : prefix.pipe(cat2(space2));
|
|
24307
24326
|
}
|
|
24308
24327
|
function renderFileName(file5, isSelected) {
|
|
24309
|
-
return isSelected ? annotate2(text3(file5),
|
|
24328
|
+
return isSelected ? annotate2(text3(file5), combine11(underlined2, cyanBright2)) : text3(file5);
|
|
24310
24329
|
}
|
|
24311
|
-
function renderFiles(state, files,
|
|
24330
|
+
function renderFiles(state, files, figures4, options3) {
|
|
24312
24331
|
const length3 = files.length;
|
|
24313
24332
|
const toDisplay = entriesToDisplay(state.cursor, length3, options3.maxPerPage);
|
|
24314
24333
|
const documents = [];
|
|
24315
24334
|
for (let index = toDisplay.startIndex; index < toDisplay.endIndex; index++) {
|
|
24316
24335
|
const isSelected = state.cursor === index;
|
|
24317
|
-
const prefix = renderPrefix(state, toDisplay, index, length3,
|
|
24336
|
+
const prefix = renderPrefix(state, toDisplay, index, length3, figures4);
|
|
24318
24337
|
const fileName = renderFileName(files[index], isSelected);
|
|
24319
24338
|
documents.push(cat2(prefix, fileName));
|
|
24320
24339
|
}
|
|
@@ -24325,14 +24344,14 @@ function renderNextFrame2(state, options3) {
|
|
|
24325
24344
|
const path2 = yield* Path2;
|
|
24326
24345
|
const terminal = yield* Terminal;
|
|
24327
24346
|
const columns = yield* terminal.columns;
|
|
24328
|
-
const
|
|
24347
|
+
const figures4 = yield* figures;
|
|
24329
24348
|
const currentPath = yield* resolveCurrentPath(state.path, options3);
|
|
24330
24349
|
const selectedPath = state.files[state.cursor];
|
|
24331
24350
|
const resolvedPath = path2.resolve(currentPath, selectedPath);
|
|
24332
|
-
const resolvedPathMsg =
|
|
24351
|
+
const resolvedPathMsg = figures4.pointerSmall.pipe(cat2(space2), cat2(text3(resolvedPath)), annotate2(blackBright2));
|
|
24333
24352
|
if (showConfirmation(state.confirm)) {
|
|
24334
24353
|
const leadingSymbol2 = annotate2(text3("?"), cyanBright2);
|
|
24335
|
-
const trailingSymbol2 = annotate2(
|
|
24354
|
+
const trailingSymbol2 = annotate2(figures4.pointerSmall, blackBright2);
|
|
24336
24355
|
const confirm3 = annotate2(text3("(Y/n)"), blackBright2);
|
|
24337
24356
|
const promptMsg2 = renderPrompt(confirm3, CONFIRM_MESSAGE, leadingSymbol2, trailingSymbol2);
|
|
24338
24357
|
return cursorHide3.pipe(cat2(promptMsg2), cat2(hardLine2), cat2(resolvedPathMsg), optimize3(Deep), render3({
|
|
@@ -24342,10 +24361,10 @@ function renderNextFrame2(state, options3) {
|
|
|
24342
24361
|
}
|
|
24343
24362
|
}));
|
|
24344
24363
|
}
|
|
24345
|
-
const leadingSymbol = annotate2(
|
|
24346
|
-
const trailingSymbol = annotate2(
|
|
24364
|
+
const leadingSymbol = annotate2(figures4.tick, green3);
|
|
24365
|
+
const trailingSymbol = annotate2(figures4.ellipsis, blackBright2);
|
|
24347
24366
|
const promptMsg = renderPrompt(empty32, options3.message, leadingSymbol, trailingSymbol);
|
|
24348
|
-
const files = renderFiles(state, state.files,
|
|
24367
|
+
const files = renderFiles(state, state.files, figures4, options3);
|
|
24349
24368
|
return cursorHide3.pipe(cat2(promptMsg), cat2(hardLine2), cat2(resolvedPathMsg), cat2(hardLine2), cat2(files), optimize3(Deep), render3({
|
|
24350
24369
|
style: "pretty",
|
|
24351
24370
|
options: {
|
|
@@ -24358,9 +24377,9 @@ function renderSubmission2(value5, options3) {
|
|
|
24358
24377
|
return gen2(function* () {
|
|
24359
24378
|
const terminal = yield* Terminal;
|
|
24360
24379
|
const columns = yield* terminal.columns;
|
|
24361
|
-
const
|
|
24362
|
-
const leadingSymbol = annotate2(
|
|
24363
|
-
const trailingSymbol = annotate2(
|
|
24380
|
+
const figures4 = yield* figures;
|
|
24381
|
+
const leadingSymbol = annotate2(figures4.tick, green3);
|
|
24382
|
+
const trailingSymbol = annotate2(figures4.ellipsis, blackBright2);
|
|
24364
24383
|
const promptMsg = renderPrompt(empty32, options3.message, leadingSymbol, trailingSymbol);
|
|
24365
24384
|
return promptMsg.pipe(cat2(space2), cat2(annotate2(text3(value5), white4)), cat2(hardLine2), render3({
|
|
24366
24385
|
style: "pretty",
|
|
@@ -24545,7 +24564,7 @@ ${error4}`, columns)))
|
|
|
24545
24564
|
}
|
|
24546
24565
|
function renderInput(state, submitted) {
|
|
24547
24566
|
const annotation = match2(state.error, {
|
|
24548
|
-
onNone: () =>
|
|
24567
|
+
onNone: () => combine11(underlined2, cyanBright2),
|
|
24549
24568
|
onSome: () => red4
|
|
24550
24569
|
});
|
|
24551
24570
|
const value5 = state.value === "" ? empty32 : text3(`${state.value}`);
|
|
@@ -24558,7 +24577,7 @@ function renderError2(state, pointer) {
|
|
|
24558
24577
|
onSome: (error4) => match3(error4.split(NEWLINE_REGEX3), {
|
|
24559
24578
|
onEmpty: () => empty32,
|
|
24560
24579
|
onNonEmpty: (errorLines) => {
|
|
24561
|
-
const annotateLine = (line4) => annotate2(text3(line4),
|
|
24580
|
+
const annotateLine = (line4) => annotate2(text3(line4), combine11(italicized2, red4));
|
|
24562
24581
|
const prefix = cat2(annotate2(pointer, red4), space2);
|
|
24563
24582
|
const lines3 = map4(errorLines, (str) => annotateLine(str));
|
|
24564
24583
|
return cursorSavePosition3.pipe(cat2(hardLine2), cat2(prefix), cat2(align2(vsep2(lines3))), cat2(cursorRestorePosition3));
|
|
@@ -24581,10 +24600,10 @@ function renderNextFrame3(state, options3) {
|
|
|
24581
24600
|
return gen2(function* () {
|
|
24582
24601
|
const terminal = yield* Terminal;
|
|
24583
24602
|
const columns = yield* terminal.columns;
|
|
24584
|
-
const
|
|
24603
|
+
const figures4 = yield* figures;
|
|
24585
24604
|
const leadingSymbol = annotate2(text3("?"), cyanBright2);
|
|
24586
|
-
const trailingSymbol = annotate2(
|
|
24587
|
-
const errorMsg = renderError2(state,
|
|
24605
|
+
const trailingSymbol = annotate2(figures4.pointerSmall, blackBright2);
|
|
24606
|
+
const errorMsg = renderError2(state, figures4.pointerSmall);
|
|
24588
24607
|
const promptMsg = renderOutput2(state, leadingSymbol, trailingSymbol, options3);
|
|
24589
24608
|
return promptMsg.pipe(cat2(errorMsg), optimize3(Deep), render3({
|
|
24590
24609
|
style: "pretty",
|
|
@@ -24598,9 +24617,9 @@ function renderSubmission3(nextState, options3) {
|
|
|
24598
24617
|
return gen2(function* () {
|
|
24599
24618
|
const terminal = yield* Terminal;
|
|
24600
24619
|
const columns = yield* terminal.columns;
|
|
24601
|
-
const
|
|
24602
|
-
const leadingSymbol = annotate2(
|
|
24603
|
-
const trailingSymbol = annotate2(
|
|
24620
|
+
const figures4 = yield* figures;
|
|
24621
|
+
const leadingSymbol = annotate2(figures4.tick, green3);
|
|
24622
|
+
const trailingSymbol = annotate2(figures4.ellipsis, blackBright2);
|
|
24604
24623
|
const promptMsg = renderOutput2(nextState, leadingSymbol, trailingSymbol, options3, true);
|
|
24605
24624
|
return promptMsg.pipe(cat2(hardLine2), optimize3(Deep), render3({
|
|
24606
24625
|
style: "pretty",
|
|
@@ -24869,25 +24888,25 @@ function renderOutput3(leadingSymbol, trailingSymbol, options3) {
|
|
|
24869
24888
|
}
|
|
24870
24889
|
});
|
|
24871
24890
|
}
|
|
24872
|
-
function renderChoicePrefix(state, choices, toDisplay, currentIndex,
|
|
24891
|
+
function renderChoicePrefix(state, choices, toDisplay, currentIndex, figures4) {
|
|
24873
24892
|
let prefix = space2;
|
|
24874
24893
|
if (currentIndex === toDisplay.startIndex && toDisplay.startIndex > 0) {
|
|
24875
|
-
prefix =
|
|
24894
|
+
prefix = figures4.arrowUp;
|
|
24876
24895
|
} else if (currentIndex === toDisplay.endIndex - 1 && toDisplay.endIndex < choices.length) {
|
|
24877
|
-
prefix =
|
|
24896
|
+
prefix = figures4.arrowDown;
|
|
24878
24897
|
}
|
|
24879
24898
|
if (choices[currentIndex].disabled) {
|
|
24880
|
-
const annotation =
|
|
24881
|
-
return state === currentIndex ?
|
|
24899
|
+
const annotation = combine11(bold2, blackBright2);
|
|
24900
|
+
return state === currentIndex ? figures4.pointer.pipe(annotate2(annotation), cat2(prefix)) : prefix.pipe(cat2(space2));
|
|
24882
24901
|
}
|
|
24883
|
-
return state === currentIndex ?
|
|
24902
|
+
return state === currentIndex ? figures4.pointer.pipe(annotate2(cyanBright2), cat2(prefix)) : prefix.pipe(cat2(space2));
|
|
24884
24903
|
}
|
|
24885
24904
|
function renderChoiceTitle(choice4, isSelected) {
|
|
24886
24905
|
const title = text3(choice4.title);
|
|
24887
24906
|
if (isSelected) {
|
|
24888
|
-
return choice4.disabled ? annotate2(title,
|
|
24907
|
+
return choice4.disabled ? annotate2(title, combine11(underlined2, blackBright2)) : annotate2(title, combine11(underlined2, cyanBright2));
|
|
24889
24908
|
}
|
|
24890
|
-
return choice4.disabled ? annotate2(title,
|
|
24909
|
+
return choice4.disabled ? annotate2(title, combine11(strikethrough2, blackBright2)) : title;
|
|
24891
24910
|
}
|
|
24892
24911
|
function renderChoiceDescription(choice4, isSelected) {
|
|
24893
24912
|
if (!choice4.disabled && choice4.description && isSelected) {
|
|
@@ -24895,14 +24914,14 @@ function renderChoiceDescription(choice4, isSelected) {
|
|
|
24895
24914
|
}
|
|
24896
24915
|
return empty32;
|
|
24897
24916
|
}
|
|
24898
|
-
function renderChoices(state, options3,
|
|
24917
|
+
function renderChoices(state, options3, figures4) {
|
|
24899
24918
|
const choices = options3.choices;
|
|
24900
24919
|
const toDisplay = entriesToDisplay(state, choices.length, options3.maxPerPage);
|
|
24901
24920
|
const documents = [];
|
|
24902
24921
|
for (let index = toDisplay.startIndex; index < toDisplay.endIndex; index++) {
|
|
24903
24922
|
const choice4 = choices[index];
|
|
24904
24923
|
const isSelected = state === index;
|
|
24905
|
-
const prefix = renderChoicePrefix(state, choices, toDisplay, index,
|
|
24924
|
+
const prefix = renderChoicePrefix(state, choices, toDisplay, index, figures4);
|
|
24906
24925
|
const title = renderChoiceTitle(choice4, isSelected);
|
|
24907
24926
|
const description = renderChoiceDescription(choice4, isSelected);
|
|
24908
24927
|
documents.push(prefix.pipe(cat2(title), cat2(space2), cat2(description)));
|
|
@@ -24913,10 +24932,10 @@ function renderNextFrame4(state, options3) {
|
|
|
24913
24932
|
return gen2(function* () {
|
|
24914
24933
|
const terminal = yield* Terminal;
|
|
24915
24934
|
const columns = yield* terminal.columns;
|
|
24916
|
-
const
|
|
24917
|
-
const choices = renderChoices(state, options3,
|
|
24935
|
+
const figures4 = yield* figures;
|
|
24936
|
+
const choices = renderChoices(state, options3, figures4);
|
|
24918
24937
|
const leadingSymbol = annotate2(text3("?"), cyanBright2);
|
|
24919
|
-
const trailingSymbol = annotate2(
|
|
24938
|
+
const trailingSymbol = annotate2(figures4.pointerSmall, blackBright2);
|
|
24920
24939
|
const promptMsg = renderOutput3(leadingSymbol, trailingSymbol, options3);
|
|
24921
24940
|
return cursorHide3.pipe(cat2(promptMsg), cat2(hardLine2), cat2(choices), render3({
|
|
24922
24941
|
style: "pretty",
|
|
@@ -24930,10 +24949,10 @@ function renderSubmission4(state, options3) {
|
|
|
24930
24949
|
return gen2(function* () {
|
|
24931
24950
|
const terminal = yield* Terminal;
|
|
24932
24951
|
const columns = yield* terminal.columns;
|
|
24933
|
-
const
|
|
24952
|
+
const figures4 = yield* figures;
|
|
24934
24953
|
const selected = text3(options3.choices[state].title);
|
|
24935
|
-
const leadingSymbol = annotate2(
|
|
24936
|
-
const trailingSymbol = annotate2(
|
|
24954
|
+
const leadingSymbol = annotate2(figures4.tick, green3);
|
|
24955
|
+
const trailingSymbol = annotate2(figures4.ellipsis, blackBright2);
|
|
24937
24956
|
const promptMsg = renderOutput3(leadingSymbol, trailingSymbol, options3);
|
|
24938
24957
|
return promptMsg.pipe(cat2(space2), cat2(annotate2(selected, white4)), cat2(hardLine2), render3({
|
|
24939
24958
|
style: "pretty",
|
|
@@ -25094,7 +25113,7 @@ function renderInput2(nextState, options3, submitted) {
|
|
|
25094
25113
|
if (nextState.value.length === 0) {
|
|
25095
25114
|
return blackBright2;
|
|
25096
25115
|
}
|
|
25097
|
-
return
|
|
25116
|
+
return combine11(underlined2, cyanBright2);
|
|
25098
25117
|
},
|
|
25099
25118
|
onSome: () => red4
|
|
25100
25119
|
});
|
|
@@ -25116,7 +25135,7 @@ function renderError3(nextState, pointer) {
|
|
|
25116
25135
|
onSome: (error4) => match3(error4.split(/\r?\n/), {
|
|
25117
25136
|
onEmpty: () => empty32,
|
|
25118
25137
|
onNonEmpty: (errorLines) => {
|
|
25119
|
-
const annotateLine = (line4) => text3(line4).pipe(annotate2(
|
|
25138
|
+
const annotateLine = (line4) => text3(line4).pipe(annotate2(combine11(italicized2, red4)));
|
|
25120
25139
|
const prefix = cat2(annotate2(pointer, red4), space2);
|
|
25121
25140
|
const lines3 = map4(errorLines, (str) => annotateLine(str));
|
|
25122
25141
|
return cursorSavePosition3.pipe(cat2(hardLine2), cat2(prefix), cat2(align2(vsep2(lines3))), cat2(cursorRestorePosition3));
|
|
@@ -25138,11 +25157,11 @@ function renderNextFrame5(state, options3) {
|
|
|
25138
25157
|
return gen2(function* () {
|
|
25139
25158
|
const terminal = yield* Terminal;
|
|
25140
25159
|
const columns = yield* terminal.columns;
|
|
25141
|
-
const
|
|
25160
|
+
const figures4 = yield* figures;
|
|
25142
25161
|
const leadingSymbol = annotate2(text3("?"), cyanBright2);
|
|
25143
|
-
const trailingSymbol = annotate2(
|
|
25162
|
+
const trailingSymbol = annotate2(figures4.pointerSmall, blackBright2);
|
|
25144
25163
|
const promptMsg = renderOutput4(state, leadingSymbol, trailingSymbol, options3);
|
|
25145
|
-
const errorMsg = renderError3(state,
|
|
25164
|
+
const errorMsg = renderError3(state, figures4.pointerSmall);
|
|
25146
25165
|
const offset = state.cursor - state.value.length;
|
|
25147
25166
|
return promptMsg.pipe(cat2(errorMsg), cat2(cursorMove3(offset)), optimize3(Deep), render3({
|
|
25148
25167
|
style: "pretty",
|
|
@@ -25156,9 +25175,9 @@ function renderSubmission5(state, options3) {
|
|
|
25156
25175
|
return gen2(function* () {
|
|
25157
25176
|
const terminal = yield* Terminal;
|
|
25158
25177
|
const columns = yield* terminal.columns;
|
|
25159
|
-
const
|
|
25160
|
-
const leadingSymbol = annotate2(
|
|
25161
|
-
const trailingSymbol = annotate2(
|
|
25178
|
+
const figures4 = yield* figures;
|
|
25179
|
+
const leadingSymbol = annotate2(figures4.tick, green3);
|
|
25180
|
+
const trailingSymbol = annotate2(figures4.ellipsis, blackBright2);
|
|
25162
25181
|
const promptMsg = renderOutput4(state, leadingSymbol, trailingSymbol, options3, true);
|
|
25163
25182
|
return promptMsg.pipe(cat2(hardLine2), optimize3(Deep), render3({
|
|
25164
25183
|
style: "pretty",
|
|
@@ -25335,7 +25354,7 @@ function handleClear6(options3) {
|
|
|
25335
25354
|
}
|
|
25336
25355
|
function renderToggle(value5, options3, submitted = false) {
|
|
25337
25356
|
const separator = annotate2(char3("/"), blackBright2);
|
|
25338
|
-
const selectedAnnotation =
|
|
25357
|
+
const selectedAnnotation = combine11(underlined2, submitted ? white4 : cyanBright2);
|
|
25339
25358
|
const inactive = value5 ? text3(options3.inactive) : annotate2(text3(options3.inactive), selectedAnnotation);
|
|
25340
25359
|
const active2 = value5 ? annotate2(text3(options3.active), selectedAnnotation) : text3(options3.active);
|
|
25341
25360
|
return hsep2([active2, separator, inactive]);
|
|
@@ -25353,10 +25372,10 @@ function renderOutput5(toggle3, leadingSymbol, trailingSymbol, options3) {
|
|
|
25353
25372
|
function renderNextFrame6(state, options3) {
|
|
25354
25373
|
return gen2(function* () {
|
|
25355
25374
|
const terminal = yield* Terminal;
|
|
25356
|
-
const
|
|
25375
|
+
const figures4 = yield* figures;
|
|
25357
25376
|
const columns = yield* terminal.columns;
|
|
25358
25377
|
const leadingSymbol = annotate2(text3("?"), cyanBright2);
|
|
25359
|
-
const trailingSymbol = annotate2(
|
|
25378
|
+
const trailingSymbol = annotate2(figures4.pointerSmall, blackBright2);
|
|
25360
25379
|
const toggle3 = renderToggle(state, options3);
|
|
25361
25380
|
const promptMsg = renderOutput5(toggle3, leadingSymbol, trailingSymbol, options3);
|
|
25362
25381
|
return cursorHide3.pipe(cat2(promptMsg), optimize3(Deep), render3({
|
|
@@ -25370,10 +25389,10 @@ function renderNextFrame6(state, options3) {
|
|
|
25370
25389
|
function renderSubmission6(value5, options3) {
|
|
25371
25390
|
return gen2(function* () {
|
|
25372
25391
|
const terminal = yield* Terminal;
|
|
25373
|
-
const
|
|
25392
|
+
const figures4 = yield* figures;
|
|
25374
25393
|
const columns = yield* terminal.columns;
|
|
25375
|
-
const leadingSymbol = annotate2(
|
|
25376
|
-
const trailingSymbol = annotate2(
|
|
25394
|
+
const leadingSymbol = annotate2(figures4.tick, green3);
|
|
25395
|
+
const trailingSymbol = annotate2(figures4.ellipsis, blackBright2);
|
|
25377
25396
|
const toggle3 = renderToggle(value5, options3, true);
|
|
25378
25397
|
const promptMsg = renderOutput5(toggle3, leadingSymbol, trailingSymbol, options3);
|
|
25379
25398
|
return promptMsg.pipe(cat2(hardLine2), optimize3(Deep), render3({
|
|
@@ -26106,7 +26125,7 @@ var boolean4 = (name, options3) => {
|
|
|
26106
26125
|
const head5 = headNonEmpty(negationNames);
|
|
26107
26126
|
const tail = tailNonEmpty(negationNames);
|
|
26108
26127
|
const negationOption = makeSingle(head5, tail, boolean3(some2(!ifPresent)));
|
|
26109
|
-
return withDefault2(
|
|
26128
|
+
return withDefault2(orElse14(option5, negationOption), !ifPresent);
|
|
26110
26129
|
}
|
|
26111
26130
|
return withDefault2(option5, !ifPresent);
|
|
26112
26131
|
};
|
|
@@ -26127,7 +26146,7 @@ var getHelp3 = (self) => getHelpInternal2(self);
|
|
|
26127
26146
|
var getUsage = (self) => getUsageInternal(self);
|
|
26128
26147
|
var map29 = /* @__PURE__ */ dual(2, (self, f) => makeMap(self, (a) => right2(f(a))));
|
|
26129
26148
|
var optional3 = (self) => withDefault2(map29(self, some2), none2());
|
|
26130
|
-
var
|
|
26149
|
+
var orElse14 = /* @__PURE__ */ dual(2, (self, that) => orElseEither4(self, that).pipe(map29(merge)));
|
|
26131
26150
|
var orElseEither4 = /* @__PURE__ */ dual(2, (self, that) => makeOrElse(self, that));
|
|
26132
26151
|
var processCommandLine = /* @__PURE__ */ dual(3, (self, args3, config2) => matchOptions(args3, toParseableInstruction(self), config2).pipe(flatMap9(([error4, commandArgs, matchedOptions]) => parseInternal(self, matchedOptions, config2).pipe(catchAll2((e) => match2(error4, {
|
|
26133
26152
|
onNone: () => fail7(e),
|
|
@@ -27588,6 +27607,7 @@ var mapEffect7 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
27588
27607
|
return op;
|
|
27589
27608
|
});
|
|
27590
27609
|
var parse3 = /* @__PURE__ */ dual(3, (self, args3, config2) => parseInternal2(self, args3, config2));
|
|
27610
|
+
var withDescription4 = /* @__PURE__ */ dual(2, (self, help) => withDescriptionInternal(self, help));
|
|
27591
27611
|
var withSubcommands = /* @__PURE__ */ dual(2, (self, subcommands) => {
|
|
27592
27612
|
const op = Object.create(proto23);
|
|
27593
27613
|
op._tag = "Subcommands";
|
|
@@ -27862,6 +27882,39 @@ var splitForcedArgs = (args3) => {
|
|
|
27862
27882
|
const [remainingArgs, forcedArgs] = span(args3, (str) => str !== "--");
|
|
27863
27883
|
return [remainingArgs, drop(forcedArgs, 1)];
|
|
27864
27884
|
};
|
|
27885
|
+
var withDescriptionInternal = (self, description) => {
|
|
27886
|
+
switch (self._tag) {
|
|
27887
|
+
case "Standard": {
|
|
27888
|
+
const helpDoc = typeof description === "string" ? p2(description) : description;
|
|
27889
|
+
const op = Object.create(proto23);
|
|
27890
|
+
op._tag = "Standard";
|
|
27891
|
+
op.name = self.name;
|
|
27892
|
+
op.description = helpDoc;
|
|
27893
|
+
op.options = self.options;
|
|
27894
|
+
op.args = self.args;
|
|
27895
|
+
return op;
|
|
27896
|
+
}
|
|
27897
|
+
case "GetUserInput": {
|
|
27898
|
+
const helpDoc = typeof description === "string" ? p2(description) : description;
|
|
27899
|
+
const op = Object.create(proto23);
|
|
27900
|
+
op._tag = "GetUserInput";
|
|
27901
|
+
op.name = self.name;
|
|
27902
|
+
op.description = helpDoc;
|
|
27903
|
+
op.prompt = self.prompt;
|
|
27904
|
+
return op;
|
|
27905
|
+
}
|
|
27906
|
+
case "Map": {
|
|
27907
|
+
return mapEffect7(withDescriptionInternal(self.command, description), self.f);
|
|
27908
|
+
}
|
|
27909
|
+
case "Subcommands": {
|
|
27910
|
+
const op = Object.create(proto23);
|
|
27911
|
+
op._tag = "Subcommands";
|
|
27912
|
+
op.parent = withDescriptionInternal(self.parent, description);
|
|
27913
|
+
op.children = self.children.slice();
|
|
27914
|
+
return op;
|
|
27915
|
+
}
|
|
27916
|
+
}
|
|
27917
|
+
};
|
|
27865
27918
|
var argsWizardHeader = /* @__PURE__ */ code("Args Wizard - ");
|
|
27866
27919
|
var optionsWizardHeader = /* @__PURE__ */ code("Options Wizard - ");
|
|
27867
27920
|
var wizardInternal4 = (self, prefix, config2) => {
|
|
@@ -28354,6 +28407,10 @@ var makeDescriptor = (name, config2) => {
|
|
|
28354
28407
|
}) => reconstructConfigTree(tree, args4, options4));
|
|
28355
28408
|
};
|
|
28356
28409
|
var make57 = (name, config2 = {}, handler) => fromDescriptor(makeDescriptor(name, config2), handler);
|
|
28410
|
+
var mapDescriptor = /* @__PURE__ */ dual(2, (self, f) => makeDerive(self, {
|
|
28411
|
+
descriptor: f(self.descriptor)
|
|
28412
|
+
}));
|
|
28413
|
+
var withDescription5 = /* @__PURE__ */ dual(2, (self, help) => mapDescriptor(self, withDescription4(help)));
|
|
28357
28414
|
var withSubcommands2 = /* @__PURE__ */ dual(2, (self, subcommands) => {
|
|
28358
28415
|
const command = withSubcommands(self.descriptor, map4(subcommands, (_) => [_.tag, _.descriptor]));
|
|
28359
28416
|
const subcommandMap = reduce(subcommands, /* @__PURE__ */ new Map(), (handlers, subcommand) => {
|
|
@@ -28387,6 +28444,7 @@ var run7 = /* @__PURE__ */ dual(2, (self, config2) => {
|
|
|
28387
28444
|
|
|
28388
28445
|
// node_modules/.pnpm/@effect+cli@0.73.0_@effect+platform@0.94.0_@effect+printer-ansi@0.47.0_@effect+printer@0.47.0_effect@3.19.13/node_modules/@effect/cli/dist/esm/Command.js
|
|
28389
28446
|
var make58 = make57;
|
|
28447
|
+
var withDescription6 = withDescription5;
|
|
28390
28448
|
var withSubcommands3 = withSubcommands2;
|
|
28391
28449
|
var run8 = run7;
|
|
28392
28450
|
|
|
@@ -29731,7 +29789,7 @@ var make63 = () => acquireRelease2(map17(make38(), (deferred) => unsafeMake8(/*
|
|
|
29731
29789
|
_tag: "Closed"
|
|
29732
29790
|
};
|
|
29733
29791
|
const fibers = state.backing;
|
|
29734
|
-
return interruptAllAs2(fibers,
|
|
29792
|
+
return interruptAllAs2(fibers, combine4(parent.id(), internalFiberId)).pipe(intoDeferred2(set7.deferred));
|
|
29735
29793
|
}));
|
|
29736
29794
|
var internalFiberIdId = -1;
|
|
29737
29795
|
var internalFiberId = /* @__PURE__ */ make15(internalFiberIdId, 0);
|
|
@@ -29745,7 +29803,7 @@ var isInternalInterruption = /* @__PURE__ */ reduceWithContext3(void 0, {
|
|
|
29745
29803
|
});
|
|
29746
29804
|
var unsafeAdd = /* @__PURE__ */ dual((args3) => isFiberSet(args3[0]), (self, fiber, options3) => {
|
|
29747
29805
|
if (self.state._tag === "Closed") {
|
|
29748
|
-
fiber.unsafeInterruptAsFork(
|
|
29806
|
+
fiber.unsafeInterruptAsFork(combine4(options3?.interruptAs ?? none4, internalFiberId));
|
|
29749
29807
|
return;
|
|
29750
29808
|
} else if (self.state.backing.has(fiber)) {
|
|
29751
29809
|
return;
|
|
@@ -30361,13 +30419,13 @@ var match17 = (fa, opts) => {
|
|
|
30361
30419
|
nano[contE] = opts.onFailure;
|
|
30362
30420
|
return nano;
|
|
30363
30421
|
};
|
|
30364
|
-
var
|
|
30422
|
+
var orElse15 = (f) => (fa) => {
|
|
30365
30423
|
const nano = Object.create(MatchProto);
|
|
30366
30424
|
nano[args2] = fa;
|
|
30367
30425
|
nano[contE] = (_) => _ instanceof NanoDefectException ? fail18(_) : f(_);
|
|
30368
30426
|
return nano;
|
|
30369
30427
|
};
|
|
30370
|
-
var firstSuccessOf2 = (arr) => arr.slice(1).reduce((arr2, fa) =>
|
|
30428
|
+
var firstSuccessOf2 = (arr) => arr.slice(1).reduce((arr2, fa) => orElse15(() => fa)(arr2), arr[0]);
|
|
30371
30429
|
var ProvideServiceProto = {
|
|
30372
30430
|
...PrimitiveProto,
|
|
30373
30431
|
[evaluate2](fiber) {
|
|
@@ -30433,9 +30491,9 @@ var CachedProto = {
|
|
|
30433
30491
|
}
|
|
30434
30492
|
};
|
|
30435
30493
|
function cachedBy(fa, type2, lookupKey) {
|
|
30436
|
-
return (...
|
|
30494
|
+
return (...p3) => {
|
|
30437
30495
|
const nano = Object.create(CachedProto);
|
|
30438
|
-
nano[args2] = [fa(...
|
|
30496
|
+
nano[args2] = [fa(...p3), type2, lookupKey(...p3)];
|
|
30439
30497
|
return nano;
|
|
30440
30498
|
};
|
|
30441
30499
|
}
|
|
@@ -31334,6 +31392,8 @@ var check2 = make58(
|
|
|
31334
31392
|
}
|
|
31335
31393
|
}
|
|
31336
31394
|
})
|
|
31395
|
+
).pipe(
|
|
31396
|
+
withDescription6("Check if the typescript package is patched with the effect-language-service.")
|
|
31337
31397
|
);
|
|
31338
31398
|
|
|
31339
31399
|
// src/cli/codegen.ts
|
|
@@ -31675,17 +31735,17 @@ var createDiagnosticExecutor = fn2("LSP.createCommentDirectivesProcessor")(
|
|
|
31675
31735
|
}
|
|
31676
31736
|
);
|
|
31677
31737
|
var cyrb53 = (str, seed = 0) => {
|
|
31678
|
-
let h12 = 3735928559 ^ seed,
|
|
31738
|
+
let h12 = 3735928559 ^ seed, h22 = 1103547991 ^ seed;
|
|
31679
31739
|
for (let i = 0, ch; i < str.length; i++) {
|
|
31680
31740
|
ch = str.charCodeAt(i);
|
|
31681
31741
|
h12 = Math.imul(h12 ^ ch, 2654435761);
|
|
31682
|
-
|
|
31742
|
+
h22 = Math.imul(h22 ^ ch, 1597334677);
|
|
31683
31743
|
}
|
|
31684
31744
|
h12 = Math.imul(h12 ^ h12 >>> 16, 2246822507);
|
|
31685
|
-
h12 ^= Math.imul(
|
|
31686
|
-
|
|
31687
|
-
|
|
31688
|
-
return (
|
|
31745
|
+
h12 ^= Math.imul(h22 ^ h22 >>> 13, 3266489909);
|
|
31746
|
+
h22 = Math.imul(h22 ^ h22 >>> 16, 2246822507);
|
|
31747
|
+
h22 ^= Math.imul(h12 ^ h12 >>> 13, 3266489909);
|
|
31748
|
+
return (h22 >>> 0).toString(16).padStart(8, "0") + (h12 >>> 0).toString(16).padStart(8, "0");
|
|
31689
31749
|
};
|
|
31690
31750
|
var CodegenNotApplicableError = class {
|
|
31691
31751
|
constructor(cause2) {
|
|
@@ -32279,9 +32339,15 @@ function make64(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
32279
32339
|
);
|
|
32280
32340
|
const extendsCauseYieldableError = cachedBy(
|
|
32281
32341
|
fn2("TypeParser.extendsCauseYieldableError")(function* (givenType) {
|
|
32342
|
+
if (givenType.flags & ts.TypeFlags.Never) {
|
|
32343
|
+
return yield* typeParserIssue("Type is never", givenType);
|
|
32344
|
+
}
|
|
32345
|
+
if (givenType.flags & ts.TypeFlags.Any) {
|
|
32346
|
+
return yield* typeParserIssue("Type is any", givenType);
|
|
32347
|
+
}
|
|
32282
32348
|
const symbols = yield* findSymbolsMatchingPackageAndExportedName("effect", "YieldableError")();
|
|
32283
32349
|
for (const [symbol3, sourceFile] of symbols) {
|
|
32284
|
-
const causeFile = yield* pipe(isCauseTypeSourceFile(sourceFile),
|
|
32350
|
+
const causeFile = yield* pipe(isCauseTypeSourceFile(sourceFile), orElse15(() => void_8));
|
|
32285
32351
|
if (!causeFile) continue;
|
|
32286
32352
|
const type2 = typeChecker.getDeclaredTypeOfSymbol(symbol3);
|
|
32287
32353
|
if (!type2) continue;
|
|
@@ -32373,18 +32439,19 @@ function make64(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
32373
32439
|
);
|
|
32374
32440
|
const effectType = cachedBy(
|
|
32375
32441
|
fn2("TypeParser.effectType")(function* (type2, atLocation) {
|
|
32376
|
-
let result = typeParserIssue("Type has no effect variance struct", type2, atLocation);
|
|
32377
32442
|
const propertiesSymbols = typeChecker.getPropertiesOfType(type2).filter(
|
|
32378
|
-
(_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration
|
|
32443
|
+
(_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration
|
|
32379
32444
|
);
|
|
32445
|
+
if (propertiesSymbols.length === 0) {
|
|
32446
|
+
return yield* typeParserIssue("Type has no effect variance struct", type2, atLocation);
|
|
32447
|
+
}
|
|
32380
32448
|
propertiesSymbols.sort(
|
|
32381
32449
|
(a, b) => ts.symbolName(b).indexOf("EffectTypeId") - ts.symbolName(a).indexOf("EffectTypeId")
|
|
32382
32450
|
);
|
|
32383
|
-
|
|
32451
|
+
return yield* firstSuccessOf2(propertiesSymbols.map((propertySymbol) => {
|
|
32384
32452
|
const propertyType = typeChecker.getTypeOfSymbolAtLocation(propertySymbol, atLocation);
|
|
32385
|
-
|
|
32386
|
-
}
|
|
32387
|
-
return yield* result;
|
|
32453
|
+
return effectVarianceStruct(propertyType, atLocation);
|
|
32454
|
+
}));
|
|
32388
32455
|
}),
|
|
32389
32456
|
"TypeParser.effectType",
|
|
32390
32457
|
(type2) => type2
|
|
@@ -32423,22 +32490,18 @@ function make64(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
32423
32490
|
fn2("TypeParser.layerType")(function* (type2, atLocation) {
|
|
32424
32491
|
yield* pipeableType(type2, atLocation);
|
|
32425
32492
|
const propertiesSymbols = typeChecker.getPropertiesOfType(type2).filter(
|
|
32426
|
-
(_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration
|
|
32493
|
+
(_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration
|
|
32427
32494
|
);
|
|
32495
|
+
if (propertiesSymbols.length === 0) {
|
|
32496
|
+
return yield* typeParserIssue("Type has no layer variance struct", type2, atLocation);
|
|
32497
|
+
}
|
|
32428
32498
|
propertiesSymbols.sort(
|
|
32429
32499
|
(a, b) => ts.symbolName(b).indexOf("LayerTypeId") - ts.symbolName(a).indexOf("LayerTypeId")
|
|
32430
32500
|
);
|
|
32431
|
-
|
|
32501
|
+
return yield* firstSuccessOf2(propertiesSymbols.map((propertySymbol) => {
|
|
32432
32502
|
const propertyType = typeChecker.getTypeOfSymbolAtLocation(propertySymbol, atLocation);
|
|
32433
|
-
|
|
32434
|
-
|
|
32435
|
-
atLocation
|
|
32436
|
-
));
|
|
32437
|
-
if (isSome2(varianceArgs)) {
|
|
32438
|
-
return varianceArgs.value;
|
|
32439
|
-
}
|
|
32440
|
-
}
|
|
32441
|
-
return yield* typeParserIssue("Type has no layer variance struct", type2, atLocation);
|
|
32503
|
+
return layerVarianceStruct(propertyType, atLocation);
|
|
32504
|
+
}));
|
|
32442
32505
|
}),
|
|
32443
32506
|
"TypeParser.layerType",
|
|
32444
32507
|
(type2) => type2
|
|
@@ -32735,20 +32798,16 @@ function make64(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
32735
32798
|
const ast = typeChecker.getPropertyOfType(type2, "ast");
|
|
32736
32799
|
if (!ast) return yield* typeParserIssue("Has no 'ast' property", type2, atLocation);
|
|
32737
32800
|
const propertiesSymbols = typeChecker.getPropertiesOfType(type2).filter(
|
|
32738
|
-
(_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration
|
|
32801
|
+
(_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration
|
|
32739
32802
|
);
|
|
32803
|
+
if (propertiesSymbols.length === 0) {
|
|
32804
|
+
return yield* typeParserIssue("Type has no schema variance struct", type2, atLocation);
|
|
32805
|
+
}
|
|
32740
32806
|
propertiesSymbols.sort((a, b) => ts.symbolName(b).indexOf("TypeId") - ts.symbolName(a).indexOf("TypeId"));
|
|
32741
|
-
|
|
32807
|
+
return yield* firstSuccessOf2(propertiesSymbols.map((propertySymbol) => {
|
|
32742
32808
|
const propertyType = typeChecker.getTypeOfSymbolAtLocation(propertySymbol, atLocation);
|
|
32743
|
-
|
|
32744
|
-
|
|
32745
|
-
atLocation
|
|
32746
|
-
));
|
|
32747
|
-
if (isSome2(varianceArgs)) {
|
|
32748
|
-
return varianceArgs.value;
|
|
32749
|
-
}
|
|
32750
|
-
}
|
|
32751
|
-
return yield* typeParserIssue("Type has no schema variance struct", type2, atLocation);
|
|
32809
|
+
return effectSchemaVarianceStruct(propertyType, atLocation);
|
|
32810
|
+
}));
|
|
32752
32811
|
}),
|
|
32753
32812
|
"TypeParser.effectSchemaType",
|
|
32754
32813
|
(type2) => type2
|
|
@@ -32784,33 +32843,54 @@ function make64(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
32784
32843
|
fn2("TypeParser.contextTag")(function* (type2, atLocation) {
|
|
32785
32844
|
yield* pipeableType(type2, atLocation);
|
|
32786
32845
|
const propertiesSymbols = typeChecker.getPropertiesOfType(type2).filter(
|
|
32787
|
-
(_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration
|
|
32846
|
+
(_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration
|
|
32788
32847
|
);
|
|
32848
|
+
if (propertiesSymbols.length === 0) {
|
|
32849
|
+
return yield* typeParserIssue("Type has no tag variance struct", type2, atLocation);
|
|
32850
|
+
}
|
|
32789
32851
|
propertiesSymbols.sort((a, b) => ts.symbolName(b).indexOf("TypeId") - ts.symbolName(a).indexOf("TypeId"));
|
|
32790
|
-
|
|
32852
|
+
return yield* firstSuccessOf2(propertiesSymbols.map((propertySymbol) => {
|
|
32791
32853
|
const propertyType = typeChecker.getTypeOfSymbolAtLocation(propertySymbol, atLocation);
|
|
32792
|
-
|
|
32793
|
-
|
|
32794
|
-
atLocation
|
|
32795
|
-
));
|
|
32796
|
-
if (isSome2(varianceArgs)) {
|
|
32797
|
-
return varianceArgs.value;
|
|
32798
|
-
}
|
|
32799
|
-
}
|
|
32800
|
-
return yield* typeParserIssue("Type has no tag variance struct", type2, atLocation);
|
|
32854
|
+
return contextTagVarianceStruct(propertyType, atLocation);
|
|
32855
|
+
}));
|
|
32801
32856
|
}),
|
|
32802
32857
|
"TypeParser.contextTag",
|
|
32803
32858
|
(type2) => type2
|
|
32804
32859
|
);
|
|
32860
|
+
const effectFunctionImportedName = cachedBy(
|
|
32861
|
+
fn2("TypeParser.effectFunctionImportedName")(function* (sourceFile) {
|
|
32862
|
+
return tsUtils.findImportedModuleIdentifierByPackageAndNameOrBarrel(sourceFile, "effect", "Function");
|
|
32863
|
+
}),
|
|
32864
|
+
"TypeParser.effectFunctionImportedName",
|
|
32865
|
+
(node) => node
|
|
32866
|
+
);
|
|
32805
32867
|
const pipeCall = cachedBy(
|
|
32806
32868
|
function(node) {
|
|
32807
32869
|
if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.name) && ts.idText(node.expression.name) === "pipe") {
|
|
32808
|
-
|
|
32809
|
-
|
|
32810
|
-
|
|
32811
|
-
|
|
32812
|
-
|
|
32813
|
-
|
|
32870
|
+
const baseExpression = node.expression.expression;
|
|
32871
|
+
return pipe(
|
|
32872
|
+
effectFunctionImportedName(tsUtils.getSourceFileOfNode(node)),
|
|
32873
|
+
flatMap18((functionIdentifier) => {
|
|
32874
|
+
if (functionIdentifier && ts.isIdentifier(baseExpression) && ts.idText(baseExpression) === functionIdentifier) {
|
|
32875
|
+
if (node.arguments.length === 0) {
|
|
32876
|
+
return typeParserIssue("Node is not a pipe call", void 0, node);
|
|
32877
|
+
}
|
|
32878
|
+
const [subject, ...args3] = node.arguments;
|
|
32879
|
+
return succeed17({
|
|
32880
|
+
node,
|
|
32881
|
+
subject,
|
|
32882
|
+
args: args3,
|
|
32883
|
+
kind: "pipe"
|
|
32884
|
+
});
|
|
32885
|
+
}
|
|
32886
|
+
return succeed17({
|
|
32887
|
+
node,
|
|
32888
|
+
subject: baseExpression,
|
|
32889
|
+
args: Array.from(node.arguments),
|
|
32890
|
+
kind: "pipeable"
|
|
32891
|
+
});
|
|
32892
|
+
})
|
|
32893
|
+
);
|
|
32814
32894
|
}
|
|
32815
32895
|
if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && ts.idText(node.expression) === "pipe" && node.arguments.length > 0) {
|
|
32816
32896
|
const [subject, ...args3] = node.arguments;
|
|
@@ -32825,17 +32905,10 @@ function make64(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
32825
32905
|
fn2("TypeParser.scopeType")(function* (type2, atLocation) {
|
|
32826
32906
|
yield* pipeableType(type2, atLocation);
|
|
32827
32907
|
const propertiesSymbols = typeChecker.getPropertiesOfType(type2).filter(
|
|
32828
|
-
(_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration
|
|
32908
|
+
(_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration
|
|
32829
32909
|
);
|
|
32830
|
-
propertiesSymbols.
|
|
32831
|
-
|
|
32832
|
-
);
|
|
32833
|
-
for (const propertySymbol of propertiesSymbols) {
|
|
32834
|
-
const computedPropertyExpression = propertySymbol.valueDeclaration.name;
|
|
32835
|
-
const symbol3 = typeChecker.getSymbolAtLocation(computedPropertyExpression.expression);
|
|
32836
|
-
if (symbol3 && ts.symbolName(symbol3) === "ScopeTypeId") {
|
|
32837
|
-
return type2;
|
|
32838
|
-
}
|
|
32910
|
+
if (propertiesSymbols.some((s) => ts.symbolName(s).indexOf("ScopeTypeId") !== -1)) {
|
|
32911
|
+
return type2;
|
|
32839
32912
|
}
|
|
32840
32913
|
return yield* typeParserIssue("Type has no scope type id", type2, atLocation);
|
|
32841
32914
|
}),
|
|
@@ -33341,12 +33414,38 @@ function make64(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
33341
33414
|
"TypeParser.extendsEffectSqlModelClass",
|
|
33342
33415
|
(atLocation) => atLocation
|
|
33343
33416
|
);
|
|
33417
|
+
const isEffectLayerTypeSourceFile = cachedBy(
|
|
33418
|
+
fn2("TypeParser.isEffectLayerTypeSourceFile")(function* (sourceFile) {
|
|
33419
|
+
const moduleSymbol = typeChecker.getSymbolAtLocation(sourceFile);
|
|
33420
|
+
if (!moduleSymbol) return yield* typeParserIssue("Node has no symbol", void 0, sourceFile);
|
|
33421
|
+
const layerTypeSymbol = typeChecker.tryGetMemberInModuleExports("Layer", moduleSymbol);
|
|
33422
|
+
if (!layerTypeSymbol) return yield* typeParserIssue("Layer type not found", void 0, sourceFile);
|
|
33423
|
+
const type2 = typeChecker.getDeclaredTypeOfSymbol(layerTypeSymbol);
|
|
33424
|
+
yield* layerType(type2, sourceFile);
|
|
33425
|
+
return sourceFile;
|
|
33426
|
+
}),
|
|
33427
|
+
"TypeParser.isEffectLayerTypeSourceFile",
|
|
33428
|
+
(sourceFile) => sourceFile
|
|
33429
|
+
);
|
|
33430
|
+
const isNodeReferenceToEffectLayerModuleApi = (memberName) => cachedBy(
|
|
33431
|
+
fn2("TypeParser.isNodeReferenceToEffectLayerModuleApi")(function* (node) {
|
|
33432
|
+
return yield* isNodeReferenceToExportOfPackageModule(
|
|
33433
|
+
node,
|
|
33434
|
+
"effect",
|
|
33435
|
+
isEffectLayerTypeSourceFile,
|
|
33436
|
+
memberName
|
|
33437
|
+
);
|
|
33438
|
+
}),
|
|
33439
|
+
`TypeParser.isNodeReferenceToEffectLayerModuleApi(${memberName})`,
|
|
33440
|
+
(node) => node
|
|
33441
|
+
);
|
|
33344
33442
|
return {
|
|
33345
33443
|
isNodeReferenceToEffectModuleApi,
|
|
33346
33444
|
isNodeReferenceToEffectSchemaModuleApi,
|
|
33347
33445
|
isNodeReferenceToEffectDataModuleApi,
|
|
33348
33446
|
isNodeReferenceToEffectContextModuleApi,
|
|
33349
33447
|
isNodeReferenceToEffectSqlModelModuleApi,
|
|
33448
|
+
isNodeReferenceToEffectLayerModuleApi,
|
|
33350
33449
|
effectType,
|
|
33351
33450
|
strictEffectType,
|
|
33352
33451
|
layerType,
|
|
@@ -33478,7 +33577,7 @@ var generate = fn2("writeTagClassAccessors.generate")(function* (sourceFile, ser
|
|
|
33478
33577
|
);
|
|
33479
33578
|
return succeed17(typeNode);
|
|
33480
33579
|
}),
|
|
33481
|
-
|
|
33580
|
+
orElse15(
|
|
33482
33581
|
() => pipe(
|
|
33483
33582
|
typeParser.promiseLike(type2, atLocation2),
|
|
33484
33583
|
flatMap18(({ type: type3 }) => {
|
|
@@ -33507,7 +33606,7 @@ var generate = fn2("writeTagClassAccessors.generate")(function* (sourceFile, ser
|
|
|
33507
33606
|
})
|
|
33508
33607
|
)
|
|
33509
33608
|
),
|
|
33510
|
-
|
|
33609
|
+
orElse15(() => {
|
|
33511
33610
|
const successType = typeChecker.typeToTypeNode(type2, atLocation2, ts.NodeBuilderFlags.NoTruncation);
|
|
33512
33611
|
if (!successType) return fail18("error generating success type");
|
|
33513
33612
|
const typeNode = ts.factory.createTypeReferenceNode(
|
|
@@ -33558,8 +33657,8 @@ var generate = fn2("writeTagClassAccessors.generate")(function* (sourceFile, ser
|
|
|
33558
33657
|
const allSignatures = ts.factory.createIntersectionTypeNode(callSignatures);
|
|
33559
33658
|
const type2 = tsUtils.simplifyTypeNode(allSignatures);
|
|
33560
33659
|
propertyDeclaration = createFunctionProperty(className, ts.symbolName(property), type2, callSignatures.length > 1);
|
|
33561
|
-
const oldProperty = atLocation.members.filter(ts.isPropertyDeclaration).find((
|
|
33562
|
-
const symbol3 = typeChecker.getSymbolAtLocation(
|
|
33660
|
+
const oldProperty = atLocation.members.filter(ts.isPropertyDeclaration).find((p3) => {
|
|
33661
|
+
const symbol3 = typeChecker.getSymbolAtLocation(p3.name);
|
|
33563
33662
|
return symbol3 && ts.symbolName(symbol3) === ts.symbolName(property);
|
|
33564
33663
|
});
|
|
33565
33664
|
if (oldProperty) {
|
|
@@ -33580,10 +33679,12 @@ var parse5 = fn2("writeTagClassAccessors.parse")(function* (node) {
|
|
|
33580
33679
|
const typeParser = yield* service2(TypeParser);
|
|
33581
33680
|
const typeCheckerUtils = yield* service2(TypeCheckerUtils);
|
|
33582
33681
|
if (!ts.isClassDeclaration(node)) return yield* fail18("not a class declaration");
|
|
33583
|
-
const { Service, accessors: accessors2, className } = yield* pipe(
|
|
33584
|
-
typeParser.extendsEffectService(node),
|
|
33585
|
-
|
|
33586
|
-
|
|
33682
|
+
const { Service, accessors: accessors2, className, kind } = yield* pipe(
|
|
33683
|
+
map34(typeParser.extendsEffectService(node), (_) => ({ kind: "effectService", ..._ })),
|
|
33684
|
+
orElse15(
|
|
33685
|
+
() => map34(typeParser.extendsEffectTag(node), (_) => ({ kind: "effectTag", accessors: true, ..._ }))
|
|
33686
|
+
),
|
|
33687
|
+
orElse15(() => fail18("not a class extending Effect.Service call"))
|
|
33587
33688
|
);
|
|
33588
33689
|
if (accessors2 !== true) return yield* fail18("accessors are not enabled in the Effect.Service call");
|
|
33589
33690
|
const involvedMembers = [];
|
|
@@ -33604,7 +33705,7 @@ var parse5 = fn2("writeTagClassAccessors.parse")(function* (node) {
|
|
|
33604
33705
|
const hash2 = involvedMembers.map(({ property, propertyType }) => {
|
|
33605
33706
|
return ts.symbolName(property) + ": " + typeChecker.typeToString(propertyType);
|
|
33606
33707
|
}).concat([ts.idText(className)]).join("\n");
|
|
33607
|
-
return { Service, className, atLocation: node, hash: cyrb53(hash2), involvedMembers };
|
|
33708
|
+
return { Service, className, atLocation: node, hash: cyrb53(hash2), involvedMembers, kind };
|
|
33608
33709
|
});
|
|
33609
33710
|
var writeTagClassAccessors = createRefactor({
|
|
33610
33711
|
name: "writeTagClassAccessors",
|
|
@@ -33631,7 +33732,7 @@ var writeTagClassAccessors = createRefactor({
|
|
|
33631
33732
|
const parentNodes = tsUtils.getAncestorNodesInRange(sourceFile, textRange);
|
|
33632
33733
|
return yield* pipe(
|
|
33633
33734
|
firstSuccessOf2(parentNodes.map(parseNode)),
|
|
33634
|
-
|
|
33735
|
+
orElse15(() => fail18(new RefactorNotApplicableError()))
|
|
33635
33736
|
);
|
|
33636
33737
|
})
|
|
33637
33738
|
});
|
|
@@ -33663,7 +33764,7 @@ var accessors = createCodegen({
|
|
|
33663
33764
|
)
|
|
33664
33765
|
})
|
|
33665
33766
|
),
|
|
33666
|
-
|
|
33767
|
+
orElse15((cause2) => fail18(new CodegenNotApplicableError(cause2)))
|
|
33667
33768
|
);
|
|
33668
33769
|
})
|
|
33669
33770
|
});
|
|
@@ -34197,7 +34298,7 @@ var process2 = fn2("StructuralSchemaGen.process")(
|
|
|
34197
34298
|
if (type2) {
|
|
34198
34299
|
const schemaType = yield* pipe(
|
|
34199
34300
|
typeParser.effectSchemaType(type2, scope4),
|
|
34200
|
-
|
|
34301
|
+
orElse15(() => void_8)
|
|
34201
34302
|
);
|
|
34202
34303
|
if (schemaType) {
|
|
34203
34304
|
ctx.hoistedSchemas.set(
|
|
@@ -34223,7 +34324,7 @@ var process2 = fn2("StructuralSchemaGen.process")(
|
|
|
34223
34324
|
...fromIterable(ctx.nameToType.entries()).map(
|
|
34224
34325
|
([name, type2]) => pipe(
|
|
34225
34326
|
processType(type2),
|
|
34226
|
-
|
|
34327
|
+
orElse15(
|
|
34227
34328
|
(error4) => succeed17(ts.addSyntheticLeadingComment(
|
|
34228
34329
|
ts.factory.createIdentifier(""),
|
|
34229
34330
|
ts.SyntaxKind.MultiLineCommentTrivia,
|
|
@@ -34496,7 +34597,7 @@ var codegen = make58(
|
|
|
34496
34597
|
for (const { codegen: codegen2, hash: hash2, range: range3 } of codegensWithRanges) {
|
|
34497
34598
|
const applicable = yield* pipe(
|
|
34498
34599
|
getEditsForCodegen([codegen2], sourceFile, range3),
|
|
34499
|
-
|
|
34600
|
+
orElse15(() => void_8)
|
|
34500
34601
|
);
|
|
34501
34602
|
if (applicable && (applicable.hash !== hash2 || force3)) {
|
|
34502
34603
|
const changes2 = tsInstance.textChanges.ChangeTracker.with(
|
|
@@ -34556,6 +34657,8 @@ var codegen = make58(
|
|
|
34556
34657
|
${checkedFilesCount} checked and ${updatedFilesCount} updated.`
|
|
34557
34658
|
);
|
|
34558
34659
|
})
|
|
34660
|
+
).pipe(
|
|
34661
|
+
withDescription6("Regenarate the outdated effect-codegens provided by the effect-language-service.")
|
|
34559
34662
|
);
|
|
34560
34663
|
|
|
34561
34664
|
// src/cli/diagnostics.ts
|
|
@@ -34594,8 +34697,8 @@ var anyUnknownInErrorContext = createDiagnostic({
|
|
|
34594
34697
|
if (!type3) continue;
|
|
34595
34698
|
const expectedEffect = yield* pipe(
|
|
34596
34699
|
typeParser.strictEffectType(type3, node.type),
|
|
34597
|
-
|
|
34598
|
-
|
|
34700
|
+
orElse15(() => typeParser.layerType(type3, typeNode)),
|
|
34701
|
+
orElse15(() => void_8)
|
|
34599
34702
|
);
|
|
34600
34703
|
if (expectedEffect) continue;
|
|
34601
34704
|
}
|
|
@@ -34612,7 +34715,7 @@ var anyUnknownInErrorContext = createDiagnostic({
|
|
|
34612
34715
|
if (!type2) continue;
|
|
34613
34716
|
yield* pipe(
|
|
34614
34717
|
typeParser.strictEffectType(type2, node),
|
|
34615
|
-
|
|
34718
|
+
orElse15(() => pipe(typeParser.layerType(type2, node), map34(({ E, RIn }) => ({ E, R: RIn })))),
|
|
34616
34719
|
map34((effectOrLayer) => {
|
|
34617
34720
|
const { E, R } = effectOrLayer;
|
|
34618
34721
|
const hasAnyUnknownR = isAnyOrUnknown(R);
|
|
@@ -34664,6 +34767,100 @@ var anyUnknownInErrorContext = createDiagnostic({
|
|
|
34664
34767
|
})
|
|
34665
34768
|
});
|
|
34666
34769
|
|
|
34770
|
+
// src/diagnostics/catchAllToMapError.ts
|
|
34771
|
+
var catchAllToMapError = createDiagnostic({
|
|
34772
|
+
name: "catchAllToMapError",
|
|
34773
|
+
code: 39,
|
|
34774
|
+
description: "Suggests using Effect.mapError instead of Effect.catchAll when the callback only wraps the error with Effect.fail",
|
|
34775
|
+
severity: "suggestion",
|
|
34776
|
+
apply: fn2("catchAllToMapError.apply")(function* (sourceFile, report) {
|
|
34777
|
+
const ts = yield* service2(TypeScriptApi);
|
|
34778
|
+
const typeParser = yield* service2(TypeParser);
|
|
34779
|
+
const getFunctionBody = (node) => {
|
|
34780
|
+
if (ts.isArrowFunction(node)) {
|
|
34781
|
+
return node.body;
|
|
34782
|
+
}
|
|
34783
|
+
if (ts.isFunctionExpression(node)) {
|
|
34784
|
+
return node.body;
|
|
34785
|
+
}
|
|
34786
|
+
return void 0;
|
|
34787
|
+
};
|
|
34788
|
+
const getEffectFailCallInfo = (body) => {
|
|
34789
|
+
return gen3(function* () {
|
|
34790
|
+
if (ts.isCallExpression(body)) {
|
|
34791
|
+
const isFailCall = yield* pipe(
|
|
34792
|
+
typeParser.isNodeReferenceToEffectModuleApi("fail")(body.expression),
|
|
34793
|
+
option4
|
|
34794
|
+
);
|
|
34795
|
+
if (isSome2(isFailCall) && body.arguments.length >= 1) {
|
|
34796
|
+
return some2({ failCall: body, failArg: body.arguments[0] });
|
|
34797
|
+
}
|
|
34798
|
+
}
|
|
34799
|
+
if (ts.isBlock(body)) {
|
|
34800
|
+
const statements = body.statements;
|
|
34801
|
+
if (statements.length === 1) {
|
|
34802
|
+
const stmt = statements[0];
|
|
34803
|
+
if (ts.isReturnStatement(stmt) && stmt.expression && ts.isCallExpression(stmt.expression)) {
|
|
34804
|
+
const isFailCall = yield* pipe(
|
|
34805
|
+
typeParser.isNodeReferenceToEffectModuleApi("fail")(stmt.expression.expression),
|
|
34806
|
+
option4
|
|
34807
|
+
);
|
|
34808
|
+
if (isSome2(isFailCall) && stmt.expression.arguments.length >= 1) {
|
|
34809
|
+
return some2({ failCall: stmt.expression, failArg: stmt.expression.arguments[0] });
|
|
34810
|
+
}
|
|
34811
|
+
}
|
|
34812
|
+
}
|
|
34813
|
+
}
|
|
34814
|
+
return none2();
|
|
34815
|
+
});
|
|
34816
|
+
};
|
|
34817
|
+
const nodeToVisit = [];
|
|
34818
|
+
const appendNodeToVisit = (node) => {
|
|
34819
|
+
nodeToVisit.push(node);
|
|
34820
|
+
return void 0;
|
|
34821
|
+
};
|
|
34822
|
+
ts.forEachChild(sourceFile, appendNodeToVisit);
|
|
34823
|
+
while (nodeToVisit.length > 0) {
|
|
34824
|
+
const node = nodeToVisit.shift();
|
|
34825
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
34826
|
+
if (ts.isCallExpression(node)) {
|
|
34827
|
+
const isCatchAllCall = yield* pipe(
|
|
34828
|
+
typeParser.isNodeReferenceToEffectModuleApi("catchAll")(node.expression),
|
|
34829
|
+
option4
|
|
34830
|
+
);
|
|
34831
|
+
if (isSome2(isCatchAllCall)) {
|
|
34832
|
+
const callback = node.arguments[0];
|
|
34833
|
+
if (!callback) continue;
|
|
34834
|
+
const functionBody = getFunctionBody(callback);
|
|
34835
|
+
if (!functionBody) continue;
|
|
34836
|
+
const failCallInfo = yield* getEffectFailCallInfo(functionBody);
|
|
34837
|
+
if (isNone2(failCallInfo)) continue;
|
|
34838
|
+
const { failArg, failCall } = failCallInfo.value;
|
|
34839
|
+
report({
|
|
34840
|
+
location: node.expression,
|
|
34841
|
+
messageText: `You can use Effect.mapError instead of Effect.catchAll + Effect.fail to transform the error type.`,
|
|
34842
|
+
fixes: [{
|
|
34843
|
+
fixName: "catchAllToMapError_fix",
|
|
34844
|
+
description: "Replace with Effect.mapError",
|
|
34845
|
+
apply: gen3(function* () {
|
|
34846
|
+
const changeTracker = yield* service2(ChangeTracker);
|
|
34847
|
+
if (ts.isPropertyAccessExpression(node.expression)) {
|
|
34848
|
+
changeTracker.replaceNode(
|
|
34849
|
+
sourceFile,
|
|
34850
|
+
node.expression.name,
|
|
34851
|
+
ts.factory.createIdentifier("mapError")
|
|
34852
|
+
);
|
|
34853
|
+
}
|
|
34854
|
+
changeTracker.replaceNode(sourceFile, failCall, failArg);
|
|
34855
|
+
})
|
|
34856
|
+
}]
|
|
34857
|
+
});
|
|
34858
|
+
}
|
|
34859
|
+
}
|
|
34860
|
+
}
|
|
34861
|
+
})
|
|
34862
|
+
});
|
|
34863
|
+
|
|
34667
34864
|
// src/diagnostics/catchUnfailableEffect.ts
|
|
34668
34865
|
var catchUnfailableEffect = createDiagnostic({
|
|
34669
34866
|
name: "catchUnfailableEffect",
|
|
@@ -34760,14 +34957,14 @@ var classSelfMismatch = createDiagnostic({
|
|
|
34760
34957
|
if (ts.isClassDeclaration(node) && node.name && node.heritageClauses) {
|
|
34761
34958
|
const result = yield* pipe(
|
|
34762
34959
|
typeParser.extendsEffectService(node),
|
|
34763
|
-
|
|
34764
|
-
|
|
34765
|
-
|
|
34766
|
-
|
|
34767
|
-
|
|
34768
|
-
|
|
34769
|
-
|
|
34770
|
-
|
|
34960
|
+
orElse15(() => typeParser.extendsContextTag(node)),
|
|
34961
|
+
orElse15(() => typeParser.extendsEffectTag(node)),
|
|
34962
|
+
orElse15(() => typeParser.extendsSchemaClass(node)),
|
|
34963
|
+
orElse15(() => typeParser.extendsSchemaTaggedClass(node)),
|
|
34964
|
+
orElse15(() => typeParser.extendsSchemaTaggedError(node)),
|
|
34965
|
+
orElse15(() => typeParser.extendsSchemaTaggedRequest(node)),
|
|
34966
|
+
orElse15(() => typeParser.extendsEffectSqlModelClass(node)),
|
|
34967
|
+
orElse15(() => void_8)
|
|
34771
34968
|
);
|
|
34772
34969
|
if (result) {
|
|
34773
34970
|
const { className, selfTypeNode } = result;
|
|
@@ -34949,19 +35146,19 @@ var deterministicKeys = createDiagnostic({
|
|
|
34949
35146
|
const result = yield* pipe(
|
|
34950
35147
|
pipe(
|
|
34951
35148
|
typeParser.extendsEffectService(node),
|
|
34952
|
-
|
|
34953
|
-
|
|
35149
|
+
orElse15(() => typeParser.extendsContextTag(node)),
|
|
35150
|
+
orElse15(() => typeParser.extendsEffectTag(node)),
|
|
34954
35151
|
map34(({ className, keyStringLiteral }) => ({ keyStringLiteral, className, target: "service" }))
|
|
34955
35152
|
),
|
|
34956
|
-
|
|
35153
|
+
orElse15(
|
|
34957
35154
|
() => pipe(
|
|
34958
35155
|
typeParser.extendsDataTaggedError(node),
|
|
34959
|
-
|
|
35156
|
+
orElse15(() => typeParser.extendsSchemaTaggedError(node)),
|
|
34960
35157
|
map34(({ className, keyStringLiteral }) => ({ keyStringLiteral, className, target: "error" }))
|
|
34961
35158
|
)
|
|
34962
35159
|
),
|
|
34963
|
-
|
|
34964
|
-
|
|
35160
|
+
orElse15(() => parseExtendsCustom(node)),
|
|
35161
|
+
orElse15(() => void_8)
|
|
34965
35162
|
);
|
|
34966
35163
|
if (result && result.keyStringLiteral) {
|
|
34967
35164
|
const { className, keyStringLiteral, target } = result;
|
|
@@ -35162,7 +35359,7 @@ var floatingEffect = createDiagnostic({
|
|
|
35162
35359
|
if (isSome2(effect3)) {
|
|
35163
35360
|
const allowedFloatingEffects = yield* pipe(
|
|
35164
35361
|
typeParser.fiberType(type2, node.expression),
|
|
35165
|
-
|
|
35362
|
+
orElse15(() => typeParser.effectSubtype(type2, node.expression)),
|
|
35166
35363
|
option4
|
|
35167
35364
|
);
|
|
35168
35365
|
if (isNone2(allowedFloatingEffects)) {
|
|
@@ -35218,7 +35415,7 @@ var genericEffectServices = createDiagnostic({
|
|
|
35218
35415
|
fixes: []
|
|
35219
35416
|
});
|
|
35220
35417
|
}),
|
|
35221
|
-
|
|
35418
|
+
orElse15(() => sync11(() => ts.forEachChild(node, appendNodeToVisit))),
|
|
35222
35419
|
ignore3
|
|
35223
35420
|
);
|
|
35224
35421
|
}
|
|
@@ -35226,6 +35423,65 @@ var genericEffectServices = createDiagnostic({
|
|
|
35226
35423
|
})
|
|
35227
35424
|
});
|
|
35228
35425
|
|
|
35426
|
+
// src/diagnostics/globalErrorInEffectCatch.ts
|
|
35427
|
+
var globalErrorInEffectCatch = createDiagnostic({
|
|
35428
|
+
name: "globalErrorInEffectCatch",
|
|
35429
|
+
code: 36,
|
|
35430
|
+
description: "Warns when catch callbacks return global Error type instead of typed errors",
|
|
35431
|
+
severity: "warning",
|
|
35432
|
+
apply: fn2("globalErrorInEffectCatch.apply")(function* (sourceFile, report) {
|
|
35433
|
+
const ts = yield* service2(TypeScriptApi);
|
|
35434
|
+
const typeParser = yield* service2(TypeParser);
|
|
35435
|
+
const typeChecker = yield* service2(TypeCheckerApi);
|
|
35436
|
+
const typeCheckerUtils = yield* service2(TypeCheckerUtils);
|
|
35437
|
+
const nodeToVisit = [];
|
|
35438
|
+
const appendNodeToVisit = (node) => {
|
|
35439
|
+
nodeToVisit.push(node);
|
|
35440
|
+
return void 0;
|
|
35441
|
+
};
|
|
35442
|
+
ts.forEachChild(sourceFile, appendNodeToVisit);
|
|
35443
|
+
while (nodeToVisit.length > 0) {
|
|
35444
|
+
const node = nodeToVisit.shift();
|
|
35445
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
35446
|
+
if (ts.isCallExpression(node)) {
|
|
35447
|
+
const isEffectWithCatch = yield* pipe(
|
|
35448
|
+
typeParser.isNodeReferenceToEffectModuleApi("tryPromise")(node.expression),
|
|
35449
|
+
orElse15(() => typeParser.isNodeReferenceToEffectModuleApi("try")(node.expression)),
|
|
35450
|
+
orElse15(() => typeParser.isNodeReferenceToEffectModuleApi("tryMap")(node.expression)),
|
|
35451
|
+
orElse15(() => typeParser.isNodeReferenceToEffectModuleApi("tryMapPromise")(node.expression)),
|
|
35452
|
+
orElse15(() => void_8)
|
|
35453
|
+
);
|
|
35454
|
+
if (isEffectWithCatch) {
|
|
35455
|
+
const signature = typeChecker.getResolvedSignature(node);
|
|
35456
|
+
if (signature) {
|
|
35457
|
+
const objectType = typeChecker.getParameterType(signature, 0);
|
|
35458
|
+
const catchFunctionSymbol = typeChecker.getPropertyOfType(objectType, "catch");
|
|
35459
|
+
if (catchFunctionSymbol) {
|
|
35460
|
+
const catchFunctionType = typeChecker.getTypeOfSymbolAtLocation(catchFunctionSymbol, node);
|
|
35461
|
+
const signatures = typeChecker.getSignaturesOfType(catchFunctionType, ts.SignatureKind.Call);
|
|
35462
|
+
if (signatures.length > 0) {
|
|
35463
|
+
const returnType = typeChecker.getReturnTypeOfSignature(signatures[0]);
|
|
35464
|
+
if (returnType && typeCheckerUtils.isGlobalErrorType(returnType)) {
|
|
35465
|
+
const nodeText = sourceFile.text.substring(
|
|
35466
|
+
ts.getTokenPosOfNode(node.expression, sourceFile),
|
|
35467
|
+
node.expression.end
|
|
35468
|
+
);
|
|
35469
|
+
report({
|
|
35470
|
+
location: node.expression,
|
|
35471
|
+
messageText: `The 'catch' callback in ${nodeText} returns the global Error type. It's not recommended to use the global Error type in Effect failures as they can get merged together.
|
|
35472
|
+
Instead, use tagged errors or custom errors with a discriminator property to get properly type-checked errors.`,
|
|
35473
|
+
fixes: []
|
|
35474
|
+
});
|
|
35475
|
+
}
|
|
35476
|
+
}
|
|
35477
|
+
}
|
|
35478
|
+
}
|
|
35479
|
+
}
|
|
35480
|
+
}
|
|
35481
|
+
}
|
|
35482
|
+
})
|
|
35483
|
+
});
|
|
35484
|
+
|
|
35229
35485
|
// src/diagnostics/globalErrorInEffectFailure.ts
|
|
35230
35486
|
var globalErrorInEffectFailure = createDiagnostic({
|
|
35231
35487
|
name: "globalErrorInEffectFailure",
|
|
@@ -35256,7 +35512,7 @@ var globalErrorInEffectFailure = createDiagnostic({
|
|
|
35256
35512
|
return sync11(
|
|
35257
35513
|
() => report({
|
|
35258
35514
|
location: node,
|
|
35259
|
-
messageText: `Effect.fail is called with the global Error type. It's not recommended to use the global Error type in Effect failures as they can get merged together. Instead, use tagged errors
|
|
35515
|
+
messageText: `Effect.fail is called with the global Error type. It's not recommended to use the global Error type in Effect failures as they can get merged together. Instead, use tagged errors or custom errors with a discriminator property to get properly type-checked errors.`,
|
|
35260
35516
|
fixes: []
|
|
35261
35517
|
})
|
|
35262
35518
|
);
|
|
@@ -35411,6 +35667,119 @@ var importFromBarrel = createDiagnostic({
|
|
|
35411
35667
|
})
|
|
35412
35668
|
});
|
|
35413
35669
|
|
|
35670
|
+
// src/diagnostics/layerMergeAllWithDependencies.ts
|
|
35671
|
+
var layerMergeAllWithDependencies = createDiagnostic({
|
|
35672
|
+
name: "layerMergeAllWithDependencies",
|
|
35673
|
+
code: 37,
|
|
35674
|
+
description: "Detects interdependencies in Layer.mergeAll calls where one layer provides a service that another layer requires",
|
|
35675
|
+
severity: "warning",
|
|
35676
|
+
apply: fn2("layerMergeAllWithDependencies.apply")(function* (sourceFile, report) {
|
|
35677
|
+
const ts = yield* service2(TypeScriptApi);
|
|
35678
|
+
const typeChecker = yield* service2(TypeCheckerApi);
|
|
35679
|
+
const typeCheckerUtils = yield* service2(TypeCheckerUtils);
|
|
35680
|
+
const typeParser = yield* service2(TypeParser);
|
|
35681
|
+
const tsUtils = yield* service2(TypeScriptUtils);
|
|
35682
|
+
const layerModuleIdentifier = tsUtils.findImportedModuleIdentifierByPackageAndNameOrBarrel(
|
|
35683
|
+
sourceFile,
|
|
35684
|
+
"effect",
|
|
35685
|
+
"Layer"
|
|
35686
|
+
) || "Layer";
|
|
35687
|
+
const nodeToVisit = [];
|
|
35688
|
+
const appendNodeToVisit = (node) => {
|
|
35689
|
+
nodeToVisit.push(node);
|
|
35690
|
+
return void 0;
|
|
35691
|
+
};
|
|
35692
|
+
ts.forEachChild(sourceFile, appendNodeToVisit);
|
|
35693
|
+
while (nodeToVisit.length > 0) {
|
|
35694
|
+
const node = nodeToVisit.shift();
|
|
35695
|
+
if (ts.isCallExpression(node)) {
|
|
35696
|
+
const checkLayerMergeAll = yield* pipe(
|
|
35697
|
+
typeParser.isNodeReferenceToEffectLayerModuleApi("mergeAll")(node.expression),
|
|
35698
|
+
orElse15(() => void_8)
|
|
35699
|
+
);
|
|
35700
|
+
if (checkLayerMergeAll) {
|
|
35701
|
+
const layerArgs = node.arguments;
|
|
35702
|
+
if (layerArgs.length > 1) {
|
|
35703
|
+
const layerInfos = [];
|
|
35704
|
+
const actuallyProvidedMap = /* @__PURE__ */ new Map();
|
|
35705
|
+
for (const arg of layerArgs) {
|
|
35706
|
+
const argType = typeCheckerUtils.getTypeAtLocation(arg);
|
|
35707
|
+
if (!argType) continue;
|
|
35708
|
+
const layerTypeParsedOption = yield* option4(typeParser.layerType(argType, arg));
|
|
35709
|
+
if (isNone2(layerTypeParsedOption)) continue;
|
|
35710
|
+
const layerTypeParsed = layerTypeParsedOption.value;
|
|
35711
|
+
const providedMembers = typeCheckerUtils.unrollUnionMembers(layerTypeParsed.ROut);
|
|
35712
|
+
for (const providedType of providedMembers) {
|
|
35713
|
+
if (providedType.flags & ts.TypeFlags.Never) continue;
|
|
35714
|
+
const isPassThrough = typeChecker.isTypeAssignableTo(providedType, layerTypeParsed.RIn);
|
|
35715
|
+
if (!isPassThrough) {
|
|
35716
|
+
actuallyProvidedMap.set(providedType, arg);
|
|
35717
|
+
}
|
|
35718
|
+
}
|
|
35719
|
+
layerInfos.push({
|
|
35720
|
+
arg,
|
|
35721
|
+
requirementsType: layerTypeParsed.RIn
|
|
35722
|
+
});
|
|
35723
|
+
}
|
|
35724
|
+
const providerToConsumers = /* @__PURE__ */ new Map();
|
|
35725
|
+
for (const layer12 of layerInfos) {
|
|
35726
|
+
for (const [providedType, providerArg] of actuallyProvidedMap) {
|
|
35727
|
+
if (providerArg === layer12.arg) continue;
|
|
35728
|
+
if (typeChecker.isTypeAssignableTo(providedType, layer12.requirementsType)) {
|
|
35729
|
+
const consumers = providerToConsumers.get(providerArg) || [];
|
|
35730
|
+
consumers.push({ consumer: layer12.arg, providedType });
|
|
35731
|
+
providerToConsumers.set(providerArg, consumers);
|
|
35732
|
+
}
|
|
35733
|
+
}
|
|
35734
|
+
}
|
|
35735
|
+
for (const [providerArg, consumers] of providerToConsumers) {
|
|
35736
|
+
const providedTypes = Array.from(new Set(consumers.map((c) => typeChecker.typeToString(c.providedType)))).join(", ");
|
|
35737
|
+
report({
|
|
35738
|
+
location: providerArg,
|
|
35739
|
+
messageText: `This layer provides ${providedTypes} which is required by another layer in the same Layer.mergeAll call. Layer.mergeAll creates layers in parallel, so dependencies between layers will not be satisfied. Consider moving this layer into a Layer.provideMerge after the Layer.mergeAll.`,
|
|
35740
|
+
fixes: [{
|
|
35741
|
+
fixName: "layerMergeAllWithDependencies_fix",
|
|
35742
|
+
description: "Move layer to Layer.provideMerge",
|
|
35743
|
+
apply: gen3(function* () {
|
|
35744
|
+
const changeTracker = yield* service2(ChangeTracker);
|
|
35745
|
+
const providerIndex = layerArgs.indexOf(providerArg);
|
|
35746
|
+
if (providerIndex === -1) return;
|
|
35747
|
+
const providerArgNode = providerArg;
|
|
35748
|
+
if (providerIndex === 0 && layerArgs.length > 1) {
|
|
35749
|
+
changeTracker.deleteRange(sourceFile, {
|
|
35750
|
+
pos: providerArgNode.pos,
|
|
35751
|
+
end: layerArgs[1].pos
|
|
35752
|
+
});
|
|
35753
|
+
} else if (providerIndex > 0) {
|
|
35754
|
+
changeTracker.deleteRange(sourceFile, {
|
|
35755
|
+
pos: layerArgs[providerIndex - 1].end,
|
|
35756
|
+
end: providerArgNode.end
|
|
35757
|
+
});
|
|
35758
|
+
}
|
|
35759
|
+
const provideMergeCall = ts.factory.createCallExpression(
|
|
35760
|
+
ts.factory.createPropertyAccessExpression(
|
|
35761
|
+
ts.factory.createIdentifier(layerModuleIdentifier),
|
|
35762
|
+
ts.factory.createIdentifier("provideMerge")
|
|
35763
|
+
),
|
|
35764
|
+
void 0,
|
|
35765
|
+
[providerArgNode]
|
|
35766
|
+
);
|
|
35767
|
+
changeTracker.insertNodeAt(sourceFile, node.end, provideMergeCall, {
|
|
35768
|
+
prefix: ".pipe("
|
|
35769
|
+
});
|
|
35770
|
+
changeTracker.insertText(sourceFile, node.end, ")");
|
|
35771
|
+
})
|
|
35772
|
+
}]
|
|
35773
|
+
});
|
|
35774
|
+
}
|
|
35775
|
+
}
|
|
35776
|
+
}
|
|
35777
|
+
}
|
|
35778
|
+
ts.forEachChild(node, appendNodeToVisit);
|
|
35779
|
+
}
|
|
35780
|
+
})
|
|
35781
|
+
});
|
|
35782
|
+
|
|
35414
35783
|
// src/diagnostics/leakingRequirements.ts
|
|
35415
35784
|
var leakingRequirements = createDiagnostic({
|
|
35416
35785
|
name: "leakingRequirements",
|
|
@@ -35437,7 +35806,7 @@ var leakingRequirements = createDiagnostic({
|
|
|
35437
35806
|
yield* pipe(
|
|
35438
35807
|
typeParser.effectType(servicePropertyType, atLocation),
|
|
35439
35808
|
map34((_) => effectContextType = _.R),
|
|
35440
|
-
|
|
35809
|
+
orElse15(() => {
|
|
35441
35810
|
const servicePropertyCallSignatures = typeChecker.getSignaturesOfType(
|
|
35442
35811
|
servicePropertyType,
|
|
35443
35812
|
ts.SignatureKind.Call
|
|
@@ -35467,7 +35836,7 @@ var leakingRequirements = createDiagnostic({
|
|
|
35467
35836
|
return pipe(
|
|
35468
35837
|
typeParser.scopeType(type2, atLocation),
|
|
35469
35838
|
map34(() => true),
|
|
35470
|
-
|
|
35839
|
+
orElse15(() => succeed17(false))
|
|
35471
35840
|
);
|
|
35472
35841
|
}
|
|
35473
35842
|
);
|
|
@@ -35509,6 +35878,7 @@ var leakingRequirements = createDiagnostic({
|
|
|
35509
35878
|
location: node,
|
|
35510
35879
|
messageText: `This Service is leaking the ${requirements.map((_) => typeChecker.typeToString(_)).join(" | ")} requirement.
|
|
35511
35880
|
If these requirements cannot be cached and are expected to be provided per method invocation (e.g. HttpServerRequest), you can either safely disable this diagnostic for this line through quickfixes or mark the service declaration with a JSDoc @effect-leakable-service.
|
|
35881
|
+
Services should usually be collected in the layer creation body, and then provided at each method that requires them.
|
|
35512
35882
|
More info at https://effect.website/docs/requirements-management/layers/#avoiding-requirement-leakage`,
|
|
35513
35883
|
fixes: []
|
|
35514
35884
|
});
|
|
@@ -35546,7 +35916,7 @@ More info at https://effect.website/docs/requirements-management/layers/#avoidin
|
|
|
35546
35916
|
)
|
|
35547
35917
|
)
|
|
35548
35918
|
),
|
|
35549
|
-
|
|
35919
|
+
orElse15(() => sync11(() => ts.forEachChild(node, appendNodeToVisit))),
|
|
35550
35920
|
ignore3
|
|
35551
35921
|
);
|
|
35552
35922
|
}
|
|
@@ -35575,7 +35945,7 @@ var missedPipeableOpportunity = createDiagnostic({
|
|
|
35575
35945
|
while (nodeToVisit.length > 0) {
|
|
35576
35946
|
const node = nodeToVisit.shift();
|
|
35577
35947
|
if (ts.isCallExpression(node) && node.arguments.length === 1) {
|
|
35578
|
-
const isPipeCall = yield* pipe(typeParser.pipeCall(node),
|
|
35948
|
+
const isPipeCall = yield* pipe(typeParser.pipeCall(node), orElse15(() => void_8));
|
|
35579
35949
|
if (!isPipeCall) {
|
|
35580
35950
|
const resolvedSignature = typeChecker.getResolvedSignature(node);
|
|
35581
35951
|
if (resolvedSignature) {
|
|
@@ -35596,7 +35966,7 @@ var missedPipeableOpportunity = createDiagnostic({
|
|
|
35596
35966
|
const subject = parentChain.pop();
|
|
35597
35967
|
const resultType = typeCheckerUtils.getTypeAtLocation(subject);
|
|
35598
35968
|
if (!resultType) continue;
|
|
35599
|
-
const pipeableType = yield* pipe(typeParser.pipeableType(resultType, subject),
|
|
35969
|
+
const pipeableType = yield* pipe(typeParser.pipeableType(resultType, subject), orElse15(() => void_8));
|
|
35600
35970
|
if (pipeableType) {
|
|
35601
35971
|
report({
|
|
35602
35972
|
location: parentChain[0],
|
|
@@ -35847,7 +36217,7 @@ var missingEffectServiceDependency = createDiagnostic({
|
|
|
35847
36217
|
if (ts.isClassDeclaration(node) && node.name && node.heritageClauses) {
|
|
35848
36218
|
const serviceResult = yield* pipe(
|
|
35849
36219
|
typeParser.extendsEffectService(node),
|
|
35850
|
-
|
|
36220
|
+
orElse15(() => void_8)
|
|
35851
36221
|
);
|
|
35852
36222
|
if (serviceResult) {
|
|
35853
36223
|
const { className, options: options3 } = serviceResult;
|
|
@@ -35860,7 +36230,7 @@ var missingEffectServiceDependency = createDiagnostic({
|
|
|
35860
36230
|
const defaultType = typeChecker.getTypeOfSymbolAtLocation(defaultProperty, node);
|
|
35861
36231
|
const layerResult = yield* pipe(
|
|
35862
36232
|
typeParser.layerType(defaultType, node),
|
|
35863
|
-
|
|
36233
|
+
orElse15(() => void_8)
|
|
35864
36234
|
);
|
|
35865
36235
|
if (layerResult) {
|
|
35866
36236
|
const servicesMemory = /* @__PURE__ */ new Map();
|
|
@@ -35884,7 +36254,7 @@ var missingEffectServiceDependency = createDiagnostic({
|
|
|
35884
36254
|
for (const depType of types) {
|
|
35885
36255
|
const depLayerResult = yield* pipe(
|
|
35886
36256
|
typeParser.layerType(depType, options3),
|
|
35887
|
-
|
|
36257
|
+
orElse15(() => void_8)
|
|
35888
36258
|
);
|
|
35889
36259
|
if (depLayerResult) {
|
|
35890
36260
|
const { allIndexes } = yield* typeCheckerUtils.appendToUniqueTypesMap(
|
|
@@ -35918,6 +36288,55 @@ var missingEffectServiceDependency = createDiagnostic({
|
|
|
35918
36288
|
})
|
|
35919
36289
|
});
|
|
35920
36290
|
|
|
36291
|
+
// src/diagnostics/missingLayerContext.ts
|
|
36292
|
+
var missingLayerContext = createDiagnostic({
|
|
36293
|
+
name: "missingLayerContext",
|
|
36294
|
+
code: 38,
|
|
36295
|
+
description: "Reports missing service requirements in Layer context channel",
|
|
36296
|
+
severity: "error",
|
|
36297
|
+
apply: fn2("missingLayerContext.apply")(function* (sourceFile, report) {
|
|
36298
|
+
const typeChecker = yield* service2(TypeCheckerApi);
|
|
36299
|
+
const typeParser = yield* service2(TypeParser);
|
|
36300
|
+
const typeCheckerUtils = yield* service2(TypeCheckerUtils);
|
|
36301
|
+
const checkForMissingContextTypes = (node, expectedType, valueNode, realType) => pipe(
|
|
36302
|
+
all9(
|
|
36303
|
+
typeParser.layerType(expectedType, node),
|
|
36304
|
+
typeParser.layerType(realType, valueNode)
|
|
36305
|
+
),
|
|
36306
|
+
map34(
|
|
36307
|
+
([expectedLayer, realLayer]) => typeCheckerUtils.getMissingTypeEntriesInTargetType(
|
|
36308
|
+
realLayer.RIn,
|
|
36309
|
+
expectedLayer.RIn
|
|
36310
|
+
)
|
|
36311
|
+
)
|
|
36312
|
+
);
|
|
36313
|
+
const sortTypes = sort(typeCheckerUtils.deterministicTypeOrder);
|
|
36314
|
+
const entries2 = getEffectLspPatchSourceFileMetadata(sourceFile)?.relationErrors || typeCheckerUtils.expectedAndRealType(sourceFile);
|
|
36315
|
+
for (const [node, expectedType, valueNode, realType] of entries2) {
|
|
36316
|
+
if (expectedType !== realType) {
|
|
36317
|
+
yield* pipe(
|
|
36318
|
+
checkForMissingContextTypes(
|
|
36319
|
+
node,
|
|
36320
|
+
expectedType,
|
|
36321
|
+
valueNode,
|
|
36322
|
+
realType
|
|
36323
|
+
),
|
|
36324
|
+
map34(
|
|
36325
|
+
(missingTypes) => missingTypes.length > 0 ? report(
|
|
36326
|
+
{
|
|
36327
|
+
location: node,
|
|
36328
|
+
messageText: `Missing '${sortTypes(missingTypes).map((_) => typeChecker.typeToString(_)).join(" | ")}' in the expected Layer context.`,
|
|
36329
|
+
fixes: []
|
|
36330
|
+
}
|
|
36331
|
+
) : void 0
|
|
36332
|
+
),
|
|
36333
|
+
ignore3
|
|
36334
|
+
);
|
|
36335
|
+
}
|
|
36336
|
+
}
|
|
36337
|
+
})
|
|
36338
|
+
});
|
|
36339
|
+
|
|
35921
36340
|
// src/diagnostics/missingReturnYieldStar.ts
|
|
35922
36341
|
var missingReturnYieldStar = createDiagnostic({
|
|
35923
36342
|
name: "missingReturnYieldStar",
|
|
@@ -35951,8 +36370,8 @@ var missingReturnYieldStar = createDiagnostic({
|
|
|
35951
36370
|
const effectGenNode = generatorFunctionOrReturnStatement.parent;
|
|
35952
36371
|
const effectGenLike = yield* pipe(
|
|
35953
36372
|
typeParser.effectGen(effectGenNode),
|
|
35954
|
-
|
|
35955
|
-
|
|
36373
|
+
orElse15(() => typeParser.effectFnUntracedGen(effectGenNode)),
|
|
36374
|
+
orElse15(() => typeParser.effectFnGen(effectGenNode)),
|
|
35956
36375
|
option4
|
|
35957
36376
|
);
|
|
35958
36377
|
if (isSome2(effectGenLike)) {
|
|
@@ -36015,8 +36434,8 @@ var missingStarInYieldEffectGen = createDiagnostic({
|
|
|
36015
36434
|
const effectGenNode = functionStarNode.parent;
|
|
36016
36435
|
yield* pipe(
|
|
36017
36436
|
typeParser.effectGen(effectGenNode),
|
|
36018
|
-
|
|
36019
|
-
|
|
36437
|
+
orElse15(() => typeParser.effectFnUntracedGen(effectGenNode)),
|
|
36438
|
+
orElse15(() => typeParser.effectFnGen(effectGenNode)),
|
|
36020
36439
|
map34(({ generatorFunction }) => {
|
|
36021
36440
|
if (generatorFunction) {
|
|
36022
36441
|
brokenGenerators.add(ts.getTokenPosOfNode(generatorFunction, tsUtils.getSourceFileOfNode(node)));
|
|
@@ -36090,7 +36509,7 @@ var multipleEffectProvide = createDiagnostic({
|
|
|
36090
36509
|
typeParser.isNodeReferenceToEffectModuleApi("provide")(node.expression),
|
|
36091
36510
|
flatMap18(() => typeParser.layerType(type2, layer12)),
|
|
36092
36511
|
map34(() => ({ layer: layer12, node })),
|
|
36093
|
-
|
|
36512
|
+
orElse15(() => void_8)
|
|
36094
36513
|
);
|
|
36095
36514
|
}
|
|
36096
36515
|
return void_8;
|
|
@@ -36186,7 +36605,7 @@ var nonObjectEffectServiceType = createDiagnostic({
|
|
|
36186
36605
|
if (ts.isClassDeclaration(node) && node.name && node.heritageClauses) {
|
|
36187
36606
|
const serviceResult = yield* pipe(
|
|
36188
36607
|
typeParser.extendsEffectService(node),
|
|
36189
|
-
|
|
36608
|
+
orElse15(() => void_8)
|
|
36190
36609
|
);
|
|
36191
36610
|
if (serviceResult && serviceResult.options && ts.isObjectLiteralExpression(serviceResult.options)) {
|
|
36192
36611
|
const options3 = serviceResult.options;
|
|
@@ -36222,7 +36641,7 @@ var nonObjectEffectServiceType = createDiagnostic({
|
|
|
36222
36641
|
if (!valueType) continue;
|
|
36223
36642
|
const effectResult = yield* pipe(
|
|
36224
36643
|
typeParser.effectType(valueType, propertyValue),
|
|
36225
|
-
|
|
36644
|
+
orElse15(() => void_8)
|
|
36226
36645
|
);
|
|
36227
36646
|
if (effectResult) {
|
|
36228
36647
|
if (isPrimitiveType(effectResult.A)) {
|
|
@@ -36235,7 +36654,7 @@ var nonObjectEffectServiceType = createDiagnostic({
|
|
|
36235
36654
|
const returnType = typeChecker.getReturnTypeOfSignature(signature);
|
|
36236
36655
|
const effectReturnResult = yield* pipe(
|
|
36237
36656
|
typeParser.effectType(returnType, propertyValue),
|
|
36238
|
-
|
|
36657
|
+
orElse15(() => void_8)
|
|
36239
36658
|
);
|
|
36240
36659
|
if (effectReturnResult && isPrimitiveType(effectReturnResult.A)) {
|
|
36241
36660
|
report(errorToReport);
|
|
@@ -36283,7 +36702,7 @@ var outdatedEffectCodegen = createDiagnostic({
|
|
|
36283
36702
|
});
|
|
36284
36703
|
}
|
|
36285
36704
|
}),
|
|
36286
|
-
|
|
36705
|
+
orElse15(
|
|
36287
36706
|
(e) => sync11(() => {
|
|
36288
36707
|
_report({
|
|
36289
36708
|
location: range3,
|
|
@@ -36346,7 +36765,7 @@ var overriddenSchemaConstructor = createDiagnostic({
|
|
|
36346
36765
|
const isSchema2 = yield* pipe(
|
|
36347
36766
|
typeParser.effectSchemaType(typeAtLocation, type2.expression),
|
|
36348
36767
|
map34(() => true),
|
|
36349
|
-
|
|
36768
|
+
orElse15(() => succeed17(false))
|
|
36350
36769
|
);
|
|
36351
36770
|
if (isSchema2) {
|
|
36352
36771
|
extendsSchema = true;
|
|
@@ -36469,8 +36888,8 @@ var returnEffectInGen = createDiagnostic({
|
|
|
36469
36888
|
const effectGenNode = generatorOrRegularFunction.parent;
|
|
36470
36889
|
yield* pipe(
|
|
36471
36890
|
typeParser.effectGen(effectGenNode),
|
|
36472
|
-
|
|
36473
|
-
|
|
36891
|
+
orElse15(() => typeParser.effectFnUntracedGen(effectGenNode)),
|
|
36892
|
+
orElse15(() => typeParser.effectFnGen(effectGenNode)),
|
|
36474
36893
|
map34(() => {
|
|
36475
36894
|
const fix = node.expression ? [{
|
|
36476
36895
|
fixName: "returnEffectInGen_fix",
|
|
@@ -36531,9 +36950,9 @@ var runEffectInsideEffect = createDiagnostic({
|
|
|
36531
36950
|
if (node.arguments.length === 0) continue;
|
|
36532
36951
|
const isEffectRunCall = yield* pipe(
|
|
36533
36952
|
parseEffectMethod(node.expression, "runPromise"),
|
|
36534
|
-
|
|
36535
|
-
|
|
36536
|
-
|
|
36953
|
+
orElse15(() => parseEffectMethod(node.expression, "runSync")),
|
|
36954
|
+
orElse15(() => parseEffectMethod(node.expression, "runFork")),
|
|
36955
|
+
orElse15(() => parseEffectMethod(node.expression, "runCallback")),
|
|
36537
36956
|
option4
|
|
36538
36957
|
);
|
|
36539
36958
|
if (isNone2(isEffectRunCall)) continue;
|
|
@@ -36549,8 +36968,8 @@ var runEffectInsideEffect = createDiagnostic({
|
|
|
36549
36968
|
}
|
|
36550
36969
|
const isInEffectGen = yield* pipe(
|
|
36551
36970
|
typeParser.effectGen(possiblyEffectGen),
|
|
36552
|
-
|
|
36553
|
-
|
|
36971
|
+
orElse15(() => typeParser.effectFnUntracedGen(possiblyEffectGen)),
|
|
36972
|
+
orElse15(() => typeParser.effectFnGen(possiblyEffectGen)),
|
|
36554
36973
|
option4
|
|
36555
36974
|
);
|
|
36556
36975
|
if (isSome2(isInEffectGen) && isInEffectGen.value.body.statements.length > 0) {
|
|
@@ -36664,7 +37083,7 @@ var schemaStructWithTag = createDiagnostic({
|
|
|
36664
37083
|
if (ts.isCallExpression(node)) {
|
|
36665
37084
|
const isSchemaStructCall = yield* pipe(
|
|
36666
37085
|
typeParser.isNodeReferenceToEffectSchemaModuleApi("Struct")(node.expression),
|
|
36667
|
-
|
|
37086
|
+
orElse15(() => void_8)
|
|
36668
37087
|
);
|
|
36669
37088
|
if (isSchemaStructCall && node.arguments.length === 1) {
|
|
36670
37089
|
const arg = node.arguments[0];
|
|
@@ -36744,7 +37163,7 @@ var schemaUnionOfLiterals = createDiagnostic({
|
|
|
36744
37163
|
if (ts.isCallExpression(node)) {
|
|
36745
37164
|
const isSchemaUnionCall = yield* pipe(
|
|
36746
37165
|
typeParser.isNodeReferenceToEffectSchemaModuleApi("Union")(node.expression),
|
|
36747
|
-
|
|
37166
|
+
orElse15(() => void_8)
|
|
36748
37167
|
);
|
|
36749
37168
|
if (isSchemaUnionCall) {
|
|
36750
37169
|
const args3 = fromIterable(node.arguments);
|
|
@@ -37038,8 +37457,8 @@ var tryCatchInEffectGen = createDiagnostic({
|
|
|
37038
37457
|
const effectGenNode = generatorOrRegularFunction.parent;
|
|
37039
37458
|
yield* pipe(
|
|
37040
37459
|
typeParser.effectGen(effectGenNode),
|
|
37041
|
-
|
|
37042
|
-
|
|
37460
|
+
orElse15(() => typeParser.effectFnUntracedGen(effectGenNode)),
|
|
37461
|
+
orElse15(() => typeParser.effectFnGen(effectGenNode)),
|
|
37043
37462
|
map34(() => {
|
|
37044
37463
|
report({
|
|
37045
37464
|
location: node,
|
|
@@ -37077,10 +37496,10 @@ var unknownInEffectCatch = createDiagnostic({
|
|
|
37077
37496
|
if (ts.isCallExpression(node)) {
|
|
37078
37497
|
const isEffectWithCatch = yield* pipe(
|
|
37079
37498
|
typeParser.isNodeReferenceToEffectModuleApi("tryPromise")(node.expression),
|
|
37080
|
-
|
|
37081
|
-
|
|
37082
|
-
|
|
37083
|
-
|
|
37499
|
+
orElse15(() => typeParser.isNodeReferenceToEffectModuleApi("try")(node.expression)),
|
|
37500
|
+
orElse15(() => typeParser.isNodeReferenceToEffectModuleApi("tryMap")(node.expression)),
|
|
37501
|
+
orElse15(() => typeParser.isNodeReferenceToEffectModuleApi("tryMapPromise")(node.expression)),
|
|
37502
|
+
orElse15(() => void_8)
|
|
37084
37503
|
);
|
|
37085
37504
|
if (isEffectWithCatch) {
|
|
37086
37505
|
const signature = typeChecker.getResolvedSignature(node);
|
|
@@ -37357,7 +37776,7 @@ var unsupportedServiceAccessors = createDiagnostic({
|
|
|
37357
37776
|
if (ts.isClassDeclaration(node)) {
|
|
37358
37777
|
const parseResult = yield* pipe(
|
|
37359
37778
|
parse5(node),
|
|
37360
|
-
|
|
37779
|
+
orElse15(() => succeed17(null))
|
|
37361
37780
|
);
|
|
37362
37781
|
if (parseResult && parseResult.involvedMembers.length > 0) {
|
|
37363
37782
|
const existingStaticMembers = /* @__PURE__ */ new Set();
|
|
@@ -37373,9 +37792,10 @@ var unsupportedServiceAccessors = createDiagnostic({
|
|
|
37373
37792
|
);
|
|
37374
37793
|
if (missingMembers.length > 0) {
|
|
37375
37794
|
const memberNames = missingMembers.map(({ property }) => `'${ts.symbolName(property)}'`).join(", ");
|
|
37795
|
+
const suggestedFix = parseResult.kind === "effectTag" ? "\nEffect.Tag does not allow to disable accessors, so you may want to use Context.Tag instead." : "";
|
|
37376
37796
|
report({
|
|
37377
37797
|
location: parseResult.className,
|
|
37378
|
-
messageText: `Even if accessors are enabled, accessors for ${memberNames} won't be available because the signature have generic type parameters or multiple call signatures
|
|
37798
|
+
messageText: `Even if accessors are enabled, accessors for ${memberNames} won't be available because the signature have generic type parameters or multiple call signatures.${suggestedFix}`,
|
|
37379
37799
|
fixes: [{
|
|
37380
37800
|
fixName: "unsupportedServiceAccessors_enableCodegen",
|
|
37381
37801
|
description: "Enable accessors codegen",
|
|
@@ -37396,6 +37816,7 @@ var unsupportedServiceAccessors = createDiagnostic({
|
|
|
37396
37816
|
// src/diagnostics.ts
|
|
37397
37817
|
var diagnostics = [
|
|
37398
37818
|
anyUnknownInErrorContext,
|
|
37819
|
+
catchAllToMapError,
|
|
37399
37820
|
catchUnfailableEffect,
|
|
37400
37821
|
classSelfMismatch,
|
|
37401
37822
|
duplicatePackage,
|
|
@@ -37403,6 +37824,7 @@ var diagnostics = [
|
|
|
37403
37824
|
missingEffectContext,
|
|
37404
37825
|
missingEffectError,
|
|
37405
37826
|
missingEffectServiceDependency,
|
|
37827
|
+
missingLayerContext,
|
|
37406
37828
|
floatingEffect,
|
|
37407
37829
|
missingStarInYieldEffectGen,
|
|
37408
37830
|
unnecessaryEffectGen,
|
|
@@ -37430,7 +37852,9 @@ var diagnostics = [
|
|
|
37430
37852
|
runEffectInsideEffect,
|
|
37431
37853
|
schemaUnionOfLiterals,
|
|
37432
37854
|
schemaStructWithTag,
|
|
37433
|
-
|
|
37855
|
+
globalErrorInEffectCatch,
|
|
37856
|
+
globalErrorInEffectFailure,
|
|
37857
|
+
layerMergeAllWithDependencies
|
|
37434
37858
|
];
|
|
37435
37859
|
|
|
37436
37860
|
// src/cli/diagnostics.ts
|
|
@@ -37749,6 +38173,422 @@ var diagnostics2 = make58(
|
|
|
37749
38173
|
const hasFailures = state.errorsCount > 0 || strict2 && state.warningsCount > 0;
|
|
37750
38174
|
if (hasFailures) return yield* sync4(() => process.exit(1));
|
|
37751
38175
|
})
|
|
38176
|
+
).pipe(
|
|
38177
|
+
withDescription6("Gets the effect-language-service diagnostics on the given files or project.")
|
|
38178
|
+
);
|
|
38179
|
+
|
|
38180
|
+
// src/cli/overview.ts
|
|
38181
|
+
var import_project_service3 = __toESM(require_dist2());
|
|
38182
|
+
|
|
38183
|
+
// src/cli/utils/Spinner.ts
|
|
38184
|
+
var DEFAULT_FRAMES = [
|
|
38185
|
+
"\u280B",
|
|
38186
|
+
"\u2819",
|
|
38187
|
+
"\u2839",
|
|
38188
|
+
"\u2838",
|
|
38189
|
+
"\u283C",
|
|
38190
|
+
"\u2834",
|
|
38191
|
+
"\u2826",
|
|
38192
|
+
"\u2827",
|
|
38193
|
+
"\u2807",
|
|
38194
|
+
"\u280F"
|
|
38195
|
+
];
|
|
38196
|
+
var isWindows = typeof process !== "undefined" && process.platform === "win32";
|
|
38197
|
+
var figures2 = {
|
|
38198
|
+
tick: isWindows ? "\u221A" : "\u2714",
|
|
38199
|
+
cross: isWindows ? "\xD7" : "\u2716"
|
|
38200
|
+
};
|
|
38201
|
+
var CLEAR_LINE = cat2(eraseLine3, cursorLeft3);
|
|
38202
|
+
var CURSOR_HIDE = render3(cursorHide3, { style: "pretty" });
|
|
38203
|
+
var CURSOR_SHOW = render3(cursorShow3, { style: "pretty" });
|
|
38204
|
+
var renderDoc = (columns, doc, addNewline = false) => {
|
|
38205
|
+
const prepared = addNewline ? cat2(doc, hardLine2) : doc;
|
|
38206
|
+
return render3(prepared, { style: "pretty", options: { lineWidth: columns } });
|
|
38207
|
+
};
|
|
38208
|
+
var spinner = dual(
|
|
38209
|
+
2,
|
|
38210
|
+
(effect3, options3) => acquireUseRelease2(
|
|
38211
|
+
// acquire
|
|
38212
|
+
gen2(function* () {
|
|
38213
|
+
const terminal = yield* Terminal;
|
|
38214
|
+
yield* orDie2(terminal.display(CURSOR_HIDE));
|
|
38215
|
+
let index = 0;
|
|
38216
|
+
let currentMessage = options3.message;
|
|
38217
|
+
const frames = options3.frames ?? DEFAULT_FRAMES;
|
|
38218
|
+
const frameCount = frames.length;
|
|
38219
|
+
const displayDoc = (doc, addNewline = false) => gen2(function* () {
|
|
38220
|
+
const columns = yield* terminal.columns;
|
|
38221
|
+
const out = renderDoc(columns, doc, addNewline);
|
|
38222
|
+
yield* orDie2(terminal.display(out));
|
|
38223
|
+
});
|
|
38224
|
+
const renderFrame = gen2(function* () {
|
|
38225
|
+
const i = index;
|
|
38226
|
+
index = index + 1;
|
|
38227
|
+
const spinnerDoc = annotate2(text3(frames[i % frameCount]), blue3);
|
|
38228
|
+
const messageDoc = annotate2(text3(currentMessage), bold2);
|
|
38229
|
+
const line4 = hsep2([spinnerDoc, messageDoc]);
|
|
38230
|
+
yield* displayDoc(cat2(CLEAR_LINE, line4));
|
|
38231
|
+
});
|
|
38232
|
+
const computeFinalMessage = (exit4) => match9(exit4, {
|
|
38233
|
+
onFailure: (cause2) => {
|
|
38234
|
+
let baseMessage = currentMessage;
|
|
38235
|
+
if (options3.onFailure) {
|
|
38236
|
+
const failureOption3 = failureOption2(cause2);
|
|
38237
|
+
if (isSome2(failureOption3)) {
|
|
38238
|
+
baseMessage = options3.onFailure(failureOption3.value);
|
|
38239
|
+
}
|
|
38240
|
+
}
|
|
38241
|
+
if (isInterrupted2(cause2)) {
|
|
38242
|
+
return `${baseMessage} (interrupted)`;
|
|
38243
|
+
} else if (isDie2(cause2)) {
|
|
38244
|
+
return `${baseMessage} (died)`;
|
|
38245
|
+
} else {
|
|
38246
|
+
return baseMessage;
|
|
38247
|
+
}
|
|
38248
|
+
},
|
|
38249
|
+
onSuccess: (value5) => options3.onSuccess ? options3.onSuccess(value5) : currentMessage
|
|
38250
|
+
});
|
|
38251
|
+
const renderFinal = (exit4) => gen2(function* () {
|
|
38252
|
+
const icon = isSuccess(exit4) ? annotate2(text3(figures2.tick), green3) : annotate2(text3(figures2.cross), red4);
|
|
38253
|
+
const finalMessage = computeFinalMessage(exit4);
|
|
38254
|
+
const msgDoc = annotate2(text3(finalMessage), bold2);
|
|
38255
|
+
const line4 = hsep2([icon, msgDoc]);
|
|
38256
|
+
yield* displayDoc(cat2(CLEAR_LINE, line4), true);
|
|
38257
|
+
});
|
|
38258
|
+
const handle = {
|
|
38259
|
+
updateMessage: (message) => gen2(function* () {
|
|
38260
|
+
currentMessage = message;
|
|
38261
|
+
yield* renderFrame;
|
|
38262
|
+
})
|
|
38263
|
+
};
|
|
38264
|
+
return {
|
|
38265
|
+
terminal,
|
|
38266
|
+
handle,
|
|
38267
|
+
renderFinal
|
|
38268
|
+
};
|
|
38269
|
+
}),
|
|
38270
|
+
// use
|
|
38271
|
+
({ handle }) => effect3(handle),
|
|
38272
|
+
// release
|
|
38273
|
+
({ renderFinal, terminal }, exitValue) => gen2(function* () {
|
|
38274
|
+
yield* renderFinal(exitValue);
|
|
38275
|
+
}).pipe(
|
|
38276
|
+
// Ensure cursor is shown even if something above failed.
|
|
38277
|
+
ensuring2(orDie2(terminal.display(CURSOR_SHOW)))
|
|
38278
|
+
)
|
|
38279
|
+
)
|
|
38280
|
+
);
|
|
38281
|
+
|
|
38282
|
+
// src/cli/overview.ts
|
|
38283
|
+
var itemOrder = combine2(
|
|
38284
|
+
mapInput2(Order4, (_) => _.filePath),
|
|
38285
|
+
combine2(
|
|
38286
|
+
mapInput2(Order, (_) => _.line),
|
|
38287
|
+
combine2(
|
|
38288
|
+
mapInput2(Order, (_) => _.column),
|
|
38289
|
+
mapInput2(Order4, (_) => _.name)
|
|
38290
|
+
)
|
|
38291
|
+
)
|
|
38292
|
+
);
|
|
38293
|
+
var NoFilesToCheckError2 = class extends TaggedError("NoFilesToCheckError") {
|
|
38294
|
+
get message() {
|
|
38295
|
+
return "No files to check. Please provide an existing .ts file or a project tsconfig.json";
|
|
38296
|
+
}
|
|
38297
|
+
};
|
|
38298
|
+
var BATCH_SIZE3 = 50;
|
|
38299
|
+
var typeToString = (typeChecker, tsInstance, type2) => typeChecker.typeToString(type2, void 0, tsInstance.TypeFormatFlags.NoTruncation);
|
|
38300
|
+
var getLocationFromDeclaration = (declaration, tsInstance) => {
|
|
38301
|
+
const sourceFile = declaration.getSourceFile();
|
|
38302
|
+
if (!sourceFile) return void 0;
|
|
38303
|
+
const { character, line: line4 } = tsInstance.getLineAndCharacterOfPosition(sourceFile, declaration.getStart());
|
|
38304
|
+
return {
|
|
38305
|
+
filePath: sourceFile.fileName,
|
|
38306
|
+
line: line4 + 1,
|
|
38307
|
+
column: character + 1
|
|
38308
|
+
};
|
|
38309
|
+
};
|
|
38310
|
+
var collectExportedItems = (sourceFile, tsInstance, typeChecker) => gen3(function* () {
|
|
38311
|
+
const typeParser = yield* service2(TypeParser);
|
|
38312
|
+
const services = [];
|
|
38313
|
+
const layers = [];
|
|
38314
|
+
const errors = [];
|
|
38315
|
+
const moduleSymbol = typeChecker.getSymbolAtLocation(sourceFile);
|
|
38316
|
+
if (!moduleSymbol) {
|
|
38317
|
+
return { services, layers, errors };
|
|
38318
|
+
}
|
|
38319
|
+
const exports2 = typeChecker.getExportsOfModule(moduleSymbol);
|
|
38320
|
+
const workQueue = exports2.map((s) => {
|
|
38321
|
+
const declarations = s.getDeclarations();
|
|
38322
|
+
const location = declarations && declarations.length > 0 ? getLocationFromDeclaration(declarations[0], tsInstance) : void 0;
|
|
38323
|
+
return [s, tsInstance.symbolName(s), location];
|
|
38324
|
+
});
|
|
38325
|
+
const exploded = /* @__PURE__ */ new WeakSet();
|
|
38326
|
+
while (workQueue.length > 0) {
|
|
38327
|
+
const [symbol3, name, location] = workQueue.shift();
|
|
38328
|
+
if (!location) continue;
|
|
38329
|
+
const type2 = typeChecker.getTypeOfSymbol(symbol3);
|
|
38330
|
+
if (!exploded.has(symbol3)) {
|
|
38331
|
+
exploded.add(symbol3);
|
|
38332
|
+
const properties = typeChecker.getPropertiesOfType(type2);
|
|
38333
|
+
for (const propSymbol of properties) {
|
|
38334
|
+
const propName = tsInstance.symbolName(propSymbol);
|
|
38335
|
+
if (propName === "prototype") continue;
|
|
38336
|
+
const childName = `${name}.${propName}`;
|
|
38337
|
+
workQueue.push([propSymbol, childName, location]);
|
|
38338
|
+
}
|
|
38339
|
+
}
|
|
38340
|
+
const declarations = symbol3.getDeclarations();
|
|
38341
|
+
const declaration = declarations && declarations.length > 0 ? declarations[0] : sourceFile;
|
|
38342
|
+
const docComment = symbol3.getDocumentationComment(typeChecker);
|
|
38343
|
+
const description = docComment.length > 0 ? docComment.map((part) => part.text).join("") : void 0;
|
|
38344
|
+
const contextTagResult = yield* pipe(
|
|
38345
|
+
typeParser.contextTag(type2, declaration),
|
|
38346
|
+
option4
|
|
38347
|
+
);
|
|
38348
|
+
if (isSome2(contextTagResult)) {
|
|
38349
|
+
const serviceType = typeToString(typeChecker, tsInstance, contextTagResult.value.Service);
|
|
38350
|
+
services.push({
|
|
38351
|
+
name,
|
|
38352
|
+
...location,
|
|
38353
|
+
serviceType,
|
|
38354
|
+
description
|
|
38355
|
+
});
|
|
38356
|
+
}
|
|
38357
|
+
let isLayer2 = false;
|
|
38358
|
+
const directLayerResult = yield* pipe(
|
|
38359
|
+
typeParser.layerType(type2, declaration),
|
|
38360
|
+
option4
|
|
38361
|
+
);
|
|
38362
|
+
if (isSome2(directLayerResult)) {
|
|
38363
|
+
isLayer2 = true;
|
|
38364
|
+
} else {
|
|
38365
|
+
const callSignatures = typeChecker.getSignaturesOfType(type2, tsInstance.SignatureKind.Call);
|
|
38366
|
+
for (const sig of callSignatures) {
|
|
38367
|
+
const returnType = typeChecker.getReturnTypeOfSignature(sig);
|
|
38368
|
+
const returnLayerResult = yield* pipe(
|
|
38369
|
+
typeParser.layerType(returnType, declaration),
|
|
38370
|
+
option4
|
|
38371
|
+
);
|
|
38372
|
+
if (isSome2(returnLayerResult)) {
|
|
38373
|
+
isLayer2 = true;
|
|
38374
|
+
break;
|
|
38375
|
+
}
|
|
38376
|
+
}
|
|
38377
|
+
}
|
|
38378
|
+
if (isLayer2) {
|
|
38379
|
+
layers.push({
|
|
38380
|
+
name,
|
|
38381
|
+
...location,
|
|
38382
|
+
layerType: typeToString(typeChecker, tsInstance, type2),
|
|
38383
|
+
description
|
|
38384
|
+
});
|
|
38385
|
+
}
|
|
38386
|
+
let isError = false;
|
|
38387
|
+
let errorType = type2;
|
|
38388
|
+
const directErrorResult = yield* pipe(
|
|
38389
|
+
typeParser.extendsCauseYieldableError(type2),
|
|
38390
|
+
option4
|
|
38391
|
+
);
|
|
38392
|
+
if (isSome2(directErrorResult)) {
|
|
38393
|
+
isError = true;
|
|
38394
|
+
errorType = type2;
|
|
38395
|
+
} else {
|
|
38396
|
+
const constructSignatures = typeChecker.getSignaturesOfType(type2, tsInstance.SignatureKind.Construct);
|
|
38397
|
+
for (const sig of constructSignatures) {
|
|
38398
|
+
const instanceType = typeChecker.getReturnTypeOfSignature(sig);
|
|
38399
|
+
const instanceErrorResult = yield* pipe(
|
|
38400
|
+
typeParser.extendsCauseYieldableError(instanceType),
|
|
38401
|
+
option4
|
|
38402
|
+
);
|
|
38403
|
+
if (isSome2(instanceErrorResult)) {
|
|
38404
|
+
isError = true;
|
|
38405
|
+
errorType = instanceType;
|
|
38406
|
+
break;
|
|
38407
|
+
}
|
|
38408
|
+
}
|
|
38409
|
+
}
|
|
38410
|
+
if (isError) {
|
|
38411
|
+
errors.push({
|
|
38412
|
+
name,
|
|
38413
|
+
...location,
|
|
38414
|
+
errorType: typeToString(typeChecker, tsInstance, errorType),
|
|
38415
|
+
description
|
|
38416
|
+
});
|
|
38417
|
+
}
|
|
38418
|
+
}
|
|
38419
|
+
return { services, layers, errors };
|
|
38420
|
+
});
|
|
38421
|
+
var toRelativePath = (absolutePath, cwd) => {
|
|
38422
|
+
if (absolutePath.startsWith(cwd)) {
|
|
38423
|
+
const relative = absolutePath.slice(cwd.length);
|
|
38424
|
+
return relative.startsWith("/") ? `.${relative}` : `./${relative}`;
|
|
38425
|
+
}
|
|
38426
|
+
return absolutePath;
|
|
38427
|
+
};
|
|
38428
|
+
var dimLine = (text10) => annotate2(text3(text10), blackBright2);
|
|
38429
|
+
var renderService = (svc, cwd) => {
|
|
38430
|
+
const relativePath = toRelativePath(svc.filePath, cwd);
|
|
38431
|
+
const details = [
|
|
38432
|
+
dimLine(`${relativePath}:${svc.line}:${svc.column}`),
|
|
38433
|
+
dimLine(svc.serviceType)
|
|
38434
|
+
];
|
|
38435
|
+
if (svc.description) {
|
|
38436
|
+
details.push(dimLine(svc.description));
|
|
38437
|
+
}
|
|
38438
|
+
return vsep2([
|
|
38439
|
+
text3(svc.name),
|
|
38440
|
+
indent2(vsep2(details), 2),
|
|
38441
|
+
empty32
|
|
38442
|
+
]);
|
|
38443
|
+
};
|
|
38444
|
+
var renderLayer = (layer12, cwd) => {
|
|
38445
|
+
const relativePath = toRelativePath(layer12.filePath, cwd);
|
|
38446
|
+
const details = [
|
|
38447
|
+
dimLine(`${relativePath}:${layer12.line}:${layer12.column}`),
|
|
38448
|
+
dimLine(layer12.layerType)
|
|
38449
|
+
];
|
|
38450
|
+
if (layer12.description) {
|
|
38451
|
+
details.push(dimLine(layer12.description));
|
|
38452
|
+
}
|
|
38453
|
+
return vsep2([
|
|
38454
|
+
text3(layer12.name),
|
|
38455
|
+
indent2(vsep2(details), 2),
|
|
38456
|
+
empty32
|
|
38457
|
+
]);
|
|
38458
|
+
};
|
|
38459
|
+
var renderError4 = (error4, cwd) => {
|
|
38460
|
+
const relativePath = toRelativePath(error4.filePath, cwd);
|
|
38461
|
+
const details = [
|
|
38462
|
+
dimLine(`${relativePath}:${error4.line}:${error4.column}`),
|
|
38463
|
+
dimLine(error4.errorType)
|
|
38464
|
+
];
|
|
38465
|
+
if (error4.description) {
|
|
38466
|
+
details.push(dimLine(error4.description));
|
|
38467
|
+
}
|
|
38468
|
+
return vsep2([
|
|
38469
|
+
text3(error4.name),
|
|
38470
|
+
indent2(vsep2(details), 2),
|
|
38471
|
+
empty32
|
|
38472
|
+
]);
|
|
38473
|
+
};
|
|
38474
|
+
var renderOverview = (result, cwd) => {
|
|
38475
|
+
const lines3 = [];
|
|
38476
|
+
if (result.errors.length > 0) {
|
|
38477
|
+
lines3.push(empty32);
|
|
38478
|
+
lines3.push(annotate2(text3(`Yieldable Errors (${result.errors.length})`), bold2));
|
|
38479
|
+
const sortedErrors = sort(result.errors, itemOrder);
|
|
38480
|
+
const errorDocs = sortedErrors.map((error4) => renderError4(error4, cwd));
|
|
38481
|
+
lines3.push(indent2(vsep2(errorDocs), 2));
|
|
38482
|
+
}
|
|
38483
|
+
if (result.services.length > 0) {
|
|
38484
|
+
lines3.push(empty32);
|
|
38485
|
+
lines3.push(annotate2(text3(`Services (${result.services.length})`), bold2));
|
|
38486
|
+
const sortedServices = sort(result.services, itemOrder);
|
|
38487
|
+
const serviceDocs = sortedServices.map((svc) => renderService(svc, cwd));
|
|
38488
|
+
lines3.push(indent2(vsep2(serviceDocs), 2));
|
|
38489
|
+
}
|
|
38490
|
+
if (result.layers.length > 0) {
|
|
38491
|
+
lines3.push(empty32);
|
|
38492
|
+
lines3.push(annotate2(text3(`Layers (${result.layers.length})`), bold2));
|
|
38493
|
+
const sortedLayers = sort(result.layers, itemOrder);
|
|
38494
|
+
const layerDocs = sortedLayers.map((layer12) => renderLayer(layer12, cwd));
|
|
38495
|
+
lines3.push(indent2(vsep2(layerDocs), 2));
|
|
38496
|
+
}
|
|
38497
|
+
if (result.services.length === 0 && result.layers.length === 0 && result.errors.length === 0) {
|
|
38498
|
+
lines3.push(empty32);
|
|
38499
|
+
lines3.push(text3("No exported services, layers, or errors found."));
|
|
38500
|
+
}
|
|
38501
|
+
return vsep2(lines3);
|
|
38502
|
+
};
|
|
38503
|
+
var collectAllItems = (filesToCheck, tsInstance, onProgress) => gen2(function* () {
|
|
38504
|
+
const services = [];
|
|
38505
|
+
const layers = [];
|
|
38506
|
+
const errors = [];
|
|
38507
|
+
const totalFiles = filesToCheck.size;
|
|
38508
|
+
let processedFiles = 0;
|
|
38509
|
+
for (const batch of chunksOf(filesToCheck, BATCH_SIZE3)) {
|
|
38510
|
+
const { service: service3 } = (0, import_project_service3.createProjectService)({ options: { loadTypeScriptPlugins: false } });
|
|
38511
|
+
for (const filePath of batch) {
|
|
38512
|
+
processedFiles++;
|
|
38513
|
+
yield* onProgress(processedFiles, totalFiles);
|
|
38514
|
+
service3.openClientFile(filePath);
|
|
38515
|
+
try {
|
|
38516
|
+
const scriptInfo = service3.getScriptInfo(filePath);
|
|
38517
|
+
if (!scriptInfo) continue;
|
|
38518
|
+
const projectInfo = scriptInfo.getDefaultProject();
|
|
38519
|
+
const languageService = projectInfo.getLanguageService(true);
|
|
38520
|
+
const program = languageService.getProgram();
|
|
38521
|
+
if (!program) continue;
|
|
38522
|
+
const sourceFile = program.getSourceFile(filePath);
|
|
38523
|
+
if (!sourceFile) continue;
|
|
38524
|
+
const result = pipe(
|
|
38525
|
+
collectExportedItems(sourceFile, tsInstance, program.getTypeChecker()),
|
|
38526
|
+
nanoLayer3,
|
|
38527
|
+
nanoLayer2,
|
|
38528
|
+
nanoLayer,
|
|
38529
|
+
provideService7(TypeCheckerApi, program.getTypeChecker()),
|
|
38530
|
+
provideService7(TypeScriptProgram, program),
|
|
38531
|
+
provideService7(TypeScriptApi, tsInstance),
|
|
38532
|
+
run9,
|
|
38533
|
+
getOrElse(() => ({ services: [], layers: [], errors: [] }))
|
|
38534
|
+
);
|
|
38535
|
+
for (const svc of result.services) {
|
|
38536
|
+
services.push(svc);
|
|
38537
|
+
}
|
|
38538
|
+
for (const layer12 of result.layers) {
|
|
38539
|
+
layers.push(layer12);
|
|
38540
|
+
}
|
|
38541
|
+
for (const error4 of result.errors) {
|
|
38542
|
+
errors.push(error4);
|
|
38543
|
+
}
|
|
38544
|
+
} finally {
|
|
38545
|
+
service3.closeClientFile(filePath);
|
|
38546
|
+
}
|
|
38547
|
+
}
|
|
38548
|
+
yield* yieldNow4();
|
|
38549
|
+
}
|
|
38550
|
+
return { services, layers, errors };
|
|
38551
|
+
});
|
|
38552
|
+
var overview = make58(
|
|
38553
|
+
"overview",
|
|
38554
|
+
{
|
|
38555
|
+
file: file3("file").pipe(
|
|
38556
|
+
optional4,
|
|
38557
|
+
withDescription3("The full path of the file to analyze.")
|
|
38558
|
+
),
|
|
38559
|
+
project: file3("project").pipe(
|
|
38560
|
+
optional4,
|
|
38561
|
+
withDescription3("The full path of the project tsconfig.json file to analyze.")
|
|
38562
|
+
)
|
|
38563
|
+
},
|
|
38564
|
+
fn("overview")(function* ({ file: file5, project: project3 }) {
|
|
38565
|
+
const path2 = yield* Path2;
|
|
38566
|
+
const cwd = path2.resolve(".");
|
|
38567
|
+
const tsInstance = yield* TypeScriptContext;
|
|
38568
|
+
const filesToCheck = isSome2(project3) ? yield* getFileNamesInTsConfig(project3.value) : /* @__PURE__ */ new Set();
|
|
38569
|
+
if (isSome2(file5)) {
|
|
38570
|
+
filesToCheck.add(path2.resolve(file5.value));
|
|
38571
|
+
}
|
|
38572
|
+
if (filesToCheck.size === 0) {
|
|
38573
|
+
return yield* new NoFilesToCheckError2();
|
|
38574
|
+
}
|
|
38575
|
+
const totalFiles = filesToCheck.size;
|
|
38576
|
+
const { errors, layers, services } = yield* spinner(
|
|
38577
|
+
(handle) => collectAllItems(
|
|
38578
|
+
filesToCheck,
|
|
38579
|
+
tsInstance,
|
|
38580
|
+
(current, total) => handle.updateMessage(`Processing file ${current}/${total}...`)
|
|
38581
|
+
),
|
|
38582
|
+
{
|
|
38583
|
+
message: `Processing ${totalFiles} file(s)...`,
|
|
38584
|
+
onSuccess: () => `Processed ${totalFiles} file(s)`
|
|
38585
|
+
}
|
|
38586
|
+
);
|
|
38587
|
+
const doc = renderOverview({ services, layers, errors, totalFilesCount: filesToCheck.size }, cwd);
|
|
38588
|
+
yield* log3(render3(doc, { style: "pretty" }));
|
|
38589
|
+
})
|
|
38590
|
+
).pipe(
|
|
38591
|
+
withDescription6("Provides an overview of Effect-related exports in the given files or project.")
|
|
37752
38592
|
);
|
|
37753
38593
|
|
|
37754
38594
|
// src/cli/patch.ts
|
|
@@ -38002,6 +38842,10 @@ var patch9 = make58(
|
|
|
38002
38842
|
yield* printRememberDeleteTsbuildinfo();
|
|
38003
38843
|
yield* printRememberPrepareScript();
|
|
38004
38844
|
})
|
|
38845
|
+
).pipe(
|
|
38846
|
+
withDescription6(
|
|
38847
|
+
"Patches the typescript package with the effect-language-service, so that effect diagnostics are available at build time with tsc."
|
|
38848
|
+
)
|
|
38005
38849
|
);
|
|
38006
38850
|
|
|
38007
38851
|
// node_modules/.pnpm/@effect+cli@0.73.0_@effect+platform@0.94.0_@effect+printer-ansi@0.47.0_@effect+printer@0.47.0_effect@3.19.13/node_modules/@effect/cli/dist/esm/internal/prompt/confirm.js
|
|
@@ -38038,9 +38882,9 @@ function renderNextFrame7(state, options3) {
|
|
|
38038
38882
|
return gen2(function* () {
|
|
38039
38883
|
const terminal = yield* Terminal;
|
|
38040
38884
|
const columns = yield* terminal.columns;
|
|
38041
|
-
const
|
|
38885
|
+
const figures4 = yield* figures;
|
|
38042
38886
|
const leadingSymbol = annotate2(text3("?"), cyanBright2);
|
|
38043
|
-
const trailingSymbol = annotate2(
|
|
38887
|
+
const trailingSymbol = annotate2(figures4.pointerSmall, blackBright2);
|
|
38044
38888
|
const confirmMessage = state.value ? options3.placeholder.defaultConfirm : options3.placeholder.defaultDeny;
|
|
38045
38889
|
const confirm3 = annotate2(text3(confirmMessage), blackBright2);
|
|
38046
38890
|
const promptMsg = renderOutput6(confirm3, leadingSymbol, trailingSymbol, options3);
|
|
@@ -38056,9 +38900,9 @@ function renderSubmission7(value5, options3) {
|
|
|
38056
38900
|
return gen2(function* () {
|
|
38057
38901
|
const terminal = yield* Terminal;
|
|
38058
38902
|
const columns = yield* terminal.columns;
|
|
38059
|
-
const
|
|
38060
|
-
const leadingSymbol = annotate2(
|
|
38061
|
-
const trailingSymbol = annotate2(
|
|
38903
|
+
const figures4 = yield* figures;
|
|
38904
|
+
const leadingSymbol = annotate2(figures4.tick, green3);
|
|
38905
|
+
const trailingSymbol = annotate2(figures4.ellipsis, blackBright2);
|
|
38062
38906
|
const confirmMessage = value5 ? options3.label.confirm : options3.label.deny;
|
|
38063
38907
|
const confirm3 = text3(confirmMessage);
|
|
38064
38908
|
const promptMsg = renderOutput6(confirm3, leadingSymbol, trailingSymbol, options3);
|
|
@@ -38145,13 +38989,13 @@ function renderOutput7(leadingSymbol, trailingSymbol, options3) {
|
|
|
38145
38989
|
}
|
|
38146
38990
|
});
|
|
38147
38991
|
}
|
|
38148
|
-
function
|
|
38992
|
+
function renderError5(state, pointer) {
|
|
38149
38993
|
return match2(state.error, {
|
|
38150
38994
|
onNone: () => empty32,
|
|
38151
38995
|
onSome: (error4) => match3(error4.split(NEWLINE_REGEX6), {
|
|
38152
38996
|
onEmpty: () => empty32,
|
|
38153
38997
|
onNonEmpty: (errorLines) => {
|
|
38154
|
-
const annotateLine = (line4) => annotate2(text3(line4),
|
|
38998
|
+
const annotateLine = (line4) => annotate2(text3(line4), combine11(italicized2, red4));
|
|
38155
38999
|
const prefix = cat2(annotate2(pointer, red4), space2);
|
|
38156
39000
|
const lines3 = map4(errorLines, (str) => annotateLine(str));
|
|
38157
39001
|
return cursorSavePosition3.pipe(cat2(hardLine2), cat2(prefix), cat2(align2(vsep2(lines3))), cat2(cursorRestorePosition3));
|
|
@@ -38166,7 +39010,7 @@ function renderChoiceDescription2(choice4, isHighlighted) {
|
|
|
38166
39010
|
return empty32;
|
|
38167
39011
|
}
|
|
38168
39012
|
var metaOptionsCount = 2;
|
|
38169
|
-
function renderChoices2(state, options3,
|
|
39013
|
+
function renderChoices2(state, options3, figures4) {
|
|
38170
39014
|
const choices = options3.choices;
|
|
38171
39015
|
const totalChoices = choices.length;
|
|
38172
39016
|
const selectedCount = state.selectedIndices.size;
|
|
@@ -38186,9 +39030,9 @@ function renderChoices2(state, options3, figures3) {
|
|
|
38186
39030
|
const isHighlighted = state.index === index;
|
|
38187
39031
|
let prefix = space2;
|
|
38188
39032
|
if (index === toDisplay.startIndex && toDisplay.startIndex > 0) {
|
|
38189
|
-
prefix =
|
|
39033
|
+
prefix = figures4.arrowUp;
|
|
38190
39034
|
} else if (index === toDisplay.endIndex - 1 && toDisplay.endIndex < allChoices.length) {
|
|
38191
|
-
prefix =
|
|
39035
|
+
prefix = figures4.arrowDown;
|
|
38192
39036
|
}
|
|
38193
39037
|
if (index < metaOptions.length) {
|
|
38194
39038
|
const title = isHighlighted ? annotate2(text3(choice4.title), cyanBright2) : text3(choice4.title);
|
|
@@ -38196,7 +39040,7 @@ function renderChoices2(state, options3, figures3) {
|
|
|
38196
39040
|
} else {
|
|
38197
39041
|
const choiceIndex = index - metaOptions.length;
|
|
38198
39042
|
const isSelected = state.selectedIndices.has(choiceIndex);
|
|
38199
|
-
const checkbox = isSelected ?
|
|
39043
|
+
const checkbox = isSelected ? figures4.checkboxOn : figures4.checkboxOff;
|
|
38200
39044
|
const annotatedCheckbox = isHighlighted ? annotate2(checkbox, cyanBright2) : checkbox;
|
|
38201
39045
|
const title = text3(choice4.title);
|
|
38202
39046
|
const description = renderChoiceDescription2(choice4, isHighlighted);
|
|
@@ -38209,12 +39053,12 @@ function renderNextFrame8(state, options3) {
|
|
|
38209
39053
|
return gen2(function* () {
|
|
38210
39054
|
const terminal = yield* Terminal;
|
|
38211
39055
|
const columns = yield* terminal.columns;
|
|
38212
|
-
const
|
|
38213
|
-
const choices = renderChoices2(state, options3,
|
|
39056
|
+
const figures4 = yield* figures;
|
|
39057
|
+
const choices = renderChoices2(state, options3, figures4);
|
|
38214
39058
|
const leadingSymbol = annotate2(text3("?"), cyanBright2);
|
|
38215
|
-
const trailingSymbol = annotate2(
|
|
39059
|
+
const trailingSymbol = annotate2(figures4.pointerSmall, blackBright2);
|
|
38216
39060
|
const promptMsg = renderOutput7(leadingSymbol, trailingSymbol, options3);
|
|
38217
|
-
const error4 =
|
|
39061
|
+
const error4 = renderError5(state, figures4.pointer);
|
|
38218
39062
|
return cursorHide3.pipe(cat2(promptMsg), cat2(hardLine2), cat2(choices), cat2(error4), render3({
|
|
38219
39063
|
style: "pretty",
|
|
38220
39064
|
options: {
|
|
@@ -38227,12 +39071,12 @@ function renderSubmission8(state, options3) {
|
|
|
38227
39071
|
return gen2(function* () {
|
|
38228
39072
|
const terminal = yield* Terminal;
|
|
38229
39073
|
const columns = yield* terminal.columns;
|
|
38230
|
-
const
|
|
39074
|
+
const figures4 = yield* figures;
|
|
38231
39075
|
const selectedChoices = Array.from(state.selectedIndices).sort(Order).map((index) => options3.choices[index].title);
|
|
38232
39076
|
const selectedText = selectedChoices.join(", ");
|
|
38233
39077
|
const selected = text3(selectedText);
|
|
38234
|
-
const leadingSymbol = annotate2(
|
|
38235
|
-
const trailingSymbol = annotate2(
|
|
39078
|
+
const leadingSymbol = annotate2(figures4.tick, green3);
|
|
39079
|
+
const trailingSymbol = annotate2(figures4.ellipsis, blackBright2);
|
|
38236
39080
|
const promptMsg = renderOutput7(leadingSymbol, trailingSymbol, options3);
|
|
38237
39081
|
return promptMsg.pipe(cat2(space2), cat2(annotate2(selected, white4)), cat2(hardLine2), render3({
|
|
38238
39082
|
style: "pretty",
|
|
@@ -38404,7 +39248,7 @@ var text9 = text5;
|
|
|
38404
39248
|
// package.json
|
|
38405
39249
|
var package_default = {
|
|
38406
39250
|
name: "@effect/language-service",
|
|
38407
|
-
version: "0.
|
|
39251
|
+
version: "0.64.1",
|
|
38408
39252
|
packageManager: "pnpm@8.11.0",
|
|
38409
39253
|
publishConfig: {
|
|
38410
39254
|
access: "public",
|
|
@@ -39310,15 +40154,15 @@ var defaultFigures2 = {
|
|
|
39310
40154
|
tick: text3("\u2714"),
|
|
39311
40155
|
pointerSmall: text3("\u203A")
|
|
39312
40156
|
};
|
|
39313
|
-
var
|
|
40157
|
+
var figures3 = succeed7(defaultFigures2);
|
|
39314
40158
|
var renderBeep9 = render3(beep3, { style: "pretty" });
|
|
39315
40159
|
function getSeverityStyle(severity) {
|
|
39316
40160
|
const styles = {
|
|
39317
|
-
off:
|
|
39318
|
-
suggestion:
|
|
39319
|
-
message:
|
|
39320
|
-
warning:
|
|
39321
|
-
error:
|
|
40161
|
+
off: combine11(white4, bgBlackBright2),
|
|
40162
|
+
suggestion: combine11(white4, bgCyan2),
|
|
40163
|
+
message: combine11(white4, bgBlue2),
|
|
40164
|
+
warning: combine11(white4, bgYellow2),
|
|
40165
|
+
error: combine11(white4, bgRed2)
|
|
39322
40166
|
};
|
|
39323
40167
|
return styles[severity];
|
|
39324
40168
|
}
|
|
@@ -39338,7 +40182,7 @@ function renderOutput8(leadingSymbol, trailingSymbol, options3) {
|
|
|
39338
40182
|
}
|
|
39339
40183
|
});
|
|
39340
40184
|
}
|
|
39341
|
-
function renderDiagnostics(state, options3,
|
|
40185
|
+
function renderDiagnostics(state, options3, figures4, columns) {
|
|
39342
40186
|
const diagnostics3 = options3.diagnostics;
|
|
39343
40187
|
const toDisplay = entriesToDisplay2(state.index, diagnostics3.length, options3.maxPerPage);
|
|
39344
40188
|
const documents = [];
|
|
@@ -39349,9 +40193,9 @@ function renderDiagnostics(state, options3, figures3, columns) {
|
|
|
39349
40193
|
const hasChanged = currentSeverity !== diagnostic.defaultSeverity;
|
|
39350
40194
|
let prefix = space2;
|
|
39351
40195
|
if (index === toDisplay.startIndex && toDisplay.startIndex > 0) {
|
|
39352
|
-
prefix =
|
|
40196
|
+
prefix = figures4.arrowUp;
|
|
39353
40197
|
} else if (index === toDisplay.endIndex - 1 && toDisplay.endIndex < diagnostics3.length) {
|
|
39354
|
-
prefix =
|
|
40198
|
+
prefix = figures4.arrowDown;
|
|
39355
40199
|
}
|
|
39356
40200
|
const shortName = getSeverityShortName(currentSeverity);
|
|
39357
40201
|
const paddedSeverity = shortName.padEnd(MAX_SEVERITY_LENGTH, " ");
|
|
@@ -39387,7 +40231,7 @@ function renderNextFrame9(state, options3) {
|
|
|
39387
40231
|
return gen2(function* () {
|
|
39388
40232
|
const terminal = yield* Terminal;
|
|
39389
40233
|
const columns = yield* terminal.columns;
|
|
39390
|
-
const figs = yield*
|
|
40234
|
+
const figs = yield* figures3;
|
|
39391
40235
|
const diagnosticsDoc = renderDiagnostics(state, options3, figs, columns);
|
|
39392
40236
|
const leadingSymbol = annotate2(text3("?"), cyanBright2);
|
|
39393
40237
|
const trailingSymbol = figs.pointerSmall;
|
|
@@ -39410,7 +40254,7 @@ function renderSubmission9(state, options3) {
|
|
|
39410
40254
|
return gen2(function* () {
|
|
39411
40255
|
const terminal = yield* Terminal;
|
|
39412
40256
|
const columns = yield* terminal.columns;
|
|
39413
|
-
const figs = yield*
|
|
40257
|
+
const figs = yield* figures3;
|
|
39414
40258
|
const changedCount = Object.entries(state.severities).filter(([name, severity]) => {
|
|
39415
40259
|
const diagnostic = options3.diagnostics.find((d) => d.name === name);
|
|
39416
40260
|
return diagnostic && severity !== diagnostic.defaultSeverity;
|
|
@@ -39789,6 +40633,8 @@ var setup = make58(
|
|
|
39789
40633
|
yield* log3(message);
|
|
39790
40634
|
}
|
|
39791
40635
|
})
|
|
40636
|
+
).pipe(
|
|
40637
|
+
withDescription6("Setup the effect-language-service for the given project using an interactive cli.")
|
|
39792
40638
|
);
|
|
39793
40639
|
|
|
39794
40640
|
// src/cli/unpatch.ts
|
|
@@ -39822,6 +40668,8 @@ var unpatch = make58(
|
|
|
39822
40668
|
yield* logInfo2(`${filePath} unpatched successfully.`);
|
|
39823
40669
|
}
|
|
39824
40670
|
})
|
|
40671
|
+
).pipe(
|
|
40672
|
+
withDescription6("Unpatches the typescript package from the effect-language-service.")
|
|
39825
40673
|
);
|
|
39826
40674
|
|
|
39827
40675
|
// src/cli.ts
|
|
@@ -39829,7 +40677,7 @@ var cliCommand = make58(
|
|
|
39829
40677
|
"effect-language-service",
|
|
39830
40678
|
{},
|
|
39831
40679
|
() => log3("Please select a command or run --help.")
|
|
39832
|
-
).pipe(withSubcommands3([setup, patch9, unpatch, check2, diagnostics2, codegen]));
|
|
40680
|
+
).pipe(withSubcommands3([setup, patch9, unpatch, check2, diagnostics2, codegen, overview]));
|
|
39833
40681
|
var main = run8(cliCommand, {
|
|
39834
40682
|
name: "effect-language-service",
|
|
39835
40683
|
version: "0.0.2"
|