@e-n-v/env 0.0.7 → 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-B7MeMkJC.d.ts → BooleanMap-BPQuO3Ae.d.ts} +1 -3
- package/dist/{BooleanMap-D93UJnv5.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/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-awxwtQ1N.d.ts → index-B2eNij2x.d.cts} +1 -2
- package/dist/{parse-5fpTbjTr.d.cts → index-BHTM8nxS.d.ts} +1 -2
- package/dist/{prompt-DG8haZjn.d.ts → index-BKBW9Dxs.d.cts} +3 -4
- package/dist/{prompt-lmZdPaBh.d.cts → index-CEyOIRdj.d.ts} +3 -4
- package/dist/{EnvModel-BiT0OiDZ.d.ts → index-Cb0abjLf.d.ts} +59 -7
- package/dist/{EnvModel-I0fWZZ_n.d.cts → index-Cz3frUwZ.d.cts} +58 -6
- package/dist/index.cjs +27 -30
- package/dist/index.d.cts +11 -13
- package/dist/index.d.ts +11 -13
- package/dist/index.js +8 -14
- 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-Cazgs3_J.cjs → redis-CyTF0SYT.cjs} +260 -268
- package/dist/{redis-DXhlNtvD.js → redis-D18f4ztf.js} +15 -22
- package/dist/{index-UQm0jdkG.d.cts → redis-DsW-Vkwq.d.cts} +2 -6
- package/dist/{index-ClKndmJv.d.ts → redis-tRD4nAy_.d.ts} +2 -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-DdDa3Qjy.d.cts → schema-B-JLVS42.d.ts} +1 -3
- package/dist/{schema-CHypJTDK.d.ts → 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 +42 -340
- package/dist/schemas/zod.d.cts +112 -114
- package/dist/schemas/zod.d.ts +112 -114
- package/dist/schemas/zod.js +111 -401
- package/dist/schemas.cjs +152 -155
- package/dist/schemas.d.cts +1 -2
- package/dist/schemas.d.ts +1 -2
- package/dist/schemas.js +2 -6
- package/dist/{src-CdqOYilA.cjs → src-5GYFbR9n.cjs} +21 -24
- package/dist/{src-BrNrE0hX.js → src-8rEOvFG5.js} +11 -14
- package/dist/{src-DI-VW4dW.js → src-CdzAzdq-.js} +77 -110
- package/dist/{src-B5Qu-M-r.js → src-Cg49gGJb.js} +9 -43
- package/dist/{src-dO72HN6e.cjs → src-CttkcdpE.cjs} +90 -130
- package/dist/{src-PHSSk-t3.cjs → src-D5KzIEH_.cjs} +130 -110
- package/dist/{src-DVdOONrX.cjs → src-DB0Har0j.cjs} +911 -932
- package/dist/{src-DQaQ28lz.js → src-DWc-WWjX.js} +107 -89
- package/dist/{src-vBXlFkSP.js → src-DvUBRBe3.js} +115 -136
- package/dist/{src-DywfI0fM.cjs → src-TZx_e95f.cjs} +78 -131
- package/dist/{vars-DF9DoAF4.d.ts → vars-DtzGL5Nc.d.cts} +1 -4
- package/dist/{vars-KUgv2rti.d.cts → vars-obKYxaSu.d.ts} +1 -4
- package/dist/vars.cjs +175 -160
- package/dist/vars.d.cts +2 -6
- package/dist/vars.d.ts +2 -6
- package/dist/vars.js +21 -9
- package/package.json +3 -2
- 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-BNDYMM9l.d.ts +0 -29
- package/dist/model-CJMnbGuS.d.cts +0 -29
- package/dist/validate-8HbVniNt.d.cts +0 -204
- package/dist/validate-CE8hQ5JG.d.ts +0 -204
- package/dist/vars-BHXXBiY1.cjs +0 -27
- package/dist/vars-FOuH_HuL.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
- /package/dist/{StringEnvVarSchema-BwSGgmeG.d.ts → StringEnvVarSchema-D9Jr1Aws.d.cts} +0 -0
- /package/dist/{StringEnvVarSchema-DnsZTIS0.d.cts → StringEnvVarSchema-D9Jr1Aws.d.ts} +0 -0
|
@@ -1,37 +1,28 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const require_src = require(
|
|
4
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
2
|
+
const require_src = require("./src-TZx_e95f.cjs");
|
|
3
|
+
const require_src$1 = require("./src-D5KzIEH_.cjs");
|
|
4
|
+
const require_resolveChannel = require("./resolveChannel-DxZNYdDe.cjs");
|
|
5
5
|
let node_path = require("node:path");
|
|
6
|
-
node_path = require_chunk.__toESM(node_path);
|
|
7
|
-
let node_url = require("node:url");
|
|
8
|
-
node_url = require_chunk.__toESM(node_url);
|
|
9
|
-
let node_os = require("node:os");
|
|
10
|
-
node_os = require_chunk.__toESM(node_os);
|
|
11
6
|
let node_process = require("node:process");
|
|
12
|
-
|
|
13
|
-
let
|
|
14
|
-
__clack_core = require_chunk.__toESM(__clack_core);
|
|
7
|
+
let _clack_core = require("@clack/core");
|
|
8
|
+
let node_url = require("node:url");
|
|
15
9
|
let picocolors = require("picocolors");
|
|
16
|
-
picocolors =
|
|
10
|
+
picocolors = require_rolldown_runtime.__toESM(picocolors, 1);
|
|
17
11
|
let node_child_process = require("node:child_process");
|
|
18
|
-
|
|
12
|
+
let node_os = require("node:os");
|
|
19
13
|
let node_readline = require("node:readline");
|
|
20
|
-
node_readline = require_chunk.__toESM(node_readline);
|
|
21
|
-
|
|
22
14
|
//#region ../prompt/src/options/defaults.ts
|
|
23
|
-
var defaults_exports = /* @__PURE__ */
|
|
15
|
+
var defaults_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
24
16
|
ENV_PATH: () => ENV_PATH,
|
|
25
17
|
SECRET_PATTERNS: () => SECRET_PATTERNS,
|
|
26
|
-
TRUNCATE_LENGTH: () =>
|
|
18
|
+
TRUNCATE_LENGTH: () => 40
|
|
27
19
|
});
|
|
28
20
|
const ENV_PATH = ".env";
|
|
29
|
-
const TRUNCATE_LENGTH = 40;
|
|
30
21
|
const SECRET_PATTERNS = Object.freeze([
|
|
31
22
|
/password/i,
|
|
32
23
|
/passphrase/i,
|
|
33
24
|
/secret/i,
|
|
34
|
-
/(?<!expires[_-]?in[_-]?)token(?![_-]
|
|
25
|
+
/(?<!(?:^|[_-])(?:expires[_-]?in|expiry|expiration|ttl|lifetime|duration|age|max[_-]?age|validity)[_-])token(?(?:$|[_-]))/i,
|
|
35
26
|
/api[_-]?key/i,
|
|
36
27
|
/client[_-]?secret/i,
|
|
37
28
|
/private[_-]?key/i,
|
|
@@ -40,7 +31,6 @@ const SECRET_PATTERNS = Object.freeze([
|
|
|
40
31
|
/access[_-]?key/i,
|
|
41
32
|
/credential/i
|
|
42
33
|
]);
|
|
43
|
-
|
|
44
34
|
//#endregion
|
|
45
35
|
//#region ../prompt/src/visuals/Theme.ts
|
|
46
36
|
var Theme = class Theme {
|
|
@@ -83,28 +73,9 @@ var Theme = class Theme {
|
|
|
83
73
|
return picocolors.default.bgBlack;
|
|
84
74
|
}
|
|
85
75
|
};
|
|
86
|
-
|
|
87
|
-
//#endregion
|
|
88
|
-
//#region ../prompt/src/visuals/symbols.ts
|
|
89
|
-
const S_BAR = "│";
|
|
90
|
-
const S_BAR_END = "└";
|
|
91
|
-
const S_BAR_START = "┌";
|
|
92
|
-
const S_STEP_ACTIVE = "◆";
|
|
93
|
-
const S_STEP_SUBMIT = "✔";
|
|
94
|
-
const S_STEP_SKIP = "⏭";
|
|
95
|
-
const S_STEP_CANCEL = "✕";
|
|
96
|
-
const S_STEP_ERROR = "▲";
|
|
97
|
-
const S_STEP_PREVIOUS = "⏮";
|
|
98
|
-
const S_TOOL_ACTIVE = "■";
|
|
99
|
-
const S_TOOL_INACTIVE = "□";
|
|
100
|
-
const S_RADIO_ACTIVE = "●";
|
|
101
|
-
const S_RADIO_INACTIVE = "○";
|
|
102
|
-
const S_CURSOR = "█";
|
|
103
|
-
const SECRET_MASK = "•";
|
|
104
|
-
|
|
105
76
|
//#endregion
|
|
106
77
|
//#region ../prompt/src/prompts/ThemedPrompt.ts
|
|
107
|
-
var ThemedPrompt = class extends
|
|
78
|
+
var ThemedPrompt = class extends _clack_core.Prompt {
|
|
108
79
|
theme;
|
|
109
80
|
constructor(opts, trackValue = false) {
|
|
110
81
|
super(opts, trackValue);
|
|
@@ -116,11 +87,11 @@ var ThemedPrompt = class extends __clack_core.Prompt {
|
|
|
116
87
|
getSymbol() {
|
|
117
88
|
switch (this.state) {
|
|
118
89
|
case "initial":
|
|
119
|
-
case "active": return this.theme.primary(
|
|
120
|
-
case "error": return this.theme.warn(
|
|
121
|
-
case "submit": return this.theme.primary(
|
|
122
|
-
case "cancel": return this.theme.error(
|
|
123
|
-
default: return this.theme.primary(
|
|
90
|
+
case "active": return this.theme.primary("◆");
|
|
91
|
+
case "error": return this.theme.warn("▲");
|
|
92
|
+
case "submit": return this.theme.primary("✔");
|
|
93
|
+
case "cancel": return this.theme.error("✕");
|
|
94
|
+
default: return this.theme.primary("◆");
|
|
124
95
|
}
|
|
125
96
|
}
|
|
126
97
|
/**
|
|
@@ -133,10 +104,10 @@ var ThemedPrompt = class extends __clack_core.Prompt {
|
|
|
133
104
|
* Get bar symbols with appropriate coloring
|
|
134
105
|
*/
|
|
135
106
|
getBar() {
|
|
136
|
-
return this.getBarColor(
|
|
107
|
+
return this.getBarColor("│");
|
|
137
108
|
}
|
|
138
109
|
getBarEnd() {
|
|
139
|
-
return this.getBarColor(
|
|
110
|
+
return this.getBarColor("└");
|
|
140
111
|
}
|
|
141
112
|
/**
|
|
142
113
|
* Color utilities for consistent theming
|
|
@@ -155,14 +126,13 @@ var ThemedPrompt = class extends __clack_core.Prompt {
|
|
|
155
126
|
};
|
|
156
127
|
}
|
|
157
128
|
};
|
|
158
|
-
|
|
159
129
|
//#endregion
|
|
160
130
|
//#region ../prompt/src/prompts/utils/ClackPromptInternals.ts
|
|
161
131
|
/** Hacks to access private members of Clack prompts */
|
|
162
132
|
var ClackPromptInternals = class {
|
|
163
133
|
prompt;
|
|
164
|
-
constructor(prompt
|
|
165
|
-
this.prompt = prompt
|
|
134
|
+
constructor(prompt) {
|
|
135
|
+
this.prompt = prompt;
|
|
166
136
|
}
|
|
167
137
|
set track(enabled) {
|
|
168
138
|
this.prompt._track = enabled;
|
|
@@ -171,7 +141,6 @@ var ClackPromptInternals = class {
|
|
|
171
141
|
return this.prompt._track;
|
|
172
142
|
}
|
|
173
143
|
};
|
|
174
|
-
|
|
175
144
|
//#endregion
|
|
176
145
|
//#region ../prompt/src/prompts/utils/padActiveRender.ts
|
|
177
146
|
/**
|
|
@@ -189,7 +158,6 @@ function padActiveRender(render) {
|
|
|
189
158
|
return result + "\n";
|
|
190
159
|
};
|
|
191
160
|
}
|
|
192
|
-
|
|
193
161
|
//#endregion
|
|
194
162
|
//#region ../prompt/src/prompts/toolbar/Toolbar.ts
|
|
195
163
|
var Toolbar = class {
|
|
@@ -254,7 +222,7 @@ var Toolbar = class {
|
|
|
254
222
|
const separator = this.theme.subtle(" / ");
|
|
255
223
|
return `${options.map((option, index) => {
|
|
256
224
|
const isFocused = index === this.cursor;
|
|
257
|
-
const label = `${isFocused ?
|
|
225
|
+
const label = `${isFocused ? "■" : "□"} ${option.label}`;
|
|
258
226
|
return isFocused ? this.theme.primary(label) : this.theme.subtle(label);
|
|
259
227
|
}).join(separator)}${separator}${this.theme.subtle("Tab to return")}`;
|
|
260
228
|
}
|
|
@@ -308,7 +276,6 @@ var Toolbar = class {
|
|
|
308
276
|
return options;
|
|
309
277
|
}
|
|
310
278
|
};
|
|
311
|
-
|
|
312
279
|
//#endregion
|
|
313
280
|
//#region ../prompt/src/prompts/state/EnvPromptModeDetails.ts
|
|
314
281
|
/**
|
|
@@ -347,7 +314,6 @@ function createState(modeDetails) {
|
|
|
347
314
|
...computeState(modeDetails)
|
|
348
315
|
};
|
|
349
316
|
}
|
|
350
|
-
|
|
351
317
|
//#endregion
|
|
352
318
|
//#region ../prompt/src/prompts/state/EnvPromptMode.ts
|
|
353
319
|
/**
|
|
@@ -510,7 +476,6 @@ var EnvPromptMode = class {
|
|
|
510
476
|
return this.intention;
|
|
511
477
|
}
|
|
512
478
|
};
|
|
513
|
-
|
|
514
479
|
//#endregion
|
|
515
480
|
//#region ../prompt/src/prompts/processing/processValue.ts
|
|
516
481
|
/**
|
|
@@ -535,6 +500,7 @@ function processValue(envKey, value, schema, preprocess) {
|
|
|
535
500
|
} catch {
|
|
536
501
|
processedValue = value;
|
|
537
502
|
}
|
|
503
|
+
if (!schema.process) throw new Error(`No processor configured for ${envKey}`);
|
|
538
504
|
return {
|
|
539
505
|
value: schema.process(processedValue),
|
|
540
506
|
rawValue: value,
|
|
@@ -549,7 +515,6 @@ function processValue(envKey, value, schema, preprocess) {
|
|
|
549
515
|
};
|
|
550
516
|
}
|
|
551
517
|
}
|
|
552
|
-
|
|
553
518
|
//#endregion
|
|
554
519
|
//#region ../prompt/src/prompts/EnvPrompt.ts
|
|
555
520
|
var EnvPrompt = class extends ThemedPrompt {
|
|
@@ -584,7 +549,7 @@ var EnvPrompt = class extends ThemedPrompt {
|
|
|
584
549
|
/** State machine managing prompt interaction modes. */
|
|
585
550
|
mode;
|
|
586
551
|
constructor(schema, opts) {
|
|
587
|
-
const { pad = true
|
|
552
|
+
const { pad = true, ...promptOpts } = opts;
|
|
588
553
|
const promptOptions = {
|
|
589
554
|
...promptOpts,
|
|
590
555
|
default: schema.default,
|
|
@@ -733,10 +698,10 @@ var EnvPrompt = class extends ThemedPrompt {
|
|
|
733
698
|
return `${value.substring(0, this.truncate)}...`;
|
|
734
699
|
}
|
|
735
700
|
renderSkipped() {
|
|
736
|
-
return `${this.colors.dim(this.theme.primary(
|
|
701
|
+
return `${this.colors.dim(this.theme.primary("⏭"))} ${this.colors.subtle(this.colors.bold(this.key))}`;
|
|
737
702
|
}
|
|
738
703
|
renderPrevious() {
|
|
739
|
-
return `${this.colors.dim(this.theme.primary(
|
|
704
|
+
return `${this.colors.dim(this.theme.primary("⏮"))} ${this.colors.subtle(this.colors.bold(this.key))}`;
|
|
740
705
|
}
|
|
741
706
|
renderOutcomeResult() {
|
|
742
707
|
const intention = this.mode.intention;
|
|
@@ -744,7 +709,7 @@ var EnvPrompt = class extends ThemedPrompt {
|
|
|
744
709
|
if (intention === "previous") return this.renderPrevious();
|
|
745
710
|
}
|
|
746
711
|
renderCancelled() {
|
|
747
|
-
return `${this.theme.error(
|
|
712
|
+
return `${this.theme.error("✕")} ${this.colors.subtle(this.colors.bold(this.key))}`;
|
|
748
713
|
}
|
|
749
714
|
toggleSecretReveal() {
|
|
750
715
|
if (!this.mode.hasSecret()) return;
|
|
@@ -774,9 +739,21 @@ var EnvPrompt = class extends ThemedPrompt {
|
|
|
774
739
|
handleOpenLink() {
|
|
775
740
|
const link = this.schema.link;
|
|
776
741
|
if (!link) return;
|
|
742
|
+
let url;
|
|
743
|
+
try {
|
|
744
|
+
url = new URL(link);
|
|
745
|
+
} catch {
|
|
746
|
+
console.error("Failed to open link");
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
749
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
750
|
+
console.error("Failed to open link");
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
777
753
|
this.mode.suppressValidation();
|
|
778
|
-
|
|
779
|
-
|
|
754
|
+
const [executable, args] = (0, node_os.platform)() === "win32" ? ["rundll32.exe", ["url.dll,FileProtocolHandler", url.href]] : (0, node_os.platform)() === "darwin" ? ["open", [url.href]] : ["xdg-open", [url.href]];
|
|
755
|
+
(0, node_child_process.execFile)(executable, args, (error) => {
|
|
756
|
+
if (error) console.error("Failed to open link");
|
|
780
757
|
});
|
|
781
758
|
}
|
|
782
759
|
consumeSkipValidation() {
|
|
@@ -813,7 +790,6 @@ var EnvPrompt = class extends ThemedPrompt {
|
|
|
813
790
|
return labels.length > 0 ? labels.join(", ") : void 0;
|
|
814
791
|
}
|
|
815
792
|
};
|
|
816
|
-
|
|
817
793
|
//#endregion
|
|
818
794
|
//#region ../prompt/src/prompts/utils/selectableOptions.ts
|
|
819
795
|
function buildSelectableOptions(params) {
|
|
@@ -857,7 +833,6 @@ function getOptionAtCursor(options, cursor) {
|
|
|
857
833
|
index
|
|
858
834
|
};
|
|
859
835
|
}
|
|
860
|
-
|
|
861
836
|
//#endregion
|
|
862
837
|
//#region ../prompt/src/prompts/typed/EnvBooleanPrompt.ts
|
|
863
838
|
var EnvBooleanPrompt = class extends EnvPrompt {
|
|
@@ -877,11 +852,11 @@ var EnvBooleanPrompt = class extends EnvPrompt {
|
|
|
877
852
|
output += `${this.getSymbol()} ${this.colors.bold(this.colors.white(this.key))}`;
|
|
878
853
|
if (this.schema.description) output += ` ${this.colors.subtle(this.schema.description)}`;
|
|
879
854
|
output += "\n";
|
|
880
|
-
const options
|
|
855
|
+
const options = this.buildOptions();
|
|
881
856
|
const dimInputs = !this.error && this.mode.isToolbarOpen();
|
|
882
|
-
options
|
|
857
|
+
options.forEach((option, index) => {
|
|
883
858
|
const isSelected = index === this.cursor;
|
|
884
|
-
const circle = dimInputs ? this.colors.dim(isSelected ?
|
|
859
|
+
const circle = dimInputs ? this.colors.dim(isSelected ? "●" : "○") : isSelected ? this.theme.primary("●") : this.colors.dim("○");
|
|
885
860
|
const formatText = (value) => {
|
|
886
861
|
if (dimInputs) return this.colors.dim(value);
|
|
887
862
|
if (isSelected) return this.colors.white(value);
|
|
@@ -913,9 +888,9 @@ var EnvBooleanPrompt = class extends EnvPrompt {
|
|
|
913
888
|
this.on("cursor", (action) => {
|
|
914
889
|
this.clearErrorState();
|
|
915
890
|
if (!this.error && this.mode.isToolbarOpen()) return;
|
|
916
|
-
const options
|
|
917
|
-
if (!options
|
|
918
|
-
const lastIndex = options
|
|
891
|
+
const options = this.buildOptions();
|
|
892
|
+
if (!options.length) return;
|
|
893
|
+
const lastIndex = options.length - 1;
|
|
919
894
|
switch (action) {
|
|
920
895
|
case "up":
|
|
921
896
|
this.cursor = this.cursor === 0 ? lastIndex : this.cursor - 1;
|
|
@@ -926,7 +901,6 @@ var EnvBooleanPrompt = class extends EnvPrompt {
|
|
|
926
901
|
default:
|
|
927
902
|
if (this.cursor > lastIndex) this.cursor = lastIndex;
|
|
928
903
|
if (this.cursor < 0) this.cursor = 0;
|
|
929
|
-
break;
|
|
930
904
|
}
|
|
931
905
|
this.updateValue();
|
|
932
906
|
});
|
|
@@ -975,7 +949,6 @@ var EnvBooleanPrompt = class extends EnvPrompt {
|
|
|
975
949
|
return option;
|
|
976
950
|
}
|
|
977
951
|
};
|
|
978
|
-
|
|
979
952
|
//#endregion
|
|
980
953
|
//#region ../prompt/src/prompts/typed/EnvEnumPrompt.ts
|
|
981
954
|
var EnvEnumPrompt = class extends EnvPrompt {
|
|
@@ -996,11 +969,11 @@ var EnvEnumPrompt = class extends EnvPrompt {
|
|
|
996
969
|
output += `${this.getSymbol()} ${this.colors.bold(this.colors.white(this.key))}`;
|
|
997
970
|
if (this.schema.description) output += ` ${this.colors.subtle(this.schema.description)}`;
|
|
998
971
|
output += "\n";
|
|
999
|
-
const options
|
|
972
|
+
const options = this.buildOptions();
|
|
1000
973
|
const dimInputs = !this.error && this.mode.isToolbarOpen();
|
|
1001
|
-
options
|
|
974
|
+
options.forEach((option, index) => {
|
|
1002
975
|
const isSelected = index === this.cursor;
|
|
1003
|
-
const circle = dimInputs ? this.colors.dim(isSelected ?
|
|
976
|
+
const circle = dimInputs ? this.colors.dim(isSelected ? "●" : "○") : isSelected ? this.theme.primary("●") : this.colors.dim("○");
|
|
1004
977
|
const formatText = (value) => {
|
|
1005
978
|
if (dimInputs) return this.colors.dim(value);
|
|
1006
979
|
if (isSelected) return this.colors.white(value);
|
|
@@ -1036,9 +1009,9 @@ var EnvEnumPrompt = class extends EnvPrompt {
|
|
|
1036
1009
|
this.on("cursor", (action) => {
|
|
1037
1010
|
this.clearErrorState();
|
|
1038
1011
|
if (!this.error && this.mode.isToolbarOpen()) return;
|
|
1039
|
-
const options
|
|
1040
|
-
if (!options
|
|
1041
|
-
const lastIndex = options
|
|
1012
|
+
const options = this.buildOptions();
|
|
1013
|
+
if (!options.length) return;
|
|
1014
|
+
const lastIndex = options.length - 1;
|
|
1042
1015
|
switch (action) {
|
|
1043
1016
|
case "up":
|
|
1044
1017
|
this.cursor = this.cursor === 0 ? lastIndex : this.cursor - 1;
|
|
@@ -1049,7 +1022,6 @@ var EnvEnumPrompt = class extends EnvPrompt {
|
|
|
1049
1022
|
default:
|
|
1050
1023
|
if (this.cursor > lastIndex) this.cursor = lastIndex;
|
|
1051
1024
|
if (this.cursor < 0) this.cursor = 0;
|
|
1052
|
-
break;
|
|
1053
1025
|
}
|
|
1054
1026
|
this.updateValue();
|
|
1055
1027
|
});
|
|
@@ -1067,8 +1039,8 @@ var EnvEnumPrompt = class extends EnvPrompt {
|
|
|
1067
1039
|
return;
|
|
1068
1040
|
}
|
|
1069
1041
|
if (selected.invalid) {
|
|
1070
|
-
const fallback
|
|
1071
|
-
this.setCommittedValue(fallback
|
|
1042
|
+
const fallback = this.default ?? this.values[0];
|
|
1043
|
+
this.setCommittedValue(fallback);
|
|
1072
1044
|
return;
|
|
1073
1045
|
}
|
|
1074
1046
|
const fallback = this.default ?? this.values[0];
|
|
@@ -1099,7 +1071,6 @@ var EnvEnumPrompt = class extends EnvPrompt {
|
|
|
1099
1071
|
return option;
|
|
1100
1072
|
}
|
|
1101
1073
|
};
|
|
1102
|
-
|
|
1103
1074
|
//#endregion
|
|
1104
1075
|
//#region ../prompt/src/prompts/typed/EnvNumberPrompt.ts
|
|
1105
1076
|
var EnvNumberPrompt = class extends EnvPrompt {
|
|
@@ -1135,7 +1106,7 @@ var EnvNumberPrompt = class extends EnvPrompt {
|
|
|
1135
1106
|
}
|
|
1136
1107
|
this.buildSelectionOptions().forEach((option, index) => {
|
|
1137
1108
|
const isSelected = index === this.mode.getCursor();
|
|
1138
|
-
const circle = dimInputs ? this.colors.dim(isSelected ?
|
|
1109
|
+
const circle = dimInputs ? this.colors.dim(isSelected ? "●" : "○") : isSelected ? this.theme.primary("●") : this.colors.dim("○");
|
|
1139
1110
|
if (option.type === "other") {
|
|
1140
1111
|
if (this.mode.isInInteraction("typing")) {
|
|
1141
1112
|
const displayText = dimInputs ? this.colors.dim(this.getInputDisplay(false)) : this.colors.white(this.getInputDisplay(true));
|
|
@@ -1143,8 +1114,8 @@ var EnvNumberPrompt = class extends EnvPrompt {
|
|
|
1143
1114
|
} else if (isSelected) if (dimInputs) output += `${this.getBar()} ${circle} ${this.colors.dim(option.label)}\n`;
|
|
1144
1115
|
else output += `${this.getBar()} ${circle} ${this.colors.white(this.getInputDisplay(true))}\n`;
|
|
1145
1116
|
else {
|
|
1146
|
-
const text
|
|
1147
|
-
output += `${this.getBar()} ${circle} ${text
|
|
1117
|
+
const text = dimInputs ? this.colors.dim(option.label) : this.colors.subtle(option.label);
|
|
1118
|
+
output += `${this.getBar()} ${circle} ${text}\n`;
|
|
1148
1119
|
}
|
|
1149
1120
|
return;
|
|
1150
1121
|
}
|
|
@@ -1249,7 +1220,6 @@ var EnvNumberPrompt = class extends EnvPrompt {
|
|
|
1249
1220
|
this.otherInputCache = "";
|
|
1250
1221
|
}
|
|
1251
1222
|
this.mode.moveCursor("down", maxIndexDown);
|
|
1252
|
-
break;
|
|
1253
1223
|
}
|
|
1254
1224
|
this.updateValue();
|
|
1255
1225
|
});
|
|
@@ -1307,8 +1277,8 @@ var EnvNumberPrompt = class extends EnvPrompt {
|
|
|
1307
1277
|
"tab"
|
|
1308
1278
|
].includes(info.name || "");
|
|
1309
1279
|
if (!isArrowKey && !isControlKey) {
|
|
1310
|
-
const textInputIndex
|
|
1311
|
-
this.mode.setCursor(textInputIndex
|
|
1280
|
+
const textInputIndex = this.getTextInputIndex();
|
|
1281
|
+
this.mode.setCursor(textInputIndex);
|
|
1312
1282
|
const existingInput = this.mode.getInputValue() || this.userInput || this.otherInputCache || "";
|
|
1313
1283
|
this.mode.enterTyping(existingInput);
|
|
1314
1284
|
const nextInput = `${existingInput}${char}`;
|
|
@@ -1338,7 +1308,7 @@ var EnvNumberPrompt = class extends EnvPrompt {
|
|
|
1338
1308
|
if (!includeCursor) return inputValue;
|
|
1339
1309
|
const rawCursor = this.mode.isInInteraction("typing") ? Math.max(0, this._cursor ?? inputValue.length) : 0;
|
|
1340
1310
|
const cursorIndex = Math.min(rawCursor, inputValue.length);
|
|
1341
|
-
if (cursorIndex >= inputValue.length) return `${inputValue}
|
|
1311
|
+
if (cursorIndex >= inputValue.length) return `${inputValue}█`;
|
|
1342
1312
|
const before = inputValue.slice(0, cursorIndex);
|
|
1343
1313
|
const cursorChar = inputValue.charAt(cursorIndex) || " ";
|
|
1344
1314
|
const after = inputValue.slice(cursorIndex + 1);
|
|
@@ -1484,7 +1454,6 @@ var EnvNumberPrompt = class extends EnvPrompt {
|
|
|
1484
1454
|
return index === -1 ? options.length - 1 : index;
|
|
1485
1455
|
}
|
|
1486
1456
|
};
|
|
1487
|
-
|
|
1488
1457
|
//#endregion
|
|
1489
1458
|
//#region ../prompt/src/utils/secrets.ts
|
|
1490
1459
|
function isSecretMatch(value, pattern) {
|
|
@@ -1504,7 +1473,7 @@ function isSecretKey(key, description, patterns) {
|
|
|
1504
1473
|
for (const pattern of patterns) if (isSecretMatch(key, pattern) || isSecretMatch(description, pattern)) return true;
|
|
1505
1474
|
return false;
|
|
1506
1475
|
}
|
|
1507
|
-
function maskSecretValue(value, maskChar =
|
|
1476
|
+
function maskSecretValue(value, maskChar = "•") {
|
|
1508
1477
|
if (!value) return value;
|
|
1509
1478
|
return value.replace(/./g, maskChar);
|
|
1510
1479
|
}
|
|
@@ -1513,7 +1482,6 @@ function resolveShouldMask(key, schema, patterns) {
|
|
|
1513
1482
|
if ("secret" in schema && schema.secret !== void 0) return schema.secret;
|
|
1514
1483
|
return isSecretKey(key, schema.description, patterns);
|
|
1515
1484
|
}
|
|
1516
|
-
|
|
1517
1485
|
//#endregion
|
|
1518
1486
|
//#region ../prompt/src/prompts/typed/EnvStringPrompt.ts
|
|
1519
1487
|
var EnvStringPrompt = class extends EnvPrompt {
|
|
@@ -1546,7 +1514,7 @@ var EnvStringPrompt = class extends EnvPrompt {
|
|
|
1546
1514
|
}
|
|
1547
1515
|
this.buildSelectionOptions().forEach((option, index) => {
|
|
1548
1516
|
const isSelected = index === this.mode.getCursor();
|
|
1549
|
-
const circle = dimInputs ? this.colors.dim(isSelected ?
|
|
1517
|
+
const circle = dimInputs ? this.colors.dim(isSelected ? "●" : "○") : isSelected ? this.theme.primary("●") : this.colors.dim("○");
|
|
1550
1518
|
if (option.type === "other") {
|
|
1551
1519
|
if (this.mode.isInInteraction("typing")) {
|
|
1552
1520
|
const displayText = dimInputs ? this.colors.dim(this.getInputDisplay(false)) : this.colors.white(this.getInputDisplay(true));
|
|
@@ -1554,8 +1522,8 @@ var EnvStringPrompt = class extends EnvPrompt {
|
|
|
1554
1522
|
} else if (isSelected) if (dimInputs) output += `${this.getBar()} ${circle} ${this.colors.dim(option.label)}\n`;
|
|
1555
1523
|
else output += `${this.getBar()} ${circle} ${this.colors.white(this.getInputDisplay(true))}\n`;
|
|
1556
1524
|
else {
|
|
1557
|
-
const text
|
|
1558
|
-
output += `${this.getBar()} ${circle} ${text
|
|
1525
|
+
const text = dimInputs ? this.colors.dim(option.label) : this.colors.subtle(option.label);
|
|
1526
|
+
output += `${this.getBar()} ${circle} ${text}\n`;
|
|
1559
1527
|
}
|
|
1560
1528
|
return;
|
|
1561
1529
|
}
|
|
@@ -1729,8 +1697,8 @@ var EnvStringPrompt = class extends EnvPrompt {
|
|
|
1729
1697
|
"tab"
|
|
1730
1698
|
].includes(info.name || "");
|
|
1731
1699
|
if (!isArrowKey && !isControlKey) {
|
|
1732
|
-
const textInputIndex
|
|
1733
|
-
this.mode.setCursor(textInputIndex
|
|
1700
|
+
const textInputIndex = this.getTextInputIndex();
|
|
1701
|
+
this.mode.setCursor(textInputIndex);
|
|
1734
1702
|
const existingInput = this.mode.getInputValue() || this.userInput || this.otherInputCache || "";
|
|
1735
1703
|
this.mode.enterTyping(existingInput);
|
|
1736
1704
|
const nextInput = `${existingInput}${char}`;
|
|
@@ -1872,7 +1840,7 @@ var EnvStringPrompt = class extends EnvPrompt {
|
|
|
1872
1840
|
return this.truncateValue(display);
|
|
1873
1841
|
}
|
|
1874
1842
|
maskValue(value) {
|
|
1875
|
-
return maskSecretValue(value,
|
|
1843
|
+
return maskSecretValue(value, "•");
|
|
1876
1844
|
}
|
|
1877
1845
|
getTextInputIndex() {
|
|
1878
1846
|
if (!this.hasPresetOptions()) return 0;
|
|
@@ -1886,9 +1854,9 @@ var EnvStringPrompt = class extends EnvPrompt {
|
|
|
1886
1854
|
const base = isMasked ? this.maskValue(inputValue) : inputValue;
|
|
1887
1855
|
if (!includeCursor) return base;
|
|
1888
1856
|
const rawCursor = this.mode.isInInteraction("typing") ? Math.max(0, this._cursor ?? inputValue.length) : 0;
|
|
1889
|
-
const maskLength = isMasked ? Math.max(1,
|
|
1857
|
+
const maskLength = isMasked ? Math.max(1, 1) : 1;
|
|
1890
1858
|
const cursorIndex = Math.min(rawCursor * maskLength, base.length);
|
|
1891
|
-
if (cursorIndex >= base.length) return `${base}
|
|
1859
|
+
if (cursorIndex >= base.length) return `${base}█`;
|
|
1892
1860
|
const segmentLength = maskLength;
|
|
1893
1861
|
const before = base.slice(0, cursorIndex);
|
|
1894
1862
|
const cursorSegment = base.slice(cursorIndex, cursorIndex + segmentLength) || " ";
|
|
@@ -1921,7 +1889,6 @@ var EnvStringPrompt = class extends EnvPrompt {
|
|
|
1921
1889
|
});
|
|
1922
1890
|
}
|
|
1923
1891
|
};
|
|
1924
|
-
|
|
1925
1892
|
//#endregion
|
|
1926
1893
|
//#region ../prompt/src/prompts/create/createPrompt.ts
|
|
1927
1894
|
function createPrompt({ key, schema, currentValue, theme, truncate, shouldMask, index, total, input, output, preprocessors: preprocessors$1 }) {
|
|
@@ -1966,7 +1933,6 @@ function createPrompt({ key, schema, currentValue, theme, truncate, shouldMask,
|
|
|
1966
1933
|
});
|
|
1967
1934
|
}
|
|
1968
1935
|
}
|
|
1969
|
-
|
|
1970
1936
|
//#endregion
|
|
1971
1937
|
//#region ../prompt/src/utils/clearConsoleLines.ts
|
|
1972
1938
|
function clearConsoleLines(lineCount) {
|
|
@@ -1981,7 +1947,6 @@ function clearConsoleLines(lineCount) {
|
|
|
1981
1947
|
(0, node_readline.cursorTo)(output, 0);
|
|
1982
1948
|
} catch {}
|
|
1983
1949
|
}
|
|
1984
|
-
|
|
1985
1950
|
//#endregion
|
|
1986
1951
|
//#region ../prompt/src/utils/getDisplayEnvPath.ts
|
|
1987
1952
|
function getDisplayEnvPath(envPath, cwd = process.cwd()) {
|
|
@@ -1990,7 +1955,6 @@ function getDisplayEnvPath(envPath, cwd = process.cwd()) {
|
|
|
1990
1955
|
if (relativeEnvPath.startsWith(".")) return relativeEnvPath;
|
|
1991
1956
|
return `./${relativeEnvPath}`;
|
|
1992
1957
|
}
|
|
1993
|
-
|
|
1994
1958
|
//#endregion
|
|
1995
1959
|
//#region ../prompt/src/session/Session.ts
|
|
1996
1960
|
var Session = class Session {
|
|
@@ -2037,7 +2001,7 @@ var Session = class Session {
|
|
|
2037
2001
|
}
|
|
2038
2002
|
const shouldMask = resolveShouldMask(key, envVarSchema, this.secrets);
|
|
2039
2003
|
const storedValue = this.newValues[key] ?? currentValues[key];
|
|
2040
|
-
const prompt
|
|
2004
|
+
const prompt = createPrompt({
|
|
2041
2005
|
key,
|
|
2042
2006
|
schema: envVarSchema,
|
|
2043
2007
|
currentValue: storedValue && storedValue.trim() !== "" ? storedValue : void 0,
|
|
@@ -2050,10 +2014,10 @@ var Session = class Session {
|
|
|
2050
2014
|
output: this.output,
|
|
2051
2015
|
preprocessors: this.preprocessors
|
|
2052
2016
|
});
|
|
2053
|
-
const value = await prompt
|
|
2017
|
+
const value = await prompt.prompt();
|
|
2054
2018
|
addedLines++;
|
|
2055
|
-
const outcome = prompt
|
|
2056
|
-
if ((0,
|
|
2019
|
+
const outcome = prompt.getOutcome();
|
|
2020
|
+
if ((0, _clack_core.isCancel)(value) || typeof value === "symbol" && value?.description === "clack:cancel") {
|
|
2057
2021
|
this.output.write(`${picocolors.default.red("│")} \n`);
|
|
2058
2022
|
this.output.write(`${picocolors.default.red("└")} ${picocolors.default.red("Setup cancelled.")}\n\n`);
|
|
2059
2023
|
return "cancelled";
|
|
@@ -2076,12 +2040,12 @@ var Session = class Session {
|
|
|
2076
2040
|
currentValues = await this.channel.get();
|
|
2077
2041
|
this.newValues[key] = stringValue;
|
|
2078
2042
|
} catch (error) {
|
|
2079
|
-
this.output.write(`${picocolors.default.gray(
|
|
2043
|
+
this.output.write(`${picocolors.default.gray("└")} ${picocolors.default.red(`Failed to save ${key}: ${error}`)}\n\n`);
|
|
2080
2044
|
return "error";
|
|
2081
2045
|
}
|
|
2082
2046
|
index++;
|
|
2083
2047
|
}
|
|
2084
|
-
this.output.write(`${picocolors.default.gray(
|
|
2048
|
+
this.output.write(`${picocolors.default.gray("│")}\n${picocolors.default.gray("└")} ${this.theme.primary("Setup complete!")}\n\n`);
|
|
2085
2049
|
return "success";
|
|
2086
2050
|
}
|
|
2087
2051
|
renderSetupHeader() {
|
|
@@ -2094,7 +2058,7 @@ var Session = class Session {
|
|
|
2094
2058
|
`${picocolors.default.gray("│")} ${clickableEnvPath}${picocolors.default.gray(` · ${variableLabel}`)}`,
|
|
2095
2059
|
`${picocolors.default.gray("│")} `
|
|
2096
2060
|
].join("\n");
|
|
2097
|
-
this.output.write(`\n${picocolors.default.gray(
|
|
2061
|
+
this.output.write(`\n${picocolors.default.gray("┌")} ${headerBody}\n`);
|
|
2098
2062
|
}
|
|
2099
2063
|
toHyperlink(text, url) {
|
|
2100
2064
|
const escapeCode = "\x1B";
|
|
@@ -2103,7 +2067,6 @@ var Session = class Session {
|
|
|
2103
2067
|
return `${oscSequence}${url}${stringTerminator}${text}${oscSequence}${stringTerminator}`;
|
|
2104
2068
|
}
|
|
2105
2069
|
};
|
|
2106
|
-
|
|
2107
2070
|
//#endregion
|
|
2108
2071
|
//#region ../prompt/src/options/resolve.ts
|
|
2109
2072
|
function resolveTheme(themeOption) {
|
|
@@ -2118,7 +2081,6 @@ function resolveEnvFilePath(pathOption, rootDir) {
|
|
|
2118
2081
|
if (!rootDir) return pathOption;
|
|
2119
2082
|
return (0, node_path.resolve)(rootDir, pathOption);
|
|
2120
2083
|
}
|
|
2121
|
-
|
|
2122
2084
|
//#endregion
|
|
2123
2085
|
//#region ../prompt/src/utils/isEnvChannel.ts
|
|
2124
2086
|
/**
|
|
@@ -2127,7 +2089,6 @@ function resolveEnvFilePath(pathOption, rootDir) {
|
|
|
2127
2089
|
function isEnvChannel(value) {
|
|
2128
2090
|
return typeof value === "object" && value !== null && "get" in value && "set" in value && typeof value.get === "function" && typeof value.set === "function";
|
|
2129
2091
|
}
|
|
2130
|
-
|
|
2131
2092
|
//#endregion
|
|
2132
2093
|
//#region ../prompt/src/prompt.ts
|
|
2133
2094
|
/**
|
|
@@ -2151,8 +2112,8 @@ async function prompt(modelOrOptions, interactiveOptions) {
|
|
|
2151
2112
|
} else throw new Error("Either provide a model or schemas in options");
|
|
2152
2113
|
}
|
|
2153
2114
|
const rootDirectory = resolveRootDirectory(finalOptions.root);
|
|
2154
|
-
const path = resolveEnvFilePath(finalOptions.path ??
|
|
2155
|
-
const truncate = finalOptions.truncate ??
|
|
2115
|
+
const path = resolveEnvFilePath(finalOptions.path ?? ".env", rootDirectory);
|
|
2116
|
+
const truncate = finalOptions.truncate ?? 40;
|
|
2156
2117
|
const secrets = finalOptions.secrets ?? SECRET_PATTERNS;
|
|
2157
2118
|
const input = node_process.stdin;
|
|
2158
2119
|
const output = node_process.stdout;
|
|
@@ -2170,17 +2131,16 @@ async function prompt(modelOrOptions, interactiveOptions) {
|
|
|
2170
2131
|
preprocess: preprocessConfig
|
|
2171
2132
|
}).run();
|
|
2172
2133
|
}
|
|
2173
|
-
|
|
2174
2134
|
//#endregion
|
|
2175
|
-
Object.defineProperty(exports,
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2135
|
+
Object.defineProperty(exports, "defaults_exports", {
|
|
2136
|
+
enumerable: true,
|
|
2137
|
+
get: function() {
|
|
2138
|
+
return defaults_exports;
|
|
2139
|
+
}
|
|
2140
|
+
});
|
|
2141
|
+
Object.defineProperty(exports, "prompt", {
|
|
2142
|
+
enumerable: true,
|
|
2143
|
+
get: function() {
|
|
2144
|
+
return prompt;
|
|
2145
|
+
}
|
|
2180
2146
|
});
|
|
2181
|
-
Object.defineProperty(exports, 'prompt', {
|
|
2182
|
-
enumerable: true,
|
|
2183
|
-
get: function () {
|
|
2184
|
-
return prompt;
|
|
2185
|
-
}
|
|
2186
|
-
});
|