@deslop/coding-standards 0.1.1076 → 0.1.1079
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 +1 -1
- package/dist/{MutableRef-KfyWrSvW.mjs → MutableList-BCF17jPH.mjs} +536 -65
- package/dist/install.js +1611 -1752
- package/dist/oxlint.d.ts +12 -18
- package/dist/oxlint.js +631 -226
- package/package.json +1 -1
- package/skills/architecture/SKILL.md +1 -1
- package/skills/design/SKILL.md +4 -4
- package/skills/engineering/SKILL.md +39 -10
- package/skills/testing/SKILL.md +1 -1
package/dist/install.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { A as filter, An as isCause, Ar as isString$1, At as getOrUndefined$1, Bn as assignProperty, Br as identity, C as contains, Cn as contE, Cr as isNullish, D as empty$3, Dn as exitFail, Dt as fromNullishOr, En as exitDie, Er as isObjectKeyword, Fn as isFailReason$1, Fr as constTrue, Ft as match$5, G as isReadonlyArrayNonEmpty, Gn as NodeInspectSymbol, Gr as Prototype$1, Gt as isGreaterThan$1, Hn as getStackTraceLimit, Hr as memoizeIdempotent, In as isInterruptReason, Ir as constUndefined, It as none, K as join$1, Kn as toStringUnknown, Kr as pipeArguments, Ln as makePrimitive$1, Lr as constVoid, Lt as orElse, M as findFirst, Mn as isDone$2, Mr as isUndefined, Mt as isSome, N as findFirstIndex, Nn as isEffect$1, Nr as isUnknown, On as exitFailCause, Ot as fromUndefinedOr, P as findLast, Pn as isExit, Pr as constFalse, Pt as map$10, Q as of, Qn as currentFiberTypeId, R as fromIterable$1, Rn as makePrimitiveProto, Rr as constant, Rt as some, Sn as contAll, Sr as isNotUndefined, St as exists, T as dedupe, Tn as evaluate, Tr as isObject, Tt as flatMap$4, U as isArrayNonEmpty, Un as setStackTraceLimit, Ur as pipe, Ut as Number$6, Vn as internalCall, Vr as memoize, W as isCanonicalArrayIndex, Wn as BaseProto, Wr as Class, Wt as String$6, X as match$6, Xn as formatPath, Xt as mapInput, Y as map$8, Yn as formatJson, Zn as formatPropertyKey, _ as trimEnd, _n as causeEmpty, _r as isError, _t as match$4, a as takeN, an as Fail, b as taggedEnum, bn as constEmptyAnnotations, br as isNotNull, c as make$30, cn as ReasonBase, cr as number$1, dn as Yield, dr as structure, en as CauseImpl, et as reduce, fn as args, gn as causeDie, gr as isBoolean$1, h as startsWith, hn as causeCombine, i as take$1, in as ExitTypeId, ir as symbol, jn as isDieReason$1, jr as isTagged, jt as isNone, kn as exitSucceed, kt as getOrElse, ln as StackTraceKey, mn as causeAnnotate, mr as hasProperty, mt as isFailure$1, n as clear, nn as Done$1, on as InterruptorStackTrace, or as combine$1, pn as causeAddInterrupts, pr as symbol$1, qn as format$1, r as make$29, rn as Error$3, rr as equals$1, sn as PipeInspectableProto, sr as hash, t as append$1, tn as Die, tt as some$1, un as TaggedError$2, ur as string$1, ut as fail$5, v as Error$2, vn as causeFail, vr as isFunction, vt as succeed$6, wn as done$1, wr as isNumber, x as append, xn as contA, xr as isNotNullish, y as TaggedError$1, yn as causeFromReasons, yr as isIterable, yt as normalize$1, zn as withFiber$1, zr as dual } from "./MutableList-BCF17jPH.mjs";
|
|
3
3
|
import * as OS from "node:os";
|
|
4
4
|
import * as NodeChildProcess from "node:child_process";
|
|
5
5
|
import { PassThrough } from "node:stream";
|
|
@@ -8,7 +8,7 @@ import * as NFS from "node:fs";
|
|
|
8
8
|
import * as Path from "node:path";
|
|
9
9
|
import * as NodeUrl from "node:url";
|
|
10
10
|
import * as readline from "node:readline";
|
|
11
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
11
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Effectable.js
|
|
12
12
|
/**
|
|
13
13
|
* Create a low-level `Effect` prototype.
|
|
14
14
|
*
|
|
@@ -34,7 +34,7 @@ const Prototype = (options) => makePrimitiveProto({
|
|
|
34
34
|
[evaluate]: options.evaluate
|
|
35
35
|
});
|
|
36
36
|
//#endregion
|
|
37
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
37
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Context.js
|
|
38
38
|
/**
|
|
39
39
|
* Runtime type identifier attached to `Context` service keys and used by
|
|
40
40
|
* `isKey` to recognize them.
|
|
@@ -140,11 +140,11 @@ const ServiceProto = {
|
|
|
140
140
|
};
|
|
141
141
|
const cacheKeys = /*#__PURE__*/ new Set();
|
|
142
142
|
const ReferenceTypeId = "~effect/Context/Reference";
|
|
143
|
-
const TypeId$
|
|
143
|
+
const TypeId$34 = "~effect/Context";
|
|
144
144
|
const MaxDepth = 8;
|
|
145
145
|
const FlattenAfterBaseHits = 8;
|
|
146
146
|
const makeImpl = (cacheRoot, base, overlay, depth) => {
|
|
147
|
-
const self = Object.create(Proto$
|
|
147
|
+
const self = Object.create(Proto$11);
|
|
148
148
|
self.cacheRoot = cacheRoot ?? self;
|
|
149
149
|
self.base = base;
|
|
150
150
|
self.overlay = overlay;
|
|
@@ -216,12 +216,12 @@ const lookup = (self, key) => {
|
|
|
216
216
|
* @since 4.0.0
|
|
217
217
|
*/
|
|
218
218
|
const makeUnsafe$5 = (mapUnsafe) => makeImpl(void 0, mapUnsafe, void 0, 0);
|
|
219
|
-
const Proto$
|
|
219
|
+
const Proto$11 = {
|
|
220
220
|
get mapUnsafe() {
|
|
221
221
|
return flatten(this);
|
|
222
222
|
},
|
|
223
223
|
...PipeInspectableProto,
|
|
224
|
-
[TypeId$
|
|
224
|
+
[TypeId$34]: { _Services: (_) => _ },
|
|
225
225
|
toJSON() {
|
|
226
226
|
return {
|
|
227
227
|
_id: "Context",
|
|
@@ -277,7 +277,7 @@ const hasSameCache = (self, that) => self.cacheRoot === that.cacheRoot;
|
|
|
277
277
|
* @category guards
|
|
278
278
|
* @since 2.0.0
|
|
279
279
|
*/
|
|
280
|
-
const isContext = (u) => hasProperty(u, TypeId$
|
|
280
|
+
const isContext = (u) => hasProperty(u, TypeId$34);
|
|
281
281
|
/**
|
|
282
282
|
* Checks whether the provided argument is a `Reference`.
|
|
283
283
|
*
|
|
@@ -686,15 +686,16 @@ const mergeAll$1 = (...ctxs) => {
|
|
|
686
686
|
*/
|
|
687
687
|
const Reference = Service;
|
|
688
688
|
//#endregion
|
|
689
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
690
|
-
const TypeId$
|
|
689
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Duration.js
|
|
690
|
+
const TypeId$33 = "~effect/Duration";
|
|
691
691
|
const bigint0$2 = /*#__PURE__*/ BigInt(0);
|
|
692
692
|
const bigint1$2 = /*#__PURE__*/ BigInt(1);
|
|
693
693
|
const bigint2 = /*#__PURE__*/ BigInt(2);
|
|
694
694
|
const bigint10$1 = /*#__PURE__*/ BigInt(10);
|
|
695
695
|
const bigint1e3 = /*#__PURE__*/ BigInt(1e3);
|
|
696
|
+
const bigint1e6 = /*#__PURE__*/ BigInt(1e6);
|
|
696
697
|
const roundTiesAwayFromZero = (input) => BigInt(Math.sign(input) * Math.round(Math.abs(input)));
|
|
697
|
-
const roundMillisToNanos = (millis) => roundTiesAwayFromZero(millis * 1e6);
|
|
698
|
+
const roundMillisToNanos = (millis) => Number.isInteger(millis) ? BigInt(millis) * bigint1e6 : roundTiesAwayFromZero(millis * 1e6);
|
|
698
699
|
const fromNanosNumber = (nanos) => make$25(Number.isFinite(nanos) ? roundTiesAwayFromZero(nanos) : nanos);
|
|
699
700
|
const parseNanos = (input, scale) => {
|
|
700
701
|
const decimalIndex = input.indexOf(".");
|
|
@@ -769,7 +770,7 @@ const fromInputUnsafe$1 = (input) => {
|
|
|
769
770
|
}
|
|
770
771
|
case "object": {
|
|
771
772
|
if (input === null) break;
|
|
772
|
-
if (TypeId$
|
|
773
|
+
if (TypeId$33 in input) return input;
|
|
773
774
|
if (Array.isArray(input)) {
|
|
774
775
|
if (input.length !== 2 || !input.every(isNumber)) return invalid$2(input);
|
|
775
776
|
if (Number.isNaN(input[0]) || Number.isNaN(input[1])) return zero$1;
|
|
@@ -801,13 +802,10 @@ const zeroDurationValue = {
|
|
|
801
802
|
const infinityDurationValue = { _tag: "Infinity" };
|
|
802
803
|
const negativeInfinityDurationValue = { _tag: "NegativeInfinity" };
|
|
803
804
|
const DurationProto = {
|
|
804
|
-
[TypeId$
|
|
805
|
+
[TypeId$33]: TypeId$33,
|
|
805
806
|
[symbol$1]() {
|
|
806
807
|
switch (this.value._tag) {
|
|
807
|
-
case "Millis":
|
|
808
|
-
const nanos = this.value.millis * 1e6;
|
|
809
|
-
return Number.isFinite(nanos) ? hash(roundTiesAwayFromZero(nanos)) : number$1(this.value.millis);
|
|
810
|
-
}
|
|
808
|
+
case "Millis": return hash(roundMillisToNanos(this.value.millis));
|
|
811
809
|
case "Nanos": return hash(this.value.nanos);
|
|
812
810
|
default: return structure(this.value);
|
|
813
811
|
}
|
|
@@ -888,7 +886,7 @@ const make$25 = (input) => {
|
|
|
888
886
|
* @category guards
|
|
889
887
|
* @since 2.0.0
|
|
890
888
|
*/
|
|
891
|
-
const isDuration = (u) => hasProperty(u, TypeId$
|
|
889
|
+
const isDuration = (u) => hasProperty(u, TypeId$33);
|
|
892
890
|
/**
|
|
893
891
|
* Checks whether a Duration is finite (not infinite).
|
|
894
892
|
*
|
|
@@ -1082,7 +1080,7 @@ const weeks = (weeks) => make$25(weeks * 6048e5);
|
|
|
1082
1080
|
* @category getters
|
|
1083
1081
|
* @since 2.0.0
|
|
1084
1082
|
*/
|
|
1085
|
-
const toMillis = (self) => match$
|
|
1083
|
+
const toMillis = (self) => match$3(fromInputUnsafe$1(self), {
|
|
1086
1084
|
onMillis: identity,
|
|
1087
1085
|
onNanos: (nanos) => Number(nanos) / 1e6,
|
|
1088
1086
|
onInfinity: () => Infinity,
|
|
@@ -1154,7 +1152,7 @@ const toNanosUnsafe = (input) => {
|
|
|
1154
1152
|
* @category pattern matching
|
|
1155
1153
|
* @since 2.0.0
|
|
1156
1154
|
*/
|
|
1157
|
-
const match$
|
|
1155
|
+
const match$3 = /*#__PURE__*/ dual(2, (self, options) => {
|
|
1158
1156
|
switch (self.value._tag) {
|
|
1159
1157
|
case "Millis": return options.onMillis(self.value.millis);
|
|
1160
1158
|
case "Nanos": return options.onNanos(self.value.nanos);
|
|
@@ -1201,7 +1199,7 @@ const matchPair = /*#__PURE__*/ dual(3, (self, that, options) => {
|
|
|
1201
1199
|
* @category instances
|
|
1202
1200
|
* @since 2.0.0
|
|
1203
1201
|
*/
|
|
1204
|
-
const Equivalence$
|
|
1202
|
+
const Equivalence$2 = (self, that) => matchPair(self, that, {
|
|
1205
1203
|
onMillis: (self, that) => self === that,
|
|
1206
1204
|
onNanos: (self, that) => self === that,
|
|
1207
1205
|
onInfinity: (self, that) => self.value._tag === that.value._tag
|
|
@@ -1221,9 +1219,9 @@ const Equivalence$1 = (self, that) => matchPair(self, that, {
|
|
|
1221
1219
|
* @category predicates
|
|
1222
1220
|
* @since 2.0.0
|
|
1223
1221
|
*/
|
|
1224
|
-
const equals = /*#__PURE__*/ dual(2, (self, that) => Equivalence$
|
|
1222
|
+
const equals = /*#__PURE__*/ dual(2, (self, that) => Equivalence$2(self, that));
|
|
1225
1223
|
//#endregion
|
|
1226
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
1224
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Scheduler.js
|
|
1227
1225
|
/**
|
|
1228
1226
|
* Controls how runnable Effect fiber tasks are dispatched.
|
|
1229
1227
|
*
|
|
@@ -1460,7 +1458,7 @@ const PreventSchedulerYield = /*#__PURE__*/ Reference("effect/Scheduler/PreventS
|
|
|
1460
1458
|
defaultValue: () => false
|
|
1461
1459
|
});
|
|
1462
1460
|
//#endregion
|
|
1463
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
1461
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Tracer.js
|
|
1464
1462
|
/**
|
|
1465
1463
|
* Defines the string key for the parent-span context service.
|
|
1466
1464
|
*
|
|
@@ -1497,11 +1495,11 @@ const ParentSpanKey = "effect/Tracer/ParentSpan";
|
|
|
1497
1495
|
*/
|
|
1498
1496
|
const TracerKey = "effect/Tracer";
|
|
1499
1497
|
//#endregion
|
|
1500
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
1498
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/metric.js
|
|
1501
1499
|
/** @internal */
|
|
1502
1500
|
const FiberRuntimeMetricsKey = "effect/Metric/FiberRuntimeMetrics";
|
|
1503
1501
|
//#endregion
|
|
1504
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
1502
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/references.js
|
|
1505
1503
|
/** @internal */
|
|
1506
1504
|
const CurrentStackFrame = /*#__PURE__*/ Reference("effect/References/CurrentStackFrame", {
|
|
1507
1505
|
fiberCached: true,
|
|
@@ -1527,7 +1525,7 @@ const MinimumLogLevel$1 = /*#__PURE__*/ Reference("effect/References/MinimumLogL
|
|
|
1527
1525
|
/** @internal */
|
|
1528
1526
|
const CurrentLogSpans = /*#__PURE__*/ Reference("effect/References/CurrentLogSpans", { defaultValue: () => [] });
|
|
1529
1527
|
//#endregion
|
|
1530
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
1528
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/effect.js
|
|
1531
1529
|
/** @internal */
|
|
1532
1530
|
var Interrupt = class extends ReasonBase {
|
|
1533
1531
|
constructor(fiberId, annotations = constEmptyAnnotations) {
|
|
@@ -1547,7 +1545,7 @@ var Interrupt = class extends ReasonBase {
|
|
|
1547
1545
|
return isInterruptReason(that) && this.fiberId === that.fiberId && this.annotations === that.annotations;
|
|
1548
1546
|
}
|
|
1549
1547
|
[symbol$1]() {
|
|
1550
|
-
return
|
|
1548
|
+
return string$1(`${this._tag}:${this.fiberId}`);
|
|
1551
1549
|
}
|
|
1552
1550
|
};
|
|
1553
1551
|
/** @internal */
|
|
@@ -1771,7 +1769,7 @@ var FiberImpl = class {
|
|
|
1771
1769
|
let cause = causeInterrupt(fiberId);
|
|
1772
1770
|
if (this.cache.stackFrame) cause = causeAnnotate(cause, make$26(StackTraceKey, this.cache.stackFrame));
|
|
1773
1771
|
if (annotations) cause = causeAnnotate(cause, annotations);
|
|
1774
|
-
this._interruptedCause = this._interruptedCause ?
|
|
1772
|
+
this._interruptedCause = this._interruptedCause ? causeAddInterrupts(this._interruptedCause, cause) : cause;
|
|
1775
1773
|
if (this.interruptible) {
|
|
1776
1774
|
if (this._running) this._deferredInterrupt = true;
|
|
1777
1775
|
else this.evaluate(failCause$3(this._interruptedCause));
|
|
@@ -2021,7 +2019,7 @@ const suspend$3 = /*#__PURE__*/ makePrimitive$1({
|
|
|
2021
2019
|
}
|
|
2022
2020
|
});
|
|
2023
2021
|
/** @internal */
|
|
2024
|
-
const fromResult$1 = /*#__PURE__*/ match$
|
|
2022
|
+
const fromResult$1 = /*#__PURE__*/ match$4({
|
|
2025
2023
|
onFailure: fail$4,
|
|
2026
2024
|
onSuccess: succeed$5
|
|
2027
2025
|
});
|
|
@@ -2495,7 +2493,7 @@ const matchEffect$2 = /*#__PURE__*/ dual(2, (self, options) => matchCauseEffect$
|
|
|
2495
2493
|
onSuccess: options.onSuccess
|
|
2496
2494
|
}));
|
|
2497
2495
|
/** @internal */
|
|
2498
|
-
const match$
|
|
2496
|
+
const match$2 = /*#__PURE__*/ dual(2, (self, options) => new MatchImpl(self, options));
|
|
2499
2497
|
/** @internal */
|
|
2500
2498
|
const matchEager = /*#__PURE__*/ dual(2, (self, options) => {
|
|
2501
2499
|
if (effectIsExit(self)) {
|
|
@@ -2504,7 +2502,7 @@ const matchEager = /*#__PURE__*/ dual(2, (self, options) => {
|
|
|
2504
2502
|
if (isFailure$1(error)) return self;
|
|
2505
2503
|
return exitSucceed(options.onFailure(error.success));
|
|
2506
2504
|
}
|
|
2507
|
-
return match$
|
|
2505
|
+
return match$2(self, options);
|
|
2508
2506
|
});
|
|
2509
2507
|
/** @internal */
|
|
2510
2508
|
const exit$1 = (self) => effectIsExit(self) ? exitSucceed(self) : exitPrimitive(self);
|
|
@@ -3338,7 +3336,7 @@ const tracerLogger = /*#__PURE__*/ loggerMake(({ cause, fiber, logLevel, message
|
|
|
3338
3336
|
span.event(toStringUnknown(Array.isArray(message) && message.length === 1 ? message[0] : message), clock.currentTimeNanosUnsafe(), attributes);
|
|
3339
3337
|
});
|
|
3340
3338
|
//#endregion
|
|
3341
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
3339
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Cause.js
|
|
3342
3340
|
/**
|
|
3343
3341
|
* Narrows a `Reason` to `Fail`.
|
|
3344
3342
|
*
|
|
@@ -3728,7 +3726,7 @@ const UnknownError = UnknownError$1;
|
|
|
3728
3726
|
*/
|
|
3729
3727
|
const reasonAnnotations = reasonAnnotations$1;
|
|
3730
3728
|
//#endregion
|
|
3731
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
3729
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Exit.js
|
|
3732
3730
|
/**
|
|
3733
3731
|
* Creates a successful Exit containing the given value.
|
|
3734
3732
|
*
|
|
@@ -4005,7 +4003,7 @@ const doneUnsafe = (self, effect) => {
|
|
|
4005
4003
|
return true;
|
|
4006
4004
|
};
|
|
4007
4005
|
//#endregion
|
|
4008
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
4006
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/References.js
|
|
4009
4007
|
/**
|
|
4010
4008
|
* Context reference for setting the minimum log level threshold. Log entries below this
|
|
4011
4009
|
* level will be filtered out completely.
|
|
@@ -4043,7 +4041,7 @@ const doneUnsafe = (self, effect) => {
|
|
|
4043
4041
|
*/
|
|
4044
4042
|
const MinimumLogLevel = MinimumLogLevel$1;
|
|
4045
4043
|
//#endregion
|
|
4046
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
4044
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Scope.js
|
|
4047
4045
|
/**
|
|
4048
4046
|
* Controls how long resources stay open.
|
|
4049
4047
|
*
|
|
@@ -4299,8 +4297,8 @@ const forkUnsafe = scopeForkUnsafe;
|
|
|
4299
4297
|
*/
|
|
4300
4298
|
const close = scopeClose;
|
|
4301
4299
|
//#endregion
|
|
4302
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
4303
|
-
const TypeId$
|
|
4300
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Layer.js
|
|
4301
|
+
const TypeId$31 = "~effect/Layer";
|
|
4304
4302
|
const MemoMapTypeId = "~effect/Layer/MemoMap";
|
|
4305
4303
|
const makeMemoMapEntry = (memoMap, layer) => {
|
|
4306
4304
|
const entry = {
|
|
@@ -4322,7 +4320,7 @@ const memoMapObserve = (entry, scope) => {
|
|
|
4322
4320
|
return true;
|
|
4323
4321
|
};
|
|
4324
4322
|
const LayerProto = {
|
|
4325
|
-
[TypeId$
|
|
4323
|
+
[TypeId$31]: {
|
|
4326
4324
|
_ROut: identity,
|
|
4327
4325
|
_E: identity,
|
|
4328
4326
|
_RIn: identity
|
|
@@ -4946,13 +4944,13 @@ const provideWith = (self, that, f) => fromBuild((memoMap, scope) => flatMap$2(A
|
|
|
4946
4944
|
*/
|
|
4947
4945
|
const provideMerge = /*#__PURE__*/ dual(2, (self, that) => provideWith(self, that, (self, that) => merge$2(that, self)));
|
|
4948
4946
|
//#endregion
|
|
4949
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
4947
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/dateTime.js
|
|
4950
4948
|
/** @internal */
|
|
4951
|
-
const TypeId$
|
|
4949
|
+
const TypeId$30 = "~effect/DateTime";
|
|
4952
4950
|
/** @internal */
|
|
4953
4951
|
const TimeZoneTypeId = "~effect/DateTime/TimeZone";
|
|
4954
|
-
const Proto$
|
|
4955
|
-
[TypeId$
|
|
4952
|
+
const Proto$10 = {
|
|
4953
|
+
[TypeId$30]: TypeId$30,
|
|
4956
4954
|
pipe() {
|
|
4957
4955
|
return pipeArguments(this, arguments);
|
|
4958
4956
|
},
|
|
@@ -4963,8 +4961,8 @@ const Proto$9 = {
|
|
|
4963
4961
|
return toDateUtc$1(this).toJSON();
|
|
4964
4962
|
}
|
|
4965
4963
|
};
|
|
4966
|
-
({ ...Proto$
|
|
4967
|
-
({ ...Proto$
|
|
4964
|
+
({ ...Proto$10 });
|
|
4965
|
+
({ ...Proto$10 });
|
|
4968
4966
|
const ProtoTimeZone = {
|
|
4969
4967
|
[TimeZoneTypeId]: TimeZoneTypeId,
|
|
4970
4968
|
[NodeInspectSymbol]() {
|
|
@@ -5001,7 +4999,7 @@ const round = /*#__PURE__*/ dual(2, (self, precision) => {
|
|
|
5001
4999
|
return Math.round(self * factor) / factor;
|
|
5002
5000
|
});
|
|
5003
5001
|
//#endregion
|
|
5004
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
5002
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/random.js
|
|
5005
5003
|
/** @internal */
|
|
5006
5004
|
const nextBetween = (min, max, draw) => {
|
|
5007
5005
|
const value = draw * (max - min) + min;
|
|
@@ -5014,7 +5012,7 @@ const nextBetween = (min, max, draw) => {
|
|
|
5014
5012
|
return view.getFloat64(0);
|
|
5015
5013
|
};
|
|
5016
5014
|
//#endregion
|
|
5017
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
5015
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Pull.js
|
|
5018
5016
|
/**
|
|
5019
5017
|
* Models one low-level pull step for stream-like consumers.
|
|
5020
5018
|
*
|
|
@@ -5192,12 +5190,12 @@ const matchEffect$1 = /*#__PURE__*/ dual(2, (self, options) => matchCauseEffect$
|
|
|
5192
5190
|
}
|
|
5193
5191
|
}));
|
|
5194
5192
|
//#endregion
|
|
5195
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
5193
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/layer.js
|
|
5196
5194
|
const provideLayer = (self, layer, options) => scopedWith$1((scope) => flatMap$2(options?.local ? buildWithMemoMap(layer, makeMemoMapUnsafe(), scope) : buildWithScope(layer, scope), (context) => provideContext$1(self, context)));
|
|
5197
5195
|
/** @internal */
|
|
5198
5196
|
const provide$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, source, options) => isContext(source) ? provideContext$1(self, source) : provideLayer(self, Array.isArray(source) ? mergeAll(...source) : source, options));
|
|
5199
5197
|
//#endregion
|
|
5200
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
5198
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Effect.js
|
|
5201
5199
|
/**
|
|
5202
5200
|
* Checks whether a value is an `Effect`.
|
|
5203
5201
|
*
|
|
@@ -6764,7 +6762,7 @@ const raceFirst = raceFirst$1;
|
|
|
6764
6762
|
* @category pattern matching
|
|
6765
6763
|
* @since 2.0.0
|
|
6766
6764
|
*/
|
|
6767
|
-
const match = match$
|
|
6765
|
+
const match$1 = match$2;
|
|
6768
6766
|
/**
|
|
6769
6767
|
* Handles failures with access to the cause and allows performing side effects.
|
|
6770
6768
|
*
|
|
@@ -8094,7 +8092,7 @@ const catchEager = catchEager$1;
|
|
|
8094
8092
|
*/
|
|
8095
8093
|
const fnUntracedEager = fnUntracedEager$1;
|
|
8096
8094
|
//#endregion
|
|
8097
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
8095
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/BigDecimal.js
|
|
8098
8096
|
/**
|
|
8099
8097
|
* Decimal numbers and arithmetic for cases where JavaScript `number` rounding
|
|
8100
8098
|
* is not precise enough. A `BigDecimal` stores digits as a `bigint` plus a
|
|
@@ -8105,9 +8103,9 @@ const fnUntracedEager = fnUntracedEager$1;
|
|
|
8105
8103
|
* @stability stable
|
|
8106
8104
|
* @since 2.0.0
|
|
8107
8105
|
*/
|
|
8108
|
-
const TypeId$
|
|
8106
|
+
const TypeId$29 = "~effect/BigDecimal";
|
|
8109
8107
|
const BigDecimalProto = {
|
|
8110
|
-
[TypeId$
|
|
8108
|
+
[TypeId$29]: TypeId$29,
|
|
8111
8109
|
[symbol$1]() {
|
|
8112
8110
|
const normalized = normalize(this);
|
|
8113
8111
|
return combine$1(string$1(String(normalized.value)), number$1(normalized.scale));
|
|
@@ -8155,7 +8153,7 @@ const BigDecimalProto = {
|
|
|
8155
8153
|
* @category guards
|
|
8156
8154
|
* @since 2.0.0
|
|
8157
8155
|
*/
|
|
8158
|
-
const isBigDecimal = (u) => hasProperty(u, TypeId$
|
|
8156
|
+
const isBigDecimal = (u) => hasProperty(u, TypeId$29);
|
|
8159
8157
|
/**
|
|
8160
8158
|
* Creates a `BigDecimal` from a `bigint` value and a safe integer scale.
|
|
8161
8159
|
*
|
|
@@ -8379,7 +8377,7 @@ const toExponential = (n) => {
|
|
|
8379
8377
|
*/
|
|
8380
8378
|
const isZero = (n) => n.value === bigint0$1;
|
|
8381
8379
|
//#endregion
|
|
8382
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
8380
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/BigInt.js
|
|
8383
8381
|
/**
|
|
8384
8382
|
* Exposes the global bigint constructor for JavaScript bigint coercion.
|
|
8385
8383
|
*
|
|
@@ -8444,7 +8442,7 @@ const toNumber = (b) => {
|
|
|
8444
8442
|
return some(Number(b));
|
|
8445
8443
|
};
|
|
8446
8444
|
//#endregion
|
|
8447
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
8445
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/ByteSize.js
|
|
8448
8446
|
const bigint0 = /*#__PURE__*/ BigInt(0);
|
|
8449
8447
|
const bigint1 = /*#__PURE__*/ BigInt(1);
|
|
8450
8448
|
const decimalBase = /*#__PURE__*/ BigInt(1e3);
|
|
@@ -8693,7 +8691,7 @@ codes[/*#__PURE__*/ "=".charCodeAt(0)] = 0;
|
|
|
8693
8691
|
({ ...BaseProto });
|
|
8694
8692
|
({ ...BaseProto });
|
|
8695
8693
|
//#endregion
|
|
8696
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
8694
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/redacted.js
|
|
8697
8695
|
/** @internal */
|
|
8698
8696
|
const redactedRegistry = /*#__PURE__*/ new WeakMap();
|
|
8699
8697
|
/** @internal */
|
|
@@ -8702,7 +8700,7 @@ const value$1 = (self) => {
|
|
|
8702
8700
|
else throw new Error("Unable to get redacted value" + (self.label ? ` with label: "${self.label}"` : ""));
|
|
8703
8701
|
};
|
|
8704
8702
|
//#endregion
|
|
8705
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
8703
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Redacted.js
|
|
8706
8704
|
/**
|
|
8707
8705
|
* Wraps sensitive values so normal output does not reveal them.
|
|
8708
8706
|
*
|
|
@@ -8716,7 +8714,7 @@ const value$1 = (self) => {
|
|
|
8716
8714
|
* @stability stable
|
|
8717
8715
|
* @since 3.3.0
|
|
8718
8716
|
*/
|
|
8719
|
-
const TypeId$
|
|
8717
|
+
const TypeId$27 = "~effect/Redacted";
|
|
8720
8718
|
/**
|
|
8721
8719
|
* Returns `true` if a value is a `Redacted` wrapper.
|
|
8722
8720
|
*
|
|
@@ -8745,7 +8743,7 @@ const TypeId$26 = "~effect/Redacted";
|
|
|
8745
8743
|
* @category guards
|
|
8746
8744
|
* @since 3.3.0
|
|
8747
8745
|
*/
|
|
8748
|
-
const isRedacted = (u) => hasProperty(u, TypeId$
|
|
8746
|
+
const isRedacted = (u) => hasProperty(u, TypeId$27);
|
|
8749
8747
|
/**
|
|
8750
8748
|
* Creates a `Redacted` wrapper for a sensitive value.
|
|
8751
8749
|
*
|
|
@@ -8774,13 +8772,13 @@ const isRedacted = (u) => hasProperty(u, TypeId$26);
|
|
|
8774
8772
|
* @since 3.3.0
|
|
8775
8773
|
*/
|
|
8776
8774
|
const make$20 = (value, options) => {
|
|
8777
|
-
const self = Object.create(Proto$
|
|
8775
|
+
const self = Object.create(Proto$8);
|
|
8778
8776
|
if (options?.label) self.label = options.label;
|
|
8779
8777
|
redactedRegistry.set(self, value);
|
|
8780
8778
|
return self;
|
|
8781
8779
|
};
|
|
8782
|
-
const Proto$
|
|
8783
|
-
[TypeId$
|
|
8780
|
+
const Proto$8 = {
|
|
8781
|
+
[TypeId$27]: { _A: (_) => _ },
|
|
8784
8782
|
label: void 0,
|
|
8785
8783
|
...PipeInspectableProto,
|
|
8786
8784
|
toJSON() {
|
|
@@ -8819,9 +8817,10 @@ const Proto$7 = {
|
|
|
8819
8817
|
* @since 3.3.0
|
|
8820
8818
|
*/
|
|
8821
8819
|
const value = value$1;
|
|
8820
|
+
BaseProto.toString, BaseProto[NodeInspectSymbol];
|
|
8822
8821
|
({ ...PipeInspectableProto });
|
|
8823
8822
|
//#endregion
|
|
8824
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
8823
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/schema/annotations.js
|
|
8825
8824
|
/** @internal */
|
|
8826
8825
|
function resolve$1(ast) {
|
|
8827
8826
|
return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
|
|
@@ -8837,7 +8836,7 @@ const getExpected = /*#__PURE__*/ memoize((ast) => {
|
|
|
8837
8836
|
return ast.getExpected(getExpected);
|
|
8838
8837
|
});
|
|
8839
8838
|
//#endregion
|
|
8840
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
8839
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/schema/parser.js
|
|
8841
8840
|
/** @internal */
|
|
8842
8841
|
const missing = /*#__PURE__*/ Symbol();
|
|
8843
8842
|
/** @internal */
|
|
@@ -8851,7 +8850,7 @@ const toOption = (value) => value === missing ? none() : some(value);
|
|
|
8851
8850
|
/** @internal */
|
|
8852
8851
|
const fromOptionExit = (option) => option._tag === "None" ? missingExit : succeed$1(option.value);
|
|
8853
8852
|
//#endregion
|
|
8854
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
8853
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/SchemaIssue.js
|
|
8855
8854
|
/**
|
|
8856
8855
|
* Describes problems found while decoding, encoding, or checking data with
|
|
8857
8856
|
* schemas.
|
|
@@ -9348,7 +9347,7 @@ function findMessage(issue) {
|
|
|
9348
9347
|
if (typeof message === "string") return message;
|
|
9349
9348
|
}
|
|
9350
9349
|
//#endregion
|
|
9351
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
9350
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/schema/cause.js
|
|
9352
9351
|
/** @internal */
|
|
9353
9352
|
function getSchemaIssue(cause) {
|
|
9354
9353
|
let issue;
|
|
@@ -9365,7 +9364,7 @@ function getSchemaIssueOrThrow(cause, message) {
|
|
|
9365
9364
|
return issue;
|
|
9366
9365
|
}
|
|
9367
9366
|
//#endregion
|
|
9368
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
9367
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/SchemaGetter.js
|
|
9369
9368
|
const makeGetter = (fields) => Object.assign(Object.create(Prototype$1), fields);
|
|
9370
9369
|
const passthrough_$1 = /*#__PURE__*/ makeGetter({ _tag: "Passthrough" });
|
|
9371
9370
|
function passthrough$1() {
|
|
@@ -9520,7 +9519,7 @@ function Number$4() {
|
|
|
9520
9519
|
return transform$2(globalThis.Number);
|
|
9521
9520
|
}
|
|
9522
9521
|
//#endregion
|
|
9523
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
9522
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/SchemaTransformation.js
|
|
9524
9523
|
/**
|
|
9525
9524
|
* Constructs schema middleware from its decode and encode functions.
|
|
9526
9525
|
*
|
|
@@ -9760,7 +9759,7 @@ const defectFromJson = (options) => transform$1({
|
|
|
9760
9759
|
encode: makeEncodeDefect(options)
|
|
9761
9760
|
});
|
|
9762
9761
|
//#endregion
|
|
9763
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
9762
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/SchemaAST.js
|
|
9764
9763
|
/**
|
|
9765
9764
|
* Represents Effect schemas as runtime trees.
|
|
9766
9765
|
*
|
|
@@ -10189,7 +10188,7 @@ const number = /*#__PURE__*/ new Number$3();
|
|
|
10189
10188
|
* @category constructors
|
|
10190
10189
|
* @since 4.0.0
|
|
10191
10190
|
*/
|
|
10192
|
-
const Boolean$
|
|
10191
|
+
const Boolean$5 = class extends ASTNodeImpl {
|
|
10193
10192
|
_tag = "Boolean";
|
|
10194
10193
|
/** @internal */
|
|
10195
10194
|
getParser() {
|
|
@@ -10215,7 +10214,7 @@ const Boolean$4 = class extends ASTNodeImpl {
|
|
|
10215
10214
|
* @category constructors
|
|
10216
10215
|
* @since 4.0.0
|
|
10217
10216
|
*/
|
|
10218
|
-
const boolean = /*#__PURE__*/ new Boolean$
|
|
10217
|
+
const boolean = /*#__PURE__*/ new Boolean$5();
|
|
10219
10218
|
/**
|
|
10220
10219
|
* Constructs a {@link Arrays}.
|
|
10221
10220
|
*
|
|
@@ -11231,7 +11230,7 @@ function getLastEncoding(ast) {
|
|
|
11231
11230
|
function annotate$1(ast, annotations) {
|
|
11232
11231
|
if (ast.checks) {
|
|
11233
11232
|
const last = ast.checks[ast.checks.length - 1];
|
|
11234
|
-
return replaceChecks(ast, append
|
|
11233
|
+
return replaceChecks(ast, append(ast.checks.slice(0, -1), last.annotate(annotations)));
|
|
11235
11234
|
}
|
|
11236
11235
|
return copy$1(ast, { annotations: {
|
|
11237
11236
|
...ast.annotations,
|
|
@@ -11257,7 +11256,7 @@ function updateLastLink(encoding, f) {
|
|
|
11257
11256
|
const links = encoding;
|
|
11258
11257
|
const last = links[links.length - 1];
|
|
11259
11258
|
const out = mapLink(last, f);
|
|
11260
|
-
return out === last ? encoding : append
|
|
11259
|
+
return out === last ? encoding : append(encoding.slice(0, encoding.length - 1), out);
|
|
11261
11260
|
}
|
|
11262
11261
|
/** @internal */
|
|
11263
11262
|
function applyToLastLink(f) {
|
|
@@ -11656,7 +11655,7 @@ const unknownToStringTree = /*#__PURE__*/ new Link(/* @__PURE__ */ new Declarati
|
|
|
11656
11655
|
toCodecStringTree: () => void 0
|
|
11657
11656
|
}), /*#__PURE__*/ passthrough());
|
|
11658
11657
|
//#endregion
|
|
11659
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
11658
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/schema/interpreter.js
|
|
11660
11659
|
const flatMapTransformation = (result, current, f) => result === sameExit ? f(current) : flatMapEager(result, f);
|
|
11661
11660
|
function compileTransformation(transformation) {
|
|
11662
11661
|
if (transformation._tag === "Middleware") return (result, current, options) => {
|
|
@@ -11791,7 +11790,7 @@ function compile(ast, compile, compileField, base, specialize) {
|
|
|
11791
11790
|
};
|
|
11792
11791
|
}
|
|
11793
11792
|
//#endregion
|
|
11794
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
11793
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/schema/compilerRegistry.js
|
|
11795
11794
|
/** @internal */
|
|
11796
11795
|
const invalid = /*#__PURE__*/ Symbol();
|
|
11797
11796
|
const cache = /*#__PURE__*/ new WeakMap();
|
|
@@ -11822,7 +11821,7 @@ function resolve(ast) {
|
|
|
11822
11821
|
return entry;
|
|
11823
11822
|
}
|
|
11824
11823
|
//#endregion
|
|
11825
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
11824
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/SchemaParser.js
|
|
11826
11825
|
/**
|
|
11827
11826
|
* Runs schemas against real values.
|
|
11828
11827
|
*
|
|
@@ -12057,7 +12056,7 @@ function makeConstructorSync(ast) {
|
|
|
12057
12056
|
const normalCompiler = (ast) => resolve(ast).parser;
|
|
12058
12057
|
const constructorCompiler = (ast) => resolve(ast).makeEffect;
|
|
12059
12058
|
//#endregion
|
|
12060
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
12059
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/schema/make.js
|
|
12061
12060
|
/** @internal */
|
|
12062
12061
|
const TypeId$21 = "~effect/Schema/Schema";
|
|
12063
12062
|
const RebuildOptions = /*#__PURE__*/ Symbol();
|
|
@@ -12114,7 +12113,7 @@ function make$17(ast, options) {
|
|
|
12114
12113
|
return self;
|
|
12115
12114
|
}
|
|
12116
12115
|
//#endregion
|
|
12117
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
12116
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/schema/toCodec.js
|
|
12118
12117
|
function withoutConstructorDefault(context) {
|
|
12119
12118
|
return context.constructorDefault === void 0 ? context : new Context(context.isOptional, context.isMutable, void 0, context.annotations);
|
|
12120
12119
|
}
|
|
@@ -12194,7 +12193,7 @@ const toCodecStringTreeAST = /*#__PURE__*/ applyToSelfOrLastLinkEncodingIdempote
|
|
|
12194
12193
|
return out;
|
|
12195
12194
|
}, { stopAt: isCodecArrayFromSingleLink });
|
|
12196
12195
|
//#endregion
|
|
12197
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
12196
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Struct.js
|
|
12198
12197
|
/**
|
|
12199
12198
|
* Wraps a plain function as a {@link Lambda} value so it can be used with
|
|
12200
12199
|
* {@link map}, {@link mapPick}, and {@link mapOmit}.
|
|
@@ -12234,7 +12233,7 @@ const toCodecStringTreeAST = /*#__PURE__*/ applyToSelfOrLastLinkEncodingIdempote
|
|
|
12234
12233
|
*/
|
|
12235
12234
|
const lambda = (f) => f;
|
|
12236
12235
|
//#endregion
|
|
12237
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
12236
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/schemaError.js
|
|
12238
12237
|
const SchemaErrorTypeId = "~effect/Schema/SchemaError";
|
|
12239
12238
|
({ ...BaseProto });
|
|
12240
12239
|
({ ...BaseProto });
|
|
@@ -12245,7 +12244,7 @@ const SchemaErrorTypeId = "~effect/Schema/SchemaError";
|
|
|
12245
12244
|
({ ...BaseProto });
|
|
12246
12245
|
({ ...BaseProto });
|
|
12247
12246
|
//#endregion
|
|
12248
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
12247
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Schema.js
|
|
12249
12248
|
const TypeId$18 = TypeId$21;
|
|
12250
12249
|
/**
|
|
12251
12250
|
* Error thrown or returned when schema decoding or encoding fails.
|
|
@@ -12542,7 +12541,7 @@ const String$3 = /*#__PURE__*/ make$16(string);
|
|
|
12542
12541
|
* @category schemas
|
|
12543
12542
|
* @since 4.0.0
|
|
12544
12543
|
*/
|
|
12545
|
-
const Boolean$
|
|
12544
|
+
const Boolean$4 = /*#__PURE__*/ make$16(boolean);
|
|
12546
12545
|
function makeStruct(ast, fields) {
|
|
12547
12546
|
return make$16(ast, {
|
|
12548
12547
|
fields,
|
|
@@ -12698,7 +12697,7 @@ const FalseLiterals = /*#__PURE__*/ Literals([
|
|
|
12698
12697
|
"n"
|
|
12699
12698
|
]);
|
|
12700
12699
|
/** @internal */
|
|
12701
|
-
const BooleanLiterals = /*#__PURE__*/ Literals([...TrueLiterals.literals, ...FalseLiterals.literals]).pipe(/*#__PURE__*/ decodeTo(Boolean$
|
|
12700
|
+
const BooleanLiterals = /*#__PURE__*/ Literals([...TrueLiterals.literals, ...FalseLiterals.literals]).pipe(/*#__PURE__*/ decodeTo(Boolean$4, /*#__PURE__*/ transform$1({
|
|
12702
12701
|
decode: (value) => value === "true" || value === "yes" || value === "on" || value === "1" || value === "y",
|
|
12703
12702
|
encode: (value) => value ? "true" : "false"
|
|
12704
12703
|
})));
|
|
@@ -13096,8 +13095,32 @@ const Json = /*#__PURE__*/ make$16(/*#__PURE__*/ annotate$1(Json$1, { toCode: ()
|
|
|
13096
13095
|
runtime: "Schema.Json",
|
|
13097
13096
|
Type: "Schema.Json"
|
|
13098
13097
|
}) }));
|
|
13098
|
+
globalThis.Boolean;
|
|
13099
|
+
/**
|
|
13100
|
+
* Chooses between two lazy branches based on a boolean value.
|
|
13101
|
+
*
|
|
13102
|
+
* **When to use**
|
|
13103
|
+
*
|
|
13104
|
+
* Use to choose between two lazy branches based on a boolean value.
|
|
13105
|
+
*
|
|
13106
|
+
* **Example** (Pattern matching on booleans)
|
|
13107
|
+
*
|
|
13108
|
+
* ```ts import.meta.vitest
|
|
13109
|
+
* import { Boolean } from "effect"
|
|
13110
|
+
*
|
|
13111
|
+
* Boolean.match(true, {
|
|
13112
|
+
* onFalse: () => "It's false!",
|
|
13113
|
+
* onTrue: () => "It's true!"
|
|
13114
|
+
* }) // => "It's true!"
|
|
13115
|
+
* ```
|
|
13116
|
+
*
|
|
13117
|
+
* @stability stable
|
|
13118
|
+
* @category pattern matching
|
|
13119
|
+
* @since 2.0.0
|
|
13120
|
+
*/
|
|
13121
|
+
const match = /*#__PURE__*/ dual(2, (value, options) => value ? options.onTrue() : options.onFalse());
|
|
13099
13122
|
//#endregion
|
|
13100
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
13123
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Brand.js
|
|
13101
13124
|
/**
|
|
13102
13125
|
* Returns a `Constructor` that **does not apply any runtime checks** and just
|
|
13103
13126
|
* returns the provided value.
|
|
@@ -13122,7 +13145,7 @@ function nominal() {
|
|
|
13122
13145
|
});
|
|
13123
13146
|
}
|
|
13124
13147
|
//#endregion
|
|
13125
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
13148
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Fiber.js
|
|
13126
13149
|
/**
|
|
13127
13150
|
* Joins a fiber, blocking until it completes. If the fiber succeeds,
|
|
13128
13151
|
* returns its value. If it fails, the error is propagated.
|
|
@@ -13257,7 +13280,7 @@ const getCurrent = getCurrentFiber;
|
|
|
13257
13280
|
*/
|
|
13258
13281
|
const runIn = fiberRunIn;
|
|
13259
13282
|
//#endregion
|
|
13260
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
13283
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Latch.js
|
|
13261
13284
|
/**
|
|
13262
13285
|
* Creates a `Latch` synchronously, outside of `Effect`.
|
|
13263
13286
|
*
|
|
@@ -13295,222 +13318,7 @@ const runIn = fiberRunIn;
|
|
|
13295
13318
|
*/
|
|
13296
13319
|
const makeUnsafe = makeLatchUnsafe;
|
|
13297
13320
|
//#endregion
|
|
13298
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
13299
|
-
/**
|
|
13300
|
-
* Defines the unique symbol used to represent an empty result when taking elements from a MutableList.
|
|
13301
|
-
* This symbol is returned by `take` when the list is empty, allowing for safe type checking.
|
|
13302
|
-
*
|
|
13303
|
-
* **When to use**
|
|
13304
|
-
*
|
|
13305
|
-
* Use to detect that `take` returned no element before handling the result as a
|
|
13306
|
-
* list item.
|
|
13307
|
-
*
|
|
13308
|
-
* **Example** (Checking for empty results)
|
|
13309
|
-
*
|
|
13310
|
-
* ```ts import.meta.vitest
|
|
13311
|
-
* import { MutableList } from "effect"
|
|
13312
|
-
*
|
|
13313
|
-
* const list = MutableList.make<string>()
|
|
13314
|
-
*
|
|
13315
|
-
* MutableList.take(list) === MutableList.Empty // => true
|
|
13316
|
-
* ```
|
|
13317
|
-
*
|
|
13318
|
-
* @stability stable
|
|
13319
|
-
* @category symbols
|
|
13320
|
-
* @since 4.0.0
|
|
13321
|
-
*/
|
|
13322
|
-
const Empty = /*#__PURE__*/ Symbol.for("effect/MutableList/Empty");
|
|
13323
|
-
/**
|
|
13324
|
-
* Creates an empty MutableList.
|
|
13325
|
-
*
|
|
13326
|
-
* **Example** (Creating an empty mutable list)
|
|
13327
|
-
*
|
|
13328
|
-
* ```ts import.meta.vitest
|
|
13329
|
-
* import { MutableList } from "effect"
|
|
13330
|
-
*
|
|
13331
|
-
* const list = MutableList.make<string>()
|
|
13332
|
-
*
|
|
13333
|
-
* list.length // => 0
|
|
13334
|
-
* MutableList.append(list, "first")
|
|
13335
|
-
* MutableList.take(list) // => "first"
|
|
13336
|
-
* list.length // => 0
|
|
13337
|
-
* ```
|
|
13338
|
-
*
|
|
13339
|
-
* @stability stable
|
|
13340
|
-
* @category constructors
|
|
13341
|
-
* @since 2.0.0
|
|
13342
|
-
*/
|
|
13343
|
-
const make$15 = () => ({
|
|
13344
|
-
head: void 0,
|
|
13345
|
-
tail: void 0,
|
|
13346
|
-
length: 0
|
|
13347
|
-
});
|
|
13348
|
-
const compactHead = (self) => {
|
|
13349
|
-
const head = self.head;
|
|
13350
|
-
if (head.offset >= 1024 && head === self.tail && head.mutable && (head.array.length - head.offset) * 8 <= head.offset) self.head = self.tail = {
|
|
13351
|
-
array: head.array.slice(head.offset),
|
|
13352
|
-
mutable: true,
|
|
13353
|
-
offset: 0,
|
|
13354
|
-
next: void 0
|
|
13355
|
-
};
|
|
13356
|
-
};
|
|
13357
|
-
const emptyBucket = () => ({
|
|
13358
|
-
array: [],
|
|
13359
|
-
mutable: true,
|
|
13360
|
-
offset: 0,
|
|
13361
|
-
next: void 0
|
|
13362
|
-
});
|
|
13363
|
-
/**
|
|
13364
|
-
* Appends an element to the end of the MutableList.
|
|
13365
|
-
* This operation is optimized for high-frequency usage.
|
|
13366
|
-
*
|
|
13367
|
-
* **Example** (Appending elements)
|
|
13368
|
-
*
|
|
13369
|
-
* ```ts import.meta.vitest
|
|
13370
|
-
* import { MutableList } from "effect"
|
|
13371
|
-
*
|
|
13372
|
-
* const list = MutableList.make<number>()
|
|
13373
|
-
* MutableList.append(list, 1)
|
|
13374
|
-
* MutableList.append(list, 2)
|
|
13375
|
-
* MutableList.append(list, 3)
|
|
13376
|
-
*
|
|
13377
|
-
* MutableList.toArray(list) // => [1, 2, 3]
|
|
13378
|
-
* list.length // => 3
|
|
13379
|
-
* ```
|
|
13380
|
-
*
|
|
13381
|
-
* @stability stable
|
|
13382
|
-
* @category mutations
|
|
13383
|
-
* @since 2.0.0
|
|
13384
|
-
*/
|
|
13385
|
-
const append = (self, message) => {
|
|
13386
|
-
if (!self.tail) self.head = self.tail = emptyBucket();
|
|
13387
|
-
else if (!self.tail.mutable) {
|
|
13388
|
-
self.tail.next = emptyBucket();
|
|
13389
|
-
self.tail = self.tail.next;
|
|
13390
|
-
}
|
|
13391
|
-
self.tail.array.push(message);
|
|
13392
|
-
self.length++;
|
|
13393
|
-
};
|
|
13394
|
-
/**
|
|
13395
|
-
* Removes all elements from the MutableList, resetting it to an empty state.
|
|
13396
|
-
* This operation is highly optimized and releases all internal memory.
|
|
13397
|
-
*
|
|
13398
|
-
* **Example** (Clearing a mutable list)
|
|
13399
|
-
*
|
|
13400
|
-
* ```ts import.meta.vitest
|
|
13401
|
-
* import { MutableList } from "effect"
|
|
13402
|
-
*
|
|
13403
|
-
* const list = MutableList.make<number>()
|
|
13404
|
-
* MutableList.appendAll(list, [1, 2, 3, 4, 5])
|
|
13405
|
-
*
|
|
13406
|
-
* MutableList.clear(list)
|
|
13407
|
-
*
|
|
13408
|
-
* MutableList.toArray(list) // => []
|
|
13409
|
-
* list.length // => 0
|
|
13410
|
-
* MutableList.take(list) === MutableList.Empty // => true
|
|
13411
|
-
* ```
|
|
13412
|
-
*
|
|
13413
|
-
* @stability stable
|
|
13414
|
-
* @category mutations
|
|
13415
|
-
* @since 4.0.0
|
|
13416
|
-
*/
|
|
13417
|
-
const clear = (self) => {
|
|
13418
|
-
self.head = self.tail = void 0;
|
|
13419
|
-
self.length = 0;
|
|
13420
|
-
};
|
|
13421
|
-
/**
|
|
13422
|
-
* Takes up to N elements from the beginning of the MutableList and returns them as an array.
|
|
13423
|
-
* The taken elements are removed from the list. This operation is optimized for performance
|
|
13424
|
-
* and includes zero-copy optimizations when possible.
|
|
13425
|
-
*
|
|
13426
|
-
* **Details**
|
|
13427
|
-
*
|
|
13428
|
-
* Finite fractional values of `n` are rounded down. `NaN` and non-positive
|
|
13429
|
-
* values leave the list unchanged and return an empty array.
|
|
13430
|
-
*
|
|
13431
|
-
* **Example** (Taking batches)
|
|
13432
|
-
*
|
|
13433
|
-
* ```ts import.meta.vitest
|
|
13434
|
-
* import { MutableList } from "effect"
|
|
13435
|
-
*
|
|
13436
|
-
* const list = MutableList.make<number>()
|
|
13437
|
-
* MutableList.appendAll(list, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
|
|
13438
|
-
*
|
|
13439
|
-
* MutableList.takeN(list, 3) // => [1, 2, 3]
|
|
13440
|
-
* MutableList.toArray(list) // => [4, 5, 6, 7, 8, 9, 10]
|
|
13441
|
-
* list.length // => 7
|
|
13442
|
-
* ```
|
|
13443
|
-
*
|
|
13444
|
-
* @stability stable
|
|
13445
|
-
* @category mutations
|
|
13446
|
-
* @since 4.0.0
|
|
13447
|
-
*/
|
|
13448
|
-
const takeN = (self, n) => {
|
|
13449
|
-
n = normalize$1(n);
|
|
13450
|
-
if (n <= 0 || !self.head) return [];
|
|
13451
|
-
n = Math.min(n, self.length);
|
|
13452
|
-
if (n === self.length && self.head?.offset === 0 && !self.head.next) {
|
|
13453
|
-
const array = self.head.array;
|
|
13454
|
-
clear(self);
|
|
13455
|
-
return array;
|
|
13456
|
-
}
|
|
13457
|
-
const array = new Array(n);
|
|
13458
|
-
let index = 0;
|
|
13459
|
-
let chunk = self.head;
|
|
13460
|
-
while (chunk) {
|
|
13461
|
-
while (chunk.offset < chunk.array.length) {
|
|
13462
|
-
array[index++] = chunk.array[chunk.offset];
|
|
13463
|
-
if (chunk.mutable) chunk.array[chunk.offset] = void 0;
|
|
13464
|
-
chunk.offset++;
|
|
13465
|
-
if (index === n) {
|
|
13466
|
-
self.head = chunk.offset === chunk.array.length && chunk.next ? chunk.next : chunk;
|
|
13467
|
-
self.length -= n;
|
|
13468
|
-
if (self.length === 0) clear(self);
|
|
13469
|
-
else compactHead(self);
|
|
13470
|
-
return array;
|
|
13471
|
-
}
|
|
13472
|
-
}
|
|
13473
|
-
chunk = chunk.next;
|
|
13474
|
-
}
|
|
13475
|
-
clear(self);
|
|
13476
|
-
return array;
|
|
13477
|
-
};
|
|
13478
|
-
/**
|
|
13479
|
-
* Takes a single element from the beginning of the MutableList.
|
|
13480
|
-
* Returns the element if available, or the Empty symbol if the list is empty.
|
|
13481
|
-
* The taken element is removed from the list.
|
|
13482
|
-
*
|
|
13483
|
-
* **Example** (Taking one element)
|
|
13484
|
-
*
|
|
13485
|
-
* ```ts import.meta.vitest
|
|
13486
|
-
* import { MutableList } from "effect"
|
|
13487
|
-
*
|
|
13488
|
-
* const list = MutableList.make<string>()
|
|
13489
|
-
* MutableList.appendAll(list, ["first", "second", "third"])
|
|
13490
|
-
*
|
|
13491
|
-
* MutableList.take(list) // => "first"
|
|
13492
|
-
* MutableList.toArray(list) // => ["second", "third"]
|
|
13493
|
-
* list.length // => 2
|
|
13494
|
-
* ```
|
|
13495
|
-
*
|
|
13496
|
-
* @stability stable
|
|
13497
|
-
* @category mutations
|
|
13498
|
-
* @since 4.0.0
|
|
13499
|
-
*/
|
|
13500
|
-
const take$1 = (self) => {
|
|
13501
|
-
if (!self.head) return Empty;
|
|
13502
|
-
const message = self.head.array[self.head.offset];
|
|
13503
|
-
if (self.head.mutable) self.head.array[self.head.offset] = void 0;
|
|
13504
|
-
self.head.offset++;
|
|
13505
|
-
self.length--;
|
|
13506
|
-
if (self.head.offset === self.head.array.length) {
|
|
13507
|
-
if (self.head.next) self.head = self.head.next;
|
|
13508
|
-
else clear(self);
|
|
13509
|
-
} else compactHead(self);
|
|
13510
|
-
return message;
|
|
13511
|
-
};
|
|
13512
|
-
//#endregion
|
|
13513
|
-
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/Queue.js
|
|
13321
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Queue.js
|
|
13514
13322
|
const TypeId$17 = "~effect/Queue";
|
|
13515
13323
|
const EnqueueTypeId = "~effect/Queue/Enqueue";
|
|
13516
13324
|
const DequeueTypeId = "~effect/Queue/Dequeue";
|
|
@@ -13574,12 +13382,12 @@ const QueueProto = {
|
|
|
13574
13382
|
* @category constructors
|
|
13575
13383
|
* @since 4.0.0
|
|
13576
13384
|
*/
|
|
13577
|
-
const make$
|
|
13385
|
+
const make$15 = (options) => withFiber$1((fiber) => {
|
|
13578
13386
|
const self = Object.create(QueueProto);
|
|
13579
13387
|
self.dispatcher = fiber.currentDispatcher;
|
|
13580
13388
|
self.capacity = options?.capacity ?? Number.POSITIVE_INFINITY;
|
|
13581
13389
|
self.strategy = options?.strategy ?? "suspend";
|
|
13582
|
-
self.messages = make$
|
|
13390
|
+
self.messages = make$29();
|
|
13583
13391
|
self.scheduleRunning = false;
|
|
13584
13392
|
self.state = {
|
|
13585
13393
|
_tag: "Open",
|
|
@@ -13620,7 +13428,7 @@ const make$14 = (options) => withFiber$1((fiber) => {
|
|
|
13620
13428
|
* @category constructors
|
|
13621
13429
|
* @since 2.0.0
|
|
13622
13430
|
*/
|
|
13623
|
-
const bounded = (capacity) => make$
|
|
13431
|
+
const bounded = (capacity) => make$15({ capacity });
|
|
13624
13432
|
/**
|
|
13625
13433
|
* Adds a message to the queue. Returns `false` if the queue is done.
|
|
13626
13434
|
*
|
|
@@ -13698,16 +13506,16 @@ const offerUnsafe = (self, message) => {
|
|
|
13698
13506
|
else if (self.messages.length >= self.capacity) {
|
|
13699
13507
|
if (self.strategy === "sliding") {
|
|
13700
13508
|
take$1(self.messages);
|
|
13701
|
-
append(self.messages, message);
|
|
13509
|
+
append$1(self.messages, message);
|
|
13702
13510
|
return true;
|
|
13703
13511
|
} else if (self.capacity <= 0 && self.state.takers.size > 0) {
|
|
13704
|
-
append(self.messages, message);
|
|
13512
|
+
append$1(self.messages, message);
|
|
13705
13513
|
releaseTakers(self);
|
|
13706
13514
|
return true;
|
|
13707
13515
|
}
|
|
13708
13516
|
return false;
|
|
13709
13517
|
}
|
|
13710
|
-
append(self.messages, message);
|
|
13518
|
+
append$1(self.messages, message);
|
|
13711
13519
|
scheduleReleaseTaker(self);
|
|
13712
13520
|
return true;
|
|
13713
13521
|
};
|
|
@@ -14276,13 +14084,13 @@ const releaseCapacity = (self) => {
|
|
|
14276
14084
|
let n = self.capacity - self.messages.length;
|
|
14277
14085
|
if (n <= 0) break;
|
|
14278
14086
|
else if (entry._tag === "Single") {
|
|
14279
|
-
append(self.messages, entry.message);
|
|
14087
|
+
append$1(self.messages, entry.message);
|
|
14280
14088
|
self.state.offers.delete(entry);
|
|
14281
14089
|
entry.resume(exitTrue);
|
|
14282
14090
|
} else {
|
|
14283
14091
|
for (; entry.offset < entry.remaining.length; entry.offset++) {
|
|
14284
14092
|
if (n === 0) return false;
|
|
14285
|
-
append(self.messages, entry.remaining[entry.offset]);
|
|
14093
|
+
append$1(self.messages, entry.remaining[entry.offset]);
|
|
14286
14094
|
n--;
|
|
14287
14095
|
}
|
|
14288
14096
|
self.state.offers.delete(entry);
|
|
@@ -14306,7 +14114,7 @@ const finalize = (self, exit) => {
|
|
|
14306
14114
|
openState.awaiters.clear();
|
|
14307
14115
|
};
|
|
14308
14116
|
//#endregion
|
|
14309
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
14117
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Channel.js
|
|
14310
14118
|
/**
|
|
14311
14119
|
* Provides low-level building blocks for streaming data through Effect.
|
|
14312
14120
|
*
|
|
@@ -14472,7 +14280,7 @@ const fromTransformBracket = (f) => fromTransform$1(fnUntraced(function* (upstre
|
|
|
14472
14280
|
* @since 4.0.0
|
|
14473
14281
|
*/
|
|
14474
14282
|
const toTransform = (channel) => channel.transform;
|
|
14475
|
-
const asyncQueue = (scope, f, options) => make$
|
|
14283
|
+
const asyncQueue = (scope, f, options) => make$15({
|
|
14476
14284
|
capacity: options?.bufferSize,
|
|
14477
14285
|
strategy: options?.strategy
|
|
14478
14286
|
}).pipe(tap((queue) => addFinalizer$1(scope, shutdown(queue))), tap((queue) => provide$2(f(queue), scope).pipe(catchCause((cause) => failCause(queue, cause)), forkIn(scope))));
|
|
@@ -14606,7 +14414,7 @@ const mapDone = /*#__PURE__*/ dual(2, (self, f) => mapDoneEffect(self, (o) => su
|
|
|
14606
14414
|
* @category sequencing
|
|
14607
14415
|
* @since 4.0.0
|
|
14608
14416
|
*/
|
|
14609
|
-
const mapDoneEffect = /*#__PURE__*/ dual(2, (self, f) => transformPull$1(self, (pull) => succeed$2(catchDone(pull, (done$
|
|
14417
|
+
const mapDoneEffect = /*#__PURE__*/ dual(2, (self, f) => transformPull$1(self, (pull) => succeed$2(catchDone(pull, (done$14) => flatMap$1(f(done$14), done)))));
|
|
14610
14418
|
/**
|
|
14611
14419
|
* Returns a new channel, which is the merge of this channel and the specified
|
|
14612
14420
|
* channel.
|
|
@@ -14684,7 +14492,7 @@ const merge$1 = /*#__PURE__*/ dual((args) => isChannel(args[0]) && isChannel(arg
|
|
|
14684
14492
|
const splitLines$1 = () => fromTransform$1((upstream, _scope) => sync(() => {
|
|
14685
14493
|
let stringBuilder = "";
|
|
14686
14494
|
let midCRLF = false;
|
|
14687
|
-
let done$
|
|
14495
|
+
let done$13 = none();
|
|
14688
14496
|
function splitLinesArray(chunk) {
|
|
14689
14497
|
const chunkBuilder = [];
|
|
14690
14498
|
function pushLine(segment) {
|
|
@@ -14729,12 +14537,12 @@ const splitLines$1 = () => fromTransform$1((upstream, _scope) => sync(() => {
|
|
|
14729
14537
|
return isReadonlyArrayNonEmpty(chunkBuilder) ? chunkBuilder : null;
|
|
14730
14538
|
}
|
|
14731
14539
|
const pullOrFlush = suspend$2(() => {
|
|
14732
|
-
if (done$
|
|
14540
|
+
if (done$13._tag === "Some") return done(done$13.value);
|
|
14733
14541
|
return matchEffect$1(upstream, {
|
|
14734
14542
|
onSuccess: loop,
|
|
14735
14543
|
onFailure: failCause$1,
|
|
14736
14544
|
onDone: (leftover) => {
|
|
14737
|
-
done$
|
|
14545
|
+
done$13 = some(leftover);
|
|
14738
14546
|
if (stringBuilder.length > 0) {
|
|
14739
14547
|
const last = stringBuilder;
|
|
14740
14548
|
stringBuilder = "";
|
|
@@ -14886,7 +14694,7 @@ const runFold = /*#__PURE__*/ dual(3, (self, initial, f) => suspend$2(() => {
|
|
|
14886
14694
|
*/
|
|
14887
14695
|
const toPullScoped = (self, scope) => toTransform(self)(done(), scope);
|
|
14888
14696
|
//#endregion
|
|
14889
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
14697
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/PlatformError.js
|
|
14890
14698
|
/**
|
|
14891
14699
|
* Normalized errors for platform APIs.
|
|
14892
14700
|
*
|
|
@@ -15044,7 +14852,7 @@ const systemError = (options) => new PlatformError(new SystemError(options));
|
|
|
15044
14852
|
*/
|
|
15045
14853
|
const badArgument = (options) => new PlatformError(new BadArgument(options));
|
|
15046
14854
|
//#endregion
|
|
15047
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
14855
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/stream.js
|
|
15048
14856
|
const TypeId$14 = "~effect/Stream";
|
|
15049
14857
|
const streamVariance = {
|
|
15050
14858
|
_R: identity,
|
|
@@ -15063,7 +14871,7 @@ Stream.prototype = {
|
|
|
15063
14871
|
/** @internal */
|
|
15064
14872
|
const fromChannel$2 = (channel) => new Stream(channel);
|
|
15065
14873
|
//#endregion
|
|
15066
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
14874
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Sink.js
|
|
15067
14875
|
const TypeId$13 = "~effect/Sink";
|
|
15068
14876
|
const endVoid = /*#__PURE__*/ succeed$2([void 0]);
|
|
15069
14877
|
const sinkVariance = {
|
|
@@ -15254,7 +15062,7 @@ const forEachArray = (f) => fromTransform((upstream) => upstream.pipe(flatMap$1(
|
|
|
15254
15062
|
*/
|
|
15255
15063
|
const unwrap$1 = (effect) => fromChannel$1(unwrap$2(map$4(effect, toChannel$1)));
|
|
15256
15064
|
//#endregion
|
|
15257
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
15065
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/rcRef.js
|
|
15258
15066
|
const TypeId$12 = "~effect/RcRef";
|
|
15259
15067
|
const stateEmpty = { _tag: "Empty" };
|
|
15260
15068
|
const stateClosed = { _tag: "Closed" };
|
|
@@ -15280,7 +15088,7 @@ var RcRefImpl = class {
|
|
|
15280
15088
|
}
|
|
15281
15089
|
};
|
|
15282
15090
|
/** @internal */
|
|
15283
|
-
const make$
|
|
15091
|
+
const make$14 = (options) => withFiber((fiber) => {
|
|
15284
15092
|
const context = fiber.context;
|
|
15285
15093
|
const scope = get$2(context, Scope);
|
|
15286
15094
|
const ref = new RcRefImpl(options.acquire, context, scope, options.idleTimeToLive !== void 0 ? fromInputUnsafe$1(options.idleTimeToLive) : void 0);
|
|
@@ -15369,7 +15177,7 @@ const release = (self, state) => {
|
|
|
15369
15177
|
return void_;
|
|
15370
15178
|
};
|
|
15371
15179
|
//#endregion
|
|
15372
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
15180
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/RcRef.js
|
|
15373
15181
|
/**
|
|
15374
15182
|
* Creates an `RcRef` from an acquire effect.
|
|
15375
15183
|
*
|
|
@@ -15417,7 +15225,7 @@ const release = (self, state) => {
|
|
|
15417
15225
|
* @category constructors
|
|
15418
15226
|
* @since 3.5.0
|
|
15419
15227
|
*/
|
|
15420
|
-
const make$
|
|
15228
|
+
const make$13 = make$14;
|
|
15421
15229
|
/**
|
|
15422
15230
|
* Gets the value from an `RcRef`, acquiring it first if needed.
|
|
15423
15231
|
*
|
|
@@ -15465,7 +15273,7 @@ const make$12 = make$13;
|
|
|
15465
15273
|
*/
|
|
15466
15274
|
const get = get$1;
|
|
15467
15275
|
//#endregion
|
|
15468
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
15276
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Stream.js
|
|
15469
15277
|
/**
|
|
15470
15278
|
* Describes effectful sources that emit values over time.
|
|
15471
15279
|
*
|
|
@@ -15907,7 +15715,7 @@ const runCollect = (self) => runFold(self.channel, () => [], (acc, chunk) => {
|
|
|
15907
15715
|
*/
|
|
15908
15716
|
const mkString = (self) => runFold(self.channel, () => "", (acc, chunk) => acc + chunk.join(""));
|
|
15909
15717
|
//#endregion
|
|
15910
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
15718
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/FileSystem.js
|
|
15911
15719
|
/**
|
|
15912
15720
|
* Defines the portable file system service for Effect programs.
|
|
15913
15721
|
*
|
|
@@ -15987,7 +15795,7 @@ const FileSystem = /*#__PURE__*/ Service("effect/FileSystem");
|
|
|
15987
15795
|
* @category constructors
|
|
15988
15796
|
* @since 4.0.0
|
|
15989
15797
|
*/
|
|
15990
|
-
const make$
|
|
15798
|
+
const make$12 = (impl) => FileSystem.of({
|
|
15991
15799
|
...impl,
|
|
15992
15800
|
[TypeId$10]: TypeId$10,
|
|
15993
15801
|
exists: (path) => pipe(impl.access(path), as(true), catchTag("PlatformError", (e) => e.reason._tag === "NotFound" ? succeed$2(false) : fail$1(e))),
|
|
@@ -16011,7 +15819,7 @@ const make$11 = (impl) => FileSystem.of({
|
|
|
16011
15819
|
return fromPull(succeed$2(flatMap$1(suspend$2(() => {
|
|
16012
15820
|
if (bytesToRead !== void 0 && bytesToRead <= totalBytesRead) return done();
|
|
16013
15821
|
return bytesToRead !== void 0 && bytesToRead - totalBytesRead < chunkSize ? file.readAlloc(Number(bytesToRead - totalBytesRead)) : readChunk;
|
|
16014
|
-
}), match$
|
|
15822
|
+
}), match$5({
|
|
16015
15823
|
onNone: () => done(),
|
|
16016
15824
|
onSome: (buf) => {
|
|
16017
15825
|
totalBytesRead += BigInt(buf.length);
|
|
@@ -16093,7 +15901,7 @@ const FileTypeId = "~effect/FileSystem/File";
|
|
|
16093
15901
|
*/
|
|
16094
15902
|
var WatchBackend = class extends (/*#__PURE__*/ Service()("effect/FileSystem/WatchBackend")) {};
|
|
16095
15903
|
//#endregion
|
|
16096
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
15904
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Path.js
|
|
16097
15905
|
/**
|
|
16098
15906
|
* Provides path operations through the Effect environment.
|
|
16099
15907
|
*
|
|
@@ -16135,8 +15943,7 @@ const TypeId$9 = "~effect/Path";
|
|
|
16135
15943
|
* import { Effect, Layer, Path } from "effect"
|
|
16136
15944
|
*
|
|
16137
15945
|
* // Create a custom path implementation
|
|
16138
|
-
* const customPath
|
|
16139
|
-
* [Path.TypeId]: Path.TypeId,
|
|
15946
|
+
* const customPath = Path.make({
|
|
16140
15947
|
* sep: "/",
|
|
16141
15948
|
* basename: (path: string, suffix?: string) => {
|
|
16142
15949
|
* const base = path.split("/").pop() || ""
|
|
@@ -16170,7 +15977,7 @@ const TypeId$9 = "~effect/Path";
|
|
|
16170
15977
|
* resolve: (...pathSegments: ReadonlyArray<string>) => pathSegments.join("/"),
|
|
16171
15978
|
* toFileUrl: (path: string) => Effect.succeed(new URL(`file://${path}`)),
|
|
16172
15979
|
* toNamespacedPath: (path: string) => path
|
|
16173
|
-
* }
|
|
15980
|
+
* })
|
|
16174
15981
|
*
|
|
16175
15982
|
* // Provide the path service
|
|
16176
15983
|
* const customPathLayer = Layer.succeed(Path.Path)(customPath)
|
|
@@ -16189,8 +15996,40 @@ const TypeId$9 = "~effect/Path";
|
|
|
16189
15996
|
* @since 4.0.0
|
|
16190
15997
|
*/
|
|
16191
15998
|
const Path$1 = /*#__PURE__*/ Service("effect/Path");
|
|
15999
|
+
/**
|
|
16000
|
+
* Creates a `Path` service from platform path operations.
|
|
16001
|
+
*
|
|
16002
|
+
* **When to use**
|
|
16003
|
+
*
|
|
16004
|
+
* Use to build a `Path` implementation, such as a platform layer or a test
|
|
16005
|
+
* double, without implementing the operations that can be derived from the
|
|
16006
|
+
* others.
|
|
16007
|
+
*
|
|
16008
|
+
* **Details**
|
|
16009
|
+
*
|
|
16010
|
+
* Adds the `Path` type marker and derives `resolveWithin` from the provided
|
|
16011
|
+
* `parse`, `resolve`, `relative`, `isAbsolute`, and `sep`, so containment
|
|
16012
|
+
* follows the same platform rules as those operations.
|
|
16013
|
+
*
|
|
16014
|
+
* @see {@link layer} for the built-in POSIX `Path` service layer
|
|
16015
|
+
*
|
|
16016
|
+
* @stability unstable
|
|
16017
|
+
* @category constructors
|
|
16018
|
+
* @since 4.0.0
|
|
16019
|
+
*/
|
|
16020
|
+
const make$11 = (impl) => Path$1.of({
|
|
16021
|
+
...impl,
|
|
16022
|
+
[TypeId$9]: TypeId$9,
|
|
16023
|
+
resolveWithin(root, input) {
|
|
16024
|
+
if (impl.parse(input).root !== "") return none();
|
|
16025
|
+
const base = impl.resolve(root);
|
|
16026
|
+
const candidate = impl.resolve(base, input);
|
|
16027
|
+
const relative = impl.relative(base, candidate);
|
|
16028
|
+
return relative === ".." || relative.startsWith(`..${impl.sep}`) || impl.isAbsolute(relative) ? none() : some(candidate);
|
|
16029
|
+
}
|
|
16030
|
+
});
|
|
16192
16031
|
//#endregion
|
|
16193
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
16032
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/ConfigProvider.js
|
|
16194
16033
|
/**
|
|
16195
16034
|
* Data sources used by `Config` to load raw configuration values. A
|
|
16196
16035
|
* `ConfigProvider` reads paths from places such as environment variables,
|
|
@@ -16544,7 +16383,7 @@ function trieNodeAt(root, path) {
|
|
|
16544
16383
|
return node;
|
|
16545
16384
|
}
|
|
16546
16385
|
//#endregion
|
|
16547
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
16386
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Config.js
|
|
16548
16387
|
/**
|
|
16549
16388
|
* Descriptions of configuration values that can be read from a
|
|
16550
16389
|
* `ConfigProvider`. A `Config<T>` explains which keys to read, how to decode
|
|
@@ -16855,7 +16694,7 @@ function String$2(name) {
|
|
|
16855
16694
|
return schema(String$3, name);
|
|
16856
16695
|
}
|
|
16857
16696
|
//#endregion
|
|
16858
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
16697
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Console.js
|
|
16859
16698
|
/**
|
|
16860
16699
|
* Context reference for the current console service in the Effect system, allowing access to the active console implementation from within the Effect context.
|
|
16861
16700
|
*
|
|
@@ -16994,7 +16833,7 @@ const log = (...args) => consoleWith((console) => sync$1(() => {
|
|
|
16994
16833
|
console.log(...args);
|
|
16995
16834
|
}));
|
|
16996
16835
|
//#endregion
|
|
16997
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
16836
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/ulid.js
|
|
16998
16837
|
const maxTimestamp = 2 ** 48 - 1;
|
|
16999
16838
|
const base32Chars = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
17000
16839
|
/** @internal */
|
|
@@ -17017,7 +16856,7 @@ const ulidString = (timestampMillis, bytes) => {
|
|
|
17017
16856
|
return out;
|
|
17018
16857
|
};
|
|
17019
16858
|
//#endregion
|
|
17020
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
16859
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/uuid.js
|
|
17021
16860
|
const hex = (byte) => byte.toString(16).padStart(2, "0");
|
|
17022
16861
|
/** @internal */
|
|
17023
16862
|
const stringify = (bytes) => {
|
|
@@ -17051,7 +16890,7 @@ function v7Bytes(timestampMillis, bytes = randomBytes()) {
|
|
|
17051
16890
|
return bytes;
|
|
17052
16891
|
}
|
|
17053
16892
|
//#endregion
|
|
17054
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
16893
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Crypto.js
|
|
17055
16894
|
/**
|
|
17056
16895
|
* Defines a platform-independent service for cryptographic operations.
|
|
17057
16896
|
*
|
|
@@ -17181,7 +17020,7 @@ const validateSize = (method, size) => Number.isSafeInteger(size) && size >= 0 ?
|
|
|
17181
17020
|
description: "size must be a non-negative safe integer"
|
|
17182
17021
|
}));
|
|
17183
17022
|
//#endregion
|
|
17184
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
17023
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Runtime.js
|
|
17185
17024
|
/**
|
|
17186
17025
|
* Helpers for turning an `Effect` program into a host application's main entry
|
|
17187
17026
|
* point. This module is the low-level layer used by platform adapters to run a
|
|
@@ -17472,7 +17311,7 @@ const getErrorReported = (u) => {
|
|
|
17472
17311
|
return true;
|
|
17473
17312
|
};
|
|
17474
17313
|
//#endregion
|
|
17475
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
17314
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Stdio.js
|
|
17476
17315
|
/**
|
|
17477
17316
|
* Service contract for command-line arguments and standard input, output, and
|
|
17478
17317
|
* error output. It lets programs depend on standard I/O through the Effect
|
|
@@ -17545,7 +17384,7 @@ const make$7 = (options) => ({
|
|
|
17545
17384
|
...options
|
|
17546
17385
|
});
|
|
17547
17386
|
//#endregion
|
|
17548
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
17387
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Terminal.js
|
|
17549
17388
|
const TypeId$5 = "~effect/Terminal";
|
|
17550
17389
|
const QuitErrorTypeId = "~effect/Terminal/QuitError";
|
|
17551
17390
|
/**
|
|
@@ -17628,7 +17467,7 @@ const make$6 = (impl) => Terminal.of({
|
|
|
17628
17467
|
[TypeId$5]: TypeId$5
|
|
17629
17468
|
});
|
|
17630
17469
|
//#endregion
|
|
17631
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
17470
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/process/ChildProcessSpawner.js
|
|
17632
17471
|
/**
|
|
17633
17472
|
* Service boundary for starting and controlling child processes.
|
|
17634
17473
|
*
|
|
@@ -17706,7 +17545,7 @@ const make$5 = (spawn) => {
|
|
|
17706
17545
|
*/
|
|
17707
17546
|
var ChildProcessSpawner = class extends (/*#__PURE__*/ Service()("effect/process/ChildProcessSpawner")) {};
|
|
17708
17547
|
//#endregion
|
|
17709
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
17548
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/process/ChildProcess.js
|
|
17710
17549
|
/**
|
|
17711
17550
|
* Describes child processes before they are started.
|
|
17712
17551
|
*
|
|
@@ -17922,7 +17761,7 @@ const concatTokens = (prevTokens, nextTokens, isSeparated) => isSeparated || pre
|
|
|
17922
17761
|
...nextTokens.slice(1)
|
|
17923
17762
|
];
|
|
17924
17763
|
//#endregion
|
|
17925
|
-
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@4.0.
|
|
17764
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@4.0.5_effect@4.0.5/node_modules/@effect/platform-node-shared/dist/internal/nodeChildProcessSpawner.js
|
|
17926
17765
|
const buildSpawnOptions = (options, base, platform) => {
|
|
17927
17766
|
const detached = options.detached ?? platform !== "win32";
|
|
17928
17767
|
return {
|
|
@@ -17933,7 +17772,7 @@ const buildSpawnOptions = (options, base, platform) => {
|
|
|
17933
17772
|
};
|
|
17934
17773
|
};
|
|
17935
17774
|
//#endregion
|
|
17936
|
-
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@4.0.
|
|
17775
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@4.0.5_effect@4.0.5/node_modules/@effect/platform-node-shared/dist/internal/utils.js
|
|
17937
17776
|
/** @internal */
|
|
17938
17777
|
const handleErrnoException = (module, method) => (err, [path]) => {
|
|
17939
17778
|
let reason = "Unknown";
|
|
@@ -17968,7 +17807,7 @@ const handleErrnoException = (module, method) => (err, [path]) => {
|
|
|
17968
17807
|
});
|
|
17969
17808
|
};
|
|
17970
17809
|
//#endregion
|
|
17971
|
-
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@4.0.
|
|
17810
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@4.0.5_effect@4.0.5/node_modules/@effect/platform-node-shared/dist/NodeSink.js
|
|
17972
17811
|
/**
|
|
17973
17812
|
* Creates a `Sink` that writes chunks to a Node writable stream, respecting
|
|
17974
17813
|
* backpressure, mapping writable errors with `onError`, and ending the stream
|
|
@@ -18051,7 +17890,7 @@ const pullIntoWritable = (options) => options.pull.pipe(flatMap$1((chunk) => {
|
|
|
18051
17890
|
});
|
|
18052
17891
|
})));
|
|
18053
17892
|
//#endregion
|
|
18054
|
-
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@4.0.
|
|
17893
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@4.0.5_effect@4.0.5/node_modules/@effect/platform-node-shared/dist/NodeStream.js
|
|
18055
17894
|
/**
|
|
18056
17895
|
* Adapters between Node streams and Effect streams, channels, and readables.
|
|
18057
17896
|
*
|
|
@@ -18093,7 +17932,7 @@ const fromReadableChannel = (options) => fromTransform$1((_, scope) => readableT
|
|
|
18093
17932
|
const readableToPullUnsafe = (options) => {
|
|
18094
17933
|
const readable = options.readable;
|
|
18095
17934
|
const closeOnDone = options.closeOnDone ?? true;
|
|
18096
|
-
const exit = options.exit ?? make$
|
|
17935
|
+
const exit = options.exit ?? make$30(void 0);
|
|
18097
17936
|
const latch = options.latch ?? makeUnsafe(false);
|
|
18098
17937
|
function onReadable() {
|
|
18099
17938
|
latch.openUnsafe();
|
|
@@ -18134,7 +17973,7 @@ const readableToPullUnsafe = (options) => {
|
|
|
18134
17973
|
};
|
|
18135
17974
|
const defaultOnError = (error) => new UnknownError(error);
|
|
18136
17975
|
//#endregion
|
|
18137
|
-
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@4.0.
|
|
17976
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@4.0.5_effect@4.0.5/node_modules/@effect/platform-node-shared/dist/NodeChildProcessSpawner.js
|
|
18138
17977
|
const toError = (error) => error instanceof globalThis.Error ? error : new globalThis.Error(String(error));
|
|
18139
17978
|
const toPlatformError = (method, error, command) => {
|
|
18140
17979
|
const { commands } = flattenCommand(command);
|
|
@@ -18596,7 +18435,7 @@ const flattenCommand = (command) => {
|
|
|
18596
18435
|
};
|
|
18597
18436
|
};
|
|
18598
18437
|
//#endregion
|
|
18599
|
-
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@4.0.
|
|
18438
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@4.0.5_effect@4.0.5/node_modules/@effect/platform-node-shared/dist/NodeCrypto.js
|
|
18600
18439
|
/**
|
|
18601
18440
|
* Node-compatible implementation of Effect's `Crypto` service.
|
|
18602
18441
|
*
|
|
@@ -18627,7 +18466,7 @@ const digest = (algorithm, data) => try_({
|
|
|
18627
18466
|
})
|
|
18628
18467
|
});
|
|
18629
18468
|
//#endregion
|
|
18630
|
-
//#region ../../node_modules/.pnpm/@effect+platform-node@4.0.
|
|
18469
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node@4.0.5_effect@4.0.5_redis@6.3.0_@opentelemetry+api@1.9.1_/node_modules/@effect/platform-node/dist/NodeCrypto.js
|
|
18631
18470
|
/**
|
|
18632
18471
|
* The `NodeCrypto` module provides the Node.js `Crypto` service layer for
|
|
18633
18472
|
* Effect programs. Provide {@link layer} at the edge of a Node application,
|
|
@@ -18654,7 +18493,7 @@ const layer$9 = /* @__PURE__ */ succeed$3(Crypto, /* @__PURE__ */ make$8({
|
|
|
18654
18493
|
digest
|
|
18655
18494
|
}));
|
|
18656
18495
|
//#endregion
|
|
18657
|
-
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@4.0.
|
|
18496
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@4.0.5_effect@4.0.5/node_modules/@effect/platform-node-shared/dist/NodeFileSystem.js
|
|
18658
18497
|
/**
|
|
18659
18498
|
* Shared Node-compatible implementation of Effect's `FileSystem` service.
|
|
18660
18499
|
*
|
|
@@ -18678,6 +18517,8 @@ const bigintToNumber = (value, field) => {
|
|
|
18678
18517
|
return number;
|
|
18679
18518
|
};
|
|
18680
18519
|
const bigintToNumberOption = (value) => flatMap$4(fromNullishOr(value), toNumber);
|
|
18520
|
+
const toUint64 = (value) => BigInt.asUintN(64, value);
|
|
18521
|
+
const toUint64Option = (value) => map$10(fromNullishOr(value), toUint64);
|
|
18681
18522
|
const positionToNumber = (position, method) => try_({
|
|
18682
18523
|
try: () => bigintToNumber(position, "position"),
|
|
18683
18524
|
catch: handleBadArgument(method)
|
|
@@ -18952,16 +18793,16 @@ const makeFileInfo = (stat) => try_({
|
|
|
18952
18793
|
mtime: fromNullishOr(stat.mtime),
|
|
18953
18794
|
atime: fromNullishOr(stat.atime),
|
|
18954
18795
|
birthtime: fromNullishOr(stat.birthtime),
|
|
18955
|
-
dev:
|
|
18956
|
-
rdev:
|
|
18957
|
-
ino:
|
|
18796
|
+
dev: toUint64(stat.dev),
|
|
18797
|
+
rdev: toUint64Option(stat.rdev),
|
|
18798
|
+
ino: toUint64Option(stat.ino),
|
|
18958
18799
|
mode: bigintToNumber(stat.mode, "mode"),
|
|
18959
|
-
nlink:
|
|
18800
|
+
nlink: toUint64Option(stat.nlink),
|
|
18960
18801
|
uid: bigintToNumberOption(stat.uid),
|
|
18961
18802
|
gid: bigintToNumberOption(stat.gid),
|
|
18962
18803
|
size: bytes(stat.size),
|
|
18963
18804
|
blksize: stat.blksize !== void 0 ? some(bytes(stat.blksize)) : none(),
|
|
18964
|
-
blocks:
|
|
18805
|
+
blocks: fromNullishOr(stat.blocks)
|
|
18965
18806
|
}),
|
|
18966
18807
|
catch: handleBadArgument("stat")
|
|
18967
18808
|
});
|
|
@@ -19019,8 +18860,8 @@ const watchNode = (path, info, options) => callback((queue) => acquireRelease(sy
|
|
|
19019
18860
|
endUnsafe(queue);
|
|
19020
18861
|
});
|
|
19021
18862
|
return watcher;
|
|
19022
|
-
}), (watcher) => sync(() => watcher.close())));
|
|
19023
|
-
const watch = (backend, path, options) => stat(path).pipe(map$4((stat) => backend.pipe(flatMap$4((_) => _.register(path, stat, options)), getOrElse(() => watchNode(path, stat, options)))), unwrap);
|
|
18863
|
+
}), (watcher) => sync(() => watcher.close())).pipe(tap(() => sync(() => options?.onReady?.()))));
|
|
18864
|
+
const watch = (backend, path, options) => all([stat(path), serviceOption(WatchBackend)]).pipe(map$4(([stat, callerBackend]) => orElse(callerBackend, () => backend).pipe(flatMap$4((_) => _.register(path, stat, options)), getOrElse(() => watchNode(path, stat, options)))), unwrap);
|
|
19024
18865
|
const writeFile = (path, data, options) => callback$1((resume, signal) => {
|
|
19025
18866
|
try {
|
|
19026
18867
|
NFS.writeFile(path, data, {
|
|
@@ -19035,7 +18876,7 @@ const writeFile = (path, data, options) => callback$1((resume, signal) => {
|
|
|
19035
18876
|
resume(fail$1(handleBadArgument("writeFile")(err)));
|
|
19036
18877
|
}
|
|
19037
18878
|
});
|
|
19038
|
-
const makeFileSystem = /*#__PURE__*/ map$4(/*#__PURE__*/ serviceOption(WatchBackend), (backend) => make$
|
|
18879
|
+
const makeFileSystem = /*#__PURE__*/ map$4(/*#__PURE__*/ serviceOption(WatchBackend), (backend) => make$12({
|
|
19039
18880
|
access,
|
|
19040
18881
|
chmod,
|
|
19041
18882
|
chown,
|
|
@@ -19065,7 +18906,7 @@ const makeFileSystem = /*#__PURE__*/ map$4(/*#__PURE__*/ serviceOption(WatchBack
|
|
|
19065
18906
|
writeFile
|
|
19066
18907
|
}));
|
|
19067
18908
|
//#endregion
|
|
19068
|
-
//#region ../../node_modules/.pnpm/@effect+platform-node@4.0.
|
|
18909
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node@4.0.5_effect@4.0.5_redis@6.3.0_@opentelemetry+api@1.9.1_/node_modules/@effect/platform-node/dist/NodeFileSystem.js
|
|
19069
18910
|
/**
|
|
19070
18911
|
* Node.js `FileSystem` layer for programs that perform real filesystem I/O.
|
|
19071
18912
|
*
|
|
@@ -19086,7 +18927,7 @@ const makeFileSystem = /*#__PURE__*/ map$4(/*#__PURE__*/ serviceOption(WatchBack
|
|
|
19086
18927
|
*/
|
|
19087
18928
|
const layer$7 = /* @__PURE__ */ effect(FileSystem)(makeFileSystem);
|
|
19088
18929
|
//#endregion
|
|
19089
|
-
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@4.0.
|
|
18930
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@4.0.5_effect@4.0.5/node_modules/@effect/platform-node-shared/dist/NodePath.js
|
|
19090
18931
|
/**
|
|
19091
18932
|
* Node-backed provider for Effect's `Path` service.
|
|
19092
18933
|
*
|
|
@@ -19125,7 +18966,7 @@ const fileUrlOps = (windows) => ({
|
|
|
19125
18966
|
.../*#__PURE__*/ fileUrlOps(true)
|
|
19126
18967
|
});
|
|
19127
18968
|
//#endregion
|
|
19128
|
-
//#region ../../node_modules/.pnpm/@effect+platform-node@4.0.
|
|
18969
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node@4.0.5_effect@4.0.5_redis@6.3.0_@opentelemetry+api@1.9.1_/node_modules/@effect/platform-node/dist/NodePath.js
|
|
19129
18970
|
/**
|
|
19130
18971
|
* Node.js layers for Effect's `Path` service.
|
|
19131
18972
|
*
|
|
@@ -19145,13 +18986,12 @@ const fileUrlOps = (windows) => ({
|
|
|
19145
18986
|
* @category layers
|
|
19146
18987
|
* @since 4.0.0
|
|
19147
18988
|
*/
|
|
19148
|
-
const layer$5 = /* @__PURE__ */ succeed$3(Path$1)({
|
|
19149
|
-
[TypeId$9]: TypeId$9,
|
|
18989
|
+
const layer$5 = /* @__PURE__ */ succeed$3(Path$1)(/*#__PURE__*/ make$11({
|
|
19150
18990
|
...Path,
|
|
19151
18991
|
.../*#__PURE__*/ fileUrlOps(void 0)
|
|
19152
|
-
});
|
|
18992
|
+
}));
|
|
19153
18993
|
//#endregion
|
|
19154
|
-
//#region ../../node_modules/.pnpm/@effect+platform-node@4.0.
|
|
18994
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node@4.0.5_effect@4.0.5_redis@6.3.0_@opentelemetry+api@1.9.1_/node_modules/@effect/platform-node/dist/NodeStdio.js
|
|
19155
18995
|
/**
|
|
19156
18996
|
* Node.js `Stdio` layer for the current process.
|
|
19157
18997
|
*
|
|
@@ -19218,7 +19058,7 @@ const layer$3 = /* @__PURE__ */ succeed$3(Stdio, /*#__PURE__*/ make$7({
|
|
|
19218
19058
|
const layer$2 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit) {
|
|
19219
19059
|
const stdin = process.stdin;
|
|
19220
19060
|
const stdout = process.stdout;
|
|
19221
|
-
const lines = yield* make$
|
|
19061
|
+
const lines = yield* make$15();
|
|
19222
19062
|
let inputEnded = stdin.readableEnded;
|
|
19223
19063
|
let readlineActive = false;
|
|
19224
19064
|
const onStdinEnd = () => {
|
|
@@ -19227,7 +19067,7 @@ const layer$2 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fn
|
|
|
19227
19067
|
};
|
|
19228
19068
|
stdin.once("end", onStdinEnd);
|
|
19229
19069
|
yield* addFinalizer(() => sync(() => stdin.off("end", onStdinEnd)));
|
|
19230
|
-
const rlRef = yield* make$
|
|
19070
|
+
const rlRef = yield* make$13({
|
|
19231
19071
|
acquire: acquireRelease(sync(() => {
|
|
19232
19072
|
const rl = readline.createInterface({
|
|
19233
19073
|
input: stdin,
|
|
@@ -19261,7 +19101,7 @@ const layer$2 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fn
|
|
|
19261
19101
|
const columns = sync(() => stdout.columns ?? 0);
|
|
19262
19102
|
const rows = sync(() => stdout.rows ?? 0);
|
|
19263
19103
|
const readInput = gen(function* () {
|
|
19264
|
-
const queue = yield* make$
|
|
19104
|
+
const queue = yield* make$15();
|
|
19265
19105
|
const handleKeypress = (s, k) => {
|
|
19266
19106
|
const userInput = {
|
|
19267
19107
|
input: fromUndefinedOr(s),
|
|
@@ -19293,7 +19133,7 @@ const layer$2 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fn
|
|
|
19293
19133
|
}
|
|
19294
19134
|
return queue;
|
|
19295
19135
|
});
|
|
19296
|
-
const readLine = suspend$2(() => poll(lines).pipe(flatMap$1(match$
|
|
19136
|
+
const readLine = suspend$2(() => poll(lines).pipe(flatMap$1(match$5({
|
|
19297
19137
|
onNone: () => scoped(andThen(get(rlRef), take(lines))),
|
|
19298
19138
|
onSome: succeed$2
|
|
19299
19139
|
})), mapError(() => new QuitError({}))));
|
|
@@ -19318,7 +19158,7 @@ function defaultShouldQuit(input) {
|
|
|
19318
19158
|
return key.name === "escape" || key.ctrl && (key.name === "c" || key.name === "d");
|
|
19319
19159
|
}
|
|
19320
19160
|
//#endregion
|
|
19321
|
-
//#region ../../node_modules/.pnpm/@effect+platform-node@4.0.
|
|
19161
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node@4.0.5_effect@4.0.5_redis@6.3.0_@opentelemetry+api@1.9.1_/node_modules/@effect/platform-node/dist/NodeServices.js
|
|
19322
19162
|
/**
|
|
19323
19163
|
* Provides the default Node implementations for child process spawning,
|
|
19324
19164
|
* filesystem, path, stdio, and terminal services.
|
|
@@ -19329,7 +19169,7 @@ function defaultShouldQuit(input) {
|
|
|
19329
19169
|
*/
|
|
19330
19170
|
const layer = /*#__PURE__*/ provideMerge(layer$11, /*#__PURE__*/ mergeAll(layer$7, layer$9, layer$5, layer$3, layer$2));
|
|
19331
19171
|
//#endregion
|
|
19332
|
-
//#region ../../node_modules/.pnpm/@effect+platform-node@4.0.
|
|
19172
|
+
//#region ../../node_modules/.pnpm/@effect+platform-node@4.0.5_effect@4.0.5_redis@6.3.0_@opentelemetry+api@1.9.1_/node_modules/@effect/platform-node/dist/NodeRuntime.js
|
|
19333
19173
|
/**
|
|
19334
19174
|
* Node.js process runner for Effect programs.
|
|
19335
19175
|
*
|
|
@@ -19383,7 +19223,7 @@ const runMain = /* @__PURE__ */ makeRunMain(({ fiber, teardown }) => {
|
|
|
19383
19223
|
process.on("SIGTERM", onSigint);
|
|
19384
19224
|
});
|
|
19385
19225
|
//#endregion
|
|
19386
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
19226
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/CliError.js
|
|
19387
19227
|
/**
|
|
19388
19228
|
* Defines structured errors for the unstable CLI parser and runner.
|
|
19389
19229
|
*
|
|
@@ -19913,7 +19753,7 @@ var ShowHelp = class extends (/*#__PURE__*/ TaggedError(`${TypeId$3}/ShowHelp`)(
|
|
|
19913
19753
|
}
|
|
19914
19754
|
};
|
|
19915
19755
|
//#endregion
|
|
19916
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
19756
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/Primitive.js
|
|
19917
19757
|
/**
|
|
19918
19758
|
* Parses raw command-line strings into typed values.
|
|
19919
19759
|
*
|
|
@@ -20110,7 +19950,7 @@ const getChoiceKeys = (primitive) => primitive._tag === "Choice" ? primitive.cho
|
|
|
20110
19950
|
*/
|
|
20111
19951
|
const getPathType = (primitive) => primitive._tag === "Path" ? primitive.pathType : void 0;
|
|
20112
19952
|
//#endregion
|
|
20113
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
19953
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/internal/ansi.js
|
|
20114
19954
|
/**
|
|
20115
19955
|
* Internal ANSI escape sequence helpers used by the unstable CLI rendering
|
|
20116
19956
|
* implementation. This module centralizes the control codes for text styling,
|
|
@@ -20250,7 +20090,7 @@ const eraseLines = (rows) => {
|
|
|
20250
20090
|
return command;
|
|
20251
20091
|
};
|
|
20252
20092
|
//#endregion
|
|
20253
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
20093
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/Prompt.js
|
|
20254
20094
|
/**
|
|
20255
20095
|
* Builds interactive terminal prompts for CLI applications.
|
|
20256
20096
|
*
|
|
@@ -20797,7 +20637,7 @@ const handleDateClear = (options) => {
|
|
|
20797
20637
|
const resetCurrentLine = eraseLine + cursorLeft;
|
|
20798
20638
|
const parts = reduce(state.dateParts, "", (doc, part) => doc + part.toString());
|
|
20799
20639
|
const promptText = renderPrompt(parts, options.message, figures.prefix, figures.pointerSmall, figures, { plain: true });
|
|
20800
|
-
const errorText = isSome(state.error) ? match$
|
|
20640
|
+
const errorText = isSome(state.error) ? match$6(state.error.value.split(NEWLINE_REGEXP), {
|
|
20801
20641
|
onEmpty: () => "",
|
|
20802
20642
|
onNonEmpty: (errorLines) => separateSymbol(figures.pointerSmall, errorLines.join("\n"))
|
|
20803
20643
|
}) : "";
|
|
@@ -20875,7 +20715,7 @@ const processDateCursorRight = (state) => {
|
|
|
20875
20715
|
};
|
|
20876
20716
|
const processDateNext = (state) => {
|
|
20877
20717
|
const next = state.dateParts[state.cursor].nextPart();
|
|
20878
|
-
const cursor = match$
|
|
20718
|
+
const cursor = match$5(next, {
|
|
20879
20719
|
onNone: () => state.dateParts.findIndex((part) => !part.isToken()),
|
|
20880
20720
|
onSome: (next) => state.dateParts.indexOf(next)
|
|
20881
20721
|
});
|
|
@@ -20964,7 +20804,7 @@ const handleDateProcess = (options) => {
|
|
|
20964
20804
|
case "down": return succeed$2(processDown(state));
|
|
20965
20805
|
case "tab": return succeed$2(processDateNext(state));
|
|
20966
20806
|
case "enter":
|
|
20967
|
-
case "return": return match(options.validate(state.value), {
|
|
20807
|
+
case "return": return match$1(options.validate(state.value), {
|
|
20968
20808
|
onFailure: (error) => Action$1.NextFrame({ state: {
|
|
20969
20809
|
...state,
|
|
20970
20810
|
error: some(error)
|
|
@@ -21218,7 +21058,7 @@ const renderPrompt = (confirm, message, leadingSymbol, trailingSymbol, theme, op
|
|
|
21218
21058
|
else if (trailingSymbol.length > 0) output += " ";
|
|
21219
21059
|
return output;
|
|
21220
21060
|
};
|
|
21221
|
-
return match$
|
|
21061
|
+
return match$6(message.split(NEWLINE_REGEXP), {
|
|
21222
21062
|
onEmpty: () => renderLine(""),
|
|
21223
21063
|
onNonEmpty: (promptLines) => {
|
|
21224
21064
|
const lines = options?.plain === true ? promptLines : map$8(promptLines, (line) => annotate(theme.colors, line, bold));
|
|
@@ -21250,7 +21090,7 @@ const renderNumberInput = (state, submitted, theme, renderOptions) => {
|
|
|
21250
21090
|
return annotate(theme.colors, value, annotation);
|
|
21251
21091
|
};
|
|
21252
21092
|
const renderNumberError = (state, pointer, theme, renderOptions) => {
|
|
21253
|
-
if (isSome(state.error)) return match$
|
|
21093
|
+
if (isSome(state.error)) return match$6(state.error.value.split(NEWLINE_REGEXP), {
|
|
21254
21094
|
onEmpty: () => "",
|
|
21255
21095
|
onNonEmpty: (errorLines) => {
|
|
21256
21096
|
if (renderOptions?.plain === true) return separateSymbol(pointer, errorLines.join("\n"));
|
|
@@ -21355,7 +21195,7 @@ const handleProcessInteger = (options) => {
|
|
|
21355
21195
|
...state,
|
|
21356
21196
|
error: some("Must provide an integer value")
|
|
21357
21197
|
} }));
|
|
21358
|
-
else return match(options.validate(parsed), {
|
|
21198
|
+
else return match$1(options.validate(parsed), {
|
|
21359
21199
|
onFailure: (error) => Action$1.NextFrame({ state: {
|
|
21360
21200
|
...state,
|
|
21361
21201
|
error: some(error)
|
|
@@ -21400,7 +21240,7 @@ const handleProcessFloat = (options) => {
|
|
|
21400
21240
|
...state,
|
|
21401
21241
|
error: some("Must provide a floating point value")
|
|
21402
21242
|
} }));
|
|
21403
|
-
else return flatMap$1(sync(() => round(parsed, options.precision)), (rounded) => match(options.validate(rounded), {
|
|
21243
|
+
else return flatMap$1(sync(() => round(parsed, options.precision)), (rounded) => match$1(options.validate(rounded), {
|
|
21404
21244
|
onFailure: (error) => Action$1.NextFrame({ state: {
|
|
21405
21245
|
...state,
|
|
21406
21246
|
error: some(error)
|
|
@@ -21527,7 +21367,7 @@ const renderTextInput = (nextState, options, theme, submitted, renderOptions) =>
|
|
|
21527
21367
|
}
|
|
21528
21368
|
};
|
|
21529
21369
|
const renderTextError = (nextState, pointer, theme, renderOptions) => {
|
|
21530
|
-
if (isSome(nextState.error)) return match$
|
|
21370
|
+
if (isSome(nextState.error)) return match$6(nextState.error.value.split(NEWLINE_REGEXP), {
|
|
21531
21371
|
onEmpty: () => "",
|
|
21532
21372
|
onNonEmpty: (errorLines) => {
|
|
21533
21373
|
if (renderOptions?.plain === true) return separateSymbol(pointer, errorLines.join("\n"));
|
|
@@ -21651,7 +21491,7 @@ const handleTextProcess = (options) => {
|
|
|
21651
21491
|
case "enter":
|
|
21652
21492
|
case "return": {
|
|
21653
21493
|
const value = state.value;
|
|
21654
|
-
return match(options.validate(value), {
|
|
21494
|
+
return match$1(options.validate(value), {
|
|
21655
21495
|
onFailure: (error) => Action$1.NextFrame({ state: {
|
|
21656
21496
|
...state,
|
|
21657
21497
|
value,
|
|
@@ -21757,7 +21597,7 @@ const entriesToDisplay = (cursor, total, maxVisible) => {
|
|
|
21757
21597
|
};
|
|
21758
21598
|
};
|
|
21759
21599
|
//#endregion
|
|
21760
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
21600
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/Param.js
|
|
21761
21601
|
const TypeId$1 = "~effect/cli/Param";
|
|
21762
21602
|
/**
|
|
21763
21603
|
* Defines the kind discriminator for flag parameters.
|
|
@@ -22129,7 +21969,7 @@ const optional$1 = (param) => {
|
|
|
22129
21969
|
*/
|
|
22130
21970
|
const withDefault$1 = /*#__PURE__*/ dual(2, (self, defaultValue) => {
|
|
22131
21971
|
if (!isEffect(defaultValue)) return map(optional$1(self), getOrElse(() => defaultValue));
|
|
22132
|
-
return mapEffect(optional$1(self), match$
|
|
21972
|
+
return mapEffect(optional$1(self), match$5({
|
|
22133
21973
|
onNone: () => defaultValue,
|
|
22134
21974
|
onSome: succeed$2
|
|
22135
21975
|
}));
|
|
@@ -22372,7 +22212,7 @@ const getParamMetadata = (param) => {
|
|
|
22372
22212
|
});
|
|
22373
22213
|
};
|
|
22374
22214
|
//#endregion
|
|
22375
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
22215
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/CliOutput.js
|
|
22376
22216
|
/**
|
|
22377
22217
|
* Formats CLI help and errors as text.
|
|
22378
22218
|
*
|
|
@@ -22664,1475 +22504,1485 @@ const formatHelpDocImpl = (doc, colors) => {
|
|
|
22664
22504
|
return sections.join("\n");
|
|
22665
22505
|
};
|
|
22666
22506
|
//#endregion
|
|
22667
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
22668
|
-
const escapeForBash = (s) => s.replace(/'/g, "'\\''");
|
|
22669
|
-
const sanitizeFunctionName = (s) => s.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
22670
|
-
const flagNamesForWordlist = (flag) => {
|
|
22671
|
-
const names = [`--${flag.name}`];
|
|
22672
|
-
for (const alias of flag.aliases) names.push(alias.length === 1 ? `-${alias}` : `--${alias}`);
|
|
22673
|
-
if (flag.type._tag === "Boolean") names.push(`--no-${flag.name}`);
|
|
22674
|
-
return names;
|
|
22675
|
-
};
|
|
22676
|
-
/** Emit a Bash 3.2-compatible used-flag filter. */
|
|
22677
|
-
const buildFlagGroupDeclarations = (flags, lines) => {
|
|
22678
|
-
if (flags.length === 0) return;
|
|
22679
|
-
const groups = flags.map(flagNamesForWordlist);
|
|
22680
|
-
lines.push(` local ${groups.map((_, index) => `_used_${index}=""`).join(" ")}`);
|
|
22681
|
-
lines.push(` for ((i = 1; i < cword; i++)); do`);
|
|
22682
|
-
lines.push(` case "\${words[i]%%=*}" in`);
|
|
22683
|
-
groups.forEach((forms, index) => {
|
|
22684
|
-
lines.push(` ${forms.join("|")}) _used_${index}=1 ;;`);
|
|
22685
|
-
});
|
|
22686
|
-
lines.push(` esac`);
|
|
22687
|
-
lines.push(` done`);
|
|
22688
|
-
lines.push(` local _filtered_flags=""`);
|
|
22689
|
-
groups.forEach((forms, index) => {
|
|
22690
|
-
lines.push(` [[ -n "$_used_${index}" ]] || _filtered_flags+=" ${forms.join(" ")}"`);
|
|
22691
|
-
});
|
|
22692
|
-
lines.push(``);
|
|
22693
|
-
};
|
|
22507
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/internal/config.js
|
|
22694
22508
|
/**
|
|
22695
|
-
*
|
|
22696
|
-
*
|
|
22509
|
+
* Config Internal
|
|
22510
|
+
* ================
|
|
22697
22511
|
*
|
|
22698
|
-
*
|
|
22699
|
-
*
|
|
22512
|
+
* The processed internal representation of a Command.Config declaration.
|
|
22513
|
+
* Separates the user's declared config shape from the flat parsing representation.
|
|
22514
|
+
*
|
|
22515
|
+
* Key concepts:
|
|
22516
|
+
* - ConfigInternal: The full processed form (flags, arguments, tree)
|
|
22517
|
+
* - ConfigInternal.Tree: Maps declaration keys to nodes
|
|
22518
|
+
* - ConfigInternal.Node: Param reference, Array, or Nested subtree
|
|
22519
|
+
*
|
|
22520
|
+
* Example transformation from Command.Config to Command.Config.Internal:
|
|
22521
|
+
*
|
|
22522
|
+
* ```ts
|
|
22523
|
+
* // User declares:
|
|
22524
|
+
* const config = {
|
|
22525
|
+
* verbose: Flag.Boolean("verbose").pipe(Flag.withDefault(false)),
|
|
22526
|
+
* server: {
|
|
22527
|
+
* host: Flag.String("host"),
|
|
22528
|
+
* port: Flag.Int("port")
|
|
22529
|
+
* },
|
|
22530
|
+
* files: Argument.String("files").pipe(Argument.variadic)
|
|
22531
|
+
* }
|
|
22532
|
+
*
|
|
22533
|
+
* // Becomes Config.Internal:
|
|
22534
|
+
* {
|
|
22535
|
+
* arguments: [filesParam], // Flat array of arguments
|
|
22536
|
+
* flags: [verboseParam, hostParam, portParam], // Flat array of flags
|
|
22537
|
+
* orderedParams: [verboseParam, hostParam, portParam, filesParam],
|
|
22538
|
+
* tree: { // Preserves nested structure
|
|
22539
|
+
* verbose: { _tag: "Param", index: 0 },
|
|
22540
|
+
* server: {
|
|
22541
|
+
* _tag: "Nested",
|
|
22542
|
+
* tree: {
|
|
22543
|
+
* host: { _tag: "Param", index: 1 },
|
|
22544
|
+
* port: { _tag: "Param", index: 2 }
|
|
22545
|
+
* }
|
|
22546
|
+
* },
|
|
22547
|
+
* files: { _tag: "Param", index: 3 }
|
|
22548
|
+
* }
|
|
22549
|
+
* }
|
|
22550
|
+
* ```
|
|
22551
|
+
*
|
|
22552
|
+
* This separation allows:
|
|
22553
|
+
* 1. Flat iteration over all params for parsing/validation
|
|
22554
|
+
* 2. Reconstruction of original nested shape for handler input
|
|
22700
22555
|
*/
|
|
22701
|
-
const
|
|
22702
|
-
|
|
22703
|
-
|
|
22704
|
-
|
|
22705
|
-
|
|
22706
|
-
|
|
22707
|
-
|
|
22708
|
-
|
|
22709
|
-
|
|
22710
|
-
|
|
22711
|
-
|
|
22712
|
-
|
|
22713
|
-
|
|
22714
|
-
|
|
22715
|
-
|
|
22716
|
-
|
|
22717
|
-
|
|
22718
|
-
|
|
22719
|
-
|
|
22720
|
-
lines.push(` [[ "$_choice" == "$_prefix"* ]] || continue`);
|
|
22721
|
-
lines.push(` _rest="\${_choice#"$_committed"}"`);
|
|
22722
|
-
lines.push(` case "$_open" in`);
|
|
22723
|
-
lines.push(` "'")`);
|
|
22724
|
-
lines.push(` if [[ "$_head" == "'" ]]; then`);
|
|
22725
|
-
lines.push(` _match=\${_rest//\\'/\\'\\\\\\'\\'}`);
|
|
22726
|
-
lines.push(` else`);
|
|
22727
|
-
lines.push(` [[ "$_rest" == *\\'* ]] && continue`);
|
|
22728
|
-
lines.push(` _match="$_rest"`);
|
|
22729
|
-
lines.push(` fi`);
|
|
22730
|
-
lines.push(` ;;`);
|
|
22731
|
-
lines.push(` '"')`);
|
|
22732
|
-
lines.push(` _match="\${_rest//\\\\/\\\\\\\\}"`);
|
|
22733
|
-
lines.push(` _match="\${_match//\\$/\\\\$}"`);
|
|
22734
|
-
lines.push(" _match=\"${_match//\\`/\\\\\\`}\"");
|
|
22735
|
-
lines.push(` _match="\${_match//\\"/\\\\\\"}"`);
|
|
22736
|
-
lines.push(` ;;`);
|
|
22737
|
-
lines.push(` *)`);
|
|
22738
|
-
lines.push(` printf -v _match '%q' "$_rest"`);
|
|
22739
|
-
lines.push(` [[ -z "$_head" && "$_match" == '~'* ]] && _match="\\\\$_match"`);
|
|
22740
|
-
lines.push(` ;;`);
|
|
22741
|
-
lines.push(` esac`);
|
|
22742
|
-
lines.push(` [[ -n "$_open" && "$_match" == *"$_open" ]] && _match+="$_open"`);
|
|
22743
|
-
lines.push(` COMPREPLY+=("$_match")`);
|
|
22744
|
-
lines.push(` done`);
|
|
22745
|
-
lines.push(`}`);
|
|
22746
|
-
lines.push(``);
|
|
22747
|
-
};
|
|
22748
|
-
const choiceCompletion = (helperName, values) => `${helperName} "$cur" "$_comp_word" ${values.map((value) => `'${escapeForBash(value)}'`).join(" ")}`;
|
|
22749
|
-
const flagValueCompletion = (type, helperName) => {
|
|
22750
|
-
switch (type._tag) {
|
|
22751
|
-
case "Boolean": return;
|
|
22752
|
-
case "Choice": return choiceCompletion(helperName, type.values);
|
|
22753
|
-
case "Path":
|
|
22754
|
-
if (type.pathType === "directory") return `COMPREPLY=( $(compgen -d -- "$cur") )`;
|
|
22755
|
-
return `COMPREPLY=( $(compgen -f -- "$cur") )`;
|
|
22756
|
-
default: return;
|
|
22757
|
-
}
|
|
22758
|
-
};
|
|
22759
|
-
const argCompletion = (type, helperName) => {
|
|
22760
|
-
switch (type._tag) {
|
|
22761
|
-
case "Choice": return choiceCompletion(helperName, type.values);
|
|
22762
|
-
case "Path":
|
|
22763
|
-
if (type.pathType === "directory") return `COMPREPLY=( $(compgen -d -- "$cur") )`;
|
|
22764
|
-
return `COMPREPLY=( $(compgen -f -- "$cur") )`;
|
|
22765
|
-
default: return;
|
|
22766
|
-
}
|
|
22767
|
-
};
|
|
22768
|
-
const generateFunction$1 = (descriptor, parentPath, lines, helperName) => {
|
|
22769
|
-
const currentPath = [...parentPath, descriptor.name];
|
|
22770
|
-
const funcName = `_${currentPath.map(sanitizeFunctionName).join("_")}`;
|
|
22771
|
-
lines.push(`${funcName}()`);
|
|
22772
|
-
lines.push(`{`);
|
|
22773
|
-
lines.push(` local cur prev words cword i`);
|
|
22774
|
-
lines.push(parentPath.length === 0 ? ` local _command_index=0` : ` local _command_index="$1"`);
|
|
22775
|
-
lines.push(` _init_completion -n "$COMP_WORDBREAKS" || return`);
|
|
22776
|
-
if (parentPath.length === 0) lines.push(` local _comp_word="$2"`);
|
|
22777
|
-
lines.push(``);
|
|
22778
|
-
const flagsWithValues = descriptor.flags.filter((f) => f.type._tag !== "Boolean");
|
|
22779
|
-
if (flagsWithValues.length > 0) {
|
|
22780
|
-
lines.push(` # Flag value completions`);
|
|
22781
|
-
lines.push(` case "$prev" in`);
|
|
22782
|
-
for (const flag of flagsWithValues) {
|
|
22783
|
-
const longNames = [`--${flag.name}`];
|
|
22784
|
-
for (const alias of flag.aliases) longNames.push(alias.length === 1 ? `-${alias}` : `--${alias}`);
|
|
22785
|
-
const completion = flagValueCompletion(flag.type, helperName);
|
|
22786
|
-
if (completion) {
|
|
22787
|
-
lines.push(` ${longNames.join("|")})`);
|
|
22788
|
-
lines.push(` ${completion}`);
|
|
22789
|
-
lines.push(` return`);
|
|
22790
|
-
lines.push(` ;;`);
|
|
22791
|
-
}
|
|
22792
|
-
}
|
|
22793
|
-
lines.push(` esac`);
|
|
22794
|
-
lines.push(``);
|
|
22795
|
-
}
|
|
22796
|
-
if (descriptor.subcommands.length > 0) {
|
|
22797
|
-
lines.push(` # Subcommand dispatch`);
|
|
22798
|
-
lines.push(` local cmd _skip_next=0`);
|
|
22799
|
-
lines.push(` for ((i = _command_index + 1; i < cword; i++)); do`);
|
|
22800
|
-
lines.push(` if (( _skip_next )); then`);
|
|
22801
|
-
lines.push(` _skip_next=0`);
|
|
22802
|
-
lines.push(` continue`);
|
|
22803
|
-
lines.push(` fi`);
|
|
22804
|
-
lines.push(` case "\${words[i]}" in`);
|
|
22805
|
-
for (const flag of descriptor.flags) {
|
|
22806
|
-
if (flag.type._tag === "Boolean") continue;
|
|
22807
|
-
const forms = flagNamesForWordlist(flag);
|
|
22808
|
-
lines.push(` ${forms.join("|")}) _skip_next=1 ;;`);
|
|
22809
|
-
lines.push(` ${forms.map((form) => `${form}=*`).join("|")}) ;;`);
|
|
22810
|
-
}
|
|
22811
|
-
for (const sub of descriptor.subcommands) {
|
|
22812
|
-
const subFuncName = `_${[...currentPath, sub.name].map(sanitizeFunctionName).join("_")}`;
|
|
22813
|
-
lines.push(` ${sub.name})`);
|
|
22814
|
-
lines.push(` ${subFuncName} "$i"`);
|
|
22815
|
-
lines.push(` return`);
|
|
22816
|
-
lines.push(` ;;`);
|
|
22817
|
-
}
|
|
22818
|
-
lines.push(` esac`);
|
|
22819
|
-
lines.push(` done`);
|
|
22820
|
-
lines.push(``);
|
|
22821
|
-
}
|
|
22822
|
-
buildFlagGroupDeclarations(descriptor.flags, lines);
|
|
22823
|
-
if (descriptor.flags.length > 0 || descriptor.subcommands.length > 0) {
|
|
22824
|
-
lines.push(` # Complete flags (filtered) and subcommands`);
|
|
22825
|
-
lines.push(` if [[ "$cur" == -* ]]; then`);
|
|
22826
|
-
if (descriptor.flags.length > 0) lines.push(` COMPREPLY=( $(compgen -W "$_filtered_flags" -- "$cur") )`);
|
|
22827
|
-
lines.push(` return`);
|
|
22828
|
-
lines.push(` fi`);
|
|
22829
|
-
lines.push(``);
|
|
22556
|
+
const ConfigInternalTypeId = "~effect/cli/Command/Config/Internal";
|
|
22557
|
+
/**
|
|
22558
|
+
* Parses a Command.Config into a ConfigInternal.
|
|
22559
|
+
*
|
|
22560
|
+
* Walks the config structure and:
|
|
22561
|
+
* 1. Extracts all Params into flat arrays (flags, arguments, orderedParams)
|
|
22562
|
+
* 2. Builds a tree that remembers the original nested structure
|
|
22563
|
+
* 3. Assigns each Param an index to link parsed values back
|
|
22564
|
+
*
|
|
22565
|
+
* @internal
|
|
22566
|
+
*/
|
|
22567
|
+
const parseConfig = (config) => {
|
|
22568
|
+
const orderedParams = [];
|
|
22569
|
+
const flags = [];
|
|
22570
|
+
const args = [];
|
|
22571
|
+
function parse(config) {
|
|
22572
|
+
const tree = Object.create(null);
|
|
22573
|
+
for (const key of Object.keys(config)) tree[key] = parseValue(config[key]);
|
|
22574
|
+
return tree;
|
|
22830
22575
|
}
|
|
22831
|
-
|
|
22832
|
-
|
|
22833
|
-
|
|
22834
|
-
|
|
22835
|
-
|
|
22836
|
-
|
|
22837
|
-
|
|
22838
|
-
|
|
22839
|
-
|
|
22840
|
-
|
|
22841
|
-
|
|
22842
|
-
|
|
22843
|
-
|
|
22844
|
-
|
|
22845
|
-
|
|
22846
|
-
|
|
22847
|
-
|
|
22848
|
-
|
|
22849
|
-
lines.push(` continue`);
|
|
22850
|
-
lines.push(` fi`);
|
|
22851
|
-
lines.push(` case "\${words[i]}" in`);
|
|
22852
|
-
lines.push(` --) _end_of_options=1 ;;`);
|
|
22853
|
-
for (const flag of descriptor.flags) {
|
|
22854
|
-
const forms = flagNamesForWordlist(flag);
|
|
22855
|
-
if (flag.type._tag === "Boolean") lines.push(` ${forms.join("|")}) ;;`);
|
|
22856
|
-
else {
|
|
22857
|
-
lines.push(` ${forms.join("|")}) _skip_next=1 ;;`);
|
|
22858
|
-
lines.push(` ${forms.map((form) => `${form}=*`).join("|")}) ;;`);
|
|
22859
|
-
}
|
|
22860
|
-
}
|
|
22861
|
-
lines.push(` -*) ;;`);
|
|
22862
|
-
lines.push(` *) ((_position += 1)) ;;`);
|
|
22863
|
-
lines.push(` esac`);
|
|
22864
|
-
lines.push(` done`);
|
|
22865
|
-
lines.push(` case "$_position" in`);
|
|
22866
|
-
for (const { argument, completion, index } of argsWithCompletions) {
|
|
22867
|
-
if (argument.variadic) continue;
|
|
22868
|
-
lines.push(` ${index})`);
|
|
22869
|
-
lines.push(` ${completion}`);
|
|
22870
|
-
lines.push(` return`);
|
|
22871
|
-
lines.push(` ;;`);
|
|
22872
|
-
}
|
|
22873
|
-
lines.push(` esac`);
|
|
22874
|
-
const variadic = argsWithCompletions.find(({ argument }) => argument.variadic);
|
|
22875
|
-
if (variadic !== void 0) {
|
|
22876
|
-
lines.push(` if (( _position >= ${variadic.index} )); then`);
|
|
22877
|
-
lines.push(` ${variadic.completion}`);
|
|
22878
|
-
lines.push(` return`);
|
|
22879
|
-
lines.push(` fi`);
|
|
22880
|
-
}
|
|
22881
|
-
} else if (descriptor.subcommands.length > 0) {
|
|
22882
|
-
const subNames = descriptor.subcommands.map((s) => s.name);
|
|
22883
|
-
lines.push(` COMPREPLY=( $(compgen -W '${subNames.join(" ")}' -- "$cur") )`);
|
|
22576
|
+
function parseValue(value) {
|
|
22577
|
+
if (Array.isArray(value)) return {
|
|
22578
|
+
_tag: "Array",
|
|
22579
|
+
children: value.map((v) => parseValue(v))
|
|
22580
|
+
};
|
|
22581
|
+
else if (isParam(value)) {
|
|
22582
|
+
const index = orderedParams.length;
|
|
22583
|
+
orderedParams.push(value);
|
|
22584
|
+
if (value.kind === "argument") args.push(value);
|
|
22585
|
+
else flags.push(value);
|
|
22586
|
+
return {
|
|
22587
|
+
_tag: "Param",
|
|
22588
|
+
index
|
|
22589
|
+
};
|
|
22590
|
+
} else return {
|
|
22591
|
+
_tag: "Nested",
|
|
22592
|
+
tree: parse(value)
|
|
22593
|
+
};
|
|
22884
22594
|
}
|
|
22885
|
-
|
|
22886
|
-
|
|
22887
|
-
|
|
22595
|
+
return {
|
|
22596
|
+
[ConfigInternalTypeId]: ConfigInternalTypeId,
|
|
22597
|
+
flags,
|
|
22598
|
+
arguments: args,
|
|
22599
|
+
orderedParams,
|
|
22600
|
+
tree: parse(config)
|
|
22601
|
+
};
|
|
22888
22602
|
};
|
|
22889
22603
|
/**
|
|
22890
22604
|
* @internal
|
|
22891
22605
|
*/
|
|
22892
|
-
const
|
|
22893
|
-
const lines = [];
|
|
22894
|
-
const safeName = sanitizeFunctionName(executableName);
|
|
22895
|
-
const helperName = `_${safeName}--choices`;
|
|
22896
|
-
lines.push(`###-begin-${escapeForBash(executableName)}-completions-###`);
|
|
22897
|
-
lines.push(`#`);
|
|
22898
|
-
lines.push(`# Static completion script for Bash`);
|
|
22899
|
-
lines.push(`#`);
|
|
22900
|
-
lines.push(`# Installation:`);
|
|
22901
|
-
lines.push(`# ${escapeForBash(executableName)} --completions bash >> ~/.bashrc`);
|
|
22902
|
-
lines.push(`#`);
|
|
22903
|
-
lines.push(``);
|
|
22904
|
-
lines.push(`if ! type _init_completion &>/dev/null; then`);
|
|
22905
|
-
lines.push(` _init_completion()`);
|
|
22906
|
-
lines.push(` {`);
|
|
22907
|
-
lines.push(` COMPREPLY=()`);
|
|
22908
|
-
lines.push(` local _i _j=0 _piece _line="$COMP_LINE"`);
|
|
22909
|
-
lines.push(` words=("\${COMP_WORDS[0]}")`);
|
|
22910
|
-
lines.push(` cword=0`);
|
|
22911
|
-
lines.push(` _line="\${_line#*"\${COMP_WORDS[0]}"}"`);
|
|
22912
|
-
lines.push(` for ((_i = 1; _i < \${#COMP_WORDS[@]}; _i++)); do`);
|
|
22913
|
-
lines.push(` _piece="\${COMP_WORDS[_i]}"`);
|
|
22914
|
-
lines.push(` if [[ "$_line" == [[:blank:]]* ]]; then`);
|
|
22915
|
-
lines.push(` ((_j++))`);
|
|
22916
|
-
lines.push(` words[_j]="$_piece"`);
|
|
22917
|
-
lines.push(` else`);
|
|
22918
|
-
lines.push(` words[_j]="\${words[_j]}$_piece"`);
|
|
22919
|
-
lines.push(` fi`);
|
|
22920
|
-
lines.push(` ((_i == COMP_CWORD)) && cword=$_j`);
|
|
22921
|
-
lines.push(` _line="\${_line#*"$_piece"}"`);
|
|
22922
|
-
lines.push(` done`);
|
|
22923
|
-
lines.push(` cur="\${words[cword]}"`);
|
|
22924
|
-
lines.push(` prev=""`);
|
|
22925
|
-
lines.push(` ((cword > 0)) && prev="\${words[cword-1]}"`);
|
|
22926
|
-
lines.push(` return 0`);
|
|
22927
|
-
lines.push(` }`);
|
|
22928
|
-
lines.push(`fi`);
|
|
22929
|
-
lines.push(``);
|
|
22930
|
-
choicesHelper(helperName, lines);
|
|
22931
|
-
generateFunction$1(descriptor, [], lines, helperName);
|
|
22932
|
-
lines.push(`complete -F _${safeName} ${escapeForBash(executableName)}`);
|
|
22933
|
-
lines.push(`###-end-${escapeForBash(executableName)}-completions-###`);
|
|
22934
|
-
return lines.join("\n");
|
|
22935
|
-
};
|
|
22936
|
-
//#endregion
|
|
22937
|
-
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/internal/completions/fish.js
|
|
22938
|
-
const escapeFishString = (s) => s.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
|
22939
|
-
/** Escape choices for Fish's second expansion of `complete -a`. */
|
|
22940
|
-
const escapeFishChoice = (s) => escapeFishString(s.replace(/[^A-Za-z0-9_.,/@%+-]/gu, "\\$&"));
|
|
22606
|
+
const emptyConfig = /*#__PURE__*/ parseConfig({});
|
|
22941
22607
|
/**
|
|
22942
|
-
*
|
|
22608
|
+
* Reconstructs the original nested config shape from parsed values.
|
|
22943
22609
|
*
|
|
22944
|
-
*
|
|
22945
|
-
*
|
|
22946
|
-
*
|
|
22610
|
+
* Uses the tree as a blueprint to place each parsed value back into
|
|
22611
|
+
* its original position in the nested structure.
|
|
22612
|
+
*
|
|
22613
|
+
* @internal
|
|
22947
22614
|
*/
|
|
22948
|
-
const
|
|
22949
|
-
|
|
22950
|
-
|
|
22951
|
-
|
|
22615
|
+
const reconstructTree = (tree, results) => {
|
|
22616
|
+
const output = {};
|
|
22617
|
+
for (const key of Object.keys(tree)) assignProperty(output, key, nodeValue(tree[key]));
|
|
22618
|
+
return output;
|
|
22619
|
+
function nodeValue(node) {
|
|
22620
|
+
switch (node._tag) {
|
|
22621
|
+
case "Param": return results[node.index];
|
|
22622
|
+
case "Array": return node.children.map((child) => nodeValue(child));
|
|
22623
|
+
case "Nested": return reconstructTree(node.tree, results);
|
|
22624
|
+
}
|
|
22952
22625
|
}
|
|
22953
|
-
const parentCondition = parentPath.map((parent) => `__fish_seen_subcommand_from ${parent}`).join("; and ");
|
|
22954
|
-
if (childSubcommandNames.length > 0) return `${parentCondition}; and not __fish_seen_subcommand_from ${childSubcommandNames.join(" ")}`;
|
|
22955
|
-
return parentCondition;
|
|
22956
22626
|
};
|
|
22627
|
+
//#endregion
|
|
22628
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/internal/command.js
|
|
22957
22629
|
/**
|
|
22958
|
-
*
|
|
22959
|
-
*
|
|
22960
|
-
*
|
|
22630
|
+
* Command Implementation
|
|
22631
|
+
* ======================
|
|
22632
|
+
*
|
|
22633
|
+
* Internal implementation details for CLI commands.
|
|
22634
|
+
* Public API is in ../Command.ts
|
|
22961
22635
|
*/
|
|
22962
|
-
const
|
|
22963
|
-
|
|
22964
|
-
|
|
22965
|
-
|
|
22966
|
-
|
|
22967
|
-
|
|
22968
|
-
|
|
22969
|
-
|
|
22970
|
-
|
|
22971
|
-
|
|
22972
|
-
const forms = [`--${flag.name}`];
|
|
22973
|
-
for (const alias of flag.aliases) forms.push(alias.length === 1 ? `-${alias}` : `--${alias}`);
|
|
22974
|
-
return `begin; ${flagContainsOptCondition(flag)}; or contains -- (commandline -poc)[-1] ${forms.join(" ")}; end`;
|
|
22975
|
-
};
|
|
22976
|
-
const flagCompletionArgs = (flag) => {
|
|
22977
|
-
const args = [`-l ${flag.name}`];
|
|
22978
|
-
for (const alias of flag.aliases) if (alias.length === 1) args.push(`-s ${alias}`);
|
|
22979
|
-
else args.push(`-l ${alias}`);
|
|
22980
|
-
if (flag.description) args.push(`-d '${escapeFishString(flag.description)}'`);
|
|
22981
|
-
const valueArgs = flagValueArgs(flag.type);
|
|
22982
|
-
if (valueArgs) args.push(valueArgs);
|
|
22983
|
-
return args;
|
|
22984
|
-
};
|
|
22985
|
-
const flagValueArgs = (type) => {
|
|
22986
|
-
switch (type._tag) {
|
|
22987
|
-
case "Boolean": return;
|
|
22988
|
-
case "Choice": return `-r -f -a '${type.values.map(escapeFishChoice).join(" ")}'`;
|
|
22989
|
-
case "Path":
|
|
22990
|
-
if (type.pathType === "directory") return `-r -F`;
|
|
22991
|
-
return `-r -F`;
|
|
22992
|
-
default: return `-r -f`;
|
|
22993
|
-
}
|
|
22994
|
-
};
|
|
22995
|
-
const argValueArgs = (type) => {
|
|
22996
|
-
switch (type._tag) {
|
|
22997
|
-
case "Choice": return `-r -f -a '${type.values.map(escapeFishChoice).join(" ")}'`;
|
|
22998
|
-
case "Path": return `-r -F`;
|
|
22999
|
-
default: return;
|
|
23000
|
-
}
|
|
23001
|
-
};
|
|
23002
|
-
const generateCompletions = (executableName, descriptor, parentPath, lines) => {
|
|
23003
|
-
const allSubNames = descriptor.subcommands.map((s) => s.name);
|
|
23004
|
-
const condition = subcommandCondition(parentPath, allSubNames);
|
|
23005
|
-
const conditionArg = condition ? `-n '${condition}'` : ``;
|
|
23006
|
-
if (!descriptor.arguments.some((a) => a.type._tag === "Path")) {
|
|
23007
|
-
const parts = [`complete -c ${executableName}`];
|
|
23008
|
-
if (conditionArg) parts.push(conditionArg);
|
|
23009
|
-
parts.push(`-f`);
|
|
23010
|
-
lines.push(parts.join(" "));
|
|
23011
|
-
}
|
|
23012
|
-
for (const sub of descriptor.subcommands) {
|
|
23013
|
-
const parts = [`complete -c ${executableName}`];
|
|
23014
|
-
if (conditionArg) parts.push(conditionArg);
|
|
23015
|
-
parts.push(`-f -a '${escapeFishString(sub.name)}'`);
|
|
23016
|
-
if (sub.description) parts.push(`-d '${escapeFishString(sub.description)}'`);
|
|
23017
|
-
lines.push(parts.join(" "));
|
|
22636
|
+
const TypeId = "~effect/cli/Command";
|
|
22637
|
+
/**
|
|
22638
|
+
* Casts a Command to its internal implementation.
|
|
22639
|
+
* For use by internal modules that need access to config, parse, handle, etc.
|
|
22640
|
+
*/
|
|
22641
|
+
const toImpl = (self) => self;
|
|
22642
|
+
const Proto = { .../*#__PURE__*/ Prototype({
|
|
22643
|
+
label: "Command",
|
|
22644
|
+
evaluate() {
|
|
22645
|
+
return toImpl(this).service;
|
|
23018
22646
|
}
|
|
23019
|
-
|
|
23020
|
-
|
|
23021
|
-
|
|
23022
|
-
|
|
23023
|
-
|
|
23024
|
-
|
|
23025
|
-
|
|
23026
|
-
|
|
23027
|
-
|
|
23028
|
-
|
|
23029
|
-
|
|
23030
|
-
|
|
23031
|
-
|
|
23032
|
-
|
|
23033
|
-
|
|
22647
|
+
}) };
|
|
22648
|
+
/**
|
|
22649
|
+
* Internal command constructor. Only accepts already-parsed ConfigInternal.
|
|
22650
|
+
*/
|
|
22651
|
+
const makeCommand = (options) => {
|
|
22652
|
+
const config = options.config;
|
|
22653
|
+
const contextConfig = options.contextConfig ?? emptyConfig;
|
|
22654
|
+
const service = options.service ?? Service(`~effect/cli/Command/${options.name}`);
|
|
22655
|
+
const annotations = options.annotations ?? empty$2();
|
|
22656
|
+
const globalFlags = options.globalFlags ?? [];
|
|
22657
|
+
const subcommands = options.subcommands ?? [];
|
|
22658
|
+
const handle = (input, commandPath) => isNotUndefined(options.handle) ? options.handle(input, commandPath) : fail$1(new ShowHelp({
|
|
22659
|
+
commandPath,
|
|
22660
|
+
errors: []
|
|
22661
|
+
}));
|
|
22662
|
+
const parse = options.parse ?? makeParser(config);
|
|
22663
|
+
const parseContext = options.parseContext ?? makeParser(contextConfig, { allowLeftovers: true });
|
|
22664
|
+
const buildHelpDoc = (commandPath) => {
|
|
22665
|
+
const args = [];
|
|
22666
|
+
const flags = [];
|
|
22667
|
+
for (const arg of config.arguments) {
|
|
22668
|
+
const singles = extractSingleParams(arg);
|
|
22669
|
+
const metadata = getParamMetadata(arg);
|
|
22670
|
+
for (const single of singles) args.push({
|
|
22671
|
+
name: single.name,
|
|
22672
|
+
type: single.typeName ?? getTypeName(single.primitiveType),
|
|
22673
|
+
description: single.description,
|
|
22674
|
+
required: !metadata.isOptional && (!metadata.isVariadic || exists(metadata.variadicMin, (min) => min > 0)),
|
|
22675
|
+
variadic: metadata.isVariadic
|
|
22676
|
+
});
|
|
23034
22677
|
}
|
|
23035
|
-
|
|
23036
|
-
|
|
23037
|
-
|
|
23038
|
-
const
|
|
23039
|
-
|
|
23040
|
-
|
|
23041
|
-
|
|
23042
|
-
|
|
23043
|
-
|
|
23044
|
-
|
|
23045
|
-
|
|
23046
|
-
|
|
23047
|
-
|
|
23048
|
-
const negParts = [`complete -c ${executableName}`];
|
|
23049
|
-
negParts.push(`-n '${bareCondition}'`);
|
|
23050
|
-
negParts.push(`-f -a '--no-${flag.name}'`);
|
|
23051
|
-
if (flag.description) negParts.push(`-d '${escapeFishString(`Disable ${flag.name}`)}'`);
|
|
23052
|
-
lines.push(negParts.join(" "));
|
|
22678
|
+
let usage = commandPath.length > 0 ? commandPath.join(" ") : options.name;
|
|
22679
|
+
if (subcommands.some((group) => group.commands.some((c) => !c.unlisted))) usage += " <subcommand>";
|
|
22680
|
+
usage += " [flags]";
|
|
22681
|
+
for (const arg of args) {
|
|
22682
|
+
const argName = arg.variadic ? `<${arg.name}...>` : `<${arg.name}>`;
|
|
22683
|
+
usage += ` ${arg.required ? argName : `[${argName}]`}`;
|
|
22684
|
+
}
|
|
22685
|
+
for (const option of config.flags) {
|
|
22686
|
+
const singles = extractSingleParams(option);
|
|
22687
|
+
const metadata = getParamMetadata(option);
|
|
22688
|
+
for (const single of singles) {
|
|
22689
|
+
if (single.hidden) continue;
|
|
22690
|
+
flags.push(toFlagDoc(single, metadata));
|
|
23053
22691
|
}
|
|
23054
22692
|
}
|
|
23055
|
-
|
|
23056
|
-
|
|
23057
|
-
|
|
23058
|
-
|
|
23059
|
-
|
|
23060
|
-
|
|
23061
|
-
|
|
23062
|
-
|
|
23063
|
-
|
|
22693
|
+
const subcommandDocs = [];
|
|
22694
|
+
for (const group of subcommands) {
|
|
22695
|
+
const visible = group.commands.filter((c) => !c.unlisted);
|
|
22696
|
+
if (visible.length === 0) continue;
|
|
22697
|
+
subcommandDocs.push({
|
|
22698
|
+
group: group.group,
|
|
22699
|
+
commands: map$8(visible, (subcommand) => ({
|
|
22700
|
+
name: subcommand.name,
|
|
22701
|
+
alias: subcommand.alias,
|
|
22702
|
+
shortDescription: subcommand.shortDescription,
|
|
22703
|
+
description: subcommand.description ?? ""
|
|
22704
|
+
}))
|
|
22705
|
+
});
|
|
23064
22706
|
}
|
|
23065
|
-
|
|
23066
|
-
|
|
22707
|
+
const examples = options.examples ?? [];
|
|
22708
|
+
return {
|
|
22709
|
+
description: options.description ?? "",
|
|
22710
|
+
usage,
|
|
22711
|
+
flags,
|
|
22712
|
+
annotations,
|
|
22713
|
+
...args.length > 0 && { args },
|
|
22714
|
+
...subcommandDocs.length > 0 && { subcommands: subcommandDocs },
|
|
22715
|
+
...examples.length > 0 && { examples }
|
|
22716
|
+
};
|
|
22717
|
+
};
|
|
22718
|
+
return Object.assign(Object.create(Proto), {
|
|
22719
|
+
[TypeId]: TypeId,
|
|
22720
|
+
name: options.name,
|
|
22721
|
+
examples: options.examples ?? [],
|
|
22722
|
+
annotations,
|
|
22723
|
+
globalFlags,
|
|
22724
|
+
subcommands,
|
|
22725
|
+
unlisted: options.unlisted ?? false,
|
|
22726
|
+
config,
|
|
22727
|
+
contextConfig,
|
|
22728
|
+
service,
|
|
22729
|
+
parse,
|
|
22730
|
+
parseContext,
|
|
22731
|
+
handle,
|
|
22732
|
+
buildHelpDoc,
|
|
22733
|
+
...isNotUndefined(options.description) ? { description: options.description } : {},
|
|
22734
|
+
...isNotUndefined(options.shortDescription) ? { shortDescription: options.shortDescription } : {},
|
|
22735
|
+
...isNotUndefined(options.alias) ? { alias: options.alias } : {}
|
|
22736
|
+
});
|
|
23067
22737
|
};
|
|
23068
22738
|
/**
|
|
22739
|
+
* Converts a single flag param into a FlagDoc for help display.
|
|
22740
|
+
*
|
|
23069
22741
|
* @internal
|
|
23070
22742
|
*/
|
|
23071
|
-
const
|
|
23072
|
-
const
|
|
23073
|
-
|
|
23074
|
-
|
|
23075
|
-
|
|
23076
|
-
|
|
23077
|
-
|
|
23078
|
-
|
|
23079
|
-
|
|
23080
|
-
|
|
23081
|
-
|
|
23082
|
-
|
|
23083
|
-
|
|
23084
|
-
|
|
22743
|
+
const toFlagDoc = (single, metadata) => {
|
|
22744
|
+
const formattedAliases = single.aliases.map((alias) => alias.length === 1 ? `-${alias}` : `--${alias}`);
|
|
22745
|
+
const type = single.typeName ?? getTypeName(single.primitiveType);
|
|
22746
|
+
return {
|
|
22747
|
+
name: single.name,
|
|
22748
|
+
aliases: formattedAliases,
|
|
22749
|
+
type: single.optionalValue === void 0 ? type : `[=${type}]`,
|
|
22750
|
+
description: appendChoiceKeys(single.description, getChoiceKeys(single.primitiveType)),
|
|
22751
|
+
required: single.primitiveType._tag !== "Boolean" && !metadata.isOptional
|
|
22752
|
+
};
|
|
22753
|
+
};
|
|
22754
|
+
const appendChoiceKeys = (description, choiceKeys) => {
|
|
22755
|
+
if (choiceKeys === void 0 || choiceKeys.length === 0) return description;
|
|
22756
|
+
const choiceSuffix = `(choices: ${choiceKeys.join(", ")})`;
|
|
22757
|
+
return match$5(description, {
|
|
22758
|
+
onNone: () => some(choiceSuffix),
|
|
22759
|
+
onSome: (value) => some(`${value} ${choiceSuffix}`)
|
|
22760
|
+
});
|
|
23085
22761
|
};
|
|
23086
|
-
//#endregion
|
|
23087
|
-
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/internal/completions/powershell.js
|
|
23088
22762
|
/**
|
|
23089
|
-
*
|
|
23090
|
-
*
|
|
23091
|
-
*
|
|
22763
|
+
* Creates a parser for a given config. Used as the default for both `parse`
|
|
22764
|
+
* and `parseContext`, and also by `withSharedFlags` to avoid constructing a
|
|
22765
|
+
* full throwaway command.
|
|
23092
22766
|
*/
|
|
23093
|
-
const
|
|
23094
|
-
const
|
|
23095
|
-
|
|
23096
|
-
|
|
23097
|
-
|
|
23098
|
-
|
|
23099
|
-
|
|
23100
|
-
|
|
23101
|
-
|
|
23102
|
-
|
|
23103
|
-
|
|
23104
|
-
|
|
23105
|
-
|
|
23106
|
-
|
|
23107
|
-
|
|
23108
|
-
|
|
23109
|
-
const
|
|
23110
|
-
const
|
|
23111
|
-
|
|
23112
|
-
|
|
23113
|
-
|
|
23114
|
-
|
|
23115
|
-
|
|
23116
|
-
|
|
23117
|
-
|
|
23118
|
-
|
|
23119
|
-
|
|
22767
|
+
const makeParser = (cfg, options) => fnUntraced(function* (input) {
|
|
22768
|
+
const parsedArgs = {
|
|
22769
|
+
flags: input.flags,
|
|
22770
|
+
arguments: input.arguments
|
|
22771
|
+
};
|
|
22772
|
+
const [remainingArguments, values] = yield* parseParams(parsedArgs, cfg.orderedParams);
|
|
22773
|
+
if (options?.allowLeftovers !== true && remainingArguments.length > 0) return yield* new UnexpectedArgument({ arguments: remainingArguments });
|
|
22774
|
+
return reconstructTree(cfg.tree, values);
|
|
22775
|
+
});
|
|
22776
|
+
/**
|
|
22777
|
+
* Parses param values from parsed command arguments into their typed
|
|
22778
|
+
* representations.
|
|
22779
|
+
*/
|
|
22780
|
+
const parseParams = /*#__PURE__*/ fnUntraced(function* (parsedArgs, params) {
|
|
22781
|
+
const results = [];
|
|
22782
|
+
let currentArguments = parsedArgs.arguments;
|
|
22783
|
+
for (const option of params) {
|
|
22784
|
+
const [remainingArguments, parsed] = yield* option.parse({
|
|
22785
|
+
flags: parsedArgs.flags,
|
|
22786
|
+
arguments: currentArguments
|
|
22787
|
+
});
|
|
22788
|
+
results.push(parsed);
|
|
22789
|
+
currentArguments = remainingArguments;
|
|
22790
|
+
}
|
|
22791
|
+
return [currentArguments, results];
|
|
22792
|
+
});
|
|
22793
|
+
//#endregion
|
|
22794
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/internal/completions/descriptor.js
|
|
22795
|
+
/**
|
|
22796
|
+
* CommandDescriptor — pure-data representation of a command tree for
|
|
22797
|
+
* shell completion generation.
|
|
22798
|
+
*
|
|
22799
|
+
* @internal
|
|
22800
|
+
*/
|
|
22801
|
+
const toFlagType = (single) => {
|
|
22802
|
+
switch (single.primitiveType._tag) {
|
|
22803
|
+
case "Boolean": return { _tag: "Boolean" };
|
|
22804
|
+
case "Int": return { _tag: "Int" };
|
|
22805
|
+
case "Finite": return { _tag: "Finite" };
|
|
22806
|
+
case "Date": return { _tag: "Date" };
|
|
22807
|
+
case "Choice": return {
|
|
22808
|
+
_tag: "Choice",
|
|
22809
|
+
values: getChoiceKeys(single.primitiveType) ?? []
|
|
22810
|
+
};
|
|
22811
|
+
case "Path": return {
|
|
22812
|
+
_tag: "Path",
|
|
22813
|
+
pathType: getPathType(single.primitiveType) ?? "either"
|
|
22814
|
+
};
|
|
22815
|
+
case "FileText":
|
|
22816
|
+
case "FileParse":
|
|
22817
|
+
case "FileSchema": return {
|
|
22818
|
+
_tag: "Path",
|
|
22819
|
+
pathType: "file"
|
|
22820
|
+
};
|
|
22821
|
+
default: return { _tag: "String" };
|
|
22822
|
+
}
|
|
22823
|
+
};
|
|
22824
|
+
const toArgumentType = (single) => {
|
|
22825
|
+
switch (single.primitiveType._tag) {
|
|
22826
|
+
case "Int": return { _tag: "Int" };
|
|
22827
|
+
case "Finite": return { _tag: "Finite" };
|
|
22828
|
+
case "Date": return { _tag: "Date" };
|
|
22829
|
+
case "Choice": return {
|
|
22830
|
+
_tag: "Choice",
|
|
22831
|
+
values: getChoiceKeys(single.primitiveType) ?? []
|
|
22832
|
+
};
|
|
22833
|
+
case "Path": return {
|
|
22834
|
+
_tag: "Path",
|
|
22835
|
+
pathType: getPathType(single.primitiveType) ?? "either"
|
|
22836
|
+
};
|
|
22837
|
+
case "FileText":
|
|
22838
|
+
case "FileParse":
|
|
22839
|
+
case "FileSchema": return {
|
|
22840
|
+
_tag: "Path",
|
|
22841
|
+
pathType: "file"
|
|
22842
|
+
};
|
|
22843
|
+
default: return { _tag: "String" };
|
|
23120
22844
|
}
|
|
23121
|
-
lines.push(` ${field} = @(`);
|
|
23122
|
-
for (const entry of entries) lines.push(` ${entry}`);
|
|
23123
|
-
lines.push(` )`);
|
|
23124
22845
|
};
|
|
23125
22846
|
/**
|
|
23126
|
-
*
|
|
23127
|
-
* contexts go in an ordinal hashtable instead of a hash literal, whose keys
|
|
23128
|
-
* ignore case.
|
|
22847
|
+
* @internal
|
|
23129
22848
|
*/
|
|
23130
|
-
const
|
|
23131
|
-
const
|
|
23132
|
-
|
|
23133
|
-
|
|
23134
|
-
|
|
23135
|
-
|
|
23136
|
-
|
|
23137
|
-
|
|
23138
|
-
|
|
23139
|
-
|
|
22849
|
+
const fromCommand = (cmd, inheritedFlags = []) => {
|
|
22850
|
+
const impl = toImpl(cmd);
|
|
22851
|
+
const config = impl.config;
|
|
22852
|
+
const flags = [];
|
|
22853
|
+
const seen = /* @__PURE__ */ new Set();
|
|
22854
|
+
for (const [index, flag] of [...config.flags, ...inheritedFlags].entries()) {
|
|
22855
|
+
const singles = extractSingleParams(flag);
|
|
22856
|
+
for (const single of singles) {
|
|
22857
|
+
if (single.kind !== "flag") continue;
|
|
22858
|
+
if (single.hidden) continue;
|
|
22859
|
+
if (index >= config.flags.length && seen.has(single.name)) continue;
|
|
22860
|
+
seen.add(single.name);
|
|
22861
|
+
flags.push({
|
|
22862
|
+
name: single.name,
|
|
22863
|
+
aliases: single.aliases,
|
|
22864
|
+
description: getOrUndefined$1(single.description),
|
|
22865
|
+
type: toFlagType(single),
|
|
22866
|
+
optionalValue: single.optionalValue !== void 0
|
|
22867
|
+
});
|
|
22868
|
+
}
|
|
22869
|
+
}
|
|
22870
|
+
const args = [];
|
|
22871
|
+
for (const arg of config.arguments) {
|
|
22872
|
+
const singles = extractSingleParams(arg);
|
|
22873
|
+
const metadata = getParamMetadata(arg);
|
|
22874
|
+
for (const single of singles) {
|
|
22875
|
+
if (single.kind !== "argument") continue;
|
|
22876
|
+
args.push({
|
|
22877
|
+
name: single.name,
|
|
22878
|
+
description: getOrUndefined$1(single.description),
|
|
22879
|
+
required: !metadata.isOptional,
|
|
22880
|
+
variadic: metadata.isVariadic,
|
|
22881
|
+
type: toArgumentType(single)
|
|
22882
|
+
});
|
|
22883
|
+
}
|
|
22884
|
+
}
|
|
22885
|
+
const subcommands = [];
|
|
22886
|
+
const sharedFlags = [...inheritedFlags, ...impl.contextConfig.flags];
|
|
22887
|
+
for (const group of cmd.subcommands) for (const subcommand of group.commands) {
|
|
22888
|
+
if (subcommand.unlisted) continue;
|
|
22889
|
+
const descriptor = fromCommand(subcommand, sharedFlags);
|
|
22890
|
+
subcommands.push(descriptor);
|
|
22891
|
+
if (subcommand.alias && subcommand.alias !== subcommand.name) subcommands.push({
|
|
22892
|
+
...descriptor,
|
|
22893
|
+
name: subcommand.alias
|
|
22894
|
+
});
|
|
22895
|
+
}
|
|
22896
|
+
return {
|
|
22897
|
+
name: cmd.name,
|
|
22898
|
+
description: cmd.shortDescription ?? cmd.description,
|
|
22899
|
+
flags,
|
|
22900
|
+
arguments: args,
|
|
22901
|
+
subcommands
|
|
22902
|
+
};
|
|
23140
22903
|
};
|
|
23141
22904
|
/**
|
|
23142
|
-
*
|
|
23143
|
-
*
|
|
23144
|
-
*
|
|
22905
|
+
* Whether the flag reads its value from the next word.
|
|
22906
|
+
*
|
|
22907
|
+
* @internal
|
|
23145
22908
|
*/
|
|
23146
|
-
const
|
|
23147
|
-
|
|
23148
|
-
|
|
23149
|
-
|
|
23150
|
-
|
|
23151
|
-
|
|
23152
|
-
|
|
23153
|
-
|
|
23154
|
-
|
|
23155
|
-
|
|
23156
|
-
|
|
23157
|
-
|
|
23158
|
-
|
|
23159
|
-
|
|
23160
|
-
|
|
23161
|
-
$
|
|
23162
|
-
|
|
23163
|
-
|
|
23164
|
-
|
|
23165
|
-
|
|
23166
|
-
|
|
23167
|
-
|
|
23168
|
-
|
|
23169
|
-
|
|
23170
|
-
|
|
23171
|
-
}
|
|
23172
|
-
|
|
23173
|
-
$addValues = {
|
|
23174
|
-
param($entry, [string]$typed, [string]$textPrefix)
|
|
23175
|
-
foreach ($value in $entry.values) {
|
|
23176
|
-
if ($textPrefix -eq '' -and (& $optionLike $value)) { continue }
|
|
23177
|
-
& $add $value 'ParameterValue' $entry.description $typed $textPrefix
|
|
23178
|
-
}
|
|
23179
|
-
if ($entry.pathType) {
|
|
23180
|
-
foreach ($file in [System.Management.Automation.CompletionCompleters]::CompleteFilename($typed)) {
|
|
23181
|
-
if ($entry.pathType -eq 'directory' -and $file.ResultType -ne 'ProviderContainer') { continue }
|
|
23182
|
-
$results.Add([System.Management.Automation.CompletionResult]::new($textPrefix + $file.CompletionText, $file.ListItemText, $file.ResultType, $file.ToolTip))
|
|
23183
|
-
}
|
|
23184
|
-
}
|
|
23185
|
-
}
|
|
23186
|
-
|
|
23187
|
-
$addFlags = {
|
|
23188
|
-
param([string]$typed)
|
|
23189
|
-
foreach ($flag in $context.flags) {
|
|
23190
|
-
if ($used.ContainsKey($flag.name)) { continue }
|
|
23191
|
-
foreach ($form in $flag.forms) {
|
|
23192
|
-
& $add $form 'ParameterName' $flag.description $typed ''
|
|
23193
|
-
}
|
|
23194
|
-
if (-not $flag.takesValue) {
|
|
23195
|
-
$tooltip = $null
|
|
23196
|
-
if ($flag.description) { $tooltip = 'Disable ' + $flag.name }
|
|
23197
|
-
& $add ('--no-' + $flag.name) 'ParameterName' $tooltip $typed ''
|
|
23198
|
-
}
|
|
23199
|
-
}
|
|
23200
|
-
}
|
|
23201
|
-
|
|
23202
|
-
# As in the CLI lexer, nothing after '--' is an option, and negative numbers
|
|
23203
|
-
# and a lone '-' are values.
|
|
23204
|
-
$optionLike = {
|
|
23205
|
-
param([string]$word)
|
|
23206
|
-
-not $endOfOptions -and $word -match '^-.' -and $word -notmatch '^-(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$'
|
|
23207
|
-
}
|
|
23208
|
-
|
|
23209
|
-
# A typed value that has no candidates completes to itself, so the engine
|
|
23210
|
-
# does not fall back to listing files.
|
|
23211
|
-
$keepTyped = {
|
|
23212
|
-
if ($results.Count -eq 0 -and $current) {
|
|
23213
|
-
$results.Add([System.Management.Automation.CompletionResult]::new($current, $current, 'ParameterValue', $current))
|
|
23214
|
-
}
|
|
23215
|
-
}
|
|
23216
|
-
|
|
23217
|
-
$path = ''
|
|
23218
|
-
$context = $spec[$path]
|
|
23219
|
-
$lookup = & $index $context
|
|
23220
|
-
$used = [hashtable]::new([System.StringComparer]::Ordinal)
|
|
23221
|
-
$pending = $null
|
|
23222
|
-
$endOfOptions = $false
|
|
23223
|
-
$position = 0
|
|
23224
|
-
|
|
23225
|
-
# The engine strips the quotes from a quoted word.
|
|
23226
|
-
$typed = [string]$wordToComplete
|
|
23227
|
-
if ($typed -match '^([''"])(.*?)\1?$') { $typed = $Matches[2] }
|
|
23228
|
-
$current = $null
|
|
23229
|
-
|
|
23230
|
-
$elements = $commandAst.CommandElements
|
|
23231
|
-
for ($i = 1; $i -lt $elements.Count; $i++) {
|
|
23232
|
-
$element = $elements[$i]
|
|
23233
|
-
$word = $element.Extent.Text
|
|
23234
|
-
if ($element -is [System.Management.Automation.Language.StringConstantExpressionAst]) { $word = $element.Value }
|
|
23235
|
-
if ($element.Extent.EndOffset -ge $cursorPosition) {
|
|
23236
|
-
if ($element -is [System.Management.Automation.Language.ConstantExpressionAst] -and $element.Extent.StartOffset -le $cursorPosition) {
|
|
23237
|
-
$current = $element.Extent.Text
|
|
23238
|
-
if ($element.Extent.EndOffset -eq $cursorPosition) { $typed = $word }
|
|
23239
|
-
}
|
|
23240
|
-
break
|
|
23241
|
-
}
|
|
23242
|
-
|
|
23243
|
-
# A flag takes the next word as its value unless it is an option or '--';
|
|
23244
|
-
# a boolean flag only takes a boolean literal.
|
|
23245
|
-
$isOption = & $optionLike $word
|
|
23246
|
-
if ($null -ne $pending) {
|
|
23247
|
-
$flag = $pending
|
|
23248
|
-
$pending = $null
|
|
23249
|
-
if ($flag.takesValue) {
|
|
23250
|
-
if (-not $isOption) { continue }
|
|
23251
|
-
} elseif ($booleanLiterals -ccontains $word) { continue }
|
|
23252
|
-
}
|
|
23253
|
-
if ($endOfOptions) { $position++; continue }
|
|
23254
|
-
if ($word -ceq '--') { $endOfOptions = $true; continue }
|
|
23255
|
-
|
|
23256
|
-
if ($isOption) {
|
|
23257
|
-
$hasValue = $word.Contains('=')
|
|
23258
|
-
if ($hasValue) {
|
|
23259
|
-
$forms = @($word.Substring(0, $word.IndexOf('=')))
|
|
23260
|
-
} elseif ($word.StartsWith('--')) {
|
|
23261
|
-
$forms = @($word)
|
|
23262
|
-
} else {
|
|
23263
|
-
$forms = @(foreach ($char in $word.Substring(1).ToCharArray()) { '-' + $char })
|
|
23264
|
-
}
|
|
23265
|
-
foreach ($form in $forms) {
|
|
23266
|
-
$pending = $null
|
|
23267
|
-
$flag = $lookup[$form]
|
|
23268
|
-
if ($null -eq $flag) {
|
|
23269
|
-
if ($form.StartsWith('--no-')) {
|
|
23270
|
-
$name = $form.Substring(5)
|
|
23271
|
-
$flag = $lookup['--' + $name]
|
|
23272
|
-
if ($null -ne $flag -and -not $flag.takesValue -and $flag.name -ceq $name) { $used[$name] = $true }
|
|
23273
|
-
}
|
|
23274
|
-
continue
|
|
23275
|
-
}
|
|
23276
|
-
$used[$flag.name] = $true
|
|
23277
|
-
if (-not $hasValue) { $pending = $flag }
|
|
23278
|
-
}
|
|
23279
|
-
continue
|
|
23280
|
-
}
|
|
23281
|
-
|
|
23282
|
-
if ($position -eq 0 -and $context.subcommands.name -ccontains $word) {
|
|
23283
|
-
if ($path) { $path = $path + ' ' + $word } else { $path = $word }
|
|
23284
|
-
$context = $spec[$path]
|
|
23285
|
-
$lookup = & $index $context
|
|
23286
|
-
$used = [hashtable]::new([System.StringComparer]::Ordinal)
|
|
23287
|
-
continue
|
|
23288
|
-
}
|
|
23289
|
-
$position++
|
|
23290
|
-
}
|
|
23291
|
-
|
|
23292
|
-
$typedIsOption = & $optionLike $typed
|
|
23293
|
-
if ($null -ne $pending -and $pending.takesValue -and -not $typedIsOption) {
|
|
23294
|
-
& $addValues $pending $typed ''
|
|
23295
|
-
& $keepTyped
|
|
23296
|
-
return $results
|
|
23297
|
-
}
|
|
23298
|
-
|
|
23299
|
-
if ($typedIsOption) {
|
|
23300
|
-
if ($typed -match '^(-[^=]+)=(.*)$') {
|
|
23301
|
-
$form = $Matches[1]
|
|
23302
|
-
$flag = $lookup[$form]
|
|
23303
|
-
if ($null -ne $flag -and $flag.takesValue) {
|
|
23304
|
-
& $addValues $flag $Matches[2] ($form + '=')
|
|
23305
|
-
& $keepTyped
|
|
23306
|
-
}
|
|
23307
|
-
} else {
|
|
23308
|
-
& $addFlags $typed
|
|
23309
|
-
}
|
|
23310
|
-
return $results
|
|
23311
|
-
}
|
|
23312
|
-
|
|
23313
|
-
if (-not $endOfOptions -and $position -eq 0) {
|
|
23314
|
-
foreach ($sub in $context.subcommands) {
|
|
23315
|
-
& $add $sub.name 'Command' $sub.description $typed ''
|
|
23316
|
-
}
|
|
23317
|
-
}
|
|
23318
|
-
|
|
23319
|
-
$arguments = $context.arguments
|
|
23320
|
-
if ($position -lt $arguments.Count) {
|
|
23321
|
-
& $addValues $arguments[$position] $typed ''
|
|
23322
|
-
} elseif ($arguments.Count -gt 0 -and $arguments[-1].variadic) {
|
|
23323
|
-
& $addValues $arguments[-1] $typed ''
|
|
23324
|
-
}
|
|
23325
|
-
|
|
23326
|
-
if (-not $endOfOptions) {
|
|
23327
|
-
& $addFlags $typed
|
|
23328
|
-
}
|
|
23329
|
-
return $results`;
|
|
23330
|
-
/** @internal */
|
|
23331
|
-
const generate$2 = (executableName, descriptor) => {
|
|
23332
|
-
const dataName = `$global:_${sanitize$1(executableName)}_Completions`;
|
|
23333
|
-
const lines = [];
|
|
23334
|
-
lines.push(`###-begin-${executableName}-completions-###`);
|
|
23335
|
-
lines.push(`#`);
|
|
23336
|
-
lines.push(`# Static completion script for PowerShell`);
|
|
23337
|
-
lines.push(`#`);
|
|
23338
|
-
lines.push(`# Installation:`);
|
|
23339
|
-
lines.push(`# ${executableName} --completions powershell > ${executableName}-completion.ps1`);
|
|
23340
|
-
lines.push(`# then add this line to your $PROFILE (use the full path to the file):`);
|
|
23341
|
-
lines.push(`# . <PATH>\\${executableName}-completion.ps1`);
|
|
23342
|
-
lines.push(`#`);
|
|
23343
|
-
lines.push(``);
|
|
23344
|
-
lines.push(`${dataName} = [hashtable]::new([System.StringComparer]::Ordinal)`);
|
|
23345
|
-
generateContexts(dataName, descriptor, [], lines, /* @__PURE__ */ new Set());
|
|
23346
|
-
lines.push(``);
|
|
23347
|
-
lines.push(`Register-ArgumentCompleter -Native -CommandName ${quotePs(executableName)} -ScriptBlock {`);
|
|
23348
|
-
lines.push(completer(dataName));
|
|
23349
|
-
lines.push(`}`);
|
|
22909
|
+
const takesSeparateValue = (flag) => flag.type._tag !== "Boolean" && flag.optionalValue !== true;
|
|
22910
|
+
//#endregion
|
|
22911
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/internal/completions/bash.js
|
|
22912
|
+
const escapeForBash = (s) => s.replace(/'/g, "'\\''");
|
|
22913
|
+
const sanitizeFunctionName = (s) => s.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
22914
|
+
const flagNamesForWordlist = (flag) => {
|
|
22915
|
+
const names = [`--${flag.name}`];
|
|
22916
|
+
for (const alias of flag.aliases) names.push(alias.length === 1 ? `-${alias}` : `--${alias}`);
|
|
22917
|
+
if (flag.type._tag === "Boolean") names.push(`--no-${flag.name}`);
|
|
22918
|
+
return names;
|
|
22919
|
+
};
|
|
22920
|
+
/** Emit a Bash 3.2-compatible used-flag filter. */
|
|
22921
|
+
const buildFlagGroupDeclarations = (flags, lines) => {
|
|
22922
|
+
if (flags.length === 0) return;
|
|
22923
|
+
const groups = flags.map(flagNamesForWordlist);
|
|
22924
|
+
lines.push(` local ${groups.map((_, index) => `_used_${index}=""`).join(" ")}`);
|
|
22925
|
+
lines.push(` for ((i = 1; i < cword; i++)); do`);
|
|
22926
|
+
lines.push(` case "\${words[i]%%=*}" in`);
|
|
22927
|
+
groups.forEach((forms, index) => {
|
|
22928
|
+
lines.push(` ${forms.join("|")}) _used_${index}=1 ;;`);
|
|
22929
|
+
});
|
|
22930
|
+
lines.push(` esac`);
|
|
22931
|
+
lines.push(` done`);
|
|
22932
|
+
lines.push(` local _filtered_flags=""`);
|
|
22933
|
+
groups.forEach((forms, index) => {
|
|
22934
|
+
lines.push(` [[ -n "$_used_${index}" ]] || _filtered_flags+=" ${forms.join(" ")}"`);
|
|
22935
|
+
});
|
|
23350
22936
|
lines.push(``);
|
|
23351
|
-
lines.push(`###-end-${executableName}-completions-###`);
|
|
23352
|
-
return lines.join("\n");
|
|
23353
22937
|
};
|
|
23354
|
-
//#endregion
|
|
23355
|
-
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/internal/completions/zsh.js
|
|
23356
|
-
const escapeZsh = (s) => s.replace(/\\/g, "\\\\").replace(/'/g, "'\\''").replace(/:/g, "\\:");
|
|
23357
|
-
const escapeZshExplanation = (s) => escapeZsh(s).replace(/]/g, "\\]");
|
|
23358
|
-
/** Escape choices for the second parse of a Zsh `_arguments` action. */
|
|
23359
|
-
const escapeZshChoice = (s) => s.replace(/[^A-Za-z0-9_.,/@%+-]/gu, "\\$&").replace(/'/g, "'\\''");
|
|
23360
|
-
const sanitize = (s) => s.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
23361
22938
|
/**
|
|
23362
|
-
*
|
|
22939
|
+
* Complete choices without `compgen -W`, which reparses quoted values. Escape
|
|
22940
|
+
* only the portion readline replaces for the active quote context.
|
|
22941
|
+
*
|
|
22942
|
+
* `!` cannot be escaped inside a user-opened double quote without changing the
|
|
22943
|
+
* resulting argument.
|
|
23363
22944
|
*/
|
|
23364
|
-
const
|
|
23365
|
-
|
|
23366
|
-
|
|
23367
|
-
|
|
23368
|
-
|
|
22945
|
+
const choicesHelper = (helperName, lines) => {
|
|
22946
|
+
lines.push(`${helperName}()`);
|
|
22947
|
+
lines.push(`{`);
|
|
22948
|
+
lines.push(` local _cur="$1" _word="$2"; shift 2`);
|
|
22949
|
+
lines.push(``);
|
|
22950
|
+
lines.push(` local _head="\${_cur%"$_word"}"`);
|
|
22951
|
+
lines.push(` local _open=""`);
|
|
22952
|
+
lines.push(` case "$_head" in`);
|
|
22953
|
+
lines.push(` *\\') _open="'" ;;`);
|
|
22954
|
+
lines.push(` *\\") _open='"' ;;`);
|
|
22955
|
+
lines.push(` esac`);
|
|
22956
|
+
lines.push(``);
|
|
22957
|
+
lines.push(` local _prefix="$_cur" _committed="$_head"`);
|
|
22958
|
+
lines.push(` _prefix=\${_prefix//\\\\/}; _prefix=\${_prefix//\\"/}; _prefix=\${_prefix//\\'/}`);
|
|
22959
|
+
lines.push(` _committed=\${_committed//\\\\/}; _committed=\${_committed//\\"/}; _committed=\${_committed//\\'/}`);
|
|
22960
|
+
lines.push(``);
|
|
22961
|
+
lines.push(` COMPREPLY=()`);
|
|
22962
|
+
lines.push(` local _choice _rest _match`);
|
|
22963
|
+
lines.push(` for _choice in "$@"; do`);
|
|
22964
|
+
lines.push(` [[ "$_choice" == "$_prefix"* ]] || continue`);
|
|
22965
|
+
lines.push(` _rest="\${_choice#"$_committed"}"`);
|
|
22966
|
+
lines.push(` case "$_open" in`);
|
|
22967
|
+
lines.push(` "'")`);
|
|
22968
|
+
lines.push(` if [[ "$_head" == "'" ]]; then`);
|
|
22969
|
+
lines.push(` _match=\${_rest//\\'/\\'\\\\\\'\\'}`);
|
|
22970
|
+
lines.push(` else`);
|
|
22971
|
+
lines.push(` [[ "$_rest" == *\\'* ]] && continue`);
|
|
22972
|
+
lines.push(` _match="$_rest"`);
|
|
22973
|
+
lines.push(` fi`);
|
|
22974
|
+
lines.push(` ;;`);
|
|
22975
|
+
lines.push(` '"')`);
|
|
22976
|
+
lines.push(` _match="\${_rest//\\\\/\\\\\\\\}"`);
|
|
22977
|
+
lines.push(` _match="\${_match//\\$/\\\\$}"`);
|
|
22978
|
+
lines.push(" _match=\"${_match//\\`/\\\\\\`}\"");
|
|
22979
|
+
lines.push(` _match="\${_match//\\"/\\\\\\"}"`);
|
|
22980
|
+
lines.push(` ;;`);
|
|
22981
|
+
lines.push(` *)`);
|
|
22982
|
+
lines.push(` printf -v _match '%q' "$_rest"`);
|
|
22983
|
+
lines.push(` [[ -z "$_head" && "$_match" == '~'* ]] && _match="\\\\$_match"`);
|
|
22984
|
+
lines.push(` ;;`);
|
|
22985
|
+
lines.push(` esac`);
|
|
22986
|
+
lines.push(` [[ -n "$_open" && "$_match" == *"$_open" ]] && _match+="$_open"`);
|
|
22987
|
+
lines.push(` COMPREPLY+=("$_match")`);
|
|
22988
|
+
lines.push(` done`);
|
|
22989
|
+
lines.push(`}`);
|
|
22990
|
+
lines.push(``);
|
|
23369
22991
|
};
|
|
23370
|
-
const
|
|
22992
|
+
const choiceCompletion = (helperName, values) => `${helperName} "$cur" "$_comp_word" ${values.map((value) => `'${escapeForBash(value)}'`).join(" ")}`;
|
|
22993
|
+
const flagValueCompletion = (type, helperName) => {
|
|
23371
22994
|
switch (type._tag) {
|
|
23372
|
-
case "Boolean": return
|
|
23373
|
-
case "Choice": return
|
|
23374
|
-
case "Path":
|
|
23375
|
-
|
|
23376
|
-
|
|
23377
|
-
|
|
23378
|
-
default: return `:value:`;
|
|
22995
|
+
case "Boolean": return;
|
|
22996
|
+
case "Choice": return choiceCompletion(helperName, type.values);
|
|
22997
|
+
case "Path":
|
|
22998
|
+
if (type.pathType === "directory") return `COMPREPLY=( $(compgen -d -- "$cur") )`;
|
|
22999
|
+
return `COMPREPLY=( $(compgen -f -- "$cur") )`;
|
|
23000
|
+
default: return;
|
|
23379
23001
|
}
|
|
23380
23002
|
};
|
|
23381
|
-
const
|
|
23003
|
+
const argCompletion = (type, helperName) => {
|
|
23382
23004
|
switch (type._tag) {
|
|
23383
|
-
case "Choice": return
|
|
23384
|
-
case "Path":
|
|
23385
|
-
|
|
23386
|
-
|
|
23387
|
-
|
|
23388
|
-
/**
|
|
23389
|
-
* Produce _arguments optspecs for a single flag. Each spec is a complete,
|
|
23390
|
-
* single-quoted string — no brace expansion, no line continuations.
|
|
23391
|
-
*/
|
|
23392
|
-
const flagSpecs = (flag) => {
|
|
23393
|
-
const specs = [];
|
|
23394
|
-
const desc = flag.description ? `[${escapeZshExplanation(flag.description)}]` : "";
|
|
23395
|
-
const action = valueAction(flag.type);
|
|
23396
|
-
const excl = `(${allForms(flag).join(" ")})`;
|
|
23397
|
-
specs.push(`'${excl}--${flag.name}${desc}${action}'`);
|
|
23398
|
-
for (const alias of flag.aliases) {
|
|
23399
|
-
const prefix = alias.length === 1 ? "-" : "--";
|
|
23400
|
-
specs.push(`'${excl}${prefix}${alias}${desc}${action}'`);
|
|
23401
|
-
}
|
|
23402
|
-
if (flag.type._tag === "Boolean") {
|
|
23403
|
-
const negDesc = flag.description ? `[${escapeZshExplanation(`Disable ${flag.name}`)}]` : "";
|
|
23404
|
-
specs.push(`'${excl}--no-${flag.name}${negDesc}'`);
|
|
23005
|
+
case "Choice": return choiceCompletion(helperName, type.values);
|
|
23006
|
+
case "Path":
|
|
23007
|
+
if (type.pathType === "directory") return `COMPREPLY=( $(compgen -d -- "$cur") )`;
|
|
23008
|
+
return `COMPREPLY=( $(compgen -f -- "$cur") )`;
|
|
23009
|
+
default: return;
|
|
23405
23010
|
}
|
|
23406
|
-
return specs;
|
|
23407
|
-
};
|
|
23408
|
-
const argSpec = (arg) => {
|
|
23409
|
-
const desc = arg.description ? escapeZsh(arg.description) : arg.name;
|
|
23410
|
-
const action = argAction(arg.type);
|
|
23411
|
-
return `'${arg.variadic ? "*" : ""}:${desc}:${action}'`;
|
|
23412
23011
|
};
|
|
23413
|
-
const generateFunction = (descriptor, parentPath, lines) => {
|
|
23012
|
+
const generateFunction$1 = (descriptor, parentPath, lines, helperName) => {
|
|
23414
23013
|
const currentPath = [...parentPath, descriptor.name];
|
|
23415
|
-
const funcName = `_${currentPath.map(
|
|
23416
|
-
lines.push(`${funcName}()
|
|
23417
|
-
|
|
23418
|
-
|
|
23419
|
-
|
|
23420
|
-
|
|
23421
|
-
|
|
23422
|
-
|
|
23423
|
-
|
|
23424
|
-
|
|
23425
|
-
|
|
23426
|
-
|
|
23427
|
-
|
|
23014
|
+
const funcName = `_${currentPath.map(sanitizeFunctionName).join("_")}`;
|
|
23015
|
+
lines.push(`${funcName}()`);
|
|
23016
|
+
lines.push(`{`);
|
|
23017
|
+
lines.push(` local cur prev words cword i`);
|
|
23018
|
+
lines.push(parentPath.length === 0 ? ` local _command_index=0` : ` local _command_index="$1"`);
|
|
23019
|
+
lines.push(` _init_completion -n "$COMP_WORDBREAKS" || return`);
|
|
23020
|
+
if (parentPath.length === 0) lines.push(` local _comp_word="$2"`);
|
|
23021
|
+
lines.push(``);
|
|
23022
|
+
const flagsWithValues = descriptor.flags.filter(takesSeparateValue);
|
|
23023
|
+
if (flagsWithValues.length > 0) {
|
|
23024
|
+
lines.push(` # Flag value completions`);
|
|
23025
|
+
lines.push(` case "$prev" in`);
|
|
23026
|
+
for (const flag of flagsWithValues) {
|
|
23027
|
+
const longNames = [`--${flag.name}`];
|
|
23028
|
+
for (const alias of flag.aliases) longNames.push(alias.length === 1 ? `-${alias}` : `--${alias}`);
|
|
23029
|
+
const completion = flagValueCompletion(flag.type, helperName);
|
|
23030
|
+
if (completion) {
|
|
23031
|
+
lines.push(` ${longNames.join("|")})`);
|
|
23032
|
+
lines.push(` ${completion}`);
|
|
23033
|
+
lines.push(` return`);
|
|
23034
|
+
lines.push(` ;;`);
|
|
23035
|
+
}
|
|
23036
|
+
}
|
|
23037
|
+
lines.push(` esac`);
|
|
23428
23038
|
lines.push(``);
|
|
23429
|
-
|
|
23430
|
-
|
|
23431
|
-
|
|
23432
|
-
|
|
23433
|
-
|
|
23434
|
-
|
|
23435
|
-
|
|
23436
|
-
|
|
23437
|
-
|
|
23039
|
+
}
|
|
23040
|
+
if (descriptor.subcommands.length > 0) {
|
|
23041
|
+
lines.push(` # Subcommand dispatch`);
|
|
23042
|
+
lines.push(` local cmd _skip_next=0`);
|
|
23043
|
+
lines.push(` for ((i = _command_index + 1; i < cword; i++)); do`);
|
|
23044
|
+
lines.push(` if (( _skip_next )); then`);
|
|
23045
|
+
lines.push(` _skip_next=0`);
|
|
23046
|
+
lines.push(` continue`);
|
|
23047
|
+
lines.push(` fi`);
|
|
23048
|
+
lines.push(` case "\${words[i]}" in`);
|
|
23049
|
+
for (const flag of descriptor.flags) {
|
|
23050
|
+
if (!takesSeparateValue(flag)) continue;
|
|
23051
|
+
const forms = flagNamesForWordlist(flag);
|
|
23052
|
+
lines.push(` ${forms.join("|")}) _skip_next=1 ;;`);
|
|
23053
|
+
lines.push(` ${forms.map((form) => `${form}=*`).join("|")}) ;;`);
|
|
23438
23054
|
}
|
|
23439
|
-
|
|
23440
|
-
|
|
23441
|
-
|
|
23055
|
+
for (const sub of descriptor.subcommands) {
|
|
23056
|
+
const subFuncName = `_${[...currentPath, sub.name].map(sanitizeFunctionName).join("_")}`;
|
|
23057
|
+
lines.push(` ${sub.name})`);
|
|
23058
|
+
lines.push(` ${subFuncName} "$i"`);
|
|
23059
|
+
lines.push(` return`);
|
|
23060
|
+
lines.push(` ;;`);
|
|
23061
|
+
}
|
|
23062
|
+
lines.push(` esac`);
|
|
23063
|
+
lines.push(` done`);
|
|
23442
23064
|
lines.push(``);
|
|
23443
|
-
|
|
23065
|
+
}
|
|
23066
|
+
buildFlagGroupDeclarations(descriptor.flags, lines);
|
|
23067
|
+
if (descriptor.flags.length > 0 || descriptor.subcommands.length > 0) {
|
|
23068
|
+
lines.push(` # Complete flags (filtered) and subcommands`);
|
|
23069
|
+
lines.push(` if [[ "$cur" == -* ]]; then`);
|
|
23070
|
+
if (descriptor.flags.length > 0) lines.push(` COMPREPLY=( $(compgen -W "$_filtered_flags" -- "$cur") )`);
|
|
23071
|
+
lines.push(` return`);
|
|
23072
|
+
lines.push(` fi`);
|
|
23444
23073
|
lines.push(``);
|
|
23445
|
-
|
|
23446
|
-
|
|
23447
|
-
|
|
23448
|
-
|
|
23449
|
-
|
|
23450
|
-
|
|
23451
|
-
|
|
23452
|
-
|
|
23453
|
-
|
|
23454
|
-
|
|
23455
|
-
|
|
23074
|
+
}
|
|
23075
|
+
const argsWithCompletions = descriptor.arguments.flatMap((argument, index) => {
|
|
23076
|
+
const completion = argCompletion(argument.type, helperName);
|
|
23077
|
+
return completion === void 0 ? [] : [{
|
|
23078
|
+
argument,
|
|
23079
|
+
completion,
|
|
23080
|
+
index
|
|
23081
|
+
}];
|
|
23082
|
+
});
|
|
23083
|
+
if (argsWithCompletions.length > 0) {
|
|
23084
|
+
lines.push(` # Positional argument completions`);
|
|
23085
|
+
lines.push(` local _position=0 _skip_next=0 _end_of_options=0`);
|
|
23086
|
+
lines.push(` for ((i = _command_index + 1; i < cword; i++)); do`);
|
|
23087
|
+
lines.push(` if (( _skip_next )); then`);
|
|
23088
|
+
lines.push(` _skip_next=0`);
|
|
23089
|
+
lines.push(` continue`);
|
|
23090
|
+
lines.push(` fi`);
|
|
23091
|
+
lines.push(` if (( _end_of_options )); then`);
|
|
23092
|
+
lines.push(` ((_position += 1))`);
|
|
23093
|
+
lines.push(` continue`);
|
|
23094
|
+
lines.push(` fi`);
|
|
23095
|
+
lines.push(` case "\${words[i]}" in`);
|
|
23096
|
+
lines.push(` --) _end_of_options=1 ;;`);
|
|
23097
|
+
for (const flag of descriptor.flags) {
|
|
23098
|
+
const forms = flagNamesForWordlist(flag);
|
|
23099
|
+
if (!takesSeparateValue(flag)) lines.push(` ${forms.join("|")}) ;;`);
|
|
23100
|
+
else {
|
|
23101
|
+
lines.push(` ${forms.join("|")}) _skip_next=1 ;;`);
|
|
23102
|
+
lines.push(` ${forms.map((form) => `${form}=*`).join("|")}) ;;`);
|
|
23103
|
+
}
|
|
23104
|
+
}
|
|
23105
|
+
lines.push(` -*) ;;`);
|
|
23106
|
+
lines.push(` *) ((_position += 1)) ;;`);
|
|
23107
|
+
lines.push(` esac`);
|
|
23108
|
+
lines.push(` done`);
|
|
23109
|
+
lines.push(` case "$_position" in`);
|
|
23110
|
+
for (const { argument, completion, index } of argsWithCompletions) {
|
|
23111
|
+
if (argument.variadic) continue;
|
|
23112
|
+
lines.push(` ${index})`);
|
|
23113
|
+
lines.push(` ${completion}`);
|
|
23114
|
+
lines.push(` return`);
|
|
23115
|
+
lines.push(` ;;`);
|
|
23456
23116
|
}
|
|
23457
|
-
lines.push(` esac`);
|
|
23458
|
-
lines.push(` ;;`);
|
|
23459
23117
|
lines.push(` esac`);
|
|
23460
|
-
|
|
23461
|
-
|
|
23462
|
-
|
|
23463
|
-
|
|
23464
|
-
|
|
23465
|
-
lines.push(`
|
|
23466
|
-
lines.push(` specs=(`);
|
|
23467
|
-
for (const spec of allSpecs) lines.push(` ${spec}`);
|
|
23468
|
-
lines.push(` )`);
|
|
23469
|
-
lines.push(` _arguments "\${specs[@]}"`);
|
|
23118
|
+
const variadic = argsWithCompletions.find(({ argument }) => argument.variadic);
|
|
23119
|
+
if (variadic !== void 0) {
|
|
23120
|
+
lines.push(` if (( _position >= ${variadic.index} )); then`);
|
|
23121
|
+
lines.push(` ${variadic.completion}`);
|
|
23122
|
+
lines.push(` return`);
|
|
23123
|
+
lines.push(` fi`);
|
|
23470
23124
|
}
|
|
23125
|
+
} else if (descriptor.subcommands.length > 0) {
|
|
23126
|
+
const subNames = descriptor.subcommands.map((s) => s.name);
|
|
23127
|
+
lines.push(` COMPREPLY=( $(compgen -W '${subNames.join(" ")}' -- "$cur") )`);
|
|
23471
23128
|
}
|
|
23472
23129
|
lines.push(`}`);
|
|
23473
23130
|
lines.push(``);
|
|
23474
|
-
for (const sub of descriptor.subcommands) generateFunction(sub, currentPath, lines);
|
|
23131
|
+
for (const sub of descriptor.subcommands) generateFunction$1(sub, currentPath, lines, helperName);
|
|
23475
23132
|
};
|
|
23476
23133
|
/**
|
|
23477
23134
|
* @internal
|
|
23478
23135
|
*/
|
|
23479
|
-
const generate$
|
|
23136
|
+
const generate$4 = (executableName, descriptor) => {
|
|
23480
23137
|
const lines = [];
|
|
23481
|
-
const safeName =
|
|
23482
|
-
|
|
23483
|
-
lines.push(`###-begin-${executableName}-completions-###`);
|
|
23138
|
+
const safeName = sanitizeFunctionName(executableName);
|
|
23139
|
+
const helperName = `_${safeName}--choices`;
|
|
23140
|
+
lines.push(`###-begin-${escapeForBash(executableName)}-completions-###`);
|
|
23484
23141
|
lines.push(`#`);
|
|
23485
|
-
lines.push(`# Static completion script for
|
|
23142
|
+
lines.push(`# Static completion script for Bash`);
|
|
23486
23143
|
lines.push(`#`);
|
|
23487
23144
|
lines.push(`# Installation:`);
|
|
23488
|
-
lines.push(`# ${executableName} --completions
|
|
23489
|
-
lines.push(`# then add ~/.zsh/completions to your fpath`);
|
|
23145
|
+
lines.push(`# ${escapeForBash(executableName)} --completions bash >> ~/.bashrc`);
|
|
23490
23146
|
lines.push(`#`);
|
|
23491
23147
|
lines.push(``);
|
|
23492
|
-
|
|
23493
|
-
lines.push(
|
|
23494
|
-
lines.push(`
|
|
23495
|
-
lines.push(`
|
|
23496
|
-
lines.push(`
|
|
23497
|
-
lines.push(`
|
|
23148
|
+
lines.push(`if ! type _init_completion &>/dev/null; then`);
|
|
23149
|
+
lines.push(` _init_completion()`);
|
|
23150
|
+
lines.push(` {`);
|
|
23151
|
+
lines.push(` COMPREPLY=()`);
|
|
23152
|
+
lines.push(` local _i _j=0 _piece _line="$COMP_LINE"`);
|
|
23153
|
+
lines.push(` words=("\${COMP_WORDS[0]}")`);
|
|
23154
|
+
lines.push(` cword=0`);
|
|
23155
|
+
lines.push(` _line="\${_line#*"\${COMP_WORDS[0]}"}"`);
|
|
23156
|
+
lines.push(` for ((_i = 1; _i < \${#COMP_WORDS[@]}; _i++)); do`);
|
|
23157
|
+
lines.push(` _piece="\${COMP_WORDS[_i]}"`);
|
|
23158
|
+
lines.push(` if [[ "$_line" == [[:blank:]]* ]]; then`);
|
|
23159
|
+
lines.push(` ((_j++))`);
|
|
23160
|
+
lines.push(` words[_j]="$_piece"`);
|
|
23161
|
+
lines.push(` else`);
|
|
23162
|
+
lines.push(` words[_j]="\${words[_j]}$_piece"`);
|
|
23163
|
+
lines.push(` fi`);
|
|
23164
|
+
lines.push(` ((_i == COMP_CWORD)) && cword=$_j`);
|
|
23165
|
+
lines.push(` _line="\${_line#*"$_piece"}"`);
|
|
23166
|
+
lines.push(` done`);
|
|
23167
|
+
lines.push(` cur="\${words[cword]}"`);
|
|
23168
|
+
lines.push(` prev=""`);
|
|
23169
|
+
lines.push(` ((cword > 0)) && prev="\${words[cword-1]}"`);
|
|
23170
|
+
lines.push(` return 0`);
|
|
23171
|
+
lines.push(` }`);
|
|
23498
23172
|
lines.push(`fi`);
|
|
23499
|
-
lines.push(
|
|
23173
|
+
lines.push(``);
|
|
23174
|
+
choicesHelper(helperName, lines);
|
|
23175
|
+
generateFunction$1(descriptor, [], lines, helperName);
|
|
23176
|
+
lines.push(`complete -F _${safeName} ${escapeForBash(executableName)}`);
|
|
23177
|
+
lines.push(`###-end-${escapeForBash(executableName)}-completions-###`);
|
|
23500
23178
|
return lines.join("\n");
|
|
23501
23179
|
};
|
|
23502
23180
|
//#endregion
|
|
23503
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
23504
|
-
|
|
23505
|
-
|
|
23506
|
-
|
|
23507
|
-
* is the low-level script generation surface used by the unstable CLI package
|
|
23508
|
-
* and by the built-in completions global flag.
|
|
23509
|
-
*
|
|
23510
|
-
* @stability unstable
|
|
23511
|
-
* @since 4.0.0
|
|
23512
|
-
*/
|
|
23181
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/internal/completions/fish.js
|
|
23182
|
+
const escapeFishString = (s) => s.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
|
23183
|
+
/** Escape choices for Fish's second expansion of `complete -a`. */
|
|
23184
|
+
const escapeFishChoice = (s) => escapeFishString(s.replace(/[^A-Za-z0-9_.,/@%+-]/gu, "\\$&"));
|
|
23513
23185
|
/**
|
|
23514
|
-
*
|
|
23515
|
-
*
|
|
23516
|
-
* **When to use**
|
|
23517
|
-
*
|
|
23518
|
-
* Use when you need an installable completion script from an existing
|
|
23519
|
-
* `CommandDescriptor`.
|
|
23520
|
-
*
|
|
23521
|
-
* **Details**
|
|
23522
|
-
*
|
|
23523
|
-
* Dispatches by `shell` to Bash, Zsh, Fish, or PowerShell generation and
|
|
23524
|
-
* returns a static script string for `executableName`.
|
|
23525
|
-
*
|
|
23526
|
-
* @see {@link Shell} for supported shell names
|
|
23527
|
-
* @see {@link CommandDescriptor} for the command shape used by completion generation
|
|
23186
|
+
* Build a Fish condition that checks the current subcommand context.
|
|
23528
23187
|
*
|
|
23529
|
-
*
|
|
23530
|
-
*
|
|
23531
|
-
*
|
|
23188
|
+
* For root-level completions with subcommands: `__fish_use_subcommand`
|
|
23189
|
+
* For nested commands: verify the full parent path is active AND none of its
|
|
23190
|
+
* child subcommands have been entered yet.
|
|
23532
23191
|
*/
|
|
23533
|
-
const
|
|
23534
|
-
|
|
23535
|
-
|
|
23536
|
-
|
|
23537
|
-
case "fish": return generate$3(executableName, descriptor);
|
|
23538
|
-
case "powershell": return generate$2(executableName, descriptor);
|
|
23192
|
+
const subcommandCondition = (parentPath, childSubcommandNames) => {
|
|
23193
|
+
if (parentPath.length === 0) {
|
|
23194
|
+
if (childSubcommandNames.length > 0) return `__fish_use_subcommand`;
|
|
23195
|
+
return ``;
|
|
23539
23196
|
}
|
|
23197
|
+
const parentCondition = parentPath.map((parent) => `__fish_seen_subcommand_from ${parent}`).join("; and ");
|
|
23198
|
+
if (childSubcommandNames.length > 0) return `${parentCondition}; and not __fish_seen_subcommand_from ${childSubcommandNames.join(" ")}`;
|
|
23199
|
+
return parentCondition;
|
|
23540
23200
|
};
|
|
23541
|
-
//#endregion
|
|
23542
|
-
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/Flag.js
|
|
23543
23201
|
/**
|
|
23544
|
-
*
|
|
23545
|
-
*
|
|
23546
|
-
*
|
|
23547
|
-
*
|
|
23548
|
-
* ```ts import.meta.vitest
|
|
23549
|
-
* import { Flag } from "effect/cli"
|
|
23550
|
-
*
|
|
23551
|
-
* const verboseFlag = Flag.Boolean("verbose")
|
|
23552
|
-
* // Usage: --verbose (true) or --no-verbose (false)
|
|
23553
|
-
* // Omission fails unless the flag is made optional or given a fallback.
|
|
23554
|
-
* verboseFlag.kind // => "flag"
|
|
23555
|
-
* ```
|
|
23556
|
-
*
|
|
23557
|
-
* @stability unstable
|
|
23558
|
-
* @category constructors
|
|
23559
|
-
* @since 4.0.0
|
|
23560
|
-
*/
|
|
23561
|
-
const Boolean = (name) => Boolean$1(flagKind, name);
|
|
23562
|
-
/**
|
|
23563
|
-
* Constructs option parameters that represent a choice between several inputs.
|
|
23564
|
-
* Each tuple maps a string flag value to an associated typed value.
|
|
23565
|
-
*
|
|
23566
|
-
* **Example** (Creating flag choices with values)
|
|
23567
|
-
*
|
|
23568
|
-
* ```ts import.meta.vitest
|
|
23569
|
-
* import { Flag } from "effect/cli"
|
|
23570
|
-
*
|
|
23571
|
-
* // simple enum like choice mapping directly to string union
|
|
23572
|
-
* const color = Flag.Literals("color", ["red", "green", "blue"])
|
|
23573
|
-
*
|
|
23574
|
-
* // choice with custom value mapping
|
|
23575
|
-
* const logLevel = Flag.ChoiceWithValue("log-level", [
|
|
23576
|
-
* ["debug", "Debug" as const],
|
|
23577
|
-
* ["info", "Info" as const],
|
|
23578
|
-
* ["error", "Error" as const]
|
|
23579
|
-
* ])
|
|
23580
|
-
* const kinds = [color.kind, logLevel.kind] // => ["flag", "flag"]
|
|
23581
|
-
* ```
|
|
23582
|
-
*
|
|
23583
|
-
* @stability unstable
|
|
23584
|
-
* @category constructors
|
|
23585
|
-
* @since 4.0.0
|
|
23586
|
-
*/
|
|
23587
|
-
const ChoiceWithValue = (name, choices) => ChoiceWithValue$1(flagKind, name, choices);
|
|
23588
|
-
/**
|
|
23589
|
-
* Adds an alias to a flag, allowing it to be referenced by multiple names.
|
|
23590
|
-
*
|
|
23591
|
-
* **Example** (Adding flag aliases)
|
|
23592
|
-
*
|
|
23593
|
-
* ```ts import.meta.vitest
|
|
23594
|
-
* import { Flag } from "effect/cli"
|
|
23595
|
-
*
|
|
23596
|
-
* // Flag can be used as both --verbose and -v
|
|
23597
|
-
* const verboseFlag = Flag.Boolean("verbose").pipe(
|
|
23598
|
-
* Flag.withAlias("v")
|
|
23599
|
-
* )
|
|
23600
|
-
*
|
|
23601
|
-
* // Multiple aliases can be chained
|
|
23602
|
-
* const helpFlag = Flag.Boolean("help").pipe(
|
|
23603
|
-
* Flag.withAlias("h"),
|
|
23604
|
-
* Flag.withAlias("?")
|
|
23605
|
-
* )
|
|
23606
|
-
* const kinds = [verboseFlag.kind, helpFlag.kind] // => ["flag", "flag"]
|
|
23607
|
-
* ```
|
|
23608
|
-
*
|
|
23609
|
-
* @stability unstable
|
|
23610
|
-
* @category aliasing
|
|
23611
|
-
* @since 4.0.0
|
|
23202
|
+
* Build a __fish_contains_opt condition that checks whether any form of this
|
|
23203
|
+
* flag has already been typed. Returns the condition string without wrapping
|
|
23204
|
+
* quotes (the caller adds those).
|
|
23612
23205
|
*/
|
|
23613
|
-
const
|
|
23206
|
+
const flagContainsOptCondition = (flag) => {
|
|
23207
|
+
const optArgs = [];
|
|
23208
|
+
for (const alias of flag.aliases) if (alias.length === 1) optArgs.push(`-s ${alias}`);
|
|
23209
|
+
optArgs.push(flag.name);
|
|
23210
|
+
for (const alias of flag.aliases) if (alias.length > 1) optArgs.push(alias);
|
|
23211
|
+
if (flag.type._tag === "Boolean") optArgs.push(`no-${flag.name}`);
|
|
23212
|
+
return `not __fish_contains_opt ${optArgs.join(" ")}`;
|
|
23213
|
+
};
|
|
23214
|
+
/** Hide used value flags without suppressing their value completions. */
|
|
23215
|
+
const valueFlagDedupCondition = (flag) => {
|
|
23216
|
+
const forms = [`--${flag.name}`];
|
|
23217
|
+
for (const alias of flag.aliases) forms.push(alias.length === 1 ? `-${alias}` : `--${alias}`);
|
|
23218
|
+
return `begin; ${flagContainsOptCondition(flag)}; or contains -- (commandline -poc)[-1] ${forms.join(" ")}; end`;
|
|
23219
|
+
};
|
|
23220
|
+
const flagCompletionArgs = (flag) => {
|
|
23221
|
+
const args = [`-l ${flag.name}`];
|
|
23222
|
+
for (const alias of flag.aliases) if (alias.length === 1) args.push(`-s ${alias}`);
|
|
23223
|
+
else args.push(`-l ${alias}`);
|
|
23224
|
+
if (flag.description) args.push(`-d '${escapeFishString(flag.description)}'`);
|
|
23225
|
+
const valueArgs = takesSeparateValue(flag) ? flagValueArgs(flag.type) : void 0;
|
|
23226
|
+
if (valueArgs) args.push(valueArgs);
|
|
23227
|
+
return args;
|
|
23228
|
+
};
|
|
23229
|
+
const flagValueArgs = (type) => {
|
|
23230
|
+
switch (type._tag) {
|
|
23231
|
+
case "Boolean": return;
|
|
23232
|
+
case "Choice": return `-r -f -a '${type.values.map(escapeFishChoice).join(" ")}'`;
|
|
23233
|
+
case "Path":
|
|
23234
|
+
if (type.pathType === "directory") return `-r -F`;
|
|
23235
|
+
return `-r -F`;
|
|
23236
|
+
default: return `-r -f`;
|
|
23237
|
+
}
|
|
23238
|
+
};
|
|
23239
|
+
const argValueArgs = (type) => {
|
|
23240
|
+
switch (type._tag) {
|
|
23241
|
+
case "Choice": return `-r -f -a '${type.values.map(escapeFishChoice).join(" ")}'`;
|
|
23242
|
+
case "Path": return `-r -F`;
|
|
23243
|
+
default: return;
|
|
23244
|
+
}
|
|
23245
|
+
};
|
|
23246
|
+
const generateCompletions = (executableName, descriptor, parentPath, lines) => {
|
|
23247
|
+
const allSubNames = descriptor.subcommands.map((s) => s.name);
|
|
23248
|
+
const condition = subcommandCondition(parentPath, allSubNames);
|
|
23249
|
+
const conditionArg = condition ? `-n '${condition}'` : ``;
|
|
23250
|
+
if (!descriptor.arguments.some((a) => a.type._tag === "Path")) {
|
|
23251
|
+
const parts = [`complete -c ${executableName}`];
|
|
23252
|
+
if (conditionArg) parts.push(conditionArg);
|
|
23253
|
+
parts.push(`-f`);
|
|
23254
|
+
lines.push(parts.join(" "));
|
|
23255
|
+
}
|
|
23256
|
+
for (const sub of descriptor.subcommands) {
|
|
23257
|
+
const parts = [`complete -c ${executableName}`];
|
|
23258
|
+
if (conditionArg) parts.push(conditionArg);
|
|
23259
|
+
parts.push(`-f -a '${escapeFishString(sub.name)}'`);
|
|
23260
|
+
if (sub.description) parts.push(`-d '${escapeFishString(sub.description)}'`);
|
|
23261
|
+
lines.push(parts.join(" "));
|
|
23262
|
+
}
|
|
23263
|
+
for (const flag of descriptor.flags) {
|
|
23264
|
+
const dedup = takesSeparateValue(flag) ? valueFlagDedupCondition(flag) : flagContainsOptCondition(flag);
|
|
23265
|
+
const flagCondition = condition ? `${condition}; and ${dedup}` : dedup;
|
|
23266
|
+
const flagCondArg = flagCondition ? `-n '${flagCondition}'` : ``;
|
|
23267
|
+
const parts = [`complete -c ${executableName}`];
|
|
23268
|
+
if (flagCondArg) parts.push(flagCondArg);
|
|
23269
|
+
parts.push(...flagCompletionArgs(flag));
|
|
23270
|
+
lines.push(parts.join(" "));
|
|
23271
|
+
if (flag.type._tag === "Boolean") {
|
|
23272
|
+
const negParts = [`complete -c ${executableName}`];
|
|
23273
|
+
if (flagCondArg) negParts.push(flagCondArg);
|
|
23274
|
+
negParts.push(`-l no-${flag.name}`);
|
|
23275
|
+
if (flag.description) negParts.push(`-d '${escapeFishString(`Disable ${flag.name}`)}'`);
|
|
23276
|
+
lines.push(negParts.join(" "));
|
|
23277
|
+
}
|
|
23278
|
+
}
|
|
23279
|
+
if (descriptor.flags.length > 0) {
|
|
23280
|
+
const notDash = `not string match -q -- "-*" (commandline -ct)`;
|
|
23281
|
+
const bareBase = condition ? `${condition}; and ${notDash}` : notDash;
|
|
23282
|
+
for (const flag of descriptor.flags) {
|
|
23283
|
+
const bareCondition = `${bareBase}; and ${flagContainsOptCondition(flag)}`;
|
|
23284
|
+
const isBoolean = flag.type._tag === "Boolean";
|
|
23285
|
+
const parts = [`complete -c ${executableName}`];
|
|
23286
|
+
parts.push(`-n '${bareCondition}'`);
|
|
23287
|
+
parts.push(`-f -a '--${flag.name}'`);
|
|
23288
|
+
if (flag.description) parts.push(`-d '${escapeFishString(flag.description)}'`);
|
|
23289
|
+
lines.push(parts.join(" "));
|
|
23290
|
+
if (isBoolean) {
|
|
23291
|
+
const negParts = [`complete -c ${executableName}`];
|
|
23292
|
+
negParts.push(`-n '${bareCondition}'`);
|
|
23293
|
+
negParts.push(`-f -a '--no-${flag.name}'`);
|
|
23294
|
+
if (flag.description) negParts.push(`-d '${escapeFishString(`Disable ${flag.name}`)}'`);
|
|
23295
|
+
lines.push(negParts.join(" "));
|
|
23296
|
+
}
|
|
23297
|
+
}
|
|
23298
|
+
}
|
|
23299
|
+
for (const arg of descriptor.arguments) {
|
|
23300
|
+
const valueArg = argValueArgs(arg.type);
|
|
23301
|
+
if (valueArg) {
|
|
23302
|
+
const parts = [`complete -c ${executableName}`];
|
|
23303
|
+
if (conditionArg) parts.push(conditionArg);
|
|
23304
|
+
parts.push(valueArg);
|
|
23305
|
+
if (arg.description) parts.push(`-d '${escapeFishString(arg.description)}'`);
|
|
23306
|
+
lines.push(parts.join(" "));
|
|
23307
|
+
}
|
|
23308
|
+
}
|
|
23309
|
+
for (const sub of descriptor.subcommands) generateCompletions(executableName, sub, [...parentPath, sub.name], lines);
|
|
23310
|
+
};
|
|
23614
23311
|
/**
|
|
23615
|
-
*
|
|
23616
|
-
*
|
|
23617
|
-
* **Example** (Adding help descriptions)
|
|
23618
|
-
*
|
|
23619
|
-
* ```ts import.meta.vitest
|
|
23620
|
-
* import { Flag } from "effect/cli"
|
|
23621
|
-
*
|
|
23622
|
-
* const portFlag = Flag.Int("port").pipe(
|
|
23623
|
-
* Flag.withDescription("The port number to listen on")
|
|
23624
|
-
* )
|
|
23625
|
-
*
|
|
23626
|
-
* const configFlag = Flag.File("config").pipe(
|
|
23627
|
-
* Flag.withDescription("Path to the configuration file")
|
|
23628
|
-
* )
|
|
23629
|
-
* const kinds = [portFlag.kind, configFlag.kind] // => ["flag", "flag"]
|
|
23630
|
-
* ```
|
|
23631
|
-
*
|
|
23632
|
-
* @stability unstable
|
|
23633
|
-
* @category metadata
|
|
23634
|
-
* @since 4.0.0
|
|
23312
|
+
* @internal
|
|
23635
23313
|
*/
|
|
23636
|
-
const
|
|
23314
|
+
const generate$3 = (executableName, descriptor) => {
|
|
23315
|
+
const lines = [];
|
|
23316
|
+
lines.push(`###-begin-${executableName}-completions-###`);
|
|
23317
|
+
lines.push(`#`);
|
|
23318
|
+
lines.push(`# Static completion script for Fish`);
|
|
23319
|
+
lines.push(`#`);
|
|
23320
|
+
lines.push(`# Installation:`);
|
|
23321
|
+
lines.push(`# ${executableName} --completions fish > ~/.config/fish/completions/${executableName}.fish`);
|
|
23322
|
+
lines.push(`#`);
|
|
23323
|
+
lines.push(``);
|
|
23324
|
+
generateCompletions(executableName, descriptor, [], lines);
|
|
23325
|
+
lines.push(``);
|
|
23326
|
+
lines.push(`###-end-${executableName}-completions-###`);
|
|
23327
|
+
return lines.join("\n");
|
|
23328
|
+
};
|
|
23329
|
+
//#endregion
|
|
23330
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/internal/completions/powershell.js
|
|
23637
23331
|
/**
|
|
23638
|
-
*
|
|
23639
|
-
*
|
|
23640
|
-
*
|
|
23641
|
-
*
|
|
23642
|
-
* The metavar is displayed in usage text to indicate what value the user should
|
|
23643
|
-
* provide. For example, `--output FILE` shows `FILE` as the metavar.
|
|
23644
|
-
*
|
|
23645
|
-
* **Example** (Setting metavars)
|
|
23646
|
-
*
|
|
23647
|
-
* ```ts import.meta.vitest
|
|
23648
|
-
* import { Flag } from "effect/cli"
|
|
23649
|
-
*
|
|
23650
|
-
* const databaseFlag = Flag.String("database-url").pipe(
|
|
23651
|
-
* Flag.withMetavar("URL"),
|
|
23652
|
-
* Flag.withDescription("Database connection URL")
|
|
23653
|
-
* )
|
|
23654
|
-
* // In help: --database-url URL
|
|
23655
|
-
*
|
|
23656
|
-
* const timeoutFlag = Flag.Int("timeout").pipe(
|
|
23657
|
-
* Flag.withMetavar("SECONDS")
|
|
23658
|
-
* )
|
|
23659
|
-
* // In help: --timeout SECONDS
|
|
23660
|
-
* const kinds = [databaseFlag.kind, timeoutFlag.kind] // => ["flag", "flag"]
|
|
23661
|
-
* ```
|
|
23662
|
-
*
|
|
23663
|
-
* @stability unstable
|
|
23664
|
-
* @category metadata
|
|
23665
|
-
* @since 4.0.0
|
|
23332
|
+
* Encode non-ASCII and control characters as `[char]` code units. Windows
|
|
23333
|
+
* PowerShell 5.1 can misread BOM-less UTF-8 as ANSI, turning some bytes into
|
|
23334
|
+
* PowerShell quote delimiters.
|
|
23666
23335
|
*/
|
|
23667
|
-
const
|
|
23336
|
+
const quotePs = (s) => {
|
|
23337
|
+
const parts = [];
|
|
23338
|
+
let literal = "";
|
|
23339
|
+
for (let i = 0; i < s.length; i++) {
|
|
23340
|
+
const code = s.charCodeAt(i);
|
|
23341
|
+
if (code >= 32 && code < 128) {
|
|
23342
|
+
literal += s[i] === "'" ? "''" : s[i];
|
|
23343
|
+
continue;
|
|
23344
|
+
}
|
|
23345
|
+
if (literal !== "" || parts.length === 0) parts.push(`'${literal}'`);
|
|
23346
|
+
literal = "";
|
|
23347
|
+
parts.push(`[char]0x${code.toString(16).toUpperCase().padStart(4, "0")}`);
|
|
23348
|
+
}
|
|
23349
|
+
if (literal !== "" || parts.length === 0) parts.push(`'${literal}'`);
|
|
23350
|
+
return parts.length === 1 ? parts[0] : `(${parts.join(" + ")})`;
|
|
23351
|
+
};
|
|
23352
|
+
const psArray = (items) => `@(${items.map(quotePs).join(", ")})`;
|
|
23353
|
+
const psOptional = (s) => s ? quotePs(s) : "$null";
|
|
23354
|
+
const sanitize$1 = (s) => s.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
23355
|
+
const flagForms = (flag) => [`--${flag.name}`, ...flag.aliases.map((alias) => alias.length === 1 ? `-${alias}` : `--${alias}`)];
|
|
23356
|
+
const valueFields = (type) => `values = ${psArray(type._tag === "Choice" ? type.values : [])}; pathType = ${type._tag === "Path" ? quotePs(type.pathType) : "$null"}`;
|
|
23357
|
+
const flagEntry = (flag) => `@{ name = ${quotePs(flag.name)}; forms = ${psArray(flagForms(flag))}; takesValue = $${flag.type._tag !== "Boolean"}; ` + (flag.optionalValue === true ? `optionalValue = $true; ` : "") + `${valueFields(flag.type)}; description = ${psOptional(flag.description)} }`;
|
|
23358
|
+
const argumentEntry = (argument) => `@{ name = ${quotePs(argument.name)}; variadic = $${argument.variadic}; ${valueFields(argument.type)}; description = ${psOptional(argument.description)} }`;
|
|
23359
|
+
const pushList = (lines, field, entries) => {
|
|
23360
|
+
if (entries.length === 0) {
|
|
23361
|
+
lines.push(` ${field} = @()`);
|
|
23362
|
+
return;
|
|
23363
|
+
}
|
|
23364
|
+
lines.push(` ${field} = @(`);
|
|
23365
|
+
for (const entry of entries) lines.push(` ${entry}`);
|
|
23366
|
+
lines.push(` )`);
|
|
23367
|
+
};
|
|
23668
23368
|
/**
|
|
23669
|
-
*
|
|
23670
|
-
*
|
|
23671
|
-
*
|
|
23672
|
-
*
|
|
23673
|
-
* ```ts import.meta.vitest
|
|
23674
|
-
* import { Effect, FileSystem, Layer, Option, Path, Stdio, Terminal } from "effect"
|
|
23675
|
-
* import { Flag } from "effect/cli"
|
|
23676
|
-
* import { ChildProcessSpawner } from "effect/process"
|
|
23677
|
-
*
|
|
23678
|
-
* const CliTestLayer = Layer.mergeAll(
|
|
23679
|
-
* FileSystem.layerNoop({}),
|
|
23680
|
-
* Path.layer,
|
|
23681
|
-
* Stdio.layerTest({}),
|
|
23682
|
-
* Layer.succeed(Terminal.Terminal, Terminal.make({
|
|
23683
|
-
* columns: Effect.succeed(80),
|
|
23684
|
-
* rows: Effect.succeed(24),
|
|
23685
|
-
* readInput: Effect.die("unused"),
|
|
23686
|
-
* readLine: Effect.die("unused"),
|
|
23687
|
-
* display: () => Effect.void
|
|
23688
|
-
* })),
|
|
23689
|
-
* Layer.succeed(
|
|
23690
|
-
* ChildProcessSpawner.ChildProcessSpawner,
|
|
23691
|
-
* ChildProcessSpawner.make(() => Effect.die("unused"))
|
|
23692
|
-
* )
|
|
23693
|
-
* )
|
|
23694
|
-
*
|
|
23695
|
-
* const optionalPort = Flag.optional(Flag.Int("port"))
|
|
23696
|
-
*
|
|
23697
|
-
* const program = Effect.gen(function*() {
|
|
23698
|
-
* const [, port] = yield* optionalPort.parse({
|
|
23699
|
-
* arguments: [],
|
|
23700
|
-
* flags: { "port": ["4000"] }
|
|
23701
|
-
* })
|
|
23702
|
-
* return port
|
|
23703
|
-
* })
|
|
23704
|
-
*
|
|
23705
|
-
* await Effect.runPromise(program.pipe(Effect.provide(CliTestLayer))) // => Option.some(4000)
|
|
23706
|
-
* ```
|
|
23707
|
-
*
|
|
23708
|
-
* @stability unstable
|
|
23709
|
-
* @category optionality
|
|
23710
|
-
* @since 4.0.0
|
|
23369
|
+
* Emit one context per subcommand path. Subcommands are case-sensitive, so
|
|
23370
|
+
* contexts go in an ordinal hashtable instead of a hash literal, whose keys
|
|
23371
|
+
* ignore case.
|
|
23711
23372
|
*/
|
|
23712
|
-
const
|
|
23373
|
+
const generateContexts = (dataName, descriptor, path, lines, seen) => {
|
|
23374
|
+
const key = path.join(" ");
|
|
23375
|
+
if (seen.has(key)) return;
|
|
23376
|
+
seen.add(key);
|
|
23377
|
+
lines.push(`${dataName}[${quotePs(key)}] = @{`);
|
|
23378
|
+
pushList(lines, "subcommands", descriptor.subcommands.map((sub) => `@{ name = ${quotePs(sub.name)}; description = ${psOptional(sub.description)} }`));
|
|
23379
|
+
pushList(lines, "flags", descriptor.flags.map(flagEntry));
|
|
23380
|
+
pushList(lines, "arguments", descriptor.arguments.map(argumentEntry));
|
|
23381
|
+
lines.push(`}`);
|
|
23382
|
+
for (const sub of descriptor.subcommands) generateContexts(dataName, sub, [...path, sub.name], lines, seen);
|
|
23383
|
+
};
|
|
23713
23384
|
/**
|
|
23714
|
-
*
|
|
23715
|
-
*
|
|
23716
|
-
*
|
|
23717
|
-
*
|
|
23718
|
-
* ```ts import.meta.vitest
|
|
23719
|
-
* import { Flag } from "effect/cli"
|
|
23720
|
-
*
|
|
23721
|
-
* const portFlag = Flag.Int("port").pipe(
|
|
23722
|
-
* Flag.withDefault(8080)
|
|
23723
|
-
* )
|
|
23724
|
-
* // If --port is not provided, defaults to 8080
|
|
23725
|
-
*
|
|
23726
|
-
* const hostFlag = Flag.String("host").pipe(
|
|
23727
|
-
* Flag.withDefault("localhost")
|
|
23728
|
-
* )
|
|
23729
|
-
* // If --host is not provided, defaults to "localhost"
|
|
23730
|
-
* const kinds = [portFlag.kind, hostFlag.kind] // => ["flag", "flag"]
|
|
23731
|
-
* ```
|
|
23732
|
-
*
|
|
23733
|
-
* @stability unstable
|
|
23734
|
-
* @category optionality
|
|
23735
|
-
* @since 4.0.0
|
|
23385
|
+
* Replay the committed words with the CLI lexer and parser rules: `--`, short
|
|
23386
|
+
* flag clusters, inline values, boolean literals, negative numbers, and
|
|
23387
|
+
* subcommand selection by the first value only.
|
|
23736
23388
|
*/
|
|
23737
|
-
const
|
|
23389
|
+
const completer = (dataName) => String.raw` param($wordToComplete, $commandAst, $cursorPosition)
|
|
23390
|
+
|
|
23391
|
+
$spec = ${dataName}
|
|
23392
|
+
$results = [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new()
|
|
23393
|
+
$booleanLiterals = @('true', 'yes', 'on', '1', 'y', 'false', 'no', 'off', '0', 'n')
|
|
23394
|
+
|
|
23395
|
+
$index = {
|
|
23396
|
+
param($context)
|
|
23397
|
+
$lookup = [hashtable]::new([System.StringComparer]::Ordinal)
|
|
23398
|
+
foreach ($flag in $context.flags) {
|
|
23399
|
+
foreach ($form in $flag.forms) { $lookup[$form] = $flag }
|
|
23400
|
+
}
|
|
23401
|
+
$lookup
|
|
23402
|
+
}
|
|
23403
|
+
|
|
23404
|
+
$add = {
|
|
23405
|
+
param([string]$value, [string]$type, $tooltip, [string]$typed, [string]$textPrefix)
|
|
23406
|
+
if (-not $value.StartsWith($typed, [System.StringComparison]::OrdinalIgnoreCase)) { return }
|
|
23407
|
+
$text = $value
|
|
23408
|
+
if ($value -notmatch '^[\w./:%+=\\-]+$') { $text = "'" + ($value -replace "['\u2018-\u201b]", '$0$0') + "'" }
|
|
23409
|
+
$text = $textPrefix + $text
|
|
23410
|
+
$label = $value
|
|
23411
|
+
if (-not $label) { $label = $text }
|
|
23412
|
+
if (-not $tooltip) { $tooltip = $label }
|
|
23413
|
+
$results.Add([System.Management.Automation.CompletionResult]::new($text, $label, $type, $tooltip))
|
|
23414
|
+
}
|
|
23415
|
+
|
|
23416
|
+
$addValues = {
|
|
23417
|
+
param($entry, [string]$typed, [string]$textPrefix)
|
|
23418
|
+
foreach ($value in $entry.values) {
|
|
23419
|
+
if ($textPrefix -eq '' -and (& $optionLike $value)) { continue }
|
|
23420
|
+
& $add $value 'ParameterValue' $entry.description $typed $textPrefix
|
|
23421
|
+
}
|
|
23422
|
+
if ($entry.pathType) {
|
|
23423
|
+
foreach ($file in [System.Management.Automation.CompletionCompleters]::CompleteFilename($typed)) {
|
|
23424
|
+
if ($entry.pathType -eq 'directory' -and $file.ResultType -ne 'ProviderContainer') { continue }
|
|
23425
|
+
$results.Add([System.Management.Automation.CompletionResult]::new($textPrefix + $file.CompletionText, $file.ListItemText, $file.ResultType, $file.ToolTip))
|
|
23426
|
+
}
|
|
23427
|
+
}
|
|
23428
|
+
}
|
|
23429
|
+
|
|
23430
|
+
$addFlags = {
|
|
23431
|
+
param([string]$typed)
|
|
23432
|
+
foreach ($flag in $context.flags) {
|
|
23433
|
+
if ($used.ContainsKey($flag.name)) { continue }
|
|
23434
|
+
foreach ($form in $flag.forms) {
|
|
23435
|
+
& $add $form 'ParameterName' $flag.description $typed ''
|
|
23436
|
+
}
|
|
23437
|
+
if (-not $flag.takesValue) {
|
|
23438
|
+
$tooltip = $null
|
|
23439
|
+
if ($flag.description) { $tooltip = 'Disable ' + $flag.name }
|
|
23440
|
+
& $add ('--no-' + $flag.name) 'ParameterName' $tooltip $typed ''
|
|
23441
|
+
}
|
|
23442
|
+
}
|
|
23443
|
+
}
|
|
23444
|
+
|
|
23445
|
+
# As in the CLI lexer, nothing after '--' is an option, and negative numbers
|
|
23446
|
+
# and a lone '-' are values.
|
|
23447
|
+
$optionLike = {
|
|
23448
|
+
param([string]$word)
|
|
23449
|
+
-not $endOfOptions -and $word -match '^-.' -and $word -notmatch '^-(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$'
|
|
23450
|
+
}
|
|
23451
|
+
|
|
23452
|
+
# A typed value that has no candidates completes to itself, so the engine
|
|
23453
|
+
# does not fall back to listing files.
|
|
23454
|
+
$keepTyped = {
|
|
23455
|
+
if ($results.Count -eq 0 -and $current) {
|
|
23456
|
+
$results.Add([System.Management.Automation.CompletionResult]::new($current, $current, 'ParameterValue', $current))
|
|
23457
|
+
}
|
|
23458
|
+
}
|
|
23459
|
+
|
|
23460
|
+
$path = ''
|
|
23461
|
+
$context = $spec[$path]
|
|
23462
|
+
$lookup = & $index $context
|
|
23463
|
+
$used = [hashtable]::new([System.StringComparer]::Ordinal)
|
|
23464
|
+
$pending = $null
|
|
23465
|
+
$endOfOptions = $false
|
|
23466
|
+
$position = 0
|
|
23467
|
+
|
|
23468
|
+
# The engine strips the quotes from a quoted word.
|
|
23469
|
+
$typed = [string]$wordToComplete
|
|
23470
|
+
if ($typed -match '^([''"])(.*?)\1?$') { $typed = $Matches[2] }
|
|
23471
|
+
$current = $null
|
|
23472
|
+
|
|
23473
|
+
$elements = $commandAst.CommandElements
|
|
23474
|
+
for ($i = 1; $i -lt $elements.Count; $i++) {
|
|
23475
|
+
$element = $elements[$i]
|
|
23476
|
+
$word = $element.Extent.Text
|
|
23477
|
+
if ($element -is [System.Management.Automation.Language.StringConstantExpressionAst]) { $word = $element.Value }
|
|
23478
|
+
if ($element.Extent.EndOffset -ge $cursorPosition) {
|
|
23479
|
+
if ($element -is [System.Management.Automation.Language.ConstantExpressionAst] -and $element.Extent.StartOffset -le $cursorPosition) {
|
|
23480
|
+
$current = $element.Extent.Text
|
|
23481
|
+
if ($element.Extent.EndOffset -eq $cursorPosition) { $typed = $word }
|
|
23482
|
+
}
|
|
23483
|
+
break
|
|
23484
|
+
}
|
|
23485
|
+
|
|
23486
|
+
# A flag takes the next word as its value unless it is an option or '--';
|
|
23487
|
+
# a boolean flag only takes a boolean literal.
|
|
23488
|
+
$isOption = & $optionLike $word
|
|
23489
|
+
if ($null -ne $pending) {
|
|
23490
|
+
$flag = $pending
|
|
23491
|
+
$pending = $null
|
|
23492
|
+
if ($flag.takesValue) {
|
|
23493
|
+
if (-not $isOption) { continue }
|
|
23494
|
+
} elseif ($booleanLiterals -ccontains $word) { continue }
|
|
23495
|
+
}
|
|
23496
|
+
if ($endOfOptions) { $position++; continue }
|
|
23497
|
+
if ($word -ceq '--') { $endOfOptions = $true; continue }
|
|
23498
|
+
|
|
23499
|
+
if ($isOption) {
|
|
23500
|
+
$hasValue = $word.Contains('=')
|
|
23501
|
+
if ($hasValue) {
|
|
23502
|
+
$forms = @($word.Substring(0, $word.IndexOf('=')))
|
|
23503
|
+
} elseif ($word.StartsWith('--')) {
|
|
23504
|
+
$forms = @($word)
|
|
23505
|
+
} else {
|
|
23506
|
+
$forms = @(foreach ($char in $word.Substring(1).ToCharArray()) { '-' + $char })
|
|
23507
|
+
}
|
|
23508
|
+
foreach ($form in $forms) {
|
|
23509
|
+
$pending = $null
|
|
23510
|
+
$flag = $lookup[$form]
|
|
23511
|
+
if ($null -eq $flag) {
|
|
23512
|
+
if ($form.StartsWith('--no-')) {
|
|
23513
|
+
$name = $form.Substring(5)
|
|
23514
|
+
$flag = $lookup['--' + $name]
|
|
23515
|
+
if ($null -ne $flag -and -not $flag.takesValue -and $flag.name -ceq $name) { $used[$name] = $true }
|
|
23516
|
+
}
|
|
23517
|
+
continue
|
|
23518
|
+
}
|
|
23519
|
+
$used[$flag.name] = $true
|
|
23520
|
+
# A flag with an optional value only takes a value attached with '='.
|
|
23521
|
+
if (-not $hasValue -and -not $flag.optionalValue) { $pending = $flag }
|
|
23522
|
+
}
|
|
23523
|
+
continue
|
|
23524
|
+
}
|
|
23525
|
+
|
|
23526
|
+
if ($position -eq 0 -and $context.subcommands.name -ccontains $word) {
|
|
23527
|
+
if ($path) { $path = $path + ' ' + $word } else { $path = $word }
|
|
23528
|
+
$context = $spec[$path]
|
|
23529
|
+
$lookup = & $index $context
|
|
23530
|
+
$used = [hashtable]::new([System.StringComparer]::Ordinal)
|
|
23531
|
+
continue
|
|
23532
|
+
}
|
|
23533
|
+
$position++
|
|
23534
|
+
}
|
|
23535
|
+
|
|
23536
|
+
$typedIsOption = & $optionLike $typed
|
|
23537
|
+
if ($null -ne $pending -and $pending.takesValue -and -not $typedIsOption) {
|
|
23538
|
+
& $addValues $pending $typed ''
|
|
23539
|
+
& $keepTyped
|
|
23540
|
+
return $results
|
|
23541
|
+
}
|
|
23542
|
+
|
|
23543
|
+
if ($typedIsOption) {
|
|
23544
|
+
if ($typed -match '^(-[^=]+)=(.*)$') {
|
|
23545
|
+
$form = $Matches[1]
|
|
23546
|
+
$flag = $lookup[$form]
|
|
23547
|
+
if ($null -ne $flag -and $flag.takesValue) {
|
|
23548
|
+
& $addValues $flag $Matches[2] ($form + '=')
|
|
23549
|
+
& $keepTyped
|
|
23550
|
+
}
|
|
23551
|
+
} else {
|
|
23552
|
+
& $addFlags $typed
|
|
23553
|
+
}
|
|
23554
|
+
return $results
|
|
23555
|
+
}
|
|
23556
|
+
|
|
23557
|
+
if (-not $endOfOptions -and $position -eq 0) {
|
|
23558
|
+
foreach ($sub in $context.subcommands) {
|
|
23559
|
+
& $add $sub.name 'Command' $sub.description $typed ''
|
|
23560
|
+
}
|
|
23561
|
+
}
|
|
23562
|
+
|
|
23563
|
+
$arguments = $context.arguments
|
|
23564
|
+
if ($position -lt $arguments.Count) {
|
|
23565
|
+
& $addValues $arguments[$position] $typed ''
|
|
23566
|
+
} elseif ($arguments.Count -gt 0 -and $arguments[-1].variadic) {
|
|
23567
|
+
& $addValues $arguments[-1] $typed ''
|
|
23568
|
+
}
|
|
23569
|
+
|
|
23570
|
+
if (-not $endOfOptions) {
|
|
23571
|
+
& $addFlags $typed
|
|
23572
|
+
}
|
|
23573
|
+
return $results`;
|
|
23574
|
+
/** @internal */
|
|
23575
|
+
const generate$2 = (executableName, descriptor) => {
|
|
23576
|
+
const dataName = `$global:_${sanitize$1(executableName)}_Completions`;
|
|
23577
|
+
const lines = [];
|
|
23578
|
+
lines.push(`###-begin-${executableName}-completions-###`);
|
|
23579
|
+
lines.push(`#`);
|
|
23580
|
+
lines.push(`# Static completion script for PowerShell`);
|
|
23581
|
+
lines.push(`#`);
|
|
23582
|
+
lines.push(`# Installation:`);
|
|
23583
|
+
lines.push(`# ${executableName} --completions powershell > ${executableName}-completion.ps1`);
|
|
23584
|
+
lines.push(`# then add this line to your $PROFILE (use the full path to the file):`);
|
|
23585
|
+
lines.push(`# . <PATH>\\${executableName}-completion.ps1`);
|
|
23586
|
+
lines.push(`#`);
|
|
23587
|
+
lines.push(``);
|
|
23588
|
+
lines.push(`${dataName} = [hashtable]::new([System.StringComparer]::Ordinal)`);
|
|
23589
|
+
generateContexts(dataName, descriptor, [], lines, /* @__PURE__ */ new Set());
|
|
23590
|
+
lines.push(``);
|
|
23591
|
+
lines.push(`Register-ArgumentCompleter -Native -CommandName ${quotePs(executableName)} -ScriptBlock {`);
|
|
23592
|
+
lines.push(completer(dataName));
|
|
23593
|
+
lines.push(`}`);
|
|
23594
|
+
lines.push(``);
|
|
23595
|
+
lines.push(`###-end-${executableName}-completions-###`);
|
|
23596
|
+
return lines.join("\n");
|
|
23597
|
+
};
|
|
23738
23598
|
//#endregion
|
|
23739
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
23599
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/internal/completions/zsh.js
|
|
23600
|
+
const escapeZsh = (s) => s.replace(/\\/g, "\\\\").replace(/'/g, "'\\''").replace(/:/g, "\\:");
|
|
23601
|
+
const escapeZshExplanation = (s) => escapeZsh(s).replace(/]/g, "\\]");
|
|
23602
|
+
/** Escape choices for the second parse of a Zsh `_arguments` action. */
|
|
23603
|
+
const escapeZshChoice = (s) => s.replace(/[^A-Za-z0-9_.,/@%+-]/gu, "\\$&").replace(/'/g, "'\\''");
|
|
23604
|
+
const sanitize = (s) => s.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
23740
23605
|
/**
|
|
23741
|
-
*
|
|
23742
|
-
* ================
|
|
23743
|
-
*
|
|
23744
|
-
* The processed internal representation of a Command.Config declaration.
|
|
23745
|
-
* Separates the user's declared config shape from the flat parsing representation.
|
|
23746
|
-
*
|
|
23747
|
-
* Key concepts:
|
|
23748
|
-
* - ConfigInternal: The full processed form (flags, arguments, tree)
|
|
23749
|
-
* - ConfigInternal.Tree: Maps declaration keys to nodes
|
|
23750
|
-
* - ConfigInternal.Node: Param reference, Array, or Nested subtree
|
|
23751
|
-
*
|
|
23752
|
-
* Example transformation from Command.Config to Command.Config.Internal:
|
|
23753
|
-
*
|
|
23754
|
-
* ```ts
|
|
23755
|
-
* // User declares:
|
|
23756
|
-
* const config = {
|
|
23757
|
-
* verbose: Flag.Boolean("verbose").pipe(Flag.withDefault(false)),
|
|
23758
|
-
* server: {
|
|
23759
|
-
* host: Flag.String("host"),
|
|
23760
|
-
* port: Flag.Int("port")
|
|
23761
|
-
* },
|
|
23762
|
-
* files: Argument.String("files").pipe(Argument.variadic)
|
|
23763
|
-
* }
|
|
23764
|
-
*
|
|
23765
|
-
* // Becomes Config.Internal:
|
|
23766
|
-
* {
|
|
23767
|
-
* arguments: [filesParam], // Flat array of arguments
|
|
23768
|
-
* flags: [verboseParam, hostParam, portParam], // Flat array of flags
|
|
23769
|
-
* orderedParams: [verboseParam, hostParam, portParam, filesParam],
|
|
23770
|
-
* tree: { // Preserves nested structure
|
|
23771
|
-
* verbose: { _tag: "Param", index: 0 },
|
|
23772
|
-
* server: {
|
|
23773
|
-
* _tag: "Nested",
|
|
23774
|
-
* tree: {
|
|
23775
|
-
* host: { _tag: "Param", index: 1 },
|
|
23776
|
-
* port: { _tag: "Param", index: 2 }
|
|
23777
|
-
* }
|
|
23778
|
-
* },
|
|
23779
|
-
* files: { _tag: "Param", index: 3 }
|
|
23780
|
-
* }
|
|
23781
|
-
* }
|
|
23782
|
-
* ```
|
|
23783
|
-
*
|
|
23784
|
-
* This separation allows:
|
|
23785
|
-
* 1. Flat iteration over all params for parsing/validation
|
|
23786
|
-
* 2. Reconstruction of original nested shape for handler input
|
|
23606
|
+
* All forms of a flag (--name, -alias, --no-name) for the exclusion group.
|
|
23787
23607
|
*/
|
|
23788
|
-
const
|
|
23608
|
+
const allForms = (flag) => {
|
|
23609
|
+
const forms = [`--${flag.name}`];
|
|
23610
|
+
for (const alias of flag.aliases) forms.push(alias.length === 1 ? `-${alias}` : `--${alias}`);
|
|
23611
|
+
if (flag.type._tag === "Boolean") forms.push(`--no-${flag.name}`);
|
|
23612
|
+
return forms;
|
|
23613
|
+
};
|
|
23614
|
+
const valueAction = (type) => {
|
|
23615
|
+
switch (type._tag) {
|
|
23616
|
+
case "Boolean": return "";
|
|
23617
|
+
case "Choice": return `:value:(${type.values.map(escapeZshChoice).join(" ")})`;
|
|
23618
|
+
case "Path": return type.pathType === "directory" ? `:directory:_directories` : `:file:_files`;
|
|
23619
|
+
case "Int": return `:integer:`;
|
|
23620
|
+
case "Finite": return `:float:`;
|
|
23621
|
+
case "Date": return `:date:`;
|
|
23622
|
+
default: return `:value:`;
|
|
23623
|
+
}
|
|
23624
|
+
};
|
|
23625
|
+
const argAction = (type) => {
|
|
23626
|
+
switch (type._tag) {
|
|
23627
|
+
case "Choice": return `(${type.values.map(escapeZshChoice).join(" ")})`;
|
|
23628
|
+
case "Path": return type.pathType === "directory" ? `_directories` : `_files`;
|
|
23629
|
+
default: return ``;
|
|
23630
|
+
}
|
|
23631
|
+
};
|
|
23789
23632
|
/**
|
|
23790
|
-
*
|
|
23791
|
-
*
|
|
23792
|
-
* Walks the config structure and:
|
|
23793
|
-
* 1. Extracts all Params into flat arrays (flags, arguments, orderedParams)
|
|
23794
|
-
* 2. Builds a tree that remembers the original nested structure
|
|
23795
|
-
* 3. Assigns each Param an index to link parsed values back
|
|
23796
|
-
*
|
|
23797
|
-
* @internal
|
|
23633
|
+
* Produce _arguments optspecs for a single flag. Each spec is a complete,
|
|
23634
|
+
* single-quoted string — no brace expansion, no line continuations.
|
|
23798
23635
|
*/
|
|
23799
|
-
const
|
|
23800
|
-
const
|
|
23801
|
-
const
|
|
23802
|
-
const
|
|
23803
|
-
|
|
23804
|
-
|
|
23805
|
-
|
|
23806
|
-
|
|
23636
|
+
const flagSpecs = (flag) => {
|
|
23637
|
+
const specs = [];
|
|
23638
|
+
const desc = flag.description ? `[${escapeZshExplanation(flag.description)}]` : "";
|
|
23639
|
+
const optional = flag.optionalValue === true && flag.type._tag !== "Boolean";
|
|
23640
|
+
const valueSuffix = optional ? "=-" : "";
|
|
23641
|
+
const action = optional ? `:${valueAction(flag.type)}` : valueAction(flag.type);
|
|
23642
|
+
const excl = `(${allForms(flag).join(" ")})`;
|
|
23643
|
+
specs.push(`'${excl}--${flag.name}${valueSuffix}${desc}${action}'`);
|
|
23644
|
+
for (const alias of flag.aliases) {
|
|
23645
|
+
const prefix = alias.length === 1 ? "-" : "--";
|
|
23646
|
+
specs.push(`'${excl}${prefix}${alias}${valueSuffix}${desc}${action}'`);
|
|
23807
23647
|
}
|
|
23808
|
-
|
|
23809
|
-
|
|
23810
|
-
|
|
23811
|
-
children: value.map((v) => parseValue(v))
|
|
23812
|
-
};
|
|
23813
|
-
else if (isParam(value)) {
|
|
23814
|
-
const index = orderedParams.length;
|
|
23815
|
-
orderedParams.push(value);
|
|
23816
|
-
if (value.kind === "argument") args.push(value);
|
|
23817
|
-
else flags.push(value);
|
|
23818
|
-
return {
|
|
23819
|
-
_tag: "Param",
|
|
23820
|
-
index
|
|
23821
|
-
};
|
|
23822
|
-
} else return {
|
|
23823
|
-
_tag: "Nested",
|
|
23824
|
-
tree: parse(value)
|
|
23825
|
-
};
|
|
23648
|
+
if (flag.type._tag === "Boolean") {
|
|
23649
|
+
const negDesc = flag.description ? `[${escapeZshExplanation(`Disable ${flag.name}`)}]` : "";
|
|
23650
|
+
specs.push(`'${excl}--no-${flag.name}${negDesc}'`);
|
|
23826
23651
|
}
|
|
23827
|
-
return
|
|
23828
|
-
|
|
23829
|
-
|
|
23830
|
-
|
|
23831
|
-
|
|
23832
|
-
|
|
23833
|
-
|
|
23652
|
+
return specs;
|
|
23653
|
+
};
|
|
23654
|
+
const argSpec = (arg) => {
|
|
23655
|
+
const desc = arg.description ? escapeZsh(arg.description) : arg.name;
|
|
23656
|
+
const action = argAction(arg.type);
|
|
23657
|
+
return `'${arg.variadic ? "*" : ""}:${desc}:${action}'`;
|
|
23658
|
+
};
|
|
23659
|
+
const generateFunction = (descriptor, parentPath, lines) => {
|
|
23660
|
+
const currentPath = [...parentPath, descriptor.name];
|
|
23661
|
+
const funcName = `_${currentPath.map(sanitize).join("_")}`;
|
|
23662
|
+
lines.push(`${funcName}() {`);
|
|
23663
|
+
if (descriptor.subcommands.length > 0) {
|
|
23664
|
+
lines.push(` local context state state_descr line`);
|
|
23665
|
+
lines.push(` typeset -A opt_args`);
|
|
23666
|
+
lines.push(``);
|
|
23667
|
+
lines.push(` local -a commands`);
|
|
23668
|
+
lines.push(` commands=(`);
|
|
23669
|
+
for (const sub of descriptor.subcommands) {
|
|
23670
|
+
const desc = sub.description ? escapeZsh(sub.description) : "";
|
|
23671
|
+
lines.push(` '${sub.name}:${desc}'`);
|
|
23672
|
+
}
|
|
23673
|
+
lines.push(` )`);
|
|
23674
|
+
lines.push(``);
|
|
23675
|
+
lines.push(` local -a specs`);
|
|
23676
|
+
lines.push(` specs=(`);
|
|
23677
|
+
for (const flag of descriptor.flags) for (const spec of flagSpecs(flag)) lines.push(` ${spec}`);
|
|
23678
|
+
if (descriptor.arguments.length > 0) {
|
|
23679
|
+
lines.push(` -`);
|
|
23680
|
+
lines.push(` parent-arguments`);
|
|
23681
|
+
for (const arg of descriptor.arguments) lines.push(` ${argSpec(arg)}`);
|
|
23682
|
+
lines.push(` -`);
|
|
23683
|
+
lines.push(` subcommands`);
|
|
23684
|
+
}
|
|
23685
|
+
lines.push(` '1:command:->command'`);
|
|
23686
|
+
lines.push(` '*::arg:->args'`);
|
|
23687
|
+
lines.push(` )`);
|
|
23688
|
+
lines.push(``);
|
|
23689
|
+
lines.push(` _arguments -C "\${specs[@]}"`);
|
|
23690
|
+
lines.push(``);
|
|
23691
|
+
lines.push(` case "$state" in`);
|
|
23692
|
+
lines.push(` command)`);
|
|
23693
|
+
lines.push(` _describe -t commands 'commands' commands`);
|
|
23694
|
+
lines.push(` ;;`);
|
|
23695
|
+
lines.push(` args)`);
|
|
23696
|
+
lines.push(` case "$words[1]" in`);
|
|
23697
|
+
for (const sub of descriptor.subcommands) {
|
|
23698
|
+
const subFunc = `_${[...currentPath, sub.name].map(sanitize).join("_")}`;
|
|
23699
|
+
lines.push(` ${sub.name})`);
|
|
23700
|
+
lines.push(` ${subFunc}`);
|
|
23701
|
+
lines.push(` ;;`);
|
|
23702
|
+
}
|
|
23703
|
+
lines.push(` esac`);
|
|
23704
|
+
lines.push(` ;;`);
|
|
23705
|
+
lines.push(` esac`);
|
|
23706
|
+
} else {
|
|
23707
|
+
const allSpecs = [];
|
|
23708
|
+
for (const flag of descriptor.flags) allSpecs.push(...flagSpecs(flag));
|
|
23709
|
+
for (const arg of descriptor.arguments) allSpecs.push(argSpec(arg));
|
|
23710
|
+
if (allSpecs.length > 0) {
|
|
23711
|
+
lines.push(` local -a specs`);
|
|
23712
|
+
lines.push(` specs=(`);
|
|
23713
|
+
for (const spec of allSpecs) lines.push(` ${spec}`);
|
|
23714
|
+
lines.push(` )`);
|
|
23715
|
+
lines.push(` _arguments "\${specs[@]}"`);
|
|
23716
|
+
}
|
|
23717
|
+
}
|
|
23718
|
+
lines.push(`}`);
|
|
23719
|
+
lines.push(``);
|
|
23720
|
+
for (const sub of descriptor.subcommands) generateFunction(sub, currentPath, lines);
|
|
23834
23721
|
};
|
|
23835
23722
|
/**
|
|
23836
23723
|
* @internal
|
|
23837
23724
|
*/
|
|
23838
|
-
const
|
|
23725
|
+
const generate$1 = (executableName, descriptor) => {
|
|
23726
|
+
const lines = [];
|
|
23727
|
+
const safeName = sanitize(executableName);
|
|
23728
|
+
lines.push(`#compdef ${executableName}`);
|
|
23729
|
+
lines.push(`###-begin-${executableName}-completions-###`);
|
|
23730
|
+
lines.push(`#`);
|
|
23731
|
+
lines.push(`# Static completion script for Zsh`);
|
|
23732
|
+
lines.push(`#`);
|
|
23733
|
+
lines.push(`# Installation:`);
|
|
23734
|
+
lines.push(`# ${executableName} --completions zsh > ~/.zsh/completions/_${executableName}`);
|
|
23735
|
+
lines.push(`# then add ~/.zsh/completions to your fpath`);
|
|
23736
|
+
lines.push(`#`);
|
|
23737
|
+
lines.push(``);
|
|
23738
|
+
generateFunction(descriptor, [], lines);
|
|
23739
|
+
lines.push(`# Handle both direct invocation and autoload`);
|
|
23740
|
+
lines.push(`if [[ "\${zsh_eval_context[-1]}" == "loadautofunc" ]]; then`);
|
|
23741
|
+
lines.push(` _${safeName} "$@"`);
|
|
23742
|
+
lines.push(`else`);
|
|
23743
|
+
lines.push(` compdef _${safeName} ${executableName}`);
|
|
23744
|
+
lines.push(`fi`);
|
|
23745
|
+
lines.push(`###-end-${executableName}-completions-###`);
|
|
23746
|
+
return lines.join("\n");
|
|
23747
|
+
};
|
|
23748
|
+
//#endregion
|
|
23749
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/Completions.js
|
|
23839
23750
|
/**
|
|
23840
|
-
*
|
|
23751
|
+
* The `Completions` module turns a plain description of an Effect CLI command
|
|
23752
|
+
* tree into shell completion scripts for Bash, Zsh, Fish, and PowerShell. It
|
|
23753
|
+
* is the low-level script generation surface used by the unstable CLI package
|
|
23754
|
+
* and by the built-in completions global flag.
|
|
23841
23755
|
*
|
|
23842
|
-
*
|
|
23843
|
-
*
|
|
23756
|
+
* @stability unstable
|
|
23757
|
+
* @since 4.0.0
|
|
23758
|
+
*/
|
|
23759
|
+
/**
|
|
23760
|
+
* Generates a shell completion script for a command descriptor.
|
|
23844
23761
|
*
|
|
23845
|
-
*
|
|
23762
|
+
* **When to use**
|
|
23763
|
+
*
|
|
23764
|
+
* Use when you need an installable completion script from an existing
|
|
23765
|
+
* `CommandDescriptor`.
|
|
23766
|
+
*
|
|
23767
|
+
* **Details**
|
|
23768
|
+
*
|
|
23769
|
+
* Dispatches by `shell` to Bash, Zsh, Fish, or PowerShell generation and
|
|
23770
|
+
* returns a static script string for `executableName`.
|
|
23771
|
+
*
|
|
23772
|
+
* @see {@link Shell} for supported shell names
|
|
23773
|
+
* @see {@link CommandDescriptor} for the command shape used by completion generation
|
|
23774
|
+
*
|
|
23775
|
+
* @stability unstable
|
|
23776
|
+
* @category constructors
|
|
23777
|
+
* @since 4.0.0
|
|
23846
23778
|
*/
|
|
23847
|
-
const
|
|
23848
|
-
|
|
23849
|
-
|
|
23850
|
-
|
|
23851
|
-
|
|
23852
|
-
|
|
23853
|
-
case "Param": return results[node.index];
|
|
23854
|
-
case "Array": return node.children.map((child) => nodeValue(child));
|
|
23855
|
-
case "Nested": return reconstructTree(node.tree, results);
|
|
23856
|
-
}
|
|
23779
|
+
const generate = (executableName, shell, descriptor) => {
|
|
23780
|
+
switch (shell) {
|
|
23781
|
+
case "bash": return generate$4(executableName, descriptor);
|
|
23782
|
+
case "zsh": return generate$1(executableName, descriptor);
|
|
23783
|
+
case "fish": return generate$3(executableName, descriptor);
|
|
23784
|
+
case "powershell": return generate$2(executableName, descriptor);
|
|
23857
23785
|
}
|
|
23858
23786
|
};
|
|
23859
23787
|
//#endregion
|
|
23860
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
23788
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/Flag.js
|
|
23861
23789
|
/**
|
|
23862
|
-
*
|
|
23863
|
-
* ======================
|
|
23790
|
+
* Creates a boolean flag that can be enabled or disabled.
|
|
23864
23791
|
*
|
|
23865
|
-
*
|
|
23866
|
-
*
|
|
23867
|
-
|
|
23868
|
-
|
|
23869
|
-
|
|
23870
|
-
*
|
|
23871
|
-
*
|
|
23792
|
+
* **Example** (Creating boolean flags)
|
|
23793
|
+
*
|
|
23794
|
+
* ```ts import.meta.vitest
|
|
23795
|
+
* import { Flag } from "effect/cli"
|
|
23796
|
+
*
|
|
23797
|
+
* const verboseFlag = Flag.Boolean("verbose")
|
|
23798
|
+
* // Usage: --verbose (true) or --no-verbose (false)
|
|
23799
|
+
* // Omission fails unless the flag is made optional or given a fallback.
|
|
23800
|
+
* verboseFlag.kind // => "flag"
|
|
23801
|
+
* ```
|
|
23802
|
+
*
|
|
23803
|
+
* @stability unstable
|
|
23804
|
+
* @category constructors
|
|
23805
|
+
* @since 4.0.0
|
|
23872
23806
|
*/
|
|
23873
|
-
const
|
|
23874
|
-
const Proto = { .../*#__PURE__*/ Prototype({
|
|
23875
|
-
label: "Command",
|
|
23876
|
-
evaluate() {
|
|
23877
|
-
return toImpl(this).service;
|
|
23878
|
-
}
|
|
23879
|
-
}) };
|
|
23807
|
+
const Boolean = (name) => Boolean$1(flagKind, name);
|
|
23880
23808
|
/**
|
|
23881
|
-
*
|
|
23809
|
+
* Constructs option parameters that represent a choice between several inputs.
|
|
23810
|
+
* Each tuple maps a string flag value to an associated typed value.
|
|
23811
|
+
*
|
|
23812
|
+
* **Example** (Creating flag choices with values)
|
|
23813
|
+
*
|
|
23814
|
+
* ```ts import.meta.vitest
|
|
23815
|
+
* import { Flag } from "effect/cli"
|
|
23816
|
+
*
|
|
23817
|
+
* // simple enum like choice mapping directly to string union
|
|
23818
|
+
* const color = Flag.Literals("color", ["red", "green", "blue"])
|
|
23819
|
+
*
|
|
23820
|
+
* // choice with custom value mapping
|
|
23821
|
+
* const logLevel = Flag.ChoiceWithValue("log-level", [
|
|
23822
|
+
* ["debug", "Debug" as const],
|
|
23823
|
+
* ["info", "Info" as const],
|
|
23824
|
+
* ["error", "Error" as const]
|
|
23825
|
+
* ])
|
|
23826
|
+
* const kinds = [color.kind, logLevel.kind] // => ["flag", "flag"]
|
|
23827
|
+
* ```
|
|
23828
|
+
*
|
|
23829
|
+
* @stability unstable
|
|
23830
|
+
* @category constructors
|
|
23831
|
+
* @since 4.0.0
|
|
23882
23832
|
*/
|
|
23883
|
-
const
|
|
23884
|
-
const config = options.config;
|
|
23885
|
-
const contextConfig = options.contextConfig ?? emptyConfig;
|
|
23886
|
-
const service = options.service ?? Service(`~effect/cli/Command/${options.name}`);
|
|
23887
|
-
const annotations = options.annotations ?? empty$2();
|
|
23888
|
-
const globalFlags = options.globalFlags ?? [];
|
|
23889
|
-
const subcommands = options.subcommands ?? [];
|
|
23890
|
-
const handle = (input, commandPath) => isNotUndefined(options.handle) ? options.handle(input, commandPath) : fail$1(new ShowHelp({
|
|
23891
|
-
commandPath,
|
|
23892
|
-
errors: []
|
|
23893
|
-
}));
|
|
23894
|
-
const parse = options.parse ?? makeParser(config);
|
|
23895
|
-
const parseContext = options.parseContext ?? makeParser(contextConfig, { allowLeftovers: true });
|
|
23896
|
-
const buildHelpDoc = (commandPath) => {
|
|
23897
|
-
const args = [];
|
|
23898
|
-
const flags = [];
|
|
23899
|
-
for (const arg of config.arguments) {
|
|
23900
|
-
const singles = extractSingleParams(arg);
|
|
23901
|
-
const metadata = getParamMetadata(arg);
|
|
23902
|
-
for (const single of singles) args.push({
|
|
23903
|
-
name: single.name,
|
|
23904
|
-
type: single.typeName ?? getTypeName(single.primitiveType),
|
|
23905
|
-
description: single.description,
|
|
23906
|
-
required: !metadata.isOptional && (!metadata.isVariadic || exists(metadata.variadicMin, (min) => min > 0)),
|
|
23907
|
-
variadic: metadata.isVariadic
|
|
23908
|
-
});
|
|
23909
|
-
}
|
|
23910
|
-
let usage = commandPath.length > 0 ? commandPath.join(" ") : options.name;
|
|
23911
|
-
if (subcommands.some((group) => group.commands.some((c) => !c.unlisted))) usage += " <subcommand>";
|
|
23912
|
-
usage += " [flags]";
|
|
23913
|
-
for (const arg of args) {
|
|
23914
|
-
const argName = arg.variadic ? `<${arg.name}...>` : `<${arg.name}>`;
|
|
23915
|
-
usage += ` ${arg.required ? argName : `[${argName}]`}`;
|
|
23916
|
-
}
|
|
23917
|
-
for (const option of config.flags) {
|
|
23918
|
-
const singles = extractSingleParams(option);
|
|
23919
|
-
const metadata = getParamMetadata(option);
|
|
23920
|
-
for (const single of singles) {
|
|
23921
|
-
if (single.hidden) continue;
|
|
23922
|
-
flags.push(toFlagDoc(single, metadata));
|
|
23923
|
-
}
|
|
23924
|
-
}
|
|
23925
|
-
const subcommandDocs = [];
|
|
23926
|
-
for (const group of subcommands) {
|
|
23927
|
-
const visible = group.commands.filter((c) => !c.unlisted);
|
|
23928
|
-
if (visible.length === 0) continue;
|
|
23929
|
-
subcommandDocs.push({
|
|
23930
|
-
group: group.group,
|
|
23931
|
-
commands: map$8(visible, (subcommand) => ({
|
|
23932
|
-
name: subcommand.name,
|
|
23933
|
-
alias: subcommand.alias,
|
|
23934
|
-
shortDescription: subcommand.shortDescription,
|
|
23935
|
-
description: subcommand.description ?? ""
|
|
23936
|
-
}))
|
|
23937
|
-
});
|
|
23938
|
-
}
|
|
23939
|
-
const examples = options.examples ?? [];
|
|
23940
|
-
return {
|
|
23941
|
-
description: options.description ?? "",
|
|
23942
|
-
usage,
|
|
23943
|
-
flags,
|
|
23944
|
-
annotations,
|
|
23945
|
-
...args.length > 0 && { args },
|
|
23946
|
-
...subcommandDocs.length > 0 && { subcommands: subcommandDocs },
|
|
23947
|
-
...examples.length > 0 && { examples }
|
|
23948
|
-
};
|
|
23949
|
-
};
|
|
23950
|
-
return Object.assign(Object.create(Proto), {
|
|
23951
|
-
[TypeId]: TypeId,
|
|
23952
|
-
name: options.name,
|
|
23953
|
-
examples: options.examples ?? [],
|
|
23954
|
-
annotations,
|
|
23955
|
-
globalFlags,
|
|
23956
|
-
subcommands,
|
|
23957
|
-
unlisted: options.unlisted ?? false,
|
|
23958
|
-
config,
|
|
23959
|
-
contextConfig,
|
|
23960
|
-
service,
|
|
23961
|
-
parse,
|
|
23962
|
-
parseContext,
|
|
23963
|
-
handle,
|
|
23964
|
-
buildHelpDoc,
|
|
23965
|
-
...isNotUndefined(options.description) ? { description: options.description } : {},
|
|
23966
|
-
...isNotUndefined(options.shortDescription) ? { shortDescription: options.shortDescription } : {},
|
|
23967
|
-
...isNotUndefined(options.alias) ? { alias: options.alias } : {}
|
|
23968
|
-
});
|
|
23969
|
-
};
|
|
23833
|
+
const ChoiceWithValue = (name, choices) => ChoiceWithValue$1(flagKind, name, choices);
|
|
23970
23834
|
/**
|
|
23971
|
-
*
|
|
23835
|
+
* Adds an alias to a flag, allowing it to be referenced by multiple names.
|
|
23972
23836
|
*
|
|
23973
|
-
*
|
|
23974
|
-
|
|
23975
|
-
|
|
23976
|
-
|
|
23977
|
-
|
|
23978
|
-
|
|
23979
|
-
|
|
23980
|
-
|
|
23981
|
-
|
|
23982
|
-
|
|
23983
|
-
|
|
23984
|
-
|
|
23985
|
-
|
|
23986
|
-
|
|
23987
|
-
|
|
23988
|
-
|
|
23989
|
-
|
|
23990
|
-
|
|
23991
|
-
|
|
23992
|
-
|
|
23837
|
+
* **Example** (Adding flag aliases)
|
|
23838
|
+
*
|
|
23839
|
+
* ```ts import.meta.vitest
|
|
23840
|
+
* import { Flag } from "effect/cli"
|
|
23841
|
+
*
|
|
23842
|
+
* // Flag can be used as both --verbose and -v
|
|
23843
|
+
* const verboseFlag = Flag.Boolean("verbose").pipe(
|
|
23844
|
+
* Flag.withAlias("v")
|
|
23845
|
+
* )
|
|
23846
|
+
*
|
|
23847
|
+
* // Multiple aliases can be chained
|
|
23848
|
+
* const helpFlag = Flag.Boolean("help").pipe(
|
|
23849
|
+
* Flag.withAlias("h"),
|
|
23850
|
+
* Flag.withAlias("?")
|
|
23851
|
+
* )
|
|
23852
|
+
* const kinds = [verboseFlag.kind, helpFlag.kind] // => ["flag", "flag"]
|
|
23853
|
+
* ```
|
|
23854
|
+
*
|
|
23855
|
+
* @stability unstable
|
|
23856
|
+
* @category aliasing
|
|
23857
|
+
* @since 4.0.0
|
|
23858
|
+
*/
|
|
23859
|
+
const withAlias = /*#__PURE__*/ dual(2, (self, alias) => withAlias$1(self, alias));
|
|
23993
23860
|
/**
|
|
23994
|
-
*
|
|
23995
|
-
*
|
|
23996
|
-
*
|
|
23861
|
+
* Adds a description to a flag for help documentation.
|
|
23862
|
+
*
|
|
23863
|
+
* **Example** (Adding help descriptions)
|
|
23864
|
+
*
|
|
23865
|
+
* ```ts import.meta.vitest
|
|
23866
|
+
* import { Flag } from "effect/cli"
|
|
23867
|
+
*
|
|
23868
|
+
* const portFlag = Flag.Int("port").pipe(
|
|
23869
|
+
* Flag.withDescription("The port number to listen on")
|
|
23870
|
+
* )
|
|
23871
|
+
*
|
|
23872
|
+
* const configFlag = Flag.File("config").pipe(
|
|
23873
|
+
* Flag.withDescription("Path to the configuration file")
|
|
23874
|
+
* )
|
|
23875
|
+
* const kinds = [portFlag.kind, configFlag.kind] // => ["flag", "flag"]
|
|
23876
|
+
* ```
|
|
23877
|
+
*
|
|
23878
|
+
* @stability unstable
|
|
23879
|
+
* @category metadata
|
|
23880
|
+
* @since 4.0.0
|
|
23997
23881
|
*/
|
|
23998
|
-
const
|
|
23999
|
-
const parsedArgs = {
|
|
24000
|
-
flags: input.flags,
|
|
24001
|
-
arguments: input.arguments
|
|
24002
|
-
};
|
|
24003
|
-
const [remainingArguments, values] = yield* parseParams(parsedArgs, cfg.orderedParams);
|
|
24004
|
-
if (options?.allowLeftovers !== true && remainingArguments.length > 0) return yield* new UnexpectedArgument({ arguments: remainingArguments });
|
|
24005
|
-
return reconstructTree(cfg.tree, values);
|
|
24006
|
-
});
|
|
23882
|
+
const withDescription$1 = /*#__PURE__*/ dual(2, (self, description) => withDescription$2(self, description));
|
|
24007
23883
|
/**
|
|
24008
|
-
*
|
|
24009
|
-
*
|
|
23884
|
+
* Sets a custom metavar (placeholder name) for the flag in help documentation.
|
|
23885
|
+
*
|
|
23886
|
+
* **Details**
|
|
23887
|
+
*
|
|
23888
|
+
* The metavar is displayed in usage text to indicate what value the user should
|
|
23889
|
+
* provide. For example, `--output FILE` shows `FILE` as the metavar.
|
|
23890
|
+
*
|
|
23891
|
+
* **Example** (Setting metavars)
|
|
23892
|
+
*
|
|
23893
|
+
* ```ts import.meta.vitest
|
|
23894
|
+
* import { Flag } from "effect/cli"
|
|
23895
|
+
*
|
|
23896
|
+
* const databaseFlag = Flag.String("database-url").pipe(
|
|
23897
|
+
* Flag.withMetavar("URL"),
|
|
23898
|
+
* Flag.withDescription("Database connection URL")
|
|
23899
|
+
* )
|
|
23900
|
+
* // In help: --database-url URL
|
|
23901
|
+
*
|
|
23902
|
+
* const timeoutFlag = Flag.Int("timeout").pipe(
|
|
23903
|
+
* Flag.withMetavar("SECONDS")
|
|
23904
|
+
* )
|
|
23905
|
+
* // In help: --timeout SECONDS
|
|
23906
|
+
* const kinds = [databaseFlag.kind, timeoutFlag.kind] // => ["flag", "flag"]
|
|
23907
|
+
* ```
|
|
23908
|
+
*
|
|
23909
|
+
* @stability unstable
|
|
23910
|
+
* @category metadata
|
|
23911
|
+
* @since 4.0.0
|
|
24010
23912
|
*/
|
|
24011
|
-
const
|
|
24012
|
-
const results = [];
|
|
24013
|
-
let currentArguments = parsedArgs.arguments;
|
|
24014
|
-
for (const option of params) {
|
|
24015
|
-
const [remainingArguments, parsed] = yield* option.parse({
|
|
24016
|
-
flags: parsedArgs.flags,
|
|
24017
|
-
arguments: currentArguments
|
|
24018
|
-
});
|
|
24019
|
-
results.push(parsed);
|
|
24020
|
-
currentArguments = remainingArguments;
|
|
24021
|
-
}
|
|
24022
|
-
return [currentArguments, results];
|
|
24023
|
-
});
|
|
24024
|
-
//#endregion
|
|
24025
|
-
//#region ../../node_modules/.pnpm/effect@4.0.4/node_modules/effect/dist/cli/internal/completions/descriptor.js
|
|
23913
|
+
const withMetavar = /*#__PURE__*/ dual(2, (self, metavar) => withMetavar$1(self, metavar));
|
|
24026
23914
|
/**
|
|
24027
|
-
*
|
|
24028
|
-
* shell completion generation.
|
|
23915
|
+
* Makes a flag optional, returning an Option type that can be None if not provided.
|
|
24029
23916
|
*
|
|
24030
|
-
*
|
|
23917
|
+
* **Example** (Making flags optional)
|
|
23918
|
+
*
|
|
23919
|
+
* ```ts import.meta.vitest
|
|
23920
|
+
* import { Effect, FileSystem, Layer, Option, Path, Stdio, Terminal } from "effect"
|
|
23921
|
+
* import { Flag } from "effect/cli"
|
|
23922
|
+
* import { ChildProcessSpawner } from "effect/process"
|
|
23923
|
+
*
|
|
23924
|
+
* const CliTestLayer = Layer.mergeAll(
|
|
23925
|
+
* FileSystem.layerNoop({}),
|
|
23926
|
+
* Path.layer,
|
|
23927
|
+
* Stdio.layerTest({}),
|
|
23928
|
+
* Layer.succeed(Terminal.Terminal, Terminal.make({
|
|
23929
|
+
* columns: Effect.succeed(80),
|
|
23930
|
+
* rows: Effect.succeed(24),
|
|
23931
|
+
* readInput: Effect.die("unused"),
|
|
23932
|
+
* readLine: Effect.die("unused"),
|
|
23933
|
+
* display: () => Effect.void
|
|
23934
|
+
* })),
|
|
23935
|
+
* Layer.succeed(
|
|
23936
|
+
* ChildProcessSpawner.ChildProcessSpawner,
|
|
23937
|
+
* ChildProcessSpawner.make(() => Effect.die("unused"))
|
|
23938
|
+
* )
|
|
23939
|
+
* )
|
|
23940
|
+
*
|
|
23941
|
+
* const optionalPort = Flag.optional(Flag.Int("port"))
|
|
23942
|
+
*
|
|
23943
|
+
* const program = Effect.gen(function*() {
|
|
23944
|
+
* const [, port] = yield* optionalPort.parse({
|
|
23945
|
+
* arguments: [],
|
|
23946
|
+
* flags: { "port": ["4000"] }
|
|
23947
|
+
* })
|
|
23948
|
+
* return port
|
|
23949
|
+
* })
|
|
23950
|
+
*
|
|
23951
|
+
* await Effect.runPromise(program.pipe(Effect.provide(CliTestLayer))) // => Option.some(4000)
|
|
23952
|
+
* ```
|
|
23953
|
+
*
|
|
23954
|
+
* @stability unstable
|
|
23955
|
+
* @category optionality
|
|
23956
|
+
* @since 4.0.0
|
|
24031
23957
|
*/
|
|
24032
|
-
const
|
|
24033
|
-
switch (single.primitiveType._tag) {
|
|
24034
|
-
case "Boolean": return { _tag: "Boolean" };
|
|
24035
|
-
case "Int": return { _tag: "Int" };
|
|
24036
|
-
case "Finite": return { _tag: "Finite" };
|
|
24037
|
-
case "Date": return { _tag: "Date" };
|
|
24038
|
-
case "Choice": return {
|
|
24039
|
-
_tag: "Choice",
|
|
24040
|
-
values: getChoiceKeys(single.primitiveType) ?? []
|
|
24041
|
-
};
|
|
24042
|
-
case "Path": return {
|
|
24043
|
-
_tag: "Path",
|
|
24044
|
-
pathType: getPathType(single.primitiveType) ?? "either"
|
|
24045
|
-
};
|
|
24046
|
-
case "FileText":
|
|
24047
|
-
case "FileParse":
|
|
24048
|
-
case "FileSchema": return {
|
|
24049
|
-
_tag: "Path",
|
|
24050
|
-
pathType: "file"
|
|
24051
|
-
};
|
|
24052
|
-
default: return { _tag: "String" };
|
|
24053
|
-
}
|
|
24054
|
-
};
|
|
24055
|
-
const toArgumentType = (single) => {
|
|
24056
|
-
switch (single.primitiveType._tag) {
|
|
24057
|
-
case "Int": return { _tag: "Int" };
|
|
24058
|
-
case "Finite": return { _tag: "Finite" };
|
|
24059
|
-
case "Date": return { _tag: "Date" };
|
|
24060
|
-
case "Choice": return {
|
|
24061
|
-
_tag: "Choice",
|
|
24062
|
-
values: getChoiceKeys(single.primitiveType) ?? []
|
|
24063
|
-
};
|
|
24064
|
-
case "Path": return {
|
|
24065
|
-
_tag: "Path",
|
|
24066
|
-
pathType: getPathType(single.primitiveType) ?? "either"
|
|
24067
|
-
};
|
|
24068
|
-
case "FileText":
|
|
24069
|
-
case "FileParse":
|
|
24070
|
-
case "FileSchema": return {
|
|
24071
|
-
_tag: "Path",
|
|
24072
|
-
pathType: "file"
|
|
24073
|
-
};
|
|
24074
|
-
default: return { _tag: "String" };
|
|
24075
|
-
}
|
|
24076
|
-
};
|
|
23958
|
+
const optional = (param) => optional$1(param);
|
|
24077
23959
|
/**
|
|
24078
|
-
*
|
|
23960
|
+
* Provides a default value for a flag when it's not specified.
|
|
23961
|
+
*
|
|
23962
|
+
* **Example** (Providing default values)
|
|
23963
|
+
*
|
|
23964
|
+
* ```ts import.meta.vitest
|
|
23965
|
+
* import { Flag } from "effect/cli"
|
|
23966
|
+
*
|
|
23967
|
+
* const portFlag = Flag.Int("port").pipe(
|
|
23968
|
+
* Flag.withDefault(8080)
|
|
23969
|
+
* )
|
|
23970
|
+
* // If --port is not provided, defaults to 8080
|
|
23971
|
+
*
|
|
23972
|
+
* const hostFlag = Flag.String("host").pipe(
|
|
23973
|
+
* Flag.withDefault("localhost")
|
|
23974
|
+
* )
|
|
23975
|
+
* // If --host is not provided, defaults to "localhost"
|
|
23976
|
+
* const kinds = [portFlag.kind, hostFlag.kind] // => ["flag", "flag"]
|
|
23977
|
+
* ```
|
|
23978
|
+
*
|
|
23979
|
+
* @stability unstable
|
|
23980
|
+
* @category optionality
|
|
23981
|
+
* @since 4.0.0
|
|
24079
23982
|
*/
|
|
24080
|
-
const
|
|
24081
|
-
const impl = toImpl(cmd);
|
|
24082
|
-
const config = impl.config;
|
|
24083
|
-
const flags = [];
|
|
24084
|
-
const seen = /* @__PURE__ */ new Set();
|
|
24085
|
-
for (const [index, flag] of [...config.flags, ...inheritedFlags].entries()) {
|
|
24086
|
-
const singles = extractSingleParams(flag);
|
|
24087
|
-
for (const single of singles) {
|
|
24088
|
-
if (single.kind !== "flag") continue;
|
|
24089
|
-
if (single.hidden) continue;
|
|
24090
|
-
if (index >= config.flags.length && seen.has(single.name)) continue;
|
|
24091
|
-
seen.add(single.name);
|
|
24092
|
-
flags.push({
|
|
24093
|
-
name: single.name,
|
|
24094
|
-
aliases: single.aliases,
|
|
24095
|
-
description: getOrUndefined$1(single.description),
|
|
24096
|
-
type: toFlagType(single)
|
|
24097
|
-
});
|
|
24098
|
-
}
|
|
24099
|
-
}
|
|
24100
|
-
const args = [];
|
|
24101
|
-
for (const arg of config.arguments) {
|
|
24102
|
-
const singles = extractSingleParams(arg);
|
|
24103
|
-
const metadata = getParamMetadata(arg);
|
|
24104
|
-
for (const single of singles) {
|
|
24105
|
-
if (single.kind !== "argument") continue;
|
|
24106
|
-
args.push({
|
|
24107
|
-
name: single.name,
|
|
24108
|
-
description: getOrUndefined$1(single.description),
|
|
24109
|
-
required: !metadata.isOptional,
|
|
24110
|
-
variadic: metadata.isVariadic,
|
|
24111
|
-
type: toArgumentType(single)
|
|
24112
|
-
});
|
|
24113
|
-
}
|
|
24114
|
-
}
|
|
24115
|
-
const subcommands = [];
|
|
24116
|
-
const sharedFlags = [...inheritedFlags, ...impl.contextConfig.flags];
|
|
24117
|
-
for (const group of cmd.subcommands) for (const subcommand of group.commands) {
|
|
24118
|
-
if (subcommand.unlisted) continue;
|
|
24119
|
-
const descriptor = fromCommand(subcommand, sharedFlags);
|
|
24120
|
-
subcommands.push(descriptor);
|
|
24121
|
-
if (subcommand.alias && subcommand.alias !== subcommand.name) subcommands.push({
|
|
24122
|
-
...descriptor,
|
|
24123
|
-
name: subcommand.alias
|
|
24124
|
-
});
|
|
24125
|
-
}
|
|
24126
|
-
return {
|
|
24127
|
-
name: cmd.name,
|
|
24128
|
-
description: cmd.shortDescription ?? cmd.description,
|
|
24129
|
-
flags,
|
|
24130
|
-
arguments: args,
|
|
24131
|
-
subcommands
|
|
24132
|
-
};
|
|
24133
|
-
};
|
|
23983
|
+
const withDefault = withDefault$1;
|
|
24134
23984
|
//#endregion
|
|
24135
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
23985
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/internal/help.js
|
|
24136
23986
|
/**
|
|
24137
23987
|
* Help Documentation
|
|
24138
23988
|
* ================
|
|
@@ -24242,7 +24092,7 @@ const getHelpForCommandPath = (command, commandPath, builtIns) => gen(function*
|
|
|
24242
24092
|
};
|
|
24243
24093
|
});
|
|
24244
24094
|
//#endregion
|
|
24245
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
24095
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/GlobalFlag.js
|
|
24246
24096
|
/**
|
|
24247
24097
|
* Global flags for Effect CLI command trees. Global flags are parsed outside a
|
|
24248
24098
|
* single command's local flags and can apply to a command and its descendants.
|
|
@@ -24425,7 +24275,7 @@ const BuiltIns = [
|
|
|
24425
24275
|
LogLevel
|
|
24426
24276
|
];
|
|
24427
24277
|
//#endregion
|
|
24428
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
24278
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/CliConfig.js
|
|
24429
24279
|
/**
|
|
24430
24280
|
* Configuration for Effect CLI command execution.
|
|
24431
24281
|
*
|
|
@@ -24455,7 +24305,7 @@ var CliConfig = class extends (/*#__PURE__*/ Reference("effect/cli/CliConfig", {
|
|
|
24455
24305
|
*/
|
|
24456
24306
|
const defaults = { builtIns: BuiltIns };
|
|
24457
24307
|
//#endregion
|
|
24458
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
24308
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/internal/lexer.js
|
|
24459
24309
|
/**
|
|
24460
24310
|
* @internal
|
|
24461
24311
|
*/
|
|
@@ -24517,7 +24367,7 @@ const lexTokens = (args) => {
|
|
|
24517
24367
|
return tokens;
|
|
24518
24368
|
};
|
|
24519
24369
|
//#endregion
|
|
24520
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
24370
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/internal/auto-suggest.js
|
|
24521
24371
|
/**
|
|
24522
24372
|
* Simple Levenshtein distance implementation (small N, no perf worries)
|
|
24523
24373
|
*/
|
|
@@ -24545,7 +24395,7 @@ const suggest = (input, candidates) => {
|
|
|
24545
24395
|
return distances.filter(([d]) => d === minDistance).map(([, c]) => c);
|
|
24546
24396
|
};
|
|
24547
24397
|
//#endregion
|
|
24548
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
24398
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/internal/parser.js
|
|
24549
24399
|
/**
|
|
24550
24400
|
* Parsing Pipeline for CLI Commands
|
|
24551
24401
|
* ==================================
|
|
@@ -24575,7 +24425,7 @@ const suggest = (input, candidates) => {
|
|
|
24575
24425
|
/**
|
|
24576
24426
|
* @internal
|
|
24577
24427
|
*/
|
|
24578
|
-
const getCommandPath = (parsedInput) => match$
|
|
24428
|
+
const getCommandPath = (parsedInput) => match$5(parsedInput.subcommand, {
|
|
24579
24429
|
onNone: () => [],
|
|
24580
24430
|
onSome: (subcommand) => [subcommand.name, ...getCommandPath(subcommand.parsedInput)]
|
|
24581
24431
|
});
|
|
@@ -24731,8 +24581,9 @@ const asBooleanLiteral = (token) => token?._tag === "Value" && (isTrueLiteral(to
|
|
|
24731
24581
|
*
|
|
24732
24582
|
* Value resolution order:
|
|
24733
24583
|
* 1. Inline value: --flag=value or -f=value
|
|
24734
|
-
* 2.
|
|
24735
|
-
* 3.
|
|
24584
|
+
* 2. Optional value: the flag's configured value, without consuming a token
|
|
24585
|
+
* 3. Boolean special case: implicit "true" or explicit boolean literal
|
|
24586
|
+
* 4. Next token: consume following Value token if present
|
|
24736
24587
|
*/
|
|
24737
24588
|
const consumeFlagValue = (cursor, token, spec, negated = false) => {
|
|
24738
24589
|
const consumed = consumeFlagValueWithTokens(cursor, token, spec, negated);
|
|
@@ -24754,7 +24605,7 @@ const consumeFlagValueWithTokens = (cursor, token, spec, negated = false) => {
|
|
|
24754
24605
|
error: invalidNegatedFlagValue(token, spec, token.value),
|
|
24755
24606
|
tokens: []
|
|
24756
24607
|
};
|
|
24757
|
-
const literal = asBooleanLiteral(cursor.peek());
|
|
24608
|
+
const literal = spec.optionalValue === void 0 ? asBooleanLiteral(cursor.peek()) : void 0;
|
|
24758
24609
|
if (literal !== void 0) {
|
|
24759
24610
|
const literalToken = cursor.take();
|
|
24760
24611
|
return {
|
|
@@ -24774,6 +24625,11 @@ const consumeFlagValueWithTokens = (cursor, token, spec, negated = false) => {
|
|
|
24774
24625
|
value: token.value,
|
|
24775
24626
|
tokens: []
|
|
24776
24627
|
};
|
|
24628
|
+
if (spec.optionalValue !== void 0) return {
|
|
24629
|
+
_tag: "Value",
|
|
24630
|
+
value: spec.optionalValue,
|
|
24631
|
+
tokens: []
|
|
24632
|
+
};
|
|
24777
24633
|
if (isBoolean(spec.primitiveType)) {
|
|
24778
24634
|
const literal = asBooleanLiteral(cursor.peek());
|
|
24779
24635
|
const literalToken = literal !== void 0 ? cursor.take() : void 0;
|
|
@@ -25077,7 +24933,7 @@ const scanCommandLevel = (tokens, context) => {
|
|
|
25077
24933
|
return toLeafResult(state);
|
|
25078
24934
|
};
|
|
25079
24935
|
//#endregion
|
|
25080
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
24936
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/internal/wizard.js
|
|
25081
24937
|
const run$1 = /*#__PURE__*/ fnUntraced(function* (command, options) {
|
|
25082
24938
|
const commandPath = options?.commandPath ?? [command.name];
|
|
25083
24939
|
const selected = getCommandAtPath(command, commandPath);
|
|
@@ -25160,7 +25016,7 @@ const promptParam = /*#__PURE__*/ fnUntraced(function* (param) {
|
|
|
25160
25016
|
yield* param.parse(parsed);
|
|
25161
25017
|
yield* log();
|
|
25162
25018
|
if (single.kind === "argument") return values;
|
|
25163
|
-
return values.flatMap((value) => value.value.startsWith("-") && value.value.length > 1 ? [commandLineArg(`--${single.name}=${value.value}`, `--${single.name}=${value.displayValue}`)] : [commandLineArg(`--${single.name}`), value]);
|
|
25019
|
+
return values.flatMap((value) => single.optionalValue !== void 0 || value.value.startsWith("-") && value.value.length > 1 ? [commandLineArg(`--${single.name}=${value.value}`, `--${single.name}=${value.displayValue}`)] : [commandLineArg(`--${single.name}`), value]);
|
|
25164
25020
|
});
|
|
25165
25021
|
const promptSingle = (single) => {
|
|
25166
25022
|
const message = renderParamMessage(single);
|
|
@@ -25248,7 +25104,7 @@ const wrapCommand = (commandLine) => {
|
|
|
25248
25104
|
};
|
|
25249
25105
|
const formatShellArg = (arg) => /^[A-Za-z0-9_./:@%+=,-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", `'"'"'`)}'`;
|
|
25250
25106
|
//#endregion
|
|
25251
|
-
//#region ../../node_modules/.pnpm/effect@4.0.
|
|
25107
|
+
//#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/cli/Command.js
|
|
25252
25108
|
/**
|
|
25253
25109
|
* Creates a `Command` from a name, an optional configuration, and an optional
|
|
25254
25110
|
* handler.
|
|
@@ -25681,7 +25537,7 @@ const runWith = (command, config) => {
|
|
|
25681
25537
|
const [, value] = yield* flag.flag.parse(emptyArgs);
|
|
25682
25538
|
program = provideService(program, flag, value);
|
|
25683
25539
|
}
|
|
25684
|
-
const services = match$
|
|
25540
|
+
const services = match$5(logLevel, {
|
|
25685
25541
|
onNone: () => empty$2(),
|
|
25686
25542
|
onSome: (level) => make$26(MinimumLogLevel, level)
|
|
25687
25543
|
});
|
|
@@ -25690,7 +25546,7 @@ const runWith = (command, config) => {
|
|
|
25690
25546
|
};
|
|
25691
25547
|
//#endregion
|
|
25692
25548
|
//#region package.json
|
|
25693
|
-
var version = "0.1.
|
|
25549
|
+
var version = "0.1.1079";
|
|
25694
25550
|
//#endregion
|
|
25695
25551
|
//#region src/install.ts
|
|
25696
25552
|
const cli = pipe(make("deslop-coding-standards", {}, fnUntraced(function* () {
|
|
@@ -25726,7 +25582,10 @@ const cli = pipe(make("deslop-coding-standards", {}, fnUntraced(function* () {
|
|
|
25726
25582
|
const targets = dedupe([
|
|
25727
25583
|
...directories,
|
|
25728
25584
|
".claude",
|
|
25729
|
-
...contains(directories, ".codex")
|
|
25585
|
+
...match(contains(directories, ".codex"), {
|
|
25586
|
+
onFalse: () => [".agents"],
|
|
25587
|
+
onTrue: () => empty$3()
|
|
25588
|
+
})
|
|
25730
25589
|
]);
|
|
25731
25590
|
function isGlobal(destination) {
|
|
25732
25591
|
return some$1(globals, (global) => destination === global || pipe(destination, startsWith(`${global}${path.sep}`)));
|