@effect/tsgo 0.33.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +99 -96
- package/dist/effect-tsgo.cjs +418 -233
- package/package.json +8 -8
package/dist/effect-tsgo.cjs
CHANGED
|
@@ -3157,7 +3157,7 @@ const isFailure$4 = (result) => result._tag === "Failure";
|
|
|
3157
3157
|
/** @internal */
|
|
3158
3158
|
const isSuccess$4 = (result) => result._tag === "Success";
|
|
3159
3159
|
/** @internal */
|
|
3160
|
-
const fail$
|
|
3160
|
+
const fail$6 = (failure) => {
|
|
3161
3161
|
const a = Object.create(FailureProto);
|
|
3162
3162
|
a.failure = failure;
|
|
3163
3163
|
return a;
|
|
@@ -3173,7 +3173,7 @@ const getFailure$2 = (self) => isSuccess$4(self) ? none$4 : some$1(self.failure)
|
|
|
3173
3173
|
/** @internal */
|
|
3174
3174
|
const getSuccess$3 = (self) => isFailure$4(self) ? none$4 : some$1(self.success);
|
|
3175
3175
|
/** @internal */
|
|
3176
|
-
const fromOption$4 = /* @__PURE__ */ dual(2, (self, onNone) => isNone$1(self) ? fail$
|
|
3176
|
+
const fromOption$4 = /* @__PURE__ */ dual(2, (self, onNone) => isNone$1(self) ? fail$6(onNone()) : succeed$7(self.value));
|
|
3177
3177
|
|
|
3178
3178
|
//#endregion
|
|
3179
3179
|
//#region ../../node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/Order.js
|
|
@@ -5032,7 +5032,7 @@ const succeed$6 = succeed$7;
|
|
|
5032
5032
|
* @category constructors
|
|
5033
5033
|
* @since 4.0.0
|
|
5034
5034
|
*/
|
|
5035
|
-
const fail$
|
|
5035
|
+
const fail$5 = fail$6;
|
|
5036
5036
|
/**
|
|
5037
5037
|
* Converts an `Option<A>` into a `Result<A, E>`.
|
|
5038
5038
|
*
|
|
@@ -6788,7 +6788,7 @@ const equals$1 = /* @__PURE__ */ dual(2, (self, that) => Equivalence$4(self, tha
|
|
|
6788
6788
|
* @category constructors
|
|
6789
6789
|
* @since 4.0.0
|
|
6790
6790
|
*/
|
|
6791
|
-
const fromPredicate = (predicate) => (input) => predicate(input) ? succeed$6(input) : fail$
|
|
6791
|
+
const fromPredicate = (predicate) => (input) => predicate(input) ? succeed$6(input) : fail$5(input);
|
|
6792
6792
|
/**
|
|
6793
6793
|
* A predefined filter that only passes through string values.
|
|
6794
6794
|
*
|
|
@@ -6913,9 +6913,9 @@ const date$2 = /* @__PURE__ */ fromPredicate(isDate);
|
|
|
6913
6913
|
*/
|
|
6914
6914
|
const composePassthrough = /* @__PURE__ */ dual(2, (left, right) => (input) => {
|
|
6915
6915
|
const leftOut = left(input);
|
|
6916
|
-
if (isFailure$3(leftOut)) return fail$
|
|
6916
|
+
if (isFailure$3(leftOut)) return fail$5(input);
|
|
6917
6917
|
const rightOut = right(leftOut.success);
|
|
6918
|
-
if (isFailure$3(rightOut)) return fail$
|
|
6918
|
+
if (isFailure$3(rightOut)) return fail$5(input);
|
|
6919
6919
|
return rightOut;
|
|
6920
6920
|
});
|
|
6921
6921
|
/**
|
|
@@ -7527,7 +7527,7 @@ const hasFails$2 = (self) => self.reasons.some(isFailReason$1);
|
|
|
7527
7527
|
/** @internal */
|
|
7528
7528
|
const findFail$1 = (self) => {
|
|
7529
7529
|
const reason = self.reasons.find(isFailReason$1);
|
|
7530
|
-
return reason ? succeed$6(reason) : fail$
|
|
7530
|
+
return reason ? succeed$6(reason) : fail$5(self);
|
|
7531
7531
|
};
|
|
7532
7532
|
/** @internal */
|
|
7533
7533
|
const findError$2 = (self) => {
|
|
@@ -7535,7 +7535,7 @@ const findError$2 = (self) => {
|
|
|
7535
7535
|
const reason = self.reasons[i];
|
|
7536
7536
|
if (reason._tag === "Fail") return succeed$6(reason.error);
|
|
7537
7537
|
}
|
|
7538
|
-
return fail$
|
|
7538
|
+
return fail$5(self);
|
|
7539
7539
|
};
|
|
7540
7540
|
/** @internal */
|
|
7541
7541
|
const findErrorOption$2 = /* @__PURE__ */ toOption$1(findError$2);
|
|
@@ -7544,19 +7544,19 @@ const hasDies$2 = (self) => self.reasons.some(isDieReason$1);
|
|
|
7544
7544
|
/** @internal */
|
|
7545
7545
|
const findDie$1 = (self) => {
|
|
7546
7546
|
const reason = self.reasons.find(isDieReason$1);
|
|
7547
|
-
return reason ? succeed$6(reason) : fail$
|
|
7547
|
+
return reason ? succeed$6(reason) : fail$5(self);
|
|
7548
7548
|
};
|
|
7549
7549
|
/** @internal */
|
|
7550
7550
|
const findDefect$2 = (self) => {
|
|
7551
7551
|
const reason = self.reasons.find(isDieReason$1);
|
|
7552
|
-
return reason ? succeed$6(reason.defect) : fail$
|
|
7552
|
+
return reason ? succeed$6(reason.defect) : fail$5(self);
|
|
7553
7553
|
};
|
|
7554
7554
|
/** @internal */
|
|
7555
7555
|
const hasInterrupts$2 = (self) => self.reasons.some(isInterruptReason$1);
|
|
7556
7556
|
/** @internal */
|
|
7557
7557
|
const findInterrupt$1 = (self) => {
|
|
7558
7558
|
const reason = self.reasons.find(isInterruptReason$1);
|
|
7559
|
-
return reason ? succeed$6(reason) : fail$
|
|
7559
|
+
return reason ? succeed$6(reason) : fail$5(self);
|
|
7560
7560
|
};
|
|
7561
7561
|
/** @internal */
|
|
7562
7562
|
const causeFilterInterruptors = (self) => {
|
|
@@ -7567,7 +7567,7 @@ const causeFilterInterruptors = (self) => {
|
|
|
7567
7567
|
interruptors ??= /* @__PURE__ */ new Set();
|
|
7568
7568
|
if (f.fiberId !== void 0) interruptors.add(f.fiberId);
|
|
7569
7569
|
}
|
|
7570
|
-
return interruptors ? succeed$6(interruptors) : fail$
|
|
7570
|
+
return interruptors ? succeed$6(interruptors) : fail$5(self);
|
|
7571
7571
|
};
|
|
7572
7572
|
/** @internal */
|
|
7573
7573
|
const causeInterruptors = (self) => {
|
|
@@ -8039,7 +8039,7 @@ const succeed$5 = exitSucceed;
|
|
|
8039
8039
|
/** @internal */
|
|
8040
8040
|
const failCause$3 = exitFailCause;
|
|
8041
8041
|
/** @internal */
|
|
8042
|
-
const fail$
|
|
8042
|
+
const fail$4 = exitFail;
|
|
8043
8043
|
/** @internal */
|
|
8044
8044
|
const sync$1 = /* @__PURE__ */ makePrimitive$1({
|
|
8045
8045
|
op: "Sync",
|
|
@@ -8057,14 +8057,14 @@ const suspend$3 = /* @__PURE__ */ makePrimitive$1({
|
|
|
8057
8057
|
}
|
|
8058
8058
|
});
|
|
8059
8059
|
/** @internal */
|
|
8060
|
-
const fromOption$1 = /* @__PURE__ */ dual((args) => args.length >= 2 || isOption(args[0]), (option, onNone) => isNone(option) ? fail$
|
|
8060
|
+
const fromOption$1 = /* @__PURE__ */ dual((args) => args.length >= 2 || isOption(args[0]), (option, onNone) => isNone(option) ? fail$4(onNone ? onNone() : new NoSuchElementError$1("Effect.fromOption: Option.none")) : succeed$5(option.value));
|
|
8061
8061
|
/** @internal */
|
|
8062
8062
|
const fromResult$1 = /* @__PURE__ */ match$7({
|
|
8063
|
-
onFailure: fail$
|
|
8063
|
+
onFailure: fail$4,
|
|
8064
8064
|
onSuccess: succeed$5
|
|
8065
8065
|
});
|
|
8066
8066
|
/** @internal */
|
|
8067
|
-
const fromNullishOr$1 = (value) => value == null ? fail$
|
|
8067
|
+
const fromNullishOr$1 = (value) => value == null ? fail$4(new NoSuchElementError$1()) : succeed$5(value);
|
|
8068
8068
|
/** @internal */
|
|
8069
8069
|
const yieldNowWith$1 = /* @__PURE__ */ makePrimitive$1({
|
|
8070
8070
|
op: "Yield",
|
|
@@ -8092,7 +8092,7 @@ const failCauseSync$1 = (evaluate) => suspend$3(() => failCause$3(internalCall(e
|
|
|
8092
8092
|
/** @internal */
|
|
8093
8093
|
const die$3 = (defect) => exitDie(defect);
|
|
8094
8094
|
/** @internal */
|
|
8095
|
-
const failSync$1 = (error) => suspend$3(() => fail$
|
|
8095
|
+
const failSync$1 = (error) => suspend$3(() => fail$4(internalCall(error)));
|
|
8096
8096
|
/** @internal */
|
|
8097
8097
|
const void_$3 = /* @__PURE__ */ succeed$5(void 0);
|
|
8098
8098
|
/** @internal */
|
|
@@ -8103,7 +8103,7 @@ const try_$1 = (options) => {
|
|
|
8103
8103
|
try {
|
|
8104
8104
|
return succeed$5(internalCall(evaluate));
|
|
8105
8105
|
} catch (err) {
|
|
8106
|
-
return fail$
|
|
8106
|
+
return fail$4(internalCall(() => catcher(err)));
|
|
8107
8107
|
}
|
|
8108
8108
|
});
|
|
8109
8109
|
};
|
|
@@ -8118,7 +8118,7 @@ const tryPromise$1 = (options) => {
|
|
|
8118
8118
|
return callbackOptions(function(resume, signal) {
|
|
8119
8119
|
const failWithCatch = (cause) => {
|
|
8120
8120
|
try {
|
|
8121
|
-
resume(fail$
|
|
8121
|
+
resume(fail$4(internalCall(() => catcher(cause))));
|
|
8122
8122
|
} catch (err) {
|
|
8123
8123
|
resume(die$3(err));
|
|
8124
8124
|
}
|
|
@@ -8297,7 +8297,7 @@ const asSome$1 = (self) => map$8(self, some);
|
|
|
8297
8297
|
/** @internal */
|
|
8298
8298
|
const flip$2 = (self) => matchEffect$2(self, {
|
|
8299
8299
|
onFailure: succeed$5,
|
|
8300
|
-
onSuccess: fail$
|
|
8300
|
+
onSuccess: fail$4
|
|
8301
8301
|
});
|
|
8302
8302
|
/** @internal */
|
|
8303
8303
|
const andThen$1 = /* @__PURE__ */ dual(2, (self, f) => flatMap$2(self, (a) => isEffect$1(f) ? f : internalCall(() => f(a))));
|
|
@@ -8306,7 +8306,7 @@ const tap$1 = /* @__PURE__ */ dual(2, (self, f) => flatMap$2(self, (a) => as$1(i
|
|
|
8306
8306
|
/** @internal */
|
|
8307
8307
|
const asVoid$2 = (self) => flatMap$2(self, (_) => exitVoid);
|
|
8308
8308
|
/** @internal */
|
|
8309
|
-
const sandbox$1 = (self) => catchCause$1(self, fail$
|
|
8309
|
+
const sandbox$1 = (self) => catchCause$1(self, fail$4);
|
|
8310
8310
|
/** @internal */
|
|
8311
8311
|
const raceAll$1 = (all, options) => withFiber$1((parent) => callback$2((resume) => {
|
|
8312
8312
|
const effects = fromIterable(all);
|
|
@@ -8424,15 +8424,15 @@ const exitInterrupt$1 = (fiberId) => exitFailCause(causeInterrupt(fiberId));
|
|
|
8424
8424
|
/** @internal */
|
|
8425
8425
|
const exitIsSuccess = (self) => self._tag === "Success";
|
|
8426
8426
|
/** @internal */
|
|
8427
|
-
const exitFilterSuccess = (self) => self._tag === "Success" ? succeed$6(self) : fail$
|
|
8427
|
+
const exitFilterSuccess = (self) => self._tag === "Success" ? succeed$6(self) : fail$5(self);
|
|
8428
8428
|
/** @internal */
|
|
8429
|
-
const exitFilterValue = (self) => self._tag === "Success" ? succeed$6(self.value) : fail$
|
|
8429
|
+
const exitFilterValue = (self) => self._tag === "Success" ? succeed$6(self.value) : fail$5(self);
|
|
8430
8430
|
/** @internal */
|
|
8431
8431
|
const exitIsFailure = (self) => self._tag === "Failure";
|
|
8432
8432
|
/** @internal */
|
|
8433
|
-
const exitFilterFailure = (self) => self._tag === "Failure" ? succeed$6(self) : fail$
|
|
8433
|
+
const exitFilterFailure = (self) => self._tag === "Failure" ? succeed$6(self) : fail$5(self);
|
|
8434
8434
|
/** @internal */
|
|
8435
|
-
const exitFilterCause = (self) => self._tag === "Failure" ? succeed$6(self.cause) : fail$
|
|
8435
|
+
const exitFilterCause = (self) => self._tag === "Failure" ? succeed$6(self.cause) : fail$5(self);
|
|
8436
8436
|
/** @internal */
|
|
8437
8437
|
const exitFindError = /* @__PURE__ */ composePassthrough(exitFilterCause, findError$2);
|
|
8438
8438
|
/** @internal */
|
|
@@ -8489,7 +8489,7 @@ const service$1 = (service) => service;
|
|
|
8489
8489
|
/** @internal */
|
|
8490
8490
|
const serviceOption$1 = (service) => withFiber$1((fiber) => succeed$5(getOption(fiber.context, service)));
|
|
8491
8491
|
/** @internal */
|
|
8492
|
-
const serviceOptional = (service) => withFiber$1((fiber) => fiber.context.mapUnsafe.has(service.key) ? succeed$5(getUnsafe(fiber.context, service)) : fail$
|
|
8492
|
+
const serviceOptional = (service) => withFiber$1((fiber) => fiber.context.mapUnsafe.has(service.key) ? succeed$5(getUnsafe(fiber.context, service)) : fail$4(new NoSuchElementError$1()));
|
|
8493
8493
|
/** @internal */
|
|
8494
8494
|
const updateContext$1 = /* @__PURE__ */ dual(2, (self, f) => withFiber$1((fiber) => {
|
|
8495
8495
|
const prevContext = fiber.context;
|
|
@@ -8550,7 +8550,7 @@ const provideServiceEffect$1 = /* @__PURE__ */ dual(3, (self, service, acquire)
|
|
|
8550
8550
|
const zip$1 = /* @__PURE__ */ dual((args) => isEffect$1(args[1]), (self, that, options) => zipWith$1(self, that, (a, a2) => [a, a2], options));
|
|
8551
8551
|
/** @internal */
|
|
8552
8552
|
const zipWith$1 = /* @__PURE__ */ dual((args) => isEffect$1(args[1]), (self, that, f, options) => options?.concurrent ? map$8(all$1([self, that], { concurrency: 2 }), ([a, a2]) => internalCall(() => f(a, a2))) : flatMap$2(self, (a) => map$8(that, (a2) => internalCall(() => f(a, a2)))));
|
|
8553
|
-
const filterOrFail$1 = /* @__PURE__ */ dual((args) => isEffect$1(args[0]), (self, predicate, orFailWith) => filterOrElse$1(self, predicate, orFailWith ? (a) => fail$
|
|
8553
|
+
const filterOrFail$1 = /* @__PURE__ */ dual((args) => isEffect$1(args[0]), (self, predicate, orFailWith) => filterOrElse$1(self, predicate, orFailWith ? (a) => fail$4(orFailWith(a)) : () => fail$4(new NoSuchElementError$1())));
|
|
8554
8554
|
/** @internal */
|
|
8555
8555
|
const when$1 = /* @__PURE__ */ dual(2, (self, condition) => flatMap$2(condition, (pass) => pass ? asSome$1(self) : succeedNone$1));
|
|
8556
8556
|
/** @internal */
|
|
@@ -8591,7 +8591,7 @@ const catchCauseFilter$1 = /* @__PURE__ */ dual(3, (self, filter, f) => catchCau
|
|
|
8591
8591
|
const catch_$1 = /* @__PURE__ */ dual(2, (self, f) => catchCauseFilter$1(self, findError$2, (e) => f(e)));
|
|
8592
8592
|
/** @internal */
|
|
8593
8593
|
const catchNoSuchElement$1 = (self) => matchEffect$2(self, {
|
|
8594
|
-
onFailure: (error) => isNoSuchElementError$1(error) ? succeedNone$1 : fail$
|
|
8594
|
+
onFailure: (error) => isNoSuchElementError$1(error) ? succeedNone$1 : fail$4(error),
|
|
8595
8595
|
onSuccess: succeedSome$1
|
|
8596
8596
|
});
|
|
8597
8597
|
/** @internal */
|
|
@@ -8639,14 +8639,14 @@ const catchTags$1 = /* @__PURE__ */ dual((args) => isEffect$1(args[0]), (self, c
|
|
|
8639
8639
|
let keys;
|
|
8640
8640
|
return catchFilter$1(self, (e) => {
|
|
8641
8641
|
keys ??= Object.keys(cases);
|
|
8642
|
-
return hasProperty(e, "_tag") && isString(e["_tag"]) && keys.includes(e["_tag"]) ? succeed$6(e) : fail$
|
|
8642
|
+
return hasProperty(e, "_tag") && isString(e["_tag"]) && keys.includes(e["_tag"]) ? succeed$6(e) : fail$5(e);
|
|
8643
8643
|
}, (e) => internalCall(() => cases[e["_tag"]](e)), orElse);
|
|
8644
8644
|
});
|
|
8645
8645
|
/** @internal */
|
|
8646
8646
|
const catchReason$1 = /* @__PURE__ */ dual((args) => isEffect$1(args[0]), (self, errorTag, reasonTag, f, orElse) => catchIf$1(self, (e) => isTagged(e, errorTag) && hasProperty(e, "reason"), (e) => {
|
|
8647
8647
|
const reason = e.reason;
|
|
8648
8648
|
if (isTagged(reason, reasonTag)) return f(reason, e);
|
|
8649
|
-
return orElse ? internalCall(() => orElse(reason, e)) : fail$
|
|
8649
|
+
return orElse ? internalCall(() => orElse(reason, e)) : fail$4(e);
|
|
8650
8650
|
}));
|
|
8651
8651
|
/** @internal */
|
|
8652
8652
|
const catchReasons$1 = /* @__PURE__ */ dual((args) => isEffect$1(args[0]), (self, errorTag, cases, orElse) => {
|
|
@@ -8655,14 +8655,14 @@ const catchReasons$1 = /* @__PURE__ */ dual((args) => isEffect$1(args[0]), (self
|
|
|
8655
8655
|
const reason = e.reason;
|
|
8656
8656
|
keys ??= Object.keys(cases);
|
|
8657
8657
|
if (keys.includes(reason._tag)) return internalCall(() => cases[reason._tag](reason, e));
|
|
8658
|
-
return orElse ? internalCall(() => orElse(reason, e)) : fail$
|
|
8658
|
+
return orElse ? internalCall(() => orElse(reason, e)) : fail$4(e);
|
|
8659
8659
|
});
|
|
8660
8660
|
});
|
|
8661
8661
|
/** @internal */
|
|
8662
8662
|
const unwrapReason$1 = /* @__PURE__ */ dual(2, (self, errorTag) => catchFilter$1(self, (e) => {
|
|
8663
8663
|
if (isTagged(e, errorTag) && hasProperty(e, "reason")) return succeed$6(e.reason);
|
|
8664
|
-
return fail$
|
|
8665
|
-
}, fail$
|
|
8664
|
+
return fail$5(e);
|
|
8665
|
+
}, fail$4));
|
|
8666
8666
|
/** @internal */
|
|
8667
8667
|
const mapError$2 = /* @__PURE__ */ dual(2, (self, f) => catch_$1(self, (error) => failSync$1(() => f(error))));
|
|
8668
8668
|
const mapBoth$2 = /* @__PURE__ */ dual(2, (self, options) => matchEffect$2(self, {
|
|
@@ -8721,7 +8721,7 @@ const option$1 = (self) => match$4(self, {
|
|
|
8721
8721
|
});
|
|
8722
8722
|
/** @internal */
|
|
8723
8723
|
const result$1 = (self) => matchEager$1(self, {
|
|
8724
|
-
onFailure: fail$
|
|
8724
|
+
onFailure: fail$5,
|
|
8725
8725
|
onSuccess: succeed$6
|
|
8726
8726
|
});
|
|
8727
8727
|
/** @internal */
|
|
@@ -8807,7 +8807,7 @@ const timeoutOrElse$1 = /* @__PURE__ */ dual(2, (self, options) => raceFirst$1(s
|
|
|
8807
8807
|
/** @internal */
|
|
8808
8808
|
const timeout$1 = /* @__PURE__ */ dual(2, (self, duration) => timeoutOrElse$1(self, {
|
|
8809
8809
|
duration,
|
|
8810
|
-
orElse: () => fail$
|
|
8810
|
+
orElse: () => fail$4(new TimeoutError$1())
|
|
8811
8811
|
}));
|
|
8812
8812
|
/** @internal */
|
|
8813
8813
|
const timeoutOption$1 = /* @__PURE__ */ dual(2, (self, duration) => raceFirst$1(asSome$1(self), as$1(sleep$1(duration), none$3())));
|
|
@@ -9094,7 +9094,7 @@ const reduce$1 = /* @__PURE__ */ dual(3, (elements, zero, f) => {
|
|
|
9094
9094
|
});
|
|
9095
9095
|
/** @internal */
|
|
9096
9096
|
const validate$1 = /* @__PURE__ */ dual((args) => isIterable(args[0]) && !isEffect$1(args[0]), (elements, f, options) => flatMap$2(partition$1(elements, f, { concurrency: options?.concurrency }), ([excluded, satisfying]) => {
|
|
9097
|
-
if (isArrayNonEmpty(excluded)) return fail$
|
|
9097
|
+
if (isArrayNonEmpty(excluded)) return fail$4(excluded);
|
|
9098
9098
|
return options?.discard ? void_$3 : succeed$5(satisfying);
|
|
9099
9099
|
}));
|
|
9100
9100
|
/** @internal */
|
|
@@ -9315,7 +9315,7 @@ const filterMapOrElse$1 = /* @__PURE__ */ dual(3, (self, filter, orElse) => flat
|
|
|
9315
9315
|
const result = filter(a);
|
|
9316
9316
|
return isFailure$3(result) ? orElse(result.failure) : succeed$5(result.success);
|
|
9317
9317
|
}));
|
|
9318
|
-
const filterMapOrFail$1 = /* @__PURE__ */ dual((args) => isEffect$1(args[0]), (self, filter, orFailWith) => filterMapOrElse$1(self, filter, orFailWith ? (x) => fail$
|
|
9318
|
+
const filterMapOrFail$1 = /* @__PURE__ */ dual((args) => isEffect$1(args[0]), (self, filter, orFailWith) => filterMapOrElse$1(self, filter, orFailWith ? (x) => fail$4(orFailWith(x)) : () => fail$4(new NoSuchElementError$1())));
|
|
9319
9319
|
/** @internal */
|
|
9320
9320
|
const filter$1 = /* @__PURE__ */ dual((args) => isIterable(args[0]) && !isEffect$1(args[0]), (elements, predicate, options) => suspend$3(() => {
|
|
9321
9321
|
const out = [];
|
|
@@ -9731,7 +9731,7 @@ const annotateCurrentSpan$1 = (...args) => withFiber$1((fiber) => {
|
|
|
9731
9731
|
/** @internal */
|
|
9732
9732
|
const currentSpan$1 = /* @__PURE__ */ withFiber$1((fiber) => {
|
|
9733
9733
|
const span = fiber.currentSpanLocal;
|
|
9734
|
-
return span ? succeed$5(span) : fail$
|
|
9734
|
+
return span ? succeed$5(span) : fail$4(new NoSuchElementError$1());
|
|
9735
9735
|
});
|
|
9736
9736
|
/** @internal */
|
|
9737
9737
|
const currentParentSpan$1 = /* @__PURE__ */ serviceOptional(ParentSpan);
|
|
@@ -10255,7 +10255,7 @@ const empty$2 = causeEmpty;
|
|
|
10255
10255
|
* @category constructors
|
|
10256
10256
|
* @since 2.0.0
|
|
10257
10257
|
*/
|
|
10258
|
-
const fail$
|
|
10258
|
+
const fail$3 = causeFail;
|
|
10259
10259
|
/**
|
|
10260
10260
|
* Creates a `Cause` containing a single `Die` reason with the
|
|
10261
10261
|
* given defect.
|
|
@@ -11342,7 +11342,7 @@ const failCause$2 = exitFailCause;
|
|
|
11342
11342
|
* @category constructors
|
|
11343
11343
|
* @since 2.0.0
|
|
11344
11344
|
*/
|
|
11345
|
-
const fail$
|
|
11345
|
+
const fail$2 = exitFail;
|
|
11346
11346
|
/**
|
|
11347
11347
|
* Creates a failed Exit from a defect (unexpected error).
|
|
11348
11348
|
*
|
|
@@ -15008,7 +15008,7 @@ const isDoneFailure = (failure) => failure._tag === "Fail" && isDone$1(failure.e
|
|
|
15008
15008
|
* @category filtering
|
|
15009
15009
|
* @since 4.0.0
|
|
15010
15010
|
*/
|
|
15011
|
-
const filterDone = /* @__PURE__ */ composePassthrough(findError$1, (e) => isDone$1(e) ? succeed$6(e) : fail$
|
|
15011
|
+
const filterDone = /* @__PURE__ */ composePassthrough(findError$1, (e) => isDone$1(e) ? succeed$6(e) : fail$5(e));
|
|
15012
15012
|
/**
|
|
15013
15013
|
* Finds a `Cause.Done` failure in a cause whose done value is not used.
|
|
15014
15014
|
*
|
|
@@ -15029,7 +15029,7 @@ const filterDone = /* @__PURE__ */ composePassthrough(findError$1, (e) => isDone
|
|
|
15029
15029
|
* @category filtering
|
|
15030
15030
|
* @since 4.0.0
|
|
15031
15031
|
*/
|
|
15032
|
-
const filterDoneVoid = /* @__PURE__ */ composePassthrough(findError$1, (e) => isDone$1(e) ? succeed$6(e) : fail$
|
|
15032
|
+
const filterDoneVoid = /* @__PURE__ */ composePassthrough(findError$1, (e) => isDone$1(e) ? succeed$6(e) : fail$5(e));
|
|
15033
15033
|
/**
|
|
15034
15034
|
* Filters a Cause to extract the leftover value from done errors.
|
|
15035
15035
|
*
|
|
@@ -15041,7 +15041,7 @@ const filterDoneVoid = /* @__PURE__ */ composePassthrough(findError$1, (e) => is
|
|
|
15041
15041
|
* @category filtering
|
|
15042
15042
|
* @since 4.0.0
|
|
15043
15043
|
*/
|
|
15044
|
-
const filterDoneLeftover = /* @__PURE__ */ composePassthrough(findError$1, (e) => isDone$1(e) ? succeed$6(e.value) : fail$
|
|
15044
|
+
const filterDoneLeftover = /* @__PURE__ */ composePassthrough(findError$1, (e) => isDone$1(e) ? succeed$6(e.value) : fail$5(e));
|
|
15045
15045
|
/**
|
|
15046
15046
|
* Converts a `Cause` into an `Exit`, treating `Cause.Done` as successful
|
|
15047
15047
|
* completion.
|
|
@@ -15472,11 +15472,11 @@ const retryOrElse$1 = /* @__PURE__ */ dual(3, (self, policy, orElse) => flatMap$
|
|
|
15472
15472
|
}));
|
|
15473
15473
|
/** @internal */
|
|
15474
15474
|
const repeat$1 = /* @__PURE__ */ dual(2, (self, options) => {
|
|
15475
|
-
return repeatOrElse$1(self, typeof options === "function" ? options(identity) : isSchedule(options) ? options : buildFromOptions(options), fail$
|
|
15475
|
+
return repeatOrElse$1(self, typeof options === "function" ? options(identity) : isSchedule(options) ? options : buildFromOptions(options), fail$4);
|
|
15476
15476
|
});
|
|
15477
15477
|
/** @internal */
|
|
15478
15478
|
const retry$1 = /* @__PURE__ */ dual(2, (self, options) => {
|
|
15479
|
-
return retryOrElse$1(self, typeof options === "function" ? options(identity) : isSchedule(options) ? options : buildFromOptions(options), fail$
|
|
15479
|
+
return retryOrElse$1(self, typeof options === "function" ? options(identity) : isSchedule(options) ? options : buildFromOptions(options), fail$4);
|
|
15480
15480
|
});
|
|
15481
15481
|
/** @internal */
|
|
15482
15482
|
const scheduleFrom$1 = /* @__PURE__ */ dual(3, (self, initial, schedule) => flatMap$2(toStepWithMetadata(schedule), (step) => {
|
|
@@ -15492,7 +15492,7 @@ const scheduleFrom$1 = /* @__PURE__ */ dual(3, (self, initial, schedule) => flat
|
|
|
15492
15492
|
meta = meta_;
|
|
15493
15493
|
}
|
|
15494
15494
|
});
|
|
15495
|
-
}), (error) => isDone$2(error) ? succeed$5(error.value) : fail$
|
|
15495
|
+
}), (error) => isDone$2(error) ? succeed$5(error.value) : fail$4(error));
|
|
15496
15496
|
}));
|
|
15497
15497
|
const passthroughForever = /* @__PURE__ */ passthrough$2(forever$1);
|
|
15498
15498
|
/** @internal */
|
|
@@ -16629,7 +16629,7 @@ const gen = gen$1;
|
|
|
16629
16629
|
* @category constructors
|
|
16630
16630
|
* @since 2.0.0
|
|
16631
16631
|
*/
|
|
16632
|
-
const fail = fail$
|
|
16632
|
+
const fail$1 = fail$4;
|
|
16633
16633
|
/**
|
|
16634
16634
|
* Creates an `Effect` that represents a recoverable error using a lazy evaluation.
|
|
16635
16635
|
*
|
|
@@ -22862,11 +22862,11 @@ const annotateLogsScoped = annotateLogsScoped$1;
|
|
|
22862
22862
|
const effectify = (fn, onError, onSyncError) => (...args) => callback$1((resume) => {
|
|
22863
22863
|
try {
|
|
22864
22864
|
fn(...args, (err, result) => {
|
|
22865
|
-
if (err) resume(fail(onError ? onError(err, args) : err));
|
|
22865
|
+
if (err) resume(fail$1(onError ? onError(err, args) : err));
|
|
22866
22866
|
else resume(succeed$2(result));
|
|
22867
22867
|
});
|
|
22868
22868
|
} catch (err) {
|
|
22869
|
-
resume(onSyncError ? fail(onSyncError(err, args)) : die(err));
|
|
22869
|
+
resume(onSyncError ? fail$1(onSyncError(err, args)) : die(err));
|
|
22870
22870
|
}
|
|
22871
22871
|
});
|
|
22872
22872
|
/**
|
|
@@ -26542,7 +26542,7 @@ const transduce = /* @__PURE__ */ dual(2, (self, sink) => transformPull(self, (u
|
|
|
26542
26542
|
}
|
|
26543
26543
|
return upstream;
|
|
26544
26544
|
}).pipe(catch_((error) => {
|
|
26545
|
-
done = fail$
|
|
26545
|
+
done = fail$2(error);
|
|
26546
26546
|
return done$1();
|
|
26547
26547
|
}));
|
|
26548
26548
|
const pull = map$5(suspend$2(() => sink.transform(upstreamWithLeftover, scope)), ([value, leftover_]) => {
|
|
@@ -26780,7 +26780,7 @@ const FileSystem = /* @__PURE__ */ Service("effect/platform/FileSystem");
|
|
|
26780
26780
|
const make$18 = (impl) => FileSystem.of({
|
|
26781
26781
|
...impl,
|
|
26782
26782
|
[TypeId$18]: TypeId$18,
|
|
26783
|
-
exists: (path) => pipe(impl.access(path), as(true), catchTag("PlatformError", (e) => e.reason._tag === "NotFound" ? succeed$2(false) : fail(e))),
|
|
26783
|
+
exists: (path) => pipe(impl.access(path), as(true), catchTag("PlatformError", (e) => e.reason._tag === "NotFound" ? succeed$2(false) : fail$1(e))),
|
|
26784
26784
|
readFileString: (path, encoding) => flatMap$1(impl.readFile(path), (_) => try_({
|
|
26785
26785
|
try: () => new TextDecoder(encoding).decode(_),
|
|
26786
26786
|
catch: (cause) => badArgument({
|
|
@@ -27041,12 +27041,12 @@ function _format(sep, pathObject) {
|
|
|
27041
27041
|
return dir + sep + base;
|
|
27042
27042
|
}
|
|
27043
27043
|
function fromFileUrl(url) {
|
|
27044
|
-
if (url.protocol !== "file:") return fail(new BadArgument({
|
|
27044
|
+
if (url.protocol !== "file:") return fail$1(new BadArgument({
|
|
27045
27045
|
module: "Path",
|
|
27046
27046
|
method: "fromFileUrl",
|
|
27047
27047
|
description: "URL must be of scheme file"
|
|
27048
27048
|
}));
|
|
27049
|
-
else if (url.hostname !== "") return fail(new BadArgument({
|
|
27049
|
+
else if (url.hostname !== "") return fail$1(new BadArgument({
|
|
27050
27050
|
module: "Path",
|
|
27051
27051
|
method: "fromFileUrl",
|
|
27052
27052
|
description: "Invalid file URL host"
|
|
@@ -27054,7 +27054,7 @@ function fromFileUrl(url) {
|
|
|
27054
27054
|
const pathname = url.pathname;
|
|
27055
27055
|
for (let n = 0; n < pathname.length; n++) if (pathname[n] === "%") {
|
|
27056
27056
|
const third = pathname.codePointAt(n + 2) | 32;
|
|
27057
|
-
if (pathname[n + 1] === "2" && third === 102) return fail(new BadArgument({
|
|
27057
|
+
if (pathname[n + 1] === "2" && third === 102) return fail$1(new BadArgument({
|
|
27058
27058
|
module: "Path",
|
|
27059
27059
|
method: "fromFileUrl",
|
|
27060
27060
|
description: "must not include encoded / characters"
|
|
@@ -30053,14 +30053,14 @@ const encodeBase64$1 = (input) => typeof input === "string" ? base64EncodeUint8A
|
|
|
30053
30053
|
const decodeBase64$1 = (str) => {
|
|
30054
30054
|
const stripped = stripCrlf(str);
|
|
30055
30055
|
const length = stripped.length;
|
|
30056
|
-
if (length % 4 !== 0) return fail$
|
|
30056
|
+
if (length % 4 !== 0) return fail$5(new EncodingError({
|
|
30057
30057
|
kind: "Decode",
|
|
30058
30058
|
module: "Base64",
|
|
30059
30059
|
input: stripped,
|
|
30060
30060
|
message: `Length must be a multiple of 4, but is ${length}`
|
|
30061
30061
|
}));
|
|
30062
30062
|
const index = stripped.indexOf("=");
|
|
30063
|
-
if (index !== -1 && (index < length - 2 || index === length - 2 && stripped[length - 1] !== "=")) return fail$
|
|
30063
|
+
if (index !== -1 && (index < length - 2 || index === length - 2 && stripped[length - 1] !== "=")) return fail$5(new EncodingError({
|
|
30064
30064
|
kind: "Decode",
|
|
30065
30065
|
module: "Base64",
|
|
30066
30066
|
input: stripped,
|
|
@@ -30077,7 +30077,7 @@ const decodeBase64$1 = (str) => {
|
|
|
30077
30077
|
}
|
|
30078
30078
|
return succeed$6(result);
|
|
30079
30079
|
} catch (e) {
|
|
30080
|
-
return fail$
|
|
30080
|
+
return fail$5(new EncodingError({
|
|
30081
30081
|
kind: "Decode",
|
|
30082
30082
|
module: "Base64",
|
|
30083
30083
|
input: stripped,
|
|
@@ -30173,13 +30173,13 @@ const encodeBase64Url$1 = (input) => typeof input === "string" ? base64UrlEncode
|
|
|
30173
30173
|
const decodeBase64Url = (str) => {
|
|
30174
30174
|
const stripped = stripCrlf(str);
|
|
30175
30175
|
const length = stripped.length;
|
|
30176
|
-
if (length % 4 === 1) return fail$
|
|
30176
|
+
if (length % 4 === 1) return fail$5(new EncodingError({
|
|
30177
30177
|
module: "Base64Url",
|
|
30178
30178
|
kind: "Decode",
|
|
30179
30179
|
input: stripped,
|
|
30180
30180
|
message: `Length should be a multiple of 4, but is ${length}`
|
|
30181
30181
|
}));
|
|
30182
|
-
if (!/^[-_A-Z0-9]*?={0,2}$/i.test(stripped)) return fail$
|
|
30182
|
+
if (!/^[-_A-Z0-9]*?={0,2}$/i.test(stripped)) return fail$5(new EncodingError({
|
|
30183
30183
|
module: "Base64Url",
|
|
30184
30184
|
kind: "Decode",
|
|
30185
30185
|
input: stripped,
|
|
@@ -30265,7 +30265,7 @@ const encodeHex$1 = (input) => typeof input === "string" ? hexEncodeUint8Array(e
|
|
|
30265
30265
|
*/
|
|
30266
30266
|
const decodeHex = (str) => {
|
|
30267
30267
|
const bytes = new TextEncoder().encode(str);
|
|
30268
|
-
if (bytes.length % 2 !== 0) return fail$
|
|
30268
|
+
if (bytes.length % 2 !== 0) return fail$5(new EncodingError({
|
|
30269
30269
|
module: "Hex",
|
|
30270
30270
|
kind: "Decode",
|
|
30271
30271
|
input: str,
|
|
@@ -30281,7 +30281,7 @@ const decodeHex = (str) => {
|
|
|
30281
30281
|
}
|
|
30282
30282
|
return succeed$6(result);
|
|
30283
30283
|
} catch (e) {
|
|
30284
|
-
return fail$
|
|
30284
|
+
return fail$5(new EncodingError({
|
|
30285
30285
|
module: "Hex",
|
|
30286
30286
|
kind: "Decode",
|
|
30287
30287
|
input: str,
|
|
@@ -31310,7 +31310,7 @@ function decodeBase64() {
|
|
|
31310
31310
|
*/
|
|
31311
31311
|
function decodeBase64String() {
|
|
31312
31312
|
return transformOrFail$1((input) => match$7(decodeBase64String$1(input), {
|
|
31313
|
-
onFailure: () => fail(new InvalidValue$1({ message: "Expected a valid Base64 string" })),
|
|
31313
|
+
onFailure: () => fail$1(new InvalidValue$1({ message: "Expected a valid Base64 string" })),
|
|
31314
31314
|
onSuccess: succeed$2
|
|
31315
31315
|
}));
|
|
31316
31316
|
}
|
|
@@ -31338,7 +31338,7 @@ function decodeBase64String() {
|
|
|
31338
31338
|
*/
|
|
31339
31339
|
function decodeBase64UrlString() {
|
|
31340
31340
|
return transformOrFail$1((input) => match$7(decodeBase64UrlString$1(input), {
|
|
31341
|
-
onFailure: () => fail(new InvalidValue$1({ message: "Expected a valid Base64Url string" })),
|
|
31341
|
+
onFailure: () => fail$1(new InvalidValue$1({ message: "Expected a valid Base64Url string" })),
|
|
31342
31342
|
onSuccess: succeed$2
|
|
31343
31343
|
}));
|
|
31344
31344
|
}
|
|
@@ -31366,7 +31366,7 @@ function decodeBase64UrlString() {
|
|
|
31366
31366
|
*/
|
|
31367
31367
|
function decodeHexString() {
|
|
31368
31368
|
return transformOrFail$1((input) => match$7(decodeHexString$1(input), {
|
|
31369
|
-
onFailure: () => fail(new InvalidValue$1({ message: "Expected a valid hexadecimal string" })),
|
|
31369
|
+
onFailure: () => fail$1(new InvalidValue$1({ message: "Expected a valid hexadecimal string" })),
|
|
31370
31370
|
onSuccess: succeed$2
|
|
31371
31371
|
}));
|
|
31372
31372
|
}
|
|
@@ -31422,7 +31422,7 @@ function decodeUriComponent() {
|
|
|
31422
31422
|
try {
|
|
31423
31423
|
return succeed$2(globalThis.decodeURIComponent(input));
|
|
31424
31424
|
} catch {
|
|
31425
|
-
return fail(new InvalidValue$1({ message: "Expected a valid URI component" }));
|
|
31425
|
+
return fail$1(new InvalidValue$1({ message: "Expected a valid URI component" }));
|
|
31426
31426
|
}
|
|
31427
31427
|
});
|
|
31428
31428
|
}
|
|
@@ -31461,7 +31461,7 @@ function decodeUriComponent() {
|
|
|
31461
31461
|
function dateTimeUtcFromInput() {
|
|
31462
31462
|
return transformOrFail$1((input) => {
|
|
31463
31463
|
return match$8(make$17(input), {
|
|
31464
|
-
onNone: () => fail(new InvalidValue$1({ message: "Invalid DateTime input" })),
|
|
31464
|
+
onNone: () => fail$1(new InvalidValue$1({ message: "Invalid DateTime input" })),
|
|
31465
31465
|
onSome: (dt) => succeed$2(toUtc(dt))
|
|
31466
31466
|
});
|
|
31467
31467
|
});
|
|
@@ -32623,7 +32623,7 @@ const dateFromMillis = /* @__PURE__ */ new Transformation(/* @__PURE__ */ Date$2
|
|
|
32623
32623
|
*/
|
|
32624
32624
|
const durationFromString = /* @__PURE__ */ transformOrFail({
|
|
32625
32625
|
decode: (s) => match$8(fromInput(s), {
|
|
32626
|
-
onNone: () => fail(new InvalidValue$1({ message: "Expected a valid Duration string" })),
|
|
32626
|
+
onNone: () => fail$1(new InvalidValue$1({ message: "Expected a valid Duration string" })),
|
|
32627
32627
|
onSome: succeed$2
|
|
32628
32628
|
}),
|
|
32629
32629
|
encode: (duration) => succeed$2(globalThis.String(duration))
|
|
@@ -32662,7 +32662,7 @@ const durationFromString = /* @__PURE__ */ transformOrFail({
|
|
|
32662
32662
|
const durationFromNanos = /* @__PURE__ */ transformOrFail({
|
|
32663
32663
|
decode: (i) => succeed$2(nanos(i)),
|
|
32664
32664
|
encode: (a) => match$8(toNanos(a), {
|
|
32665
|
-
onNone: () => fail(new InvalidValue$1({ message: "Expected a Duration representable as a bigint" })),
|
|
32665
|
+
onNone: () => fail$1(new InvalidValue$1({ message: "Expected a Duration representable as a bigint" })),
|
|
32666
32666
|
onSome: (nanos) => succeed$2(nanos)
|
|
32667
32667
|
})
|
|
32668
32668
|
});
|
|
@@ -32776,7 +32776,7 @@ const defectFromJson = (options) => transform$1({
|
|
|
32776
32776
|
* @since 4.0.0
|
|
32777
32777
|
*/
|
|
32778
32778
|
const urlFromString = /* @__PURE__ */ transformOrFail({
|
|
32779
|
-
decode: (s) => URL.canParse(s) ? succeed$2(new URL(s)) : fail(new InvalidValue$1({ message: "Expected a valid URL string" })),
|
|
32779
|
+
decode: (s) => URL.canParse(s) ? succeed$2(new URL(s)) : fail$1(new InvalidValue$1({ message: "Expected a valid URL string" })),
|
|
32780
32780
|
encode: (url) => succeed$2(url.href)
|
|
32781
32781
|
});
|
|
32782
32782
|
/**
|
|
@@ -32800,7 +32800,7 @@ const urlFromString = /* @__PURE__ */ transformOrFail({
|
|
|
32800
32800
|
const bigDecimalFromString = /* @__PURE__ */ transformOrFail({
|
|
32801
32801
|
decode: (s) => {
|
|
32802
32802
|
const result = fromString(s);
|
|
32803
|
-
return isNone(result) ? fail(new InvalidValue$1({ message: "Expected a valid BigDecimal string" })) : succeed$2(result.value);
|
|
32803
|
+
return isNone(result) ? fail$1(new InvalidValue$1({ message: "Expected a valid BigDecimal string" })) : succeed$2(result.value);
|
|
32804
32804
|
},
|
|
32805
32805
|
encode: (bd) => succeed$2(format(bd))
|
|
32806
32806
|
});
|
|
@@ -33009,7 +33009,7 @@ const timeZoneOffsetFromNumber = /* @__PURE__ */ transform$1({
|
|
|
33009
33009
|
const timeZoneNamedFromString = /* @__PURE__ */ transformOrFail({
|
|
33010
33010
|
decode: (s) => {
|
|
33011
33011
|
return match$8(zoneMakeNamed(s), {
|
|
33012
|
-
onNone: () => fail(new InvalidValue$1({ message: "Expected a valid IANA time zone" })),
|
|
33012
|
+
onNone: () => fail$1(new InvalidValue$1({ message: "Expected a valid IANA time zone" })),
|
|
33013
33013
|
onSome: succeed$2
|
|
33014
33014
|
});
|
|
33015
33015
|
},
|
|
@@ -33039,7 +33039,7 @@ const timeZoneNamedFromString = /* @__PURE__ */ transformOrFail({
|
|
|
33039
33039
|
const timeZoneFromString = /* @__PURE__ */ transformOrFail({
|
|
33040
33040
|
decode: (s) => {
|
|
33041
33041
|
return match$8(zoneFromString(s), {
|
|
33042
|
-
onNone: () => fail(new InvalidValue$1({ message: "Expected a valid time zone" })),
|
|
33042
|
+
onNone: () => fail$1(new InvalidValue$1({ message: "Expected a valid time zone" })),
|
|
33043
33043
|
onSome: succeed$2
|
|
33044
33044
|
});
|
|
33045
33045
|
},
|
|
@@ -33069,7 +33069,7 @@ const timeZoneFromString = /* @__PURE__ */ transformOrFail({
|
|
|
33069
33069
|
const dateTimeUtcFromString = /* @__PURE__ */ transformOrFail({
|
|
33070
33070
|
decode: (s) => {
|
|
33071
33071
|
return match$8(make$17(s), {
|
|
33072
|
-
onNone: () => fail(new InvalidValue$1({ message: "Expected a valid UTC DateTime string" })),
|
|
33072
|
+
onNone: () => fail$1(new InvalidValue$1({ message: "Expected a valid UTC DateTime string" })),
|
|
33073
33073
|
onSome: (result) => succeed$2(toUtc(result))
|
|
33074
33074
|
});
|
|
33075
33075
|
},
|
|
@@ -33098,7 +33098,7 @@ const dateTimeUtcFromString = /* @__PURE__ */ transformOrFail({
|
|
|
33098
33098
|
const dateTimeZonedFromString = /* @__PURE__ */ transformOrFail({
|
|
33099
33099
|
decode: (s) => {
|
|
33100
33100
|
return match$8(makeZonedFromString(s), {
|
|
33101
|
-
onNone: () => fail(new InvalidValue$1({ message: "Expected a valid Zoned DateTime string" })),
|
|
33101
|
+
onNone: () => fail$1(new InvalidValue$1({ message: "Expected a valid Zoned DateTime string" })),
|
|
33102
33102
|
onSome: succeed$2
|
|
33103
33103
|
});
|
|
33104
33104
|
},
|
|
@@ -33988,7 +33988,7 @@ var Arrays = class Arrays extends Base {
|
|
|
33988
33988
|
}
|
|
33989
33989
|
return fnUntracedEager(function* (input, options) {
|
|
33990
33990
|
if (input === missing) return missing;
|
|
33991
|
-
if (!Array.isArray(input)) return yield* fail(new InvalidType(ast));
|
|
33991
|
+
if (!Array.isArray(input)) return yield* fail$1(new InvalidType(ast));
|
|
33992
33992
|
if (!elements) {
|
|
33993
33993
|
elements = ast.elements.map((ast) => ({
|
|
33994
33994
|
ast,
|
|
@@ -34019,9 +34019,9 @@ var Arrays = class Arrays extends Base {
|
|
|
34019
34019
|
const issue = new Pointer([i], new UnexpectedKey(ast));
|
|
34020
34020
|
if (options.errors === "all") if (state.issues) state.issues.push(issue);
|
|
34021
34021
|
else state.issues = [issue];
|
|
34022
|
-
else return yield* fail(new Composite(ast, [issue]));
|
|
34022
|
+
else return yield* fail$1(new Composite(ast, [issue]));
|
|
34023
34023
|
}
|
|
34024
|
-
if (state.issues) return yield* fail(new Composite(ast, state.issues));
|
|
34024
|
+
if (state.issues) return yield* fail$1(new Composite(ast, state.issues));
|
|
34025
34025
|
return state.output;
|
|
34026
34026
|
});
|
|
34027
34027
|
}
|
|
@@ -34058,7 +34058,7 @@ const parseArray = /* @__PURE__ */ iterateEager()({
|
|
|
34058
34058
|
const issue = new Pointer([i], new MissingKey(p.ast.context?.annotations));
|
|
34059
34059
|
if (s.options.errors === "all") if (s.issues) s.issues.push(issue);
|
|
34060
34060
|
else s.issues = [issue];
|
|
34061
|
-
else return fail$
|
|
34061
|
+
else return fail$2(new Composite(s.ast, [issue]));
|
|
34062
34062
|
}
|
|
34063
34063
|
}
|
|
34064
34064
|
});
|
|
@@ -34073,7 +34073,7 @@ const wrapPropertyKeyIssue = (s, ast, key, exit) => {
|
|
|
34073
34073
|
const pointer = new Pointer([key], issue);
|
|
34074
34074
|
if (s.options.errors === "all") if (s.issues) s.issues.push(pointer);
|
|
34075
34075
|
else s.issues = [pointer];
|
|
34076
|
-
else return fail$
|
|
34076
|
+
else return fail$2(new Composite(ast, [pointer]));
|
|
34077
34077
|
};
|
|
34078
34078
|
/**
|
|
34079
34079
|
* floating point or integer, with optional exponent
|
|
@@ -34265,7 +34265,7 @@ var Objects = class Objects extends Base {
|
|
|
34265
34265
|
}) : void 0;
|
|
34266
34266
|
return fnUntracedEager(function* (input, options) {
|
|
34267
34267
|
if (input === missing) return missing;
|
|
34268
|
-
if (!(typeof input === "object" && input !== null && !Array.isArray(input))) return yield* fail(new InvalidType(ast));
|
|
34268
|
+
if (!(typeof input === "object" && input !== null && !Array.isArray(input))) return yield* fail$1(new InvalidType(ast));
|
|
34269
34269
|
if (!properties) {
|
|
34270
34270
|
properties = ast.propertySignatures.map((ps) => ({
|
|
34271
34271
|
parser: compileConstructorDefault(ps.type),
|
|
@@ -34302,7 +34302,7 @@ var Objects = class Objects extends Base {
|
|
|
34302
34302
|
if (state.issues) state.issues.push(issue);
|
|
34303
34303
|
else state.issues = [issue];
|
|
34304
34304
|
continue;
|
|
34305
|
-
} else return yield* fail(new Composite(ast, [issue]));
|
|
34305
|
+
} else return yield* fail$1(new Composite(ast, [issue]));
|
|
34306
34306
|
} else assignProperty$1(out, key, record[key]);
|
|
34307
34307
|
}
|
|
34308
34308
|
}
|
|
@@ -34331,7 +34331,7 @@ var Objects = class Objects extends Base {
|
|
|
34331
34331
|
const eff = parseIndexes(state, keyPairs, concurrency);
|
|
34332
34332
|
if (eff) yield* eff;
|
|
34333
34333
|
}
|
|
34334
|
-
if (state.issues) return yield* fail(new Composite(ast, state.issues));
|
|
34334
|
+
if (state.issues) return yield* fail$1(new Composite(ast, state.issues));
|
|
34335
34335
|
if (options.propertyOrder === "original") {
|
|
34336
34336
|
const keys = (inputKeys ?? Reflect.ownKeys(record)).concat(expectedKeys);
|
|
34337
34337
|
const preserved = {};
|
|
@@ -34389,7 +34389,7 @@ const parseProperties = /* @__PURE__ */ iterateEager()({
|
|
|
34389
34389
|
if (s.issues) s.issues.push(issue);
|
|
34390
34390
|
else s.issues = [issue];
|
|
34391
34391
|
return;
|
|
34392
|
-
} else return fail$
|
|
34392
|
+
} else return fail$2(new Composite(s.ast, [issue]));
|
|
34393
34393
|
}
|
|
34394
34394
|
}
|
|
34395
34395
|
});
|
|
@@ -34658,9 +34658,9 @@ var Union$1 = class Union$1 extends Base {
|
|
|
34658
34658
|
...concurrency,
|
|
34659
34659
|
orderedStep: true
|
|
34660
34660
|
} : void 0);
|
|
34661
|
-
if (!eff) return state.out ?? fail(new AnyOf(ast, state.issues ?? []));
|
|
34661
|
+
if (!eff) return state.out ?? fail$1(new AnyOf(ast, state.issues ?? []));
|
|
34662
34662
|
return flatMapEager(eff, (_) => {
|
|
34663
|
-
return state.out === sameExit ? succeed$2(input) : state.out ?? fail(new AnyOf(ast, state.issues ?? []));
|
|
34663
|
+
return state.out === sameExit ? succeed$2(input) : state.out ?? fail$1(new AnyOf(ast, state.issues ?? []));
|
|
34664
34664
|
});
|
|
34665
34665
|
};
|
|
34666
34666
|
}
|
|
@@ -34709,7 +34709,7 @@ var Union$1 = class Union$1 extends Base {
|
|
|
34709
34709
|
};
|
|
34710
34710
|
function failSingleUnionCandidate(ast, cause) {
|
|
34711
34711
|
const issue = getSchemaIssue(cause);
|
|
34712
|
-
return issue ? fail$
|
|
34712
|
+
return issue ? fail$2(new AnyOf(ast, [issue])) : failCause$2(cause);
|
|
34713
34713
|
}
|
|
34714
34714
|
const parseUnion = /* @__PURE__ */ iterateEager()({
|
|
34715
34715
|
onItem(s, ast) {
|
|
@@ -34724,7 +34724,7 @@ const parseUnion = /* @__PURE__ */ iterateEager()({
|
|
|
34724
34724
|
} else {
|
|
34725
34725
|
if (s.out && s.successes) {
|
|
34726
34726
|
s.successes.push(candidate);
|
|
34727
|
-
return fail$
|
|
34727
|
+
return fail$2(new OneOf(s.ast, s.successes));
|
|
34728
34728
|
}
|
|
34729
34729
|
s.out = exit;
|
|
34730
34730
|
if (s.successes) s.successes.push(candidate);
|
|
@@ -35178,13 +35178,13 @@ function fromConst(ast, value) {
|
|
|
35178
35178
|
const succeed = succeed$1(value);
|
|
35179
35179
|
return (input) => {
|
|
35180
35180
|
if (input === missing) return missingExit;
|
|
35181
|
-
return input === value ? succeed : fail(new InvalidType(ast));
|
|
35181
|
+
return input === value ? succeed : fail$1(new InvalidType(ast));
|
|
35182
35182
|
};
|
|
35183
35183
|
}
|
|
35184
35184
|
function fromRefinement(ast, refinement) {
|
|
35185
35185
|
return (input) => {
|
|
35186
35186
|
if (input === missing) return missingExit;
|
|
35187
|
-
return refinement(input) ? sameExit : fail(new InvalidType(ast));
|
|
35187
|
+
return refinement(input) ? sameExit : fail$1(new InvalidType(ast));
|
|
35188
35188
|
};
|
|
35189
35189
|
}
|
|
35190
35190
|
const parameterFromPropertyKey = /* @__PURE__ */ applyToSelfOrLastLinkEncoding((ast) => {
|
|
@@ -35244,7 +35244,7 @@ const symbolString = /* @__PURE__ */ appendChecks(string$3, [/* @__PURE__ */ isS
|
|
|
35244
35244
|
*/
|
|
35245
35245
|
const symbolToString = /* @__PURE__ */ new Link(symbolString, /* @__PURE__ */ new Transformation(/* @__PURE__ */ transform$2((description) => globalThis.Symbol.for(isStringSymbolRegExp.exec(description)[1])), /* @__PURE__ */ transformOrFail$1((sym) => {
|
|
35246
35246
|
if (globalThis.Symbol.keyFor(sym) !== void 0) return succeed$2(globalThis.String(sym));
|
|
35247
|
-
return fail(new Forbidden({ message: "cannot serialize to string, Symbol is not registered" }));
|
|
35247
|
+
return fail$1(new Forbidden({ message: "cannot serialize to string, Symbol is not registered" }));
|
|
35248
35248
|
})));
|
|
35249
35249
|
/** @internal */
|
|
35250
35250
|
function isStringSymbol(annotations) {
|
|
@@ -35418,7 +35418,7 @@ function isJson(u) {
|
|
|
35418
35418
|
return isTree(u, isJsonLeaf);
|
|
35419
35419
|
}
|
|
35420
35420
|
/** @internal */
|
|
35421
|
-
const Json$1 = /* @__PURE__ */ new Declaration([], () => (input, ast) => isJson(input) ? sameExit : fail(new InvalidType(ast)), {
|
|
35421
|
+
const Json$1 = /* @__PURE__ */ new Declaration([], () => (input, ast) => isJson(input) ? sameExit : fail$1(new InvalidType(ast)), {
|
|
35422
35422
|
representation: {
|
|
35423
35423
|
id: "effect/schema/Json",
|
|
35424
35424
|
payload: null
|
|
@@ -35443,7 +35443,7 @@ const MutableJson$1 = /* @__PURE__ */ annotate$1(Json$1, { representation: {
|
|
|
35443
35443
|
function isStringTree(u) {
|
|
35444
35444
|
return isTree(u, isStringTreeLeaf);
|
|
35445
35445
|
}
|
|
35446
|
-
const StringTree = /* @__PURE__ */ new Declaration([], () => (input, ast) => isStringTree(input) ? sameExit : fail(new InvalidType(ast)), {
|
|
35446
|
+
const StringTree = /* @__PURE__ */ new Declaration([], () => (input, ast) => isStringTree(input) ? sameExit : fail$1(new InvalidType(ast)), {
|
|
35447
35447
|
expected: "StringTree",
|
|
35448
35448
|
toCodecStringTree: () => void 0
|
|
35449
35449
|
});
|
|
@@ -35848,7 +35848,7 @@ const pullIntoWritable = (options) => options.pull.pipe(flatMap$1((chunk) => {
|
|
|
35848
35848
|
resume(void_$1);
|
|
35849
35849
|
});
|
|
35850
35850
|
}), forever({ disableYield: true }), raceFirst(callback$1((resume) => {
|
|
35851
|
-
const onError = (error) => resume(fail(options.onError(error)));
|
|
35851
|
+
const onError = (error) => resume(fail$1(options.onError(error)));
|
|
35852
35852
|
options.writable.once("error", onError);
|
|
35853
35853
|
return sync(() => {
|
|
35854
35854
|
options.writable.off("error", onError);
|
|
@@ -35907,11 +35907,11 @@ const readableToPullUnsafe = (options) => {
|
|
|
35907
35907
|
latch.openUnsafe();
|
|
35908
35908
|
}
|
|
35909
35909
|
function onError(error) {
|
|
35910
|
-
exit.current = fail$
|
|
35910
|
+
exit.current = fail$2(options.onError(error));
|
|
35911
35911
|
latch.openUnsafe();
|
|
35912
35912
|
}
|
|
35913
35913
|
function onEnd() {
|
|
35914
|
-
exit.current = fail$
|
|
35914
|
+
exit.current = fail$2(Done());
|
|
35915
35915
|
latch.openUnsafe();
|
|
35916
35916
|
}
|
|
35917
35917
|
readable.on("readable", onReadable);
|
|
@@ -35921,7 +35921,7 @@ const readableToPullUnsafe = (options) => {
|
|
|
35921
35921
|
let item = options.readable.read(options.chunkSize);
|
|
35922
35922
|
if (item === null) {
|
|
35923
35923
|
if (exit.current) return exit.current;
|
|
35924
|
-
if (readable.readableEnded) return fail(Done());
|
|
35924
|
+
if (readable.readableEnded) return fail$1(Done());
|
|
35925
35925
|
latch.closeUnsafe();
|
|
35926
35926
|
return flatMap$1(latch.await, loop);
|
|
35927
35927
|
}
|
|
@@ -36106,7 +36106,7 @@ const make$12 = /* @__PURE__ */ gen(function* () {
|
|
|
36106
36106
|
const deferred = makeUnsafe$5();
|
|
36107
36107
|
const handle = node_child_process.spawn(command.command, command.args, spawnOptions);
|
|
36108
36108
|
handle.on("error", (error) => {
|
|
36109
|
-
resume(fail(toPlatformError("spawn", error, command)));
|
|
36109
|
+
resume(fail$1(toPlatformError("spawn", error, command)));
|
|
36110
36110
|
});
|
|
36111
36111
|
handle.on("exit", (...args) => {
|
|
36112
36112
|
doneUnsafe(deferred, succeed$4(args));
|
|
@@ -36121,7 +36121,7 @@ const make$12 = /* @__PURE__ */ gen(function* () {
|
|
|
36121
36121
|
const killProcessGroup = (command, childProcess, signal) => {
|
|
36122
36122
|
if (globalThis.process.platform === "win32") return callback$1((resume) => {
|
|
36123
36123
|
node_child_process.exec(`taskkill /pid ${childProcess.pid} /T /F`, (error) => {
|
|
36124
|
-
if (error) resume(fail(toPlatformError("kill", toError(error), command)));
|
|
36124
|
+
if (error) resume(fail$1(toPlatformError("kill", toError(error), command)));
|
|
36125
36125
|
else resume(void_$1);
|
|
36126
36126
|
});
|
|
36127
36127
|
});
|
|
@@ -36144,7 +36144,7 @@ const make$12 = /* @__PURE__ */ gen(function* () {
|
|
|
36144
36144
|
const killProcess = (command, childProcess, signal) => suspend$2(() => {
|
|
36145
36145
|
if (!childProcess.kill(signal)) {
|
|
36146
36146
|
const error = new globalThis.Error("Failed to kill child process");
|
|
36147
|
-
return fail(toPlatformError("kill", error, command));
|
|
36147
|
+
return fail$1(toPlatformError("kill", error, command));
|
|
36148
36148
|
}
|
|
36149
36149
|
return void_$1;
|
|
36150
36150
|
});
|
|
@@ -36224,7 +36224,7 @@ const make$12 = /* @__PURE__ */ gen(function* () {
|
|
|
36224
36224
|
const exitCode = flatMap$1(_await(exitSignal), ([code, signal]) => {
|
|
36225
36225
|
if (isNotNull(code)) return succeed$2(ExitCode(code));
|
|
36226
36226
|
const error = new globalThis.Error(`Process interrupted due to receipt of signal: '${signal}'`);
|
|
36227
|
-
return fail(toPlatformError("exitCode", error, cmd));
|
|
36227
|
+
return fail$1(toPlatformError("exitCode", error, cmd));
|
|
36228
36228
|
});
|
|
36229
36229
|
const kill = (options) => {
|
|
36230
36230
|
return withTimeout(childProcess, cmd, options)((command, childProcess, signal) => killProcessGroup(command, childProcess, signal).pipe(catch_(() => killProcess(command, childProcess, signal)), andThen(_await(exitSignal)))).pipe(asVoid);
|
|
@@ -36462,7 +36462,7 @@ const make$11 = (impl) => {
|
|
|
36462
36462
|
randomUUIDv7: clockWith((clock) => succeed$2(formatUUIDv7(clock.currentTimeMillisUnsafe(), randomBytesUnsafe(16))))
|
|
36463
36463
|
});
|
|
36464
36464
|
};
|
|
36465
|
-
const validateSize = (method, size) => Number.isSafeInteger(size) && size >= 0 ? succeed$2(size) : fail(badArgument({
|
|
36465
|
+
const validateSize = (method, size) => Number.isSafeInteger(size) && size >= 0 ? succeed$2(size) : fail$1(badArgument({
|
|
36466
36466
|
module: "Crypto",
|
|
36467
36467
|
method,
|
|
36468
36468
|
description: "size must be a non-negative safe integer"
|
|
@@ -36747,7 +36747,7 @@ const makeFile = /* @__PURE__ */ (() => {
|
|
|
36747
36747
|
return suspend$2(() => {
|
|
36748
36748
|
const position = this.position;
|
|
36749
36749
|
return flatMap$1(nodeWriteAll(this.fd, buffer, void 0, void 0, this.append ? void 0 : Number(position)), (bytesWritten) => {
|
|
36750
|
-
if (bytesWritten === 0) return fail(systemError({
|
|
36750
|
+
if (bytesWritten === 0) return fail$1(systemError({
|
|
36751
36751
|
module: "FileSystem",
|
|
36752
36752
|
method: "writeAll",
|
|
36753
36753
|
_tag: "WriteZero",
|
|
@@ -36788,11 +36788,11 @@ const readDirectory = (path, options) => tryPromise({
|
|
|
36788
36788
|
const readFile = (path) => callback$1((resume, signal) => {
|
|
36789
36789
|
try {
|
|
36790
36790
|
node_fs.readFile(path, { signal }, (err, data) => {
|
|
36791
|
-
if (err) resume(fail(handleErrnoException("FileSystem", "readFile")(err, [path])));
|
|
36791
|
+
if (err) resume(fail$1(handleErrnoException("FileSystem", "readFile")(err, [path])));
|
|
36792
36792
|
else resume(succeed$2(data));
|
|
36793
36793
|
});
|
|
36794
36794
|
} catch (err) {
|
|
36795
|
-
resume(fail(handleBadArgument("readFile")(err)));
|
|
36795
|
+
resume(fail$1(handleBadArgument("readFile")(err)));
|
|
36796
36796
|
}
|
|
36797
36797
|
});
|
|
36798
36798
|
const readLink = /* @__PURE__ */ (() => {
|
|
@@ -36864,7 +36864,7 @@ const watchNode = (path, options) => callback((queue) => acquireRelease(sync(()
|
|
|
36864
36864
|
}
|
|
36865
36865
|
});
|
|
36866
36866
|
watcher.on("error", (error) => {
|
|
36867
|
-
failCauseUnsafe(queue, fail$
|
|
36867
|
+
failCauseUnsafe(queue, fail$3(systemError({
|
|
36868
36868
|
module: "FileSystem",
|
|
36869
36869
|
_tag: "Unknown",
|
|
36870
36870
|
method: "watch",
|
|
@@ -36885,11 +36885,11 @@ const writeFile = (path, data, options) => callback$1((resume, signal) => {
|
|
|
36885
36885
|
flag: options?.flag,
|
|
36886
36886
|
mode: options?.mode
|
|
36887
36887
|
}, (err) => {
|
|
36888
|
-
if (err) resume(fail(handleErrnoException("FileSystem", "writeFile")(err, [path])));
|
|
36888
|
+
if (err) resume(fail$1(handleErrnoException("FileSystem", "writeFile")(err, [path])));
|
|
36889
36889
|
else resume(void_$1);
|
|
36890
36890
|
});
|
|
36891
36891
|
} catch (err) {
|
|
36892
|
-
resume(fail(handleBadArgument("writeFile")(err)));
|
|
36892
|
+
resume(fail$1(handleBadArgument("writeFile")(err)));
|
|
36893
36893
|
}
|
|
36894
36894
|
});
|
|
36895
36895
|
const makeFileSystem = /* @__PURE__ */ map$5(/* @__PURE__ */ serviceOption(WatchBackend), (backend) => make$18({
|
|
@@ -37478,7 +37478,7 @@ const mergeParseOptions = (options, overrideOptions) => overrideOptions ? {
|
|
|
37478
37478
|
...overrideOptions
|
|
37479
37479
|
} : options;
|
|
37480
37480
|
const getValue = (value) => {
|
|
37481
|
-
if (value === missing) return fail(new InvalidValue$1());
|
|
37481
|
+
if (value === missing) return fail$1(new InvalidValue$1());
|
|
37482
37482
|
return succeed$2(value);
|
|
37483
37483
|
};
|
|
37484
37484
|
/** @internal */
|
|
@@ -37549,13 +37549,13 @@ function makeParser$1(ast, compile, compileConstructorDefault, constructorDefaul
|
|
|
37549
37549
|
const output = result === sameExit ? input : result[args];
|
|
37550
37550
|
if (input !== missing && output !== missing) {
|
|
37551
37551
|
const issues = collectIssues(encodingChecks, input, void 0, ast, options);
|
|
37552
|
-
if (issues) result = fail(new Composite(ast, issues));
|
|
37552
|
+
if (issues) result = fail$1(new Composite(ast, issues));
|
|
37553
37553
|
}
|
|
37554
37554
|
}
|
|
37555
37555
|
} else result = flatMap$1(result, (value) => {
|
|
37556
37556
|
if (input !== missing && value !== missing) {
|
|
37557
37557
|
const issues = collectIssues(encodingChecks, input, void 0, ast, options);
|
|
37558
|
-
if (issues) return fail(new Composite(ast, issues));
|
|
37558
|
+
if (issues) return fail$1(new Composite(ast, issues));
|
|
37559
37559
|
}
|
|
37560
37560
|
return succeed$2(value);
|
|
37561
37561
|
});
|
|
@@ -37564,12 +37564,12 @@ function makeParser$1(ast, compile, compileConstructorDefault, constructorDefaul
|
|
|
37564
37564
|
const value = result === sameExit ? input : result[args];
|
|
37565
37565
|
if (value === missing) return result;
|
|
37566
37566
|
const issues = collectIssues(checks, value, void 0, ast, options);
|
|
37567
|
-
if (issues) result = fail(new Composite(ast, issues));
|
|
37567
|
+
if (issues) result = fail$1(new Composite(ast, issues));
|
|
37568
37568
|
}
|
|
37569
37569
|
} else result = flatMap$1(result, (value) => {
|
|
37570
37570
|
if (value !== missing) {
|
|
37571
37571
|
const issues = collectIssues(checks, value, void 0, ast, options);
|
|
37572
|
-
if (issues) return fail(new Composite(ast, issues));
|
|
37572
|
+
if (issues) return fail$1(new Composite(ast, issues));
|
|
37573
37573
|
}
|
|
37574
37574
|
return succeed$2(value);
|
|
37575
37575
|
});
|
|
@@ -37972,7 +37972,7 @@ function declareConstructor() {
|
|
|
37972
37972
|
* @since 3.10.0
|
|
37973
37973
|
*/
|
|
37974
37974
|
function declare(is, annotations) {
|
|
37975
|
-
return declareConstructor()([], () => (input, ast) => is(input) ? succeed$2(input) : fail(new InvalidType(ast)), annotations);
|
|
37975
|
+
return declareConstructor()([], () => (input, ast) => is(input) ? succeed$2(input) : fail$1(new InvalidType(ast)), annotations);
|
|
37976
37976
|
}
|
|
37977
37977
|
/**
|
|
37978
37978
|
* Creates a type guard function that checks if a value conforms to a given
|
|
@@ -40084,7 +40084,7 @@ const File = /* @__PURE__ */ instanceOf(globalThis.File, {
|
|
|
40084
40084
|
lastModified: Int
|
|
40085
40085
|
}), transformOrFail({
|
|
40086
40086
|
decode: (e) => match$7(decodeBase64$1(e.data), {
|
|
40087
|
-
onFailure: () => fail(new InvalidValue$1({ message: "Expected a valid Base64 string" })),
|
|
40087
|
+
onFailure: () => fail$1(new InvalidValue$1({ message: "Expected a valid Base64 string" })),
|
|
40088
40088
|
onSuccess: (bytes) => {
|
|
40089
40089
|
const buffer = new globalThis.Uint8Array(bytes);
|
|
40090
40090
|
return succeed$2(new globalThis.File([buffer], e.name, {
|
|
@@ -40748,7 +40748,7 @@ function getClassSchemaFactory(from, identifier, annotations) {
|
|
|
40748
40748
|
const isClassValue = (input) => input instanceof self || hasProperty(input, ClassTypeId);
|
|
40749
40749
|
const transformation = getClassTransformation(self);
|
|
40750
40750
|
return memo = decodeTo(make$5(new Declaration([from.ast], () => (input, ast) => {
|
|
40751
|
-
return isClassValue(input) ? succeed$2(input) : fail(new InvalidType(ast));
|
|
40751
|
+
return isClassValue(input) ? succeed$2(input) : fail$1(new InvalidType(ast));
|
|
40752
40752
|
}, {
|
|
40753
40753
|
identifier,
|
|
40754
40754
|
[CONSTRUCTOR_ANNOTATION_KEY]: ([from]) => ({
|
|
@@ -41136,7 +41136,7 @@ const make$3 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQ
|
|
|
41136
41136
|
onSome: succeed$2
|
|
41137
41137
|
})), mapError(() => new QuitError({}))));
|
|
41138
41138
|
const display = (prompt) => uninterruptible(callback$1((resume) => {
|
|
41139
|
-
stdout.write(prompt, (err) => isNullish(err) ? resume(void_$1) : resume(fail(badArgument({
|
|
41139
|
+
stdout.write(prompt, (err) => isNullish(err) ? resume(void_$1) : resume(fail$1(badArgument({
|
|
41140
41140
|
module: "Terminal",
|
|
41141
41141
|
method: "display",
|
|
41142
41142
|
description: "Failed to write prompt to stdout",
|
|
@@ -43359,7 +43359,7 @@ const choice$2 = (choices) => {
|
|
|
43359
43359
|
const validChoices = choices.map(([key]) => format$3(key)).join(" | ");
|
|
43360
43360
|
const primitive = makePrimitive("Choice", (value) => {
|
|
43361
43361
|
if (choiceMap.has(value)) return succeed$2(choiceMap.get(value));
|
|
43362
|
-
return fail(validChoices);
|
|
43362
|
+
return fail$1(validChoices);
|
|
43363
43363
|
});
|
|
43364
43364
|
return Object.assign(primitive, { choiceKeys: choices.map(([key]) => key) });
|
|
43365
43365
|
};
|
|
@@ -43411,11 +43411,11 @@ const path$1 = (pathType, mustExist) => {
|
|
|
43411
43411
|
const path = yield* Path;
|
|
43412
43412
|
const absolutePath = path.isAbsolute(value) ? value : path.resolve(value);
|
|
43413
43413
|
const exists = yield* mapError(fs.exists(absolutePath), (error) => `Failed to check path existence: ${error.message}`);
|
|
43414
|
-
if (mustExist === true && !exists) return yield* fail(`Path does not exist: ${absolutePath}`);
|
|
43414
|
+
if (mustExist === true && !exists) return yield* fail$1(`Path does not exist: ${absolutePath}`);
|
|
43415
43415
|
if (exists && pathType !== "either") {
|
|
43416
43416
|
const stat = yield* mapError(fs.stat(absolutePath), (error) => `Failed to stat path: ${error.message}`);
|
|
43417
|
-
if (pathType === "file" && stat.type !== "File") return yield* fail(`Path is not a file: ${absolutePath}`);
|
|
43418
|
-
if (pathType === "directory" && stat.type !== "Directory") return yield* fail(`Path is not a directory: ${absolutePath}`);
|
|
43417
|
+
if (pathType === "file" && stat.type !== "File") return yield* fail$1(`Path is not a file: ${absolutePath}`);
|
|
43418
|
+
if (pathType === "directory" && stat.type !== "Directory") return yield* fail$1(`Path is not a directory: ${absolutePath}`);
|
|
43419
43419
|
}
|
|
43420
43420
|
return absolutePath;
|
|
43421
43421
|
}));
|
|
@@ -43463,7 +43463,7 @@ const path$1 = (pathType, mustExist) => {
|
|
|
43463
43463
|
* @category constructors
|
|
43464
43464
|
* @since 4.0.0
|
|
43465
43465
|
*/
|
|
43466
|
-
const none$2 = /* @__PURE__ */ makePrimitive("None", () => fail("This option does not accept values"));
|
|
43466
|
+
const none$2 = /* @__PURE__ */ makePrimitive("None", () => fail$1("This option does not accept values"));
|
|
43467
43467
|
/**
|
|
43468
43468
|
* Gets a human-readable type name for a primitive.
|
|
43469
43469
|
*
|
|
@@ -43851,8 +43851,8 @@ const float = (options) => {
|
|
|
43851
43851
|
decrementBy: 1,
|
|
43852
43852
|
precision: 2,
|
|
43853
43853
|
validate: (n) => {
|
|
43854
|
-
if (n < opts.min) return fail(`${n} must be greater than or equal to ${opts.min}`);
|
|
43855
|
-
if (n > opts.max) return fail(`${n} must be less than or equal to ${opts.max}`);
|
|
43854
|
+
if (n < opts.min) return fail$1(`${n} must be greater than or equal to ${opts.min}`);
|
|
43855
|
+
if (n > opts.max) return fail$1(`${n} must be less than or equal to ${opts.max}`);
|
|
43856
43856
|
return succeed$2(n);
|
|
43857
43857
|
},
|
|
43858
43858
|
...options
|
|
@@ -43887,8 +43887,8 @@ const integer = (options) => {
|
|
|
43887
43887
|
incrementBy: 1,
|
|
43888
43888
|
decrementBy: 1,
|
|
43889
43889
|
validate: (n) => {
|
|
43890
|
-
if (n < opts.min) return fail(`${n} must be greater than or equal to ${opts.min}`);
|
|
43891
|
-
if (n > opts.max) return fail(`${n} must be less than or equal to ${opts.max}`);
|
|
43890
|
+
if (n < opts.min) return fail$1(`${n} must be greater than or equal to ${opts.min}`);
|
|
43891
|
+
if (n > opts.max) return fail$1(`${n} must be less than or equal to ${opts.max}`);
|
|
43892
43892
|
return succeed$2(n);
|
|
43893
43893
|
},
|
|
43894
43894
|
...options
|
|
@@ -46046,6 +46046,37 @@ const variadic = (self, options) => {
|
|
|
46046
46046
|
});
|
|
46047
46047
|
};
|
|
46048
46048
|
/**
|
|
46049
|
+
* Wraps an option to require it to be specified at least `min` times.
|
|
46050
|
+
*
|
|
46051
|
+
* **Details**
|
|
46052
|
+
*
|
|
46053
|
+
* This combinator transforms an option to accept at least `min`
|
|
46054
|
+
* occurrences on the command line, returning an array of all provided values.
|
|
46055
|
+
*
|
|
46056
|
+
* **Example** (Requiring repeated values)
|
|
46057
|
+
*
|
|
46058
|
+
* ```ts import.meta.vitest
|
|
46059
|
+
* import { Param } from "effect/unstable/cli"
|
|
46060
|
+
*
|
|
46061
|
+
* // Require at least 2 input files
|
|
46062
|
+
* const inputs = Param.string(Param.flagKind, "input").pipe(
|
|
46063
|
+
* Param.atLeast(2),
|
|
46064
|
+
* Param.withAlias("-i")
|
|
46065
|
+
* )
|
|
46066
|
+
*
|
|
46067
|
+
* // Parse: --input file1.txt --input file2.txt --input file3.txt
|
|
46068
|
+
* // Result: ["file1.txt", "file2.txt", "file3.txt"]
|
|
46069
|
+
* inputs.kind // => "flag"
|
|
46070
|
+
* ```
|
|
46071
|
+
*
|
|
46072
|
+
* @category combinators
|
|
46073
|
+
* @since 4.0.0
|
|
46074
|
+
*/
|
|
46075
|
+
const atLeast$1 = /* @__PURE__ */ dual(2, (self, min) => {
|
|
46076
|
+
if (min < 0) throw new Error("atLeast: min must be non-negative");
|
|
46077
|
+
return variadic(self, { min });
|
|
46078
|
+
});
|
|
46079
|
+
/**
|
|
46049
46080
|
* Sets a custom metavar (placeholder name) for the param in help documentation.
|
|
46050
46081
|
*
|
|
46051
46082
|
* **Details**
|
|
@@ -46524,6 +46555,29 @@ const withDefault = withDefault$1;
|
|
|
46524
46555
|
* @since 4.0.0
|
|
46525
46556
|
*/
|
|
46526
46557
|
const map = /* @__PURE__ */ dual(2, (self, f) => map$1(self, f));
|
|
46558
|
+
/**
|
|
46559
|
+
* Ensures a flag is specified at least a minimum number of times.
|
|
46560
|
+
*
|
|
46561
|
+
* **Example** (Requiring repeated values)
|
|
46562
|
+
*
|
|
46563
|
+
* ```ts import.meta.vitest
|
|
46564
|
+
* import { Flag } from "effect/unstable/cli"
|
|
46565
|
+
*
|
|
46566
|
+
* const sourceFlag = Flag.atLeast(Flag.file("source"), 2)
|
|
46567
|
+
* // Requires at least 2 source files
|
|
46568
|
+
* // Usage: --source file1.ts --source file2.ts
|
|
46569
|
+
*
|
|
46570
|
+
* const tagFlag = Flag.string("tag").pipe(
|
|
46571
|
+
* Flag.atLeast(1)
|
|
46572
|
+
* )
|
|
46573
|
+
* // Requires at least 1 tag
|
|
46574
|
+
* const kinds = [sourceFlag.kind, tagFlag.kind] // => ["flag", "flag"]
|
|
46575
|
+
* ```
|
|
46576
|
+
*
|
|
46577
|
+
* @category repetition
|
|
46578
|
+
* @since 4.0.0
|
|
46579
|
+
*/
|
|
46580
|
+
const atLeast = /* @__PURE__ */ dual(2, (self, min) => atLeast$1(self, min));
|
|
46527
46581
|
|
|
46528
46582
|
//#endregion
|
|
46529
46583
|
//#region ../../node_modules/.pnpm/effect@4.0.0-beta.104/node_modules/effect/dist/unstable/cli/internal/config.js
|
|
@@ -46676,7 +46730,7 @@ const makeCommand = (options) => {
|
|
|
46676
46730
|
const annotations = options.annotations ?? empty$4();
|
|
46677
46731
|
const globalFlags = options.globalFlags ?? [];
|
|
46678
46732
|
const subcommands = options.subcommands ?? [];
|
|
46679
|
-
const handle = (input, commandPath) => isNotUndefined(options.handle) ? options.handle(input, commandPath) : fail(new ShowHelp({
|
|
46733
|
+
const handle = (input, commandPath) => isNotUndefined(options.handle) ? options.handle(input, commandPath) : fail$1(new ShowHelp({
|
|
46680
46734
|
commandPath,
|
|
46681
46735
|
errors: []
|
|
46682
46736
|
}));
|
|
@@ -48627,7 +48681,7 @@ const runWith = (command, config) => {
|
|
|
48627
48681
|
onSome: (level) => make$29(MinimumLogLevel, level)
|
|
48628
48682
|
});
|
|
48629
48683
|
yield* provideContext(program, services);
|
|
48630
|
-
}, catchFilter((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed$6(error) : fail$
|
|
48684
|
+
}, catchFilter((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed$6(error) : fail$5(error), (error) => andThen(showHelp(command, error), fail$1(error))), catchFilter((e) => isQuitError(e) ? succeed$6(e) : fail$5(e), (_) => interrupt$1));
|
|
48631
48685
|
};
|
|
48632
48686
|
|
|
48633
48687
|
//#endregion
|
|
@@ -50367,7 +50421,7 @@ const readPackage = (require, packageName) => gen(function* () {
|
|
|
50367
50421
|
..."main" in json && typeof json.main === "string" ? { main: json.main } : {}
|
|
50368
50422
|
};
|
|
50369
50423
|
});
|
|
50370
|
-
const optionally = (effect) => effect.pipe(catchTag("DiscoveryError", (error) => error.reason.startsWith("Unable to resolve ") ? succeed$2(void 0) : fail(error)));
|
|
50424
|
+
const optionally = (effect) => effect.pipe(catchTag("DiscoveryError", (error) => error.reason.startsWith("Unable to resolve ") ? succeed$2(void 0) : fail$1(error)));
|
|
50371
50425
|
const isGlibc = () => {
|
|
50372
50426
|
if (process.platform !== "linux") return false;
|
|
50373
50427
|
return typeof ((process.report?.getReport())?.header)?.glibcVersionRuntime === "string";
|
|
@@ -50560,7 +50614,7 @@ const preparePatch = (targets, options) => gen(function* () {
|
|
|
50560
50614
|
continue;
|
|
50561
50615
|
}
|
|
50562
50616
|
const replacement = yield* resolver(target).pipe(catchTag("ReplacementUnavailableError", (error) => {
|
|
50563
|
-
if (!options.skipMissing) return fail(error);
|
|
50617
|
+
if (!options.skipMissing) return fail$1(error);
|
|
50564
50618
|
skipped.push({
|
|
50565
50619
|
target,
|
|
50566
50620
|
reason: "replacement-unavailable",
|
|
@@ -197885,7 +197939,7 @@ var FileReadError = class extends TaggedError$1("FileReadError") {
|
|
|
197885
197939
|
//#endregion
|
|
197886
197940
|
//#region package.json
|
|
197887
197941
|
var name = "@effect/tsgo";
|
|
197888
|
-
var version = "0.
|
|
197942
|
+
var version = "0.35.0";
|
|
197889
197943
|
|
|
197890
197944
|
//#endregion
|
|
197891
197945
|
//#region src/cli/setup/consts.ts
|
|
@@ -198932,6 +198986,7 @@ const computeChanges = (assessment, target) => {
|
|
|
198932
198986
|
const packageJsonResult = computePackageJsonChanges(assessment.packageJson, target.packageJson);
|
|
198933
198987
|
codeActions = [...codeActions, ...packageJsonResult.codeActions];
|
|
198934
198988
|
messages = [...messages, ...packageJsonResult.messages];
|
|
198989
|
+
if (packageJsonResult.codeActions.length > 0) messages = [...messages, "`package.json` changed. Run your package manager's install command (for example, `pnpm install`, `npm install`, `yarn install`, or `bun install`)."];
|
|
198935
198990
|
const tsconfigResult = computeTsConfigChanges(assessment.tsconfig, target.tsconfig, target.packageJson.integrations.includes("typescript") ? target.packageJson.lspVersion : none$3());
|
|
198936
198991
|
codeActions = [...codeActions, ...tsconfigResult.codeActions];
|
|
198937
198992
|
messages = [...messages, ...tsconfigResult.messages];
|
|
@@ -199004,6 +199059,11 @@ const reviewAndApplyChanges = (result, assessmentState, options) => gen(function
|
|
|
199004
199059
|
yield* log(options?.cancelMessage ?? "No changes were made.");
|
|
199005
199060
|
return;
|
|
199006
199061
|
}
|
|
199062
|
+
yield* applyChanges(result, options);
|
|
199063
|
+
});
|
|
199064
|
+
const previewChanges = (result, assessmentState) => renderCodeActions(result, assessmentState);
|
|
199065
|
+
const applyChanges = (result, options) => gen(function* () {
|
|
199066
|
+
if (result.codeActions.length === 0) return;
|
|
199007
199067
|
yield* log("");
|
|
199008
199068
|
yield* log(options?.applyMessage ?? "Applying changes...");
|
|
199009
199069
|
const fs = yield* FileSystem;
|
|
@@ -199428,6 +199488,82 @@ function createRulePrompt(rules, initialSeverities) {
|
|
|
199428
199488
|
|
|
199429
199489
|
//#endregion
|
|
199430
199490
|
//#region src/cli/setup/target.ts
|
|
199491
|
+
const create = (assessment, context, options) => gen(function* () {
|
|
199492
|
+
const path = yield* Path;
|
|
199493
|
+
const { dependencyType, diagnosticSeverities: diagnosticSeveritiesRecord, editors, integrations } = options;
|
|
199494
|
+
const useTypescript = integrations.includes("typescript");
|
|
199495
|
+
const useOxlint = integrations.includes("oxlint");
|
|
199496
|
+
if (integrations.length === 0) return {
|
|
199497
|
+
packageJson: {
|
|
199498
|
+
lspVersion: none$3(),
|
|
199499
|
+
typescriptVersion: assessment.packageJson.typescriptVersion,
|
|
199500
|
+
oxlintVersion: assessment.packageJson.oxlintVersion,
|
|
199501
|
+
oxlintTsgolintVersion: assessment.packageJson.oxlintTsgolintVersion,
|
|
199502
|
+
prepareScript: false,
|
|
199503
|
+
managePrepareScript: true,
|
|
199504
|
+
integrations
|
|
199505
|
+
},
|
|
199506
|
+
tsconfig: {
|
|
199507
|
+
schemaPath: none$3(),
|
|
199508
|
+
diagnosticSeverities: none$3(),
|
|
199509
|
+
manageIntegration: true
|
|
199510
|
+
},
|
|
199511
|
+
oxlintrcSchemaPath: none$3(),
|
|
199512
|
+
vscodeSettings: none$3(),
|
|
199513
|
+
editors: []
|
|
199514
|
+
};
|
|
199515
|
+
const diagnosticSeverities = Object.keys(diagnosticSeveritiesRecord).length > 0 ? some({ ...diagnosticSeveritiesRecord }) : none$3();
|
|
199516
|
+
const defaultTypescriptPackageName = defaultTypescriptPackageNames[0];
|
|
199517
|
+
const relativeSchemaPath = path.relative(path.dirname(assessment.tsconfig.path), context.defaultSchemaPath).replaceAll("\\", "/");
|
|
199518
|
+
const oxlintrcSchemaPath = useOxlint ? map$11(assessment.oxlintConfig, (config) => {
|
|
199519
|
+
const relativePath = path.relative(path.dirname(config.path), context.defaultOxlintrcSchemaPath).replaceAll("\\", "/");
|
|
199520
|
+
return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
199521
|
+
}) : none$3();
|
|
199522
|
+
const vscodeSettings = editors.includes("vscode") ? some({ settings: {
|
|
199523
|
+
"js/ts.experimental.useTsgo": true,
|
|
199524
|
+
"js/ts.tsdk.path": "./node_modules/typescript/bin",
|
|
199525
|
+
"js/ts.tsdk.promptToUseWorkspaceVersion": true,
|
|
199526
|
+
"js/ts.tsdk.additionalLocations": ["./node_modules/typescript/bin"]
|
|
199527
|
+
} }) : none$3();
|
|
199528
|
+
return {
|
|
199529
|
+
packageJson: {
|
|
199530
|
+
lspVersion: some({
|
|
199531
|
+
dependencyType,
|
|
199532
|
+
version: context.defaultLspVersion
|
|
199533
|
+
}),
|
|
199534
|
+
typescriptVersion: useTypescript ? orElse(assessment.packageJson.typescriptVersion, () => some({
|
|
199535
|
+
dependencyType,
|
|
199536
|
+
version: context.defaultTypescriptVersion,
|
|
199537
|
+
packageName: defaultTypescriptPackageName
|
|
199538
|
+
})) : assessment.packageJson.typescriptVersion,
|
|
199539
|
+
oxlintVersion: useOxlint && (isSome(assessment.packageJson.oxlintVersion) || isNone(assessment.packageJson.vitePlusVersion)) ? some({
|
|
199540
|
+
dependencyType: match$8(assessment.packageJson.oxlintVersion, {
|
|
199541
|
+
onNone: () => dependencyType,
|
|
199542
|
+
onSome: (dependency) => dependency.dependencyType
|
|
199543
|
+
}),
|
|
199544
|
+
version: context.defaultOxlintVersion
|
|
199545
|
+
}) : assessment.packageJson.oxlintVersion,
|
|
199546
|
+
oxlintTsgolintVersion: useOxlint && (isSome(assessment.packageJson.oxlintTsgolintVersion) || isNone(assessment.packageJson.vitePlusVersion)) ? some({
|
|
199547
|
+
dependencyType: match$8(assessment.packageJson.oxlintTsgolintVersion, {
|
|
199548
|
+
onNone: () => dependencyType,
|
|
199549
|
+
onSome: (dependency) => dependency.dependencyType
|
|
199550
|
+
}),
|
|
199551
|
+
version: context.defaultOxlintTsgolintVersion
|
|
199552
|
+
}) : assessment.packageJson.oxlintTsgolintVersion,
|
|
199553
|
+
prepareScript: true,
|
|
199554
|
+
managePrepareScript: true,
|
|
199555
|
+
integrations
|
|
199556
|
+
},
|
|
199557
|
+
tsconfig: {
|
|
199558
|
+
schemaPath: useTypescript ? some(relativeSchemaPath.startsWith(".") ? relativeSchemaPath : `./${relativeSchemaPath}`) : none$3(),
|
|
199559
|
+
diagnosticSeverities,
|
|
199560
|
+
manageIntegration: true
|
|
199561
|
+
},
|
|
199562
|
+
oxlintrcSchemaPath,
|
|
199563
|
+
vscodeSettings,
|
|
199564
|
+
editors
|
|
199565
|
+
};
|
|
199566
|
+
});
|
|
199431
199567
|
const fromAssessment = (inputState) => ({
|
|
199432
199568
|
packageJson: {
|
|
199433
199569
|
lspVersion: inputState.packageJson.lspVersion,
|
|
@@ -199477,8 +199613,8 @@ const promptForTsConfigPath = (currentDir) => file$2({
|
|
|
199477
199613
|
filter: (file) => file === ".." || !file.includes(".") || isTsConfigFile(file)
|
|
199478
199614
|
});
|
|
199479
199615
|
const selectTsConfigFile = (currentDir) => gen(function* () {
|
|
199480
|
-
|
|
199481
|
-
|
|
199616
|
+
yield* FileSystem;
|
|
199617
|
+
yield* Path;
|
|
199482
199618
|
const tsconfigFiles = yield* findTsConfigFiles(currentDir);
|
|
199483
199619
|
let selectedTsconfigPath;
|
|
199484
199620
|
if (tsconfigFiles.length === 0) selectedTsconfigPath = yield* promptForTsConfigPath(currentDir);
|
|
@@ -199497,15 +199633,18 @@ const selectTsConfigFile = (currentDir) => gen(function* () {
|
|
|
199497
199633
|
if (selected === "__manual__") selectedTsconfigPath = yield* promptForTsConfigPath(currentDir);
|
|
199498
199634
|
else selectedTsconfigPath = selected;
|
|
199499
199635
|
}
|
|
199500
|
-
|
|
199501
|
-
|
|
199502
|
-
|
|
199503
|
-
|
|
199504
|
-
|
|
199505
|
-
|
|
199636
|
+
return yield* readTsConfigFile(selectedTsconfigPath);
|
|
199637
|
+
});
|
|
199638
|
+
const readTsConfigFile = (tsconfigPath) => gen(function* () {
|
|
199639
|
+
const fs = yield* FileSystem;
|
|
199640
|
+
const resolvedPath = (yield* Path).resolve(tsconfigPath);
|
|
199641
|
+
if (!(yield* fs.exists(resolvedPath))) return yield* new TsConfigNotFoundError({ path: resolvedPath });
|
|
199506
199642
|
return {
|
|
199507
|
-
fileName:
|
|
199508
|
-
text:
|
|
199643
|
+
fileName: resolvedPath,
|
|
199644
|
+
text: yield* fs.readFileString(resolvedPath).pipe(mapError((cause) => new FileReadError({
|
|
199645
|
+
path: resolvedPath,
|
|
199646
|
+
cause
|
|
199647
|
+
})))
|
|
199509
199648
|
};
|
|
199510
199649
|
});
|
|
199511
199650
|
|
|
@@ -199554,7 +199693,7 @@ const integrationFlags = {
|
|
|
199554
199693
|
typescript: boolean("typescript").pipe(withDefault(true), withDescription$1("Include the native TypeScript-Go integration")),
|
|
199555
199694
|
oxlint: boolean("oxlint").pipe(withDefault(false), withDescription$1("Include the experimental Oxlint integration"))
|
|
199556
199695
|
};
|
|
199557
|
-
const ensureIntegrationSelected = (typescript, oxlint) => typescript || oxlint ? void_$1 : fail(new IntegrationSelectionError({ reason: "Select at least one integration to manage." }));
|
|
199696
|
+
const ensureIntegrationSelected = (typescript, oxlint) => typescript || oxlint ? void_$1 : fail$1(new IntegrationSelectionError({ reason: "Select at least one integration to manage." }));
|
|
199558
199697
|
|
|
199559
199698
|
//#endregion
|
|
199560
199699
|
//#region src/cli/presets.ts
|
|
@@ -199608,13 +199747,110 @@ function isPresetEnabled(presetName, severities) {
|
|
|
199608
199747
|
return Object.entries(preset.diagnosticSeverity).every(([ruleName, requiredSeverity]) => compareRuleSeverity(resolveDiagnosticSeverity(ruleName, severities), requiredSeverity) >= 0);
|
|
199609
199748
|
}
|
|
199610
199749
|
|
|
199750
|
+
//#endregion
|
|
199751
|
+
//#region src/cli/setup/options.ts
|
|
199752
|
+
const dependencyTypes = ["devDependencies", "dependencies"];
|
|
199753
|
+
const severityNames = [
|
|
199754
|
+
"off",
|
|
199755
|
+
"suggestion",
|
|
199756
|
+
"message",
|
|
199757
|
+
"warning",
|
|
199758
|
+
"error"
|
|
199759
|
+
];
|
|
199760
|
+
const setupFlags = {
|
|
199761
|
+
project: file("project").pipe(optional, withDescription$1("The project tsconfig file to configure")),
|
|
199762
|
+
nonInteractive: boolean("non-interactive").pipe(withDefault(false), withDescription$1("Never open an interactive prompt")),
|
|
199763
|
+
acceptDefaults: boolean("accept-defaults").pipe(withDefault(false), withDescription$1("Use recommended defaults for unspecified setup choices")),
|
|
199764
|
+
apply: boolean("apply").pipe(withDefault(false), withDescription$1("Apply changes without asking for confirmation")),
|
|
199765
|
+
typescript: boolean("typescript").pipe(optional, withDescription$1("Configure the TypeScript language service integration")),
|
|
199766
|
+
oxlint: boolean("oxlint").pipe(optional, withDescription$1("Configure the Oxlint type-aware rules integration")),
|
|
199767
|
+
dependencyType: choice("dependency-type", dependencyTypes).pipe(optional, withDescription$1("Install @effect/tsgo in this dependency section")),
|
|
199768
|
+
preset: string("preset").pipe(atLeast(0), withDescription$1("Enable a diagnostic preset; may be specified more than once")),
|
|
199769
|
+
noPresets: boolean("no-presets").pipe(withDefault(false), withDescription$1("Do not select any diagnostic presets")),
|
|
199770
|
+
diagnostic: string("diagnostic").pipe(atLeast(0), withDescription$1("Set a diagnostic severity as <rule>=<severity>; may be specified more than once")),
|
|
199771
|
+
vscode: boolean("vscode").pipe(optional, withDescription$1("Configure VS Code-based editors")),
|
|
199772
|
+
nvim: boolean("nvim").pipe(optional, withDescription$1("Show Neovim setup instructions")),
|
|
199773
|
+
emacs: boolean("emacs").pipe(optional, withDescription$1("Show Emacs setup instructions"))
|
|
199774
|
+
};
|
|
199775
|
+
var NonInteractiveSetupError = class extends TaggedError$1("NonInteractiveSetupError") {
|
|
199776
|
+
get message() {
|
|
199777
|
+
return this.reason;
|
|
199778
|
+
}
|
|
199779
|
+
};
|
|
199780
|
+
const fail = (reason) => fail$1(new NonInteractiveSetupError({ reason }));
|
|
199781
|
+
const hasNonInteractiveTargetFlags = (flags) => flags.acceptDefaults || isSome(flags.typescript) || isSome(flags.oxlint) || isSome(flags.dependencyType) || flags.preset.length > 0 || flags.noPresets || flags.diagnostic.length > 0 || isSome(flags.vscode) || isSome(flags.nvim) || isSome(flags.emacs);
|
|
199782
|
+
const currentDiagnosticSeverities = (assessment) => getOrElse(assessment.tsconfig.currentDiagnosticSeverities, () => ({}));
|
|
199783
|
+
const resolvePresets = (assessment, flags) => {
|
|
199784
|
+
if (flags.noPresets && flags.preset.length > 0) return fail("--no-presets cannot be combined with --preset.");
|
|
199785
|
+
const presets = getAllPresets();
|
|
199786
|
+
const presetNames = new Set(presets.map((preset) => preset.name));
|
|
199787
|
+
const selected = flags.noPresets ? [] : flags.preset.length > 0 ? flags.preset : flags.acceptDefaults ? presets.filter((preset) => isPresetEnabled(preset.name, currentDiagnosticSeverities(assessment))).map((preset) => preset.name) : [];
|
|
199788
|
+
const invalid = selected.find((name) => !presetNames.has(name));
|
|
199789
|
+
return invalid === void 0 ? succeed$2(selected) : fail(`Unknown diagnostic preset '${invalid}'. Available presets: ${[...presetNames].join(", ")}.`);
|
|
199790
|
+
};
|
|
199791
|
+
const applyDiagnosticOverrides = (severities, overrides) => {
|
|
199792
|
+
const rulesByLowerCase = new Map(getAllRules().map((rule) => [rule.name.toLowerCase(), rule.name]));
|
|
199793
|
+
const result = { ...severities };
|
|
199794
|
+
for (const override of overrides) {
|
|
199795
|
+
const separator = override.lastIndexOf("=");
|
|
199796
|
+
const inputName = separator === -1 ? "" : override.slice(0, separator);
|
|
199797
|
+
const severity = separator === -1 ? "" : override.slice(separator + 1);
|
|
199798
|
+
const ruleName = rulesByLowerCase.get(inputName.toLowerCase());
|
|
199799
|
+
if (ruleName === void 0 || !severityNames.includes(severity)) return fail(`Invalid diagnostic '${override}'. Expected <rule>=<severity>, where severity is one of ${severityNames.join(", ")}.`);
|
|
199800
|
+
result[ruleName] = severity;
|
|
199801
|
+
}
|
|
199802
|
+
return succeed$2(result);
|
|
199803
|
+
};
|
|
199804
|
+
const resolveTargetOptions = (assessment, flags) => gen(function* () {
|
|
199805
|
+
if (!flags.acceptDefaults && (isNone(flags.typescript) || isNone(flags.oxlint))) return yield* fail("Non-interactive setup requires both integration flags or --accept-defaults. Pass --typescript/--no-typescript and --oxlint/--no-oxlint.");
|
|
199806
|
+
const defaultOxlint = isSome(assessment.packageJson.oxlintVersion) || isSome(assessment.packageJson.oxlintTsgolintVersion) || isSome(assessment.packageJson.vitePlusVersion);
|
|
199807
|
+
const integrations = [];
|
|
199808
|
+
if (getOrElse(flags.typescript, () => flags.acceptDefaults)) integrations.push("typescript");
|
|
199809
|
+
if (getOrElse(flags.oxlint, () => flags.acceptDefaults && defaultOxlint)) integrations.push("oxlint");
|
|
199810
|
+
const useTypescript = integrations.includes("typescript");
|
|
199811
|
+
const hasTypescriptOnlyOverrides = flags.preset.length > 0 || flags.diagnostic.length > 0 || getOrElse(flags.vscode, () => false) || getOrElse(flags.nvim, () => false) || getOrElse(flags.emacs, () => false);
|
|
199812
|
+
if (!useTypescript && hasTypescriptOnlyOverrides) return yield* fail("Diagnostic presets, diagnostic overrides, and editor choices require --typescript.");
|
|
199813
|
+
const dependencyType = match$8(flags.dependencyType, {
|
|
199814
|
+
onNone: () => match$8(assessment.packageJson.lspVersion, {
|
|
199815
|
+
onNone: () => "devDependencies",
|
|
199816
|
+
onSome: (dependency) => dependency.dependencyType
|
|
199817
|
+
}),
|
|
199818
|
+
onSome: (value) => value
|
|
199819
|
+
});
|
|
199820
|
+
if (integrations.length > 0 && isNone(flags.dependencyType) && !flags.acceptDefaults) return yield* fail("Non-interactive setup requires --dependency-type unless --accept-defaults is used.");
|
|
199821
|
+
const selectedPresets = useTypescript ? yield* resolvePresets(assessment, flags) : [];
|
|
199822
|
+
const diagnosticSeverities = yield* applyDiagnosticOverrides(applyPresetDiagnosticSeverities(currentDiagnosticSeverities(assessment), selectedPresets), flags.diagnostic);
|
|
199823
|
+
const editorSelections = [
|
|
199824
|
+
[
|
|
199825
|
+
flags.vscode,
|
|
199826
|
+
"vscode",
|
|
199827
|
+
isSome(assessment.vscodeSettings)
|
|
199828
|
+
],
|
|
199829
|
+
[
|
|
199830
|
+
flags.nvim,
|
|
199831
|
+
"nvim",
|
|
199832
|
+
false
|
|
199833
|
+
],
|
|
199834
|
+
[
|
|
199835
|
+
flags.emacs,
|
|
199836
|
+
"emacs",
|
|
199837
|
+
false
|
|
199838
|
+
]
|
|
199839
|
+
];
|
|
199840
|
+
return {
|
|
199841
|
+
integrations,
|
|
199842
|
+
dependencyType,
|
|
199843
|
+
diagnosticSeverities,
|
|
199844
|
+
editors: useTypescript ? editorSelections.flatMap(([selection, editor, recommended]) => getOrElse(selection, () => flags.acceptDefaults && recommended) ? [editor] : []) : []
|
|
199845
|
+
};
|
|
199846
|
+
});
|
|
199847
|
+
|
|
199611
199848
|
//#endregion
|
|
199612
199849
|
//#region src/cli/setup/target-prompt.ts
|
|
199613
199850
|
/**
|
|
199614
199851
|
* Gather target state from user based on current assessment
|
|
199615
199852
|
*/
|
|
199616
|
-
const
|
|
199617
|
-
const path = yield* Path;
|
|
199853
|
+
const gatherTargetOptions = (assessment) => gen(function* () {
|
|
199618
199854
|
const integrations = yield* multiSelect({
|
|
199619
199855
|
message: "Which integrations would you like to configure?",
|
|
199620
199856
|
choices: [{
|
|
@@ -199628,24 +199864,11 @@ const gatherTargetState = (assessment, context) => gen(function* () {
|
|
|
199628
199864
|
}]
|
|
199629
199865
|
});
|
|
199630
199866
|
const useTypescript = integrations.includes("typescript");
|
|
199631
|
-
|
|
199867
|
+
integrations.includes("oxlint");
|
|
199632
199868
|
if (integrations.length === 0) return {
|
|
199633
|
-
|
|
199634
|
-
|
|
199635
|
-
|
|
199636
|
-
oxlintVersion: assessment.packageJson.oxlintVersion,
|
|
199637
|
-
oxlintTsgolintVersion: assessment.packageJson.oxlintTsgolintVersion,
|
|
199638
|
-
prepareScript: false,
|
|
199639
|
-
managePrepareScript: true,
|
|
199640
|
-
integrations
|
|
199641
|
-
},
|
|
199642
|
-
tsconfig: {
|
|
199643
|
-
schemaPath: none$3(),
|
|
199644
|
-
diagnosticSeverities: none$3(),
|
|
199645
|
-
manageIntegration: true
|
|
199646
|
-
},
|
|
199647
|
-
oxlintrcSchemaPath: none$3(),
|
|
199648
|
-
vscodeSettings: none$3(),
|
|
199869
|
+
integrations,
|
|
199870
|
+
dependencyType: "devDependencies",
|
|
199871
|
+
diagnosticSeverities: {},
|
|
199649
199872
|
editors: []
|
|
199650
199873
|
};
|
|
199651
199874
|
const currentLspState = match$8(assessment.packageJson.lspVersion, {
|
|
@@ -199686,75 +199909,29 @@ const gatherTargetState = (assessment, context) => gen(function* () {
|
|
|
199686
199909
|
const shouldCustomizeDiagnostics = selectedDiagnosticModes.includes("custom");
|
|
199687
199910
|
const initialSeverities = applyPresetDiagnosticSeverities(currentDiagnosticSeverities, selectedDiagnosticModes.filter((value) => value !== "custom"));
|
|
199688
199911
|
const diagnosticSeveritiesRecord = shouldCustomizeDiagnostics ? yield* createRulePrompt(getAllRules(), initialSeverities) : initialSeverities;
|
|
199689
|
-
const diagnosticSeverities = Object.keys(diagnosticSeveritiesRecord).length > 0 ? some(diagnosticSeveritiesRecord) : none$3();
|
|
199690
199912
|
const hasVscodeSettings = isSome(assessment.vscodeSettings);
|
|
199691
|
-
const editors = useTypescript ? yield* multiSelect({
|
|
199692
|
-
message: "Which editors do you use?",
|
|
199693
|
-
choices: [
|
|
199694
|
-
{
|
|
199695
|
-
title: "VS Code / Cursor / VS Code-based editors",
|
|
199696
|
-
value: "vscode",
|
|
199697
|
-
selected: hasVscodeSettings
|
|
199698
|
-
},
|
|
199699
|
-
{
|
|
199700
|
-
title: "Neovim",
|
|
199701
|
-
value: "nvim"
|
|
199702
|
-
},
|
|
199703
|
-
{
|
|
199704
|
-
title: "Emacs",
|
|
199705
|
-
value: "emacs"
|
|
199706
|
-
}
|
|
199707
|
-
]
|
|
199708
|
-
}) : [];
|
|
199709
|
-
const defaultTypescriptPackageName = defaultTypescriptPackageNames[0];
|
|
199710
|
-
const relativeSchemaPath = path.relative(path.dirname(assessment.tsconfig.path), context.defaultSchemaPath).replaceAll("\\", "/");
|
|
199711
|
-
const oxlintrcSchemaPath = useOxlint ? map$11(assessment.oxlintConfig, (config) => {
|
|
199712
|
-
const relativePath = path.relative(path.dirname(config.path), context.defaultOxlintrcSchemaPath).replaceAll("\\", "/");
|
|
199713
|
-
return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
199714
|
-
}) : none$3();
|
|
199715
|
-
const vscodeSettings = editors.includes("vscode") ? some({ settings: {
|
|
199716
|
-
"js/ts.experimental.useTsgo": true,
|
|
199717
|
-
"js/ts.tsdk.path": "./node_modules/typescript/bin",
|
|
199718
|
-
"js/ts.tsdk.promptToUseWorkspaceVersion": true,
|
|
199719
|
-
"js/ts.tsdk.additionalLocations": ["./node_modules/typescript/bin"]
|
|
199720
|
-
} }) : none$3();
|
|
199721
199913
|
return {
|
|
199722
|
-
|
|
199723
|
-
|
|
199724
|
-
|
|
199725
|
-
|
|
199726
|
-
|
|
199727
|
-
|
|
199728
|
-
|
|
199729
|
-
|
|
199730
|
-
|
|
199731
|
-
|
|
199732
|
-
|
|
199733
|
-
|
|
199734
|
-
|
|
199735
|
-
|
|
199736
|
-
}
|
|
199737
|
-
|
|
199738
|
-
|
|
199739
|
-
|
|
199740
|
-
|
|
199741
|
-
|
|
199742
|
-
|
|
199743
|
-
}),
|
|
199744
|
-
version: context.defaultOxlintTsgolintVersion
|
|
199745
|
-
}) : assessment.packageJson.oxlintTsgolintVersion,
|
|
199746
|
-
prepareScript: true,
|
|
199747
|
-
managePrepareScript: true,
|
|
199748
|
-
integrations
|
|
199749
|
-
},
|
|
199750
|
-
tsconfig: {
|
|
199751
|
-
schemaPath: useTypescript ? some(relativeSchemaPath.startsWith(".") ? relativeSchemaPath : `./${relativeSchemaPath}`) : none$3(),
|
|
199752
|
-
diagnosticSeverities,
|
|
199753
|
-
manageIntegration: true
|
|
199754
|
-
},
|
|
199755
|
-
oxlintrcSchemaPath,
|
|
199756
|
-
vscodeSettings,
|
|
199757
|
-
editors
|
|
199914
|
+
integrations,
|
|
199915
|
+
dependencyType: lspDependencyType,
|
|
199916
|
+
diagnosticSeverities: diagnosticSeveritiesRecord,
|
|
199917
|
+
editors: useTypescript ? yield* multiSelect({
|
|
199918
|
+
message: "Which editors do you use?",
|
|
199919
|
+
choices: [
|
|
199920
|
+
{
|
|
199921
|
+
title: "VS Code / Cursor / VS Code-based editors",
|
|
199922
|
+
value: "vscode",
|
|
199923
|
+
selected: hasVscodeSettings
|
|
199924
|
+
},
|
|
199925
|
+
{
|
|
199926
|
+
title: "Neovim",
|
|
199927
|
+
value: "nvim"
|
|
199928
|
+
},
|
|
199929
|
+
{
|
|
199930
|
+
title: "Emacs",
|
|
199931
|
+
value: "emacs"
|
|
199932
|
+
}
|
|
199933
|
+
]
|
|
199934
|
+
}) : []
|
|
199758
199935
|
};
|
|
199759
199936
|
});
|
|
199760
199937
|
|
|
@@ -199763,7 +199940,7 @@ const gatherTargetState = (assessment, context) => gen(function* () {
|
|
|
199763
199940
|
var tags = {
|
|
199764
199941
|
"typescript": {
|
|
199765
199942
|
"latest": "7.0.2",
|
|
199766
|
-
"next": "7.1.0-dev.
|
|
199943
|
+
"next": "7.1.0-dev.20260806.1"
|
|
199767
199944
|
},
|
|
199768
199945
|
"oxlint": { "latest": "1.77.0" },
|
|
199769
199946
|
"oxlint-tsgolint": { "latest": "7.0.2001" }
|
|
@@ -199771,22 +199948,30 @@ var tags = {
|
|
|
199771
199948
|
|
|
199772
199949
|
//#endregion
|
|
199773
199950
|
//#region src/cli/setup/index.ts
|
|
199774
|
-
const setupCommand = make("setup").pipe(withDescription("Setup @effect/tsgo for the given project
|
|
199951
|
+
const setupCommand = make("setup", setupFlags).pipe(withDescription("Setup @effect/tsgo for the given project."), withHandler((flags) => gen(function* () {
|
|
199775
199952
|
const path = yield* Path;
|
|
199776
199953
|
const currentDir = path.resolve(process.cwd());
|
|
199777
|
-
|
|
199954
|
+
if (!flags.nonInteractive && hasNonInteractiveTargetFlags(flags)) return yield* fail$1(new NonInteractiveSetupError({ reason: "Setup choice flags require --non-interactive." }));
|
|
199955
|
+
if (flags.nonInteractive && isNone(flags.project)) return yield* fail$1(new NonInteractiveSetupError({ reason: "Non-interactive setup requires --project." }));
|
|
199956
|
+
const tsconfigInput = isSome(flags.project) ? yield* readTsConfigFile(path.resolve(currentDir, flags.project.value)) : yield* selectTsConfigFile(currentDir);
|
|
199778
199957
|
const assessmentInput = yield* createAssessmentInput(currentDir, tsconfigInput);
|
|
199779
199958
|
const assessmentState = assess(assessmentInput);
|
|
199780
|
-
const
|
|
199959
|
+
const targetContext = {
|
|
199781
199960
|
defaultLspVersion: version,
|
|
199782
199961
|
defaultTypescriptVersion: tags.typescript.latest,
|
|
199783
199962
|
defaultOxlintVersion: tags.oxlint.latest,
|
|
199784
199963
|
defaultOxlintTsgolintVersion: tags["oxlint-tsgolint"].latest,
|
|
199785
199964
|
defaultSchemaPath: path.resolve(currentDir, "node_modules", name, "schema.json"),
|
|
199786
199965
|
defaultOxlintrcSchemaPath: path.resolve(currentDir, "node_modules", name, "oxlint-schema.json")
|
|
199787
|
-
}
|
|
199966
|
+
};
|
|
199967
|
+
const targetOptions = flags.nonInteractive ? yield* resolveTargetOptions(assessmentState, flags) : yield* gatherTargetOptions(assessmentState);
|
|
199968
|
+
const targetState = yield* create(assessmentState, targetContext, targetOptions);
|
|
199788
199969
|
const result = computeChanges(assessmentState, targetState);
|
|
199789
|
-
|
|
199970
|
+
if (flags.apply) {
|
|
199971
|
+
yield* previewChanges(result, assessmentState);
|
|
199972
|
+
yield* applyChanges(result);
|
|
199973
|
+
} else if (flags.nonInteractive) yield* previewChanges(result, assessmentState);
|
|
199974
|
+
else yield* reviewAndApplyChanges(result, assessmentState, { cancelMessage: "Setup cancelled. No changes were made." });
|
|
199790
199975
|
})));
|
|
199791
199976
|
|
|
199792
199977
|
//#endregion
|