first commit

This commit is contained in:
2025-10-26 23:10:15 +08:00
commit 8f0345b7be
14961 changed files with 2356381 additions and 0 deletions

87
node_modules/@clack/prompts/dist/index.cjs generated vendored Normal file
View File

@@ -0,0 +1,87 @@
"use strict";const node_util=require("node:util"),core=require("@clack/core"),process$1=require("node:process"),e=require("picocolors"),sisteransi=require("sisteransi");function _interopDefaultCompat(t){return t&&typeof t=="object"&&"default"in t?t.default:t}const process__default=_interopDefaultCompat(process$1),e__default=_interopDefaultCompat(e);function isUnicodeSupported(){return process__default.platform!=="win32"?process__default.env.TERM!=="linux":!!process__default.env.CI||!!process__default.env.WT_SESSION||!!process__default.env.TERMINUS_SUBLIME||process__default.env.ConEmuTask==="{cmd::Cmder}"||process__default.env.TERM_PROGRAM==="Terminus-Sublime"||process__default.env.TERM_PROGRAM==="vscode"||process__default.env.TERM==="xterm-256color"||process__default.env.TERM==="alacritty"||process__default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const P=isUnicodeSupported(),u=(t,o)=>P?t:o,ie=u("\u25C6","*"),G=u("\u25A0","x"),L=u("\u25B2","x"),S=u("\u25C7","o"),ae=u("\u250C","T"),a=u("\u2502","|"),g=u("\u2514","\u2014"),_=u("\u25CF",">"),A=u("\u25CB"," "),C=u("\u25FB","[\u2022]"),V=u("\u25FC","[+]"),N=u("\u25FB","[ ]"),oe=u("\u25AA","\u2022"),j=u("\u2500","-"),le=u("\u256E","+"),ce=u("\u251C","+"),ue=u("\u256F","+"),B=u("\u25CF","\u2022"),W=u("\u25C6","*"),H=u("\u25B2","!"),q=u("\u25A0","x"),b=t=>{switch(t){case"initial":case"active":return e__default.cyan(ie);case"cancel":return e__default.red(G);case"error":return e__default.yellow(L);case"submit":return e__default.green(S)}},E=t=>{const{cursor:o,options:s,style:i}=t,r=t.maxItems??Number.POSITIVE_INFINITY,c=Math.max(process.stdout.rows-4,0),n=Math.min(c,Math.max(r,5));let l=0;o>=l+n-3?l=Math.max(Math.min(o-n+3,s.length-n),0):o<l+2&&(l=Math.max(o-2,0));const $=n<s.length&&l>0,h=n<s.length&&l+n<s.length;return s.slice(l,l+n).map((m,y,w)=>{const x=y===0&&$,M=y===w.length-1&&h;return x||M?e__default.dim("..."):i(m,y+l===o)})},text=t=>new core.TextPrompt({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){const o=`${e__default.gray(a)}
${b(this.state)} ${t.message}
`,s=t.placeholder?e__default.inverse(t.placeholder[0])+e__default.dim(t.placeholder.slice(1)):e__default.inverse(e__default.hidden("_")),i=this.value?this.valueWithCursor:s;switch(this.state){case"error":return`${o.trim()}
${e__default.yellow(a)} ${i}
${e__default.yellow(g)} ${e__default.yellow(this.error)}
`;case"submit":return`${o}${e__default.gray(a)} ${e__default.dim(this.value||t.placeholder)}`;case"cancel":return`${o}${e__default.gray(a)} ${e__default.strikethrough(e__default.dim(this.value??""))}${this.value?.trim()?`
${e__default.gray(a)}`:""}`;default:return`${o}${e__default.cyan(a)} ${i}
${e__default.cyan(g)}
`}}}).prompt(),password=t=>new core.PasswordPrompt({validate:t.validate,mask:t.mask??oe,render(){const o=`${e__default.gray(a)}
${b(this.state)} ${t.message}
`,s=this.valueWithCursor,i=this.masked;switch(this.state){case"error":return`${o.trim()}
${e__default.yellow(a)} ${i}
${e__default.yellow(g)} ${e__default.yellow(this.error)}
`;case"submit":return`${o}${e__default.gray(a)} ${e__default.dim(i)}`;case"cancel":return`${o}${e__default.gray(a)} ${e__default.strikethrough(e__default.dim(i??""))}${i?`
${e__default.gray(a)}`:""}`;default:return`${o}${e__default.cyan(a)} ${s}
${e__default.cyan(g)}
`}}}).prompt(),confirm=t=>{const o=t.active??"Yes",s=t.inactive??"No";return new core.ConfirmPrompt({active:o,inactive:s,initialValue:t.initialValue??!0,render(){const i=`${e__default.gray(a)}
${b(this.state)} ${t.message}
`,r=this.value?o:s;switch(this.state){case"submit":return`${i}${e__default.gray(a)} ${e__default.dim(r)}`;case"cancel":return`${i}${e__default.gray(a)} ${e__default.strikethrough(e__default.dim(r))}
${e__default.gray(a)}`;default:return`${i}${e__default.cyan(a)} ${this.value?`${e__default.green(_)} ${o}`:`${e__default.dim(A)} ${e__default.dim(o)}`} ${e__default.dim("/")} ${this.value?`${e__default.dim(A)} ${e__default.dim(s)}`:`${e__default.green(_)} ${s}`}
${e__default.cyan(g)}
`}}}).prompt()},select=t=>{const o=(s,i)=>{const r=s.label??String(s.value);switch(i){case"selected":return`${e__default.dim(r)}`;case"active":return`${e__default.green(_)} ${r} ${s.hint?e__default.dim(`(${s.hint})`):""}`;case"cancelled":return`${e__default.strikethrough(e__default.dim(r))}`;default:return`${e__default.dim(A)} ${e__default.dim(r)}`}};return new core.SelectPrompt({options:t.options,initialValue:t.initialValue,render(){const s=`${e__default.gray(a)}
${b(this.state)} ${t.message}
`;switch(this.state){case"submit":return`${s}${e__default.gray(a)} ${o(this.options[this.cursor],"selected")}`;case"cancel":return`${s}${e__default.gray(a)} ${o(this.options[this.cursor],"cancelled")}
${e__default.gray(a)}`;default:return`${s}${e__default.cyan(a)} ${E({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(i,r)=>o(i,r?"active":"inactive")}).join(`
${e__default.cyan(a)} `)}
${e__default.cyan(g)}
`}}}).prompt()},selectKey=t=>{const o=(s,i="inactive")=>{const r=s.label??String(s.value);return i==="selected"?`${e__default.dim(r)}`:i==="cancelled"?`${e__default.strikethrough(e__default.dim(r))}`:i==="active"?`${e__default.bgCyan(e__default.gray(` ${s.value} `))} ${r} ${s.hint?e__default.dim(`(${s.hint})`):""}`:`${e__default.gray(e__default.bgWhite(e__default.inverse(` ${s.value} `)))} ${r} ${s.hint?e__default.dim(`(${s.hint})`):""}`};return new core.SelectKeyPrompt({options:t.options,initialValue:t.initialValue,render(){const s=`${e__default.gray(a)}
${b(this.state)} ${t.message}
`;switch(this.state){case"submit":return`${s}${e__default.gray(a)} ${o(this.options.find(i=>i.value===this.value)??t.options[0],"selected")}`;case"cancel":return`${s}${e__default.gray(a)} ${o(this.options[0],"cancelled")}
${e__default.gray(a)}`;default:return`${s}${e__default.cyan(a)} ${this.options.map((i,r)=>o(i,r===this.cursor?"active":"inactive")).join(`
${e__default.cyan(a)} `)}
${e__default.cyan(g)}
`}}}).prompt()},multiselect=t=>{const o=(s,i)=>{const r=s.label??String(s.value);return i==="active"?`${e__default.cyan(C)} ${r} ${s.hint?e__default.dim(`(${s.hint})`):""}`:i==="selected"?`${e__default.green(V)} ${e__default.dim(r)} ${s.hint?e__default.dim(`(${s.hint})`):""}`:i==="cancelled"?`${e__default.strikethrough(e__default.dim(r))}`:i==="active-selected"?`${e__default.green(V)} ${r} ${s.hint?e__default.dim(`(${s.hint})`):""}`:i==="submitted"?`${e__default.dim(r)}`:`${e__default.dim(N)} ${e__default.dim(r)}`};return new core.MultiSelectPrompt({options:t.options,initialValues:t.initialValues,required:t.required??!0,cursorAt:t.cursorAt,validate(s){if(this.required&&s.length===0)return`Please select at least one option.
${e__default.reset(e__default.dim(`Press ${e__default.gray(e__default.bgWhite(e__default.inverse(" space ")))} to select, ${e__default.gray(e__default.bgWhite(e__default.inverse(" enter ")))} to submit`))}`},render(){const s=`${e__default.gray(a)}
${b(this.state)} ${t.message}
`,i=(r,c)=>{const n=this.value.includes(r.value);return c&&n?o(r,"active-selected"):n?o(r,"selected"):o(r,c?"active":"inactive")};switch(this.state){case"submit":return`${s}${e__default.gray(a)} ${this.options.filter(({value:r})=>this.value.includes(r)).map(r=>o(r,"submitted")).join(e__default.dim(", "))||e__default.dim("none")}`;case"cancel":{const r=this.options.filter(({value:c})=>this.value.includes(c)).map(c=>o(c,"cancelled")).join(e__default.dim(", "));return`${s}${e__default.gray(a)} ${r.trim()?`${r}
${e__default.gray(a)}`:""}`}case"error":{const r=this.error.split(`
`).map((c,n)=>n===0?`${e__default.yellow(g)} ${e__default.yellow(c)}`:` ${c}`).join(`
`);return`${s+e__default.yellow(a)} ${E({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:i}).join(`
${e__default.yellow(a)} `)}
${r}
`}default:return`${s}${e__default.cyan(a)} ${E({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:i}).join(`
${e__default.cyan(a)} `)}
${e__default.cyan(g)}
`}}}).prompt()},groupMultiselect=t=>{const{selectableGroups:o=!0}=t,s=(i,r,c=[])=>{const n=i.label??String(i.value),l=typeof i.group=="string",$=l&&(c[c.indexOf(i)+1]??{group:!0}),h=l&&$.group===!0,m=l?o?`${h?g:a} `:" ":"";if(r==="active")return`${e__default.dim(m)}${e__default.cyan(C)} ${n} ${i.hint?e__default.dim(`(${i.hint})`):""}`;if(r==="group-active")return`${m}${e__default.cyan(C)} ${e__default.dim(n)}`;if(r==="group-active-selected")return`${m}${e__default.green(V)} ${e__default.dim(n)}`;if(r==="selected"){const w=l||o?e__default.green(V):"";return`${e__default.dim(m)}${w} ${e__default.dim(n)} ${i.hint?e__default.dim(`(${i.hint})`):""}`}if(r==="cancelled")return`${e__default.strikethrough(e__default.dim(n))}`;if(r==="active-selected")return`${e__default.dim(m)}${e__default.green(V)} ${n} ${i.hint?e__default.dim(`(${i.hint})`):""}`;if(r==="submitted")return`${e__default.dim(n)}`;const y=l||o?e__default.dim(N):"";return`${e__default.dim(m)}${y} ${e__default.dim(n)}`};return new core.GroupMultiSelectPrompt({options:t.options,initialValues:t.initialValues,required:t.required??!0,cursorAt:t.cursorAt,selectableGroups:o,validate(i){if(this.required&&i.length===0)return`Please select at least one option.
${e__default.reset(e__default.dim(`Press ${e__default.gray(e__default.bgWhite(e__default.inverse(" space ")))} to select, ${e__default.gray(e__default.bgWhite(e__default.inverse(" enter ")))} to submit`))}`},render(){const i=`${e__default.gray(a)}
${b(this.state)} ${t.message}
`;switch(this.state){case"submit":return`${i}${e__default.gray(a)} ${this.options.filter(({value:r})=>this.value.includes(r)).map(r=>s(r,"submitted")).join(e__default.dim(", "))}`;case"cancel":{const r=this.options.filter(({value:c})=>this.value.includes(c)).map(c=>s(c,"cancelled")).join(e__default.dim(", "));return`${i}${e__default.gray(a)} ${r.trim()?`${r}
${e__default.gray(a)}`:""}`}case"error":{const r=this.error.split(`
`).map((c,n)=>n===0?`${e__default.yellow(g)} ${e__default.yellow(c)}`:` ${c}`).join(`
`);return`${i}${e__default.yellow(a)} ${this.options.map((c,n,l)=>{const $=this.value.includes(c.value)||c.group===!0&&this.isGroupSelected(`${c.value}`),h=n===this.cursor;return!h&&typeof c.group=="string"&&this.options[this.cursor].value===c.group?s(c,$?"group-active-selected":"group-active",l):h&&$?s(c,"active-selected",l):$?s(c,"selected",l):s(c,h?"active":"inactive",l)}).join(`
${e__default.yellow(a)} `)}
${r}
`}default:return`${i}${e__default.cyan(a)} ${this.options.map((r,c,n)=>{const l=this.value.includes(r.value)||r.group===!0&&this.isGroupSelected(`${r.value}`),$=c===this.cursor;return!$&&typeof r.group=="string"&&this.options[this.cursor].value===r.group?s(r,l?"group-active-selected":"group-active",n):$&&l?s(r,"active-selected",n):l?s(r,"selected",n):s(r,$?"active":"inactive",n)}).join(`
${e__default.cyan(a)} `)}
${e__default.cyan(g)}
`}}}).prompt()},note=(t="",o="")=>{const s=`
${t}
`.split(`
`),i=node_util.stripVTControlCharacters(o).length,r=Math.max(s.reduce((n,l)=>{const $=node_util.stripVTControlCharacters(l);return $.length>n?$.length:n},0),i)+2,c=s.map(n=>`${e__default.gray(a)} ${e__default.dim(n)}${" ".repeat(r-node_util.stripVTControlCharacters(n).length)}${e__default.gray(a)}`).join(`
`);process.stdout.write(`${e__default.gray(a)}
${e__default.green(S)} ${e__default.reset(o)} ${e__default.gray(j.repeat(Math.max(r-i-1,1))+le)}
${c}
${e__default.gray(ce+j.repeat(r+2)+ue)}
`)},cancel=(t="")=>{process.stdout.write(`${e__default.gray(g)} ${e__default.red(t)}
`)},intro=(t="")=>{process.stdout.write(`${e__default.gray(ae)} ${t}
`)},outro=(t="")=>{process.stdout.write(`${e__default.gray(a)}
${e__default.gray(g)} ${t}
`)},log={message:(t="",{symbol:o=e__default.gray(a)}={})=>{const s=[`${e__default.gray(a)}`];if(t){const[i,...r]=t.split(`
`);s.push(`${o} ${i}`,...r.map(c=>`${e__default.gray(a)} ${c}`))}process.stdout.write(`${s.join(`
`)}
`)},info:t=>{log.message(t,{symbol:e__default.blue(B)})},success:t=>{log.message(t,{symbol:e__default.green(W)})},step:t=>{log.message(t,{symbol:e__default.green(S)})},warn:t=>{log.message(t,{symbol:e__default.yellow(H)})},warning:t=>{log.warn(t)},error:t=>{log.message(t,{symbol:e__default.red(q)})}},D=`${e__default.gray(a)} `,stream={message:async(t,{symbol:o=e__default.gray(a)}={})=>{process.stdout.write(`${e__default.gray(a)}
${o} `);let s=3;for await(let i of t){i=i.replace(/\n/g,`
${D}`),i.includes(`
`)&&(s=3+node_util.stripVTControlCharacters(i.slice(i.lastIndexOf(`
`))).length);const r=node_util.stripVTControlCharacters(i).length;s+r<process.stdout.columns?(s+=r,process.stdout.write(i)):(process.stdout.write(`
${D}${i.trimStart()}`),s=3+node_util.stripVTControlCharacters(i.trimStart()).length)}process.stdout.write(`
`)},info:t=>stream.message(t,{symbol:e__default.blue(B)}),success:t=>stream.message(t,{symbol:e__default.green(W)}),step:t=>stream.message(t,{symbol:e__default.green(S)}),warn:t=>stream.message(t,{symbol:e__default.yellow(H)}),warning:t=>stream.warn(t),error:t=>stream.message(t,{symbol:e__default.red(q)})},spinner=({indicator:t="dots"}={})=>{const o=P?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],s=P?80:120,i=process.env.CI==="true";let r,c,n=!1,l="",$,h=performance.now();const m=p=>{const d=p>1?"Something went wrong":"Canceled";n&&R(d,p)},y=()=>m(2),w=()=>m(1),x=()=>{process.on("uncaughtExceptionMonitor",y),process.on("unhandledRejection",y),process.on("SIGINT",w),process.on("SIGTERM",w),process.on("exit",m)},M=()=>{process.removeListener("uncaughtExceptionMonitor",y),process.removeListener("unhandledRejection",y),process.removeListener("SIGINT",w),process.removeListener("SIGTERM",w),process.removeListener("exit",m)},T=()=>{if($===void 0)return;i&&process.stdout.write(`
`);const p=$.split(`
`);process.stdout.write(sisteransi.cursor.move(-999,p.length-1)),process.stdout.write(sisteransi.erase.down(p.length))},I=p=>p.replace(/\.+$/,""),k=p=>{const d=(performance.now()-p)/1e3,v=Math.floor(d/60),f=Math.floor(d%60);return v>0?`[${v}m ${f}s]`:`[${f}s]`},O=(p="")=>{n=!0,r=core.block(),l=I(p),h=performance.now(),process.stdout.write(`${e__default.gray(a)}
`);let d=0,v=0;x(),c=setInterval(()=>{if(i&&l===$)return;T(),$=l;const f=e__default.magenta(o[d]);if(i)process.stdout.write(`${f} ${l}...`);else if(t==="timer")process.stdout.write(`${f} ${l} ${k(h)}`);else{const F=".".repeat(Math.floor(v)).slice(0,3);process.stdout.write(`${f} ${l}${F}`)}d=d+1<o.length?d+1:0,v=v<o.length?v+.125:0},s)},R=(p="",d=0)=>{n=!1,clearInterval(c),T();const v=d===0?e__default.green(S):d===1?e__default.red(G):e__default.red(L);l=I(p??l),t==="timer"?process.stdout.write(`${v} ${l} ${k(h)}
`):process.stdout.write(`${v} ${l}
`),M(),r()};return{start:O,stop:R,message:(p="")=>{l=I(p??l)}}},group=async(t,o)=>{const s={},i=Object.keys(t);for(const r of i){const c=t[r],n=await c({results:s})?.catch(l=>{throw l});if(typeof o?.onCancel=="function"&&core.isCancel(n)){s[r]="canceled",o.onCancel({results:s});continue}s[r]=n}return s},tasks=async t=>{for(const o of t){if(o.enabled===!1)continue;const s=spinner();s.start(o.title);const i=await o.task(s.message);s.stop(i||o.title)}};exports.isCancel=core.isCancel,exports.updateSettings=core.updateSettings,exports.cancel=cancel,exports.confirm=confirm,exports.group=group,exports.groupMultiselect=groupMultiselect,exports.intro=intro,exports.log=log,exports.multiselect=multiselect,exports.note=note,exports.outro=outro,exports.password=password,exports.select=select,exports.selectKey=selectKey,exports.spinner=spinner,exports.stream=stream,exports.tasks=tasks,exports.text=text;
//# sourceMappingURL=index.cjs.map

