@voidzero-dev/vite-plus-prompts 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +0 -44
- package/dist/index.mjs +27 -54
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AutocompletePrompt, CANCEL_SYMBOL, CANCEL_SYMBOL as CANCEL_SYMBOL$1, ClackSettings, State, Validate, isCancel, settings, updateSettings } from "@clack/core";
|
|
2
2
|
import { Readable, Writable } from "node:stream";
|
|
3
|
-
//#region src/common.d.ts
|
|
4
3
|
/** Wrap using visible columns rather than the length of ANSI escape sequences. */
|
|
5
4
|
export declare const wrapTextWithPrefix: (output: Writable | undefined, text: string, prefix: string, startPrefix?: string) => string;
|
|
6
5
|
export declare const getGuide: (opts?: CommonOptions) => boolean;
|
|
@@ -58,8 +57,6 @@ export interface CommonOptions {
|
|
|
58
57
|
*/
|
|
59
58
|
testId?: string;
|
|
60
59
|
}
|
|
61
|
-
//#endregion
|
|
62
|
-
//#region src/select.d.ts
|
|
63
60
|
type Primitive = Readonly<string | boolean | number>;
|
|
64
61
|
export type Option<Value> = Value extends Primitive ? {
|
|
65
62
|
/**
|
|
@@ -119,8 +116,6 @@ export interface SelectOptions<Value> extends CommonOptions {
|
|
|
119
116
|
showInstructions?: boolean;
|
|
120
117
|
}
|
|
121
118
|
export declare const select: <Value>(opts: SelectOptions<Value>) => Promise<Value | typeof CANCEL_SYMBOL$1>;
|
|
122
|
-
//#endregion
|
|
123
|
-
//#region src/autocomplete.d.ts
|
|
124
119
|
interface AutocompleteSharedOptions<Value> extends CommonOptions {
|
|
125
120
|
/**
|
|
126
121
|
* The message to display to the user.
|
|
@@ -175,8 +170,6 @@ export interface AutocompleteMultiSelectOptions<Value> extends AutocompleteShare
|
|
|
175
170
|
* Integrated autocomplete multiselect - combines type-ahead filtering with multiselect in one UI
|
|
176
171
|
*/
|
|
177
172
|
export declare const autocompleteMultiselect: <Value>(opts: AutocompleteMultiSelectOptions<Value>) => Promise<Value[] | typeof CANCEL_SYMBOL$1>;
|
|
178
|
-
//#endregion
|
|
179
|
-
//#region src/box.d.ts
|
|
180
173
|
export type BoxAlignment = 'left' | 'center' | 'right';
|
|
181
174
|
export interface BoxOptions extends CommonOptions {
|
|
182
175
|
contentAlign?: BoxAlignment;
|
|
@@ -188,8 +181,6 @@ export interface BoxOptions extends CommonOptions {
|
|
|
188
181
|
formatBorder?: (text: string) => string;
|
|
189
182
|
}
|
|
190
183
|
export declare const box: (message?: string, title?: string, opts?: BoxOptions) => void;
|
|
191
|
-
//#endregion
|
|
192
|
-
//#region src/confirm.d.ts
|
|
193
184
|
export interface ConfirmOptions extends CommonOptions {
|
|
194
185
|
message: string;
|
|
195
186
|
active?: string;
|
|
@@ -198,8 +189,6 @@ export interface ConfirmOptions extends CommonOptions {
|
|
|
198
189
|
vertical?: boolean;
|
|
199
190
|
}
|
|
200
191
|
export declare const confirm: (opts: ConfirmOptions) => Promise<boolean | typeof CANCEL_SYMBOL$1>;
|
|
201
|
-
//#endregion
|
|
202
|
-
//#region src/group.d.ts
|
|
203
192
|
type Prettify<T> = { [P in keyof T]: T[P]; } & {};
|
|
204
193
|
export type PromptGroupAwaitedReturn<T> = { [P in keyof T]: Exclude<Awaited<T[P]>, symbol>; };
|
|
205
194
|
export interface PromptGroupOptions<T> {
|
|
@@ -219,8 +208,6 @@ export type PromptGroup<T> = { [P in keyof T]: (opts: {
|
|
|
219
208
|
* and return a results of objects within the group
|
|
220
209
|
*/
|
|
221
210
|
export declare const group: <T>(prompts: PromptGroup<T>, opts?: PromptGroupOptions<T>) => Promise<Prettify<PromptGroupAwaitedReturn<T>>>;
|
|
222
|
-
//#endregion
|
|
223
|
-
//#region src/group-multi-select.d.ts
|
|
224
211
|
export interface GroupMultiSelectOptions<Value> extends CommonOptions {
|
|
225
212
|
message: string;
|
|
226
213
|
options: Record<string, Option<Value>[]>;
|
|
@@ -233,8 +220,6 @@ export interface GroupMultiSelectOptions<Value> extends CommonOptions {
|
|
|
233
220
|
showInstructions?: boolean;
|
|
234
221
|
}
|
|
235
222
|
export declare const groupMultiselect: <Value>(opts: GroupMultiSelectOptions<Value>) => Promise<Value[] | typeof CANCEL_SYMBOL$1>;
|
|
236
|
-
//#endregion
|
|
237
|
-
//#region src/limit-options.d.ts
|
|
238
223
|
/**
|
|
239
224
|
* Options for the {@link limitOptions} function.
|
|
240
225
|
*/
|
|
@@ -294,8 +279,6 @@ export interface LimitOptionsParams<TOption> extends CommonOptions {
|
|
|
294
279
|
* ```
|
|
295
280
|
*/
|
|
296
281
|
export declare const limitOptions: <TOption>({ cursor, options, style, output, maxItems, columnPadding, rowPadding }: LimitOptionsParams<TOption>) => string[];
|
|
297
|
-
//#endregion
|
|
298
|
-
//#region src/log.d.ts
|
|
299
282
|
export interface LogMessageOptions extends CommonOptions {
|
|
300
283
|
symbol?: string;
|
|
301
284
|
spacing?: number;
|
|
@@ -311,13 +294,9 @@ export declare const log: {
|
|
|
311
294
|
warning: (message: string, opts?: LogMessageOptions) => void;
|
|
312
295
|
error: (message: string, opts?: LogMessageOptions) => void;
|
|
313
296
|
};
|
|
314
|
-
//#endregion
|
|
315
|
-
//#region src/messages.d.ts
|
|
316
297
|
export declare const cancel: (message?: string, opts?: CommonOptions) => void;
|
|
317
298
|
export declare const intro: (title?: string, opts?: CommonOptions) => void;
|
|
318
299
|
export declare const outro: (message?: string, opts?: CommonOptions) => void;
|
|
319
|
-
//#endregion
|
|
320
|
-
//#region src/milestone.d.ts
|
|
321
300
|
/**
|
|
322
301
|
* Render-milestone markers for the PTY snapshot suite
|
|
323
302
|
* (crates/vp_cli_snapshots): invisible window-title updates the runner
|
|
@@ -345,8 +324,6 @@ export declare function milestone(name: string): string;
|
|
|
345
324
|
* `testId` at ambiguous call sites (multiple prompts of one kind in a flow).
|
|
346
325
|
*/
|
|
347
326
|
export declare function promptMilestone(kind: string, id: string | undefined, state: string): string;
|
|
348
|
-
//#endregion
|
|
349
|
-
//#region src/multi-select.d.ts
|
|
350
327
|
export interface MultiSelectOptions<Value> extends CommonOptions {
|
|
351
328
|
message: string;
|
|
352
329
|
options: Option<Value>[];
|
|
@@ -357,16 +334,12 @@ export interface MultiSelectOptions<Value> extends CommonOptions {
|
|
|
357
334
|
showInstructions?: boolean;
|
|
358
335
|
}
|
|
359
336
|
export declare const multiselect: <Value>(opts: MultiSelectOptions<Value>) => Promise<Value[] | typeof CANCEL_SYMBOL$1>;
|
|
360
|
-
//#endregion
|
|
361
|
-
//#region src/note.d.ts
|
|
362
337
|
export interface NoteOptions extends CommonOptions {
|
|
363
338
|
/** Format note content; readable, un-dimmed text by default. */
|
|
364
339
|
format?: (line: string) => string;
|
|
365
340
|
}
|
|
366
341
|
/** A compact, enclosed note. Guide bars never replace its side borders. */
|
|
367
342
|
export declare const note: (message?: string, title?: string, opts?: NoteOptions) => void;
|
|
368
|
-
//#endregion
|
|
369
|
-
//#region src/password.d.ts
|
|
370
343
|
export interface PasswordOptions extends CommonOptions {
|
|
371
344
|
message: string;
|
|
372
345
|
mask?: string;
|
|
@@ -376,8 +349,6 @@ export interface PasswordOptions extends CommonOptions {
|
|
|
376
349
|
clearOnError?: boolean;
|
|
377
350
|
}
|
|
378
351
|
export declare const password: (opts: PasswordOptions) => Promise<string | typeof CANCEL_SYMBOL$1>;
|
|
379
|
-
//#endregion
|
|
380
|
-
//#region src/path.d.ts
|
|
381
352
|
/**
|
|
382
353
|
* Options for the {@link path} prompt.
|
|
383
354
|
*/
|
|
@@ -427,8 +398,6 @@ export interface PathOptions extends CommonOptions {
|
|
|
427
398
|
* ```
|
|
428
399
|
*/
|
|
429
400
|
export declare const path: (opts: PathOptions) => Promise<string | typeof CANCEL_SYMBOL$1>;
|
|
430
|
-
//#endregion
|
|
431
|
-
//#region src/spinner.d.ts
|
|
432
401
|
export interface SpinnerOptions extends CommonOptions {
|
|
433
402
|
indicator?: 'dots' | 'timer';
|
|
434
403
|
onCancel?: () => void;
|
|
@@ -450,8 +419,6 @@ export interface SpinnerResult {
|
|
|
450
419
|
readonly isCancelled: boolean;
|
|
451
420
|
}
|
|
452
421
|
export declare const spinner: ({ indicator, onCancel, output, cancelMessage, errorMessage, frames, delay, signal, ...opts }?: SpinnerOptions) => SpinnerResult;
|
|
453
|
-
//#endregion
|
|
454
|
-
//#region src/progress-bar.d.ts
|
|
455
422
|
export interface ProgressOptions extends SpinnerOptions {
|
|
456
423
|
style?: 'light' | 'heavy' | 'block';
|
|
457
424
|
max?: number;
|
|
@@ -461,8 +428,6 @@ export interface ProgressResult extends SpinnerResult {
|
|
|
461
428
|
advance(step?: number, msg?: string): void;
|
|
462
429
|
}
|
|
463
430
|
export declare function progress({ style, max: userMax, size: userSize, ...spinnerOptions }?: ProgressOptions): ProgressResult;
|
|
464
|
-
//#endregion
|
|
465
|
-
//#region src/select-key.d.ts
|
|
466
431
|
export interface SelectKeyOptions<Value extends string> extends CommonOptions {
|
|
467
432
|
message: string;
|
|
468
433
|
options: Option<Value>[];
|
|
@@ -470,8 +435,6 @@ export interface SelectKeyOptions<Value extends string> extends CommonOptions {
|
|
|
470
435
|
caseSensitive?: boolean;
|
|
471
436
|
}
|
|
472
437
|
export declare const selectKey: <Value extends string>(opts: SelectKeyOptions<Value>) => Promise<Value | typeof CANCEL_SYMBOL$1>;
|
|
473
|
-
//#endregion
|
|
474
|
-
//#region src/stream.d.ts
|
|
475
438
|
export declare const stream: {
|
|
476
439
|
message: (iterable: Iterable<string> | AsyncIterable<string>, { symbol }?: LogMessageOptions) => Promise<void>;
|
|
477
440
|
info: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
|
|
@@ -482,8 +445,6 @@ export declare const stream: {
|
|
|
482
445
|
warning: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
|
|
483
446
|
error: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
|
|
484
447
|
};
|
|
485
|
-
//#endregion
|
|
486
|
-
//#region src/task.d.ts
|
|
487
448
|
export type Task = {
|
|
488
449
|
/**
|
|
489
450
|
* Task title
|
|
@@ -502,8 +463,6 @@ export type Task = {
|
|
|
502
463
|
* Define a group of tasks to be executed
|
|
503
464
|
*/
|
|
504
465
|
export declare const tasks: (tasks: Task[], opts?: CommonOptions) => Promise<void>;
|
|
505
|
-
//#endregion
|
|
506
|
-
//#region src/task-log.d.ts
|
|
507
466
|
export interface TaskLogOptions extends CommonOptions {
|
|
508
467
|
title: string;
|
|
509
468
|
limit?: number;
|
|
@@ -529,8 +488,6 @@ export declare const taskLog: (opts: TaskLogOptions) => {
|
|
|
529
488
|
error(message: string, opts?: TaskLogCompletionOptions): void;
|
|
530
489
|
success(message: string, opts?: TaskLogCompletionOptions): void;
|
|
531
490
|
};
|
|
532
|
-
//#endregion
|
|
533
|
-
//#region src/text.d.ts
|
|
534
491
|
export interface TextOptions extends CommonOptions {
|
|
535
492
|
message: string;
|
|
536
493
|
placeholder?: string;
|
|
@@ -539,5 +496,4 @@ export interface TextOptions extends CommonOptions {
|
|
|
539
496
|
validate?: Validate<string>;
|
|
540
497
|
}
|
|
541
498
|
export declare const text: (opts: TextOptions) => Promise<string | typeof CANCEL_SYMBOL$1>;
|
|
542
|
-
//#endregion
|
|
543
499
|
export { CANCEL_SYMBOL, type ClackSettings, isCancel, settings, symbol$1 as symbol, updateSettings };
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { randomBytes } from "node:crypto";
|
|
|
6
6
|
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
7
7
|
import { dirname, join } from "node:path";
|
|
8
8
|
import { cursor, erase } from "sisteransi";
|
|
9
|
-
|
|
9
|
+
// ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
10
10
|
const getCodePointsLength = (() => {
|
|
11
11
|
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
12
12
|
return (input) => {
|
|
@@ -22,8 +22,7 @@ const isFullWidth = (x) => {
|
|
|
22
22
|
const isWideNotCJKTNotEmoji = (x) => {
|
|
23
23
|
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
24
24
|
};
|
|
25
|
-
|
|
26
|
-
//#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
25
|
+
// ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
27
26
|
const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
28
27
|
const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
29
28
|
const CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy;
|
|
@@ -112,8 +111,7 @@ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {
|
|
|
112
111
|
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
113
112
|
};
|
|
114
113
|
};
|
|
115
|
-
|
|
116
|
-
//#region ../../node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
114
|
+
// ../../node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
117
115
|
const NO_TRUNCATION = {
|
|
118
116
|
limit: Infinity,
|
|
119
117
|
ellipsis: "",
|
|
@@ -122,8 +120,7 @@ const NO_TRUNCATION = {
|
|
|
122
120
|
const fastStringWidth = (input, options = {}) => {
|
|
123
121
|
return getStringTruncatedWidth(input, NO_TRUNCATION, options).width;
|
|
124
122
|
};
|
|
125
|
-
|
|
126
|
-
//#region ../../node_modules/.pnpm/fast-wrap-ansi@0.2.0/node_modules/fast-wrap-ansi/lib/main.js
|
|
123
|
+
// ../../node_modules/.pnpm/fast-wrap-ansi@0.2.0/node_modules/fast-wrap-ansi/lib/main.js
|
|
127
124
|
const ESC = "\x1B";
|
|
128
125
|
const CSI = "";
|
|
129
126
|
const END_CODE = 39;
|
|
@@ -287,16 +284,14 @@ const CRLF_OR_LF = /\r?\n/;
|
|
|
287
284
|
function wrapAnsi(string, columns, options) {
|
|
288
285
|
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
289
286
|
}
|
|
290
|
-
|
|
291
|
-
//#region ../../node_modules/.pnpm/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
|
|
287
|
+
// ../../node_modules/.pnpm/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
|
|
292
288
|
function isUnicodeSupported() {
|
|
293
289
|
const { env } = process$1;
|
|
294
290
|
const { TERM, TERM_PROGRAM } = env;
|
|
295
291
|
if (process$1.platform !== "win32") return TERM !== "linux";
|
|
296
292
|
return Boolean(env.WT_SESSION) || Boolean(env.TERMINUS_SUBLIME) || env.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
297
293
|
}
|
|
298
|
-
|
|
299
|
-
//#region src/common.ts
|
|
294
|
+
// src/common.ts
|
|
300
295
|
updateSettings$1({ withGuide: false });
|
|
301
296
|
/** Wrap using visible columns rather than the length of ANSI escape sequences. */
|
|
302
297
|
const wrapTextWithPrefix = (output, text, prefix, startPrefix = prefix) => {
|
|
@@ -383,8 +378,7 @@ const symbolBar = (state) => {
|
|
|
383
378
|
default: return color.blue(S_BAR);
|
|
384
379
|
}
|
|
385
380
|
};
|
|
386
|
-
|
|
387
|
-
//#region src/limit-options.ts
|
|
381
|
+
// src/limit-options.ts
|
|
388
382
|
const trimLines = (groups, initialLineCount, startIndex, endIndex, maxLines, fromEnd = false) => {
|
|
389
383
|
let lineCount = initialLineCount;
|
|
390
384
|
let removals = 0;
|
|
@@ -492,8 +486,7 @@ const limitOptions = ({ cursor, options, style, output = process.stdout, maxItem
|
|
|
492
486
|
if (shouldRenderBottomEllipsis) result.push(overflowFormat);
|
|
493
487
|
return result;
|
|
494
488
|
};
|
|
495
|
-
|
|
496
|
-
//#region src/autocomplete.ts
|
|
489
|
+
// src/autocomplete.ts
|
|
497
490
|
function getLabel(option) {
|
|
498
491
|
return option.label ?? String(option.value ?? "");
|
|
499
492
|
}
|
|
@@ -680,8 +673,7 @@ const autocompleteMultiselect = (opts) => {
|
|
|
680
673
|
}
|
|
681
674
|
}).prompt();
|
|
682
675
|
};
|
|
683
|
-
|
|
684
|
-
//#region src/box.ts
|
|
676
|
+
// src/box.ts
|
|
685
677
|
const roundedSymbols = [
|
|
686
678
|
S_CORNER_TOP_LEFT,
|
|
687
679
|
S_CORNER_TOP_RIGHT,
|
|
@@ -760,8 +752,7 @@ const box = (message = "", title = "", opts) => {
|
|
|
760
752
|
}
|
|
761
753
|
output.write(`${linePrefix}${symbols[2]}${hSymbol.repeat(innerWidth)}${symbols[3]}\n`);
|
|
762
754
|
};
|
|
763
|
-
|
|
764
|
-
//#region src/milestone.ts
|
|
755
|
+
// src/milestone.ts
|
|
765
756
|
/**
|
|
766
757
|
* Render-milestone markers for the PTY snapshot suite
|
|
767
758
|
* (crates/vp_cli_snapshots): invisible window-title updates the runner
|
|
@@ -800,8 +791,7 @@ function milestone(name) {
|
|
|
800
791
|
function promptMilestone(kind, id, state) {
|
|
801
792
|
return milestone(`${kind}:${id ?? kind}:${state}`);
|
|
802
793
|
}
|
|
803
|
-
|
|
804
|
-
//#region src/confirm.ts
|
|
794
|
+
// src/confirm.ts
|
|
805
795
|
const confirm = (opts) => {
|
|
806
796
|
const active = opts.active ?? "Yes";
|
|
807
797
|
const inactive = opts.inactive ?? "No";
|
|
@@ -830,8 +820,7 @@ const confirm = (opts) => {
|
|
|
830
820
|
}
|
|
831
821
|
}).prompt();
|
|
832
822
|
};
|
|
833
|
-
|
|
834
|
-
//#region src/group.ts
|
|
823
|
+
// src/group.ts
|
|
835
824
|
/**
|
|
836
825
|
* Define a group of prompts to be displayed
|
|
837
826
|
* and return a results of objects within the group
|
|
@@ -853,8 +842,7 @@ const group = async (prompts, opts) => {
|
|
|
853
842
|
}
|
|
854
843
|
return results;
|
|
855
844
|
};
|
|
856
|
-
|
|
857
|
-
//#region src/group-multi-select.ts
|
|
845
|
+
// src/group-multi-select.ts
|
|
858
846
|
const groupMultiselect = (opts) => {
|
|
859
847
|
const { selectableGroups = true, groupSpacing = 0 } = opts;
|
|
860
848
|
const hasGuide = getGuide(opts);
|
|
@@ -934,8 +922,7 @@ const groupMultiselect = (opts) => {
|
|
|
934
922
|
}
|
|
935
923
|
}).prompt();
|
|
936
924
|
};
|
|
937
|
-
|
|
938
|
-
//#region src/log.ts
|
|
925
|
+
// src/log.ts
|
|
939
926
|
const log = {
|
|
940
927
|
message: (message = [], { symbol, secondarySymbol = color.gray(S_BAR), output = process.stdout, spacing = 0, withGuide } = {}) => {
|
|
941
928
|
const parts = [];
|
|
@@ -990,8 +977,7 @@ const log = {
|
|
|
990
977
|
});
|
|
991
978
|
}
|
|
992
979
|
};
|
|
993
|
-
|
|
994
|
-
//#region src/messages.ts
|
|
980
|
+
// src/messages.ts
|
|
995
981
|
const cancel = (message = "", opts) => {
|
|
996
982
|
const output = opts?.output ?? process.stdout;
|
|
997
983
|
const prefix = getGuide(opts) ? `${color.gray(S_BAR_END)} ` : "";
|
|
@@ -1007,8 +993,7 @@ const outro = (message = "", opts) => {
|
|
|
1007
993
|
const prefix = getGuide(opts) ? `${color.gray(S_BAR)}\n${color.gray(S_BAR_END)} ` : "";
|
|
1008
994
|
output.write(`${prefix}${message}\n\n`);
|
|
1009
995
|
};
|
|
1010
|
-
|
|
1011
|
-
//#region src/multi-select.ts
|
|
996
|
+
// src/multi-select.ts
|
|
1012
997
|
const computeLabel$1 = (label, format) => {
|
|
1013
998
|
return label.split("\n").map((line) => format(line)).join("\n");
|
|
1014
999
|
};
|
|
@@ -1098,8 +1083,7 @@ const multiselect = (opts) => {
|
|
|
1098
1083
|
}
|
|
1099
1084
|
}).prompt();
|
|
1100
1085
|
};
|
|
1101
|
-
|
|
1102
|
-
//#region src/note.ts
|
|
1086
|
+
// src/note.ts
|
|
1103
1087
|
/** A compact, enclosed note. Guide bars never replace its side borders. */
|
|
1104
1088
|
const note = (message = "", title = "", opts) => {
|
|
1105
1089
|
const content = opts?.format ? message.split("\n").map(opts.format).join("\n") : message;
|
|
@@ -1110,8 +1094,7 @@ const note = (message = "", title = "", opts) => {
|
|
|
1110
1094
|
formatBorder: color.gray
|
|
1111
1095
|
});
|
|
1112
1096
|
};
|
|
1113
|
-
|
|
1114
|
-
//#region src/password.ts
|
|
1097
|
+
// src/password.ts
|
|
1115
1098
|
const password = (opts) => {
|
|
1116
1099
|
return new PasswordPrompt({
|
|
1117
1100
|
validate: opts.validate,
|
|
@@ -1149,8 +1132,7 @@ const password = (opts) => {
|
|
|
1149
1132
|
}
|
|
1150
1133
|
}).prompt();
|
|
1151
1134
|
};
|
|
1152
|
-
|
|
1153
|
-
//#region src/path.ts
|
|
1135
|
+
// src/path.ts
|
|
1154
1136
|
/**
|
|
1155
1137
|
* The `path` prompt extends `autocomplete` to provide file and directory suggestions.
|
|
1156
1138
|
*
|
|
@@ -1202,8 +1184,7 @@ const path = (opts) => {
|
|
|
1202
1184
|
}
|
|
1203
1185
|
});
|
|
1204
1186
|
};
|
|
1205
|
-
|
|
1206
|
-
//#region src/spinner.ts
|
|
1187
|
+
// src/spinner.ts
|
|
1207
1188
|
const defaultStyleFn = color.blue;
|
|
1208
1189
|
const removeTrailingDots = (msg) => {
|
|
1209
1190
|
return msg.replace(/\.+$/, "");
|
|
@@ -1367,8 +1348,7 @@ const spinner = ({ indicator = "dots", onCancel, output = process.stdout, cancel
|
|
|
1367
1348
|
}
|
|
1368
1349
|
};
|
|
1369
1350
|
};
|
|
1370
|
-
|
|
1371
|
-
//#region src/progress-bar.ts
|
|
1351
|
+
// src/progress-bar.ts
|
|
1372
1352
|
const S_PROGRESS_CHAR = {
|
|
1373
1353
|
light: unicodeOr("─", "-"),
|
|
1374
1354
|
heavy: unicodeOr("━", "="),
|
|
@@ -1422,8 +1402,7 @@ function progress({ style = "heavy", max: userMax = 100, size: userSize = 40, ..
|
|
|
1422
1402
|
}
|
|
1423
1403
|
};
|
|
1424
1404
|
}
|
|
1425
|
-
|
|
1426
|
-
//#region src/select.ts
|
|
1405
|
+
// src/select.ts
|
|
1427
1406
|
const computeLabel = (label, format) => {
|
|
1428
1407
|
if (!label.includes("\n")) return format(label);
|
|
1429
1408
|
return label.split("\n").map((line) => format(line)).join("\n");
|
|
@@ -1483,8 +1462,7 @@ const select = (opts) => {
|
|
|
1483
1462
|
}
|
|
1484
1463
|
}).prompt();
|
|
1485
1464
|
};
|
|
1486
|
-
|
|
1487
|
-
//#region src/select-key.ts
|
|
1465
|
+
// src/select-key.ts
|
|
1488
1466
|
const selectKey = (opts) => {
|
|
1489
1467
|
const withMarker = (marker, value) => optionText(opts.output, `${marker} `, value, (text) => text);
|
|
1490
1468
|
const opt = (option, state = "inactive") => {
|
|
@@ -1526,8 +1504,7 @@ const selectKey = (opts) => {
|
|
|
1526
1504
|
}
|
|
1527
1505
|
}).prompt();
|
|
1528
1506
|
};
|
|
1529
|
-
|
|
1530
|
-
//#region src/stream.ts
|
|
1507
|
+
// src/stream.ts
|
|
1531
1508
|
const prefix = " ";
|
|
1532
1509
|
const stream = {
|
|
1533
1510
|
message: async (iterable, { symbol = "" } = {}) => {
|
|
@@ -1568,8 +1545,7 @@ const stream = {
|
|
|
1568
1545
|
return stream.message(iterable, { symbol: color.red(S_ERROR) });
|
|
1569
1546
|
}
|
|
1570
1547
|
};
|
|
1571
|
-
|
|
1572
|
-
//#region src/task.ts
|
|
1548
|
+
// src/task.ts
|
|
1573
1549
|
/**
|
|
1574
1550
|
* Define a group of tasks to be executed
|
|
1575
1551
|
*/
|
|
@@ -1582,8 +1558,7 @@ const tasks = async (tasks, opts) => {
|
|
|
1582
1558
|
s.stop(result || task.title);
|
|
1583
1559
|
}
|
|
1584
1560
|
};
|
|
1585
|
-
|
|
1586
|
-
//#region src/task-log.ts
|
|
1561
|
+
// src/task-log.ts
|
|
1587
1562
|
const stripDestructiveANSI = (input) => {
|
|
1588
1563
|
return input.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, "");
|
|
1589
1564
|
};
|
|
@@ -1745,8 +1720,7 @@ const taskLog = (opts) => {
|
|
|
1745
1720
|
}
|
|
1746
1721
|
};
|
|
1747
1722
|
};
|
|
1748
|
-
|
|
1749
|
-
//#region src/text.ts
|
|
1723
|
+
// src/text.ts
|
|
1750
1724
|
const text = (opts) => {
|
|
1751
1725
|
return new TextPrompt({
|
|
1752
1726
|
validate: opts.validate,
|
|
@@ -1792,5 +1766,4 @@ const text = (opts) => {
|
|
|
1792
1766
|
}
|
|
1793
1767
|
}).prompt();
|
|
1794
1768
|
};
|
|
1795
|
-
//#endregion
|
|
1796
1769
|
export { CANCEL_SYMBOL, MULTISELECT_INSTRUCTIONS, SELECT_INSTRUCTIONS, S_BAR, S_BAR_END, S_BAR_END_RIGHT, S_BAR_H, S_BAR_START, S_BAR_START_RIGHT, S_CHECKBOX_ACTIVE, S_CHECKBOX_INACTIVE, S_CHECKBOX_SELECTED, S_CONNECT_LEFT, S_CORNER_BOTTOM_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_TOP_LEFT, S_CORNER_TOP_RIGHT, S_ERROR, S_INFO, S_PASSWORD_MASK, S_POINTER_ACTIVE, S_POINTER_INACTIVE, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_SUCCESS, S_WARN, autocomplete, autocompleteMultiselect, box, cancel, completeColor, confirm, formatInstructionFooter, getGuide, group, groupMultiselect, intro, isCI, isCancel, isTTY, limitOptions, log, milestone, multiselect, note, optionText, outro, password, path, progress, promptMilestone, promptTitle, select, selectKey, settings, spinner, stream, symbol, symbolBar, taskLog, tasks, text, unicode, unicodeOr, updateSettings, wrapTextWithPrefix };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voidzero-dev/vite-plus-prompts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "The Unified Toolchain for the Web",
|
|
5
5
|
"homepage": "https://viteplus.dev/guide",
|
|
6
6
|
"bugs": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"fast-string-width": "^3.0.0",
|
|
33
33
|
"fast-wrap-ansi": "^0.2.0",
|
|
34
34
|
"is-unicode-supported": "^2.0.0",
|
|
35
|
-
"tsdown": "^0.23.
|
|
35
|
+
"tsdown": "^0.23.4"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "tsdown"
|