vite-plus 0.1.3 → 0.1.4
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/global/{agent-BE4Xze8Q.js → agent-CpNB3GIY.js} +111 -86
- package/dist/global/config.js +1 -1
- package/dist/global/create.js +324 -170
- package/dist/global/migrate.js +159 -55
- package/dist/global/staged.js +768 -660
- package/dist/global/{workspace-lRm8huz4.js → workspace-CiqQdO1L.js} +153 -85
- package/dist/utils/prompts.d.ts +1 -1
- package/dist/utils/prompts.js +2 -2
- package/package.json +12 -12
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as __commonJSMin } from "./chunk-CgnkrU7a.js";
|
|
2
|
-
import { o as DEFAULT_ENVS, u as resolve } from "./json-BRdVJ52a.js";
|
|
2
|
+
import { o as DEFAULT_ENVS, u as resolve$1 } from "./json-BRdVJ52a.js";
|
|
3
3
|
import { n as accent } from "./help-BAGHa8fD.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { stripVTControlCharacters } from "node:util";
|
|
6
|
-
import
|
|
6
|
+
import color from "picocolors";
|
|
7
7
|
import process$1, { stdin, stdout } from "node:process";
|
|
8
8
|
import * as k from "node:readline";
|
|
9
9
|
import ot from "node:readline";
|
|
@@ -550,7 +550,7 @@ var $t = class extends x {
|
|
|
550
550
|
const e = this.userInput;
|
|
551
551
|
if (this.cursor >= e.length) return `${this.userInput}\u2588`;
|
|
552
552
|
const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
|
|
553
|
-
return `${s}${
|
|
553
|
+
return `${s}${color.inverse(i)}${r.join("")}`;
|
|
554
554
|
}
|
|
555
555
|
get cursor() {
|
|
556
556
|
return this._cursor;
|
|
@@ -599,22 +599,22 @@ const S_INFO = unicodeOr("●", "•");
|
|
|
599
599
|
const S_SUCCESS = unicodeOr("◆", "*");
|
|
600
600
|
const S_WARN = unicodeOr("▲", "!");
|
|
601
601
|
const S_ERROR = unicodeOr("■", "x");
|
|
602
|
-
const completeColor = (value) =>
|
|
602
|
+
const completeColor = (value) => color.gray(value);
|
|
603
603
|
const symbol = (state) => {
|
|
604
604
|
switch (state) {
|
|
605
605
|
case "initial":
|
|
606
|
-
case "active": return
|
|
607
|
-
case "cancel": return
|
|
608
|
-
case "error": return
|
|
606
|
+
case "active": return color.blue(S_STEP_ACTIVE);
|
|
607
|
+
case "cancel": return color.red(S_STEP_CANCEL);
|
|
608
|
+
case "error": return color.yellow(S_STEP_ERROR);
|
|
609
609
|
case "submit": return completeColor(S_STEP_SUBMIT);
|
|
610
610
|
}
|
|
611
611
|
};
|
|
612
612
|
const symbolBar = (state) => {
|
|
613
613
|
switch (state) {
|
|
614
614
|
case "initial":
|
|
615
|
-
case "active": return
|
|
616
|
-
case "cancel": return
|
|
617
|
-
case "error": return
|
|
615
|
+
case "active": return color.blue(S_BAR);
|
|
616
|
+
case "cancel": return color.red(S_BAR);
|
|
617
|
+
case "error": return color.yellow(S_BAR);
|
|
618
618
|
case "submit": return completeColor(S_BAR);
|
|
619
619
|
}
|
|
620
620
|
};
|
|
@@ -952,7 +952,7 @@ const limitOptions = (params) => {
|
|
|
952
952
|
const rowPadding = params.rowPadding ?? 4;
|
|
953
953
|
const maxWidth = columns - columnPadding;
|
|
954
954
|
const rows = nt(output);
|
|
955
|
-
const overflowFormat =
|
|
955
|
+
const overflowFormat = color.dim("...");
|
|
956
956
|
const paramMaxItems = params.maxItems ?? Number.POSITIVE_INFINITY;
|
|
957
957
|
const outputMaxItems = Math.max(rows - rowPadding, 0);
|
|
958
958
|
const maxItems = Math.max(Math.min(paramMaxItems, outputMaxItems), 5);
|
|
@@ -1016,22 +1016,22 @@ const confirm = (opts) => {
|
|
|
1016
1016
|
render() {
|
|
1017
1017
|
const hasGuide = opts.withGuide ?? false;
|
|
1018
1018
|
const nestedPrefix = " ";
|
|
1019
|
-
const title = `${hasGuide ? `${
|
|
1019
|
+
const title = `${hasGuide ? `${color.gray(S_BAR)}\n` : ""}${symbol(this.state)} ${opts.message}\n`;
|
|
1020
1020
|
const value = this.value ? active : inactive;
|
|
1021
1021
|
switch (this.state) {
|
|
1022
|
-
case "submit": return `${title}${hasGuide ? `${
|
|
1023
|
-
case "cancel": return `${title}${hasGuide ? `${
|
|
1022
|
+
case "submit": return `${title}${hasGuide ? `${color.gray(S_BAR)} ` : nestedPrefix}${color.dim(value)}\n`;
|
|
1023
|
+
case "cancel": return `${title}${hasGuide ? `${color.gray(S_BAR)} ` : nestedPrefix}${color.strikethrough(color.dim(value))}${hasGuide ? `\n${color.gray(S_BAR)}` : ""}\n`;
|
|
1024
1024
|
default: {
|
|
1025
|
-
const defaultPrefix = hasGuide ? `${
|
|
1026
|
-
const defaultPrefixEnd = hasGuide ?
|
|
1027
|
-
return `${title}${defaultPrefix}${this.value ? `${
|
|
1025
|
+
const defaultPrefix = hasGuide ? `${color.blue(S_BAR)} ` : nestedPrefix;
|
|
1026
|
+
const defaultPrefixEnd = hasGuide ? color.blue(S_BAR_END) : "";
|
|
1027
|
+
return `${title}${defaultPrefix}${this.value ? `${color.blue(S_POINTER_ACTIVE)} ${color.bold(active)}` : `${color.dim(" ")} ${color.dim(active)}`}${opts.vertical ? hasGuide ? `\n${color.blue(S_BAR)} ` : `\n${nestedPrefix}` : ` ${color.dim("/")} `}${!this.value ? `${color.blue(S_POINTER_ACTIVE)} ${color.bold(inactive)}` : `${color.dim(" ")} ${color.dim(inactive)}`}\n${defaultPrefixEnd}\n`;
|
|
1028
1028
|
}
|
|
1029
1029
|
}
|
|
1030
1030
|
}
|
|
1031
1031
|
}).prompt();
|
|
1032
1032
|
};
|
|
1033
1033
|
const log = {
|
|
1034
|
-
message: (message = [], { symbol =
|
|
1034
|
+
message: (message = [], { symbol = color.gray(S_BAR), secondarySymbol = color.gray(S_BAR), output = process.stdout, spacing = 1, withGuide } = {}) => {
|
|
1035
1035
|
const parts = [];
|
|
1036
1036
|
const hasGuide = withGuide ?? false;
|
|
1037
1037
|
const spacingString = !hasGuide ? "" : secondarySymbol;
|
|
@@ -1051,7 +1051,7 @@ const log = {
|
|
|
1051
1051
|
info: (message, opts) => {
|
|
1052
1052
|
log.message(message, {
|
|
1053
1053
|
...opts,
|
|
1054
|
-
symbol:
|
|
1054
|
+
symbol: color.blue(S_INFO)
|
|
1055
1055
|
});
|
|
1056
1056
|
},
|
|
1057
1057
|
success: (message, opts) => {
|
|
@@ -1069,7 +1069,7 @@ const log = {
|
|
|
1069
1069
|
warn: (message, opts) => {
|
|
1070
1070
|
log.message(message, {
|
|
1071
1071
|
...opts,
|
|
1072
|
-
symbol:
|
|
1072
|
+
symbol: color.yellow(S_WARN)
|
|
1073
1073
|
});
|
|
1074
1074
|
},
|
|
1075
1075
|
warning: (message, opts) => {
|
|
@@ -1078,12 +1078,12 @@ const log = {
|
|
|
1078
1078
|
error: (message, opts) => {
|
|
1079
1079
|
log.message(message, {
|
|
1080
1080
|
...opts,
|
|
1081
|
-
symbol:
|
|
1081
|
+
symbol: color.red(S_ERROR)
|
|
1082
1082
|
});
|
|
1083
1083
|
}
|
|
1084
1084
|
};
|
|
1085
1085
|
const cancel = (message = "", opts) => {
|
|
1086
|
-
(opts?.output ?? process.stdout).write(`${
|
|
1086
|
+
(opts?.output ?? process.stdout).write(`${color.red(message)}\n\n`);
|
|
1087
1087
|
};
|
|
1088
1088
|
const intro = (title = "", opts) => {
|
|
1089
1089
|
(opts?.output ?? process.stdout).write(`${title}\n\n`);
|
|
@@ -1104,14 +1104,14 @@ const withMarkerAndCheckbox = (marker, checkbox, checkboxWidth, label, format, f
|
|
|
1104
1104
|
const multiselect = (opts) => {
|
|
1105
1105
|
const opt = (option, state) => {
|
|
1106
1106
|
const label = option.label ?? String(option.value);
|
|
1107
|
-
const hint = option.hint ? ` ${
|
|
1108
|
-
if (state === "disabled") return withMarkerAndCheckbox(
|
|
1109
|
-
if (state === "active") return withMarkerAndCheckbox(
|
|
1110
|
-
if (state === "selected") return withMarkerAndCheckbox(
|
|
1111
|
-
if (state === "cancelled") return computeLabel$1(label, (text) =>
|
|
1112
|
-
if (state === "active-selected") return withMarkerAndCheckbox(
|
|
1113
|
-
if (state === "submitted") return computeLabel$1(label,
|
|
1114
|
-
return withMarkerAndCheckbox(
|
|
1107
|
+
const hint = option.hint ? ` ${color.gray(`(${option.hint})`)}` : "";
|
|
1108
|
+
if (state === "disabled") return withMarkerAndCheckbox(color.gray(" "), color.gray(S_CHECKBOX_INACTIVE), S_CHECKBOX_INACTIVE.length, label, (str) => color.strikethrough(color.gray(str)), option.hint ? ` ${color.dim(`(${option.hint ?? "disabled"})`)}` : "");
|
|
1109
|
+
if (state === "active") return withMarkerAndCheckbox(color.blue(S_POINTER_ACTIVE), color.blue(S_CHECKBOX_ACTIVE), S_CHECKBOX_ACTIVE.length, label, (text) => color.blue(color.bold(text)), hint);
|
|
1110
|
+
if (state === "selected") return withMarkerAndCheckbox(color.dim(" "), color.blue(S_CHECKBOX_SELECTED), S_CHECKBOX_SELECTED.length, label, color.dim, hint);
|
|
1111
|
+
if (state === "cancelled") return computeLabel$1(label, (text) => color.strikethrough(color.dim(text)));
|
|
1112
|
+
if (state === "active-selected") return withMarkerAndCheckbox(color.blue(S_POINTER_ACTIVE), color.blue(S_CHECKBOX_SELECTED), S_CHECKBOX_SELECTED.length, label, (text) => color.blue(color.bold(text)), hint);
|
|
1113
|
+
if (state === "submitted") return computeLabel$1(label, color.dim);
|
|
1114
|
+
return withMarkerAndCheckbox(color.dim(" "), color.dim(S_CHECKBOX_INACTIVE), S_CHECKBOX_INACTIVE.length, label, color.dim);
|
|
1115
1115
|
};
|
|
1116
1116
|
const required = opts.required ?? true;
|
|
1117
1117
|
return new Lt({
|
|
@@ -1123,7 +1123,7 @@ const multiselect = (opts) => {
|
|
|
1123
1123
|
required,
|
|
1124
1124
|
cursorAt: opts.cursorAt,
|
|
1125
1125
|
validate(selected) {
|
|
1126
|
-
if (required && (selected === void 0 || selected.length === 0)) return `Please select at least one option.\n${
|
|
1126
|
+
if (required && (selected === void 0 || selected.length === 0)) return `Please select at least one option.\n${color.reset(color.dim(`Press ${color.gray(color.bgWhite(color.inverse(" space ")))} to select, ${color.gray(color.bgWhite(color.inverse(" enter ")))} to submit`))}`;
|
|
1127
1127
|
},
|
|
1128
1128
|
render() {
|
|
1129
1129
|
const hasGuide = opts.withGuide ?? false;
|
|
@@ -1132,7 +1132,7 @@ const multiselect = (opts) => {
|
|
|
1132
1132
|
return message.split("\n").map((line, index) => `${index === 0 ? `${symbol(this.state)} ` : nestedPrefix}${line}`).join("\n");
|
|
1133
1133
|
};
|
|
1134
1134
|
const wrappedMessage = hasGuide ? xt(opts.output, opts.message, `${symbolBar(this.state)} `, `${symbol(this.state)} `) : formatMessageLines(opts.message);
|
|
1135
|
-
const title = `${hasGuide ? `${
|
|
1135
|
+
const title = `${hasGuide ? `${color.gray(S_BAR)}\n` : ""}${wrappedMessage}\n`;
|
|
1136
1136
|
const value = this.value ?? [];
|
|
1137
1137
|
const styleOption = (option, active) => {
|
|
1138
1138
|
if (option.disabled) return opt(option, "disabled");
|
|
@@ -1143,20 +1143,20 @@ const multiselect = (opts) => {
|
|
|
1143
1143
|
};
|
|
1144
1144
|
switch (this.state) {
|
|
1145
1145
|
case "submit": {
|
|
1146
|
-
const submitText = this.options.filter(({ value: optionValue }) => value.includes(optionValue)).map((option) => opt(option, "submitted")).join(
|
|
1147
|
-
const submitPrefix = hasGuide ? `${
|
|
1146
|
+
const submitText = this.options.filter(({ value: optionValue }) => value.includes(optionValue)).map((option) => opt(option, "submitted")).join(color.dim(", ")) || color.dim("none");
|
|
1147
|
+
const submitPrefix = hasGuide ? `${color.gray(S_BAR)} ` : nestedPrefix;
|
|
1148
1148
|
return `${title}${xt(opts.output, submitText, submitPrefix)}\n`;
|
|
1149
1149
|
}
|
|
1150
1150
|
case "cancel": {
|
|
1151
|
-
const label = this.options.filter(({ value: optionValue }) => value.includes(optionValue)).map((option) => opt(option, "cancelled")).join(
|
|
1152
|
-
if (label.trim() === "") return hasGuide ? `${title}${
|
|
1153
|
-
const cancelPrefix = hasGuide ? `${
|
|
1151
|
+
const label = this.options.filter(({ value: optionValue }) => value.includes(optionValue)).map((option) => opt(option, "cancelled")).join(color.dim(", "));
|
|
1152
|
+
if (label.trim() === "") return hasGuide ? `${title}${color.gray(S_BAR)}\n` : `${title.trimEnd()}\n`;
|
|
1153
|
+
const cancelPrefix = hasGuide ? `${color.gray(S_BAR)} ` : nestedPrefix;
|
|
1154
1154
|
const wrappedLabel = xt(opts.output, label, cancelPrefix);
|
|
1155
|
-
return hasGuide ? `${title}${wrappedLabel}\n${
|
|
1155
|
+
return hasGuide ? `${title}${wrappedLabel}\n${color.gray(S_BAR)}\n` : `${title}${wrappedLabel}\n`;
|
|
1156
1156
|
}
|
|
1157
1157
|
case "error": {
|
|
1158
|
-
const prefix = hasGuide ? `${
|
|
1159
|
-
const footer = hasGuide ? this.error.split("\n").map((ln, i) => i === 0 ? `${
|
|
1158
|
+
const prefix = hasGuide ? `${color.yellow(S_BAR)} ` : nestedPrefix;
|
|
1159
|
+
const footer = hasGuide ? this.error.split("\n").map((ln, i) => i === 0 ? `${color.yellow(S_BAR_END)} ${color.yellow(ln)}` : ` ${ln}`).join("\n") : `${nestedPrefix}${color.yellow(this.error)}`;
|
|
1160
1160
|
const titleLineCount = title.split("\n").length;
|
|
1161
1161
|
const footerLineCount = footer.split("\n").length + 1;
|
|
1162
1162
|
return `${title}${prefix}${limitOptions({
|
|
@@ -1170,7 +1170,7 @@ const multiselect = (opts) => {
|
|
|
1170
1170
|
}).join(`\n${prefix}`)}\n${footer}\n`;
|
|
1171
1171
|
}
|
|
1172
1172
|
default: {
|
|
1173
|
-
const prefix = hasGuide ? `${
|
|
1173
|
+
const prefix = hasGuide ? `${color.blue(S_BAR)} ` : nestedPrefix;
|
|
1174
1174
|
const titleLineCount = title.split("\n").length;
|
|
1175
1175
|
const footerLineCount = hasGuide ? 2 : 1;
|
|
1176
1176
|
return `${title}${prefix}${limitOptions({
|
|
@@ -1181,13 +1181,13 @@ const multiselect = (opts) => {
|
|
|
1181
1181
|
columnPadding: prefix.length,
|
|
1182
1182
|
rowPadding: titleLineCount + footerLineCount,
|
|
1183
1183
|
style: styleOption
|
|
1184
|
-
}).join(`\n${prefix}`)}\n${hasGuide ?
|
|
1184
|
+
}).join(`\n${prefix}`)}\n${hasGuide ? color.blue(S_BAR_END) : ""}\n`;
|
|
1185
1185
|
}
|
|
1186
1186
|
}
|
|
1187
1187
|
}
|
|
1188
1188
|
}).prompt();
|
|
1189
1189
|
};
|
|
1190
|
-
const defaultNoteFormatter = (line) =>
|
|
1190
|
+
const defaultNoteFormatter = (line) => color.dim(line);
|
|
1191
1191
|
const wrapWithFormat = (message, width, format) => {
|
|
1192
1192
|
const opts = {
|
|
1193
1193
|
hard: true,
|
|
@@ -1211,21 +1211,21 @@ const note = (message = "", title = "", opts) => {
|
|
|
1211
1211
|
const width = fastStringWidth(ln);
|
|
1212
1212
|
return width > sum ? width : sum;
|
|
1213
1213
|
}, 0), titleLen) + 2;
|
|
1214
|
-
const lineSymbol = hasGuide ?
|
|
1214
|
+
const lineSymbol = hasGuide ? color.gray(S_BAR) : " ";
|
|
1215
1215
|
const msg = lines.map((ln) => `${lineSymbol} ${ln}${" ".repeat(len - fastStringWidth(ln))}${lineSymbol}`).join("\n");
|
|
1216
|
-
const leadingBorder = hasGuide ? `${
|
|
1216
|
+
const leadingBorder = hasGuide ? `${color.gray(S_BAR)}\n` : "";
|
|
1217
1217
|
const bottomLeft = hasGuide ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
|
|
1218
|
-
output.write(`${leadingBorder}${completeColor(S_STEP_SUBMIT)} ${
|
|
1218
|
+
output.write(`${leadingBorder}${completeColor(S_STEP_SUBMIT)} ${color.reset(title)} ${color.gray(S_BAR_H.repeat(Math.max(len - titleLen - 1, 1)) + S_CORNER_TOP_RIGHT)}\n${msg}\n${color.gray(bottomLeft + S_BAR_H.repeat(len + 2) + S_CORNER_BOTTOM_RIGHT)}\n`);
|
|
1219
1219
|
};
|
|
1220
|
-
const defaultStyleFn =
|
|
1220
|
+
const defaultStyleFn = color.magenta;
|
|
1221
1221
|
const removeTrailingDots = (msg) => {
|
|
1222
1222
|
return msg.replace(/\.+$/, "");
|
|
1223
1223
|
};
|
|
1224
|
-
const formatTimer = (
|
|
1225
|
-
const duration =
|
|
1224
|
+
const formatTimer = (durationMs) => {
|
|
1225
|
+
const duration = durationMs / 1e3;
|
|
1226
1226
|
const min = Math.floor(duration / 60);
|
|
1227
1227
|
const secs = Math.floor(duration % 60);
|
|
1228
|
-
return min > 0 ? `
|
|
1228
|
+
return color.gray(min > 0 ? `(${min}m ${secs}s)` : `(${secs}s)`);
|
|
1229
1229
|
};
|
|
1230
1230
|
const spinner = ({ indicator = "dots", onCancel, output = process.stdout, cancelMessage, errorMessage, frames = unicode ? [
|
|
1231
1231
|
"◒",
|
|
@@ -1246,8 +1246,13 @@ const spinner = ({ indicator = "dots", onCancel, output = process.stdout, cancel
|
|
|
1246
1246
|
let _message = "";
|
|
1247
1247
|
let _prevMessage;
|
|
1248
1248
|
let _origin = performance.now();
|
|
1249
|
+
let _elapsedMs = 0;
|
|
1249
1250
|
const columns = rt(output);
|
|
1250
1251
|
const styleFn = opts?.styleFrame ?? defaultStyleFn;
|
|
1252
|
+
const getElapsedMs = () => {
|
|
1253
|
+
if (!isSpinnerActive) return _elapsedMs;
|
|
1254
|
+
return _elapsedMs + (performance.now() - _origin);
|
|
1255
|
+
};
|
|
1251
1256
|
const handleExit = (code) => {
|
|
1252
1257
|
const msg = code > 1 ? errorMessage ?? _.messages.error : cancelMessage ?? _.messages.cancel;
|
|
1253
1258
|
isCancelled = code === 1;
|
|
@@ -1286,12 +1291,12 @@ const spinner = ({ indicator = "dots", onCancel, output = process.stdout, cancel
|
|
|
1286
1291
|
output.write(import_src.erase.down());
|
|
1287
1292
|
};
|
|
1288
1293
|
const hasGuide = opts.withGuide ?? false;
|
|
1289
|
-
const
|
|
1294
|
+
const startLoop = () => {
|
|
1290
1295
|
isSpinnerActive = true;
|
|
1291
1296
|
unblock = Bt({ output });
|
|
1292
|
-
_message = removeTrailingDots(msg);
|
|
1293
1297
|
_origin = performance.now();
|
|
1294
|
-
|
|
1298
|
+
_prevMessage = void 0;
|
|
1299
|
+
if (hasGuide) output.write(`${color.gray(S_BAR)}\n`);
|
|
1295
1300
|
let frameIndex = 0;
|
|
1296
1301
|
let indicatorTimer = 0;
|
|
1297
1302
|
registerHooks();
|
|
@@ -1302,7 +1307,7 @@ const spinner = ({ indicator = "dots", onCancel, output = process.stdout, cancel
|
|
|
1302
1307
|
const frame = styleFn(frames[frameIndex]);
|
|
1303
1308
|
let outputMessage;
|
|
1304
1309
|
if (isCI$1) outputMessage = `${frame} ${_message}...`;
|
|
1305
|
-
else if (indicator === "timer") outputMessage = `${frame} ${_message} ${formatTimer(
|
|
1310
|
+
else if (indicator === "timer") outputMessage = `${frame} ${_message} ${formatTimer(getElapsedMs())}`;
|
|
1306
1311
|
else {
|
|
1307
1312
|
const loadingDots = ".".repeat(Math.floor(indicatorTimer)).slice(0, 3);
|
|
1308
1313
|
outputMessage = `${frame} ${_message}${loadingDots}`;
|
|
@@ -1316,18 +1321,36 @@ const spinner = ({ indicator = "dots", onCancel, output = process.stdout, cancel
|
|
|
1316
1321
|
indicatorTimer = indicatorTimer < 4 ? indicatorTimer + .125 : 0;
|
|
1317
1322
|
}, delay);
|
|
1318
1323
|
};
|
|
1319
|
-
const
|
|
1324
|
+
const start = (msg = "") => {
|
|
1325
|
+
_elapsedMs = 0;
|
|
1326
|
+
_message = removeTrailingDots(msg);
|
|
1327
|
+
startLoop();
|
|
1328
|
+
};
|
|
1329
|
+
const _stop = (msg = "", code = 0, silent = false, preserveElapsed = false) => {
|
|
1320
1330
|
if (!isSpinnerActive) return;
|
|
1321
1331
|
isSpinnerActive = false;
|
|
1322
1332
|
clearInterval(loop);
|
|
1323
1333
|
clearPrevMessage();
|
|
1324
|
-
const
|
|
1334
|
+
const elapsedMs = getElapsedMs();
|
|
1335
|
+
const step = code === 0 ? completeColor(S_STEP_SUBMIT) : code === 1 ? color.red(S_STEP_CANCEL) : color.red(S_STEP_ERROR);
|
|
1325
1336
|
_message = msg ?? _message;
|
|
1326
|
-
if (!silent) if (indicator === "timer") output.write(`${step} ${_message} ${formatTimer(
|
|
1337
|
+
if (!silent) if (indicator === "timer") output.write(`${step} ${_message} ${formatTimer(elapsedMs)}\n\n`);
|
|
1327
1338
|
else output.write(`${step} ${_message}\n\n`);
|
|
1339
|
+
if (!preserveElapsed) _elapsedMs = 0;
|
|
1340
|
+
_prevMessage = void 0;
|
|
1328
1341
|
clearHooks();
|
|
1329
1342
|
unblock();
|
|
1330
1343
|
};
|
|
1344
|
+
const pause = () => {
|
|
1345
|
+
if (!isSpinnerActive) return;
|
|
1346
|
+
_elapsedMs = getElapsedMs();
|
|
1347
|
+
_stop(_message, 0, true, true);
|
|
1348
|
+
};
|
|
1349
|
+
const resume = (msg = _message) => {
|
|
1350
|
+
if (isSpinnerActive) return;
|
|
1351
|
+
_message = removeTrailingDots(msg);
|
|
1352
|
+
startLoop();
|
|
1353
|
+
};
|
|
1331
1354
|
const stop = (msg = "") => _stop(msg, 0);
|
|
1332
1355
|
const cancel = (msg = "") => _stop(msg, 1);
|
|
1333
1356
|
const error = (msg = "") => _stop(msg, 2);
|
|
@@ -1337,6 +1360,8 @@ const spinner = ({ indicator = "dots", onCancel, output = process.stdout, cancel
|
|
|
1337
1360
|
};
|
|
1338
1361
|
return {
|
|
1339
1362
|
start,
|
|
1363
|
+
pause,
|
|
1364
|
+
resume,
|
|
1340
1365
|
stop,
|
|
1341
1366
|
message,
|
|
1342
1367
|
cancel,
|
|
@@ -1361,13 +1386,13 @@ const withMarker = (marker, label, format, firstLineSuffix = "") => {
|
|
|
1361
1386
|
const select = (opts) => {
|
|
1362
1387
|
const opt = (option, state) => {
|
|
1363
1388
|
const label = option.label ?? String(option.value);
|
|
1364
|
-
const hint = option.hint ? `: ${
|
|
1389
|
+
const hint = option.hint ? `: ${color.gray(option.hint)}` : "";
|
|
1365
1390
|
switch (state) {
|
|
1366
|
-
case "disabled": return withMarker(
|
|
1367
|
-
case "selected": return computeLabel(label,
|
|
1368
|
-
case "active": return withMarker(
|
|
1369
|
-
case "cancelled": return computeLabel(label, (str) =>
|
|
1370
|
-
default: return withMarker(
|
|
1391
|
+
case "disabled": return withMarker(color.gray(" "), label, (text) => color.strikethrough(color.gray(text)), option.hint ? `: ${color.gray(option.hint ?? "disabled")}` : "");
|
|
1392
|
+
case "selected": return computeLabel(label, color.dim);
|
|
1393
|
+
case "active": return withMarker(color.blue(S_POINTER_ACTIVE), label, (text) => color.blue(color.bold(text)), hint);
|
|
1394
|
+
case "cancelled": return computeLabel(label, (str) => color.strikethrough(color.dim(str)));
|
|
1395
|
+
default: return withMarker(color.dim(" "), label, (text) => text, hint);
|
|
1371
1396
|
}
|
|
1372
1397
|
};
|
|
1373
1398
|
return new Wt({
|
|
@@ -1384,19 +1409,19 @@ const select = (opts) => {
|
|
|
1384
1409
|
};
|
|
1385
1410
|
const hasMessage = opts.message.trim().length > 0;
|
|
1386
1411
|
const messageLines = !hasMessage ? "" : hasGuide ? xt(opts.output, opts.message, `${symbolBar(this.state)} `, `${symbol(this.state)} `) : formatMessageLines(opts.message);
|
|
1387
|
-
const title = hasMessage ? `${hasGuide ? `${
|
|
1412
|
+
const title = hasMessage ? `${hasGuide ? `${color.gray(S_BAR)}\n` : ""}${messageLines}\n` : "";
|
|
1388
1413
|
switch (this.state) {
|
|
1389
1414
|
case "submit": {
|
|
1390
|
-
const submitPrefix = hasGuide ? `${
|
|
1415
|
+
const submitPrefix = hasGuide ? `${color.gray(S_BAR)} ` : nestedPrefix;
|
|
1391
1416
|
return `${title}${xt(opts.output, opt(this.options[this.cursor], "selected"), submitPrefix)}\n`;
|
|
1392
1417
|
}
|
|
1393
1418
|
case "cancel": {
|
|
1394
|
-
const cancelPrefix = hasGuide ? `${
|
|
1395
|
-
return `${title}${xt(opts.output, opt(this.options[this.cursor], "cancelled"), cancelPrefix)}${hasGuide ? `\n${
|
|
1419
|
+
const cancelPrefix = hasGuide ? `${color.gray(S_BAR)} ` : nestedPrefix;
|
|
1420
|
+
return `${title}${xt(opts.output, opt(this.options[this.cursor], "cancelled"), cancelPrefix)}${hasGuide ? `\n${color.gray(S_BAR)}` : ""}\n`;
|
|
1396
1421
|
}
|
|
1397
1422
|
default: {
|
|
1398
|
-
const prefix = hasGuide ? `${
|
|
1399
|
-
const prefixEnd = hasGuide ?
|
|
1423
|
+
const prefix = hasGuide ? `${color.blue(S_BAR)} ` : nestedPrefix;
|
|
1424
|
+
const prefixEnd = hasGuide ? color.blue(S_BAR_END) : "";
|
|
1400
1425
|
const titleLineCount = title ? title.split("\n").length : 0;
|
|
1401
1426
|
const footerLineCount = hasGuide ? 2 : 1;
|
|
1402
1427
|
return `${title}${prefix}${limitOptions({
|
|
@@ -1434,7 +1459,7 @@ const stream = {
|
|
|
1434
1459
|
process.stdout.write("\n");
|
|
1435
1460
|
},
|
|
1436
1461
|
info: (iterable) => {
|
|
1437
|
-
return stream.message(iterable, { symbol:
|
|
1462
|
+
return stream.message(iterable, { symbol: color.blue(S_INFO) });
|
|
1438
1463
|
},
|
|
1439
1464
|
success: (iterable) => {
|
|
1440
1465
|
return stream.message(iterable, { symbol: completeColor(S_SUCCESS) });
|
|
@@ -1443,13 +1468,13 @@ const stream = {
|
|
|
1443
1468
|
return stream.message(iterable, { symbol: completeColor(S_STEP_SUBMIT) });
|
|
1444
1469
|
},
|
|
1445
1470
|
warn: (iterable) => {
|
|
1446
|
-
return stream.message(iterable, { symbol:
|
|
1471
|
+
return stream.message(iterable, { symbol: color.yellow(S_WARN) });
|
|
1447
1472
|
},
|
|
1448
1473
|
warning: (iterable) => {
|
|
1449
1474
|
return stream.warn(iterable);
|
|
1450
1475
|
},
|
|
1451
1476
|
error: (iterable) => {
|
|
1452
|
-
return stream.message(iterable, { symbol:
|
|
1477
|
+
return stream.message(iterable, { symbol: color.red(S_ERROR) });
|
|
1453
1478
|
}
|
|
1454
1479
|
};
|
|
1455
1480
|
const text = (opts) => {
|
|
@@ -1464,27 +1489,27 @@ const text = (opts) => {
|
|
|
1464
1489
|
render() {
|
|
1465
1490
|
const hasGuide = opts?.withGuide ?? false;
|
|
1466
1491
|
const nestedPrefix = " ";
|
|
1467
|
-
const title = `${hasGuide ? `${
|
|
1468
|
-
const placeholder = opts.placeholder ?
|
|
1492
|
+
const title = `${hasGuide ? `${color.gray(S_BAR)}\n` : ""}${symbol(this.state)} ${opts.message}\n`;
|
|
1493
|
+
const placeholder = opts.placeholder ? color.inverse(opts.placeholder[0]) + color.dim(opts.placeholder.slice(1)) : color.inverse(color.hidden("_"));
|
|
1469
1494
|
const userInput = !this.userInput ? placeholder : this.userInputWithCursor;
|
|
1470
1495
|
const value = this.value ?? "";
|
|
1471
1496
|
switch (this.state) {
|
|
1472
1497
|
case "error": {
|
|
1473
|
-
const errorText = this.error ? ` ${
|
|
1474
|
-
const errorPrefix = hasGuide ? `${
|
|
1475
|
-
const errorPrefixEnd = hasGuide ?
|
|
1498
|
+
const errorText = this.error ? ` ${color.yellow(this.error)}` : "";
|
|
1499
|
+
const errorPrefix = hasGuide ? `${color.yellow(S_BAR)} ` : nestedPrefix;
|
|
1500
|
+
const errorPrefixEnd = hasGuide ? color.yellow(S_BAR_END) : "";
|
|
1476
1501
|
return `${title.trim()}\n${errorPrefix}${userInput}\n${errorPrefixEnd}${errorText}\n`;
|
|
1477
1502
|
}
|
|
1478
1503
|
case "submit": {
|
|
1479
|
-
const valueText = value ?
|
|
1480
|
-
return `${title}${hasGuide ? `${
|
|
1504
|
+
const valueText = value ? color.dim(value) : "";
|
|
1505
|
+
return `${title}${hasGuide ? `${color.gray(S_BAR)} ` : nestedPrefix}${valueText}\n`;
|
|
1481
1506
|
}
|
|
1482
1507
|
case "cancel": {
|
|
1483
|
-
const valueText = value ?
|
|
1484
|
-
const cancelPrefix = hasGuide ? `${
|
|
1508
|
+
const valueText = value ? color.strikethrough(color.dim(value)) : "";
|
|
1509
|
+
const cancelPrefix = hasGuide ? `${color.gray(S_BAR)} ` : nestedPrefix;
|
|
1485
1510
|
return `${title}${cancelPrefix}${valueText}${value.trim() ? `\n${cancelPrefix}` : ""}\n`;
|
|
1486
1511
|
}
|
|
1487
|
-
default: return `${title}${hasGuide ? `${
|
|
1512
|
+
default: return `${title}${hasGuide ? `${color.blue(S_BAR)} ` : nestedPrefix}${userInput}\n${hasGuide ? color.blue(S_BAR_END) : ""}\n`;
|
|
1488
1513
|
}
|
|
1489
1514
|
}
|
|
1490
1515
|
}).prompt();
|
|
@@ -1573,7 +1598,7 @@ function displayRelative(to, from = process.cwd()) {
|
|
|
1573
1598
|
*/
|
|
1574
1599
|
async function fmt() {
|
|
1575
1600
|
return {
|
|
1576
|
-
binPath: resolve("oxfmt/bin/oxfmt"),
|
|
1601
|
+
binPath: resolve$1("oxfmt/bin/oxfmt"),
|
|
1577
1602
|
envs: { ...DEFAULT_ENVS }
|
|
1578
1603
|
};
|
|
1579
1604
|
}
|
|
@@ -1681,8 +1706,8 @@ async function runViteFmt(cwd, interactive, paths, options) {
|
|
|
1681
1706
|
};
|
|
1682
1707
|
}
|
|
1683
1708
|
}
|
|
1684
|
-
async function upgradeYarn(cwd, interactive) {
|
|
1685
|
-
const spinner = getSpinner(interactive);
|
|
1709
|
+
async function upgradeYarn(cwd, interactive, silent = false) {
|
|
1710
|
+
const spinner = silent ? getSilentSpinner() : getSpinner(interactive);
|
|
1686
1711
|
spinner.start(`Running yarn set version stable...`);
|
|
1687
1712
|
const { exitCode, stderr, stdout } = await runCommandSilently({
|
|
1688
1713
|
command: "yarn",
|
|
@@ -2140,4 +2165,4 @@ function getMarkedRange(content, startMarker, endMarker) {
|
|
|
2140
2165
|
};
|
|
2141
2166
|
}
|
|
2142
2167
|
//#endregion
|
|
2143
|
-
export { select as A, cancel as C, multiselect as D, log as E,
|
|
2168
|
+
export { select as A, cancel as C, multiselect as D, log as E, text as M, Ct as N, note as O, PackageManager as S, intro as T, pkgRoot as _, selectAgentTargetPaths as a, runCommandSilently as b, defaultInteractive as c, promptGitHooks as d, runViteFmt as f, displayRelative as g, upgradeYarn as h, getAgentById as i, spinner as j, outro as k, downloadPackageManager$1 as l, selectPackageManager as m, detectAgents as n, writeAgentInstructions as o, runViteInstall as p, detectExistingAgentTargetPaths as r, cancelAndExit as s, detectAgentConflicts as t, getSpinner as u, rulesDir as v, confirm as w, DependencyType as x, templatesDir as y };
|
package/dist/global/config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as select, C as cancel, E as log,
|
|
1
|
+
import { A as select, C as cancel, E as log, N as Ct, O as note, _ as pkgRoot, c as defaultInteractive, d as promptGitHooks, i as getAgentById, n as detectAgents } from "./agent-CpNB3GIY.js";
|
|
2
2
|
import { t as lib_default } from "./lib-DxappLRQ.js";
|
|
3
3
|
import { i as writeJsonFile, r as readJsonFile, s as VITE_PLUS_NAME } from "./json-BRdVJ52a.js";
|
|
4
4
|
import { r as log$1, t as renderCliDoc } from "./help-BAGHa8fD.js";
|