1
node_modules/@clack/prompts/dist/index.cjs.map generated vendored Normal file

File diff suppressed because one or more lines are too long

165
node_modules/@clack/prompts/dist/index.d.cts generated vendored Normal file
View File

@@ -0,0 +1,165 @@
export { ClackSettings, isCancel, updateSettings } from '@clack/core';
interface TextOptions {
message: string;
placeholder?: string;
defaultValue?: string;
initialValue?: string;
validate?: (value: string) => string | Error | undefined;
}
declare const text: (opts: TextOptions) => Promise<string | symbol>;
interface PasswordOptions {
message: string;
mask?: string;
validate?: (value: string) => string | Error | undefined;
}
declare const password: (opts: PasswordOptions) => Promise<string | symbol>;
interface ConfirmOptions {
message: string;
active?: string;
inactive?: string;
initialValue?: boolean;
}
declare const confirm: (opts: ConfirmOptions) => Promise<boolean | symbol>;
type Primitive = Readonly<string | boolean | number>;
type Option<Value> = Value extends Primitive ? {
/**
* Internal data for this option.
*/
value: Value;
/**
* The optional, user-facing text for this option.
*
* By default, the `value` is converted to a string.
*/
label?: string;
/**
* An optional hint to display to the user when
* this option might be selected.
*
* By default, no `hint` is displayed.
*/
hint?: string;
} : {
/**
* Internal data for this option.
*/
value: Value;
/**
* Required. The user-facing text for this option.
*/
label: string;
/**
* An optional hint to display to the user when
* this option might be selected.
*
* By default, no `hint` is displayed.
*/
hint?: string;
};
interface SelectOptions<Value> {
message: string;
options: Option<Value>[];
initialValue?: Value;
maxItems?: number;
}
declare const select: <Value>(opts: SelectOptions<Value>) => Promise<symbol | Value>;
declare const selectKey: <Value extends string>(opts: SelectOptions<Value>) => Promise<symbol | Value>;
interface MultiSelectOptions<Value> {
message: string;
options: Option<Value>[];
initialValues?: Value[];
maxItems?: number;
required?: boolean;
cursorAt?: Value;
}
declare const multiselect: <Value>(opts: MultiSelectOptions<Value>) => Promise<symbol | Value[]>;
interface GroupMultiSelectOptions<Value> {
message: string;
options: Record<string, Option<Value>[]>;
initialValues?: Value[];
required?: boolean;
cursorAt?: Value;
selectableGroups?: boolean;
}
declare const groupMultiselect: <Value>(opts: GroupMultiSelectOptions<Value>) => Promise<symbol | Value[]>;
declare const note: (message?: string, title?: string) => void;
declare const cancel: (message?: string) => void;
declare const intro: (title?: string) => void;
declare const outro: (message?: string) => void;
type LogMessageOptions = {
symbol?: string;
};
declare const log: {
message: (message?: string, { symbol }?: LogMessageOptions) => void;
info: (message: string) => void;
success: (message: string) => void;
step: (message: string) => void;
warn: (message: string) => void;
/** alias for `log.warn()`. */
warning: (message: string) => void;
error: (message: string) => void;
};
declare const stream: {
message: (iterable: Iterable<string> | AsyncIterable<string>, { symbol }?: LogMessageOptions) => Promise<void>;
info: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
success: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
step: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
warn: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
/** alias for `log.warn()`. */
warning: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
error: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
};
interface SpinnerOptions {
indicator?: 'dots' | 'timer';
}
declare const spinner: ({ indicator }?: SpinnerOptions) => {
start: (msg?: string) => void;
stop: (msg?: string, code?: number) => void;
message: (msg?: string) => void;
};
type PromptGroupAwaitedReturn<T> = {
[P in keyof T]: Exclude<Awaited<T[P]>, symbol>;
};
interface PromptGroupOptions<T> {
/**
* Control how the group can be canceled
* if one of the prompts is canceled.
*/
onCancel?: (opts: {
results: Prettify<Partial<PromptGroupAwaitedReturn<T>>>;
}) => void;
}
type Prettify<T> = {
[P in keyof T]: T[P];
} & {};
type PromptGroup<T> = {
[P in keyof T]: (opts: {
results: Prettify<Partial<PromptGroupAwaitedReturn<Omit<T, P>>>>;
}) => undefined | Promise<T[P] | undefined>;
};
/**
* Define a group of prompts to be displayed
* and return a results of objects within the group
*/
declare const group: <T>(prompts: PromptGroup<T>, opts?: PromptGroupOptions<T> | undefined) => Promise<{ [P in keyof PromptGroupAwaitedReturn<T>]: PromptGroupAwaitedReturn<T>[P]; }>;
type Task = {
/**
* Task title
*/
title: string;
/**
* Task function
*/
task: (message: (string: string) => void) => string | Promise<string> | void | Promise<void>;
/**
* If enabled === false the task will be skipped
*/
enabled?: boolean;
};
/**
* Define a group of tasks to be executed
*/
declare const tasks: (tasks: Task[]) => Promise<void>;
export { type ConfirmOptions, type GroupMultiSelectOptions, type LogMessageOptions, type MultiSelectOptions, type Option, type PasswordOptions, type PromptGroup, type PromptGroupAwaitedReturn, type PromptGroupOptions, type SelectOptions, type SpinnerOptions, type Task, type TextOptions, cancel, confirm, group, groupMultiselect, intro, log, multiselect, note, outro, password, select, selectKey, spinner, stream, tasks, text };

