pickier 0.1.65 → 0.1.67
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/bin/cli.js +2 -2
- package/dist/chunk-13r0v0m9.js +226 -0
- package/dist/chunk-bxyt25b3.js +2 -0
- package/dist/chunk-by60fzz0.js +92 -0
- package/dist/chunk-p0j2ra3t.js +31 -0
- package/dist/chunk-rtzfbwtn.js +2 -0
- package/dist/chunk-tvt73e07.js +2 -0
- package/dist/chunk-xf6t6ene.js +2 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/lexer.d.ts +44 -0
- package/dist/src/linter.d.ts +9 -0
- package/dist/src/rules/general/_template-tracking.d.ts +5 -18
- package/dist/src/rules/general/no-unused-vars.d.ts +12 -0
- package/dist/src/rules/ts/no-top-level-await.d.ts +7 -1
- package/package.json +1 -1
- package/dist/chunk-awmb5sg5.js +0 -3
- package/dist/chunk-bnbsk67m.js +0 -2
- package/dist/chunk-gy6wyx8t.js +0 -62
- package/dist/chunk-hwa8gmzb.js +0 -156
- package/dist/chunk-qh9cawym.js +0 -2
- package/dist/chunk-sj3ctzyt.js +0 -3
- package/dist/chunk-tskywgx9.js +0 -226
- package/dist/chunk-vdbbvx8x.js +0 -33
- package/dist/chunk-wh52kdr1.js +0 -2
- package/dist/chunk-z7exyj5z.js +0 -2
package/dist/chunk-hwa8gmzb.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import"./chunk-awmb5sg5.js";import{existsSync as It}from"fs";import de from"fs/promises";import ke from"os";import fe from"path";import G from"process";import{EventEmitter as Ot}from"events";import P from"process";import Ve from"process";import we from"process";import ae from"process";import Ne from"process";import Z from"process";import Re from"tty";import rt,{stdin as hs,stdout as ms}from"process";import*as U from"readline";import{ReadStream as je,WriteStream as ds}from"tty";import Le,{stdin as ys,stdout as bs}from"process";import xs from"readline";import Es from"process";import Rs from"process";import{WriteStream as js}from"tty";import Ws from"process";import Te from"process";import Fs from"process";import{stripVTControlCharacters as ge}from"util";import{existsSync as Us,lstatSync as Fe,readdirSync as Gs}from"fs";import{dirname as He,join as Ks}from"path";import qs from"process";import A from"process";import ee from"process";import{stripVTControlCharacters as $e}from"util";import Ys from"process";import{Buffer as Ke}from"buffer";import j from"fs/promises";import Js from"os";import le from"path";import x from"process";import{Readable as Qs,Writable as Xs}from"stream";class qe{configPath;config=null;events=[];retryCount=0;maxRetries=3;retryDelayMs=1000;constructor(){let e=ke.homedir(),t=fe.join(e,".config","clapp");this.configPath=fe.join(t,"telemetry.json")}async isEnabled(){if(G.env.DO_NOT_TRACK==="1"||G.env.DO_NOT_TRACK==="true")return!1;if(G.env.NO_TELEMETRY==="1"||G.env.NO_TELEMETRY==="true")return!1;return(await this.loadConfig()).enabled}async enable(){let e=await this.loadConfig();if(e.enabled=!0,!e.userId)e.userId=this.generateUserId();await this.saveConfig(e)}async disable(){let e=await this.loadConfig();e.enabled=!1,await this.saveConfig(e)}async track(e,t){if(!await this.isEnabled())return;let i={event:e,...t,timestamp:Date.now(),platform:ke.platform(),nodeVersion:G.version};if(this.events.push(i),this.events.length>=10)await this.send()}async trackCommand(e,t){await this.track("command",{command:e,duration:t})}async trackError(e,t){await this.track("error",{error:e,command:t})}async send(){if(!await this.isEnabled()||this.events.length===0)return!0;try{this.events=[],this.retryCount=0;let t=await this.loadConfig();return t.lastSent=Date.now(),await this.saveConfig(t),!0}catch{if(this.retryCount<this.maxRetries){this.retryCount++;let t=this.retryDelayMs*2**(this.retryCount-1);return await this.sleep(t),this.send()}return this.events=[],this.retryCount=0,!1}}async flush(){if(this.events.length===0)return!0;return this.send()}sleep(e){return new Promise((t)=>setTimeout(t,e))}async status(){let e=await this.loadConfig();return{enabled:e.enabled,doNotTrack:G.env.DO_NOT_TRACK==="1"||G.env.DO_NOT_TRACK==="true",eventsQueued:this.events.length,lastSent:e.lastSent}}async loadConfig(){if(this.config)return this.config;try{if(It(this.configPath)){let e=await de.readFile(this.configPath,"utf-8");return this.config=JSON.parse(e),this.config}}catch{}return this.config={enabled:!1},this.config}async saveConfig(e){this.config=e;try{let t=fe.dirname(this.configPath);await de.mkdir(t,{recursive:!0}),await de.writeFile(this.configPath,JSON.stringify(e,null,2),"utf-8")}catch{}}generateUserId(){let e=Math.random().toString(36).substring(2,15),t=Date.now().toString(36);return`${e}-${t}`}}var oi=new qe;function Et(e,t={}){let s={_:[]},i=t.alias||{},r=new Set(t.boolean||[]),o={};for(let u of Object.keys(i))for(let a of i[u])o[a]=u;for(let u of r)if(i[u])for(let a of i[u])r.add(a);function l(u,a){let c=o[u]||u;if(s[c]=a,i[c])for(let h of i[c])s[h]=a;if(o[u]&&i[o[u]])for(let h of i[o[u]])s[h]=a;s[u]=a}for(let u=0;u<e.length;u++){let a=e[u];if(a==="--"){s._.push(...e.slice(u+1));break}if(a.startsWith("--")){let c=a.indexOf("=");if(c!==-1){let h=a.slice(2,c),f=a.slice(c+1);l(h,f)}else{let h=a.slice(2);if(h.startsWith("no-")){let p=h.slice(3);l(p,!1);continue}let f=o[h]||h;if(r.has(f)||r.has(h))l(h,!0);else{let p=e[u+1];if(p!==void 0&&!p.startsWith("-"))l(h,p),u++;else l(h,!0)}}}else if(a.startsWith("-")&&a.length>1){let c=a.slice(1);for(let h=0;h<c.length;h++){let f=c[h],p=o[f]||f;if(h===c.length-1&&!r.has(p)&&!r.has(f)){let d=e[u+1];if(d!==void 0&&!d.startsWith("-"))l(f,d),u++;else l(f,!0)}else l(f,!0)}}else s._.push(a)}return s}function ve(e){return e.replace(/[<[].+/,"").trim()}function Bt(e){let t=/<([^>]+)>/g,s=/\[([^\]]+)\]/g,i=[],r=(u)=>{let a=!1,c=u[1];if(c.startsWith("..."))c=c.slice(3),a=!0;return{required:u[0].startsWith("<"),value:c,variadic:a}},o;while(o=t.exec(e))i.push(r(o));let l;while(l=s.exec(e))i.push(r(l));return i}function Tt(e){let t={alias:{},boolean:[]};for(let[s,i]of e.entries()){if(i.names.length>1)t.alias[i.names[0]]=i.names.slice(1);if(i.isBoolean)if(i.negated){if(!e.some((o,l)=>l!==s&&o.names.some((u)=>i.names.includes(u))&&typeof o.required==="boolean"))t.boolean.push(i.names[0])}else t.boolean.push(i.names[0])}return t}function Me(e){return e.reduce((t,s)=>t.length>=s.length?t:s,"")}function pe(e,t){return e.length>=t?e:`${e}${" ".repeat(t-e.length)}`}function kt(e){return e.replace(/([a-z])-([a-z])/g,(t,s,i)=>s+i.toUpperCase())}function Vt(e,t,s){let i=0,r=t.length,o=e,l;for(;i<r;++i)l=o[t[i]],o=o[t[i]]=i===r-1?s:l!=null?l:!!~t[i+1].indexOf(".")||!(+t[i+1]>-1)?{}:[]}function Mt(e,t){for(let s of Object.keys(t)){let i=t[s];if(i.shouldTransform){if(e[s]=Array.prototype.concat.call([],e[s]),typeof i.transformFunction==="function")e[s]=e[s].map(i.transformFunction)}}}function At(e){let t=/([^\\/]+)$/.exec(e);return t?t[1]:""}function ze(e){return e.split(".").map((t,s)=>s===0?kt(t):t).join(".")}class oe extends Error{exitCode=2;isUsageError=!0;constructor(e){super(e);if(this.name=this.constructor.name,typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,this.constructor);else this.stack=Error(e).stack}format(e=!1){if(e&&this.stack)return`${this.message}
|
|
3
|
-
|
|
4
|
-
Stack trace:
|
|
5
|
-
${this.stack}`;return this.message}}function Nt(){let{env:e}=Ve,{TERM:t,TERM_PROGRAM:s}=e;if(Ve.platform!=="win32")return t!=="linux";return Boolean(e.WT_SESSION)||Boolean(e.TERMINUS_SUBLIME)||e.ConEmuTask==="{cmd::Cmder}"||s==="Terminus-Sublime"||s==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var ue="\x1B",S=`${ue}[`,ci="\x07",k={to(e,t){if(!t)return`${S}${e+1}G`;return`${S}${t+1};${e+1}H`},move(e,t){let s="";if(e<0)s+=`${S}${-e}D`;else if(e>0)s+=`${S}${e}C`;if(t<0)s+=`${S}${-t}A`;else if(t>0)s+=`${S}${t}B`;return s},up:(e=1)=>`${S}${e}A`,down:(e=1)=>`${S}${e}B`,forward:(e=1)=>`${S}${e}C`,backward:(e=1)=>`${S}${e}D`,nextLine:(e=1)=>`${S}E`.repeat(e),prevLine:(e=1)=>`${S}F`.repeat(e),left:`${S}G`,hide:`${S}?25l`,show:`${S}?25h`,save:`${ue}7`,restore:`${ue}8`},hi={up:(e=1)=>`${S}S`.repeat(e),down:(e=1)=>`${S}T`.repeat(e)},te={screen:`${S}2J`,up:(e=1)=>`${S}1J`.repeat(e),down:(e=1)=>`${S}J`.repeat(e),line:`${S}2K`,lineEnd:`${S}K`,lineStart:`${S}1K`,lines(e){let t="";for(let s=0;s<e;s++)t+=this.line+(s<e-1?k.up():"");if(e)t+=k.left;return t}},mi={screen:`${ue}c`};function Rt(e,t){let s=[];for(let i=0;i<=t.length;i++)s[i]=[i];for(let i=0;i<=e.length;i++)s[0][i]=i;for(let i=1;i<=t.length;i++)for(let r=1;r<=e.length;r++)if(t.charAt(i-1)===e.charAt(r-1))s[i][r]=s[i-1][r-1];else s[i][r]=Math.min(s[i-1][r-1]+1,s[i][r-1]+1,s[i-1][r]+1);return s[t.length][e.length]}function Ye(e,t,s=2,i=3){return t.map((r)=>({cmd:r,distance:Rt(e,r)})).filter(({distance:r})=>r<=s).sort((r,o)=>r.distance-o.distance).slice(0,i).map(({cmd:r})=>r)}class Je{rawName;description;name;names;isBoolean;required;config;negated;constructor(e,t,s){if(this.rawName=e,this.description=t,this.config=Object.assign({},s),e=e.replace(/\.\*/g,""),this.negated=!1,this.names=ve(e).split(",").map((i)=>{let r=i.trim().replace(/^-{1,2}/,"");if(r.startsWith("no-"))this.negated=!0,r=r.replace(/^no-/,"");return ze(r)}).sort((i,r)=>i.length>r.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null)this.config.default=!0;if(e.includes("<"))this.required=!0;else if(e.includes("["))this.required=!1;else this.isBoolean=!0}}var fi=we.argv,jt=`${we.platform}-${we.arch} bun-v${typeof Bun<"u"?Bun.version:"unknown"}`,Ae=ae.argv,Lt=`${ae.platform}-${ae.arch} node-${ae.version}`;class _e{rawName;description;config;cli;options;aliasNames;name;namespace;args;commandAction;usageText;versionNumber;examples;helpCallback;globalCommand;beforeHooks;afterHooks;middleware;constructor(e,t,s,i){this.rawName=e,this.description=t,this.config=s,this.cli=i,this.options=[],this.aliasNames=[],this.name=ve(e);let r=ve(e),o=r.indexOf(":");if(o>0)this.namespace=r.substring(0,o),this.name=r.substring(o+1);if(this.args=Bt(e),this.examples=[],this.beforeHooks=[],this.afterHooks=[],this.middleware=[],!s)this.config={}}usage(e){return this.usageText=e,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(e,t="-v, --version"){return this.versionNumber=e,this.option(t,"Display version number"),this}example(e){return this.examples.push(e),this}option(e,t,s){let i=new Je(e,t,s);return this.options.push(i),this}alias(e){return this.aliasNames.push(e),this}action(e){return this.commandAction=e,this}before(e){return this.beforeHooks.push(e),this}after(e){return this.afterHooks.push(e),this}use(e){return this.middleware.push(e),this}isMatched(e){if(this.aliasNames.includes(e))return!0;if(this.namespace)return`${this.namespace}:${this.name}`===e;return this.name===e}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof Ie}get displayName(){return this.namespace?`${this.namespace}:${this.name}`:this.name}hasOption(e){return e=e.split(".")[0],!!this.options.find((t)=>t.names.includes(e))}outputHelp(){let{name:e,commands:t}=this.cli,{versionNumber:s,options:i,helpCallback:r}=this.cli.globalCommand,o=[{body:`${e}${s?`/${s}`:""}`}];if(o.push({title:"Usage",body:` $ ${e} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&t.length>0){let a=Me(t.map((d)=>d.rawName)),c=new Map,h=[];for(let d of t)if(d.namespace){if(!c.has(d.namespace))c.set(d.namespace,[]);c.get(d.namespace).push(d)}else h.push(d);let f="";if(h.length>0)f+=h.map((d)=>` ${pe(d.rawName,a.length)} ${d.description}`).join(`
|
|
6
|
-
`);let p=Array.from(c.keys()).sort();for(let d of p){let v=c.get(d);if(f.length>0)f+=`
|
|
7
|
-
|
|
8
|
-
`;f+=` ${d}:
|
|
9
|
-
`,f+=v.map((y)=>` ${pe(y.rawName,a.length-2)} ${y.description}`).join(`
|
|
10
|
-
`)}o.push({title:"Commands",body:f}),o.push({title:"For more info, run any command with the `--help` flag",body:t.map((d)=>` $ ${e}${d.displayName===""?"":` ${d.displayName}`} --help`).join(`
|
|
11
|
-
`)})}let u=this.isGlobalCommand?i:[...this.options,...i||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand)u=u.filter((a)=>a.name!=="version");if(u.length>0){let a=Me(u.map((c)=>c.rawName));o.push({title:"Options",body:u.map((c)=>` ${pe(c.rawName,a.length)} ${c.description} ${c.config.default===void 0?"":`(default: ${c.config.default})`}`).join(`
|
|
12
|
-
`)})}if(this.examples.length>0)o.push({title:"Examples",body:this.examples.map((a)=>{if(typeof a==="function")return a(e);return a}).join(`
|
|
13
|
-
`)});if(r)o=r(o)||o;console.log(o.map((a)=>a.title?`${a.title}:
|
|
14
|
-
${a.body}`:a.body).join(`
|
|
15
|
-
|
|
16
|
-
`))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;if(t)console.log(`${e}/${t} ${typeof Bun<"u"?jt:Lt}`)}checkRequiredArgs(){let e=this.args.filter((t)=>t.required).length;if(this.cli.args.length<e){let s=this.args.filter((r)=>r.required).slice(this.cli.args.length),i=s.map((r)=>`<${r.value}>`).join(" ");throw new oe(`Missing required argument${s.length>1?"s":""}: ${i}
|
|
17
|
-
|
|
18
|
-
Run \`${this.cli.name} ${this.rawName} --help\` for usage information.`)}}checkUnknownOptions(){let{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions){for(let s of Object.keys(e))if(s!=="--"&&!this.hasOption(s)&&!t.hasOption(s)){let r=[...t.options,...this.options].flatMap((a)=>a.names),o=s.length>1?`--${s}`:`-${s}`,l=Ye(s,r),u=`Unknown option \`${o}\``;if(l.length>0)u+=`
|
|
19
|
-
|
|
20
|
-
Did you mean one of these?`,l.forEach((a)=>{let c=a.length>1?`--${a}`:`-${a}`;u+=`
|
|
21
|
-
\u2022 ${c}`});throw u+=`
|
|
22
|
-
|
|
23
|
-
Run \`${this.cli.name} ${this.rawName} --help\` to see available options.`,new oe(u)}}}checkOptionValue(){let{options:e,globalCommand:t}=this.cli,s=[...t.options,...this.options];for(let i of s){let r=e[i.name.split(".")[0]];if(i.required){let o=s.some((l)=>l.negated&&l.names.includes(i.name));if(r===!0||r===!1&&!o)throw new oe(`Option \`${i.rawName}\` requires a value.
|
|
24
|
-
|
|
25
|
-
Example: ${this.cli.name} ${this.rawName} ${i.rawName} <value>`)}}}}class Ie extends _e{constructor(e){super("@@global@@","",{},e)}}var Dt=_e,F={red:["\x1B[31m","\x1B[39m"],green:["\x1B[32m","\x1B[39m"],blue:["\x1B[34m","\x1B[39m"],yellow:["\x1B[33m","\x1B[39m"],cyan:["\x1B[36m","\x1B[39m"],magenta:["\x1B[35m","\x1B[39m"],white:["\x1B[37m","\x1B[39m"],gray:["\x1B[90m","\x1B[39m"],bgRed:["\x1B[41m","\x1B[49m"],bgGreen:["\x1B[42m","\x1B[49m"],bgBlue:["\x1B[44m","\x1B[49m"],bgYellow:["\x1B[43m","\x1B[49m"],bgCyan:["\x1B[46m","\x1B[49m"],bgMagenta:["\x1B[45m","\x1B[49m"],bold:["\x1B[1m","\x1B[22m"],italic:["\x1B[3m","\x1B[23m"],underline:["\x1B[4m","\x1B[24m"],dim:["\x1B[2m","\x1B[22m"],inverse:["\x1B[7m","\x1B[27m"],hidden:["\x1B[8m","\x1B[28m"],strikethrough:["\x1B[9m","\x1B[29m"]},ye={default:{primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"},dracula:{primary:"magenta",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"blue",muted:"gray"},nord:{primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"cyan",muted:"gray"},solarized:{primary:"cyan",secondary:"blue",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"},monokai:{primary:"magenta",secondary:"blue",success:"green",warning:"yellow",error:"red",info:"cyan",muted:"gray"}},J={primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"};function Wt(){return!0}function Pt(){let e={};e.supportsColor=Wt();function t(i,r=[]){let o=i===""?[]:[...r,i],l=function(a){if(!e.supportsColor)return a;let c="",h="";for(let f of o)if(f in J&&J[f]in F){let p=J[f];c+=F[p][0],h=F[p][1]+h}else if(f in F)c+=F[f][0],h=F[f][1]+h;return c+a+h},u=[...Object.keys(F),...Object.keys(J)];for(let a of u)if(!(a in l))Object.defineProperty(l,a,{get(){return t(a,o)}});return l}let s=[...Object.keys(F),...Object.keys(J)];for(let i of s)if(!(i in e))Object.defineProperty(e,i,{get(){return t(i)}});return e}var K=Pt();function Ft(e){for(let t in e)if(e[t]!==void 0)J[t]=e[t]}function gi(e){if(e in ye)Ft(ye[e])}function $i(){return Object.keys(ye)}function vi(e){if(e.colors!==void 0)K.supportsColor=e.colors}function wi(e,t){let s=t?.title?` ${t.title} `:"",i=t?.padding||0,r=" ".repeat(i),o=e.split(`
|
|
26
|
-
`),u=Math.max(...o.map((c)=>c.length))+i*2,a=u;console.log(`\u250C${s?"\u2500".repeat(Math.floor((a-s.length)/2))+s+"\u2500".repeat(Math.ceil((a-s.length)/2)):"\u2500".repeat(a)}\u2510`),console.log(`\u2502${" ".repeat(a)}\u2502`);for(let c of o){let h=u-c.length-i;console.log(`\u2502${r}${c}${" ".repeat(h)}\u2502`)}console.log(`\u2502${" ".repeat(a)}\u2502`),console.log(`\u2514${"\u2500".repeat(a)}\u2518`)}function yi(e){let t=e?.title?` ${e.title} `:"",i=e.content.split(`
|
|
27
|
-
`),o=Math.max(...i.map((l)=>l.length))+2;console.log(`\u2554${t?"\u2550".repeat(Math.floor((o-t.length)/2))+t+"\u2550".repeat(Math.ceil((o-t.length)/2)):"\u2550".repeat(o)}\u2557`),console.log(`\u2551${" ".repeat(o)}\u2551`);for(let l of i){let u=o-l.length-1;console.log(`\u2551 ${l}${" ".repeat(u)}\u2551`)}console.log(`\u2551${" ".repeat(o)}\u2551`),console.log(`\u255A${"\u2550".repeat(o)}\u255D`)}function bi(e,t){if(!e||e.length===0)return;let s=Array.from({length:e[0].length},()=>0);for(let r of e)for(let o=0;o<r.length;o++)s[o]=Math.max(s[o],String(r[o]).length);if(t?.border)console.log(`\u250C${s.map((r)=>"\u2500".repeat(r+2)).join("\u252C")}\u2510`);if(t?.header&&e.length>0)if(console.log((t.border?"\u2502 ":"")+e[0].map((r,o)=>`${r}${" ".repeat(s[o]-String(r).length)}`).join(" \u2502 ")+(t.border?" \u2502":"")),t.border)console.log(`\u251C${s.map((r)=>"\u2500".repeat(r+2)).join("\u253C")}\u2524`);else console.log(`${s.map((r)=>"\u2500".repeat(r)).join("\u2500\u253C\u2500")}`);let i=t?.header?1:0;for(let r=i;r<e.length;r++)console.log((t?.border?"\u2502 ":"")+e[r].map((o,l)=>`${o}${" ".repeat(s[l]-String(o).length)}`).join(" \u2502 ")+(t?.border?" \u2502":""));if(t?.border)console.log(`\u2514${s.map((r)=>"\u2500".repeat(r+2)).join("\u2534")}\u2518`)}class Qe extends Ot{name;commands;globalCommand;matchedCommand;matchedCommandName;rawArgs;args;options;showHelpOnExit;showVersionOnExit;enableDidYouMean=!0;signalHandlersSet=!1;isVerbose=!1;isQuiet=!1;isDebug=!1;isNoInteraction=!1;environment;isDryRun=!1;isForce=!1;useEmoji=!0;theme;isNoCache=!1;constructor(e=""){super();this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new Ie(this),this.globalCommand.usage("<command> [options]")}handleSignals(e){if(this.signalHandlersSet)return this;let t=async(s)=>{if(console.log(`
|
|
28
|
-
|
|
29
|
-
Received ${s}, cleaning up...`),e)try{await e()}catch(i){console.error("Error during cleanup:",i)}P.exit(0)};return P.on("SIGINT",()=>t("SIGINT")),P.on("SIGTERM",()=>t("SIGTERM")),this.signalHandlersSet=!0,this}didYouMean(e=!0){return this.enableDidYouMean=e,this}verbose(){return this.globalCommand.option("-v, --verbose","Enable verbose output"),this}quiet(){return this.globalCommand.option("-q, --quiet","Suppress non-essential output"),this}debug(){return this.globalCommand.option("--debug","Enable debug mode with detailed error information"),this}noInteraction(){return this.globalCommand.option("-n, --no-interaction","Do not ask any interactive questions (for CI/CD)"),this}env(){return this.globalCommand.option("--env <environment>","Target environment (e.g., production, staging, local)"),this}dryRun(){return this.globalCommand.option("--dry-run","Preview actions without executing them"),this}force(){return this.globalCommand.option("-f, --force","Skip confirmation prompts"),this}emoji(){return this.globalCommand.option("--no-emoji","Disable emoji in output"),this}themes(){return this.globalCommand.option("--theme <theme>","Color theme (default, dracula, nord, solarized, monokai)"),this}cache(){return this.globalCommand.option("--no-cache","Disable caching"),this}usage(e){return this.globalCommand.usage(e),this}command(e,t,s){if(!s)s={};let i=new Dt(e,t||"",s,this);return i.globalCommand=this.globalCommand,this.commands.push(i),i}option(e,t,s){return this.globalCommand.option(e,t,s),this}help(e){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,t="-v, --version"){return this.globalCommand.version(e,t),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){if(this.matchedCommand)this.matchedCommand.outputHelp();else this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:t},s,i){if(this.args=e,this.options=t,s)this.matchedCommand=s;if(i)this.matchedCommandName=i;return this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}showCommandNotFound(e){if(console.log(K.red(`
|
|
30
|
-
\u2717 Command "${e}" not found.
|
|
31
|
-
`)),this.enableDidYouMean){let t=[];for(let i of this.commands){if(i.displayName)t.push(i.displayName);if(i.aliasNames)t.push(...i.aliasNames)}let s=Ye(e,t);if(s.length>0)console.log(K.yellow("Did you mean one of these?")),s.forEach((i)=>console.log(` ${K.dim("\u2022")} ${this.name} ${i}`)),console.log("")}console.log(K.dim("Run"),`${this.name} --help`,K.dim("to see all available commands")),P.exit(1)}async parse(e=Ae,t={}){let{run:s=!0,exitOnError:i=!1}=t;if(i)try{return await this.parse(e,{run:s})}catch(a){throw this.handleUsageError(a),a}if(this.rawArgs=e,!this.name)this.name=e[1]?At(e[1]):"cli";let r=!0,o=e.slice(2),l=o[0];if(l&&!l.startsWith("-")){for(let a of this.commands)if(a.isMatched(l)){let c=this.mri(o,a);r=!1;let h={...c,args:c.args.slice(1)};this.setParsedInfo(h,a,l),this.emit(`command:${l}`,a);break}}if(r){for(let a of this.commands)if(a.name===""){r=!1;let c=this.mri(o,a);this.setParsedInfo(c,a),this.emit("command:!",a);break}}if(r){let a=this.mri(e.slice(2));this.setParsedInfo(a)}if(this.options.verbose)this.isVerbose=!0;if(this.options.quiet)this.isQuiet=!0;if(this.options.debug)this.isDebug=!0;if(this.options.noInteraction)this.isNoInteraction=!0;if(this.options.env)this.environment=String(this.options.env);if(this.options.dryRun)this.isDryRun=!0;if(this.options.force)this.isForce=!0;if(this.options.noEmoji!==void 0)this.useEmoji=!this.options.noEmoji;if(this.options.theme)this.theme=String(this.options.theme);if(this.options.noCache!==void 0)this.isNoCache=Boolean(this.options.noCache);if(this.options.help&&this.showHelpOnExit)this.outputHelp(),s=!1,this.unsetMatchedCommand();if(this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null)this.outputVersion(),s=!1,this.unsetMatchedCommand();let u={args:this.args,options:this.options};if(s)await this.runMatchedCommand();if(!this.matchedCommand&&this.args[0]){if(this.emit("command:*"),!(this.listenerCount("command:*")>0))this.showCommandNotFound(this.args[0])}return u}mri(e,t){let s=[...this.globalCommand.options,...t?t.options:[]],i=Tt(s),r=[],o=e.indexOf("--");if(o>-1)r=e.slice(o+1),e=e.slice(0,o);let l=Et(e,i),u={_:l._};for(let p of Object.keys(l))if(p!=="_")u[ze(p)]=l[p];let a=u._,c={"--":r},h=t&&t.config.ignoreOptionDefaultValue?t.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,f=Object.create(null);for(let p of s){if(!h&&p.config.default!==void 0)for(let d of p.names)c[d]=p.config.default;if(Array.isArray(p.config.type)){if(f[p.name]===void 0)f[p.name]={shouldTransform:!0,transformFunction:p.config.type[0]}}}for(let p of Object.keys(u))if(p!=="_"){let d=p.split(".");Vt(c,d,u[p]),Mt(c,f)}return{args:a,options:c}}async run(e=Ae){return this.parse(e,{run:!0,exitOnError:!0})}handleUsageError(e){if(!(!!e&&typeof e==="object"&&e.name==="ClappError"&&e.isUsageError!==!1))return;let i=e,r=i.message??"command-line error",o=this.name?`${this.name}: `:"",l=/--help/.test(r)?"":`
|
|
32
|
-
Run \`${this.name??"cli"} --help\` for usage.`;P.stderr.write(`${o}${r}${l}
|
|
33
|
-
`),P.exit(i.exitCode??2)}async runMatchedCommand(){let{args:e,options:t,matchedCommand:s}=this;if(!s||!s.commandAction)return;s.checkUnknownOptions(),s.checkOptionValue(),s.checkRequiredArgs();let i=[];s.args.forEach((u,a)=>{if(u.variadic)i.push(e.slice(a));else i.push(e[a])}),i.push(t);let r={command:s,args:i,options:t};for(let u of s.beforeHooks)await u(r);let o,l=async()=>{let u=s.commandAction.apply(this,i);if(u instanceof Promise)o=await u;else o=u;return o};if(s.middleware.length>0){let u=0,a=async()=>{if(u<s.middleware.length){let c=s.middleware[u++];await c({...r,next:a})}else await l()};await a()}else await l();for(let u of s.afterHooks)await u(r);return o}removeSignalHandlers(){if(!this.signalHandlersSet)return this;return P.removeAllListeners("SIGINT"),P.removeAllListeners("SIGTERM"),this.signalHandlersSet=!1,this}destroy(){this.removeSignalHandlers(),this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.matchedCommand=void 0,this.matchedCommandName=void 0,this.removeAllListeners()}}var Xe=(e="")=>new Qe(e);class Ze{cache;enabled;cleanupInterval=null;hits=0;misses=0;constructor(){this.cache=new Map,this.enabled=!0,this.startCleanupInterval()}startCleanupInterval(){if(this.cleanupInterval)return;this.cleanupInterval=setInterval(()=>{this.cleanup()},30000),this.cleanupInterval.unref()}stopCleanup(){if(this.cleanupInterval)clearInterval(this.cleanupInterval),this.cleanupInterval=null}isEnabled(){return this.enabled}get(e){if(!this.enabled){this.misses++;return}let t=this.cache.get(e);if(!t){this.misses++;return}if(Date.now()-t.timestamp>t.ttl){this.cache.delete(e),this.misses++;return}return this.hits++,t.value}set(e,t,s=5000){if(!this.enabled)return;this.cache.set(e,{value:t,timestamp:Date.now(),ttl:s})}has(e){if(!this.enabled)return!1;let t=this.cache.get(e);if(!t)return!1;if(Date.now()-t.timestamp>t.ttl)return this.cache.delete(e),!1;return!0}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}disable(){this.enabled=!1,this.clear()}enable(){this.enabled=!0}stats(){return{size:this.cache.size,enabled:this.enabled,hits:this.hits,misses:this.misses}}resetStats(){this.hits=0,this.misses=0}keys(){return Array.from(this.cache.keys())}cleanup(){let e=Date.now();for(let[t,s]of this.cache.entries())if(e-s.timestamp>s.ttl)this.cache.delete(t)}destroy(){this.stopCleanup(),this.clear(),this.resetStats()}}var xi=new Ze;function Si(e,t){e.on(`${t}:*`,()=>{let s=e.args??[];Ne.stderr.write(`Unknown ${t} subcommand: ${[...s].join(" ")}
|
|
34
|
-
Run \`${e.name??"cli"} ${t} --help\` to see available subcommands.
|
|
35
|
-
`),Ne.exit(64)})}function Ht(){if("FORCE_COLOR"in Z.env)return Z.env.FORCE_COLOR!=="0";if("NO_COLOR"in Z.env||Z.env.TERM==="dumb")return!1;if(Z.platform==="win32")return!0;return Re.isatty(1)&&Re.isatty(2)}var et=Ht();function _(e,t){if(!et)return(s)=>s;return(s)=>e+s+t}var Ut=_("\x1B[0m","\x1B[0m"),Gt=_("\x1B[31m","\x1B[39m"),tt=_("\x1B[32m","\x1B[39m"),Kt=_("\x1B[33m","\x1B[39m"),qt=_("\x1B[34m","\x1B[39m"),zt=_("\x1B[35m","\x1B[39m"),Yt=_("\x1B[36m","\x1B[39m"),Jt=_("\x1B[37m","\x1B[39m"),st=_("\x1B[90m","\x1B[39m"),it=_("\x1B[1m","\x1B[22m"),Qt=_("\x1B[3m","\x1B[23m"),Xt=_("\x1B[4m","\x1B[24m"),nt=_("\x1B[2m","\x1B[22m"),Zt=_("\x1B[7m","\x1B[27m"),es=_("\x1B[8m","\x1B[28m"),ts=_("\x1B[9m","\x1B[29m"),ss=_("\x1B[41m","\x1B[49m"),is=_("\x1B[42m","\x1B[49m"),ns=_("\x1B[43m","\x1B[49m"),rs=_("\x1B[44m","\x1B[49m"),os=_("\x1B[45m","\x1B[49m"),as=_("\x1B[46m","\x1B[49m"),ls=_("\x1B[47m","\x1B[49m"),us=et,cs={reset:Ut,red:Gt,green:tt,yellow:Kt,blue:qt,magenta:zt,cyan:Yt,white:Jt,gray:st,bold:it,italic:Qt,underline:Xt,dim:nt,inverse:Zt,hidden:es,strikethrough:ts,bgRed:ss,bgGreen:is,bgYellow:ns,bgBlue:rs,bgMagenta:os,bgCyan:as,bgWhite:ls,isColorSupported:us},n=cs,fs=["up","down","left","right","space","enter","cancel"],N={actions:new Set(fs),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};function Bi(e){if(e.aliases!==void 0){let t=e.aliases;for(let s in t){if(!Object.hasOwn(t,s))continue;let i=t[s];if(!N.actions.has(i))continue;if(!N.aliases.has(s))N.aliases.set(s,i)}}if(e.messages!==void 0){let t=e.messages;if(t.cancel!==void 0)N.messages.cancel=t.cancel;if(t.error!==void 0)N.messages.error=t.error}}function Oe(e,t){if(typeof e==="string")return N.aliases.get(e)===t;for(let s of e){if(s===void 0)continue;if(Oe(s,t))return!0}return!1}function ps(e,t){if(e===t)return[];let s=e.split(`
|
|
36
|
-
`),i=t.split(`
|
|
37
|
-
`),r=[];for(let o=0;o<Math.max(s.length,i.length);o++)if(s[o]!==i[o])r.push(o);return r}var gs=rt.platform.startsWith("win"),be=Symbol("clapp:cancel");function $s(e){return e===be}function re(e,t){let s=e;if(s.isTTY)s.setRawMode(t)}function vs(e){let{input:t=hs,output:s=ms,overwrite:i=!0,hideCursor:r=!0}=e||{},o=U.createInterface({input:t,output:s,prompt:"",tabSize:1});if(U.emitKeypressEvents(t,o),t instanceof je&&t.isTTY)t.setRawMode(!0);let l=(u,{name:a,sequence:c})=>{let h=String(u);if(Oe([h,a,c],"cancel")){if(r)s.write(k.show);rt.exit(0);return}if(!i)return;U.moveCursor(s,a==="return"?0:-1,a==="return"?-1:0,()=>{U.clearLine(s,1,()=>{t.once("keypress",l)})})};if(r)s.write(k.hide);return t.once("keypress",l),()=>{if(t.off("keypress",l),r)s.write(k.show);if(t instanceof je&&t.isTTY&&!gs)t.setRawMode(!1);o.terminal=!1,o.close()}}function ws(e){if(e instanceof ds&&e.columns)return e.columns;return 80}function Cs(e){return e.replace(/\x1b\[[0-9;]*m/g,"")}function Ss(e){return Cs(e).length}function De(e,t,s){if(!t||t<1)return e;let i=s?.hard??!1,r=s?.trim??!0,o=e.split(`
|
|
38
|
-
`),l=[];for(let u of o){if(Ss(u)<=t){l.push(r?u.trimEnd():u);continue}if(i){let a="",c=0,h=0;while(h<u.length){let f=u.slice(h).match(/^\x1b\[[0-9;]*m/);if(f){a+=f[0],h+=f[0].length;continue}if(c>=t)l.push(r?a.trimEnd():a),a="",c=0;a+=u[h],c++,h++}if(a)l.push(r?a.trimEnd():a)}else l.push(r?u.trimEnd():u)}return l.join(`
|
|
39
|
-
`)}class D{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;_manualLine="";state="initial";error="";value;userInput="";constructor(e,t=!0){let{input:s=ys,output:i=bs,render:r,signal:o,...l}=e;this.opts=l,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=r.bind(this),this._track=t,this._abortSignal=o,this.input=s,this.output=i}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let s=this._subscribers.get(e)??[];s.push(t),this._subscribers.set(e,s)}on(e,t){return this.setSubscriber(e,{cb:t}),this}once(e,t){return this.setSubscriber(e,{cb:t,once:!0}),this}emit(e,...t){let s=this._subscribers.get(e)??[],i=[];for(let r of s)if(r.cb(...t),r.once)i.push(()=>s.splice(s.indexOf(r),1));for(let r of i)r();return this}prompt(){return new Promise((e)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(be);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}if(this.rl=xs.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0)this._setUserInput(this.opts.initialUserInput,!0);this.input.on("keypress",this.onKeypress),re(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(k.show),this.output.off("resize",this.render),re(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(k.show),this.output.off("resize",this.render),re(this.input,!1),e(be)})})}_isActionKey(e,t){return e==="\t"}_setValue(e){this.value=e,this.emit("value",this.value)}_setUserInput(e,t){if(this.userInput=e??"",this.emit("userInput",this.userInput),t&&this._track&&this.rl)this.rl.write(this.userInput),this._cursor=this.rl.cursor}onKeypress(e,t){if(this._track&&t.name!=="return"){if(t.name&&this._isActionKey(e,t))this.rl?.write(null,{ctrl:!0,name:"h"});this._cursor=this.rl?.cursor??0;let s=t.name==="tab"||t.name==="escape"||t.name==="backspace"||t.name==="delete"||t.name==="enter"||t.name==="return"||t.name&&["up","down","left","right"].includes(t.name);if(e&&!s&&e.length===1&&e>=" ")this._manualLine+=e;else if(t.name==="backspace"&&this._manualLine.length>0)this._manualLine=this._manualLine.slice(0,-1);let i=this._manualLine.length>=(this.rl?.line?.length||0)?this._manualLine:this.rl?.line;this._setUserInput(i)}if(this.state==="error")this.state="active",this.error="";if(t?.name){if(!this._track&&N.aliases.has(t.name))this.emit("cursor",N.aliases.get(t.name));if(N.actions.has(t.name))this.emit("cursor",t.name)}if(e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n"))this.emit("confirm",e.toLowerCase()==="y");if(this.emit("key",e?.toLowerCase(),t),t?.name==="return"){if(this.opts.validate){let s=this.opts.validate(this.value);if(s)this.error=s instanceof Error?s.message:s,this.state="error"}if(this.state!=="error")this.state="submit"}if(Oe([e,t?.name,t?.sequence],"cancel"))this.state="cancel";if(this.state==="submit"||this.state==="cancel")this.emit("finalize");if(this.render(),this.state==="submit"||this.state==="cancel")this.close()}close(){if(this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
40
|
-
`),re(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.state==="cancel")setTimeout(()=>{this.unsubscribe()},10);else this.unsubscribe()}restoreCursor(){let e=De(this._prevFrame,Le.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
41
|
-
`).length-1;this.output.write(k.move(-999,e*-1))}render(){let e=De(this._render(this)??"",Le.stdout.columns,{hard:!0,trim:!1});if(e===this._prevFrame)return;if(this.state==="initial")this.output.write(k.hide);else{let t=ps(this._prevFrame,e);if(this.restoreCursor(),t&&t?.length===1){let s=t[0];this.output.write(k.move(0,s)),this.output.write(te.lines(1));let i=e.split(`
|
|
42
|
-
`);this.output.write(i[s]),this._prevFrame=e,this.output.write(k.move(0,i.length-s-1));return}if(t&&t?.length>1){let s=t[0];this.output.write(k.move(0,s)),this.output.write(te.down());let r=e.split(`
|
|
43
|
-
`).slice(s);this.output.write(r.join(`
|
|
44
|
-
`)),this._prevFrame=e;return}this.output.write(te.down())}if(this.output.write(e),this.state==="initial")this.state="active";this._prevFrame=e}}function _s(e,t){if(e===void 0)return 0;if(t.length===0)return 0;let i=t.findIndex((r)=>r.value===e);return i!==-1?i:0}function Is(e,t){return(t.label??String(t.value)).toLowerCase().includes(e.toLowerCase())}function Os(e,t){if(!t)return;if(e)return t;return t[0]}class Ee extends D{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#e=0;#s="";#i;#t;get cursor(){return this.#e}get userInputWithCursor(){if(!this.userInput)return n.inverse(n.hidden("_"));if(this._cursor>=this.userInput.length)return`${this.userInput}\u2588`;let e=this.userInput.slice(0,this._cursor),[t,...s]=this.userInput.slice(this._cursor);return`${e}${n.inverse(t)}${s.join("")}`}get options(){if(typeof this.#t==="function")return this.#t();return this.#t}constructor(e){super(e);this.#t=e.options;let t=this.options;this.filteredOptions=[...t],this.multiple=e.multiple===!0,this.#i=e.filter??Is;let s;if(e.initialValue&&Array.isArray(e.initialValue))if(this.multiple)s=e.initialValue;else s=e.initialValue.slice(0,1);else if(!this.multiple&&this.options.length>0)s=[this.options[0].value];if(s)for(let i of s){let r=t.findIndex((o)=>o.value===i);if(r!==-1)this.toggleSelected(i),this.#e=r}this.focusedValue=this.options[this.#e]?.value,this.on("key",(i,r)=>this.#n(i,r)),this.on("userInput",(i)=>this.#r(i))}_isActionKey(e,t){return e==="\t"||this.multiple&&this.isNavigating&&t.name==="space"&&e!==void 0&&e!==""}#n(e,t){let s=t.name==="up",i=t.name==="down",r=t.name==="return";if(s||i){if(this.#e=Math.max(0,Math.min(this.#e+(s?-1:1),this.filteredOptions.length-1)),this.focusedValue=this.filteredOptions[this.#e]?.value,!this.multiple)this.selectedValues=[this.focusedValue];this.isNavigating=!0}else if(r)this.value=Os(this.multiple,this.selectedValues);else if(this.multiple)if(this.focusedValue!==void 0&&(t.name==="tab"||this.isNavigating&&t.name==="space"))this.toggleSelected(this.focusedValue);else this.isNavigating=!1;else{if(this.focusedValue)this.selectedValues=[this.focusedValue];this.isNavigating=!1}}deselectAll(){this.selectedValues=[]}toggleSelected(e){if(this.filteredOptions.length===0)return;if(this.multiple)if(this.selectedValues.includes(e))this.selectedValues=this.selectedValues.filter((t)=>t!==e);else this.selectedValues=[...this.selectedValues,e];else this.selectedValues=[e]}#r(e){if(e!==this.#s){this.#s=e;let t=this.options;if(e)this.filteredOptions=t.filter((s)=>this.#i(e,s));else this.filteredOptions=[...t];if(this.#e=_s(this.focusedValue,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#e]?.value,!this.multiple)if(this.focusedValue!==void 0)this.toggleSelected(this.focusedValue);else this.deselectAll()}}}class ot extends D{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1);this.value=!!e.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",(t)=>{this.output.write(k.move(0,-1)),this.value=t,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}class at extends D{options;cursor=0;#e;getGroupItems(e){return this.options.filter((t)=>t.group===e)}isGroupSelected(e){let t=this.getGroupItems(e),s=this.value;if(s===void 0)return!1;return t.every((i)=>s.includes(i.value))}toggleValue(){let e=this.options[this.cursor];if(this.value===void 0)this.value=[];if(e.group===!0){let t=String(e.value),s=this.getGroupItems(t);if(this.isGroupSelected(t))this.value=this.value.filter((i)=>s.findIndex((r)=>r.value===i)===-1);else this.value=[...this.value,...s.map((i)=>i.value)];this.value=Array.from(new Set(this.value))}else{let t=this.value.includes(e.value);this.value=t?this.value.filter((s)=>s!==e.value):[...this.value,e.value]}}constructor(e){super(e,!1);let{options:t}=e;this.#e=e.selectableGroups!==!1,this.options=Object.entries(t).flatMap(([s,i])=>[{value:s,group:!0,label:s},...i.map((r)=>({...r,group:s}))]),this.value=[...e.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:s})=>s===e.cursorAt),this.#e?0:1),this.on("cursor",(s)=>{switch(s){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let i=this.options[this.cursor]?.group===!0;if(!this.#e&&i)this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;let i=this.options[this.cursor]?.group===!0;if(!this.#e&&i)this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}case"space":this.toggleValue();break}})}}class lt extends D{options;cursor=0;get _value(){return this.options[this.cursor].value}toggleAll(){let e=this.value!==void 0&&this.value.length===this.options.length;this.value=e?[]:this.options.map((t)=>t.value)}toggleValue(){if(this.value===void 0)this.value=[];let e=this.value.includes(this._value);this.value=e?this.value.filter((t)=>t!==this._value):[...this.value,this._value]}constructor(e){super(e,!1);this.options=e.options,this.value=[...e.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:t})=>t===e.cursorAt),0),this.on("key",(t)=>{if(t==="a")this.toggleAll()}),this.on("cursor",(t)=>{switch(t){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}}class ut extends D{_mask="\u2022";get cursor(){return this._cursor}get masked(){return this.userInput.replaceAll(/./g,this._mask)}get userInputWithCursor(){if(this.state==="submit"||this.state==="cancel")return this.masked;let e=this.userInput;if(this.cursor>=e.length)return`${this.masked}${n.inverse(n.hidden("_"))}`;let t=this.masked,s=t.slice(0,this.cursor),i=t.slice(this.cursor);return`${s}${n.inverse(i[0])}${i.slice(1)}`}constructor({mask:e,...t}){super(t);this._mask=e??"\u2022",this.on("userInput",(s)=>{this._setValue(s)})}}class ct extends D{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(e){super(e,!1);if(this.options=e.options,this.cursor=this.options.findIndex(({value:t})=>t===e.initialValue),this.cursor===-1)this.cursor=0;this.changeValue(),this.on("cursor",(t)=>{switch(t){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}}class ht extends D{options;cursor=0;constructor(e){super(e,!1);this.options=e.options;let t=this.options.map(({value:[s]})=>s?.toLowerCase());this.cursor=Math.max(t.indexOf(e.initialValue),0),this.on("key",(s)=>{if(!s||!t.includes(s))return;let i=this.options.find(({value:[r]})=>r?.toLowerCase()===s);if(i)this.value=i.value,this.state="submit",this.emit("submit")})}}class mt extends D{placeholder;get userInputWithCursor(){if(this.state==="submit")return this.userInput;let e=this.userInput;if(this.cursor>=e.length)return`${this.userInput}\u2588`;let t=e.slice(0,this.cursor),[s,...i]=e.slice(this.cursor);return`${t}${n.inverse(s)}${i.join("")}`}get cursor(){return this._cursor}constructor(e){super({...e,initialUserInput:e.initialUserInput??e.initialValue});this.placeholder=e.placeholder,this.on("key",(t)=>{if(t==="\t"&&this.placeholder){if(!this.userInput||this.userInput==="\t")this._setValue(this.placeholder),this._setUserInput(this.placeholder,!0)}}),this.on("userInput",(t)=>{this._setValue(t)}),this.on("finalize",()=>{if(!this.userInput&&this.placeholder)this.value=this.placeholder;if(!this.value)this.value=e.defaultValue;if(this.value===void 0)this.value=""})}}var xe=Nt(),dt=()=>Es.env.CI==="true";function Bs(e){return e.isTTY===!0}var C=(e,t)=>xe?e:t,Ts=C("\u25C6","*"),ft=C("\u25A0","x"),pt=C("\u25B2","x"),X=C("\u25C7","o"),ks=C("\u250C","T"),m=C("\u2502","|"),T=C("\u2514","\u2014"),ce=C("\u25CF",">"),he=C("\u25CB"," "),Ce=C("\u25FB","[\u2022]"),Q=C("\u25FC","[+]"),Be=C("\u25FB","[ ]"),Vs=C("\u25AA","\u2022"),We=C("\u2500","-"),Ms=C("\u256E","+"),As=C("\u251C","+"),Ns=C("\u256F","+"),gt=C("\u25CF","\u2022"),$t=C("\u25C6","*"),vt=C("\u25B2","!"),wt=C("\u25A0","x");function W(e){switch(e){case"initial":case"active":return n.cyan(Ts);case"cancel":return n.red(ft);case"error":return n.yellow(pt);case"submit":return n.green(X)}}function q(e){return e.replace(/_([^_]+)_/g,(t,s)=>K.italic(s))}function se(e){let{cursor:t,options:s,style:i}=e,r=e.output??Rs.stdout,o=r instanceof js&&r.rows!==void 0?r.rows:10,l=n.dim("..."),u=e.maxItems??Number.POSITIVE_INFINITY,a=Math.max(o-4,0),c=Math.min(a,Math.max(u,5)),h=0;if(t>=h+c-3)h=Math.max(Math.min(t-c+3,s.length-c),0);else if(t<h+2)h=Math.max(t-2,0);let f=c<s.length&&h>0,p=c<s.length&&h+c<s.length;return s.slice(h,h+c).map((d,v,y)=>{let g=v===0&&f,w=v===y.length-1&&p;return g||w?l:i(d,v+h===t)})}function Pe(e){return e.label??String(e.value??"")}function yt(e,t){if(!e)return!0;let s=(t.label??String(t.value??"")).toLowerCase(),i=(t.hint??"").toLowerCase(),r=String(t.value).toLowerCase(),o=e.toLowerCase();return s.includes(o)||i.includes(o)||r.includes(o)}function Ls(e,t){let s=[];for(let i of t)if(e.includes(i.value))s.push(i);return s}function Ds(e){return new Ee({options:e.options,initialValue:e.initialValue?[e.initialValue]:void 0,initialUserInput:e.initialUserInput,filter:(s,i)=>yt(s,i),signal:e.signal,input:e.input,output:e.output,validate:e.validate,render(){let s=`${n.gray(m)}
|
|
45
|
-
${W(this.state)} ${e.message}
|
|
46
|
-
`,i=this.userInput,r=String(this.value??""),o=this.options,l=e.placeholder,u=r===""&&l!==void 0;switch(this.state){case"submit":{let a=Ls(this.selectedValues,o),c=a.length>0?` ${n.dim(a.map(Pe).join(", "))}`:"";return`${s}${n.gray(m)}${c}`}case"cancel":{let a=i?` ${n.strikethrough(n.dim(i))}`:"";return`${s}${n.gray(m)}${a}`}default:{let a="";if(this.isNavigating||u){let v=u?l:i;a=v!==""?` ${n.dim(v)}`:""}else a=` ${this.userInputWithCursor}`;let c=this.filteredOptions.length!==o.length?n.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"",h=this.filteredOptions.length===0?[]:se({cursor:this.cursor,options:this.filteredOptions,style:(v,y)=>{let g=Pe(v),w=v.hint&&v.value===this.focusedValue?n.dim(` (${v.hint})`):"";return y?`${n.green(ce)} ${g}${w}`:`${n.dim(he)} ${n.dim(g)}${w}`},maxItems:e.maxItems,output:e.output}),f=[`${n.dim("\u2191/\u2193")} to select`,`${n.dim("Enter:")} confirm`,`${n.dim("Type:")} to search`],p=this.filteredOptions.length===0&&i?[`${n.cyan(m)} ${n.yellow("No matches found")}`]:[],d=this.state==="error"?[`${n.yellow(m)} ${n.yellow(this.error)}`]:[];return[`${s}${n.cyan(m)}`,`${n.cyan(m)} ${n.dim("Search:")}${a}${c}`,...p,...d,...h.map((v)=>`${n.cyan(m)} ${v}`),`${n.cyan(m)} ${n.dim(f.join(" \u2022 "))}`,`${n.cyan(T)}`].join(`
|
|
47
|
-
`)}}}}).prompt()}function Ni(e){let t=(i,r,o,l)=>{let u=o.includes(i.value),a=i.label??String(i.value??""),c=i.hint&&l!==void 0&&i.value===l?n.dim(` (${i.hint})`):"",h=u?n.green(Q):n.dim(Be);if(r)return`${h} ${a}${c}`;return`${h} ${n.dim(a)}`},s=new Ee({options:e.options,multiple:!0,filter:(i,r)=>yt(i,r),validate:()=>{if(e.required&&s.selectedValues.length===0)return"Please select at least one item";return},initialValue:e.initialValues,signal:e.signal,input:e.input,output:e.output,render(){let i=`${n.gray(m)}
|
|
48
|
-
${W(this.state)} ${e.message}
|
|
49
|
-
`,r=this.userInput,o=e.placeholder,l=r===""&&o!==void 0,u=this.isNavigating||l?n.dim(l?o:r):this.userInputWithCursor,a=this.options,c=this.filteredOptions.length!==a.length?n.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"";switch(this.state){case"submit":return`${i}${n.gray(m)} ${n.dim(`${this.selectedValues.length} items selected`)}`;case"cancel":return`${i}${n.gray(m)} ${n.strikethrough(n.dim(r))}`;default:{let h=[`${n.dim("\u2191/\u2193")} to navigate`,`${n.dim("Space:")} select`,`${n.dim("Enter:")} confirm`,`${n.dim("Type:")} to search`],f=this.filteredOptions.length===0&&r?[`${n.cyan(m)} ${n.yellow("No matches found")}`]:[],p=this.state==="error"?[`${n.cyan(m)} ${n.yellow(this.error)}`]:[],d=se({cursor:this.cursor,options:this.filteredOptions,style:(v,y)=>t(v,y,this.selectedValues,this.focusedValue),maxItems:e.maxItems,output:e.output});return[i,`${n.cyan(m)} ${n.dim("Search:")} ${u}${c}`,...f,...p,...d.map((v)=>`${n.cyan(m)} ${v}`),`${n.cyan(m)} ${n.dim(h.join(" \u2022 "))}`,`${n.cyan(T)}`].join(`
|
|
50
|
-
`)}}}});return s.prompt()}function Ri(e){let t=e.active??"Yes",s=e.inactive??"No",i=q(e.message);return new ot({active:t,inactive:s,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){let r=`${n.gray(m)}
|
|
51
|
-
${W(this.state)} ${i}
|
|
52
|
-
`,o=this.value?t:s;switch(this.state){case"submit":return`${r}${n.gray(m)} ${n.dim(o)}`;case"cancel":return`${r}${n.gray(m)} ${n.strikethrough(n.dim(o))}
|
|
53
|
-
${n.gray(m)}`;default:return`${r}${n.cyan(m)} ${this.value?`${n.green(ce)} ${t}`:`${n.dim(he)} ${n.dim(t)}`} ${n.dim("/")} ${!this.value?`${n.green(ce)} ${s}`:`${n.dim(he)} ${n.dim(s)}`}
|
|
54
|
-
${n.cyan(T)}
|
|
55
|
-
`}}}).prompt()}async function ji(e,t){let s={},i=Object.keys(e);for(let r of i){let o=e[r],l=await o({results:s})?.catch((u)=>{throw u});if(typeof t?.onCancel==="function"&&$s(l)){s[r]="canceled",t.onCancel({results:s});continue}s[r]=l}return s}function Li(e){let{selectableGroups:t=!0,groupSpacing:s=0}=e,i=(o,l,u=[])=>{let a=o.label??String(o.value),c=typeof o.group==="string",h=c&&(u[u.indexOf(o)+1]??{group:!0}),f=c&&h.group===!0,p=c?t?`${f?T:m} `:" ":"",d="";if(s>0&&!c){let y=`
|
|
56
|
-
${n.cyan(m)}`;d=`${y.repeat(s-1)}${y} `}if(l==="active")return`${d}${n.dim(p)}${n.cyan(Ce)} ${a}${o.hint?` ${n.dim(`(${o.hint})`)}`:""}`;if(l==="group-active")return`${d}${p}${n.cyan(Ce)} ${n.dim(a)}`;if(l==="group-active-selected")return`${d}${p}${n.green(Q)} ${n.dim(a)}`;if(l==="selected"){let y=c||t?n.green(Q):"";return`${d}${n.dim(p)}${y} ${n.dim(a)}${o.hint?` ${n.dim(`(${o.hint})`)}`:""}`}if(l==="cancelled")return`${n.strikethrough(n.dim(a))}`;if(l==="active-selected")return`${d}${n.dim(p)}${n.green(Q)} ${a}${o.hint?` ${n.dim(`(${o.hint})`)}`:""}`;if(l==="submitted")return`${n.dim(a)}`;let v=c||t?n.dim(Be):"";return`${d}${n.dim(p)}${v} ${n.dim(a)}`},r=e.required??!0;return new at({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValues:e.initialValues,required:r,cursorAt:e.cursorAt,selectableGroups:t,validate(o){if(r&&(o===void 0||o.length===0))return`Please select at least one option.
|
|
57
|
-
${n.reset(n.dim(`Press ${n.gray(n.bgWhite(n.inverse(" space ")))} to select, ${n.gray(n.bgWhite(n.inverse(" enter ")))} to submit`))}`},render(){let o=`${n.gray(m)}
|
|
58
|
-
${W(this.state)} ${e.message}
|
|
59
|
-
`,l=this.value??[];switch(this.state){case"submit":{let u=this.options.filter(({value:c})=>l.includes(c)).map((c)=>i(c,"submitted")),a=u.length===0?"":` ${u.join(n.dim(", "))}`;return`${o}${n.gray(m)}${a}`}case"cancel":{let u=this.options.filter(({value:a})=>l.includes(a)).map((a)=>i(a,"cancelled")).join(n.dim(", "));return`${o}${n.gray(m)} ${u.trim()?`${u}
|
|
60
|
-
${n.gray(m)}`:""}`}case"error":{let u=this.error.split(`
|
|
61
|
-
`).map((a,c)=>c===0?`${n.yellow(T)} ${n.yellow(a)}`:` ${a}`).join(`
|
|
62
|
-
`);return`${o}${n.yellow(m)} ${this.options.map((a,c,h)=>{let f=l.includes(a.value)||a.group===!0&&this.isGroupSelected(`${a.value}`),p=c===this.cursor;if(!p&&typeof a.group==="string"&&this.options[this.cursor].value===a.group)return i(a,f?"group-active-selected":"group-active",h);if(p&&f)return i(a,"active-selected",h);if(f)return i(a,"selected",h);return i(a,p?"active":"inactive",h)}).join(`
|
|
63
|
-
${n.yellow(m)} `)}
|
|
64
|
-
${u}
|
|
65
|
-
`}default:{let u=this.options.map((c,h,f)=>{let p=l.includes(c.value)||c.group===!0&&this.isGroupSelected(`${c.value}`),d=h===this.cursor,v=!d&&typeof c.group==="string"&&this.options[this.cursor].value===c.group,y="";if(v)y=i(c,p?"group-active-selected":"group-active",f);else if(d&&p)y=i(c,"active-selected",f);else if(p)y=i(c,"selected",f);else y=i(c,d?"active":"inactive",f);return`${h!==0&&!y.startsWith(`
|
|
66
|
-
`)?" ":""}${y}`}).join(`
|
|
67
|
-
${n.cyan(m)}`),a=u.startsWith(`
|
|
68
|
-
`)?"":" ";return`${o}${n.cyan(m)}${a}${u}
|
|
69
|
-
${n.cyan(T)}
|
|
70
|
-
`}}}}).prompt()}function Ps(e){if(Array.isArray(e))return e.map((t)=>q(t));return q(e)}var V={message:(e=[],{symbol:t=n.gray(m),secondarySymbol:s=n.gray(m),output:i=Ws.stdout,spacing:r=1}={})=>{let o=[];for(let a=0;a<r;a++)o.push(`${s}`);let l=Ps(e),u=Array.isArray(l)?l:l.split(`
|
|
71
|
-
`);if(u.length>0){let[a,...c]=u;if(a.length>0)o.push(`${t} ${a}`);else o.push(t);for(let h of c)if(h.length>0)o.push(`${s} ${h}`);else o.push(s)}i.write(`${o.join(`
|
|
72
|
-
`)}
|
|
73
|
-
`)},info:(e,t)=>{V.message(e,{...t,symbol:n.blue(gt)})},success:(e,t)=>{V.message(e,{...t,symbol:n.green($t)})},step:(e,t)=>{V.message(e,{...t,symbol:n.green(X)})},warn:(e,t)=>{V.message(e,{...t,symbol:n.yellow(vt)})},warning:(e,t)=>{V.warn(e,t)},error:(e,t)=>{V.message(e,{...t,symbol:n.red(wt)})},custom:(e,t,s,i)=>{let r=typeof s==="string"?(o)=>n[s]?.(o)||o:s;V.message(t,{...i,symbol:r(e),secondarySymbol:r(e)})}};function Pi(e="",t){(t?.output??Te.stdout).write(`${n.gray(T)} ${n.red(e)}
|
|
74
|
-
|
|
75
|
-
`)}function Fi(e="",t){(t?.output??Te.stdout).write(`${n.gray(ks)} ${e}
|
|
76
|
-
`)}function Hi(e="",t){(t?.output??Te.stdout).write(`${n.gray(m)}
|
|
77
|
-
${n.gray(T)} ${e}
|
|
78
|
-
|
|
79
|
-
`)}function Ui(e){let t=(i,r)=>{let o=i.label??String(i.value);if(r==="active")return`${n.cyan(Ce)} ${o}${i.hint?` ${n.dim(`(${i.hint})`)}`:""}`;if(r==="selected")return`${n.green(Q)} ${n.dim(o)}${i.hint?` ${n.dim(`(${i.hint})`)}`:""}`;if(r==="cancelled")return`${n.strikethrough(n.dim(o))}`;if(r==="active-selected")return`${n.green(Q)} ${o}${i.hint?` ${n.dim(`(${i.hint})`)}`:""}`;if(r==="submitted")return`${n.dim(o)}`;return`${n.dim(Be)} ${n.dim(o)}`},s=e.required??!0;return new lt({options:e.options,input:e.input,output:e.output,initialValues:e.initialValues,required:s,cursorAt:e.cursorAt,validate(i){if(s&&(i===void 0||i.length===0))return`Please select at least one option.
|
|
80
|
-
${n.reset(n.dim(`Press ${n.gray(n.bgWhite(n.inverse(" space ")))} to select, ${n.gray(n.bgWhite(n.inverse(" enter ")))} to submit`))}`},render(){let i=`${n.gray(m)}
|
|
81
|
-
${W(this.state)} ${e.message}
|
|
82
|
-
`,r=this.value??[],o=(l,u)=>{let a=r.includes(l.value);if(u&&a)return t(l,"active-selected");if(a)return t(l,"selected");return t(l,u?"active":"inactive")};switch(this.state){case"submit":return`${i}${n.gray(m)} ${this.options.filter(({value:l})=>r.includes(l)).map((l)=>t(l,"submitted")).join(n.dim(", "))||n.dim("none")}`;case"cancel":{let l=this.options.filter(({value:u})=>r.includes(u)).map((u)=>t(u,"cancelled")).join(n.dim(", "));return`${i}${n.gray(m)}${l.trim()?` ${l}
|
|
83
|
-
${n.gray(m)}`:""}`}case"error":{let l=this.error.split(`
|
|
84
|
-
`).map((u,a)=>a===0?`${n.yellow(T)} ${n.yellow(u)}`:` ${u}`).join(`
|
|
85
|
-
`);return`${i+n.yellow(m)} ${se({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,style:o}).join(`
|
|
86
|
-
${n.yellow(m)} `)}
|
|
87
|
-
${l}
|
|
88
|
-
`}default:return`${i}${n.cyan(m)} ${se({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,style:o}).join(`
|
|
89
|
-
${n.cyan(m)} `)}
|
|
90
|
-
${n.cyan(T)}
|
|
91
|
-
`}}}).prompt()}var Hs=(e)=>n.dim(e);function qi(e="",t="",s){let i=s?.format??Hs,r=q(e),o=q(t),l=["",...r.split(`
|
|
92
|
-
`).map(i),""],u=ge(o).length,a=s?.output??Fs.stdout,c=Math.max(l.reduce((f,p)=>{let d=ge(p);return d.length>f?d.length:f},0),u)+2,h=l.map((f)=>`${n.gray(m)} ${f}${" ".repeat(c-ge(f).length)}${n.gray(m)}`).join(`
|
|
93
|
-
`);a.write(`${n.gray(m)}
|
|
94
|
-
${n.green(X)} ${n.reset(o)} ${n.gray(We.repeat(Math.max(c-u-1,1))+Ms)}
|
|
95
|
-
${h}
|
|
96
|
-
${n.gray(As+We.repeat(c+2)+Ns)}
|
|
97
|
-
`)}function zi(e){return new ut({validate:e.validate,mask:e.mask??Vs,signal:e.signal,input:e.input,output:e.output,render(){let t=`${n.gray(m)}
|
|
98
|
-
${W(this.state)} ${e.message}
|
|
99
|
-
`,s=this.userInputWithCursor,i=this.masked;switch(this.state){case"error":{let r=i?` ${i}`:"";return`${t.trim()}
|
|
100
|
-
${n.yellow(m)}${r}
|
|
101
|
-
${n.yellow(T)} ${n.yellow(this.error)}
|
|
102
|
-
`}case"submit":{let r=i?` ${n.dim(i)}`:"";return`${t}${n.gray(m)}${r}`}case"cancel":{let r=i?` ${n.strikethrough(n.dim(i))}`:"";return`${t}${n.gray(m)}${r}${i?`
|
|
103
|
-
${n.gray(m)}`:""}`}default:return`${t}${n.cyan(m)} ${s}
|
|
104
|
-
${n.cyan(T)}
|
|
105
|
-
`}}}).prompt()}function Xi(e){let t=e.validate;return Ds({...e,initialUserInput:e.initialValue??e.root??qs.cwd(),maxItems:5,validate(s){if(Array.isArray(s))return;if(!s)return"Please select a path";if(t)return t(s);return},options(){let s=this.userInput;if(s==="")return[];try{let i;if(!Us(s))i=He(s);else if(Fe(s).isDirectory())i=s;else i=He(s);return Gs(i).map((o)=>{let l=Ks(i,o),u=Fe(l);return{name:o,path:l,isDirectory:u.isDirectory()}}).filter(({path:o,isDirectory:l})=>o.startsWith(s)&&(e.directory||!l)).map((o)=>({value:o.path}))}catch(i){return console.error("Error reading directory:",i),[]}}})}function bt({indicator:e="dots",onCancel:t,output:s=A.stdout,cancelMessage:i,errorMessage:r,frames:o=xe?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:l=xe?80:120,signal:u}={}){let a=dt(),c,h,f=!1,p=!1,d="",v,y=performance.now();function g(){if(v===void 0)return;if(a)s.write(`
|
|
106
|
-
`);let B=v.split(`
|
|
107
|
-
`);s.write(k.move(-999,B.length-1)),s.write(te.down(B.length))}function w(B){return B.replace(/\.+$/,"")}function I(B){let M=(performance.now()-B)/1000,R=Math.floor(M/60),z=Math.floor(M%60);return R>0?`[${R}m ${z}s]`:`[${z}s]`}function b(B="",M=0){f=!1,clearInterval(h),g();let R=M===0?n.green(X):M===1?n.red(ft):n.red(pt);if(d=B??d,e==="timer")s.write(`${R} ${d} ${I(y)}
|
|
108
|
-
`);else s.write(`${R} ${d}
|
|
109
|
-
`);ne(),c()}function O(B){let M=B>1?r??N.messages.error:i??N.messages.cancel;if(p=B===1,f){if(b(M,B),p&&typeof t==="function")t()}}function E(){O(2)}function L(){O(1)}function ie(){A.on("uncaughtExceptionMonitor",E),A.on("unhandledRejection",E),A.on("SIGINT",L),A.on("SIGTERM",L),A.on("exit",O)}function ne(){if(A.removeListener("uncaughtExceptionMonitor",E),A.removeListener("unhandledRejection",E),A.removeListener("SIGINT",L),A.removeListener("SIGTERM",L),A.removeListener("exit",O),u)u.removeEventListener("abort",L)}function Ct(B=""){f=!0,c=vs({output:s}),d=w(B),y=performance.now(),s.write(`${n.gray(m)}
|
|
110
|
-
`);let M=0,R=0;ie(),h=setInterval(()=>{if(a&&d===v)return;g(),v=d;let z=n.magenta(o[M]);if(a)s.write(`${z} ${d}...`);else if(e==="timer")s.write(`${z} ${d} ${I(y)}`);else{let _t=".".repeat(Math.floor(R)).slice(0,3);s.write(`${z} ${d}${_t}`)}M=M+1<o.length?M+1:0,R=R<4?R+0.125:0},l)}function St(B=""){d=w(B??d)}return{start:Ct,stop:b,message:St,get isCancelled(){return p}}}var Ue={light:C("\u2500","-"),heavy:C("\u2501","="),block:C("\u2588","#")};function en(e={}){let{style:t="heavy",max:s=100,size:i=40,...r}=e,o=bt(r),l=0,u="",a=Math.max(1,s),c=Math.max(1,i),h=(v)=>{switch(v){case"initial":case"active":return n.magenta;case"error":case"cancel":return n.red;case"submit":return n.green;default:return n.magenta}},f=(v,y)=>{let g=Math.floor(l/a*c);return`${h(v)(Ue[t].repeat(g))}${n.dim(Ue[t].repeat(c-g))} ${y}`},p=(v="")=>(u=v,o.start(f("initial",v))),d=(v=1,y)=>{l=Math.min(a,v+l),o.message(f("active",y??u)),u=y??u};return{start:p,stop:o.stop,advance:d,isCancelled:o.isCancelled,message:(v)=>d(0,v)}}function tn(e){let t=q(e.message),s=(i,r)=>{let o=i.label??String(i.value);switch(r){case"selected":return`${n.dim(o)}`;case"active":return`${n.green(ce)} ${o}${i.hint?` ${n.dim(`(${i.hint})`)}`:""}`;case"cancelled":return`${n.strikethrough(n.dim(o))}`;default:return`${n.dim(he)} ${n.dim(o)}`}};return new ct({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let i=`${n.gray(m)}
|
|
111
|
-
${W(this.state)} ${t}
|
|
112
|
-
`;switch(this.state){case"submit":return`${i}${n.gray(m)} ${s(this.options[this.cursor],"selected")}`;case"cancel":return`${i}${n.gray(m)} ${s(this.options[this.cursor],"cancelled")}
|
|
113
|
-
${n.gray(m)}`;default:return`${i}${n.cyan(m)} ${se({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,style:(r,o)=>s(r,o?"active":"inactive")}).join(`
|
|
114
|
-
${n.cyan(m)} `)}
|
|
115
|
-
${n.cyan(T)}
|
|
116
|
-
`}}}).prompt()}function sn(e){let t=(s,i="inactive")=>{let r=s.label??String(s.value);if(i==="selected")return`${n.dim(r)}`;if(i==="cancelled")return`${n.strikethrough(n.dim(r))}`;if(i==="active")return`${n.bgCyan(n.gray(` ${s.value} `))} ${r} ${s.hint?n.dim(`(${s.hint})`):""}`;return`${n.gray(n.bgWhite(n.inverse(` ${s.value} `)))} ${r} ${s.hint?n.dim(`(${s.hint})`):""}`};return new ht({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let s=`${n.gray(m)}
|
|
117
|
-
${W(this.state)} ${e.message}
|
|
118
|
-
`;switch(this.state){case"submit":return`${s}${n.gray(m)} ${t(this.options.find((i)=>i.value===this.value)??e.options[0],"selected")}`;case"cancel":return`${s}${n.gray(m)} ${t(this.options[0],"cancelled")}
|
|
119
|
-
${n.gray(m)}`;default:return`${s}${n.cyan(m)} ${this.options.map((i,r)=>t(i,r===this.cursor?"active":"inactive")).join(`
|
|
120
|
-
${n.cyan(m)} `)}
|
|
121
|
-
${n.cyan(T)}
|
|
122
|
-
`}}}).prompt()}function zs(){return`${n.gray(m)} `}var Ge=zs(),Y={message:async(e,{symbol:t=n.gray(m)}={})=>{ee.stdout.write(`${n.gray(m)}
|
|
123
|
-
${t} `);let s=3;for await(let i of e){if(i=i.replace(/\n/g,`
|
|
124
|
-
${Ge}`),i.includes(`
|
|
125
|
-
`))s=3+$e(i.slice(i.lastIndexOf(`
|
|
126
|
-
`))).length;let r=$e(i).length;if(s+r<ee.stdout.columns)s+=r,ee.stdout.write(i);else ee.stdout.write(`
|
|
127
|
-
${Ge}${i.trimStart()}`),s=3+$e(i.trimStart()).length}ee.stdout.write(`
|
|
128
|
-
`)},info:(e)=>Y.message(e,{symbol:n.blue(gt)}),success:(e)=>Y.message(e,{symbol:n.green($t)}),step:(e)=>Y.message(e,{symbol:n.green(X)}),warn:(e)=>Y.message(e,{symbol:n.yellow(vt)}),warning:(e)=>Y.warn(e),error:(e)=>Y.message(e,{symbol:n.red(wt)})};async function on(e,t){for(let s of e){if(s.enabled===!1)continue;let i=bt(t);i.start(s.title);let r=await s.task(i.message);i.stop(r||s.title)}}function ln(e){let t=e.output??Ys.stdout,s=ws(t),i=st(m),r=e.spacing??1,o=3,l=e.retainLog===!0,u=!dt()&&Bs(t);t.write(`${i}
|
|
129
|
-
`),t.write(`${tt(X)} ${e.title}
|
|
130
|
-
`);for(let g=0;g<r;g++)t.write(`${i}
|
|
131
|
-
`);let a=[{value:"",full:""}],c=!1,h=(g)=>{if(a.length===0)return;let w=0;if(g)w+=r+2;for(let I of a){let{value:b,result:O}=I,E=O?.message??b;if(E.length===0)continue;if(O===void 0&&I.header!==void 0&&I.header!=="")E+=`
|
|
132
|
-
${I.header}`;let L=E.split(`
|
|
133
|
-
`).reduce((ie,ne)=>{if(ne==="")return ie+1;return ie+Math.ceil((ne.length+3)/s)},0);w+=L}if(w>0)w+=1,t.write(te.lines(w))},f=(g,w,I)=>{let b=I?`${g.full}
|
|
134
|
-
${g.value}`:g.value;if(g.header!==void 0&&g.header!=="")V.message(g.header.split(`
|
|
135
|
-
`).map(it),{output:t,secondarySymbol:i,symbol:i,spacing:0});V.message(b.split(`
|
|
136
|
-
`).map(nt),{output:t,secondarySymbol:i,symbol:i,spacing:w??r})},p=()=>{for(let g of a){let{header:w,value:I,full:b}=g;if((w===void 0||w.length===0)&&I.length===0)continue;f(g,void 0,l===!0&&b.length>0)}},d=()=>{for(let g of a)if(g.result)if(g.result.status==="error")V.error(g.result.message,{output:t,secondarySymbol:i,spacing:0});else V.success(g.result.message,{output:t,secondarySymbol:i,spacing:0});else if(g.value!=="")f(g,0)},v=(g,w,I)=>{if(h(!1),(I?.raw!==!0||!c)&&g.value!=="")g.value+=`
|
|
137
|
-
`;if(g.value+=w,c=I?.raw===!0,e.limit!==void 0){let b=g.value.split(`
|
|
138
|
-
`),O=b.length-e.limit;if(O>0){let E=b.splice(0,O);if(l)g.full+=(g.full===""?"":`
|
|
139
|
-
`)+E.join(`
|
|
140
|
-
`)}g.value=b.join(`
|
|
141
|
-
`)}if(u)d()},y=(g,w)=>{if(h(!1),g.result=w,u)d()};return{message(g,w){v(a[0],g,w)},group(g){let w={header:g,value:"",full:""};return a.push(w),{message(I,b){v(w,I,b)},error(I){y(w,{status:"error",message:I})},success(I){y(w,{status:"success",message:I})}}},error(g,w){if(h(!0),V.error(g,{output:t,secondarySymbol:i,spacing:1}),w?.showLog!==!1)p();a.splice(1,a.length-1),a[0].value="",a[0].full=""},success(g,w){if(h(!0),V.success(g,{output:t,secondarySymbol:i,spacing:1}),w?.showLog===!0)p();a.splice(1,a.length-1),a[0].value="",a[0].full=""}}}function un(e){let t=q(e.message);return new mt({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){let s=`${n.gray(m)}
|
|
142
|
-
${W(this.state)} ${t}
|
|
143
|
-
`,i=e.placeholder?n.inverse(e.placeholder[0])+n.dim(e.placeholder.slice(1)):n.inverse(n.hidden("_")),r=!this.userInput?i:this.userInputWithCursor,o=this.value??"";switch(this.state){case"error":{let l=this.error?` ${n.yellow(this.error)}`:"";return`${s.trim()}
|
|
144
|
-
${n.yellow(m)} ${r}
|
|
145
|
-
${n.yellow(T)}${l}
|
|
146
|
-
`}case"submit":{let u=(this.userInput||o!==e.placeholder)&&o?` ${n.dim(o)}`:"";return`${s}${n.gray(m)}${u}`}case"cancel":{let l=o?` ${n.strikethrough(n.dim(o))}`:"";return`${s}${n.gray(m)}${l}${o.trim()?`
|
|
147
|
-
${n.gray(m)}`:""}`}default:return`${s}${n.cyan(m)} ${r}
|
|
148
|
-
${n.cyan(T)}
|
|
149
|
-
`}}}).prompt()}class Se extends Xs{buffer=[];_write(e,t,s){this.buffer.push(e.toString()),s()}}class xt extends Qs{_buffer=[];_read(){if(this._buffer===null){this.push(null);return}for(let e of this._buffer)this.push(e);this._buffer=[]}pushValue(e){this._buffer?.push(e)}close(){this._buffer=null}}function gn(e={}){return Xe(e.name||"")}function Zs(){let e=new Se,t=new Se,s=new xt,i=x.exit,r=x.stdout,o=x.stderr,l=x.stdin,u=console.log;return x.exit=(a)=>{throw Error(`Process exit with code: ${a||0}`)},Object.defineProperty(x,"stdout",{value:e,writable:!0}),Object.defineProperty(x,"stderr",{value:t,writable:!0}),Object.defineProperty(x,"stdin",{value:s,writable:!0}),{stdout:e,stderr:t,stdin:s,originalExit:i,originalStdout:r,originalStderr:o,originalStdin:l,originalConsoleLog:u}}function ei(e){x.exit=e.originalExit,Object.defineProperty(x,"stdout",{value:e.originalStdout,writable:!0}),Object.defineProperty(x,"stderr",{value:e.originalStderr,writable:!0}),Object.defineProperty(x,"stdin",{value:e.originalStdin,writable:!0}),console.log=e.originalConsoleLog}async function $n(e,t,s={}){let i=Date.now(),{inputs:r=[],env:o={},cwd:l=x.cwd(),timeout:u=5000}=s,a=Zs(),{stdin:c,stdout:h,stderr:f}=a,p=t.includes("--help")||t.includes("-h"),d=[];if(x.stdout.write=function(b){let O=b.toString();return d.push(O),h.write(O),!0},console.log=function(...b){let O=b.map((E)=>String(E)).join(" ");d.push(`${O}
|
|
150
|
-
`),h.write(`${O}
|
|
151
|
-
`);return},r.length>0)for(let b of r)c.pushValue(`${b}
|
|
152
|
-
`);let v={...x.env},y=x.cwd();if(Object.entries(o).forEach(([b,O])=>{x.env[b]=O}),l!==y)x.chdir(l);let g,w=0;try{let b=new Promise((E,L)=>{setTimeout(()=>L(Error("Command execution timed out")),u)}),O=Promise.resolve().then(async()=>{try{if(e.showHelpOnExit=!1,e.showVersionOnExit=!1,await e.parse(["node","cli",...t],{run:!1}),p)e.outputHelp();return g=await e.runMatchedCommand(),g}catch(E){throw w=1,f.write(`${E}
|
|
153
|
-
`),E}});await Promise.race([O,b])}catch(b){if(b.message==="Command execution timed out")throw b}finally{if(x.env=v,l!==y)x.chdir(y);ei(a)}let I=Date.now()-i;if(p)w=0;return{stdout:d.join(""),stderr:f.buffer.join(""),exitCode:w,duration:I,outputs:[...d],result:g}}var H=null;function vn(e){H=e}function wn(e){if(!H)return;if(e in H)return H[e];for(let[t,s]of Object.entries(H))if(t.startsWith("/")&&t.endsWith("/i")){let i=t.slice(1,-2);if(new RegExp(i,"i").test(e))return s}else if(t.startsWith("/")&&t.endsWith("/")){let i=t.slice(1,-1);if(new RegExp(i).test(e))return s}if("*"in H)return H["*"];return}function yn(){H=null}var me=null;function bn(){let e=[],t=[],s=x.stdout.write,i=x.stderr.write;x.stdout.write=function(o){return e.push(o.toString()),!0},x.stderr.write=function(o){return t.push(o.toString()),!0};let r={stdout:e,stderr:t,stop:()=>(x.stdout.write=s,x.stderr.write=i,me=null,{stdout:e.join(""),stderr:t.join("")})};return me=r,r}function xn(){if(!me)throw Error("No output capture in progress. Call captureOutput() first.");return me.stdout.join("")}async function Cn(e){let t=await j.mkdtemp(le.join(Js.tmpdir(),"clapp-test-")),s=async(i,r)=>{for(let[o,l]of Object.entries(r)){let u=le.join(i,o);if(typeof l==="object"&&!Ke.isBuffer(l))if(o.endsWith("/"))await j.mkdir(u,{recursive:!0}),await s(u,l);else await j.mkdir(u,{recursive:!0}),await s(u,l);else{let a=le.dirname(u);if(await j.mkdir(a,{recursive:!0}),Ke.isBuffer(l))await j.writeFile(u,l);else if(typeof l==="string")await j.writeFile(u,l,"utf8");else await j.writeFile(u,JSON.stringify(l),"utf8")}}};return await s(t,e),t}async function Sn(e){let t=async(s)=>{let i=await j.readdir(s,{withFileTypes:!0});for(let r of i){let o=le.join(s,r.name);if(r.isDirectory())await t(o);else await j.unlink(o)}await j.rmdir(s)};await t(e)}var _n={outputToContain(e,t){if(!e.stdout.includes(t))throw Error(`Expected output to contain "${t}", but got:
|
|
154
|
-
${e.stdout}`)},outputToMatch(e,t){if(!t.test(e.stdout))throw Error(`Expected output to match ${t}, but got:
|
|
155
|
-
${e.stdout}`)},exitCode(e,t){if(e.exitCode!==t)throw Error(`Expected exit code ${t}, but got ${e.exitCode}`)},completedWithin(e,t){if(e.duration>t)throw Error(`Expected command to complete within ${t}ms, but took ${e.duration}ms`)},outputNotToContain(e,t){if(e.stdout.includes(t))throw Error(`Expected output not to contain "${t}", but it did`)},stderrToContain(e,t){if(!e.stderr.includes(t))throw Error(`Expected stderr to contain "${t}", but got:
|
|
156
|
-
${e.stderr}`)}},In=Xe;export{be as CANCEL_SYMBOL,Qe as CLI,S as CSI,oe as ClappError,_e as Command,ue as ESC,Ie as GlobalCommand,m as S_BAR,T as S_BAR_END,We as S_BAR_H,ks as S_BAR_START,Ce as S_CHECKBOX_ACTIVE,Be as S_CHECKBOX_INACTIVE,Q as S_CHECKBOX_SELECTED,As as S_CONNECT_LEFT,Ns as S_CORNER_BOTTOM_RIGHT,Ms as S_CORNER_TOP_RIGHT,wt as S_ERROR,gt as S_INFO,Vs as S_PASSWORD_MASK,ce as S_RADIO_ACTIVE,he as S_RADIO_INACTIVE,Ts as S_STEP_ACTIVE,ft as S_STEP_CANCEL,pt as S_STEP_ERROR,X as S_STEP_SUBMIT,$t as S_SUCCESS,vt as S_WARN,gi as applyTheme,Ds as autocomplete,Ni as autocompleteMultiselect,ci as beep,vs as block,wi as box,kt as camelcase,ze as camelcaseOptionName,Pi as cancel,bn as captureOutput,Sn as cleanupTestFS,mi as clear,Xe as cli,xi as cliCache,F as codes,Ri as confirm,gn as createTestCLI,Cn as createTestFS,k as cursor,In as default,ps as diffLines,te as erase,$n as execCommand,_n as expect,Bt as findAllBrackets,Me as findLongest,Ye as findSimilarCommands,$i as getAvailableThemes,ws as getColumns,At as getFileName,xn as getLastOutput,wn as getMockResponse,Tt as getMriOptions,ji as group,Li as groupMultiselect,Fi as intro,Oe as isActionKey,dt as isCI,$s as isCancel,Bs as isTTY,Nt as isUnicodeSupported,Rt as levenshteinDistance,se as limitOptions,V as log,vn as mockPrompt,Ui as multiselect,qi as note,Si as onUnknownSubcommand,Hi as outro,pe as padRight,yi as panel,zi as password,Xi as path,q as processMarkdown,en as progress,ve as removeBrackets,yn as resetMockPrompts,hi as scroll,tn as select,sn as selectKey,vi as setAccessibility,Mt as setByType,Vt as setDotProp,re as setRawMode,Ft as setTheme,N as settings,Zs as setupTest,bt as spinner,Y as stream,K as style,W as symbol,bi as table,ln as taskLog,on as tasks,ei as teardownTest,oi as telemetry,un as text,ye as themes,xe as unicode,C as unicodeOr,Bi as updateSettings};
|
package/dist/chunk-qh9cawym.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import"./chunk-awmb5sg5.js";var e="pickier",u="module",t="0.1.65",r="Format, lint and more in a fraction of seconds.",s="Chris Breuer <chris@stacksjs.org>",l="MIT",p="https://github.com/pickier/pickier#readme",b={type:"git",url:"git+https://github.com/pickier/pickier.git"},c={url:"https://github.com/pickier/pickier/issues"},m=["pickier","linter","formatter","bun","fast"],o={".":{types:"./dist/src/index.d.ts",import:"./dist/src/index.js"},"./*":{import:"./dist/*"}},a="./dist/src/index.js",x="./dist/src/index.d.ts",d={pickier:"./dist/bin/cli.js"},w=["README.md","dist"],k={build:"bun --bun build.ts","build:bin":"bun --bun build.ts && bun run compile",compile:"bun build ./bin/cli.ts --compile --minify --outfile bin/pickier","compile:all":"bun run compile:linux-x64 && bun run compile:linux-arm64 && bun run compile:linux-x64-musl && bun run compile:linux-arm64-musl && bun run compile:windows-x64 && bun run compile:windows-arm64 && bun run compile:darwin-x64 && bun run compile:darwin-arm64","compile:linux-x64":"bun build ./bin/cli.ts --compile --minify --target=bun-linux-x64 --outfile bin/pickier-linux-x64","compile:linux-arm64":"bun build ./bin/cli.ts --compile --minify --target=bun-linux-arm64 --outfile bin/pickier-linux-arm64","compile:linux-x64-musl":"bun build ./bin/cli.ts --compile --minify --target=bun-linux-x64-musl --outfile bin/pickier-linux-x64-musl","compile:linux-arm64-musl":"bun build ./bin/cli.ts --compile --minify --target=bun-linux-arm64-musl --outfile bin/pickier-linux-arm64-musl","compile:windows-x64":"bun build ./bin/cli.ts --compile --minify --target=bun-windows-x64 --outfile bin/pickier-windows-x64.exe","compile:windows-arm64":"bun build ./bin/cli.ts --compile --minify --target=bun-windows-arm64 --outfile bin/pickier-windows-arm64.exe","compile:darwin-x64":"bun build ./bin/cli.ts --compile --minify --target=bun-darwin-x64 --outfile bin/pickier-darwin-x64","compile:darwin-arm64":"bun build ./bin/cli.ts --compile --minify --target=bun-darwin-arm64 --outfile bin/pickier-darwin-arm64",zip:"bun run zip:all","zip:all":"bun run zip:linux-x64 && bun run zip:linux-arm64 && bun run zip:linux-x64-musl && bun run zip:linux-arm64-musl && bun run zip:windows-x64 && bun run zip:windows-arm64 && bun run zip:darwin-x64 && bun run zip:darwin-arm64","zip:linux-x64":"zip -j bin/pickier-linux-x64.zip bin/pickier-linux-x64","zip:linux-arm64":"zip -j bin/pickier-linux-arm64.zip bin/pickier-linux-arm64","zip:linux-x64-musl":"zip -j bin/pickier-linux-x64-musl.zip bin/pickier-linux-x64-musl","zip:linux-arm64-musl":"zip -j bin/pickier-linux-arm64-musl.zip bin/pickier-linux-arm64-musl","zip:windows-x64":"zip -j bin/pickier-windows-x64.zip bin/pickier-windows-x64.exe","zip:windows-arm64":"zip -j bin/pickier-windows-arm64.zip bin/pickier-windows-arm64.exe","zip:darwin-x64":"zip -j bin/pickier-darwin-x64.zip bin/pickier-darwin-x64","zip:darwin-arm64":"zip -j bin/pickier-darwin-arm64.zip bin/pickier-darwin-arm64",prepublishOnly:"bun --bun run build && bun run compile:all && bun run zip",test:"PICKIER_NO_AUTO_CONFIG=1 bun test --coverage","test:core":"PICKIER_NO_AUTO_CONFIG=1 bun test test/core","test:format":"PICKIER_NO_AUTO_CONFIG=1 bun test test/format","test:lint":"PICKIER_NO_AUTO_CONFIG=1 bun test test/lint","test:rules":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules","test:rules:sort":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules/sort","test:rules:style":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules/style","test:rules:quality":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules/quality","test:rules:imports":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules/imports","test:rules:typescript":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules/typescript","test:rules:regexp":"PICKIER_NO_AUTO_CONFIG=1 bun test test/rules/regexp","test:plugin":"PICKIER_NO_AUTO_CONFIG=1 bun test test/plugin","test:watch":"PICKIER_NO_AUTO_CONFIG=1 bun test --watch"},I={"@stacksjs/clarity":"^0.3.24","@stacksjs/clapp":"^0.2.3"},O={"@stacksjs/ts-spell-check":"^0.1.0"},_={bunfig:"^0.15.13"},z={name:e,type:u,version:t,description:r,author:s,license:l,homepage:p,repository:b,bugs:c,keywords:m,exports:o,module:a,types:x,bin:d,files:w,scripts:k,dependencies:I,optionalDependencies:O,devDependencies:_};export{s as author,d as bin,c as bugs,z as default,I as dependencies,r as description,_ as devDependencies,o as exports,w as files,p as homepage,m as keywords,l as license,a as module,e as name,O as optionalDependencies,b as repository,k as scripts,u as type,x as types,t as version};
|
package/dist/chunk-sj3ctzyt.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{H as u,k as m}from"./chunk-vdbbvx8x.js";import{Q as y}from"./chunk-awmb5sg5.js";import{readFileSync as O,statSync as p,writeFileSync as x}from"fs";import{isAbsolute as d,resolve as l}from"path";async function R(r,t){let a=t.mode||"auto";if(a==="format"&&r.length===1&&!/[*?[\]{}()!]/.test(r[0]))try{let n=r[0],i=d(n)?n:l(process.cwd(),n);if(p(i).isFile()){let o=await u(t.config),c=O(i,"utf8"),f=m(c,o,i);if(t.check&&f!==c)return 1;if(t.write&&f!==c)x(i,f,"utf8");return 0}}catch{}let{runLint:e}=await import("./chunk-bnbsk67m.js");if(a==="lint")return e(r,t);if(a==="format"){let n={...t,fix:!0,dryRun:!!t.check,ext:t.ext,_formatOnly:!0};return e(r,n)}if(!(t.fix===!0||t.write===!0||t.check===!0))return e(r,t);let s={...t,fix:!0,dryRun:!!t.check,ext:t.ext};return e(r,s)}
|
|
3
|
-
export{R as h};
|