@abw/badger 1.3.4 → 1.3.5

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.
@@ -1,2 +1,2 @@
1
- import{splitList as t,isObject as e,doNothing as n,fail as o,isArray as r,noValue as i,isString as s,isBoolean as a,splitHash as c,hasValue as l,joinListOr as h,isInteger as p,extract as g,splitLines as u,debounce as f,sleep as d}from"@abw/badger-utils";import{DirPath as m,bin as b,cwd as w,dir as y,file as $}from"@abw/badger-filesystem";export*from"@abw/badger-filesystem";import v from"node:process";import x from"prompts";import{Command as C}from"commander";import{now as j}from"@abw/badger-timestamp";import k from"chokidar";import E from"node:child_process";export*from"@abw/badger-codecs";const T={reset:0,bold:1,bright:1,dark:2,black:0,red:1,green:2,yellow:3,blue:4,magenta:5,cyan:6,grey:7,white:8,fg:30,bg:40},D={fg:t=>`38;2;${t.r};${t.g};${t.b}`,bg:t=>`48;2;${t.r};${t.g};${t.b}`},P=(e,n="fg")=>{const o=(t=>{const e=t.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null})(e)||(e=>{const n=t(e);return 3===n.length?{r:n[0],g:n[1],b:n[2]}:null})(e);return o?((t,e="fg")=>"["+D[e](t)+"m")(o,n):((t,e="fg")=>{let n=[],o=t.split(/ /,2);const r=o.pop(),i=(e?T[e]:0)+T[r];if(n.push(i),o.length){const t=o.length?o.shift():"dark";n.push(T[t])}return"["+n.join(";")+"m"})(e,n)},S=(t={})=>{const n=e(t)?t:{fg:t};let o=[];return n.bg&&o.push(P(n.bg,"bg")),n.fg&&o.push(P(n.fg,"fg")),o.join("")},q=P("reset",!1),F=()=>q,N=t=>(...e)=>S(t)+e.join("")+q,z=t=>Object.entries(t).reduce((t,[e,n])=>(t[e]=N(n),t),{}),A=N("black"),I=N("red"),L=N("green"),O=N("yellow"),W=N("blue"),M=N("magenta"),U=N("cyan"),G=N("grey"),R=N("white"),V=N("bright black"),Y=N("bright red"),B=N("bright green"),H=N("bright yellow"),Q=N("bright blue"),_=N("bright magenta"),J=N("bright cyan"),K=N("bright grey"),X=N("bright white"),Z=N("dark black"),tt=N("dark red"),et=N("dark green"),nt=N("dark yellow"),ot=N("dark blue"),rt=N("dark magenta"),it=N("dark cyan"),st=N("dark grey"),at=N("dark white");function ct(t,e="",o){return t?e?(t,...n)=>console.log("%s"+e+"%s"+t,o?S(o):"",F(),...n):console.log.bind(console):n}function lt(t,e,n="",o){t.debug=ct(e,n,o)}class ht{constructor(t,e={}){this.workspace=t,this.props=e,lt(this,e.debug,e.debugPrefix,e.debugColor),this.initComponent(e)}initComponent(){}}const pt={b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v",'"':'"',"'":"'","\\":"\\"},gt=t=>{const e=t.match(/^"((?:\\[\\"bfnrtv]|.)*?)"$/);return e?e[1].replace(/\\([\\"bfnrtv])/g,(t,e)=>pt[e]||`\\${e}`):null},ut=t=>{const e=t.match(/^'((?:\\[\\'bfnrtv]|.)*?)'$/);return e?e[1].replace(/\\([\\'bfnrtv])/g,(t,e)=>pt[e]||`\\${e}`):null},ft=t=>{let e,n,r=[];for(;t.length;){let i,s;(n=t.match(/^(\/+)/))?t=t.slice(n[1].length):(t.match(/^(\?)/)&&(t=t.slice(1),i=!0),(n=t.match(/^('((\\[\\'bfnrtv]|.)*?)')/))?(t=t.slice(n[1].length),e=n[2].replace(/\\([\\'bfnrtv])/g,(t,e)=>pt[e]||`\\${e}`)):(n=t.match(/^("((\\[\\"bfnrtv]|.)*?)")/))?(t=t.slice(n[1].length),e=n[2].replace(/\\([\\"bfnrtv])/g,(t,e)=>pt[e]||`\\${e}`)):(n=t.match(/^([^/?]+)/))?(e=n[1],t=t.slice(e.length)):o(`Can't parse data path: ${t}`),t.match(/^(\?)/)&&(t=t.slice(1),s=!0),i?r.push([e,{maybe:!0}]):s?r.push([e,{optional:!0}]):r.push(e))}return r},dt=(t,e)=>{let n=t,s=ft(e),a=[];for(let t of s){const[e,s]=r(t)?t:[t,{}],c=n[e];if(a.push(e),i(c)){if(s.maybe)return n;if(s.optional)return;o("No value for data at path: ",a.join("/"))}n=c}return n},mt={codec:["yaml","json"],jsExt:["js","mjs"]};class bt extends m{constructor(e,n={}){super(e);const o={...mt,...n};this.state.codec=t(o.codec),this.state.jsExt=t(o.jsExt),lt(this,n.debug,n.debugPrefix,n.debugColor)}async firstFileWithExt(t,e,o=n){const r=await this.dirs();for(let n of r)for(let r of e){const e=t+"."+r,i=n.file(e,o(t,r));if(this.debug("looking for config file: ",i.path()),await i.exists())return this.debug("config file exists: ",i.path()),i}}async jsFile(t){return await this.firstFileWithExt(t,this.state.jsExt)}async file(t){return await this.firstFileWithExt(t,this.state.codec,(t,e)=>({codec:e}))}async config(t,e){const[n,r]=t.split("#",2);let i,s,a;if(i=await this.jsFile(n))a=await import(i.path());else if(s=await this.file(n))a=await s.read();else{if(!e)return o("No configuration file for "+n);a=e}return r?dt(a,r):a}}const wt=(t,e)=>new bt(t,e),yt={jsExt:"js mjs"};class $t extends m{constructor(e,n={}){super(e);const o={...yt,...n},r=t(o.jsExt).map(t=>t.replace(/^\./,""));this.state.exts=r,lt(this,n.debug,n.debugPrefix,n.debugColor),this.debug("state: ",this.state)}async library(t){const[e,n]=t.split("#",2),r=await this.dirs(),i=this.state.exts;for(let t of r)for(let o of i){const r=t.file(e+"."+o);this.debug("looking for module %s as",e,r.path());if(await r.exists()){const t=await import(r.path());return this.debug("loaded %s as",r.path()),n?dt(t,n):t}}o("Library not found: ",t)}}const vt=(t,e)=>new $t(t,e),xt=t=>async function(...e){try{const n=await t(...e);return n&&console.log(B(`✓ ${n}`)),!0}catch(t){return console.log(v.env.DEBUG?t:Y(`✗ ${t.message||t}`)),!1}},Ct=async(t,e={})=>{const n=(e=s(e)?{default:e}:e).name||"answer";return(await x([{name:n,type:e.type||"text",message:t,initial:e.default}]))[n]},jt=async(t,e={})=>(e=a(e)?{default:e}:e,Ct(t,{...e,type:"confirm"})),kt=async(t,e,n)=>(await x([{type:"select",name:"selected",message:t,initial:n,choices:r(e)?e:Object.entries(e).map(([t,e])=>({value:t,title:e}))}])).selected,Et=()=>v.argv.slice(2);function Tt(t,e){t?r(t)&&(e=t,t={}):t={},e||(e||=Et());const n=!!t.options&&c(t.options),i=t.others||"error",s=t.short||{},a=t.on||{};let h=!1,p=0,g={};for(;p<e.length;){const t=e[p].match(/^-(-)?(.*)/);if("--"===e[p]&&(h=!0,e.splice(p,1)),t&&!h){const r=!("-"===t[1])&&l(s[t[2]])?s[t[2]]:t[2];if(a[r]){if(a[r](r,e.splice(p,1)[0],e,g))continue;e.splice(p,0,t[0])}if(n&&!n[r])switch(i){case"collect":break;case"remove":e.splice(p,1)[0];case"keep":p++;continue;case"error":return o(`Invalid command line flag: ${t[0]}`);default:return o(`Invalid "others" option: ${i}`)}e.splice(p,1),g[r]=!0}else p++}return{flags:g,args:e}}async function Dt(t,e=Et()){return e.length?e.shift():t?await Ct(t):void 0}async function Pt(t,e=Et()){let n=[];if(t){for(let o of t){const t=await Dt(o,e);if(!t?.length)return;n.push(t)}return n}return e}const St=".env",qt=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;async function Ft({filename:t=St,dirs:e=[b(),w()],walkup:n=!0}){const r={},i=e.map(t=>y(t));for(;i.length;){const e=i.shift();if(!r[e.path()]){r[e.path()]=!0;const o=e.file(t);if(await o.exists())return o.path();n&&i.push(e.up())}}o(`Cannot locate ${St} file in any parent directory of ${e.join(", ")}`)}function Nt(t){const e={},n=t.toString().replace(/\r\n?/gm,"\n");let o;for(;null!=(o=qt.exec(n));){const t=o[1];let n=o[2]??"";n=n.trim();const r=n[0];n=n.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),'"'===r&&(n=n.replace(/\\n/g,"\n"),n=n.replace(/\\r/g,"\r")),e[t]=n}return e}async function zt({path:t,filename:e,dirs:n,addToProcessEnv:r=!0,debug:i=!1}={}){t||=await Ft({filename:e,dirs:n}),i&&console.log(`Loading environment from ${t}`);const s=$(t);await s.exists()||o(`Specified environment file does not exist: ${t}`);const a=Nt(await s.read());return i&&console.log("Loaded environment:",a),r&&(Object.assign(v.env,a),i&&console.log("Added environment to process.env")),a}function At(t,e){e&&console.log(e),v.exit(t)}function It(t){At(0,t)}function Lt(t){At(1,t)}function Ot(t=v.argv){return t.slice(2)}const Wt={verboseColor:"magenta",titleColor:"bright yellow",underlineColor:"dark yellow",infoColor:"cyan",tickColor:"green",questionColor:"bright white",answerColor:"bright green",sectionNewlines:!0},Mt=async e=>{const n=N(Mt.verboseColor||Wt.verboseColor),r=new C;e.name&&r.name(e.name),e.description&&r.description(e.description),e.version&&r.version(e.version),e.yes&&r.option("-y, --yes","Accept default answers"),e.verbose&&r.option("-v, --verbose","Verbose output"),e.quiet&&r.option("-q, --quiet","Quiet output"),e.options?.filter(t=>!(l(t.arg)&&!t.arg)&&(t.title?void 0:l(t.name))).forEach(t=>{const e=t.name,n=t.about,o=t.default,i=t.handler,s=t.short,a=t.type,c=t.pattern||(l(a)?`<${a}>`:void 0);let h=`--${e}`,p=[];l(s)&&(h=`-${s}, ${h}`),l(c)&&(h=`${h} ${c}`),p.push(h),l(n)&&p.push(n),l(i)&&p.push(i),l(o)&&p.push(o),r.option(...p)});let i={};e.commands?.forEach(e=>{const n=e.name,s=e.about,a=e.type,c=e.pattern||(l(a)?`<${a}>`:void 0);let h=[],p=n,g=r.command(p);l(c)&&g.argument(c),l(s)&&g.description(s),l(e.arguments)&&t(e.arguments).forEach(t=>{h.push(function(t){const e=t.match(/(\w+)/);e||o("Can't parse argument name: ",t);return e[1]}(t)),g.argument(t)}),g.action((...t)=>{i[n]=h.length?h.reduce((e,n)=>(e[n]=t.shift(),e),{}):t[0]})}),r.parse();const s=r.opts(),a=e.yes&&s.yes,c=e.verbose&&s.verbose,h=e.quiet&&s.quiet;a&&(c&&!h&&v.stdout.write(n("Accepting default answers (-y option is set)\n")),x.override(s));let p=[];e.options?.forEach(t=>{const e=t.type||"text",n=t.name,o=t.prompt,r=l(t.arg)&&!t.arg,i=t.validate||(t.required?t=>!(!l(t)||!t.toString().length)||(Mt.invalid||`You must enter a value for ${n}`):void 0);let c=r?t.default:s[n];"select"===e&&l(c)&&(Number.isInteger(c)||(c=t.choices?.findIndex(t=>t.value===c),c<0&&(c=0))),l(o)?p.push({...t,type:l(c)?()=>(a&&(h||Gt({question:o,answer:c})),e):e,name:n,message:o,initial:c,validate:i}):(t.title||t.info)&&p.push({type:()=>(h||Ut(t),!1)})});let g=!1;const u=await x(p,{onCancel:()=>(g=!0,!1)});return g?void 0:{...s,...u,...i}};const Ut=t=>{const e=t.title,n=N(t.titleColor||Wt.titleColor),o=N(t.underlineColor||Wt.underlineColor),r=N(t.infoColor||Wt.infoColor),i=(l(t.newlines)?t.newlines:Wt.sectionNewlines)?"\n":"";if(e){const t="-".repeat(e.length);v.stdout.write(i+n(e)+"\n"+o(t)+"\n"+i)}t.info&&v.stdout.write(r(t.info)+"\n"+i)},Gt=t=>{const e=N(t.tickColor||Wt.tickColor),n=N(t.questionColor||Wt.questionColor),o=N(t.answerColor||Wt.answerColor);v.stdout.write(e("✔ ")+n(t.question)+" "+o(t.answer)+"\n")};function Rt(t={},e){const n=t[e];if(l(n))return n;o("Missing value for required parameter: ",e)}function Vt(e={},n){return t(n).map(t=>Rt(e,t))}const Yt=Vt;function Bt(e,n){let r=!1;const i=t(n),s=i.map(t=>{const n=e[t];return l(n)&&(r=!0),n});return r?s:o("Missing value for one of: ",h(i))}const Ht={border:"┌─┐│└─┘|-",background:"+∙",fill:"*"},Qt={border:"green",background:"dark grey",foreground:"blue",fill:"bright yellow"},_t={charTypes:Ht,source:"\n┌────────────────────────────────────────────────────────────────┐\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙ ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ∙∙ │\n│ ∙∙ ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ∙∙ │\n│ ∙∙ ●● ◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦ ●● ∙∙ │\n│ ∙∙ ●● ◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦ ●● ∙∙ │\n│ ∙∙∙ ●● ◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦ ●● ∙∙∙ │\n│ ∙∙∙∙ ●● ◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦ ●● ∙∙∙∙ │\n│ ∙∙∙∙∙ ●● ◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦ ●● ∙∙∙∙∙ │\n│ ∙∙∙∙∙∙ ●● ◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦ ●● ∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙ ●● *◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦* ●● ∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙ ●● **◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦** ●● ∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙ ●● *****◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦***** ●● ∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● *******◦◦◦◦◦◦◦◦◦◦******* ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● ****************** ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● ************ ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● ****** ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● **** ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● **** ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● **** ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● ◦****◦ ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● ◦◦◦◦****◦◦◦◦ ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● ◦◦◦◦◦◦◦****◦◦◦◦◦◦◦ ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● ◦◦◦◦◦◦◦◦◦******◦◦◦◦◦◦◦◦◦ ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙ ●● ◦◦◦◦◦◦◦◦◦◦◦********◦◦◦◦◦◦◦◦◦◦◦ ●● ∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙ ●● ◦◦◦◦◦◦◦◦◦◦◦************◦◦◦◦◦◦◦◦◦◦◦ ●● ∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙ ●● ◦◦◦◦◦◦◦◦◦◦******************◦◦◦◦◦◦◦◦◦◦ ●● ∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙ ●● ◦◦◦◦◦◦◦◦◦************************◦◦◦◦◦◦◦◦◦ ●● ∙∙∙∙∙∙ │\n│ ∙∙∙∙∙ ●● ◦◦◦◦◦◦◦******************************◦◦◦◦◦◦◦ ●● ∙∙∙∙∙ │\n│ ∙∙∙∙ ●● ◦◦◦◦◦************************************◦◦◦◦◦ ●● ∙∙∙∙ │\n│ ∙∙∙ ●● ◦◦◦◦****************************************◦◦◦◦ ●● ∙∙∙ │\n│ ∙∙ ●● ◦◦◦********************************************◦◦◦ ●● ∙∙ │\n│ ∙∙ ●● ◦◦**********************************************◦◦ ●● ∙∙ │\n│ ∙∙ ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ∙∙ │\n│ ∙∙ ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n└────────────────────────────────────────────────────────────────┘\n"},Jt={size:100,elapsed:!1,picture:_t,colours:Qt};function Kt(t){const{source:e,charTypes:n={background:""}}=t,o=e.trim()+"\n",r=o.length,i=Object.entries(n).reduce((t,[e,n])=>(n.split("").forEach(n=>t[n]=e),t),{});return{picture:o,length:r,lineLength:e.split("\n").reduce((t,e)=>Math.max(t,e.length),0),charType:i}}function Xt(t){return Object.entries(t).reduce((t,[e,n])=>(t[e]=N(n),t),{})}function Zt(t){const{picture:e,charType:n={},colours:o={}}=t;return e.split("").map(t=>{const e=n[t]||"foreground",r=o[e];return r?r(t):t}).join("")}function te(t){const e=t%60,n=Math.floor(t/60);return[Math.floor(t/3600),n,e].map(t=>t.toString().padStart(2,"0")).join(":")}class ee{constructor(t={}){const e={...Jt,...p(t)?{size:t}:t},{size:n,colours:o,colors:r,debug:i,elapsed:a}=e,{picture:c,length:l,lineLength:h,charType:g}=Kt(s(e.picture)?{source:e.picture,charTypes:Ht}:e.picture);this.size=n,this.picture=c,this.pixels=this.picture.split(""),this.length=l,this.lineLength=h,this.charType=g,this.colours=Xt(r||o),this.count=0,this.lastCount=0,this.lastPixel=0,this.startTime=j().epochSeconds(),this.elapsed=0,this.elapsedCol=N("dark grey"),this.showElapsed=a,this.debugging=i,lt(this,i,"Progress > ","blue")}progress(t=1){this.count+=t;const e=j().epochSeconds()-this.startTime;this.elapsed=e;const n=Math.floor(this.length*this.count/this.size);if(n>this.lastPixel){const t=this.lastPixel;return this.lastPixel=n,this.debug(`count: ${this.count}/${this.size} pixels from ${t} to ${n}`),this.pictureSegment(t,n)}return""}remains(){this.count=this.size;const t=this.lastPixel,e=this.length;return e>t?(this.lastPixel=this.length,this.pictureSegment(t,e)):""}pictureSegment(t,e){if(this.debugging)return"";let n=Zt({picture:this.picture.substring(t,e),charType:this.charType,colours:this.colours});if(this.showElapsed&&n.match("\n")){const t=n.split("\n"),e=t.pop();n=t.map(t=>t+" "+this.elapsedCol(te(this.elapsed))).join("\n").concat("\n",e)}return n}printProgress(t=1){v.stdout.write(this.progress(t))}printRemains(){v.stdout.write(this.remains())}}const ne=t=>new ee(t),oe={description:"Project setup script.",configFiles:["config/setup.yaml","config/setup.json","setup.yaml","setup.json",".setup.yaml",".setup.json"],dataFile:".env.yaml",envFile:".env",envComments:!0,envSections:!0,writeData:!0,writeEnv:!1,compact:!1,cancelled:"Setup cancelled",allDone:"All configuration options have been set",warning:t=>`\n#=============================================================================\n# WARNING: This file is generated automatically when the ${t.scriptName}\n# script is run. Any changes made here may be lost.\n#\n# Generated: ${j()}\n#=============================================================================\n\n`},re=xt(async t=>{await ie(t)});async function ie(t){const e={...oe,...t},n=e.rootDir?y(e.rootDir):w(),r=n.file(e.envFile),i=zt({path:r.path()}),s=n.file(e.dataFile,{codec:"auto"}),c=await s.exists()?await s.read():{},h=e.configFile?n.file(e.configFile,{codec:"auto"}):await se(n,e.configFiles),p=await h.read();p.name||=e.name||v.argv[1].replace(n.path()+"/",""),p.version||=e.version,p.description||=e.description,t.preprocess&&await t.preprocess(p);const u={root:n.path(),...e.values||{}},f={quiet:!0,verbose:!0,yes:!0};for(let t of p.options){const{name:e,save:n}=t;if(a(n)&&!n&&(f[e]=!0),!e)continue;t.pattern&&(t.type||="text");const o=t.envvar||=e.toUpperCase();l(i[o])?t.default=i[o]:l(c[e])?t.default=c[e]:l(u[e])?t.default=u[e]:t.program&&(t.default=await ae(t.program),t.pattern||="<path>")}const d=await Mt(p);d||It("\n👎 "+Y(e.cancelled));const{debug:m,verbose:b,quiet:$}=d;return e.writeData&&(await s.write(g(d,t=>!f[t])),b&&console.log(B(`✓ Wrote data file: ${s}`))),e.writeEnv&&(await r.write(await async function(t,e,n,r){const{compact:i,envComments:s,envSections:c,envPrefix:h=""}=e,p=i?"":"\n";let g=[ce(e.warning(e))];const u="#"+"-".repeat(77),f="#"+"=".repeat(77);for(let t of n.options){const{name:e,envvar:n,title:o,about:f,save:d}=t;if(!a(d)||d)if(o&&c)g.push(`${p}\n${u}\n${ce(o)}\n${u}`);else if(i||g.push(""),f&&s&&g.push(`${ce(f)}`),e){const t=r[e];if(l(t)){const o=t.toString().match(/[#\r\n]/)?'"$value"':t;g.push(`${h}${n||e.toUpperCase()}=${o}`)}else g.push(ce(`No value for ${n||e.toUpperCase()}`))}}if(e.envExtra){const n=t.file(e.envExtra);await n.exists()||o(`Cannot find envExtra file: ${e.envExtra}`),c&&g.push("\n",f,ce(` Additional configuration copied from ${e.envExtra}`),f,""),g.push(await n.read())}return g.join("\n")+"\n"}(n,e,p,d)),b&&console.log(B(`✓ Wrote .env file: ${r}`))),m&&console.log("\nGenerated configuration:",d),e.allDone&&!$&&console.log("\n👍 ",B(e.allDone),"\n"),d}async function se(t,e=[]){for(let n of e){const e=t.file(n,{codec:"auto"});if(await e.exists())return e}o("Can't find a configFile: ",e.join(", "))}async function ae(e){for(let n of t(e))for(let t of v.env.PATH.split(":")){const e=y(t).file(n);if(await e.exists())return e.path()}}function ce(t){return u(t.trim()).map(t=>t.match(/^#/)?t:`# ${t}`).join("\n")}const le={script:v.argv[1].split("/").at(-1),prefix:"watcher >",colors:{prefix:"dark grey",error:"bright red",watcher:"bright yellow",section:"bright white",program:"bright green",arg:"bright cyan",args:"bright blue",debug:"bright grey",command:"yellow",scanning:"cyan",watching:"cyan",change:"bright cyan",starting:"bright green",stopping:"bright red",stopped:"green",failed:"bright red"}};async function he(t){const{config:e,cmdLine:n}=pe(t),o=await n(),{watch:r,restart:i,program:s,programArgs:a}=o,{scanning:c,watching:l,starting:h,stopping:p,failed:g,stopped:u,change:m}=ge({...e,...o});let b,w=!1;c(),l(r);const y=()=>{b||(h(),b=E.spawn(s,a,{stdio:"inherit"}),b.on("exit",(t,e)=>{e||(t?g(t):u(),i?(b=null,d(500).then(y)):At(t))}))},$=f(()=>{b&&(p(),b.kill(),b=null),y()},300);k.watch(r).on("ready",()=>{y(),w=!0}).on("all",(t,e)=>{w&&(m(t,e),$())})}const pe=t=>{const e={...le,...t},n=e.colors=z({...le.colors,...e.colors}),o=ue(e),r=()=>It(o()),i=t=>Lt(o(t));return{config:e,colors:n,helpText:o,help:r,barf:i,cmdLine:async()=>{const{flags:t,args:e}=Tt({options:"watch restart verbose help",others:"keep",short:{w:"watch",r:"restart",v:"verbose",h:"help"},on:{help:r,watch:(t,e,n,o)=>(o.watch||=[],n.length||i("The -w option expects an argument!"),o.watch.push(n.shift()),!0)}}),[n,...o]=e,s=e.join(" ");return e.length<1&&i("No program specified to run!"),t.watch?.length||i("Nothing specified to watch!"),await $(n).exists()||i(`Program not found: ${n}`),{...t,progText:s,program:n,programArgs:o}}}},ge=({verbose:t,colors:e,prefix:o,progText:r})=>({scanning:()=>t?console.log(e.prefix(o),e.scanning("scanning...")):n,watching:r=>t?r.forEach(t=>console.log(e.prefix(o),e.watching("watching "),e.command(t))):n,change:(r,i)=>t?console.log(e.prefix(o),e.change(`${r}`.padEnd(9)),e.command(i)):n,starting:()=>t?console.log(e.prefix(o),e.starting("starting "),e.command(r)):n,stopping:()=>t?console.log(e.prefix(o),e.stopping("stopping "),e.command(r)):n,failed:i=>t?console.log(e.prefix(o),e.failed(`failed ${i}`),e.command(r)):n,stopped:()=>t?console.log(e.prefix(o),e.stopped("stopped "),e.command(r)):n}),ue=({colors:t,script:e})=>{const{watcher:n,arg:o,section:r,program:i,args:s,error:a}=t,c=n(e);return t=>`${c}\n${t?`\n${a(t)}\n`:""}\n${r("Usage")}\n\n $ ${c} [${o("options")}] ${i("program")} [${s("arg1 arg2 ...")}]\n\n${r("Description")}\n\n This program will run another program and restart it if any files\n are added, deleted or modified in one or more watched locations.\n\n Paths to watch should be specified using the ${o("-w")} (or ${o("--watch")})\n option. You can specify this multiple times for different paths.\n\n The path to the ${i("program")} should follow, along with any additional\n ${s("arguments")} to be passed to it.\n\n If the ${o("-r")} (or ${o("--restart")}) option is specified then the\n program will be restarted when it exits.\n\n${r("Options")}\n\n ${o("-w <path>")} / ${o("--watch <path>")} Watch a path for changes\n ${o("-r")} / ${o("--restart")} Restart program on exit\n ${o("-v")} / ${o("--verbose")} Verbose mode\n ${o("-h")} / ${o("--help")} This help\n\n${r("Examples")}\n\n $ ${c} ${o("-w .")} ${i("bin/foo.js")}\n $ ${c} ${o("-w lib -w config")} ${i("bin/foo.js")}\n $ ${c} ${o("-w lib -w config")} ${i("bin/foo.js")} ${s("bar baz")}\n $ ${c} ${o("-w lib -w config -v")} ${i("bin/foo.js")} ${s("bar baz")}\n $ ${c} ${o("-w lib -w config -v -r")} ${i("bin/foo.js")} ${s("bar baz")}\n`},fe={dir:"config"},de={dir:"lib library src components"},me={};class be{constructor(e,n={}){const o=y(e),r=t(n.config?.dir||fe.dir).map(t=>o.dir(t)),i={...fe,...n.config||{}},s=new bt(r,i),a=t(n.library?.dir||de.dir).map(t=>o.dir(t)),c={...de,...n.library||{}},l=new $t(a,c);this.case={...me,...n.case||{}},this.state={rootDir:o,config:s,library:l},lt(this,n.debug,n.debugPrefix,n.debugColor),this.debug("root dir: ",o.path()),this.debug("config dir: ",r.map(t=>t.path())),this.debug("libDirs: ",a),this.debug("libOpts: ",c)}dir(t,e){return this.debug("dir(%s, %o)",t,e),l(t)?this.state.rootDir.dir(t,e):this.state.rootDir}file(t,e){return this.debug("file(%s, %o)",t,e),this.state.rootDir.file(t,e)}read(t,e){return this.debug("read(%s, %o)",t,e),this.file(t,e).read()}write(t,e,n){return this.debug("write(%s, %o, %o)",t,e,n),this.file(t,n).write(e)}configDir(t,e){return this.debug("configDir(%s, %o)",t,e),l(t)?this.state.configDir.dir(t,e):this.state.configDir}async config(t,e){return this.debug("config(%s, %o)",t,e),l(t)?this.state.config.config(t,e):this.state.config}async library(t){return this.debug("library(%s, %o)",t),l(t)?this.state.library.library(t):this.state.library}async component(t,e){const[n,r]=t.split("#",2),i=this.convertCase("config",n),s=await this.config(i,{}),a=s.component?.library||this.convertCase("library",n),c=await this.library(a),l=r||s.component?.export||"default";return new(c[l]||o("No '",l,"' export from component library: ",t))(this,{...s,...e})}convertCase(t,e){const n=this.case[t];return n?n(e):e}}const we=(t,e)=>new be(t,e);export{S as ANSIescape,P as ANSIescapeCode,F as ANSIreset,q as ANSIresetCode,ht as Component,bt as Config,ct as Debugger,$t as Library,ee as Progress,be as Workspace,Lt as abort,lt as addDebug,Yt as allParams,Gt as answer,Bt as anyParams,xt as appStatus,Ot as args,A as black,W as blue,V as brightBlack,Q as brightBlue,J as brightCyan,B as brightGreen,K as brightGrey,_ as brightMagenta,Y as brightRed,X as brightWhite,H as brightYellow,Ht as charTypes,Et as cmdLine,Dt as cmdLineArg,Pt as cmdLineArgs,Tt as cmdLineFlags,N as color,Qt as colours,wt as config,jt as confirm,U as cyan,Z as darkBlack,ot as darkBlue,it as darkCyan,et as darkGreen,st as darkGrey,rt as darkMagenta,tt as darkRed,at as darkWhite,nt as darkYellow,dt as dataPath,Wt as defaults,zt as dotenv,At as exit,Ft as findDotenv,se as findFirstFile,ae as findProgram,te as formatElapsed,Zt as formatPicture,L as green,G as grey,vt as library,M as magenta,gt as matchDoubleQuotedString,ut as matchSingleQuotedString,Mt as options,z as palette,Nt as parseDotenv,_t as picture,Xt as prepareColours,Kt as preparePicture,ne as progress,Ct as prompt,It as quit,I as red,Rt as requiredParam,Vt as requiredParams,ie as runSetup,Ut as section,kt as select,re as setup,ft as splitDataPath,he as watch,pe as watcherFunctions,ue as watcherHelpText,ge as watcherStatus,R as white,we as workspace,O as yellow};
1
+ import{splitList as e,isObject as t,doNothing as n,fail as r,isArray as o,noValue as i,isString as s,isBoolean as a,splitHash as c,hasValue as l,joinListOr as p,isInteger as h,extract as g,splitLines as u,debounce as f,sleep as d}from"@abw/badger-utils";import{DirPath as m,bin as b,cwd as w,dir as y,file as $}from"@abw/badger-filesystem";export*from"@abw/badger-filesystem";import v from"node:process";import x from"prompts";import{Command as C}from"commander";import{now as j}from"@abw/badger-timestamp";import k from"chokidar";import E from"node:child_process";export*from"@abw/badger-codecs";const T={reset:0,bold:1,bright:1,dark:2,black:0,red:1,green:2,yellow:3,blue:4,magenta:5,cyan:6,grey:7,white:8,fg:30,bg:40},P={fg:e=>`38;2;${e.r};${e.g};${e.b}`,bg:e=>`48;2;${e.r};${e.g};${e.b}`},D=(t,n="fg")=>{const r=(e=>{const t=e.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null})(t)||(t=>{const n=e(t);return 3===n.length?{r:n[0],g:n[1],b:n[2]}:null})(t);return r?((e,t="fg")=>"["+P[t](e)+"m")(r,n):((e,t="fg")=>{let n=[],r=e.split(/ /,2);const o=r.pop(),i=(t?T[t]:0)+T[o];if(n.push(i),r.length){const e=r.length?r.shift():"dark";n.push(T[e])}return"["+n.join(";")+"m"})(t,n)},S=(e={})=>{const n=t(e)?e:{fg:e};let r=[];return n.bg&&r.push(D(n.bg,"bg")),n.fg&&r.push(D(n.fg,"fg")),r.join("")},q=D("reset",!1),F=()=>q,N=e=>(...t)=>S(e)+t.join("")+q,_=e=>Object.entries(e).reduce((e,[t,n])=>(e[t]=N(n),e),{}),z=N("black"),A=N("red"),I=N("green"),L=N("yellow"),O=N("blue"),W=N("magenta"),M=N("cyan"),U=N("grey"),G=N("white"),R=N("bright black"),V=N("bright red"),Y=N("bright green"),B=N("bright yellow"),H=N("bright blue"),Q=N("bright magenta"),J=N("bright cyan"),K=N("bright grey"),X=N("bright white"),Z=N("dark black"),ee=N("dark red"),te=N("dark green"),ne=N("dark yellow"),re=N("dark blue"),oe=N("dark magenta"),ie=N("dark cyan"),se=N("dark grey"),ae=N("dark white");function ce(e,t="",r){return e?t?(e,...n)=>console.log("%s"+t+"%s"+e,r?S(r):"",F(),...n):console.log.bind(console):n}function le(e,t,n="",r){e.debug=ce(t,n,r)}class pe{constructor(e,t={}){this.workspace=e,this.props=t,le(this,t.debug,t.debugPrefix,t.debugColor),this.initComponent(t)}initComponent(){}}const he={b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v",'"':'"',"'":"'","\\":"\\"},ge=e=>{const t=e.match(/^"((?:\\[\\"bfnrtv]|.)*?)"$/);return t?t[1].replace(/\\([\\"bfnrtv])/g,(e,t)=>he[t]||`\\${t}`):null},ue=e=>{const t=e.match(/^'((?:\\[\\'bfnrtv]|.)*?)'$/);return t?t[1].replace(/\\([\\'bfnrtv])/g,(e,t)=>he[t]||`\\${t}`):null},fe=e=>{let t,n,o=[];for(;e.length;){let i,s;(n=e.match(/^(\/+)/))?e=e.slice(n[1].length):(e.match(/^(\?)/)&&(e=e.slice(1),i=!0),(n=e.match(/^('((\\[\\'bfnrtv]|.)*?)')/))?(e=e.slice(n[1].length),t=n[2].replace(/\\([\\'bfnrtv])/g,(e,t)=>he[t]||`\\${t}`)):(n=e.match(/^("((\\[\\"bfnrtv]|.)*?)")/))?(e=e.slice(n[1].length),t=n[2].replace(/\\([\\"bfnrtv])/g,(e,t)=>he[t]||`\\${t}`)):(n=e.match(/^([^/?]+)/))?(t=n[1],e=e.slice(t.length)):r(`Can't parse data path: ${e}`),e.match(/^(\?)/)&&(e=e.slice(1),s=!0),i?o.push([t,{maybe:!0}]):s?o.push([t,{optional:!0}]):o.push(t))}return o},de=(e,t)=>{let n=e,s=fe(t),a=[];for(let e of s){const[t,s]=o(e)?e:[e,{}],c=n[t];if(a.push(t),i(c)){if(s.maybe)return n;if(s.optional)return;r("No value for data at path: ",a.join("/"))}n=c}return n},me={codec:["yaml","json"],jsExt:["js","mjs"]};class be extends m{constructor(t,n={}){super(t);const r={...me,...n};this.state.codec=e(r.codec),this.state.jsExt=e(r.jsExt),le(this,n.debug,n.debugPrefix,n.debugColor)}async firstFileWithExt(e,t,r=n){const o=await this.dirs();for(let n of o)for(let o of t){const t=e+"."+o,i=n.file(t,r(e,o));if(this.debug("looking for config file: ",i.path()),await i.exists())return this.debug("config file exists: ",i.path()),i}}async jsFile(e){return await this.firstFileWithExt(e,this.state.jsExt)}async file(e){return await this.firstFileWithExt(e,this.state.codec,(e,t)=>({codec:t}))}async config(e,t){const[n,o]=e.split("#",2);let i,s,a;if(i=await this.jsFile(n))a=await import(i.path());else if(s=await this.file(n))a=await s.read();else{if(!t)return r("No configuration file for "+n);a=t}return o?de(a,o):a}}const we=(e,t)=>new be(e,t),ye={jsExt:"js mjs"};class $e extends m{constructor(t,n={}){super(t);const r={...ye,...n},o=e(r.jsExt).map(e=>e.replace(/^\./,""));this.state.exts=o,le(this,n.debug,n.debugPrefix,n.debugColor),this.debug("state: ",this.state)}async library(e){const[t,n]=e.split("#",2),o=await this.dirs(),i=this.state.exts;for(let e of o)for(let r of i){const o=e.file(t+"."+r);this.debug("looking for module %s as",t,o.path());if(await o.exists()){const e=await import(o.path());return this.debug("loaded %s as",o.path()),n?de(e,n):e}}r("Library not found: ",e)}}const ve=(e,t)=>new $e(e,t),xe=e=>async function(...t){try{const n=await e(...t);return n&&console.log(Y(`✓ ${n}`)),!0}catch(e){return console.log(v.env.DEBUG?e:V(`✗ ${e.message||e}`)),!1}},Ce=async(e,t={})=>{const n=(t=s(t)?{default:t}:t).name||"answer";return(await x([{name:n,type:t.type||"text",message:e,initial:t.default}]))[n]},je=async(e,t={})=>(t=a(t)?{default:t}:t,Ce(e,{...t,type:"confirm"})),ke=async(e,t,n)=>(await x([{type:"select",name:"selected",message:e,initial:n,choices:o(t)?t:Object.entries(t).map(([e,t])=>({value:e,title:t}))}])).selected,Ee=()=>v.argv.slice(2);function Te(e,t){e?o(e)&&(t=e,e={}):e={},t||(t||=Ee());const n=!!e.options&&c(e.options),i=e.others||"error",s=e.short||{},a=e.on||{};let p=!1,h=0,g={};for(;h<t.length;){const e=t[h].match(/^-(-)?(.*)/);if("--"===t[h]&&(p=!0,t.splice(h,1)),e&&!p){const o=!("-"===e[1])&&l(s[e[2]])?s[e[2]]:e[2];if(a[o]){if(a[o](o,t.splice(h,1)[0],t,g))continue;t.splice(h,0,e[0])}if(n&&!n[o])switch(i){case"collect":break;case"remove":t.splice(h,1)[0];case"keep":h++;continue;case"error":return r(`Invalid command line flag: ${e[0]}`);default:return r(`Invalid "others" option: ${i}`)}t.splice(h,1),g[o]=!0}else h++}return{flags:g,args:t}}async function Pe(e,t=Ee()){return t.length?t.shift():e?await Ce(e):void 0}async function De(e,t=Ee()){let n=[];if(e){for(let r of e){const e=await Pe(r,t);if(!e?.length)return;n.push(e)}return n}return t}const Se=".env",qe=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;async function Fe({filename:e=Se,dirs:t=[b(),w()],walkup:n=!0}){const o={},i=t.map(e=>y(e));for(;i.length;){const t=i.shift();if(!o[t.path()]){o[t.path()]=!0;const r=t.file(e);if(await r.exists())return r.path();n&&i.push(t.up())}}r(`Cannot locate ${Se} file in any parent directory of ${t.join(", ")}`)}function Ne(e){const t={},n=e.toString().replace(/\r\n?/gm,"\n");let r;for(;null!=(r=qe.exec(n));){const e=r[1];let n=r[2]??"";n=n.trim();const o=n[0];n=n.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),'"'===o&&(n=n.replace(/\\n/g,"\n"),n=n.replace(/\\r/g,"\r")),t[e]=n}return t}async function _e({path:e,filename:t,dirs:n,addToProcessEnv:o=!0,debug:i=!1}={}){e||=await Fe({filename:t,dirs:n}),i&&console.log(`Loading environment from ${e}`);const s=$(e);await s.exists()||r(`Specified environment file does not exist: ${e}`);const a=Ne(await s.read());return i&&console.log("Loaded environment:",a),o&&(Object.assign(v.env,a),i&&console.log("Added environment to process.env")),a}function ze(e,t){t&&console.log(t),v.exit(e)}function Ae(e){ze(0,e)}function Ie(e){ze(1,e)}function Le(e=v.argv){return e.slice(2)}const Oe={verboseColor:"magenta",titleColor:"bright yellow",underlineColor:"dark yellow",infoColor:"cyan",tickColor:"green",questionColor:"bright white",answerColor:"bright green",sectionNewlines:!0},We=async t=>{const n=N(We.verboseColor||Oe.verboseColor),o=new C;t.name&&o.name(t.name),t.description&&o.description(t.description),t.version&&o.version(t.version),t.yes&&o.option("-y, --yes","Accept default answers"),t.verbose&&o.option("-v, --verbose","Verbose output"),t.quiet&&o.option("-q, --quiet","Quiet output"),t.options?.filter(e=>!(l(e.arg)&&!e.arg)&&(e.title?void 0:l(e.name))).forEach(e=>{const t=e.name,n=e.about,r=e.default,i=e.handler,s=e.short,a=e.type,c=e.pattern||(l(a)?`<${a}>`:void 0);let p=`--${t}`,h=[];l(s)&&(p=`-${s}, ${p}`),l(c)&&(p=`${p} ${c}`),h.push(p),l(n)&&h.push(n),l(i)&&h.push(i),l(r)&&h.push(r),o.option(...h)});let i={};t.commands?.forEach(t=>{const n=t.name,s=t.about,a=t.type,c=t.pattern||(l(a)?`<${a}>`:void 0);let p=[],h=n,g=o.command(h);l(c)&&g.argument(c),l(s)&&g.description(s),l(t.arguments)&&e(t.arguments).forEach(e=>{p.push(function(e){const t=e.match(/(\w+)/);t||r("Can't parse argument name: ",e);return t[1]}(e)),g.argument(e)}),g.action((...e)=>{i[n]=p.length?p.reduce((t,n)=>(t[n]=e.shift(),t),{}):e[0]})}),o.parse();const s=o.opts(),a=t.yes&&s.yes,c=t.verbose&&s.verbose,p=t.quiet&&s.quiet;a&&(c&&!p&&v.stdout.write(n("Accepting default answers (-y option is set)\n")),x.override(s));let h=[];t.options?.forEach(e=>{const t=e.type||"text",n=e.name,r=e.prompt,o=l(e.arg)&&!e.arg,i=e.validate||(e.required?e=>!(!l(e)||!e.toString().length)||(We.invalid||`You must enter a value for ${n}`):void 0);let c=o?e.default:s[n];"select"===t&&l(c)&&(Number.isInteger(c)||(c=e.choices?.findIndex(e=>e.value===c),c<0&&(c=0))),l(r)?h.push({...e,type:l(c)?()=>(a&&(p||Ue({question:r,answer:c})),t):t,name:n,message:r,initial:c,validate:i}):(e.title||e.info)&&h.push({type:()=>(p||Me(e),!1)})});let g=!1;const u=await x(h,{onCancel:()=>(g=!0,!1)});return g?void 0:{...s,...u,...i}};const Me=e=>{const t=e.title,n=N(e.titleColor||Oe.titleColor),r=N(e.underlineColor||Oe.underlineColor),o=N(e.infoColor||Oe.infoColor),i=(l(e.newlines)?e.newlines:Oe.sectionNewlines)?"\n":"";if(t){const e="-".repeat(t.length);v.stdout.write(i+n(t)+"\n"+r(e)+"\n"+i)}e.info&&v.stdout.write(o(e.info)+"\n"+i)},Ue=e=>{const t=N(e.tickColor||Oe.tickColor),n=N(e.questionColor||Oe.questionColor),r=N(e.answerColor||Oe.answerColor);v.stdout.write(t("✔ ")+n(e.question)+" "+r(e.answer)+"\n")};function Ge(e={},t){const n=e[t];if(l(n))return n;r("Missing value for required parameter: ",t)}function Re(t={},n){return e(n).map(e=>Ge(t,e))}const Ve=Re;function Ye(t,n){let o=!1;const i=e(n),s=i.map(e=>{const n=t[e];return l(n)&&(o=!0),n});return o?s:r("Missing value for one of: ",p(i))}const Be={border:"┌─┐│└─┘|-",background:"+∙",fill:"*"},He={border:"green",background:"dark grey",foreground:"blue",fill:"bright yellow"},Qe={charTypes:Be,source:"\n┌────────────────────────────────────────────────────────────────┐\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙ ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ∙∙ │\n│ ∙∙ ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ∙∙ │\n│ ∙∙ ●● ◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦ ●● ∙∙ │\n│ ∙∙ ●● ◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦ ●● ∙∙ │\n│ ∙∙∙ ●● ◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦ ●● ∙∙∙ │\n│ ∙∙∙∙ ●● ◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦ ●● ∙∙∙∙ │\n│ ∙∙∙∙∙ ●● ◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦ ●● ∙∙∙∙∙ │\n│ ∙∙∙∙∙∙ ●● ◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦ ●● ∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙ ●● *◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦* ●● ∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙ ●● **◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦** ●● ∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙ ●● *****◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦***** ●● ∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● *******◦◦◦◦◦◦◦◦◦◦******* ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● ****************** ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● ************ ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● ****** ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● **** ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● **** ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● **** ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● ◦****◦ ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● ◦◦◦◦****◦◦◦◦ ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● ◦◦◦◦◦◦◦****◦◦◦◦◦◦◦ ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ●● ◦◦◦◦◦◦◦◦◦******◦◦◦◦◦◦◦◦◦ ●● ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙ ●● ◦◦◦◦◦◦◦◦◦◦◦********◦◦◦◦◦◦◦◦◦◦◦ ●● ∙∙∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙ ●● ◦◦◦◦◦◦◦◦◦◦◦************◦◦◦◦◦◦◦◦◦◦◦ ●● ∙∙∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙∙∙ ●● ◦◦◦◦◦◦◦◦◦◦******************◦◦◦◦◦◦◦◦◦◦ ●● ∙∙∙∙∙∙∙∙ │\n│ ∙∙∙∙∙∙ ●● ◦◦◦◦◦◦◦◦◦************************◦◦◦◦◦◦◦◦◦ ●● ∙∙∙∙∙∙ │\n│ ∙∙∙∙∙ ●● ◦◦◦◦◦◦◦******************************◦◦◦◦◦◦◦ ●● ∙∙∙∙∙ │\n│ ∙∙∙∙ ●● ◦◦◦◦◦************************************◦◦◦◦◦ ●● ∙∙∙∙ │\n│ ∙∙∙ ●● ◦◦◦◦****************************************◦◦◦◦ ●● ∙∙∙ │\n│ ∙∙ ●● ◦◦◦********************************************◦◦◦ ●● ∙∙ │\n│ ∙∙ ●● ◦◦**********************************************◦◦ ●● ∙∙ │\n│ ∙∙ ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ∙∙ │\n│ ∙∙ ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ∙∙ │\n│ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ │\n└────────────────────────────────────────────────────────────────┘\n"},Je={size:100,elapsed:!1,picture:Qe,colours:He};function Ke(e){const{source:t,charTypes:n={background:""}}=e,r=t.trim()+"\n",o=r.length,i=Object.entries(n).reduce((e,[t,n])=>(n.split("").forEach(n=>e[n]=t),e),{});return{picture:r,length:o,lineLength:t.split("\n").reduce((e,t)=>Math.max(e,t.length),0),charType:i}}function Xe(e){return Object.entries(e).reduce((e,[t,n])=>(e[t]=N(n),e),{})}function Ze(e){const{picture:t,charType:n={},colours:r={}}=e;return t.split("").map(e=>{const t=n[e]||"foreground",o=r[t];return o?o(e):e}).join("")}function et(e){const t=e%60,n=Math.floor(e/60);return[Math.floor(e/3600),n,t].map(e=>e.toString().padStart(2,"0")).join(":")}class tt{constructor(e={}){const t={...Je,...h(e)?{size:e}:e},{size:n,colours:r,colors:o,debug:i,elapsed:a}=t,{picture:c,length:l,lineLength:p,charType:g}=Ke(s(t.picture)?{source:t.picture,charTypes:Be}:t.picture);this.size=n,this.picture=c,this.pixels=this.picture.split(""),this.length=l,this.lineLength=p,this.charType=g,this.colours=Xe(o||r),this.count=0,this.lastCount=0,this.lastPixel=0,this.startTime=j().epochSeconds(),this.elapsed=0,this.elapsedCol=N("dark grey"),this.showElapsed=a,this.debugging=i,le(this,i,"Progress > ","blue")}progress(e=1){this.count+=e;const t=j().epochSeconds()-this.startTime;this.elapsed=t;const n=Math.floor(this.length*this.count/this.size);if(n>this.lastPixel){const e=this.lastPixel;return this.lastPixel=n,this.debug(`count: ${this.count}/${this.size} pixels from ${e} to ${n}`),this.pictureSegment(e,n)}return""}remains(){this.count=this.size;const e=this.lastPixel,t=this.length;return t>e?(this.lastPixel=this.length,this.pictureSegment(e,t)):""}pictureSegment(e,t){if(this.debugging)return"";let n=Ze({picture:this.picture.substring(e,t),charType:this.charType,colours:this.colours});if(this.showElapsed&&n.match("\n")){const e=n.split("\n"),t=e.pop();n=e.map(e=>e+" "+this.elapsedCol(et(this.elapsed))).join("\n").concat("\n",t)}return n}printProgress(e=1){v.stdout.write(this.progress(e))}printRemains(){v.stdout.write(this.remains())}}const nt=e=>new tt(e),rt={description:"Project setup script.",configFiles:["config/setup.yaml","config/setup.json","setup.yaml","setup.json",".setup.yaml",".setup.json"],dataFile:".env.yaml",envFile:".env",envComments:!0,envSections:!0,writeData:!0,writeEnv:!1,compact:!1,scriptName:"scaffolding",cancelled:"Setup cancelled",allDone:"All configuration options have been set",warning:e=>`\n#=============================================================================\n# WARNING: This file is generated automatically when the ${e.scriptName}\n# script is run. Any changes made here may be lost.\n#\n# Generated: ${j()}\n#=============================================================================\n\n`},ot=xe(async e=>{await it(e)});async function it(e){const t={...rt,...e},n=t.rootDir?y(t.rootDir):w(),o=n.file(t.envFile),i=_e({path:o.path()}),s=n.file(t.dataFile,{codec:"auto"}),c=await s.exists()?await s.read():{},p=t.configFile?n.file(t.configFile,{codec:"auto"}):await st(n,t.configFiles),h=await p.read();h.name||=t.name||v.argv[1].replace(n.path()+"/",""),h.version||=t.version,h.description||=t.description,e.preprocess&&await e.preprocess(h);const u={root:n.path(),...t.values||{}},f={quiet:!0,verbose:!0,yes:!0};for(let e of h.options){const{name:n,save:r}=e;if(a(r)&&!r&&(f[n]=!0),!n)continue;e.pattern&&(e.type||="text");const o=e.no_prefix||a(e.env_prefix)&&!e.env_prefix?"":e.env_prefix??t.envPrefix??"",s=e.envvar??=e.env_var??`${o}${n.toUpperCase()}`;l(i[s])?e.default=i[s]:l(c[n])?e.default=c[n]:l(u[n])?e.default=u[n]:e.program&&(e.default=await at(e.program),e.pattern||="<path>")}const d=await We(h);d||Ae("\n👎 "+V(t.cancelled));const{debug:m,verbose:b,quiet:$}=d;return t.writeData&&(await s.write(g(d,e=>!f[e])),b&&console.log(Y(`✓ Wrote data file: ${s}`))),t.writeEnv&&(await o.write(await async function(e,t,n,o){const{compact:i,envComments:s,envSections:c,envPrefix:p=""}=t,h=i?"":"\n";let g=[ct(t.warning(t))];const u="#"+"-".repeat(77),f="#"+"=".repeat(77);for(let e of n.options){const{name:t,envvar:n,env_var:r,title:f,about:d,save:m,save_env:b}=e;if((!a(m)||m)&&(!a(b)||b))if(f&&c)g.push(`${h}\n${u}\n${ct(f)}\n${u}`);else if(i||g.push(""),d&&s&&g.push(`${ct(d)}`),t){const i=o[t];if(l(i)){const o=i.toString().match(/[#\r\n]/)?'"$value"':i,s=e.no_prefix||a(e.env_prefix)&&!e.env_prefix?"":e.env_prefix??p,c=n??r??`${s}${t.toUpperCase()}`;g.push(`${c}=${o}`)}else g.push(ct(`No value for ${n||t.toUpperCase()}`))}}if(t.envExtra){const n=e.file(t.envExtra);await n.exists()||r(`Cannot find envExtra file: ${t.envExtra}`),c&&g.push("\n",f,ct(` Additional configuration copied from ${t.envExtra}`),f,""),g.push(await n.read())}return g.join("\n")+"\n"}(n,t,h,d)),b&&console.log(Y(`✓ Wrote .env file: ${o}`))),m&&console.log("\nGenerated configuration:",d),t.allDone&&!$&&console.log("\n👍 ",Y(t.allDone),"\n"),d}async function st(e,t=[]){for(let n of t){const t=e.file(n,{codec:"auto"});if(await t.exists())return t}r("Can't find a configFile: ",t.join(", "))}async function at(t){for(let n of e(t))for(let e of v.env.PATH.split(":")){const t=y(e).file(n);if(await t.exists())return t.path()}}function ct(e){return u(e.trim()).map(e=>e.match(/^#/)?e:`# ${e}`).join("\n")}const lt={script:v.argv[1].split("/").at(-1),prefix:"watcher >",colors:{prefix:"dark grey",error:"bright red",watcher:"bright yellow",section:"bright white",program:"bright green",arg:"bright cyan",args:"bright blue",debug:"bright grey",command:"yellow",scanning:"cyan",watching:"cyan",change:"bright cyan",starting:"bright green",stopping:"bright red",stopped:"green",failed:"bright red"}};async function pt(e){const{config:t,cmdLine:n}=ht(e),r=await n(),{watch:o,restart:i,program:s,programArgs:a}=r,{scanning:c,watching:l,starting:p,stopping:h,failed:g,stopped:u,change:m}=gt({...t,...r});let b,w=!1;c(),l(o);const y=()=>{b||(p(),b=E.spawn(s,a,{stdio:"inherit"}),b.on("exit",(e,t)=>{t||(e?g(e):u(),i?(b=null,d(500).then(y)):ze(e))}))},$=f(()=>{b&&(h(),b.kill(),b=null),y()},300);k.watch(o).on("ready",()=>{y(),w=!0}).on("all",(e,t)=>{w&&(m(e,t),$())})}const ht=e=>{const t={...lt,...e},n=t.colors=_({...lt.colors,...t.colors}),r=ut(t),o=()=>Ae(r()),i=e=>Ie(r(e));return{config:t,colors:n,helpText:r,help:o,barf:i,cmdLine:async()=>{const{flags:e,args:t}=Te({options:"watch restart verbose help",others:"keep",short:{w:"watch",r:"restart",v:"verbose",h:"help"},on:{help:o,watch:(e,t,n,r)=>(r.watch||=[],n.length||i("The -w option expects an argument!"),r.watch.push(n.shift()),!0)}}),[n,...r]=t,s=t.join(" ");return t.length<1&&i("No program specified to run!"),e.watch?.length||i("Nothing specified to watch!"),await $(n).exists()||i(`Program not found: ${n}`),{...e,progText:s,program:n,programArgs:r}}}},gt=({verbose:e,colors:t,prefix:r,progText:o})=>({scanning:()=>e?console.log(t.prefix(r),t.scanning("scanning...")):n,watching:o=>e?o.forEach(e=>console.log(t.prefix(r),t.watching("watching "),t.command(e))):n,change:(o,i)=>e?console.log(t.prefix(r),t.change(`${o}`.padEnd(9)),t.command(i)):n,starting:()=>e?console.log(t.prefix(r),t.starting("starting "),t.command(o)):n,stopping:()=>e?console.log(t.prefix(r),t.stopping("stopping "),t.command(o)):n,failed:i=>e?console.log(t.prefix(r),t.failed(`failed ${i}`),t.command(o)):n,stopped:()=>e?console.log(t.prefix(r),t.stopped("stopped "),t.command(o)):n}),ut=({colors:e,script:t})=>{const{watcher:n,arg:r,section:o,program:i,args:s,error:a}=e,c=n(t);return e=>`${c}\n${e?`\n${a(e)}\n`:""}\n${o("Usage")}\n\n $ ${c} [${r("options")}] ${i("program")} [${s("arg1 arg2 ...")}]\n\n${o("Description")}\n\n This program will run another program and restart it if any files\n are added, deleted or modified in one or more watched locations.\n\n Paths to watch should be specified using the ${r("-w")} (or ${r("--watch")})\n option. You can specify this multiple times for different paths.\n\n The path to the ${i("program")} should follow, along with any additional\n ${s("arguments")} to be passed to it.\n\n If the ${r("-r")} (or ${r("--restart")}) option is specified then the\n program will be restarted when it exits.\n\n${o("Options")}\n\n ${r("-w <path>")} / ${r("--watch <path>")} Watch a path for changes\n ${r("-r")} / ${r("--restart")} Restart program on exit\n ${r("-v")} / ${r("--verbose")} Verbose mode\n ${r("-h")} / ${r("--help")} This help\n\n${o("Examples")}\n\n $ ${c} ${r("-w .")} ${i("bin/foo.js")}\n $ ${c} ${r("-w lib -w config")} ${i("bin/foo.js")}\n $ ${c} ${r("-w lib -w config")} ${i("bin/foo.js")} ${s("bar baz")}\n $ ${c} ${r("-w lib -w config -v")} ${i("bin/foo.js")} ${s("bar baz")}\n $ ${c} ${r("-w lib -w config -v -r")} ${i("bin/foo.js")} ${s("bar baz")}\n`},ft={dir:"config"},dt={dir:"lib library src components"},mt={};class bt{constructor(t,n={}){const r=y(t),o=e(n.config?.dir||ft.dir).map(e=>r.dir(e)),i={...ft,...n.config||{}},s=new be(o,i),a=e(n.library?.dir||dt.dir).map(e=>r.dir(e)),c={...dt,...n.library||{}},l=new $e(a,c);this.case={...mt,...n.case||{}},this.state={rootDir:r,config:s,library:l},le(this,n.debug,n.debugPrefix,n.debugColor),this.debug("root dir: ",r.path()),this.debug("config dir: ",o.map(e=>e.path())),this.debug("libDirs: ",a),this.debug("libOpts: ",c)}dir(e,t){return this.debug("dir(%s, %o)",e,t),l(e)?this.state.rootDir.dir(e,t):this.state.rootDir}file(e,t){return this.debug("file(%s, %o)",e,t),this.state.rootDir.file(e,t)}read(e,t){return this.debug("read(%s, %o)",e,t),this.file(e,t).read()}write(e,t,n){return this.debug("write(%s, %o, %o)",e,t,n),this.file(e,n).write(t)}configDir(e,t){return this.debug("configDir(%s, %o)",e,t),l(e)?this.state.configDir.dir(e,t):this.state.configDir}async config(e,t){return this.debug("config(%s, %o)",e,t),l(e)?this.state.config.config(e,t):this.state.config}async library(e){return this.debug("library(%s, %o)",e),l(e)?this.state.library.library(e):this.state.library}async component(e,t){const[n,o]=e.split("#",2),i=this.convertCase("config",n),s=await this.config(i,{}),a=s.component?.library||this.convertCase("library",n),c=await this.library(a),l=o||s.component?.export||"default";return new(c[l]||r("No '",l,"' export from component library: ",e))(this,{...s,...t})}convertCase(e,t){const n=this.case[e];return n?n(t):t}}const wt=(e,t)=>new bt(e,t);export{S as ANSIescape,D as ANSIescapeCode,F as ANSIreset,q as ANSIresetCode,pe as Component,be as Config,ce as Debugger,$e as Library,tt as Progress,bt as Workspace,Ie as abort,le as addDebug,Ve as allParams,Ue as answer,Ye as anyParams,xe as appStatus,Le as args,z as black,O as blue,R as brightBlack,H as brightBlue,J as brightCyan,Y as brightGreen,K as brightGrey,Q as brightMagenta,V as brightRed,X as brightWhite,B as brightYellow,Be as charTypes,Ee as cmdLine,Pe as cmdLineArg,De as cmdLineArgs,Te as cmdLineFlags,N as color,He as colours,we as config,je as confirm,M as cyan,Z as darkBlack,re as darkBlue,ie as darkCyan,te as darkGreen,se as darkGrey,oe as darkMagenta,ee as darkRed,ae as darkWhite,ne as darkYellow,de as dataPath,Oe as defaults,_e as dotenv,ze as exit,Fe as findDotenv,st as findFirstFile,at as findProgram,et as formatElapsed,Ze as formatPicture,I as green,U as grey,ve as library,W as magenta,ge as matchDoubleQuotedString,ue as matchSingleQuotedString,We as options,_ as palette,Ne as parseDotenv,Qe as picture,Xe as prepareColours,Ke as preparePicture,nt as progress,Ce as prompt,Ae as quit,A as red,Ge as requiredParam,Re as requiredParams,it as runSetup,Me as section,ke as select,ot as setup,fe as splitDataPath,pt as watch,ht as watcherFunctions,ut as watcherHelpText,gt as watcherStatus,G as white,wt as workspace,L as yellow};
2
2
  //# sourceMappingURL=badger.esm.js.map