165
node_modules/@clack/prompts/dist/index.d.mts generated vendored Normal file
View File

@@ -0,0 +1,165 @@
export { ClackSettings, isCancel, updateSettings } from '@clack/core';
interface TextOptions {
message: string;
placeholder?: string;
defaultValue?: string;
initialValue?: string;
validate?: (value: string) => string | Error | undefined;
}
declare const text: (opts: TextOptions) => Promise<string | symbol>;
interface PasswordOptions {
message: string;
mask?: string;
validate?: (value: string) => string | Error | undefined;
}
declare const password: (opts: PasswordOptions) => Promise<string | symbol>;
interface ConfirmOptions {
message: string;
active?: string;
inactive?: string;
initialValue?: boolean;
}
declare const confirm: (opts: ConfirmOptions) => Promise<boolean | symbol>;
type Primitive = Readonly<string | boolean | number>;
type Option<Value> = Value extends Primitive ? {
/**
* Internal data for this option.
*/
value: Value;
/**
* The optional, user-facing text for this option.
*
* By default, the `value` is converted to a string.
*/
label?: string;
/**
* An optional hint to display to the user when
* this option might be selected.
*
* By default, no `hint` is displayed.
*/
hint?: string;
} : {
/**
* Internal data for this option.
*/
value: Value;
/**
* Required. The user-facing text for this option.
*/
label: string;
/**
* An optional hint to display to the user when
* this option might be selected.
*
* By default, no `hint` is displayed.
*/
hint?: string;
};
interface SelectOptions<Value> {
message: string;
options: Option<Value>[];
initialValue?: Value;
maxItems?: number;
}
declare const select: <Value>(opts: SelectOptions<Value>) => Promise<symbol | Value>;
declare const selectKey: <Value extends string>(opts: SelectOptions<Value>) => Promise<symbol | Value>;
interface MultiSelectOptions<Value> {
message: string;
options: Option<Value>[];
initialValues?: Value[];
maxItems?: number;
required?: boolean;
cursorAt?: Value;
}
declare const multiselect: <Value>(opts: MultiSelectOptions<Value>) => Promise<symbol | Value[]>;
interface GroupMultiSelectOptions<Value> {
message: string;
options: Record<string, Option<Value>[]>;
initialValues?: Value[];
required?: boolean;
cursorAt?: Value;
selectableGroups?: boolean;
}
declare const groupMultiselect: <Value>(opts: GroupMultiSelectOptions<Value>) => Promise<symbol | Value[]>;
declare const note: (message?: string, title?: string) => void;
declare const cancel: (message?: string) => void;
declare const intro: (title?: string) => void;
declare const outro: (message?: string) => void;
type LogMessageOptions = {
symbol?: string;
};
declare const log: {
message: (message?: string, { symbol }?: LogMessageOptions) => void;
info: (message: string) => void;
success: (message: string) => void;
step: (message: string) => void;
warn: (message: string) => void;
/** alias for `log.warn()`. */
warning: (message: string) => void;
error: (message: string) => void;
};
declare const stream: {
message: (iterable: Iterable<string> | AsyncIterable<string>, { symbol }?: LogMessageOptions) => Promise<void>;
info: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
success: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
step: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
warn: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
/** alias for `log.warn()`. */
warning: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
error: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
};
interface SpinnerOptions {
indicator?: 'dots' | 'timer';
}
declare const spinner: ({ indicator }?: SpinnerOptions) => {
start: (msg?: string) => void;
stop: (msg?: string, code?: number) => void;
message: (msg?: string) => void;
};
type PromptGroupAwaitedReturn<T> = {
[P in keyof T]: Exclude<Awaited<T[P]>, symbol>;
};
interface PromptGroupOptions<T> {
/**
* Control how the group can be canceled
* if one of the prompts is canceled.
*/
onCancel?: (opts: {
results: Prettify<Partial<PromptGroupAwaitedReturn<T>>>;
}) => void;
}
type Prettify<T> = {
[P in keyof T]: T[P];
} & {};
type PromptGroup<T> = {
[P in keyof T]: (opts: {
results: Prettify<Partial<PromptGroupAwaitedReturn<Omit<T, P>>>>;
}) => undefined | Promise<T[P] | undefined>;
};
/**
* Define a group of prompts to be displayed
* and return a results of objects within the group
*/
declare const group: <T>(prompts: PromptGroup<T>, opts?: PromptGroupOptions<T> | undefined) => Promise<{ [P in keyof PromptGroupAwaitedReturn<T>]: PromptGroupAwaitedReturn<T>[P]; }>;
type Task = {
/**
* Task title
*/
title: string;
/**
* Task function
*/
task: (message: (string: string) => void) => string | Promise<string> | void | Promise<void>;
/**
* If enabled === false the task will be skipped
*/
enabled?: boolean;
};
/**
* Define a group of tasks to be executed
*/
declare const tasks: (tasks: Task[]) => Promise<void>;
export { type ConfirmOptions, type GroupMultiSelectOptions, type LogMessageOptions, type MultiSelectOptions, type Option, type PasswordOptions, type PromptGroup, type PromptGroupAwaitedReturn, type PromptGroupOptions, type SelectOptions, type SpinnerOptions, type Task, type TextOptions, cancel, confirm, group, groupMultiselect, intro, log, multiselect, note, outro, password, select, selectKey, spinner, stream, tasks, text };

