@e-n-v/env 0.0.5 → 0.0.8
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/dist/{BooleanMap-DmFnCA-O.d.ts → BooleanMap-BPQuO3Ae.d.ts} +1 -3
- package/dist/{BooleanMap-B2eIP3tZ.d.cts → BooleanMap-CX_YrPCf.d.cts} +1 -3
- package/dist/EnvChannelOptions-BbKeuO-o.d.cts +366 -0
- package/dist/EnvChannelOptions-BbKeuO-o.d.ts +366 -0
- package/dist/{EnvSource-DA3ZGlES.js → EnvSource-WAGWqRVM.js} +6 -10
- package/dist/{EnvSource-BVnmdHku.cjs → EnvSource-s8F_M_6O.cjs} +21 -28
- package/dist/EnvVarSchema-CDZGmnex.cjs +15 -0
- package/dist/EnvVarSchema-Dr6q7jf6.js +10 -0
- package/dist/{ProcessEnvChannel-Do4-yiLI.d.ts → ProcessEnvChannel-CwhV7_EB.d.ts} +2 -4
- package/dist/{ProcessEnvChannel-D465c-dp.d.cts → ProcessEnvChannel-DWHPZePe.d.cts} +2 -4
- package/dist/{StringEnvVarSchema-B8MT7htU.d.ts → StringEnvVarSchema-D9Jr1Aws.d.cts} +5 -3
- package/dist/{StringEnvVarSchema-BF6C0nyT.d.cts → StringEnvVarSchema-D9Jr1Aws.d.ts} +5 -3
- package/dist/channels.cjs +3 -4
- package/dist/channels.d.cts +3 -4
- package/dist/channels.d.ts +3 -4
- package/dist/channels.js +2 -4
- package/dist/cli.cjs +10 -23
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +7 -13
- package/dist/core.cjs +13 -14
- package/dist/core.d.cts +147 -6
- package/dist/core.d.ts +147 -6
- package/dist/core.js +9 -11
- package/dist/{custom-Bt_wnxIu.js → custom-Bd-jLg80.js} +3 -12
- package/dist/{custom-D_Rqjm09.cjs → custom-Dyb9TnER.cjs} +48 -58
- package/dist/files.cjs +6 -6
- package/dist/files.d.cts +2 -2
- package/dist/files.d.ts +2 -2
- package/dist/files.js +2 -5
- package/dist/{parse-DwtLpVhC.d.ts → index-B2eNij2x.d.cts} +1 -2
- package/dist/{parse-BT1QSa5e.d.cts → index-BHTM8nxS.d.ts} +1 -2
- package/dist/{prompt-yKdccbtZ.d.ts → index-BKBW9Dxs.d.cts} +3 -4
- package/dist/{prompt-C5WudV9x.d.cts → index-CEyOIRdj.d.ts} +3 -4
- package/dist/{EnvModel-CrGclUpJ.d.cts → index-Cb0abjLf.d.ts} +59 -7
- package/dist/{EnvModel-D8rt0EJ6.d.ts → index-Cz3frUwZ.d.cts} +58 -6
- package/dist/index.cjs +33 -0
- package/dist/index.d.cts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +15 -0
- package/dist/model.cjs +10 -11
- package/dist/model.d.cts +2 -35
- package/dist/model.d.ts +2 -35
- package/dist/model.js +2 -6
- package/dist/parse.cjs +14 -14
- package/dist/parse.d.cts +5 -8
- package/dist/parse.d.ts +5 -8
- package/dist/parse.js +4 -7
- package/dist/preprocessors-BKuIcZa1.d.ts +83 -0
- package/dist/preprocessors-DFVyF0c7.d.cts +83 -0
- package/dist/prompt.cjs +12 -15
- package/dist/prompt.d.cts +5 -10
- package/dist/prompt.d.ts +5 -10
- package/dist/prompt.js +3 -9
- package/dist/{redis-EcC7TX3K.cjs → redis-CyTF0SYT.cjs} +321 -253
- package/dist/{redis-CJOpRPjc.js → redis-D18f4ztf.js} +76 -37
- package/dist/{index-Dq_0aeAL.d.ts → redis-DsW-Vkwq.d.cts} +26 -6
- package/dist/{index-D8pslhp4.d.cts → redis-tRD4nAy_.d.ts} +26 -6
- package/dist/{resolveChannel-v9BDsw-M.js → resolveChannel-D1Fzl4TL.js} +59 -63
- package/dist/{resolveChannel-CjAuxy3p.cjs → resolveChannel-DxZNYdDe.cjs} +84 -92
- package/dist/{chunk-pbleEpgJ.cjs → rolldown-runtime-C0BPl7ul.cjs} +15 -16
- package/dist/{chunk-Bp6m_JJh.js → rolldown-runtime-D7D4PA-g.js} +4 -4
- package/dist/{schema-jN4EtvEP.d.ts → schema-B-JLVS42.d.ts} +1 -3
- package/dist/{schema-DH4GiW9A.d.cts → schema-B1i83alz.d.cts} +1 -3
- package/dist/schema-CtP5lpU1.js +11 -0
- package/dist/schema-D9nJKipf.cjs +22 -0
- package/dist/schemas/zod.cjs +112 -359
- package/dist/schemas/zod.d.cts +117 -87
- package/dist/schemas/zod.d.ts +117 -87
- package/dist/schemas/zod.js +116 -377
- package/dist/schemas.cjs +152 -133
- package/dist/schemas.d.cts +2 -3
- package/dist/schemas.d.ts +2 -3
- package/dist/schemas.js +2 -6
- package/dist/{src-Cjo2XA4n.cjs → src-5GYFbR9n.cjs} +21 -25
- package/dist/{src-BBwjK5SK.js → src-8rEOvFG5.js} +11 -15
- package/dist/{src-Dtv7TlJx.js → src-CdzAzdq-.js} +100 -114
- package/dist/{src-CLTURaoo.js → src-Cg49gGJb.js} +18 -44
- package/dist/{src-DWYoqPX1.cjs → src-CttkcdpE.cjs} +114 -133
- package/dist/{src-XjL5cyPG.cjs → src-D5KzIEH_.cjs} +130 -107
- package/dist/src-DB0Har0j.cjs +1632 -0
- package/dist/{src-CVdUqK3q.js → src-DWc-WWjX.js} +107 -86
- package/dist/{src-B7FG1rak.js → src-DvUBRBe3.js} +205 -116
- package/dist/{src-meUnCASg.cjs → src-TZx_e95f.cjs} +87 -132
- package/dist/{vars-BNVI6k89.d.ts → vars-DtzGL5Nc.d.cts} +1 -4
- package/dist/{vars-CptZRPX5.d.cts → vars-obKYxaSu.d.ts} +1 -4
- package/dist/vars.cjs +175 -138
- package/dist/vars.d.cts +3 -7
- package/dist/vars.d.ts +3 -7
- package/dist/vars.js +21 -9
- package/package.json +9 -8
- package/dist/EnvChannelOptions-BPkWDrmr.d.cts +0 -108
- package/dist/EnvChannelOptions-CRwDLWjd.d.ts +0 -108
- package/dist/coerce-DNIuYAx4.js +0 -11028
- package/dist/coerce-b7UVodS9.cjs +0 -12365
- package/dist/model-Dic8IJsf.d.ts +0 -29
- package/dist/model-ft0WhSSS.d.cts +0 -29
- package/dist/root.cjs +0 -36
- package/dist/root.d.cts +0 -21
- package/dist/root.d.ts +0 -21
- package/dist/root.js +0 -21
- package/dist/src-DZmpNGrQ.cjs +0 -1411
- package/dist/validate-BxA3a-ns.d.cts +0 -203
- package/dist/validate-CyxrRacF.d.ts +0 -203
- package/dist/vars-CYOaskkK.cjs +0 -27
- package/dist/vars-DOW0LiiN.js +0 -22
- /package/dist/{EnvChannel-LMIRYvT1.d.cts → EnvChannel-CfSwa_25.d.cts} +0 -0
- /package/dist/{EnvChannel-w27PEm7x.d.ts → EnvChannel-CfSwa_25.d.ts} +0 -0
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { t as
|
|
3
|
-
import { i as
|
|
4
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { n as preprocessors, t as resolvePreprocessor } from "./src-Cg49gGJb.js";
|
|
3
|
+
import { i as resolveSchemas, n as EnvModel } from "./src-DWc-WWjX.js";
|
|
4
|
+
import { t as resolveChannel } from "./resolveChannel-D1Fzl4TL.js";
|
|
5
5
|
import { dirname, relative, resolve } from "node:path";
|
|
6
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
6
|
import { stdin, stdout } from "node:process";
|
|
8
7
|
import { Prompt, isCancel } from "@clack/core";
|
|
8
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
9
9
|
import color from "picocolors";
|
|
10
|
+
import { execFile } from "node:child_process";
|
|
11
|
+
import { platform } from "node:os";
|
|
10
12
|
import { clearLine, cursorTo, moveCursor } from "node:readline";
|
|
11
|
-
|
|
12
13
|
//#region ../prompt/src/options/defaults.ts
|
|
13
|
-
var defaults_exports = /* @__PURE__ */
|
|
14
|
+
var defaults_exports = /* @__PURE__ */ __exportAll({
|
|
14
15
|
ENV_PATH: () => ENV_PATH,
|
|
15
16
|
SECRET_PATTERNS: () => SECRET_PATTERNS,
|
|
16
|
-
TRUNCATE_LENGTH: () =>
|
|
17
|
+
TRUNCATE_LENGTH: () => 40
|
|
17
18
|
});
|
|
18
19
|
const ENV_PATH = ".env";
|
|
19
|
-
const TRUNCATE_LENGTH = 40;
|
|
20
20
|
const SECRET_PATTERNS = Object.freeze([
|
|
21
21
|
/password/i,
|
|
22
22
|
/passphrase/i,
|
|
23
23
|
/secret/i,
|
|
24
|
-
/(?<!expires[_-]?in[_-]?)token(?![_-]
|
|
24
|
+
/(?<!(?:^|[_-])(?:expires[_-]?in|expiry|expiration|ttl|lifetime|duration|age|max[_-]?age|validity)[_-])token(?(?:$|[_-]))/i,
|
|
25
25
|
/api[_-]?key/i,
|
|
26
26
|
/client[_-]?secret/i,
|
|
27
27
|
/private[_-]?key/i,
|
|
@@ -30,7 +30,6 @@ const SECRET_PATTERNS = Object.freeze([
|
|
|
30
30
|
/access[_-]?key/i,
|
|
31
31
|
/credential/i
|
|
32
32
|
]);
|
|
33
|
-
|
|
34
33
|
//#endregion
|
|
35
34
|
//#region ../prompt/src/visuals/Theme.ts
|
|
36
35
|
var Theme = class Theme {
|
|
@@ -73,25 +72,6 @@ var Theme = class Theme {
|
|
|
73
72
|
return color.bgBlack;
|
|
74
73
|
}
|
|
75
74
|
};
|
|
76
|
-
|
|
77
|
-
//#endregion
|
|
78
|
-
//#region ../prompt/src/visuals/symbols.ts
|
|
79
|
-
const S_BAR = "│";
|
|
80
|
-
const S_BAR_END = "└";
|
|
81
|
-
const S_BAR_START = "┌";
|
|
82
|
-
const S_STEP_ACTIVE = "◆";
|
|
83
|
-
const S_STEP_SUBMIT = "✔";
|
|
84
|
-
const S_STEP_SKIP = "⏭";
|
|
85
|
-
const S_STEP_CANCEL = "✕";
|
|
86
|
-
const S_STEP_ERROR = "▲";
|
|
87
|
-
const S_STEP_PREVIOUS = "⏮";
|
|
88
|
-
const S_TOOL_ACTIVE = "■";
|
|
89
|
-
const S_TOOL_INACTIVE = "□";
|
|
90
|
-
const S_RADIO_ACTIVE = "●";
|
|
91
|
-
const S_RADIO_INACTIVE = "○";
|
|
92
|
-
const S_CURSOR = "█";
|
|
93
|
-
const SECRET_MASK = "•";
|
|
94
|
-
|
|
95
75
|
//#endregion
|
|
96
76
|
//#region ../prompt/src/prompts/ThemedPrompt.ts
|
|
97
77
|
var ThemedPrompt = class extends Prompt {
|
|
@@ -106,11 +86,11 @@ var ThemedPrompt = class extends Prompt {
|
|
|
106
86
|
getSymbol() {
|
|
107
87
|
switch (this.state) {
|
|
108
88
|
case "initial":
|
|
109
|
-
case "active": return this.theme.primary(
|
|
110
|
-
case "error": return this.theme.warn(
|
|
111
|
-
case "submit": return this.theme.primary(
|
|
112
|
-
case "cancel": return this.theme.error(
|
|
113
|
-
default: return this.theme.primary(
|
|
89
|
+
case "active": return this.theme.primary("◆");
|
|
90
|
+
case "error": return this.theme.warn("▲");
|
|
91
|
+
case "submit": return this.theme.primary("✔");
|
|
92
|
+
case "cancel": return this.theme.error("✕");
|
|
93
|
+
default: return this.theme.primary("◆");
|
|
114
94
|
}
|
|
115
95
|
}
|
|
116
96
|
/**
|
|
@@ -123,10 +103,10 @@ var ThemedPrompt = class extends Prompt {
|
|
|
123
103
|
* Get bar symbols with appropriate coloring
|
|
124
104
|
*/
|
|
125
105
|
getBar() {
|
|
126
|
-
return this.getBarColor(
|
|
106
|
+
return this.getBarColor("│");
|
|
127
107
|
}
|
|
128
108
|
getBarEnd() {
|
|
129
|
-
return this.getBarColor(
|
|
109
|
+
return this.getBarColor("└");
|
|
130
110
|
}
|
|
131
111
|
/**
|
|
132
112
|
* Color utilities for consistent theming
|
|
@@ -145,14 +125,13 @@ var ThemedPrompt = class extends Prompt {
|
|
|
145
125
|
};
|
|
146
126
|
}
|
|
147
127
|
};
|
|
148
|
-
|
|
149
128
|
//#endregion
|
|
150
129
|
//#region ../prompt/src/prompts/utils/ClackPromptInternals.ts
|
|
151
130
|
/** Hacks to access private members of Clack prompts */
|
|
152
131
|
var ClackPromptInternals = class {
|
|
153
132
|
prompt;
|
|
154
|
-
constructor(prompt
|
|
155
|
-
this.prompt = prompt
|
|
133
|
+
constructor(prompt) {
|
|
134
|
+
this.prompt = prompt;
|
|
156
135
|
}
|
|
157
136
|
set track(enabled) {
|
|
158
137
|
this.prompt._track = enabled;
|
|
@@ -161,7 +140,6 @@ var ClackPromptInternals = class {
|
|
|
161
140
|
return this.prompt._track;
|
|
162
141
|
}
|
|
163
142
|
};
|
|
164
|
-
|
|
165
143
|
//#endregion
|
|
166
144
|
//#region ../prompt/src/prompts/utils/padActiveRender.ts
|
|
167
145
|
/**
|
|
@@ -179,19 +157,20 @@ function padActiveRender(render) {
|
|
|
179
157
|
return result + "\n";
|
|
180
158
|
};
|
|
181
159
|
}
|
|
182
|
-
|
|
183
160
|
//#endregion
|
|
184
161
|
//#region ../prompt/src/prompts/toolbar/Toolbar.ts
|
|
185
162
|
var Toolbar = class {
|
|
186
163
|
_isOpen = false;
|
|
187
164
|
cursor = 0;
|
|
188
165
|
previous;
|
|
166
|
+
link;
|
|
189
167
|
theme;
|
|
190
168
|
actions;
|
|
191
169
|
secret;
|
|
192
170
|
constructor(config) {
|
|
193
171
|
this.previous = config.previous;
|
|
194
172
|
this.secret = config.secret;
|
|
173
|
+
this.link = config.link;
|
|
195
174
|
this.theme = config.theme;
|
|
196
175
|
this.actions = config.actions;
|
|
197
176
|
}
|
|
@@ -242,7 +221,7 @@ var Toolbar = class {
|
|
|
242
221
|
const separator = this.theme.subtle(" / ");
|
|
243
222
|
return `${options.map((option, index) => {
|
|
244
223
|
const isFocused = index === this.cursor;
|
|
245
|
-
const label = `${isFocused ?
|
|
224
|
+
const label = `${isFocused ? "■" : "□"} ${option.label}`;
|
|
246
225
|
return isFocused ? this.theme.primary(label) : this.theme.subtle(label);
|
|
247
226
|
}).join(separator)}${separator}${this.theme.subtle("Tab to return")}`;
|
|
248
227
|
}
|
|
@@ -288,10 +267,14 @@ var Toolbar = class {
|
|
|
288
267
|
label: this.secret === "shown" ? "Hide" : "Show",
|
|
289
268
|
action: this.actions.toggleSecret
|
|
290
269
|
});
|
|
270
|
+
if (this.link) options.push({
|
|
271
|
+
key: "openLink",
|
|
272
|
+
label: "Open link",
|
|
273
|
+
action: this.actions.openLink
|
|
274
|
+
});
|
|
291
275
|
return options;
|
|
292
276
|
}
|
|
293
277
|
};
|
|
294
|
-
|
|
295
278
|
//#endregion
|
|
296
279
|
//#region ../prompt/src/prompts/state/EnvPromptModeDetails.ts
|
|
297
280
|
/**
|
|
@@ -330,7 +313,6 @@ function createState(modeDetails) {
|
|
|
330
313
|
...computeState(modeDetails)
|
|
331
314
|
};
|
|
332
315
|
}
|
|
333
|
-
|
|
334
316
|
//#endregion
|
|
335
317
|
//#region ../prompt/src/prompts/state/EnvPromptMode.ts
|
|
336
318
|
/**
|
|
@@ -493,7 +475,6 @@ var EnvPromptMode = class {
|
|
|
493
475
|
return this.intention;
|
|
494
476
|
}
|
|
495
477
|
};
|
|
496
|
-
|
|
497
478
|
//#endregion
|
|
498
479
|
//#region ../prompt/src/prompts/processing/processValue.ts
|
|
499
480
|
/**
|
|
@@ -512,14 +493,15 @@ function processValue(envKey, value, schema, preprocess) {
|
|
|
512
493
|
if (typeof preprocess === "function") return preprocess;
|
|
513
494
|
return resolvePreprocessor(schema.type);
|
|
514
495
|
})();
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
496
|
+
let processedValue = value;
|
|
497
|
+
if (activePreprocessor) try {
|
|
498
|
+
processedValue = activePreprocessor(value);
|
|
499
|
+
} catch {
|
|
500
|
+
processedValue = value;
|
|
501
|
+
}
|
|
502
|
+
if (!schema.process) throw new Error(`No processor configured for ${envKey}`);
|
|
521
503
|
return {
|
|
522
|
-
value: schema.process(
|
|
504
|
+
value: schema.process(processedValue),
|
|
523
505
|
rawValue: value,
|
|
524
506
|
isValid: true
|
|
525
507
|
};
|
|
@@ -532,7 +514,6 @@ function processValue(envKey, value, schema, preprocess) {
|
|
|
532
514
|
};
|
|
533
515
|
}
|
|
534
516
|
}
|
|
535
|
-
|
|
536
517
|
//#endregion
|
|
537
518
|
//#region ../prompt/src/prompts/EnvPrompt.ts
|
|
538
519
|
var EnvPrompt = class extends ThemedPrompt {
|
|
@@ -567,7 +548,7 @@ var EnvPrompt = class extends ThemedPrompt {
|
|
|
567
548
|
/** State machine managing prompt interaction modes. */
|
|
568
549
|
mode;
|
|
569
550
|
constructor(schema, opts) {
|
|
570
|
-
const { pad = true
|
|
551
|
+
const { pad = true, ...promptOpts } = opts;
|
|
571
552
|
const promptOptions = {
|
|
572
553
|
...promptOpts,
|
|
573
554
|
default: schema.default,
|
|
@@ -608,11 +589,13 @@ var EnvPrompt = class extends ThemedPrompt {
|
|
|
608
589
|
this.toolbar = new Toolbar({
|
|
609
590
|
previous: this.index > 0,
|
|
610
591
|
secret: hasSecret ? this.mode.isSecretRevealed() ? "shown" : "hidden" : false,
|
|
592
|
+
link: this.schema.link,
|
|
611
593
|
theme: this.theme,
|
|
612
594
|
actions: {
|
|
613
595
|
toggleSecret: () => this.handleToggleSecret(),
|
|
614
596
|
skip: () => this.handleSkip(),
|
|
615
|
-
previous: () => this.handlePrevious()
|
|
597
|
+
previous: () => this.handlePrevious(),
|
|
598
|
+
openLink: () => this.handleOpenLink()
|
|
616
599
|
}
|
|
617
600
|
});
|
|
618
601
|
this.on("finalize", () => {
|
|
@@ -714,10 +697,10 @@ var EnvPrompt = class extends ThemedPrompt {
|
|
|
714
697
|
return `${value.substring(0, this.truncate)}...`;
|
|
715
698
|
}
|
|
716
699
|
renderSkipped() {
|
|
717
|
-
return `${this.colors.dim(this.theme.primary(
|
|
700
|
+
return `${this.colors.dim(this.theme.primary("⏭"))} ${this.colors.subtle(this.colors.bold(this.key))}`;
|
|
718
701
|
}
|
|
719
702
|
renderPrevious() {
|
|
720
|
-
return `${this.colors.dim(this.theme.primary(
|
|
703
|
+
return `${this.colors.dim(this.theme.primary("⏮"))} ${this.colors.subtle(this.colors.bold(this.key))}`;
|
|
721
704
|
}
|
|
722
705
|
renderOutcomeResult() {
|
|
723
706
|
const intention = this.mode.intention;
|
|
@@ -725,7 +708,7 @@ var EnvPrompt = class extends ThemedPrompt {
|
|
|
725
708
|
if (intention === "previous") return this.renderPrevious();
|
|
726
709
|
}
|
|
727
710
|
renderCancelled() {
|
|
728
|
-
return `${this.theme.error(
|
|
711
|
+
return `${this.theme.error("✕")} ${this.colors.subtle(this.colors.bold(this.key))}`;
|
|
729
712
|
}
|
|
730
713
|
toggleSecretReveal() {
|
|
731
714
|
if (!this.mode.hasSecret()) return;
|
|
@@ -752,6 +735,26 @@ var EnvPrompt = class extends ThemedPrompt {
|
|
|
752
735
|
this.value = void 0;
|
|
753
736
|
this.state = "submit";
|
|
754
737
|
}
|
|
738
|
+
handleOpenLink() {
|
|
739
|
+
const link = this.schema.link;
|
|
740
|
+
if (!link) return;
|
|
741
|
+
let url;
|
|
742
|
+
try {
|
|
743
|
+
url = new URL(link);
|
|
744
|
+
} catch {
|
|
745
|
+
console.error("Failed to open link");
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
749
|
+
console.error("Failed to open link");
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
this.mode.suppressValidation();
|
|
753
|
+
const [executable, args] = platform() === "win32" ? ["rundll32.exe", ["url.dll,FileProtocolHandler", url.href]] : platform() === "darwin" ? ["open", [url.href]] : ["xdg-open", [url.href]];
|
|
754
|
+
execFile(executable, args, (error) => {
|
|
755
|
+
if (error) console.error("Failed to open link");
|
|
756
|
+
});
|
|
757
|
+
}
|
|
755
758
|
consumeSkipValidation() {
|
|
756
759
|
if (this.mode.state.shouldSkipValidation) {
|
|
757
760
|
this.mode.restoreValidation();
|
|
@@ -786,7 +789,6 @@ var EnvPrompt = class extends ThemedPrompt {
|
|
|
786
789
|
return labels.length > 0 ? labels.join(", ") : void 0;
|
|
787
790
|
}
|
|
788
791
|
};
|
|
789
|
-
|
|
790
792
|
//#endregion
|
|
791
793
|
//#region ../prompt/src/prompts/utils/selectableOptions.ts
|
|
792
794
|
function buildSelectableOptions(params) {
|
|
@@ -830,7 +832,6 @@ function getOptionAtCursor(options, cursor) {
|
|
|
830
832
|
index
|
|
831
833
|
};
|
|
832
834
|
}
|
|
833
|
-
|
|
834
835
|
//#endregion
|
|
835
836
|
//#region ../prompt/src/prompts/typed/EnvBooleanPrompt.ts
|
|
836
837
|
var EnvBooleanPrompt = class extends EnvPrompt {
|
|
@@ -850,11 +851,11 @@ var EnvBooleanPrompt = class extends EnvPrompt {
|
|
|
850
851
|
output += `${this.getSymbol()} ${this.colors.bold(this.colors.white(this.key))}`;
|
|
851
852
|
if (this.schema.description) output += ` ${this.colors.subtle(this.schema.description)}`;
|
|
852
853
|
output += "\n";
|
|
853
|
-
const options
|
|
854
|
+
const options = this.buildOptions();
|
|
854
855
|
const dimInputs = !this.error && this.mode.isToolbarOpen();
|
|
855
|
-
options
|
|
856
|
+
options.forEach((option, index) => {
|
|
856
857
|
const isSelected = index === this.cursor;
|
|
857
|
-
const circle = dimInputs ? this.colors.dim(isSelected ?
|
|
858
|
+
const circle = dimInputs ? this.colors.dim(isSelected ? "●" : "○") : isSelected ? this.theme.primary("●") : this.colors.dim("○");
|
|
858
859
|
const formatText = (value) => {
|
|
859
860
|
if (dimInputs) return this.colors.dim(value);
|
|
860
861
|
if (isSelected) return this.colors.white(value);
|
|
@@ -886,9 +887,9 @@ var EnvBooleanPrompt = class extends EnvPrompt {
|
|
|
886
887
|
this.on("cursor", (action) => {
|
|
887
888
|
this.clearErrorState();
|
|
888
889
|
if (!this.error && this.mode.isToolbarOpen()) return;
|
|
889
|
-
const options
|
|
890
|
-
if (!options
|
|
891
|
-
const lastIndex = options
|
|
890
|
+
const options = this.buildOptions();
|
|
891
|
+
if (!options.length) return;
|
|
892
|
+
const lastIndex = options.length - 1;
|
|
892
893
|
switch (action) {
|
|
893
894
|
case "up":
|
|
894
895
|
this.cursor = this.cursor === 0 ? lastIndex : this.cursor - 1;
|
|
@@ -899,7 +900,6 @@ var EnvBooleanPrompt = class extends EnvPrompt {
|
|
|
899
900
|
default:
|
|
900
901
|
if (this.cursor > lastIndex) this.cursor = lastIndex;
|
|
901
902
|
if (this.cursor < 0) this.cursor = 0;
|
|
902
|
-
break;
|
|
903
903
|
}
|
|
904
904
|
this.updateValue();
|
|
905
905
|
});
|
|
@@ -948,7 +948,6 @@ var EnvBooleanPrompt = class extends EnvPrompt {
|
|
|
948
948
|
return option;
|
|
949
949
|
}
|
|
950
950
|
};
|
|
951
|
-
|
|
952
951
|
//#endregion
|
|
953
952
|
//#region ../prompt/src/prompts/typed/EnvEnumPrompt.ts
|
|
954
953
|
var EnvEnumPrompt = class extends EnvPrompt {
|
|
@@ -969,11 +968,11 @@ var EnvEnumPrompt = class extends EnvPrompt {
|
|
|
969
968
|
output += `${this.getSymbol()} ${this.colors.bold(this.colors.white(this.key))}`;
|
|
970
969
|
if (this.schema.description) output += ` ${this.colors.subtle(this.schema.description)}`;
|
|
971
970
|
output += "\n";
|
|
972
|
-
const options
|
|
971
|
+
const options = this.buildOptions();
|
|
973
972
|
const dimInputs = !this.error && this.mode.isToolbarOpen();
|
|
974
|
-
options
|
|
973
|
+
options.forEach((option, index) => {
|
|
975
974
|
const isSelected = index === this.cursor;
|
|
976
|
-
const circle = dimInputs ? this.colors.dim(isSelected ?
|
|
975
|
+
const circle = dimInputs ? this.colors.dim(isSelected ? "●" : "○") : isSelected ? this.theme.primary("●") : this.colors.dim("○");
|
|
977
976
|
const formatText = (value) => {
|
|
978
977
|
if (dimInputs) return this.colors.dim(value);
|
|
979
978
|
if (isSelected) return this.colors.white(value);
|
|
@@ -1009,9 +1008,9 @@ var EnvEnumPrompt = class extends EnvPrompt {
|
|
|
1009
1008
|
this.on("cursor", (action) => {
|
|
1010
1009
|
this.clearErrorState();
|
|
1011
1010
|
if (!this.error && this.mode.isToolbarOpen()) return;
|
|
1012
|
-
const options
|
|
1013
|
-
if (!options
|
|
1014
|
-
const lastIndex = options
|
|
1011
|
+
const options = this.buildOptions();
|
|
1012
|
+
if (!options.length) return;
|
|
1013
|
+
const lastIndex = options.length - 1;
|
|
1015
1014
|
switch (action) {
|
|
1016
1015
|
case "up":
|
|
1017
1016
|
this.cursor = this.cursor === 0 ? lastIndex : this.cursor - 1;
|
|
@@ -1022,7 +1021,6 @@ var EnvEnumPrompt = class extends EnvPrompt {
|
|
|
1022
1021
|
default:
|
|
1023
1022
|
if (this.cursor > lastIndex) this.cursor = lastIndex;
|
|
1024
1023
|
if (this.cursor < 0) this.cursor = 0;
|
|
1025
|
-
break;
|
|
1026
1024
|
}
|
|
1027
1025
|
this.updateValue();
|
|
1028
1026
|
});
|
|
@@ -1040,8 +1038,8 @@ var EnvEnumPrompt = class extends EnvPrompt {
|
|
|
1040
1038
|
return;
|
|
1041
1039
|
}
|
|
1042
1040
|
if (selected.invalid) {
|
|
1043
|
-
const fallback
|
|
1044
|
-
this.setCommittedValue(fallback
|
|
1041
|
+
const fallback = this.default ?? this.values[0];
|
|
1042
|
+
this.setCommittedValue(fallback);
|
|
1045
1043
|
return;
|
|
1046
1044
|
}
|
|
1047
1045
|
const fallback = this.default ?? this.values[0];
|
|
@@ -1072,7 +1070,6 @@ var EnvEnumPrompt = class extends EnvPrompt {
|
|
|
1072
1070
|
return option;
|
|
1073
1071
|
}
|
|
1074
1072
|
};
|
|
1075
|
-
|
|
1076
1073
|
//#endregion
|
|
1077
1074
|
//#region ../prompt/src/prompts/typed/EnvNumberPrompt.ts
|
|
1078
1075
|
var EnvNumberPrompt = class extends EnvPrompt {
|
|
@@ -1108,7 +1105,7 @@ var EnvNumberPrompt = class extends EnvPrompt {
|
|
|
1108
1105
|
}
|
|
1109
1106
|
this.buildSelectionOptions().forEach((option, index) => {
|
|
1110
1107
|
const isSelected = index === this.mode.getCursor();
|
|
1111
|
-
const circle = dimInputs ? this.colors.dim(isSelected ?
|
|
1108
|
+
const circle = dimInputs ? this.colors.dim(isSelected ? "●" : "○") : isSelected ? this.theme.primary("●") : this.colors.dim("○");
|
|
1112
1109
|
if (option.type === "other") {
|
|
1113
1110
|
if (this.mode.isInInteraction("typing")) {
|
|
1114
1111
|
const displayText = dimInputs ? this.colors.dim(this.getInputDisplay(false)) : this.colors.white(this.getInputDisplay(true));
|
|
@@ -1116,8 +1113,8 @@ var EnvNumberPrompt = class extends EnvPrompt {
|
|
|
1116
1113
|
} else if (isSelected) if (dimInputs) output += `${this.getBar()} ${circle} ${this.colors.dim(option.label)}\n`;
|
|
1117
1114
|
else output += `${this.getBar()} ${circle} ${this.colors.white(this.getInputDisplay(true))}\n`;
|
|
1118
1115
|
else {
|
|
1119
|
-
const text
|
|
1120
|
-
output += `${this.getBar()} ${circle} ${text
|
|
1116
|
+
const text = dimInputs ? this.colors.dim(option.label) : this.colors.subtle(option.label);
|
|
1117
|
+
output += `${this.getBar()} ${circle} ${text}\n`;
|
|
1121
1118
|
}
|
|
1122
1119
|
return;
|
|
1123
1120
|
}
|
|
@@ -1222,7 +1219,6 @@ var EnvNumberPrompt = class extends EnvPrompt {
|
|
|
1222
1219
|
this.otherInputCache = "";
|
|
1223
1220
|
}
|
|
1224
1221
|
this.mode.moveCursor("down", maxIndexDown);
|
|
1225
|
-
break;
|
|
1226
1222
|
}
|
|
1227
1223
|
this.updateValue();
|
|
1228
1224
|
});
|
|
@@ -1280,8 +1276,8 @@ var EnvNumberPrompt = class extends EnvPrompt {
|
|
|
1280
1276
|
"tab"
|
|
1281
1277
|
].includes(info.name || "");
|
|
1282
1278
|
if (!isArrowKey && !isControlKey) {
|
|
1283
|
-
const textInputIndex
|
|
1284
|
-
this.mode.setCursor(textInputIndex
|
|
1279
|
+
const textInputIndex = this.getTextInputIndex();
|
|
1280
|
+
this.mode.setCursor(textInputIndex);
|
|
1285
1281
|
const existingInput = this.mode.getInputValue() || this.userInput || this.otherInputCache || "";
|
|
1286
1282
|
this.mode.enterTyping(existingInput);
|
|
1287
1283
|
const nextInput = `${existingInput}${char}`;
|
|
@@ -1311,7 +1307,7 @@ var EnvNumberPrompt = class extends EnvPrompt {
|
|
|
1311
1307
|
if (!includeCursor) return inputValue;
|
|
1312
1308
|
const rawCursor = this.mode.isInInteraction("typing") ? Math.max(0, this._cursor ?? inputValue.length) : 0;
|
|
1313
1309
|
const cursorIndex = Math.min(rawCursor, inputValue.length);
|
|
1314
|
-
if (cursorIndex >= inputValue.length) return `${inputValue}
|
|
1310
|
+
if (cursorIndex >= inputValue.length) return `${inputValue}█`;
|
|
1315
1311
|
const before = inputValue.slice(0, cursorIndex);
|
|
1316
1312
|
const cursorChar = inputValue.charAt(cursorIndex) || " ";
|
|
1317
1313
|
const after = inputValue.slice(cursorIndex + 1);
|
|
@@ -1457,7 +1453,6 @@ var EnvNumberPrompt = class extends EnvPrompt {
|
|
|
1457
1453
|
return index === -1 ? options.length - 1 : index;
|
|
1458
1454
|
}
|
|
1459
1455
|
};
|
|
1460
|
-
|
|
1461
1456
|
//#endregion
|
|
1462
1457
|
//#region ../prompt/src/utils/secrets.ts
|
|
1463
1458
|
function isSecretMatch(value, pattern) {
|
|
@@ -1477,7 +1472,7 @@ function isSecretKey(key, description, patterns) {
|
|
|
1477
1472
|
for (const pattern of patterns) if (isSecretMatch(key, pattern) || isSecretMatch(description, pattern)) return true;
|
|
1478
1473
|
return false;
|
|
1479
1474
|
}
|
|
1480
|
-
function maskSecretValue(value, maskChar =
|
|
1475
|
+
function maskSecretValue(value, maskChar = "•") {
|
|
1481
1476
|
if (!value) return value;
|
|
1482
1477
|
return value.replace(/./g, maskChar);
|
|
1483
1478
|
}
|
|
@@ -1486,7 +1481,6 @@ function resolveShouldMask(key, schema, patterns) {
|
|
|
1486
1481
|
if ("secret" in schema && schema.secret !== void 0) return schema.secret;
|
|
1487
1482
|
return isSecretKey(key, schema.description, patterns);
|
|
1488
1483
|
}
|
|
1489
|
-
|
|
1490
1484
|
//#endregion
|
|
1491
1485
|
//#region ../prompt/src/prompts/typed/EnvStringPrompt.ts
|
|
1492
1486
|
var EnvStringPrompt = class extends EnvPrompt {
|
|
@@ -1519,7 +1513,7 @@ var EnvStringPrompt = class extends EnvPrompt {
|
|
|
1519
1513
|
}
|
|
1520
1514
|
this.buildSelectionOptions().forEach((option, index) => {
|
|
1521
1515
|
const isSelected = index === this.mode.getCursor();
|
|
1522
|
-
const circle = dimInputs ? this.colors.dim(isSelected ?
|
|
1516
|
+
const circle = dimInputs ? this.colors.dim(isSelected ? "●" : "○") : isSelected ? this.theme.primary("●") : this.colors.dim("○");
|
|
1523
1517
|
if (option.type === "other") {
|
|
1524
1518
|
if (this.mode.isInInteraction("typing")) {
|
|
1525
1519
|
const displayText = dimInputs ? this.colors.dim(this.getInputDisplay(false)) : this.colors.white(this.getInputDisplay(true));
|
|
@@ -1527,8 +1521,8 @@ var EnvStringPrompt = class extends EnvPrompt {
|
|
|
1527
1521
|
} else if (isSelected) if (dimInputs) output += `${this.getBar()} ${circle} ${this.colors.dim(option.label)}\n`;
|
|
1528
1522
|
else output += `${this.getBar()} ${circle} ${this.colors.white(this.getInputDisplay(true))}\n`;
|
|
1529
1523
|
else {
|
|
1530
|
-
const text
|
|
1531
|
-
output += `${this.getBar()} ${circle} ${text
|
|
1524
|
+
const text = dimInputs ? this.colors.dim(option.label) : this.colors.subtle(option.label);
|
|
1525
|
+
output += `${this.getBar()} ${circle} ${text}\n`;
|
|
1532
1526
|
}
|
|
1533
1527
|
return;
|
|
1534
1528
|
}
|
|
@@ -1702,8 +1696,8 @@ var EnvStringPrompt = class extends EnvPrompt {
|
|
|
1702
1696
|
"tab"
|
|
1703
1697
|
].includes(info.name || "");
|
|
1704
1698
|
if (!isArrowKey && !isControlKey) {
|
|
1705
|
-
const textInputIndex
|
|
1706
|
-
this.mode.setCursor(textInputIndex
|
|
1699
|
+
const textInputIndex = this.getTextInputIndex();
|
|
1700
|
+
this.mode.setCursor(textInputIndex);
|
|
1707
1701
|
const existingInput = this.mode.getInputValue() || this.userInput || this.otherInputCache || "";
|
|
1708
1702
|
this.mode.enterTyping(existingInput);
|
|
1709
1703
|
const nextInput = `${existingInput}${char}`;
|
|
@@ -1845,7 +1839,7 @@ var EnvStringPrompt = class extends EnvPrompt {
|
|
|
1845
1839
|
return this.truncateValue(display);
|
|
1846
1840
|
}
|
|
1847
1841
|
maskValue(value) {
|
|
1848
|
-
return maskSecretValue(value,
|
|
1842
|
+
return maskSecretValue(value, "•");
|
|
1849
1843
|
}
|
|
1850
1844
|
getTextInputIndex() {
|
|
1851
1845
|
if (!this.hasPresetOptions()) return 0;
|
|
@@ -1859,9 +1853,9 @@ var EnvStringPrompt = class extends EnvPrompt {
|
|
|
1859
1853
|
const base = isMasked ? this.maskValue(inputValue) : inputValue;
|
|
1860
1854
|
if (!includeCursor) return base;
|
|
1861
1855
|
const rawCursor = this.mode.isInInteraction("typing") ? Math.max(0, this._cursor ?? inputValue.length) : 0;
|
|
1862
|
-
const maskLength = isMasked ? Math.max(1,
|
|
1856
|
+
const maskLength = isMasked ? Math.max(1, 1) : 1;
|
|
1863
1857
|
const cursorIndex = Math.min(rawCursor * maskLength, base.length);
|
|
1864
|
-
if (cursorIndex >= base.length) return `${base}
|
|
1858
|
+
if (cursorIndex >= base.length) return `${base}█`;
|
|
1865
1859
|
const segmentLength = maskLength;
|
|
1866
1860
|
const before = base.slice(0, cursorIndex);
|
|
1867
1861
|
const cursorSegment = base.slice(cursorIndex, cursorIndex + segmentLength) || " ";
|
|
@@ -1894,7 +1888,6 @@ var EnvStringPrompt = class extends EnvPrompt {
|
|
|
1894
1888
|
});
|
|
1895
1889
|
}
|
|
1896
1890
|
};
|
|
1897
|
-
|
|
1898
1891
|
//#endregion
|
|
1899
1892
|
//#region ../prompt/src/prompts/create/createPrompt.ts
|
|
1900
1893
|
function createPrompt({ key, schema, currentValue, theme, truncate, shouldMask, index, total, input, output, preprocessors: preprocessors$1 }) {
|
|
@@ -1939,7 +1932,6 @@ function createPrompt({ key, schema, currentValue, theme, truncate, shouldMask,
|
|
|
1939
1932
|
});
|
|
1940
1933
|
}
|
|
1941
1934
|
}
|
|
1942
|
-
|
|
1943
1935
|
//#endregion
|
|
1944
1936
|
//#region ../prompt/src/utils/clearConsoleLines.ts
|
|
1945
1937
|
function clearConsoleLines(lineCount) {
|
|
@@ -1954,7 +1946,6 @@ function clearConsoleLines(lineCount) {
|
|
|
1954
1946
|
cursorTo(output, 0);
|
|
1955
1947
|
} catch {}
|
|
1956
1948
|
}
|
|
1957
|
-
|
|
1958
1949
|
//#endregion
|
|
1959
1950
|
//#region ../prompt/src/utils/getDisplayEnvPath.ts
|
|
1960
1951
|
function getDisplayEnvPath(envPath, cwd = process.cwd()) {
|
|
@@ -1963,7 +1954,6 @@ function getDisplayEnvPath(envPath, cwd = process.cwd()) {
|
|
|
1963
1954
|
if (relativeEnvPath.startsWith(".")) return relativeEnvPath;
|
|
1964
1955
|
return `./${relativeEnvPath}`;
|
|
1965
1956
|
}
|
|
1966
|
-
|
|
1967
1957
|
//#endregion
|
|
1968
1958
|
//#region ../prompt/src/session/Session.ts
|
|
1969
1959
|
var Session = class Session {
|
|
@@ -2010,7 +2000,7 @@ var Session = class Session {
|
|
|
2010
2000
|
}
|
|
2011
2001
|
const shouldMask = resolveShouldMask(key, envVarSchema, this.secrets);
|
|
2012
2002
|
const storedValue = this.newValues[key] ?? currentValues[key];
|
|
2013
|
-
const prompt
|
|
2003
|
+
const prompt = createPrompt({
|
|
2014
2004
|
key,
|
|
2015
2005
|
schema: envVarSchema,
|
|
2016
2006
|
currentValue: storedValue && storedValue.trim() !== "" ? storedValue : void 0,
|
|
@@ -2023,9 +2013,9 @@ var Session = class Session {
|
|
|
2023
2013
|
output: this.output,
|
|
2024
2014
|
preprocessors: this.preprocessors
|
|
2025
2015
|
});
|
|
2026
|
-
const value = await prompt
|
|
2016
|
+
const value = await prompt.prompt();
|
|
2027
2017
|
addedLines++;
|
|
2028
|
-
const outcome = prompt
|
|
2018
|
+
const outcome = prompt.getOutcome();
|
|
2029
2019
|
if (isCancel(value) || typeof value === "symbol" && value?.description === "clack:cancel") {
|
|
2030
2020
|
this.output.write(`${color.red("│")} \n`);
|
|
2031
2021
|
this.output.write(`${color.red("└")} ${color.red("Setup cancelled.")}\n\n`);
|
|
@@ -2049,12 +2039,12 @@ var Session = class Session {
|
|
|
2049
2039
|
currentValues = await this.channel.get();
|
|
2050
2040
|
this.newValues[key] = stringValue;
|
|
2051
2041
|
} catch (error) {
|
|
2052
|
-
this.output.write(`${color.gray(
|
|
2042
|
+
this.output.write(`${color.gray("└")} ${color.red(`Failed to save ${key}: ${error}`)}\n\n`);
|
|
2053
2043
|
return "error";
|
|
2054
2044
|
}
|
|
2055
2045
|
index++;
|
|
2056
2046
|
}
|
|
2057
|
-
this.output.write(`${color.gray(
|
|
2047
|
+
this.output.write(`${color.gray("│")}\n${color.gray("└")} ${this.theme.primary("Setup complete!")}\n\n`);
|
|
2058
2048
|
return "success";
|
|
2059
2049
|
}
|
|
2060
2050
|
renderSetupHeader() {
|
|
@@ -2067,7 +2057,7 @@ var Session = class Session {
|
|
|
2067
2057
|
`${color.gray("│")} ${clickableEnvPath}${color.gray(` · ${variableLabel}`)}`,
|
|
2068
2058
|
`${color.gray("│")} `
|
|
2069
2059
|
].join("\n");
|
|
2070
|
-
this.output.write(`\n${color.gray(
|
|
2060
|
+
this.output.write(`\n${color.gray("┌")} ${headerBody}\n`);
|
|
2071
2061
|
}
|
|
2072
2062
|
toHyperlink(text, url) {
|
|
2073
2063
|
const escapeCode = "\x1B";
|
|
@@ -2076,7 +2066,6 @@ var Session = class Session {
|
|
|
2076
2066
|
return `${oscSequence}${url}${stringTerminator}${text}${oscSequence}${stringTerminator}`;
|
|
2077
2067
|
}
|
|
2078
2068
|
};
|
|
2079
|
-
|
|
2080
2069
|
//#endregion
|
|
2081
2070
|
//#region ../prompt/src/options/resolve.ts
|
|
2082
2071
|
function resolveTheme(themeOption) {
|
|
@@ -2091,7 +2080,6 @@ function resolveEnvFilePath(pathOption, rootDir) {
|
|
|
2091
2080
|
if (!rootDir) return pathOption;
|
|
2092
2081
|
return resolve(rootDir, pathOption);
|
|
2093
2082
|
}
|
|
2094
|
-
|
|
2095
2083
|
//#endregion
|
|
2096
2084
|
//#region ../prompt/src/utils/isEnvChannel.ts
|
|
2097
2085
|
/**
|
|
@@ -2100,7 +2088,6 @@ function resolveEnvFilePath(pathOption, rootDir) {
|
|
|
2100
2088
|
function isEnvChannel(value) {
|
|
2101
2089
|
return typeof value === "object" && value !== null && "get" in value && "set" in value && typeof value.get === "function" && typeof value.set === "function";
|
|
2102
2090
|
}
|
|
2103
|
-
|
|
2104
2091
|
//#endregion
|
|
2105
2092
|
//#region ../prompt/src/prompt.ts
|
|
2106
2093
|
/**
|
|
@@ -2124,8 +2111,8 @@ async function prompt(modelOrOptions, interactiveOptions) {
|
|
|
2124
2111
|
} else throw new Error("Either provide a model or schemas in options");
|
|
2125
2112
|
}
|
|
2126
2113
|
const rootDirectory = resolveRootDirectory(finalOptions.root);
|
|
2127
|
-
const path = resolveEnvFilePath(finalOptions.path ??
|
|
2128
|
-
const truncate = finalOptions.truncate ??
|
|
2114
|
+
const path = resolveEnvFilePath(finalOptions.path ?? ".env", rootDirectory);
|
|
2115
|
+
const truncate = finalOptions.truncate ?? 40;
|
|
2129
2116
|
const secrets = finalOptions.secrets ?? SECRET_PATTERNS;
|
|
2130
2117
|
const input = stdin;
|
|
2131
2118
|
const output = stdout;
|
|
@@ -2143,6 +2130,5 @@ async function prompt(modelOrOptions, interactiveOptions) {
|
|
|
2143
2130
|
preprocess: preprocessConfig
|
|
2144
2131
|
}).run();
|
|
2145
2132
|
}
|
|
2146
|
-
|
|
2147
2133
|
//#endregion
|
|
2148
|
-
export { defaults_exports as n, prompt as t };
|
|
2134
|
+
export { defaults_exports as n, prompt as t };
|