165
node_modules/@clack/prompts/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,165 @@
export { ClackSettings, isCancel, updateSettings } from '@clack/core';
interface TextOptions {
message: string;
placeholder?: string;
defaultValue?: string;
initialValue?: string;
validate?: (value: string) => string | Error | undefined;
}
declare const text: (opts: TextOptions) => Promise<string | symbol>;
interface PasswordOptions {
message: string;
mask?: string;
validate?: (value: string) => string | Error | undefined;
}
declare const password: (opts: PasswordOptions) => Promise<string | symbol>;
interface ConfirmOptions {
message: string;
active?: string;
inactive?: string;
initialValue?: boolean;
}
declare const confirm: (opts: ConfirmOptions) => Promise<boolean | symbol>;
type Primitive = Readonly<string | boolean | number>;
type Option<Value> = Value extends Primitive ? {
/**
* Internal data for this option.
*/
value: Value;
/**
* The optional, user-facing text for this option.
*
* By default, the `value` is converted to a string.
*/
label?: string;
/**
* An optional hint to display to the user when
* this option might be selected.
*
* By default, no `hint` is displayed.
*/
hint?: string;
} : {
/**
* Internal data for this option.
*/
value: Value;
/**
* Required. The user-facing text for this option.
*/
label: string;
/**
* An optional hint to display to the user when
* this option might be selected.
*
* By default, no `hint` is displayed.
*/
hint?: string;
};
interface SelectOptions<Value> {
message: string;
options: Option<Value>[];
initialValue?: Value;
maxItems?: number;
}
declare const select: <Value>(opts: SelectOptions<Value>) => Promise<symbol | Value>;
declare const selectKey: <Value extends string>(opts: SelectOptions<Value>) => Promise<symbol | Value>;
interface MultiSelectOptions<Value> {
message: string;
options: Option<Value>[];
initialValues?: Value[];
maxItems?: number;
required?: boolean;
cursorAt?: Value;
}
declare const multiselect: <Value>(opts: MultiSelectOptions<Value>) => Promise<symbol | Value[]>;
interface GroupMultiSelectOptions<Value> {
message: string;
options: Record<string, Option<Value>[]>;
initialValues?: Value[];
required?: boolean;
cursorAt?: Value;
selectableGroups?: boolean;
}
declare const groupMultiselect: <Value>(opts: GroupMultiSelectOptions<Value>) => Promise<symbol | Value[]>;
declare const note: (message?: string, title?: string) => void;
declare const cancel: (message?: string) => void;
declare const intro: (title?: string) => void;
declare const outro: (message?: string) => void;
type LogMessageOptions = {
symbol?: string;
};
declare const log: {
message: (message?: string, { symbol }?: LogMessageOptions) => void;
info: (message: string) => void;
success: (message: string) => void;
step: (message: string) => void;
warn: (message: string) => void;
/** alias for `log.warn()`. */
warning: (message: string) => void;
error: (message: string) => void;
};
declare const stream: {
message: (iterable: Iterable<string> | AsyncIterable<string>, { symbol }?: LogMessageOptions) => Promise<void>;
info: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
success: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
step: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
warn: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
/** alias for `log.warn()`. */
warning: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
error: (iterable: Iterable<string> | AsyncIterable<string>) => Promise<void>;
};
interface SpinnerOptions {
indicator?: 'dots' | 'timer';
}
declare const spinner: ({ indicator }?: SpinnerOptions) => {
start: (msg?: string) => void;
stop: (msg?: string, code?: number) => void;
message: (msg?: string) => void;
};
type PromptGroupAwaitedReturn<T> = {
[P in keyof T]: Exclude<Awaited<T[P]>, symbol>;
};
interface PromptGroupOptions<T> {
/**
* Control how the group can be canceled
* if one of the prompts is canceled.
*/
onCancel?: (opts: {
results: Prettify<Partial<PromptGroupAwaitedReturn<T>>>;
}) => void;
}
type Prettify<T> = {
[P in keyof T]: T[P];
} & {};
type PromptGroup<T> = {
[P in keyof T]: (opts: {
results: Prettify<Partial<PromptGroupAwaitedReturn<Omit<T, P>>>>;
}) => undefined | Promise<T[P] | undefined>;
};
/**
* Define a group of prompts to be displayed
* and return a results of objects within the group
*/
declare const group: <T>(prompts: PromptGroup<T>, opts?: PromptGroupOptions<T> | undefined) => Promise<{ [P in keyof PromptGroupAwaitedReturn<T>]: PromptGroupAwaitedReturn<T>[P]; }>;
type Task = {
/**
* Task title
*/
title: string;
/**
* Task function
*/
task: (message: (string: string) => void) => string | Promise<string> | void | Promise<void>;
/**
* If enabled === false the task will be skipped
*/
enabled?: boolean;
};
/**
* Define a group of tasks to be executed
*/
declare const tasks: (tasks: Task[]) => Promise<void>;
export { type ConfirmOptions, type GroupMultiSelectOptions, type LogMessageOptions, type MultiSelectOptions, type Option, type PasswordOptions, type PromptGroup, type PromptGroupAwaitedReturn, type PromptGroupOptions, type SelectOptions, type SpinnerOptions, type Task, type TextOptions, cancel, confirm, group, groupMultiselect, intro, log, multiselect, note, outro, password, select, selectKey, spinner, stream, tasks, text };

87
node_modules/@clack/prompts/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,87 @@
import{stripVTControlCharacters as S}from"node:util";import{TextPrompt as Q,PasswordPrompt as X,ConfirmPrompt as Z,SelectPrompt as ee,SelectKeyPrompt as te,MultiSelectPrompt as re,GroupMultiSelectPrompt as se,isCancel as ie,block as ne}from"@clack/core";export{isCancel,updateSettings}from"@clack/core";import y from"node:process";import e from"picocolors";import{cursor as oe,erase as ae}from"sisteransi";function ce(){return y.platform!=="win32"?y.env.TERM!=="linux":!!y.env.CI||!!y.env.WT_SESSION||!!y.env.TERMINUS_SUBLIME||y.env.ConEmuTask==="{cmd::Cmder}"||y.env.TERM_PROGRAM==="Terminus-Sublime"||y.env.TERM_PROGRAM==="vscode"||y.env.TERM==="xterm-256color"||y.env.TERM==="alacritty"||y.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const V=ce(),u=(t,n)=>V?t:n,le=u("\u25C6","*"),L=u("\u25A0","x"),W=u("\u25B2","x"),C=u("\u25C7","o"),ue=u("\u250C","T"),o=u("\u2502","|"),d=u("\u2514","\u2014"),k=u("\u25CF",">"),P=u("\u25CB"," "),A=u("\u25FB","[\u2022]"),T=u("\u25FC","[+]"),F=u("\u25FB","[ ]"),$e=u("\u25AA","\u2022"),_=u("\u2500","-"),me=u("\u256E","+"),de=u("\u251C","+"),pe=u("\u256F","+"),q=u("\u25CF","\u2022"),D=u("\u25C6","*"),U=u("\u25B2","!"),K=u("\u25A0","x"),b=t=>{switch(t){case"initial":case"active":return e.cyan(le);case"cancel":return e.red(L);case"error":return e.yellow(W);case"submit":return e.green(C)}},G=t=>{const{cursor:n,options:r,style:i}=t,s=t.maxItems??Number.POSITIVE_INFINITY,c=Math.max(process.stdout.rows-4,0),a=Math.min(c,Math.max(s,5));let l=0;n>=l+a-3?l=Math.max(Math.min(n-a+3,r.length-a),0):n<l+2&&(l=Math.max(n-2,0));const $=a<r.length&&l>0,g=a<r.length&&l+a<r.length;return r.slice(l,l+a).map((p,v,f)=>{const j=v===0&&$,E=v===f.length-1&&g;return j||E?e.dim("..."):i(p,v+l===n)})},he=t=>new Q({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){const n=`${e.gray(o)}
${b(this.state)} ${t.message}
`,r=t.placeholder?e.inverse(t.placeholder[0])+e.dim(t.placeholder.slice(1)):e.inverse(e.hidden("_")),i=this.value?this.valueWithCursor:r;switch(this.state){case"error":return`${n.trim()}
${e.yellow(o)} ${i}
${e.yellow(d)} ${e.yellow(this.error)}
`;case"submit":return`${n}${e.gray(o)} ${e.dim(this.value||t.placeholder)}`;case"cancel":return`${n}${e.gray(o)} ${e.strikethrough(e.dim(this.value??""))}${this.value?.trim()?`
${e.gray(o)}`:""}`;default:return`${n}${e.cyan(o)} ${i}
${e.cyan(d)}
`}}}).prompt(),ge=t=>new X({validate:t.validate,mask:t.mask??$e,render(){const n=`${e.gray(o)}
${b(this.state)} ${t.message}
`,r=this.valueWithCursor,i=this.masked;switch(this.state){case"error":return`${n.trim()}
${e.yellow(o)} ${i}
${e.yellow(d)} ${e.yellow(this.error)}
`;case"submit":return`${n}${e.gray(o)} ${e.dim(i)}`;case"cancel":return`${n}${e.gray(o)} ${e.strikethrough(e.dim(i??""))}${i?`
${e.gray(o)}`:""}`;default:return`${n}${e.cyan(o)} ${r}
${e.cyan(d)}
`}}}).prompt(),ye=t=>{const n=t.active??"Yes",r=t.inactive??"No";return new Z({active:n,inactive:r,initialValue:t.initialValue??!0,render(){const i=`${e.gray(o)}
${b(this.state)} ${t.message}
`,s=this.value?n:r;switch(this.state){case"submit":return`${i}${e.gray(o)} ${e.dim(s)}`;case"cancel":return`${i}${e.gray(o)} ${e.strikethrough(e.dim(s))}
${e.gray(o)}`;default:return`${i}${e.cyan(o)} ${this.value?`${e.green(k)} ${n}`:`${e.dim(P)} ${e.dim(n)}`} ${e.dim("/")} ${this.value?`${e.dim(P)} ${e.dim(r)}`:`${e.green(k)} ${r}`}
${e.cyan(d)}
`}}}).prompt()},ve=t=>{const n=(r,i)=>{const s=r.label??String(r.value);switch(i){case"selected":return`${e.dim(s)}`;case"active":return`${e.green(k)} ${s} ${r.hint?e.dim(`(${r.hint})`):""}`;case"cancelled":return`${e.strikethrough(e.dim(s))}`;default:return`${e.dim(P)} ${e.dim(s)}`}};return new ee({options:t.options,initialValue:t.initialValue,render(){const r=`${e.gray(o)}
${b(this.state)} ${t.message}
`;switch(this.state){case"submit":return`${r}${e.gray(o)} ${n(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${e.gray(o)} ${n(this.options[this.cursor],"cancelled")}
${e.gray(o)}`;default:return`${r}${e.cyan(o)} ${G({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(i,s)=>n(i,s?"active":"inactive")}).join(`
${e.cyan(o)} `)}
${e.cyan(d)}
`}}}).prompt()},we=t=>{const n=(r,i="inactive")=>{const s=r.label??String(r.value);return i==="selected"?`${e.dim(s)}`:i==="cancelled"?`${e.strikethrough(e.dim(s))}`:i==="active"?`${e.bgCyan(e.gray(` ${r.value} `))} ${s} ${r.hint?e.dim(`(${r.hint})`):""}`:`${e.gray(e.bgWhite(e.inverse(` ${r.value} `)))} ${s} ${r.hint?e.dim(`(${r.hint})`):""}`};return new te({options:t.options,initialValue:t.initialValue,render(){const r=`${e.gray(o)}
${b(this.state)} ${t.message}
`;switch(this.state){case"submit":return`${r}${e.gray(o)} ${n(this.options.find(i=>i.value===this.value)??t.options[0],"selected")}`;case"cancel":return`${r}${e.gray(o)} ${n(this.options[0],"cancelled")}
${e.gray(o)}`;default:return`${r}${e.cyan(o)} ${this.options.map((i,s)=>n(i,s===this.cursor?"active":"inactive")).join(`
${e.cyan(o)} `)}
${e.cyan(d)}
`}}}).prompt()},fe=t=>{const n=(r,i)=>{const s=r.label??String(r.value);return i==="active"?`${e.cyan(A)} ${s} ${r.hint?e.dim(`(${r.hint})`):""}`:i==="selected"?`${e.green(T)} ${e.dim(s)} ${r.hint?e.dim(`(${r.hint})`):""}`:i==="cancelled"?`${e.strikethrough(e.dim(s))}`:i==="active-selected"?`${e.green(T)} ${s} ${r.hint?e.dim(`(${r.hint})`):""}`:i==="submitted"?`${e.dim(s)}`:`${e.dim(F)} ${e.dim(s)}`};return new re({options:t.options,initialValues:t.initialValues,required:t.required??!0,cursorAt:t.cursorAt,validate(r){if(this.required&&r.length===0)return`Please select at least one option.
${e.reset(e.dim(`Press ${e.gray(e.bgWhite(e.inverse(" space ")))} to select, ${e.gray(e.bgWhite(e.inverse(" enter ")))} to submit`))}`},render(){const r=`${e.gray(o)}
${b(this.state)} ${t.message}
`,i=(s,c)=>{const a=this.value.includes(s.value);return c&&a?n(s,"active-selected"):a?n(s,"selected"):n(s,c?"active":"inactive")};switch(this.state){case"submit":return`${r}${e.gray(o)} ${this.options.filter(({value:s})=>this.value.includes(s)).map(s=>n(s,"submitted")).join(e.dim(", "))||e.dim("none")}`;case"cancel":{const s=this.options.filter(({value:c})=>this.value.includes(c)).map(c=>n(c,"cancelled")).join(e.dim(", "));return`${r}${e.gray(o)} ${s.trim()?`${s}
${e.gray(o)}`:""}`}case"error":{const s=this.error.split(`
`).map((c,a)=>a===0?`${e.yellow(d)} ${e.yellow(c)}`:` ${c}`).join(`
`);return`${r+e.yellow(o)} ${G({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:i}).join(`
${e.yellow(o)} `)}
${s}
`}default:return`${r}${e.cyan(o)} ${G({options:this.options,cursor:this.cursor,maxItems:t.maxItems,style:i}).join(`
${e.cyan(o)} `)}
${e.cyan(d)}
`}}}).prompt()},be=t=>{const{selectableGroups:n=!0}=t,r=(i,s,c=[])=>{const a=i.label??String(i.value),l=typeof i.group=="string",$=l&&(c[c.indexOf(i)+1]??{group:!0}),g=l&&$.group===!0,p=l?n?`${g?d:o} `:" ":"";if(s==="active")return`${e.dim(p)}${e.cyan(A)} ${a} ${i.hint?e.dim(`(${i.hint})`):""}`;if(s==="group-active")return`${p}${e.cyan(A)} ${e.dim(a)}`;if(s==="group-active-selected")return`${p}${e.green(T)} ${e.dim(a)}`;if(s==="selected"){const f=l||n?e.green(T):"";return`${e.dim(p)}${f} ${e.dim(a)} ${i.hint?e.dim(`(${i.hint})`):""}`}if(s==="cancelled")return`${e.strikethrough(e.dim(a))}`;if(s==="active-selected")return`${e.dim(p)}${e.green(T)} ${a} ${i.hint?e.dim(`(${i.hint})`):""}`;if(s==="submitted")return`${e.dim(a)}`;const v=l||n?e.dim(F):"";return`${e.dim(p)}${v} ${e.dim(a)}`};return new se({options:t.options,initialValues:t.initialValues,required:t.required??!0,cursorAt:t.cursorAt,selectableGroups:n,validate(i){if(this.required&&i.length===0)return`Please select at least one option.
${e.reset(e.dim(`Press ${e.gray(e.bgWhite(e.inverse(" space ")))} to select, ${e.gray(e.bgWhite(e.inverse(" enter ")))} to submit`))}`},render(){const i=`${e.gray(o)}
${b(this.state)} ${t.message}
`;switch(this.state){case"submit":return`${i}${e.gray(o)} ${this.options.filter(({value:s})=>this.value.includes(s)).map(s=>r(s,"submitted")).join(e.dim(", "))}`;case"cancel":{const s=this.options.filter(({value:c})=>this.value.includes(c)).map(c=>r(c,"cancelled")).join(e.dim(", "));return`${i}${e.gray(o)} ${s.trim()?`${s}
${e.gray(o)}`:""}`}case"error":{const s=this.error.split(`
`).map((c,a)=>a===0?`${e.yellow(d)} ${e.yellow(c)}`:` ${c}`).join(`
`);return`${i}${e.yellow(o)} ${this.options.map((c,a,l)=>{const $=this.value.includes(c.value)||c.group===!0&&this.isGroupSelected(`${c.value}`),g=a===this.cursor;return!g&&typeof c.group=="string"&&this.options[this.cursor].value===c.group?r(c,$?"group-active-selected":"group-active",l):g&&$?r(c,"active-selected",l):$?r(c,"selected",l):r(c,g?"active":"inactive",l)}).join(`
${e.yellow(o)} `)}
${s}
`}default:return`${i}${e.cyan(o)} ${this.options.map((s,c,a)=>{const l=this.value.includes(s.value)||s.group===!0&&this.isGroupSelected(`${s.value}`),$=c===this.cursor;return!$&&typeof s.group=="string"&&this.options[this.cursor].value===s.group?r(s,l?"group-active-selected":"group-active",a):$&&l?r(s,"active-selected",a):l?r(s,"selected",a):r(s,$?"active":"inactive",a)}).join(`
${e.cyan(o)} `)}
${e.cyan(d)}
`}}}).prompt()},Me=(t="",n="")=>{const r=`
${t}
`.split(`
`),i=S(n).length,s=Math.max(r.reduce((a,l)=>{const $=S(l);return $.length>a?$.length:a},0),i)+2,c=r.map(a=>`${e.gray(o)} ${e.dim(a)}${" ".repeat(s-S(a).length)}${e.gray(o)}`).join(`
`);process.stdout.write(`${e.gray(o)}
${e.green(C)} ${e.reset(n)} ${e.gray(_.repeat(Math.max(s-i-1,1))+me)}
${c}
${e.gray(de+_.repeat(s+2)+pe)}
`)},xe=(t="")=>{process.stdout.write(`${e.gray(d)} ${e.red(t)}
`)},Ie=(t="")=>{process.stdout.write(`${e.gray(ue)} ${t}
`)},Se=(t="")=>{process.stdout.write(`${e.gray(o)}
${e.gray(d)} ${t}
`)},M={message:(t="",{symbol:n=e.gray(o)}={})=>{const r=[`${e.gray(o)}`];if(t){const[i,...s]=t.split(`
`);r.push(`${n} ${i}`,...s.map(c=>`${e.gray(o)} ${c}`))}process.stdout.write(`${r.join(`
`)}
`)},info:t=>{M.message(t,{symbol:e.blue(q)})},success:t=>{M.message(t,{symbol:e.green(D)})},step:t=>{M.message(t,{symbol:e.green(C)})},warn:t=>{M.message(t,{symbol:e.yellow(U)})},warning:t=>{M.warn(t)},error:t=>{M.message(t,{symbol:e.red(K)})}},J=`${e.gray(o)} `,x={message:async(t,{symbol:n=e.gray(o)}={})=>{process.stdout.write(`${e.gray(o)}
${n} `);let r=3;for await(let i of t){i=i.replace(/\n/g,`
${J}`),i.includes(`
`)&&(r=3+S(i.slice(i.lastIndexOf(`
`))).length);const s=S(i).length;r+s<process.stdout.columns?(r+=s,process.stdout.write(i)):(process.stdout.write(`
${J}${i.trimStart()}`),r=3+S(i.trimStart()).length)}process.stdout.write(`
`)},info:t=>x.message(t,{symbol:e.blue(q)}),success:t=>x.message(t,{symbol:e.green(D)}),step:t=>x.message(t,{symbol:e.green(C)}),warn:t=>x.message(t,{symbol:e.yellow(U)}),warning:t=>x.warn(t),error:t=>x.message(t,{symbol:e.red(K)})},Y=({indicator:t="dots"}={})=>{const n=V?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=V?80:120,i=process.env.CI==="true";let s,c,a=!1,l="",$,g=performance.now();const p=m=>{const h=m>1?"Something went wrong":"Canceled";a&&N(h,m)},v=()=>p(2),f=()=>p(1),j=()=>{process.on("uncaughtExceptionMonitor",v),process.on("unhandledRejection",v),process.on("SIGINT",f),process.on("SIGTERM",f),process.on("exit",p)},E=()=>{process.removeListener("uncaughtExceptionMonitor",v),process.removeListener("unhandledRejection",v),process.removeListener("SIGINT",f),process.removeListener("SIGTERM",f),process.removeListener("exit",p)},B=()=>{if($===void 0)return;i&&process.stdout.write(`
`);const m=$.split(`
`);process.stdout.write(oe.move(-999,m.length-1)),process.stdout.write(ae.down(m.length))},R=m=>m.replace(/\.+$/,""),O=m=>{const h=(performance.now()-m)/1e3,w=Math.floor(h/60),I=Math.floor(h%60);return w>0?`[${w}m ${I}s]`:`[${I}s]`},H=(m="")=>{a=!0,s=ne(),l=R(m),g=performance.now(),process.stdout.write(`${e.gray(o)}
`);let h=0,w=0;j(),c=setInterval(()=>{if(i&&l===$)return;B(),$=l;const I=e.magenta(n[h]);if(i)process.stdout.write(`${I} ${l}...`);else if(t==="timer")process.stdout.write(`${I} ${l} ${O(g)}`);else{const z=".".repeat(Math.floor(w)).slice(0,3);process.stdout.write(`${I} ${l}${z}`)}h=h+1<n.length?h+1:0,w=w<n.length?w+.125:0},r)},N=(m="",h=0)=>{a=!1,clearInterval(c),B();const w=h===0?e.green(C):h===1?e.red(L):e.red(W);l=R(m??l),t==="timer"?process.stdout.write(`${w} ${l} ${O(g)}
`):process.stdout.write(`${w} ${l}
`),E(),s()};return{start:H,stop:N,message:(m="")=>{l=R(m??l)}}},Ce=async(t,n)=>{const r={},i=Object.keys(t);for(const s of i){const c=t[s],a=await c({results:r})?.catch(l=>{throw l});if(typeof n?.onCancel=="function"&&ie(a)){r[s]="canceled",n.onCancel({results:r});continue}r[s]=a}return r},Te=async t=>{for(const n of t){if(n.enabled===!1)continue;const r=Y();r.start(n.title);const i=await n.task(r.message);r.stop(i||n.title)}};export{xe as cancel,ye as confirm,Ce as group,be as groupMultiselect,Ie as intro,M as log,fe as multiselect,Me as note,Se as outro,ge as password,ve as select,we as selectKey,Y as spinner,x as stream,Te as tasks,he as text};
//# sourceMappingURL=index.mjs.map

1
node_modules/@clack/prompts/dist/index.mjs.map generated vendored Normal file

File diff suppressed because one or more lines are too long