@abw/badger 1.1.0 → 1.1.1

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
- "use strict";var t=require("@abw/badger-filesystem"),e=require("node:process"),r=require("prompts"),o=require("commander"),s=require("@abw/badger-codecs");function i(t){return"string"==typeof t}function n(t){return Array.isArray(t)}function a(t){return null===t}function c(t){return!(function(t){return void 0===t}(t)||a(t))}function l(t){return!c(t)}function u(...t){throw new Error(t.join(""))}function p(){}function g(t){return l(t)?[]:i(t)?t.length?t.split(/,\s*|\s+/):[]:n(t)?t:[t]}Intl.DateTimeFormat().resolvedOptions().locale;const d={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},f=(t,e="fg")=>{let r=[],o=t.split(/ /,2);const s=o.pop(),i=(e?d[e]:0)+d[s];if(r.push(i),o.length){const t=o.length?o.shift():"dark";r.push(d[t])}return"["+r.join(";")+"m"},h=(t={})=>{const e="object"!=typeof(r=t)||n(r)||a(r)?{fg:t}:t;var r;let o=[];return e.bg&&o.push(f(e.bg,"bg")),e.fg&&o.push(f(e.fg,"fg")),o.join("")},b=()=>f("reset",!1),x=t=>e=>h(t)+e+b(),y=x("black"),m=x("red"),w=x("green"),v=x("yellow"),k=x("blue"),C=x("magenta"),j=x("cyan"),q=x("grey"),D=x("white"),E=x("bright black"),P=x("bright red"),$=x("bright green"),A=x("bright yellow"),N=x("bright blue"),O=x("bright magenta"),S=x("bright cyan"),F=x("bright grey"),I=x("bright white"),W=x("dark black"),B=x("dark red"),G=x("dark green"),L=x("dark yellow"),M=x("dark blue"),Q=x("dark magenta"),Y=x("dark cyan"),R=x("dark grey"),T=x("dark white");function U(t,e="",r){return t?e?(t,...o)=>console.log("%s"+e+"%s"+t,r?h(r):"",b(),...o):console.log.bind(console):p}function V(t,e,r="",o){t.debug=U(e,r,o)}const z={b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v",'"':'"',"'":"'","\\":"\\"},H=t=>{let e=[];return[...t.matchAll(/(?:(\/)|'((?:\\[\\']|.)*?)'|"((?:\\[\\"nrt]|.)*?)"|([^/?]+))(\??)/g)].map((([,,t,r,o,s])=>{let i;t?i=t.replace(/\\([\\'bfnrtv])/g,((t,e)=>z[e]||`\\${e}`)):r?i=r.replace(/\\([\\"bfnrtv])/g,((t,e)=>z[e]||`\\${e}`)):o&&(i=o),c(i)&&e.push(s?[i,{optional:!0}]:i)})),e},J=(t,e)=>{let r=t,o=H(e),s=[];for(let t of o){const[e,o]=n(t)?t:[t,{}];if(r=r[e],s.push(e),l(r)){if(o.optional)return r;u("No value for data at path: ",s.join("/"))}}return r},K={codec:["yaml","json"],jsExt:["js","mjs"]};class X extends t.DirPath{constructor(t,e={}){super(t);const r={...K,...e};this.state.codec=g(r.codec),this.state.jsExt=g(r.jsExt),V(this,e.debug,e.debugPrefix,e.debugColor)}async firstFileWithExt(t,e,r=p){const o=await this.dirs();for(let s of o)for(let o of e){const e=t+"."+o,i=s.file(e,r(t,o));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[r,o]=t.split("#",2);let s,i,n;if(s=await this.jsFile(r))n=await import(s.path());else if(i=await this.file(r))n=await i.read();else{if(!e)return u("No configuration file for "+r);n=e}return o?J(n,o):n}}const Z={jsExt:"js mjs"};class _ extends t.DirPath{constructor(t,e={}){super(t);const r=g({...Z,...e}.jsExt).map((t=>t.replace(/^\./,"")));this.state.exts=r,V(this,e.debug,e.debugPrefix,e.debugColor),this.debug("state: ",this.state)}async library(t){const[e,r]=t.split("#",2),o=await this.dirs(),s=this.state.exts;for(let t of o)for(let o of s){const s=t.file(e+"."+o);this.debug("looking for module %s as",e,s.path());if(await s.exists()){const t=await import(s.path());return this.debug("loaded %s as",s.path()),r?J(t,r):t}}u("Library not found: ",t)}}const tt=async(t,e={})=>{const o=(e=i(e)?{default:e}:e).name||"answer";return(await r([{name:o,type:e.type||"text",message:t,initial:e.default}]))[o]};async function et(t,r=e.argv.slice(2)){return r.length?r.shift():t?await tt(t):void 0}function rt(t,r){r&&console.log(r),e.exit(t)}const ot={verboseColor:"magenta",titleColor:"bright yellow",underlineColor:"dark yellow",infoColor:"cyan",tickColor:"green",questionColor:"bright white",answerColor:"bright green",sectionNewlines:!0},st=async t=>{const s=x(st.verboseColor||ot.verboseColor),i=new o.Command;t.name&&i.name(t.name),t.description&&i.description(t.description),t.version&&i.version(t.version),t.yes&&i.option("-y, --yes","Accept default answers"),t.verbose&&i.option("-v, --verbose","Verbose output"),t.quiet&&i.option("-q, --quiet","Quiet output"),t.options?.filter((t=>!(c(t.arg)&&!t.arg)&&(t.title?void 0:c(t.name)))).forEach((t=>{const e=t.name,r=t.about,o=t.default,s=t.handler,n=t.short,a=t.type,l=t.pattern||(c(a)?`<${a}>`:void 0);let u=`--${e}`,p=[];c(n)&&(u=`-${n}, ${u}`),c(l)&&(u=`${u} ${l}`),p.push(u),c(r)&&p.push(r),c(s)&&p.push(s),c(o)&&p.push(o),console.log("command option: ",p),i.option(...p)}));let n={};t.commands?.forEach((t=>{const e=t.name,r=t.about,o=t.type,s=t.pattern||(c(o)?`<${o}>`:void 0);let a=e,l=i.command(a);c(s)&&l.argument(s),c(r)&&l.description(r),l.action((t=>{n[e]=t}))})),i.parse();const a=i.opts(),l=t.yes&&a.yes,u=t.verbose&&a.verbose,p=t.quiet&&a.quiet;l&&(u&&!p&&e.stdout.write(s("Accepting default answers (-y option is set)\n")),r.override(a));let g=[];t.options?.forEach((t=>{const e=t.type||"text",r=t.name,o=t.prompt,s=c(t.arg)&&!t.arg,i=t.validate||(t.required?t=>!(!c(t)||!t.toString().length)||(st.invalid||`You must enter a value for ${r}`):void 0);let n=s?t.default:a[r];"select"===e&&c(n)&&(Number.isInteger(n)||(n=t.choices?.findIndex((t=>t.value===n)),n<0&&(n=0))),c(o)?g.push({...t,type:c(n)?()=>(l&&(p||nt({question:o,answer:n})),e):e,name:r,message:o,initial:n,validate:i}):(t.title||t.info)&&g.push({type:()=>(p||it(t),!1)})}));const d=await r(g);return{...a,...d,...n}},it=t=>{const r=t.title,o=x(t.titleColor||ot.titleColor),s=x(t.underlineColor||ot.underlineColor),i=x(t.infoColor||ot.infoColor),n=(c(t.newlines)?t.newlines:ot.sectionNewlines)?"\n":"";if(r){const t="-".repeat(r.length);e.stdout.write(n+o(r)+"\n"+s(t)+"\n"+n)}t.info&&e.stdout.write(i(t.info)+"\n"+n)},nt=t=>{const r=x(t.tickColor||ot.tickColor),o=x(t.questionColor||ot.questionColor),s=x(t.answerColor||ot.answerColor);e.stdout.write(r("✔ ")+o(t.question)+" "+s(t.answer)+"\n")};function at(t={},e){const r=t[e];if(c(r))return r;u("Missing value for required parameter: ",e)}function ct(t={},e){return g(e).map((e=>at(t,e)))}const lt=ct;const ut={dir:"config"},pt={dir:"lib library src components"},gt={};class dt{constructor(e,r={}){const o=t.dir(e),s=g(r.config?.dir||ut.dir).map((t=>o.dir(t))),i={...ut,...r.config||{}},n=new X(s,i),a=g(r.library?.dir||pt.dir).map((t=>o.dir(t))),c={...pt,...r.library||{}},l=new _(a,c);this.case={...gt,...r.case||{}},this.state={rootDir:o,config:n,library:l},V(this,r.debug,r.debugPrefix,r.debugColor),this.debug("root dir: ",o.path()),this.debug("config dir: ",s.map((t=>t.path()))),this.debug("libDirs: ",a),this.debug("libOpts: ",c)}dir(t,e){return this.debug("dir(%s, %o)",t,e),c(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,r){return this.debug("write(%s, %o, %o)",t,e,r),this.file(t,r).write(e)}configDir(t,e){return this.debug("configDir(%s, %o)",t,e),c(t)?this.state.configDir.dir(t,e):this.state.configDir}async config(t,e){return this.debug("config(%s, %o)",t,e),c(t)?this.state.config.config(t,e):this.state.config}async library(t){return this.debug("library(%s, %o)",t),c(t)?this.state.library.library(t):this.state.library}async component(t,e){const[r,o]=t.split("#",2),s=this.convertCase("config",r),i=await this.config(s,{}),n=i.component?.library||this.convertCase("library",r),a=await this.library(n),c=o||i.component?.export||"default";return new(a[c]||u("No '",c,"' export from component library: ",t))(this,{...i,...e})}convertCase(t,e){const r=this.case[t];return r?r(e):e}}exports.ANSIescape=h,exports.ANSIescapeCode=f,exports.ANSIreset=b,exports.Component=class{constructor(t,e={}){this.workspace=t,this.props=e,V(this,e.debug,e.debugPrefix,e.debugColor),this.initComponent(e)}initComponent(){}},exports.Config=X,exports.Debugger=U,exports.Library=_,exports.Workspace=dt,exports.abort=function(t){rt(1,t)},exports.addDebug=V,exports.allParams=lt,exports.answer=nt,exports.anyParams=function(t,e){let r=!1;const o=g(e),s=o.map((e=>{const o=t[e];return c(o)&&(r=!0),o}));return r?s:u("Missing value for one of: ",function(t,e=", ",r=" or "){return function(t,e=" ",r=e){let o=[...t];const s=o.pop();return o.length?[o.join(e),s].join(r):s}(t,e,r)}(o))},exports.appStatus=t=>async function(...r){try{const e=await t(...r);e&&console.log($(`✓ ${e}`))}catch(t){console.log(e.env.DEBUG?t:P(`✗ ${t.message||t}`))}},exports.args=function(t=e.argv){return t.slice(2)},exports.black=y,exports.blue=k,exports.brightBlack=E,exports.brightBlue=N,exports.brightCyan=S,exports.brightGreen=$,exports.brightGrey=F,exports.brightMagenta=O,exports.brightRed=P,exports.brightWhite=I,exports.brightYellow=A,exports.cmdLineArg=et,exports.cmdLineArgs=async function(t,r=e.argv.slice(2)){let o=[];for(let e of t){const t=await et(e,r);if(!t?.length)return;o.push(t)}return o},exports.color=x,exports.config=(t,e)=>new X(t,e),exports.confirm=async(t,e={})=>tt(t,{...e,type:"confirm"}),exports.cyan=j,exports.darkBlack=W,exports.darkBlue=M,exports.darkCyan=Y,exports.darkGreen=G,exports.darkGrey=R,exports.darkMagenta=Q,exports.darkRed=B,exports.darkWhite=T,exports.darkYellow=L,exports.dataPath=J,exports.defaults=ot,exports.exit=rt,exports.green=w,exports.grey=q,exports.library=(t,e)=>new _(t,e),exports.magenta=C,exports.matchDoubleQuotedString=t=>{const e=t.match(/^"((?:\\[\\"nrt]|.)*?)"$/);return e?e[1].replace(/\\([\\"bfnrtv])/g,((t,e)=>z[e]||`\\${e}`)):null},exports.matchSingleQuotedString=t=>{const e=t.match(/^'((?:\\[\\']|.)*?)'$/);return e?e[1].replace(/\\([\\'bfnrtv])/g,((t,e)=>z[e]||`\\${e}`)):null},exports.options=st,exports.prompt=tt,exports.quit=function(t){rt(0,t)},exports.red=m,exports.requiredParam=at,exports.requiredParams=ct,exports.section=it,exports.splitDataPath=H,exports.white=D,exports.workspace=(t,e)=>new dt(t,e),exports.yellow=v,Object.keys(t).forEach((function(e){"default"===e||exports.hasOwnProperty(e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})})),Object.keys(s).forEach((function(t){"default"===t||exports.hasOwnProperty(t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return s[t]}})}));
1
+ "use strict";var t=require("@abw/badger-filesystem"),e=require("node:process"),r=require("prompts"),o=require("commander"),s=require("@abw/badger-codecs");function i(t){return"string"==typeof t}function n(t){return Array.isArray(t)}function a(t){return null===t}function c(t){return!(function(t){return void 0===t}(t)||a(t))}function l(t){return!c(t)}function u(...t){throw new Error(t.join(""))}function p(){}function g(t){return l(t)?[]:i(t)?t.length?t.split(/,\s*|\s+/):[]:n(t)?t:[t]}Intl.DateTimeFormat().resolvedOptions().locale;const d={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},f=(t,e="fg")=>{let r=[],o=t.split(/ /,2);const s=o.pop(),i=(e?d[e]:0)+d[s];if(r.push(i),o.length){const t=o.length?o.shift():"dark";r.push(d[t])}return"["+r.join(";")+"m"},h=(t={})=>{const e="object"!=typeof(r=t)||n(r)||a(r)?{fg:t}:t;var r;let o=[];return e.bg&&o.push(f(e.bg,"bg")),e.fg&&o.push(f(e.fg,"fg")),o.join("")},b=()=>f("reset",!1),x=t=>e=>h(t)+e+b(),y=x("black"),m=x("red"),w=x("green"),v=x("yellow"),k=x("blue"),C=x("magenta"),j=x("cyan"),q=x("grey"),D=x("white"),E=x("bright black"),P=x("bright red"),$=x("bright green"),A=x("bright yellow"),N=x("bright blue"),O=x("bright magenta"),S=x("bright cyan"),F=x("bright grey"),I=x("bright white"),W=x("dark black"),B=x("dark red"),G=x("dark green"),L=x("dark yellow"),M=x("dark blue"),Q=x("dark magenta"),Y=x("dark cyan"),R=x("dark grey"),T=x("dark white");function U(t,e="",r){return t?e?(t,...o)=>console.log("%s"+e+"%s"+t,r?h(r):"",b(),...o):console.log.bind(console):p}function V(t,e,r="",o){t.debug=U(e,r,o)}const z={b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v",'"':'"',"'":"'","\\":"\\"},H=t=>{let e=[];return[...t.matchAll(/(?:(\/)|'((?:\\[\\']|.)*?)'|"((?:\\[\\"nrt]|.)*?)"|([^/?]+))(\??)/g)].map((([,,t,r,o,s])=>{let i;t?i=t.replace(/\\([\\'bfnrtv])/g,((t,e)=>z[e]||`\\${e}`)):r?i=r.replace(/\\([\\"bfnrtv])/g,((t,e)=>z[e]||`\\${e}`)):o&&(i=o),c(i)&&e.push(s?[i,{optional:!0}]:i)})),e},J=(t,e)=>{let r=t,o=H(e),s=[];for(let t of o){const[e,o]=n(t)?t:[t,{}];if(r=r[e],s.push(e),l(r)){if(o.optional)return r;u("No value for data at path: ",s.join("/"))}}return r},K={codec:["yaml","json"],jsExt:["js","mjs"]};class X extends t.DirPath{constructor(t,e={}){super(t);const r={...K,...e};this.state.codec=g(r.codec),this.state.jsExt=g(r.jsExt),V(this,e.debug,e.debugPrefix,e.debugColor)}async firstFileWithExt(t,e,r=p){const o=await this.dirs();for(let s of o)for(let o of e){const e=t+"."+o,i=s.file(e,r(t,o));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[r,o]=t.split("#",2);let s,i,n;if(s=await this.jsFile(r))n=await import(s.path());else if(i=await this.file(r))n=await i.read();else{if(!e)return u("No configuration file for "+r);n=e}return o?J(n,o):n}}const Z={jsExt:"js mjs"};class _ extends t.DirPath{constructor(t,e={}){super(t);const r=g({...Z,...e}.jsExt).map((t=>t.replace(/^\./,"")));this.state.exts=r,V(this,e.debug,e.debugPrefix,e.debugColor),this.debug("state: ",this.state)}async library(t){const[e,r]=t.split("#",2),o=await this.dirs(),s=this.state.exts;for(let t of o)for(let o of s){const s=t.file(e+"."+o);this.debug("looking for module %s as",e,s.path());if(await s.exists()){const t=await import(s.path());return this.debug("loaded %s as",s.path()),r?J(t,r):t}}u("Library not found: ",t)}}const tt=async(t,e={})=>{const o=(e=i(e)?{default:e}:e).name||"answer";return(await r([{name:o,type:e.type||"text",message:t,initial:e.default}]))[o]};async function et(t,r=e.argv.slice(2)){return r.length?r.shift():t?await tt(t):void 0}function rt(t,r){r&&console.log(r),e.exit(t)}const ot={verboseColor:"magenta",titleColor:"bright yellow",underlineColor:"dark yellow",infoColor:"cyan",tickColor:"green",questionColor:"bright white",answerColor:"bright green",sectionNewlines:!0},st=async t=>{const s=x(st.verboseColor||ot.verboseColor),i=new o.Command;t.name&&i.name(t.name),t.description&&i.description(t.description),t.version&&i.version(t.version),t.yes&&i.option("-y, --yes","Accept default answers"),t.verbose&&i.option("-v, --verbose","Verbose output"),t.quiet&&i.option("-q, --quiet","Quiet output"),t.options?.filter((t=>!(c(t.arg)&&!t.arg)&&(t.title?void 0:c(t.name)))).forEach((t=>{const e=t.name,r=t.about,o=t.default,s=t.handler,n=t.short,a=t.type,l=t.pattern||(c(a)?`<${a}>`:void 0);let u=`--${e}`,p=[];c(n)&&(u=`-${n}, ${u}`),c(l)&&(u=`${u} ${l}`),p.push(u),c(r)&&p.push(r),c(s)&&p.push(s),c(o)&&p.push(o),i.option(...p)}));let n={};t.commands?.forEach((t=>{const e=t.name,r=t.about,o=t.type,s=t.pattern||(c(o)?`<${o}>`:void 0);let a=e,l=i.command(a);c(s)&&l.argument(s),c(r)&&l.description(r),l.action((t=>{n[e]=t}))})),i.parse();const a=i.opts(),l=t.yes&&a.yes,u=t.verbose&&a.verbose,p=t.quiet&&a.quiet;l&&(u&&!p&&e.stdout.write(s("Accepting default answers (-y option is set)\n")),r.override(a));let g=[];t.options?.forEach((t=>{const e=t.type||"text",r=t.name,o=t.prompt,s=c(t.arg)&&!t.arg,i=t.validate||(t.required?t=>!(!c(t)||!t.toString().length)||(st.invalid||`You must enter a value for ${r}`):void 0);let n=s?t.default:a[r];"select"===e&&c(n)&&(Number.isInteger(n)||(n=t.choices?.findIndex((t=>t.value===n)),n<0&&(n=0))),c(o)?g.push({...t,type:c(n)?()=>(l&&(p||nt({question:o,answer:n})),e):e,name:r,message:o,initial:n,validate:i}):(t.title||t.info)&&g.push({type:()=>(p||it(t),!1)})}));const d=await r(g);return{...a,...d,...n}},it=t=>{const r=t.title,o=x(t.titleColor||ot.titleColor),s=x(t.underlineColor||ot.underlineColor),i=x(t.infoColor||ot.infoColor),n=(c(t.newlines)?t.newlines:ot.sectionNewlines)?"\n":"";if(r){const t="-".repeat(r.length);e.stdout.write(n+o(r)+"\n"+s(t)+"\n"+n)}t.info&&e.stdout.write(i(t.info)+"\n"+n)},nt=t=>{const r=x(t.tickColor||ot.tickColor),o=x(t.questionColor||ot.questionColor),s=x(t.answerColor||ot.answerColor);e.stdout.write(r("✔ ")+o(t.question)+" "+s(t.answer)+"\n")};function at(t={},e){const r=t[e];if(c(r))return r;u("Missing value for required parameter: ",e)}function ct(t={},e){return g(e).map((e=>at(t,e)))}const lt=ct;const ut={dir:"config"},pt={dir:"lib library src components"},gt={};class dt{constructor(e,r={}){const o=t.dir(e),s=g(r.config?.dir||ut.dir).map((t=>o.dir(t))),i={...ut,...r.config||{}},n=new X(s,i),a=g(r.library?.dir||pt.dir).map((t=>o.dir(t))),c={...pt,...r.library||{}},l=new _(a,c);this.case={...gt,...r.case||{}},this.state={rootDir:o,config:n,library:l},V(this,r.debug,r.debugPrefix,r.debugColor),this.debug("root dir: ",o.path()),this.debug("config dir: ",s.map((t=>t.path()))),this.debug("libDirs: ",a),this.debug("libOpts: ",c)}dir(t,e){return this.debug("dir(%s, %o)",t,e),c(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,r){return this.debug("write(%s, %o, %o)",t,e,r),this.file(t,r).write(e)}configDir(t,e){return this.debug("configDir(%s, %o)",t,e),c(t)?this.state.configDir.dir(t,e):this.state.configDir}async config(t,e){return this.debug("config(%s, %o)",t,e),c(t)?this.state.config.config(t,e):this.state.config}async library(t){return this.debug("library(%s, %o)",t),c(t)?this.state.library.library(t):this.state.library}async component(t,e){const[r,o]=t.split("#",2),s=this.convertCase("config",r),i=await this.config(s,{}),n=i.component?.library||this.convertCase("library",r),a=await this.library(n),c=o||i.component?.export||"default";return new(a[c]||u("No '",c,"' export from component library: ",t))(this,{...i,...e})}convertCase(t,e){const r=this.case[t];return r?r(e):e}}exports.ANSIescape=h,exports.ANSIescapeCode=f,exports.ANSIreset=b,exports.Component=class{constructor(t,e={}){this.workspace=t,this.props=e,V(this,e.debug,e.debugPrefix,e.debugColor),this.initComponent(e)}initComponent(){}},exports.Config=X,exports.Debugger=U,exports.Library=_,exports.Workspace=dt,exports.abort=function(t){rt(1,t)},exports.addDebug=V,exports.allParams=lt,exports.answer=nt,exports.anyParams=function(t,e){let r=!1;const o=g(e),s=o.map((e=>{const o=t[e];return c(o)&&(r=!0),o}));return r?s:u("Missing value for one of: ",function(t,e=", ",r=" or "){return function(t,e=" ",r=e){let o=[...t];const s=o.pop();return o.length?[o.join(e),s].join(r):s}(t,e,r)}(o))},exports.appStatus=t=>async function(...r){try{const e=await t(...r);e&&console.log($(`✓ ${e}`))}catch(t){console.log(e.env.DEBUG?t:P(`✗ ${t.message||t}`))}},exports.args=function(t=e.argv){return t.slice(2)},exports.black=y,exports.blue=k,exports.brightBlack=E,exports.brightBlue=N,exports.brightCyan=S,exports.brightGreen=$,exports.brightGrey=F,exports.brightMagenta=O,exports.brightRed=P,exports.brightWhite=I,exports.brightYellow=A,exports.cmdLineArg=et,exports.cmdLineArgs=async function(t,r=e.argv.slice(2)){let o=[];for(let e of t){const t=await et(e,r);if(!t?.length)return;o.push(t)}return o},exports.color=x,exports.config=(t,e)=>new X(t,e),exports.confirm=async(t,e={})=>tt(t,{...e,type:"confirm"}),exports.cyan=j,exports.darkBlack=W,exports.darkBlue=M,exports.darkCyan=Y,exports.darkGreen=G,exports.darkGrey=R,exports.darkMagenta=Q,exports.darkRed=B,exports.darkWhite=T,exports.darkYellow=L,exports.dataPath=J,exports.defaults=ot,exports.exit=rt,exports.green=w,exports.grey=q,exports.library=(t,e)=>new _(t,e),exports.magenta=C,exports.matchDoubleQuotedString=t=>{const e=t.match(/^"((?:\\[\\"nrt]|.)*?)"$/);return e?e[1].replace(/\\([\\"bfnrtv])/g,((t,e)=>z[e]||`\\${e}`)):null},exports.matchSingleQuotedString=t=>{const e=t.match(/^'((?:\\[\\']|.)*?)'$/);return e?e[1].replace(/\\([\\'bfnrtv])/g,((t,e)=>z[e]||`\\${e}`)):null},exports.options=st,exports.prompt=tt,exports.quit=function(t){rt(0,t)},exports.red=m,exports.requiredParam=at,exports.requiredParams=ct,exports.section=it,exports.splitDataPath=H,exports.white=D,exports.workspace=(t,e)=>new dt(t,e),exports.yellow=v,Object.keys(t).forEach((function(e){"default"===e||exports.hasOwnProperty(e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})})),Object.keys(s).forEach((function(t){"default"===t||exports.hasOwnProperty(t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return s[t]}})}));
2
2
  //# sourceMappingURL=badger.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"badger.cjs.js","sources":["../node_modules/.pnpm/@abw+badger-utils@1.0.16/node_modules/@abw/badger-utils/dist/badger-utils.esm.js","../src/Badger/Utils/Color.js","../src/Badger/Utils/Debug.js","../src/Badger/Utils/DataPath.js","../src/Badger/Config.js","../src/Badger/Library.js","../src/Badger/Utils/Prompt.js","../src/Badger/Utils/CmdLine.js","../src/Badger/Utils/Exit.js","../src/Badger/Utils/Options.js","../src/Badger/Utils/Params.js","../src/Badger/Workspace.js","../src/Badger/Component.js","../src/Badger/Utils/AppStatus.js","../src/Badger/Utils/Misc.js"],"sourcesContent":["function n(n){return\"boolean\"==typeof n}function t(n){return\"string\"==typeof n}function e(n){return\"number\"==typeof n}function r(n){return Number.isInteger(n)}function o(n){return e(n)&&!r(n)}function i(n){return Array.isArray(n)}function u(n){return\"function\"==typeof n}function c(n){return\"object\"==typeof n&&!i(n)&&!a(n)}function s(n){return void 0===n}function a(n){return null===n}function f(n){return!(s(n)||a(n))}function l(...n){return n.every((n=>f(n)))}function p(n){return!f(n)}function d(...n){return n.find((n=>f(n)))}const m=(n,t)=>n.replace(/<(\\w+)>/g,((e,r)=>{const o=t[r];return p(o)&&h(`Invalid variable expansion <${r}> in message format: ${n}`),o}));function h(...n){throw new Error(n.join(\"\"))}function y(n,t){throw new Error(m(n,t))}function $(n){throw n}function g(){}function w(){return Intl.DateTimeFormat().resolvedOptions().locale}let b={locale:w(),currency:\"GBP\",currencySign:\"£\",thousands:\",\"};function j(n={}){b={...b,...n}}const v=(n,t,e=1)=>{const r=t<n?-Math.abs(e):e;return Array(1+Math.floor(Math.abs((t-n)/e))).fill(n).map(((n,t)=>n+t*r))};function I(n,t={}){return new Intl.NumberFormat(t.locale||b.locale,t).format(n)}function x(n,t={}){return I(n,{style:\"currency\",currency:b.currency,...t})}function O(n,t=b.thousands){if(p(n))return\"\";for(var e=n.toString().split(\".\"),r=/(\\d+)(\\d{3})/;r.test(e[0]);)e[0]=e[0].replace(r,`$1${t}$2`);return e.join(\".\")}function k(n){return p(n)?[]:t(n)?n.length?n.split(/,\\s*|\\s+/):[]:i(n)?n:[n]}function A(n,t=!0,e={}){if(c(n))return n;return k(n).reduce(((n,e)=>(n[e]=u(t)?t(e):t,n)),e)}function C(n){return t(n)&&0!==n.length?n.split(/\\s*\\n+\\s*/).filter((function(n){return n.length>0})):[]}function T(n,t=\" \",e=t){let r=[...n];const o=r.pop();return r.length?[r.join(t),o].join(e):o}function E(n,t=\", \",e=\" and \"){return T(n,t,e)}function F(n,t=\", \",e=\" or \"){return T(n,t,e)}function L(n){return n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()}function M(n){return n.replace(/(\\w+)/g,L)}function N(n){return n.split(\"/\").map((n=>n.split(\"_\").map(L).join(\"\"))).join(\"/\")}function S(n){return n.split(\"/\").map((n=>n.split(\"_\").map(((n,t)=>t?L(n):n)).join(\"\"))).join(\"/\")}function P(n,t={}){const e=t[n];if(f(e))return e;let r;return n.match(/(ss?|sh|ch|x)$/)?n+\"es\":(r=n.match(/(.*?[^aeiou])y$/))?r[1]+\"ies\":n.match(/([^s\\d\\W])$/)?n+\"s\":n}function W(n,t={}){const e=t[n];return f(e)?e:n.match(/(ss|sh|ch|x)es$/)?n.replace(/es$/,\"\"):n.match(/([^aeiou])ies$/)?n.replace(/ies$/,\"y\"):n.match(/([^s\\d\\W])s$/)?n.replace(/s$/,\"\"):n}function _(n,t,e,r=\"no\"){return(n?O(n):r)+\" \"+(1===n?t:e||P(t))}function B(n,t,e,r=\"No\"){return _(n,t,e,r)}const D=L,G=M,R=P,U=P;function q(n,t){return Object.keys(n).reduce(((e,r)=>(e[r]=t(n[r],r),e)),{})}const z=(n,e,r={})=>{let o,s={},a={delete:!1,...r};if(u(e))o=e;else if(e instanceof RegExp)o=n=>e.test(n);else if(c(e))o=n=>e[n];else if(i(e)||t(e)){const n=A(e);o=t=>n[t]}else h(\"Invalid specification for extract(): \"+e);return Object.keys(n).map((t=>{if(o(t)){let e=n[t];a.delete&&delete n[t],a.key&&(t=a.key(t)),a.value&&(e=a.value(e)),s[t]=e}})),s},H=z,J=(n,t)=>{const e=n[t];return delete n[t],e},K=Object.keys,Q=Object.values,V=Object.entries,X=(n,t)=>parseInt(n[t]||0),Y=(n,t)=>parseFloat(n[t]||0),Z=(n,t)=>(n[t]||\"\").toString(),nn=n=>(t,e)=>X(t,n)-X(e,n),tn=n=>(t,e)=>Y(t,n)-Y(e,n),en=n=>(t,e)=>{let r=Z(t,n).toLowerCase(),o=Z(e,n).toLowerCase();return r>o?1:o>r?-1:0},rn={num:tn,int:nn,str:en,number:tn,integer:nn,string:en},on=n=>n,un=n=>(t,e)=>n(e,t),cn={asc:on,desc:un,ascending:on,descending:un},sn=n=>{const e=k(n).map((n=>{if(u(n))return n;if(t(n)){const t=n.match(/^(\\w+)(?::(\\w+))?(?::(\\w+))?$/)||h(`Invalid sort field: ${n}`),e=rn[t[2]||\"string\"]||h(`Invalid sort type \"${t[2]}\" in sort field: ${n}`);return(cn[t[3]||\"asc\"]||h(`Invalid sort order \"${t[3]}\" in sort field: ${n}`))(e(t[1]))}h(`Invalid sort field: ${n}`)}));return(n,t)=>{for(let r=0;r<e.length;r++){const o=(0,e[r])(n,t);if(0!==o)return o}return 0}};function an(n,t=300){let e;return(...r)=>{clearTimeout(e),e=setTimeout((()=>n.apply(this,r)),t)}}function fn(n){return new Promise((t=>setTimeout(t,n)))}export{B as Inflect,on as ascendingOrder,L as capitalise,M as capitaliseWords,D as capitalize,G as capitalizeWords,O as commas,x as currency,an as debounce,w as defaultLocale,un as descendingOrder,g as doNothing,V as entries,z as extract,h as fail,y as failMsg,d as firstValue,m as format,I as formatNumber,f as hasValue,l as haveValue,_ as inflect,X as integerField,nn as integerSort,i as isArray,n as isBoolean,o as isFloat,u as isFunction,r as isInteger,a as isNull,e as isNumber,c as isObject,t as isString,s as isUndefined,T as joinList,E as joinListAnd,F as joinListOr,K as keys,sn as multiSort,p as noValue,Y as numberField,tn as numberSort,q as objMap,H as objSubset,P as plural,R as pluralise,U as pluralize,v as range,J as remove,$ as rethrow,j as setNumberDefaults,W as singular,fn as sleep,S as snakeToCamel,N as snakeToStudly,cn as sortOrders,rn as sortTypes,A as splitHash,C as splitLines,k as splitList,Z as stringField,en as stringSort,Q as values};\n//# sourceMappingURL=badger-utils.esm.js.map\n","import { isObject } from \"@abw/badger-utils\";\n\nconst ANSIStart = '\\u001B[';\nconst ANSIEnd = 'm';\nconst ANSIColors = {\n reset: 0,\n bold: 1,\n bright: 1,\n dark: 2,\n black: 0,\n red: 1,\n green: 2,\n yellow: 3,\n blue: 4,\n magenta: 5,\n cyan: 6,\n grey: 7,\n white: 8,\n fg: 30,\n bg: 40,\n};\n\n/**\n * Returns an ANSI escape code for a color string. This can be a single color\n * name, e.g. `red`, `green`, etc., or a color prefixed with `bright` or `dark`,\n * e.g. `bright red`, `dark green`, etc. An optional section argument can be\n * set to `fg` (default) to set a foreground color or `bg` for a background color.\n * @param {String} color - color name with optional modifier prefix\n * @param {String} [base='fg'] - `fg` or `bg` to set foreground or background color respectively\n * @return {String} ANSI escape code string\n * @example\n * const str = escapeCode('red')\n * @example\n * const str = escapeCode('bright red')\n * @example\n * const str = escapeCode('bright red', 'bg')\n */\nexport const ANSIescapeCode = (color, base='fg') => {\n let codes = [ ];\n let pair = color.split(/ /, 2);\n const hue = pair.pop();\n const code = (base ? ANSIColors[base] : 0) + ANSIColors[hue];\n codes.push(code);\n if (pair.length) {\n const shade = pair.length ? pair.shift() : 'dark';\n codes.push(ANSIColors[shade])\n }\n // console.log('escapeCode(%s, %s) => ', color, base, codes.join(';'));\n return ANSIStart + codes.join(';') + ANSIEnd;\n}\n\n/**\n * Returns an ANSI escape code for a color string or combination of foreground and\n * background colors.\n * @param {String|Object} colors - either a simple color name or object contain foreground and background colors\n * @param {String} [colors.fg] - foreground color\n * @param {String} [colors.fg] - background color\n * @return {String} ANSI escape code string\n * @example\n * const str = escape('red')\n * @example\n * const str = escape('bright red')\n * @example\n * const str = escape({ fg: 'bright yellow', bg: 'blue' })\n */\nexport const ANSIescape = (colors={}) => {\n const col = isObject(colors) ? colors : { fg: colors };\n let escapes = [ ];\n if (col.bg) {\n escapes.push(ANSIescapeCode(col.bg, 'bg'));\n }\n if (col.fg) {\n escapes.push(ANSIescapeCode(col.fg, 'fg'));\n }\n return escapes.join('');\n}\n\n/**\n * Returns an ANSI escape code to reset all colors.\n * @return {String} ANSI escape reset string\n */\nexport const ANSIreset = () => ANSIescapeCode('reset', false)\n\n/**\n * Returns a function to display strings in a particular color.\n * @param {String} colors - color(s) to display string\n * @return {Function} function to display strings in the pre-defined color(s)\n */\nexport const color = (colors) =>\n text => ANSIescape(colors) + text + ANSIreset();\n\nexport const black = color('black');\nexport const red = color('red');\nexport const green = color('green');\nexport const yellow = color('yellow');\nexport const blue = color('blue');\nexport const magenta = color('magenta');\nexport const cyan = color('cyan');\nexport const grey = color('grey');\nexport const white = color('white');\nexport const brightBlack = color('bright black');\nexport const brightRed = color('bright red');\nexport const brightGreen = color('bright green');\nexport const brightYellow = color('bright yellow');\nexport const brightBlue = color('bright blue');\nexport const brightMagenta = color('bright magenta');\nexport const brightCyan = color('bright cyan');\nexport const brightGrey = color('bright grey');\nexport const brightWhite = color('bright white');\nexport const darkBlack = color('dark black');\nexport const darkRed = color('dark red');\nexport const darkGreen = color('dark green');\nexport const darkYellow = color('dark yellow');\nexport const darkBlue = color('dark blue');\nexport const darkMagenta = color('dark magenta');\nexport const darkCyan = color('dark cyan');\nexport const darkGrey = color('dark grey');\nexport const darkWhite = color('dark white');\n","import { ANSIescape, ANSIreset } from './Color.js'\nimport { doNothing } from '@abw/badger-utils';\n\n/**\n * Returns a debugging function which is enabled by the first `enabled` argument.\n * If this is `false` then it returns a function which does nothing. If it is\n * true then it returns a function that forwards all arguments to `console.log`.\n * An optional `prefix` be be specified to prefix each debugging line. The\n * optional third argument `color` can be used to specify a color for the prefix.\n * @param {Boolean} enabled - is debugging enabled?\n * @param {String} [prefix] - optional prefix for debugging messages\n * @param {String|Object} [color] - a color name or object (see {@link Badger/Utils/Color})\n * @param {String} [color.fg] - foreground color\n * @param {String} [color.bg] - background color\n * @return {Function} a debugging function\n * @example\n * const debug = Debugger(true)\n * @example\n * const debug = Debugger(true, 'Debug > ')\n * @example\n * const debug = Debugger(true, 'Debug > ', 'blue')\n * @example\n * const debug = Debugger(true, 'Debug > ', { bg: 'blue', fg: 'bright yellow' })\n */\nexport function Debugger(enabled, prefix='', color) {\n return enabled\n ? prefix\n ? (format, ...args) =>\n console.log(\n '%s' + prefix + '%s' + format,\n color ? ANSIescape(color) : '',\n ANSIreset(),\n ...args,\n )\n : console.log.bind(console)\n : doNothing;\n}\n\n/**\n * Creates a debugging function via {@link Debugger} and attaches it to the object\n * passed as the first argument as the `debug` function.\n * @param {Object} obj - the object to receive the `debug` function\n * @param {Boolean} enabled - is debugging enabled?\n * @param {String} [prefix] - optional prefix for debugging messages\n * @param {String|Object} [color] - a color name or object (see {@link Badger/Utils/Color})\n * @param {String} [color.fg] - foreground color\n * @param {String} [color.bg] - background color\n * @example\n * const debug = addDebug(myObject, true)\n * @example\n * const debug = addDebug(myObject, true, 'Debug > ')\n * @example\n * const debug = addDebug(myObject, true, 'Debug > ', 'blue')\n * @example\n * const debug = addDebug(myObject, true, 'Debug > ', { bg: 'blue', fg: 'bright yellow' })\n */\nexport function addDebug(obj, enabled, prefix='', color) {\n obj.debug = Debugger(enabled, prefix, color);\n}\n","import { fail, hasValue, isArray, noValue } from \"@abw/badger-utils\";\n\n/**\n * Characters that can be escaped in quoted strings.\n */\nconst quotedEscapes = {\n b: \"\\b\",\n f: \"\\f\",\n n: \"\\n\",\n r: \"\\r\",\n t: \"\\t\",\n v: \"\\v\",\n '\"': '\"',\n \"'\": \"'\",\n '\\\\': '\\\\',\n}\n\n/**\n * Match a double quoted string and expand escaped characters\n * @param {String} [string] - the string to match\n */\nexport const matchDoubleQuotedString = string => {\n const regex = /^\"((?:\\\\[\\\\\"nrt]|.)*?)\"$/\n const match = string.match(regex);\n return match\n ? match[1].replace(/\\\\([\\\\\"bfnrtv])/g, (all, one) => quotedEscapes[one] || `\\\\${one}`)\n : null;\n}\n\n/**\n * Match a single quoted string and expand escaped characters\n * @param {String} [string] - the string to match\n */\nexport const matchSingleQuotedString = string => {\n const regex = /^'((?:\\\\[\\\\']|.)*?)'$/\n const match = string.match(regex);\n return match\n ? match[1].replace(/\\\\([\\\\'bfnrtv])/g, (all, one) => quotedEscapes[one] || `\\\\${one}`)\n : null;\n}\n\n/**\n * Split a data path into component parts\n * @param {String} [path] - the path to split\n */\nexport const splitDataPath = path => {\n // * match a slash: \\/\n // * match a single quoted string: '...'\n // * match a double quoted string: \"...\"\n // * match anything else: hello world!\n let parts = [ ];\n const regex = /(?:(\\/)|'((?:\\\\[\\\\']|.)*?)'|\"((?:\\\\[\\\\\"nrt]|.)*?)\"|([^/?]+))(\\??)/g;\n const matches = [...path.matchAll(regex)];\n\n matches.map(\n ([ , , single, double, other, optional]) => {\n let part;\n // console.log('match [slash:%s] [single:%s] [double:%s] [other:%s]', slash, single, double, other);\n\n if (single) {\n part = single.replace(/\\\\([\\\\'bfnrtv])/g, (all, one) => quotedEscapes[one] || `\\\\${one}`);\n }\n else if (double) {\n part = double.replace(/\\\\([\\\\\"bfnrtv])/g, (all, one) => quotedEscapes[one] || `\\\\${one}`);\n }\n else if (other) {\n part = other\n }\n if (hasValue(part)) {\n parts.push(optional ? [part, {optional:true}] : part);\n }\n }\n )\n // console.log('MATCHED ', parts);\n\n return parts;\n}\n\n/**\n * Traverse a data structure using a path.\n * @param {Object} [data] - the data to traverse\n * @param {String} [path] - the data path\n */\nexport const dataPath = (data, path) => {\n let root = data;\n let parts = splitDataPath(path);\n let done = [ ];\n // console.log('parts: ', parts);\n\n for (let part of parts) {\n const [word, opts] = isArray(part) ? part : [part, {}];\n root = root[word];\n done.push(word);\n if (noValue(root)) {\n if (opts.optional) {\n return root;\n }\n else {\n fail(\"No value for data at path: \", done.join('/'));\n }\n }\n }\n return root;\n}\n","import { DirPath } from '@abw/badger-filesystem';\nimport { addDebug } from './Utils/Debug.js';\nimport { dataPath } from '../Badger/Utils/DataPath.js';\nimport { doNothing, fail, splitList } from '@abw/badger-utils';\n\n/**\n * Default configuration options.\n */\nconst defaults = {\n codec: ['yaml', 'json'],\n jsExt: ['js', 'mjs'],\n};\n\n/**\n * The Config class implements an object which can load configuration\n * files from a configuration directory. Files can be Javascript files\n * (with `.js` or `.mjs` extensions by default) or data files using any\n * of the standard codecs (`.yaml` or `.json` by default).\n */\nexport class Config extends DirPath {\n /**\n * Constructor for Config object.\n * @param {String} dir - one or more directories that contain configuration files\n * @param {Object} [options] - configuration options\n * @param {Array|String} [options.jsExt='js mjs'] - Array or comma/whitespace delimited string of Javascript file extensions\n * @param {Array|String} [options.codec='yaml json'] - Array or comma/whitespace delimited string of codec names\n * @return {Object} the Config object\n */\n constructor(dir, options={}) {\n super(dir);\n const params = { ...defaults, ...options };\n this.state.codec = splitList(params.codec),\n this.state.jsExt = splitList(params.jsExt),\n addDebug(this, options.debug, options.debugPrefix, options.debugColor);\n }\n\n /**\n * Internal method to locate the first config file with one of a number of file extensions.\n * @param {String} uri - base part of filename\n * @param {Array} [exts] - array of possible extensions\n * @param {Function} [makeOptions] - optional function to generate options for a {@link File} object\n * @return {Object} the {@link File} object if it exists or `undefined` if not\n */\n async firstFileWithExt(uri, exts, makeOptions=doNothing) {\n const dirs = await this.dirs();\n\n for (let dir of dirs) {\n for (let ext of exts) {\n const path = uri + '.' + ext;\n const file = dir.file(path, makeOptions(uri, ext));\n this.debug('looking for config file: ', file.path());\n if (await file.exists()) {\n this.debug('config file exists: ', file.path());\n return file;\n }\n }\n }\n return undefined;\n }\n\n /**\n * Internal method to locate a Javascript configuration file with one of the `jsExt` extensions (`.js` or `.mjs` by default)\n * @param {String} uri - base part of filename\n * @return {Object} the {@link File} object if it exists or `undefined` if not\n */\n async jsFile(uri) {\n return await this.firstFileWithExt(uri, this.state.jsExt);\n }\n\n /**\n * Internal method to locate a configuration file with one of the `codec` extensions (`.yaml` or `.json` by default)\n * @param {String} uri - base part of filename\n * @return {Object} the {@link File} object if it exists or `undefined` if not\n */\n async file(uri) {\n return await this.firstFileWithExt(uri, this.state.codec, (uri, codec) => ({ codec }));\n }\n\n /**\n * Method to fetch configuration data from a file. The file can be a Javascript file which should\n * return the configuration data as the default export, or a YAML (`.yaml`) or JSON (`.json`) file.\n * If the file isn't found then the method returns the `defaults` data if provided, or throws an\n * error if not.\n * @param {String} uri - base part of filename\n * @param {Object} [defaults] - default configuration options to be used if a file isn't found\n * @return {Object} the configuration data loaded from the file\n */\n async config(uri, defaults) {\n const [base, fragment] = uri.split('#', 2);\n let jsFile, file, data;\n\n // first look for a JS file, e.g. <uri>.js, <uri>.mjs\n if ((jsFile = await this.jsFile(base))) {\n data = await import(jsFile.path());\n }\n // then for a config file with a codec extension, e.g. <uri>.yaml, <uri>.yaml\n else if ((file = await this.file(base))) {\n data = await file.read();\n }\n // failing that use any default value\n else if (defaults) {\n data = defaults;\n }\n // anything else is a big pile of fail\n else {\n return fail(\"No configuration file for \" + base);\n }\n // resolve any data path in a #fragment\n return fragment\n ? dataPath(data, fragment)\n : data;\n }\n}\n\n/**\n * Function to create a new Config object\n * @param {String} dir - directory or directories containing configuration files\n * @param {Object} [options] - configuration options\n * @param {Array|String} [options.jsExt='js mjs'] - Array or comma/whitespace delimited string of Javascript file extensions\n * @param {Array|String} [options.codec='yaml json'] - Array or comma/whitespace delimited string of codec names\n * @return {Object} the Config object\n */\nexport const config = (dir, options) => new Config(dir, options)\n\nexport default Config\n","import { DirPath } from \"@abw/badger-filesystem\";\nimport { addDebug } from \"./Utils/Debug.js\";\nimport { dataPath } from \"./Utils/DataPath.js\";\nimport { fail, splitList } from \"@abw/badger-utils\";\n\n/**\n * Default configuration options.\n */\nconst defaults = {\n jsExt: 'js mjs',\n}\n\n/**\n * The Library class implements an object which can load Javascript files\n * from one or more library directories. Files can be Javascript files\n * (with `.js` or `.mjs` extensions by default)\n */\nexport class Library extends DirPath {\n /**\n * Constructor for Library object.\n * @param {String} dir - one or more directories that contain Javascript libraries\n * @param {Object} [options] - configuration options\n * @param {Array|String} [options.jsExt='js mjs'] - Array or comma/whitespace delimited string of Javascript file extensions\n * @return {Object} the Library object\n */\n constructor(dir, options={}) {\n super(dir);\n const params = { ...defaults, ...options };\n const exts = splitList(params.jsExt).map( ext => ext.replace(/^\\./, '') ); // remove leading '.'\n this.state.exts = exts;\n addDebug(this, options.debug, options.debugPrefix, options.debugColor);\n this.debug(\"state: \", this.state)\n }\n\n /**\n * Method to load a Javascript library in one of the library directories and with one of the `jsExt` extensions (`.js` or `.mjs` by default).\n * Returns the exports from the library if found or throws an error if not.\n * @param {String} uri - base part of filename\n * @return {Object} the exports from the loaded libary\n */\n async library(uri) {\n const [base, fragment] = uri.split('#', 2);\n const dirs = await this.dirs();\n const exts = this.state.exts;\n for (let dir of dirs) {\n for (let ext of exts) {\n const file = dir.file(base + '.' + ext);\n this.debug('looking for module %s as', base, file.path());\n const exists = await file.exists();\n if (exists) {\n const load = await import(file.path());\n this.debug('loaded %s as', file.path());\n return fragment\n ? dataPath(load, fragment)\n : load;\n }\n }\n }\n fail(\"Library not found: \", uri);\n }\n}\n\n/**\n * Function to create a new Library object\n * @param {String} dir - directory or directories containing configuration files\n * @param {Object} [options] - configuration options\n * @param {Array|String} [options.jsExt='js mjs'] - Array or comma/whitespace delimited string of Javascript file extensions\n * @return {Object} the Library object\n */\nexport const library = (dir, options) => new Library(dir, options);\n\nexport default library;","import { isString } from '@abw/badger-utils';\nimport prompts from 'prompts'\n\n/**\n * Prompt user to enter a value.\n * @param {String} question - question to prompt user to answer\n * @param {Object} [options] - optional options\n * @param {String} [options.default] - default value returned if user presses RETURN\n * @return {Promise} fulfills with response to question or default value\n * @example\n * prompt(\"What is your name?\")\n * .then( name => console.log(`Hello ${name}`) );\n * @example\n * prompt(\"What is your name?\", { default: 'Mr.Badger' })\n * .then( name => console.log(`Hello ${name}`) );\n */\nexport const prompt = async (question, options={}) => {\n options = isString(options)\n ? { default: options }\n : options;\n\n const name = options.name || 'answer';\n const answers = await prompts([\n {\n name,\n type: options.type || 'text',\n message: question,\n initial: options.default,\n },\n ]);\n return answers[name];\n}\n\n/**\n * Prompt user to confirm a choice.\n * @param {String} question - question to prompt user to answer\n * @param {Object} [options] - optional options\n * @param {String} [options.default] - default value returned if user presses RETURN\n * @return {Promise} fulfills with response to question or default value\n * @example\n * confirm(\"Are you sure?\")\n * .then( yes => console.log('You said \"%s\"', yes ? 'YES' : 'NO') );\n */\nexport const confirm = async (question, options={}) =>\n prompt(question, { ...options, type: 'confirm' });\n\nexport default prompt","import process from 'node:process'\nimport { prompt } from './Prompt.js';\n\n// quick hacks - use with caution\nexport async function cmdLineArg(argPrompt, args=process.argv.slice(2)) {\n if (args.length) {\n return args.shift();\n }\n else if (argPrompt) {\n return await prompt(argPrompt);\n }\n return undefined;\n}\n\nexport async function cmdLineArgs(argPrompts, args=process.argv.slice(2)) {\n let results = [ ];\n for (let argPrompt of argPrompts) {\n const response = await cmdLineArg(argPrompt, args);\n if (! response?.length) {\n return undefined;\n }\n results.push(response);\n }\n return results;\n}","import process from 'node:process'\n\nexport function exit(value, message) {\n if (message) {\n console.log(message);\n }\n process.exit(value);\n}\n\nexport function quit(message) {\n exit(0, message);\n}\n\nexport function abort(message) {\n exit(1, message);\n}","import process from 'node:process';\nimport prompter from 'prompts'\nimport { Command } from 'commander';\nimport { color } from './Color.js';\nimport { hasValue } from '@abw/badger-utils';\n\nexport const defaults = {\n verboseColor: 'magenta',\n titleColor: 'bright yellow',\n underlineColor: 'dark yellow',\n infoColor: 'cyan',\n tickColor: 'green',\n questionColor: 'bright white',\n answerColor: 'bright green',\n sectionNewlines: true\n};\n\nexport const options = async config => {\n const vcol = color(options.verboseColor || defaults.verboseColor);\n const command = new Command;\n\n // set command name, description and version\n if (config.name) {\n command.name(config.name);\n }\n if (config.description) {\n command.description(config.description);\n }\n if (config.version) {\n command.version(config.version);\n }\n\n // define the -y / -yes and -v / --verbose options\n if (config.yes) {\n command.option('-y, --yes', 'Accept default answers')\n }\n if (config.verbose) {\n command.option('-v, --verbose', 'Verbose output')\n }\n if (config.quiet) {\n command.option('-q, --quiet', 'Quiet output')\n }\n\n // add in other command line options\n config.options\n ?.filter(\n option => {\n if (hasValue(option.arg) && ! option.arg) {\n // allow arg: false to indicate no command line argument\n return false;\n }\n if (option.title) {\n // section break\n return;\n }\n return hasValue(option.name);\n }\n )\n .forEach(\n option => {\n const name = option.name;\n const about = option.about;\n const deflt = option.default;\n const handler = option.handler;\n const short = option.short;\n const type = option.type;\n const pattern = option.pattern || (hasValue(type) ? `<${type}>` : undefined);\n let string = `--${name}`;\n let args = [];\n if (hasValue(short)) {\n string = `-${short}, ${string}`;\n }\n if (hasValue(pattern)) {\n string = `${string} ${pattern}`;\n }\n args.push(string);\n if (hasValue(about)) {\n args.push(about);\n }\n if (hasValue(handler)) {\n args.push(handler);\n }\n if (hasValue(deflt)) {\n args.push(deflt);\n }\n console.log('command option: ', args);\n\n command.option(...args)\n }\n )\n\n let commands = { };\n\n config.commands?.forEach(\n option => {\n const name = option.name;\n const about = option.about;\n const type = option.type;\n const pattern = option.pattern || (hasValue(type) ? `<${type}>` : undefined);\n let string = name;\n let cmd = command.command(string)\n if (hasValue(pattern)) {\n cmd.argument(pattern);\n // string = `${string} ${pattern}`;\n }\n if (hasValue(about)) {\n cmd.description(about);\n }\n cmd.action(\n args => {\n commands[name] = args;\n }\n )\n //console.log({ args });\n //command.command(...args)\n }\n )\n\n // parse the command line arguments\n command.parse();\n const cmdline = command.opts();\n\n // if the -y / --yes option has been specified then accept all\n // default answers automatically\n const yes = config.yes && cmdline.yes;\n const verbose = config.verbose && cmdline.verbose;\n const quiet = config.quiet && cmdline.quiet;\n\n if (yes) {\n if (verbose && ! quiet) {\n process.stdout.write(vcol('Accepting default answers (-y option is set)\\n'))\n }\n prompter.override(cmdline);\n }\n\n // build up the list of prompts for interactive questions\n let prompts = [ ];\n config.options?.forEach(\n option => {\n const type = option.type || 'text';\n const name = option.name;\n const prompt = option.prompt;\n const noArg = hasValue(option.arg) && ! option.arg;\n const validate = option.validate ||\n (option.required\n ? value => (hasValue(value) && value.toString().length)\n ? true\n : (options.invalid || `You must enter a value for ${name}`)\n : undefined\n )\n\n // special process for initial\n // - use cmdline[name]\n // - or if noArg, use option.default\n // - if a select list and not a number, find the index\n let initial = noArg ? option.default : cmdline[name];\n if (type === 'select' && hasValue(initial)) {\n if (! Number.isInteger(initial)) {\n // console.log('looking up select option for [%s]', initial);\n initial = option.choices?.findIndex( i => i.value === initial );\n if (initial < 0) {\n initial = 0;\n }\n }\n }\n\n if (hasValue(prompt)) {\n prompts.push(\n {\n ...option,\n type: (\n hasValue(initial)\n ? () => {\n yes && (quiet || answer({ question: prompt, answer: initial }));\n return type;\n }\n : type\n ),\n name,\n message: prompt,\n initial: initial,\n validate: validate,\n },\n )\n }\n else if (option.title || option.info) {\n prompts.push(\n {\n type: () => {\n quiet || section(option);\n return false;\n }\n }\n );\n }\n }\n );\n\n // prompt the user to answer/confirm questions\n const answers = await prompter(prompts);\n\n return {\n ...cmdline, ...answers, ...commands\n }\n}\n\nexport const section = option => {\n const title = option.title;\n const tcol = color(option.titleColor || defaults.titleColor);\n const ucol = color(option.underlineColor || defaults.underlineColor);\n const icol = color(option.infoColor || defaults.infoColor);\n const nl = (hasValue(option.newlines) ? option.newlines : defaults.sectionNewlines) ? \"\\n\" : \"\";\n\n if (title) {\n const uline = '-'.repeat(title.length);\n process.stdout.write(nl + tcol(title) + \"\\n\" + ucol(uline) + \"\\n\" + nl);\n }\n\n if (option.info) {\n process.stdout.write(icol(option.info) + \"\\n\" + nl);\n }\n}\n\nexport const answer = option => {\n const tcol = color(option.tickColor || defaults.tickColor);\n const qcol = color(option.questionColor || defaults.questionColor);\n const acol = color(option.answerColor || defaults.answerColor);\n process.stdout.write(tcol(\"✔ \") + qcol(option.question) + \" \" + acol(option.answer) + \"\\n\");\n}\n\nexport default options","import { joinListOr, splitList, hasValue, fail } from \"@abw/badger-utils\";\n\n/**\n * Assert that a parameter object contains an item with a defined/non-null value\n * @param {Object} params={} - parameters object\n * @param {String} name - parameter that must be included\n * @return {any} the parameter value\n * @throws {Error} if the parameter is not defined or null\n * @example\n * const foo = requiredParam({ foo: 10 }, 'foo');\n */\nexport function requiredParam(params={}, name) {\n const value = params[name];\n if (hasValue(value)) {\n return value;\n }\n else {\n fail(\"Missing value for required parameter: \", name);\n }\n}\n\n/**\n * Assert that a parameter object contains all specified item with a defined/non-null value\n * @param {Object} params={} - parameters object\n * @param {Array|String} names - parameters that must be included, as an Array or whitespace/comma delimited string (see {@link splitList})\n * @return {Array} the parameter values\n * @throws {Error} if any parameter is not defined or null\n * @example\n * const [foo, bar] = requiredParams({ foo: 10, bar: 20 }, 'foo bar');\n */\nexport function requiredParams(params={}, names) {\n return splitList(names).map( name => requiredParam(params, name) );\n}\n\n/**\n * An alias for {@link requiredParams} for people who don't like typing long names (and for symmetry with {@link anyParams}))\n */\nexport const allParams=requiredParams;\n\n/**\n * Assert that a parameter object contains any of the specified items with a defined/non-null value\n * @param {Object} params={} - parameters object\n * @param {Array|String} names - parameters of which at least one must be included, as an Array or whitespace/comma delimited string (see {@link splitList})\n * @return {Array} the parameter values\n * @throws {Error} if any parameter is not defined or null\n * @example\n * const [foo, bar] = anyParams({ foo: 10, wiz: 99 }, 'foo bar');\n */\nexport function anyParams(params, names) {\n let found = false;\n const nlist = splitList(names);\n const values = nlist.map(\n name => {\n const value = params[name];\n if (hasValue(value)) {\n found = true;\n }\n return value;\n }\n );\n return found\n ? values\n : fail(\"Missing value for one of: \", joinListOr(nlist));\n}\n","import { addDebug } from \"./Utils/Debug.js\";\nimport { Config } from \"./Config.js\";\nimport { Library } from \"./Library.js\";\nimport { dir as fsDir } from \"@abw/badger-filesystem\";\nimport { fail, hasValue, splitList } from \"@abw/badger-utils\";\n\n/**\n * Default configuration options.\n */\nconst defaults = {\n config: {\n dir: 'config',\n },\n library: {\n dir: 'lib library src components',\n },\n case: {\n // config and/or library case conversion functions\n }\n}\n\n/**\n * The Workspace class implements an object which acts as a central repository\n * for your project, providing access to directories, files, configuration files,\n * Javascript libraries and components.\n */\nexport class Workspace {\n /**\n * Constructor for Workspace object.\n * @param {String} dir - root directory for the workspace\n * @param {Object} [options] - configuration options\n * @param {Object} [options.config] - configuration options for a {@link Config} object\n * @param {Array|String} [options.config.dir] - configuration directory or directories relative to the workspace directory\n * @param {Object} [options.library] - configuration options for a {@link Config} object\n * @param {Array|String} [options.library.dir] - library directory or directories relative to the workspace directory\n * @return {Object} the Workspace object\n */\n constructor(dir, options={}) {\n const rootDir = fsDir(dir);\n const cfgDir = splitList(options.config?.dir || defaults.config.dir).map( dir => rootDir.dir(dir) );\n const cfgOpts = { ...defaults.config, ...(options.config||{}) };\n const config = new Config(cfgDir, cfgOpts);\n const libDirs = splitList(options.library?.dir || defaults.library.dir).map( dir => rootDir.dir(dir) );\n const libOpts = { ...defaults.library, ...(options.library||{}) };\n const library = new Library(libDirs, libOpts);\n\n this.case = {\n ...defaults.case,\n ...(options.case||{})\n };\n\n this.state = {\n rootDir,\n config,\n library\n }\n\n addDebug(this, options.debug, options.debugPrefix, options.debugColor);\n this.debug('root dir: ', rootDir.path());\n this.debug('config dir: ', cfgDir.map( d => d.path() ));\n this.debug('libDirs: ', libDirs);\n this.debug('libOpts: ', libOpts);\n }\n\n /**\n * Fetch a new {@link Directory} object for a sub-directory of the workspace directory.\n * @param {string} path - directory path relative to the workspace directory\n * @param {Object} [options] - directory configuration options\n * @param {String} [options.codec] - codec for encoding/decoding file data\n * @return {Object} a {@link Directory} object\n */\n dir(path, options) {\n this.debug(\"dir(%s, %o)\", path, options);\n return hasValue(path)\n ? this.state.rootDir.dir(path, options)\n : this.state.rootDir;\n }\n\n /**\n * Fetch a new {@link File} object for a file in the workspace.\n * @param {string} path - file path relative to the workspace directory\n * @param {Object} [options] - file configuration options\n * @param {String} [options.codec] - codec for encoding/decoding file data\n * @param {Boolean} [options.encoding=utf8] - character encoding for the file\n * @return {Object} a {@link File} object\n */\n file(path, options) {\n this.debug(\"file(%s, %o)\", path, options);\n return this.state.rootDir.file(path, options)\n }\n\n /**\n * Read the content of a file in the workspace.\n * @param {string} path - file path relative to the workspace directory\n * @param {Object} [options] - directory configuration options\n * @param {Boolean} [options.codec] - codec for encoding/decoding file data\n * @param {Boolean} [options.encoding=utf8] - character encoding for the file\n * @return {Promise} fulfills with the file content\n * @example\n * file('myfile.txt').read().then( text => console.log(text) );\n * @example\n * file('myfile.json', { codec: 'json' }).read().then( data => console.log(data) );\n * @example\n * file('myfile.json').read({ codec: 'json' }).then( data => console.log(data) );\n */\n read(path, options) {\n this.debug(\"read(%s, %o)\", path, options);\n return this.file(path, options).read();\n }\n\n /**\n * Writes content to a file. If a `codec` has been specified then the content will be encoded.\n * @param {string} path - file path relative to the workspace directory\n * @param {String|Object} data - directory configuration options\n * @param {Object} [options] - directory configuration options\n * @param {Boolean} [options.codec] - codec for encoding/decoding file data\n * @param {Boolean} [options.encoding=utf8] - codec for encoding/decoding file data\n * @return {Promise} fulfills with the file object\n * @example\n * file('myfile.txt').write('Hello World');\n * @example\n * file('myfile.json', { codec: 'json' }).write({ message: 'Hello World' });\n * @example\n * file('myfile.json').write({ message: 'Hello World' }, { codec: 'json' });\n */\n write(path, data, options) {\n this.debug(\"write(%s, %o, %o)\", path, data, options);\n return this.file(path, options).write(data);\n }\n\n /**\n * Fetch the configuration directory or a directory relative to it\n * @param {string} [path] - file path relative to the configuration directory\n * @param {Object} [options] - directory configuration options\n * @param {String} [options.codec] - codec for encoding/decoding data for files in the directory\n * @param {Boolean} [options.encoding=utf8] - character encoding for files in the directory\n * @return {Object} a {@link Directory} object\n */\n configDir(path, options) {\n this.debug(\"configDir(%s, %o)\", path, options);\n return hasValue(path)\n ? this.state.configDir.dir(path, options)\n : this.state.configDir;\n }\n\n /**\n * Fetches configuration data from a file in the configuration directory or returns the\n * {@link Config} object itself if no file uri is specified.\n * @param {string} [uri] - file path relative to the configuration directory\n * @param {Object} [defaults] - default configuration options if file isn't found\n * @return {Promise} fulfills to the configuration data read from the file\n * @example\n * workspace.config('myfile').then(\n * config => console.log(\"Loaded myfile config: \", config)\n * );\n */\n async config(uri, defaults) {\n this.debug(\"config(%s, %o)\", uri, defaults);\n return hasValue(uri)\n ? this.state.config.config(uri, defaults)\n : this.state.config;\n }\n\n /**\n * Loads a Javscript library from the library directory or returns the\n * {@link Library} object itself if no file uri is specified.\n * @param {string} [uri] - file path relative to the library directory\n * @return {Promise} fulfills to the configuration data read from the file\n * @example\n * workspace.library('mylib').then(\n * exports => console.log(\"Loaded mylib exports: \", exports)\n * );\n */\n async library(uri) {\n this.debug(\"library(%s, %o)\", uri);\n return hasValue(uri)\n ? this.state.library.library(uri)\n : this.state.library;\n }\n\n /**\n * Loads a Javscript library from the library directory and instantiates a\n * component.\n * @param {String} uri - component base name\n * @param {Object} [props] - optional configuration properties\n * @return {Promise} fulfills to a newly instantiated component\n * @example\n * workspace.component('mycomp').then(\n * component => console.log(\"Created component: \", component)\n * );\n */\n async component(uri, props) {\n const [base, fragment] = uri.split('#', 2);\n const cfgname = this.convertCase('config', base);\n const config = await this.config(cfgname, {});\n const libname = config.component?.library || this.convertCase('library', base);\n const lib = await this.library(libname);\n const exp = fragment || config.component?.export || 'default';\n const compcls = lib[exp] || fail(\"No '\", exp, \"' export from component library: \", uri);\n const comp = new compcls(this, { ...config, ...props });\n return comp;\n }\n\n convertCase(type, uri) {\n const fn = this.case[type];\n return fn\n ? fn(uri)\n : uri;\n }\n}\n\nexport const workspace = (dir, options) => new Workspace(dir, options);\n\nexport default Workspace;","import { addDebug } from \"./Utils/Debug.js\";\n\nexport class Component {\n constructor(workspace, props={}) {\n this.workspace = workspace;\n this.props = props;\n addDebug(this, props.debug, props.debugPrefix, props.debugColor);\n this.initComponent(props);\n }\n initComponent() {\n // stub for subclasses\n }\n}\n\nexport default Component","import process from 'node:process'\nimport { brightGreen, brightRed } from './Color.js';\n\nexport const appStatus = app => async function(...args) {\n try {\n const message = await app(...args);\n if (message) {\n console.log(brightGreen(`✓ ${message}`));\n }\n }\n catch (error) {\n console.log(\n process.env.DEBUG\n ? error\n : brightRed(`✗ ${error.message||error}`)\n )\n }\n}\n\nexport default appStatus","import process from \"node:process\"\n\n/**\n * Returns an array of the `process.argv` array from offset 2 onwards,\n * i.e. removing the node path and script name.\n * @param {Array} argv - list of arguments, defaults to `process.argv`\n * @return {Array} array of arguments excluding the first two\n */\nexport function args(argv=process.argv) {\n return argv.slice(2);\n}\n"],"names":["t","n","i","Array","isArray","a","f","s","p","h","Error","join","g","k","length","split","Intl","DateTimeFormat","resolvedOptions","locale","ANSIColors","reset","bold","bright","dark","black","red","green","yellow","blue","magenta","cyan","grey","white","fg","bg","ANSIescapeCode","color","base","codes","pair","hue","pop","code","push","shade","shift","ANSIescape","colors","col","escapes","ANSIreset","text","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightGrey","brightWhite","darkBlack","darkRed","darkGreen","darkYellow","darkBlue","darkMagenta","darkCyan","darkGrey","darkWhite","Debugger","enabled","prefix","format","args","console","log","bind","doNothing","addDebug","obj","debug","quotedEscapes","b","r","v","splitDataPath","path","parts","matchAll","map","single","double","other","optional","part","replace","all","one","hasValue","dataPath","data","root","done","word","opts","noValue","fail","defaults","codec","jsExt","Config","DirPath","constructor","dir","options","super","params","this","state","splitList","debugPrefix","debugColor","async","uri","exts","makeOptions","dirs","ext","file","exists","firstFileWithExt","fragment","jsFile","import","read","Library","load","prompt","question","name","isString","default","prompts","type","message","initial","cmdLineArg","argPrompt","process","argv","slice","exit","value","verboseColor","titleColor","underlineColor","infoColor","tickColor","questionColor","answerColor","sectionNewlines","vcol","command","Command","config","description","version","yes","option","verbose","quiet","filter","arg","title","forEach","about","deflt","handler","short","pattern","undefined","string","commands","cmd","argument","action","parse","cmdline","stdout","write","prompter","override","noArg","validate","required","toString","invalid","Number","isInteger","choices","findIndex","answer","info","section","answers","tcol","ucol","icol","nl","newlines","uline","repeat","qcol","acol","requiredParam","requiredParams","names","allParams","Workspace","rootDir","fsDir","cfgDir","cfgOpts","libDirs","library","libOpts","case","d","configDir","props","cfgname","convertCase","libname","component","lib","exp","export","fn","workspace","initComponent","found","nlist","values","e","o","T","joinListOr","app","error","env","DEBUG","argPrompts","results","response","match"],"mappings":"2JAAwC,SAASA,EAAEC,GAAG,MAAM,iBAAiBA,CAAC,CAAkH,SAASC,EAAED,GAAG,OAAOE,MAAMC,QAAQH,EAAE,CAA+H,SAASI,EAAEJ,GAAG,OAAO,OAAOA,CAAC,CAAC,SAASK,EAAEL,GAAG,QAA5E,SAAWA,GAAG,YAAO,IAASA,CAAC,CAAqDM,CAAEN,IAAII,EAAEJ,GAAG,CAA4C,SAASO,EAAEP,GAAG,OAAOK,EAAEL,EAAE,CAAsL,SAASQ,KAAKR,GAAG,MAAM,IAAIS,MAAMT,EAAEU,KAAK,IAAI,CAA+D,SAASC,IAAG,CAA2lB,SAASC,EAAEZ,GAAG,OAAOO,EAAEP,GAAG,GAAGD,EAAEC,GAAGA,EAAEa,OAAOb,EAAEc,MAAM,YAAY,GAAGb,EAAED,GAAGA,EAAE,CAACA,EAAE,CAAjpBe,KAAKC,iBAAiBC,kBAAkBC,OCEn1B,MAEMC,EAAa,CACjBC,MAAU,EACVC,KAAU,EACVC,OAAU,EACVC,KAAU,EACVC,MAAU,EACVC,IAAU,EACVC,MAAU,EACVC,OAAU,EACVC,KAAU,EACVC,QAAU,EACVC,KAAU,EACVC,KAAU,EACVC,MAAU,EACVC,GAAS,GACTC,GAA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2E,EAAQC,KAAKC,MAAM,IACpE,IAAIsG,EAAU,GACd,IAAK,IAAIzG,KAAawG,EAAY,CAChC,MAAME,QAAiB3G,GAAWC,EAAW1E,GAC7C,IAAMoL,GAAUjP,OACd,OAEFgP,EAAQlN,KAAKmN,EACd,CACD,OAAOD,CACT,iCHkGsB,CAAC3I,EAAKC,IAAY,IAAIJ,EAAOG,EAAKC,mBE/EjCQ,MAAOgB,EAAUxB,EAAQ,CAAE,IAChDuB,GAAOC,EAAU,IAAKxB,EAAS6B,KAAM,mTDyBhB,CAAC9B,EAAKC,IAAY,IAAIqB,EAAQtB,EAAKC,qDFhDnBmE,IACrC,MACMyE,EAAQzE,EAAOyE,MADP,4BAEd,OAAOA,EACHA,EAAM,GAAG/J,QAAQ,oBAAoB,CAACC,EAAKC,IAAQhB,EAAcgB,IAAQ,KAAKA,MAC9E,IAAI,kCAO6BoF,IACrC,MACMyE,EAAQzE,EAAOyE,MADP,yBAEd,OAAOA,EACHA,EAAM,GAAG/J,QAAQ,oBAAoB,CAACC,EAAKC,IAAQhB,EAAcgB,IAAQ,KAAKA,MAC9E,IAAI,oDK7BH,SAAc+C,GACnBO,GAAK,EAAGP,EACV,gJGwMyB,CAAC/B,EAAKC,IAAY,IAAIwG,GAAUzG,EAAKC","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"badger.cjs.js","sources":["../node_modules/.pnpm/@abw+badger-utils@1.0.16/node_modules/@abw/badger-utils/dist/badger-utils.esm.js","../src/Badger/Utils/Color.js","../src/Badger/Utils/Debug.js","../src/Badger/Utils/DataPath.js","../src/Badger/Config.js","../src/Badger/Library.js","../src/Badger/Utils/Prompt.js","../src/Badger/Utils/CmdLine.js","../src/Badger/Utils/Exit.js","../src/Badger/Utils/Options.js","../src/Badger/Utils/Params.js","../src/Badger/Workspace.js","../src/Badger/Component.js","../src/Badger/Utils/AppStatus.js","../src/Badger/Utils/Misc.js"],"sourcesContent":["function n(n){return\"boolean\"==typeof n}function t(n){return\"string\"==typeof n}function e(n){return\"number\"==typeof n}function r(n){return Number.isInteger(n)}function o(n){return e(n)&&!r(n)}function i(n){return Array.isArray(n)}function u(n){return\"function\"==typeof n}function c(n){return\"object\"==typeof n&&!i(n)&&!a(n)}function s(n){return void 0===n}function a(n){return null===n}function f(n){return!(s(n)||a(n))}function l(...n){return n.every((n=>f(n)))}function p(n){return!f(n)}function d(...n){return n.find((n=>f(n)))}const m=(n,t)=>n.replace(/<(\\w+)>/g,((e,r)=>{const o=t[r];return p(o)&&h(`Invalid variable expansion <${r}> in message format: ${n}`),o}));function h(...n){throw new Error(n.join(\"\"))}function y(n,t){throw new Error(m(n,t))}function $(n){throw n}function g(){}function w(){return Intl.DateTimeFormat().resolvedOptions().locale}let b={locale:w(),currency:\"GBP\",currencySign:\"£\",thousands:\",\"};function j(n={}){b={...b,...n}}const v=(n,t,e=1)=>{const r=t<n?-Math.abs(e):e;return Array(1+Math.floor(Math.abs((t-n)/e))).fill(n).map(((n,t)=>n+t*r))};function I(n,t={}){return new Intl.NumberFormat(t.locale||b.locale,t).format(n)}function x(n,t={}){return I(n,{style:\"currency\",currency:b.currency,...t})}function O(n,t=b.thousands){if(p(n))return\"\";for(var e=n.toString().split(\".\"),r=/(\\d+)(\\d{3})/;r.test(e[0]);)e[0]=e[0].replace(r,`$1${t}$2`);return e.join(\".\")}function k(n){return p(n)?[]:t(n)?n.length?n.split(/,\\s*|\\s+/):[]:i(n)?n:[n]}function A(n,t=!0,e={}){if(c(n))return n;return k(n).reduce(((n,e)=>(n[e]=u(t)?t(e):t,n)),e)}function C(n){return t(n)&&0!==n.length?n.split(/\\s*\\n+\\s*/).filter((function(n){return n.length>0})):[]}function T(n,t=\" \",e=t){let r=[...n];const o=r.pop();return r.length?[r.join(t),o].join(e):o}function E(n,t=\", \",e=\" and \"){return T(n,t,e)}function F(n,t=\", \",e=\" or \"){return T(n,t,e)}function L(n){return n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()}function M(n){return n.replace(/(\\w+)/g,L)}function N(n){return n.split(\"/\").map((n=>n.split(\"_\").map(L).join(\"\"))).join(\"/\")}function S(n){return n.split(\"/\").map((n=>n.split(\"_\").map(((n,t)=>t?L(n):n)).join(\"\"))).join(\"/\")}function P(n,t={}){const e=t[n];if(f(e))return e;let r;return n.match(/(ss?|sh|ch|x)$/)?n+\"es\":(r=n.match(/(.*?[^aeiou])y$/))?r[1]+\"ies\":n.match(/([^s\\d\\W])$/)?n+\"s\":n}function W(n,t={}){const e=t[n];return f(e)?e:n.match(/(ss|sh|ch|x)es$/)?n.replace(/es$/,\"\"):n.match(/([^aeiou])ies$/)?n.replace(/ies$/,\"y\"):n.match(/([^s\\d\\W])s$/)?n.replace(/s$/,\"\"):n}function _(n,t,e,r=\"no\"){return(n?O(n):r)+\" \"+(1===n?t:e||P(t))}function B(n,t,e,r=\"No\"){return _(n,t,e,r)}const D=L,G=M,R=P,U=P;function q(n,t){return Object.keys(n).reduce(((e,r)=>(e[r]=t(n[r],r),e)),{})}const z=(n,e,r={})=>{let o,s={},a={delete:!1,...r};if(u(e))o=e;else if(e instanceof RegExp)o=n=>e.test(n);else if(c(e))o=n=>e[n];else if(i(e)||t(e)){const n=A(e);o=t=>n[t]}else h(\"Invalid specification for extract(): \"+e);return Object.keys(n).map((t=>{if(o(t)){let e=n[t];a.delete&&delete n[t],a.key&&(t=a.key(t)),a.value&&(e=a.value(e)),s[t]=e}})),s},H=z,J=(n,t)=>{const e=n[t];return delete n[t],e},K=Object.keys,Q=Object.values,V=Object.entries,X=(n,t)=>parseInt(n[t]||0),Y=(n,t)=>parseFloat(n[t]||0),Z=(n,t)=>(n[t]||\"\").toString(),nn=n=>(t,e)=>X(t,n)-X(e,n),tn=n=>(t,e)=>Y(t,n)-Y(e,n),en=n=>(t,e)=>{let r=Z(t,n).toLowerCase(),o=Z(e,n).toLowerCase();return r>o?1:o>r?-1:0},rn={num:tn,int:nn,str:en,number:tn,integer:nn,string:en},on=n=>n,un=n=>(t,e)=>n(e,t),cn={asc:on,desc:un,ascending:on,descending:un},sn=n=>{const e=k(n).map((n=>{if(u(n))return n;if(t(n)){const t=n.match(/^(\\w+)(?::(\\w+))?(?::(\\w+))?$/)||h(`Invalid sort field: ${n}`),e=rn[t[2]||\"string\"]||h(`Invalid sort type \"${t[2]}\" in sort field: ${n}`);return(cn[t[3]||\"asc\"]||h(`Invalid sort order \"${t[3]}\" in sort field: ${n}`))(e(t[1]))}h(`Invalid sort field: ${n}`)}));return(n,t)=>{for(let r=0;r<e.length;r++){const o=(0,e[r])(n,t);if(0!==o)return o}return 0}};function an(n,t=300){let e;return(...r)=>{clearTimeout(e),e=setTimeout((()=>n.apply(this,r)),t)}}function fn(n){return new Promise((t=>setTimeout(t,n)))}export{B as Inflect,on as ascendingOrder,L as capitalise,M as capitaliseWords,D as capitalize,G as capitalizeWords,O as commas,x as currency,an as debounce,w as defaultLocale,un as descendingOrder,g as doNothing,V as entries,z as extract,h as fail,y as failMsg,d as firstValue,m as format,I as formatNumber,f as hasValue,l as haveValue,_ as inflect,X as integerField,nn as integerSort,i as isArray,n as isBoolean,o as isFloat,u as isFunction,r as isInteger,a as isNull,e as isNumber,c as isObject,t as isString,s as isUndefined,T as joinList,E as joinListAnd,F as joinListOr,K as keys,sn as multiSort,p as noValue,Y as numberField,tn as numberSort,q as objMap,H as objSubset,P as plural,R as pluralise,U as pluralize,v as range,J as remove,$ as rethrow,j as setNumberDefaults,W as singular,fn as sleep,S as snakeToCamel,N as snakeToStudly,cn as sortOrders,rn as sortTypes,A as splitHash,C as splitLines,k as splitList,Z as stringField,en as stringSort,Q as values};\n//# sourceMappingURL=badger-utils.esm.js.map\n","import { isObject } from \"@abw/badger-utils\";\n\nconst ANSIStart = '\\u001B[';\nconst ANSIEnd = 'm';\nconst ANSIColors = {\n reset: 0,\n bold: 1,\n bright: 1,\n dark: 2,\n black: 0,\n red: 1,\n green: 2,\n yellow: 3,\n blue: 4,\n magenta: 5,\n cyan: 6,\n grey: 7,\n white: 8,\n fg: 30,\n bg: 40,\n};\n\n/**\n * Returns an ANSI escape code for a color string. This can be a single color\n * name, e.g. `red`, `green`, etc., or a color prefixed with `bright` or `dark`,\n * e.g. `bright red`, `dark green`, etc. An optional section argument can be\n * set to `fg` (default) to set a foreground color or `bg` for a background color.\n * @param {String} color - color name with optional modifier prefix\n * @param {String} [base='fg'] - `fg` or `bg` to set foreground or background color respectively\n * @return {String} ANSI escape code string\n * @example\n * const str = escapeCode('red')\n * @example\n * const str = escapeCode('bright red')\n * @example\n * const str = escapeCode('bright red', 'bg')\n */\nexport const ANSIescapeCode = (color, base='fg') => {\n let codes = [ ];\n let pair = color.split(/ /, 2);\n const hue = pair.pop();\n const code = (base ? ANSIColors[base] : 0) + ANSIColors[hue];\n codes.push(code);\n if (pair.length) {\n const shade = pair.length ? pair.shift() : 'dark';\n codes.push(ANSIColors[shade])\n }\n // console.log('escapeCode(%s, %s) => ', color, base, codes.join(';'));\n return ANSIStart + codes.join(';') + ANSIEnd;\n}\n\n/**\n * Returns an ANSI escape code for a color string or combination of foreground and\n * background colors.\n * @param {String|Object} colors - either a simple color name or object contain foreground and background colors\n * @param {String} [colors.fg] - foreground color\n * @param {String} [colors.fg] - background color\n * @return {String} ANSI escape code string\n * @example\n * const str = escape('red')\n * @example\n * const str = escape('bright red')\n * @example\n * const str = escape({ fg: 'bright yellow', bg: 'blue' })\n */\nexport const ANSIescape = (colors={}) => {\n const col = isObject(colors) ? colors : { fg: colors };\n let escapes = [ ];\n if (col.bg) {\n escapes.push(ANSIescapeCode(col.bg, 'bg'));\n }\n if (col.fg) {\n escapes.push(ANSIescapeCode(col.fg, 'fg'));\n }\n return escapes.join('');\n}\n\n/**\n * Returns an ANSI escape code to reset all colors.\n * @return {String} ANSI escape reset string\n */\nexport const ANSIreset = () => ANSIescapeCode('reset', false)\n\n/**\n * Returns a function to display strings in a particular color.\n * @param {String} colors - color(s) to display string\n * @return {Function} function to display strings in the pre-defined color(s)\n */\nexport const color = (colors) =>\n text => ANSIescape(colors) + text + ANSIreset();\n\nexport const black = color('black');\nexport const red = color('red');\nexport const green = color('green');\nexport const yellow = color('yellow');\nexport const blue = color('blue');\nexport const magenta = color('magenta');\nexport const cyan = color('cyan');\nexport const grey = color('grey');\nexport const white = color('white');\nexport const brightBlack = color('bright black');\nexport const brightRed = color('bright red');\nexport const brightGreen = color('bright green');\nexport const brightYellow = color('bright yellow');\nexport const brightBlue = color('bright blue');\nexport const brightMagenta = color('bright magenta');\nexport const brightCyan = color('bright cyan');\nexport const brightGrey = color('bright grey');\nexport const brightWhite = color('bright white');\nexport const darkBlack = color('dark black');\nexport const darkRed = color('dark red');\nexport const darkGreen = color('dark green');\nexport const darkYellow = color('dark yellow');\nexport const darkBlue = color('dark blue');\nexport const darkMagenta = color('dark magenta');\nexport const darkCyan = color('dark cyan');\nexport const darkGrey = color('dark grey');\nexport const darkWhite = color('dark white');\n","import { ANSIescape, ANSIreset } from './Color.js'\nimport { doNothing } from '@abw/badger-utils';\n\n/**\n * Returns a debugging function which is enabled by the first `enabled` argument.\n * If this is `false` then it returns a function which does nothing. If it is\n * true then it returns a function that forwards all arguments to `console.log`.\n * An optional `prefix` be be specified to prefix each debugging line. The\n * optional third argument `color` can be used to specify a color for the prefix.\n * @param {Boolean} enabled - is debugging enabled?\n * @param {String} [prefix] - optional prefix for debugging messages\n * @param {String|Object} [color] - a color name or object (see {@link Badger/Utils/Color})\n * @param {String} [color.fg] - foreground color\n * @param {String} [color.bg] - background color\n * @return {Function} a debugging function\n * @example\n * const debug = Debugger(true)\n * @example\n * const debug = Debugger(true, 'Debug > ')\n * @example\n * const debug = Debugger(true, 'Debug > ', 'blue')\n * @example\n * const debug = Debugger(true, 'Debug > ', { bg: 'blue', fg: 'bright yellow' })\n */\nexport function Debugger(enabled, prefix='', color) {\n return enabled\n ? prefix\n ? (format, ...args) =>\n console.log(\n '%s' + prefix + '%s' + format,\n color ? ANSIescape(color) : '',\n ANSIreset(),\n ...args,\n )\n : console.log.bind(console)\n : doNothing;\n}\n\n/**\n * Creates a debugging function via {@link Debugger} and attaches it to the object\n * passed as the first argument as the `debug` function.\n * @param {Object} obj - the object to receive the `debug` function\n * @param {Boolean} enabled - is debugging enabled?\n * @param {String} [prefix] - optional prefix for debugging messages\n * @param {String|Object} [color] - a color name or object (see {@link Badger/Utils/Color})\n * @param {String} [color.fg] - foreground color\n * @param {String} [color.bg] - background color\n * @example\n * const debug = addDebug(myObject, true)\n * @example\n * const debug = addDebug(myObject, true, 'Debug > ')\n * @example\n * const debug = addDebug(myObject, true, 'Debug > ', 'blue')\n * @example\n * const debug = addDebug(myObject, true, 'Debug > ', { bg: 'blue', fg: 'bright yellow' })\n */\nexport function addDebug(obj, enabled, prefix='', color) {\n obj.debug = Debugger(enabled, prefix, color);\n}\n","import { fail, hasValue, isArray, noValue } from \"@abw/badger-utils\";\n\n/**\n * Characters that can be escaped in quoted strings.\n */\nconst quotedEscapes = {\n b: \"\\b\",\n f: \"\\f\",\n n: \"\\n\",\n r: \"\\r\",\n t: \"\\t\",\n v: \"\\v\",\n '\"': '\"',\n \"'\": \"'\",\n '\\\\': '\\\\',\n}\n\n/**\n * Match a double quoted string and expand escaped characters\n * @param {String} [string] - the string to match\n */\nexport const matchDoubleQuotedString = string => {\n const regex = /^\"((?:\\\\[\\\\\"nrt]|.)*?)\"$/\n const match = string.match(regex);\n return match\n ? match[1].replace(/\\\\([\\\\\"bfnrtv])/g, (all, one) => quotedEscapes[one] || `\\\\${one}`)\n : null;\n}\n\n/**\n * Match a single quoted string and expand escaped characters\n * @param {String} [string] - the string to match\n */\nexport const matchSingleQuotedString = string => {\n const regex = /^'((?:\\\\[\\\\']|.)*?)'$/\n const match = string.match(regex);\n return match\n ? match[1].replace(/\\\\([\\\\'bfnrtv])/g, (all, one) => quotedEscapes[one] || `\\\\${one}`)\n : null;\n}\n\n/**\n * Split a data path into component parts\n * @param {String} [path] - the path to split\n */\nexport const splitDataPath = path => {\n // * match a slash: \\/\n // * match a single quoted string: '...'\n // * match a double quoted string: \"...\"\n // * match anything else: hello world!\n let parts = [ ];\n const regex = /(?:(\\/)|'((?:\\\\[\\\\']|.)*?)'|\"((?:\\\\[\\\\\"nrt]|.)*?)\"|([^/?]+))(\\??)/g;\n const matches = [...path.matchAll(regex)];\n\n matches.map(\n ([ , , single, double, other, optional]) => {\n let part;\n // console.log('match [slash:%s] [single:%s] [double:%s] [other:%s]', slash, single, double, other);\n\n if (single) {\n part = single.replace(/\\\\([\\\\'bfnrtv])/g, (all, one) => quotedEscapes[one] || `\\\\${one}`);\n }\n else if (double) {\n part = double.replace(/\\\\([\\\\\"bfnrtv])/g, (all, one) => quotedEscapes[one] || `\\\\${one}`);\n }\n else if (other) {\n part = other\n }\n if (hasValue(part)) {\n parts.push(optional ? [part, {optional:true}] : part);\n }\n }\n )\n // console.log('MATCHED ', parts);\n\n return parts;\n}\n\n/**\n * Traverse a data structure using a path.\n * @param {Object} [data] - the data to traverse\n * @param {String} [path] - the data path\n */\nexport const dataPath = (data, path) => {\n let root = data;\n let parts = splitDataPath(path);\n let done = [ ];\n // console.log('parts: ', parts);\n\n for (let part of parts) {\n const [word, opts] = isArray(part) ? part : [part, {}];\n root = root[word];\n done.push(word);\n if (noValue(root)) {\n if (opts.optional) {\n return root;\n }\n else {\n fail(\"No value for data at path: \", done.join('/'));\n }\n }\n }\n return root;\n}\n","import { DirPath } from '@abw/badger-filesystem';\nimport { addDebug } from './Utils/Debug.js';\nimport { dataPath } from '../Badger/Utils/DataPath.js';\nimport { doNothing, fail, splitList } from '@abw/badger-utils';\n\n/**\n * Default configuration options.\n */\nconst defaults = {\n codec: ['yaml', 'json'],\n jsExt: ['js', 'mjs'],\n};\n\n/**\n * The Config class implements an object which can load configuration\n * files from a configuration directory. Files can be Javascript files\n * (with `.js` or `.mjs` extensions by default) or data files using any\n * of the standard codecs (`.yaml` or `.json` by default).\n */\nexport class Config extends DirPath {\n /**\n * Constructor for Config object.\n * @param {String} dir - one or more directories that contain configuration files\n * @param {Object} [options] - configuration options\n * @param {Array|String} [options.jsExt='js mjs'] - Array or comma/whitespace delimited string of Javascript file extensions\n * @param {Array|String} [options.codec='yaml json'] - Array or comma/whitespace delimited string of codec names\n * @return {Object} the Config object\n */\n constructor(dir, options={}) {\n super(dir);\n const params = { ...defaults, ...options };\n this.state.codec = splitList(params.codec),\n this.state.jsExt = splitList(params.jsExt),\n addDebug(this, options.debug, options.debugPrefix, options.debugColor);\n }\n\n /**\n * Internal method to locate the first config file with one of a number of file extensions.\n * @param {String} uri - base part of filename\n * @param {Array} [exts] - array of possible extensions\n * @param {Function} [makeOptions] - optional function to generate options for a {@link File} object\n * @return {Object} the {@link File} object if it exists or `undefined` if not\n */\n async firstFileWithExt(uri, exts, makeOptions=doNothing) {\n const dirs = await this.dirs();\n\n for (let dir of dirs) {\n for (let ext of exts) {\n const path = uri + '.' + ext;\n const file = dir.file(path, makeOptions(uri, ext));\n this.debug('looking for config file: ', file.path());\n if (await file.exists()) {\n this.debug('config file exists: ', file.path());\n return file;\n }\n }\n }\n return undefined;\n }\n\n /**\n * Internal method to locate a Javascript configuration file with one of the `jsExt` extensions (`.js` or `.mjs` by default)\n * @param {String} uri - base part of filename\n * @return {Object} the {@link File} object if it exists or `undefined` if not\n */\n async jsFile(uri) {\n return await this.firstFileWithExt(uri, this.state.jsExt);\n }\n\n /**\n * Internal method to locate a configuration file with one of the `codec` extensions (`.yaml` or `.json` by default)\n * @param {String} uri - base part of filename\n * @return {Object} the {@link File} object if it exists or `undefined` if not\n */\n async file(uri) {\n return await this.firstFileWithExt(uri, this.state.codec, (uri, codec) => ({ codec }));\n }\n\n /**\n * Method to fetch configuration data from a file. The file can be a Javascript file which should\n * return the configuration data as the default export, or a YAML (`.yaml`) or JSON (`.json`) file.\n * If the file isn't found then the method returns the `defaults` data if provided, or throws an\n * error if not.\n * @param {String} uri - base part of filename\n * @param {Object} [defaults] - default configuration options to be used if a file isn't found\n * @return {Object} the configuration data loaded from the file\n */\n async config(uri, defaults) {\n const [base, fragment] = uri.split('#', 2);\n let jsFile, file, data;\n\n // first look for a JS file, e.g. <uri>.js, <uri>.mjs\n if ((jsFile = await this.jsFile(base))) {\n data = await import(jsFile.path());\n }\n // then for a config file with a codec extension, e.g. <uri>.yaml, <uri>.yaml\n else if ((file = await this.file(base))) {\n data = await file.read();\n }\n // failing that use any default value\n else if (defaults) {\n data = defaults;\n }\n // anything else is a big pile of fail\n else {\n return fail(\"No configuration file for \" + base);\n }\n // resolve any data path in a #fragment\n return fragment\n ? dataPath(data, fragment)\n : data;\n }\n}\n\n/**\n * Function to create a new Config object\n * @param {String} dir - directory or directories containing configuration files\n * @param {Object} [options] - configuration options\n * @param {Array|String} [options.jsExt='js mjs'] - Array or comma/whitespace delimited string of Javascript file extensions\n * @param {Array|String} [options.codec='yaml json'] - Array or comma/whitespace delimited string of codec names\n * @return {Object} the Config object\n */\nexport const config = (dir, options) => new Config(dir, options)\n\nexport default Config\n","import { DirPath } from \"@abw/badger-filesystem\";\nimport { addDebug } from \"./Utils/Debug.js\";\nimport { dataPath } from \"./Utils/DataPath.js\";\nimport { fail, splitList } from \"@abw/badger-utils\";\n\n/**\n * Default configuration options.\n */\nconst defaults = {\n jsExt: 'js mjs',\n}\n\n/**\n * The Library class implements an object which can load Javascript files\n * from one or more library directories. Files can be Javascript files\n * (with `.js` or `.mjs` extensions by default)\n */\nexport class Library extends DirPath {\n /**\n * Constructor for Library object.\n * @param {String} dir - one or more directories that contain Javascript libraries\n * @param {Object} [options] - configuration options\n * @param {Array|String} [options.jsExt='js mjs'] - Array or comma/whitespace delimited string of Javascript file extensions\n * @return {Object} the Library object\n */\n constructor(dir, options={}) {\n super(dir);\n const params = { ...defaults, ...options };\n const exts = splitList(params.jsExt).map( ext => ext.replace(/^\\./, '') ); // remove leading '.'\n this.state.exts = exts;\n addDebug(this, options.debug, options.debugPrefix, options.debugColor);\n this.debug(\"state: \", this.state)\n }\n\n /**\n * Method to load a Javascript library in one of the library directories and with one of the `jsExt` extensions (`.js` or `.mjs` by default).\n * Returns the exports from the library if found or throws an error if not.\n * @param {String} uri - base part of filename\n * @return {Object} the exports from the loaded libary\n */\n async library(uri) {\n const [base, fragment] = uri.split('#', 2);\n const dirs = await this.dirs();\n const exts = this.state.exts;\n for (let dir of dirs) {\n for (let ext of exts) {\n const file = dir.file(base + '.' + ext);\n this.debug('looking for module %s as', base, file.path());\n const exists = await file.exists();\n if (exists) {\n const load = await import(file.path());\n this.debug('loaded %s as', file.path());\n return fragment\n ? dataPath(load, fragment)\n : load;\n }\n }\n }\n fail(\"Library not found: \", uri);\n }\n}\n\n/**\n * Function to create a new Library object\n * @param {String} dir - directory or directories containing configuration files\n * @param {Object} [options] - configuration options\n * @param {Array|String} [options.jsExt='js mjs'] - Array or comma/whitespace delimited string of Javascript file extensions\n * @return {Object} the Library object\n */\nexport const library = (dir, options) => new Library(dir, options);\n\nexport default library;","import { isString } from '@abw/badger-utils';\nimport prompts from 'prompts'\n\n/**\n * Prompt user to enter a value.\n * @param {String} question - question to prompt user to answer\n * @param {Object} [options] - optional options\n * @param {String} [options.default] - default value returned if user presses RETURN\n * @return {Promise} fulfills with response to question or default value\n * @example\n * prompt(\"What is your name?\")\n * .then( name => console.log(`Hello ${name}`) );\n * @example\n * prompt(\"What is your name?\", { default: 'Mr.Badger' })\n * .then( name => console.log(`Hello ${name}`) );\n */\nexport const prompt = async (question, options={}) => {\n options = isString(options)\n ? { default: options }\n : options;\n\n const name = options.name || 'answer';\n const answers = await prompts([\n {\n name,\n type: options.type || 'text',\n message: question,\n initial: options.default,\n },\n ]);\n return answers[name];\n}\n\n/**\n * Prompt user to confirm a choice.\n * @param {String} question - question to prompt user to answer\n * @param {Object} [options] - optional options\n * @param {String} [options.default] - default value returned if user presses RETURN\n * @return {Promise} fulfills with response to question or default value\n * @example\n * confirm(\"Are you sure?\")\n * .then( yes => console.log('You said \"%s\"', yes ? 'YES' : 'NO') );\n */\nexport const confirm = async (question, options={}) =>\n prompt(question, { ...options, type: 'confirm' });\n\nexport default prompt","import process from 'node:process'\nimport { prompt } from './Prompt.js';\n\n// quick hacks - use with caution\nexport async function cmdLineArg(argPrompt, args=process.argv.slice(2)) {\n if (args.length) {\n return args.shift();\n }\n else if (argPrompt) {\n return await prompt(argPrompt);\n }\n return undefined;\n}\n\nexport async function cmdLineArgs(argPrompts, args=process.argv.slice(2)) {\n let results = [ ];\n for (let argPrompt of argPrompts) {\n const response = await cmdLineArg(argPrompt, args);\n if (! response?.length) {\n return undefined;\n }\n results.push(response);\n }\n return results;\n}","import process from 'node:process'\n\nexport function exit(value, message) {\n if (message) {\n console.log(message);\n }\n process.exit(value);\n}\n\nexport function quit(message) {\n exit(0, message);\n}\n\nexport function abort(message) {\n exit(1, message);\n}","import process from 'node:process';\nimport prompter from 'prompts'\nimport { Command } from 'commander';\nimport { color } from './Color.js';\nimport { hasValue } from '@abw/badger-utils';\n\nexport const defaults = {\n verboseColor: 'magenta',\n titleColor: 'bright yellow',\n underlineColor: 'dark yellow',\n infoColor: 'cyan',\n tickColor: 'green',\n questionColor: 'bright white',\n answerColor: 'bright green',\n sectionNewlines: true\n};\n\nexport const options = async config => {\n const vcol = color(options.verboseColor || defaults.verboseColor);\n const command = new Command;\n\n // set command name, description and version\n if (config.name) {\n command.name(config.name);\n }\n if (config.description) {\n command.description(config.description);\n }\n if (config.version) {\n command.version(config.version);\n }\n\n // define the -y / -yes and -v / --verbose options\n if (config.yes) {\n command.option('-y, --yes', 'Accept default answers')\n }\n if (config.verbose) {\n command.option('-v, --verbose', 'Verbose output')\n }\n if (config.quiet) {\n command.option('-q, --quiet', 'Quiet output')\n }\n\n // add in other command line options\n config.options\n ?.filter(\n option => {\n if (hasValue(option.arg) && ! option.arg) {\n // allow arg: false to indicate no command line argument\n return false;\n }\n if (option.title) {\n // section break\n return;\n }\n return hasValue(option.name);\n }\n )\n .forEach(\n option => {\n const name = option.name;\n const about = option.about;\n const deflt = option.default;\n const handler = option.handler;\n const short = option.short;\n const type = option.type;\n const pattern = option.pattern || (hasValue(type) ? `<${type}>` : undefined);\n let string = `--${name}`;\n let args = [];\n if (hasValue(short)) {\n string = `-${short}, ${string}`;\n }\n if (hasValue(pattern)) {\n string = `${string} ${pattern}`;\n }\n args.push(string);\n if (hasValue(about)) {\n args.push(about);\n }\n if (hasValue(handler)) {\n args.push(handler);\n }\n if (hasValue(deflt)) {\n args.push(deflt);\n }\n command.option(...args)\n }\n )\n\n let commands = { };\n\n config.commands?.forEach(\n option => {\n const name = option.name;\n const about = option.about;\n const type = option.type;\n const pattern = option.pattern || (hasValue(type) ? `<${type}>` : undefined);\n let string = name;\n let cmd = command.command(string)\n if (hasValue(pattern)) {\n cmd.argument(pattern);\n // string = `${string} ${pattern}`;\n }\n if (hasValue(about)) {\n cmd.description(about);\n }\n cmd.action(\n args => {\n commands[name] = args;\n }\n )\n //console.log({ args });\n //command.command(...args)\n }\n )\n\n // parse the command line arguments\n command.parse();\n const cmdline = command.opts();\n\n // if the -y / --yes option has been specified then accept all\n // default answers automatically\n const yes = config.yes && cmdline.yes;\n const verbose = config.verbose && cmdline.verbose;\n const quiet = config.quiet && cmdline.quiet;\n\n if (yes) {\n if (verbose && ! quiet) {\n process.stdout.write(vcol('Accepting default answers (-y option is set)\\n'))\n }\n prompter.override(cmdline);\n }\n\n // build up the list of prompts for interactive questions\n let prompts = [ ];\n config.options?.forEach(\n option => {\n const type = option.type || 'text';\n const name = option.name;\n const prompt = option.prompt;\n const noArg = hasValue(option.arg) && ! option.arg;\n const validate = option.validate ||\n (option.required\n ? value => (hasValue(value) && value.toString().length)\n ? true\n : (options.invalid || `You must enter a value for ${name}`)\n : undefined\n )\n\n // special process for initial\n // - use cmdline[name]\n // - or if noArg, use option.default\n // - if a select list and not a number, find the index\n let initial = noArg ? option.default : cmdline[name];\n if (type === 'select' && hasValue(initial)) {\n if (! Number.isInteger(initial)) {\n // console.log('looking up select option for [%s]', initial);\n initial = option.choices?.findIndex( i => i.value === initial );\n if (initial < 0) {\n initial = 0;\n }\n }\n }\n\n if (hasValue(prompt)) {\n prompts.push(\n {\n ...option,\n type: (\n hasValue(initial)\n ? () => {\n yes && (quiet || answer({ question: prompt, answer: initial }));\n return type;\n }\n : type\n ),\n name,\n message: prompt,\n initial: initial,\n validate: validate,\n },\n )\n }\n else if (option.title || option.info) {\n prompts.push(\n {\n type: () => {\n quiet || section(option);\n return false;\n }\n }\n );\n }\n }\n );\n\n // prompt the user to answer/confirm questions\n const answers = await prompter(prompts);\n\n return {\n ...cmdline, ...answers, ...commands\n }\n}\n\nexport const section = option => {\n const title = option.title;\n const tcol = color(option.titleColor || defaults.titleColor);\n const ucol = color(option.underlineColor || defaults.underlineColor);\n const icol = color(option.infoColor || defaults.infoColor);\n const nl = (hasValue(option.newlines) ? option.newlines : defaults.sectionNewlines) ? \"\\n\" : \"\";\n\n if (title) {\n const uline = '-'.repeat(title.length);\n process.stdout.write(nl + tcol(title) + \"\\n\" + ucol(uline) + \"\\n\" + nl);\n }\n\n if (option.info) {\n process.stdout.write(icol(option.info) + \"\\n\" + nl);\n }\n}\n\nexport const answer = option => {\n const tcol = color(option.tickColor || defaults.tickColor);\n const qcol = color(option.questionColor || defaults.questionColor);\n const acol = color(option.answerColor || defaults.answerColor);\n process.stdout.write(tcol(\"✔ \") + qcol(option.question) + \" \" + acol(option.answer) + \"\\n\");\n}\n\nexport default options","import { joinListOr, splitList, hasValue, fail } from \"@abw/badger-utils\";\n\n/**\n * Assert that a parameter object contains an item with a defined/non-null value\n * @param {Object} params={} - parameters object\n * @param {String} name - parameter that must be included\n * @return {any} the parameter value\n * @throws {Error} if the parameter is not defined or null\n * @example\n * const foo = requiredParam({ foo: 10 }, 'foo');\n */\nexport function requiredParam(params={}, name) {\n const value = params[name];\n if (hasValue(value)) {\n return value;\n }\n else {\n fail(\"Missing value for required parameter: \", name);\n }\n}\n\n/**\n * Assert that a parameter object contains all specified item with a defined/non-null value\n * @param {Object} params={} - parameters object\n * @param {Array|String} names - parameters that must be included, as an Array or whitespace/comma delimited string (see {@link splitList})\n * @return {Array} the parameter values\n * @throws {Error} if any parameter is not defined or null\n * @example\n * const [foo, bar] = requiredParams({ foo: 10, bar: 20 }, 'foo bar');\n */\nexport function requiredParams(params={}, names) {\n return splitList(names).map( name => requiredParam(params, name) );\n}\n\n/**\n * An alias for {@link requiredParams} for people who don't like typing long names (and for symmetry with {@link anyParams}))\n */\nexport const allParams=requiredParams;\n\n/**\n * Assert that a parameter object contains any of the specified items with a defined/non-null value\n * @param {Object} params={} - parameters object\n * @param {Array|String} names - parameters of which at least one must be included, as an Array or whitespace/comma delimited string (see {@link splitList})\n * @return {Array} the parameter values\n * @throws {Error} if any parameter is not defined or null\n * @example\n * const [foo, bar] = anyParams({ foo: 10, wiz: 99 }, 'foo bar');\n */\nexport function anyParams(params, names) {\n let found = false;\n const nlist = splitList(names);\n const values = nlist.map(\n name => {\n const value = params[name];\n if (hasValue(value)) {\n found = true;\n }\n return value;\n }\n );\n return found\n ? values\n : fail(\"Missing value for one of: \", joinListOr(nlist));\n}\n","import { addDebug } from \"./Utils/Debug.js\";\nimport { Config } from \"./Config.js\";\nimport { Library } from \"./Library.js\";\nimport { dir as fsDir } from \"@abw/badger-filesystem\";\nimport { fail, hasValue, splitList } from \"@abw/badger-utils\";\n\n/**\n * Default configuration options.\n */\nconst defaults = {\n config: {\n dir: 'config',\n },\n library: {\n dir: 'lib library src components',\n },\n case: {\n // config and/or library case conversion functions\n }\n}\n\n/**\n * The Workspace class implements an object which acts as a central repository\n * for your project, providing access to directories, files, configuration files,\n * Javascript libraries and components.\n */\nexport class Workspace {\n /**\n * Constructor for Workspace object.\n * @param {String} dir - root directory for the workspace\n * @param {Object} [options] - configuration options\n * @param {Object} [options.config] - configuration options for a {@link Config} object\n * @param {Array|String} [options.config.dir] - configuration directory or directories relative to the workspace directory\n * @param {Object} [options.library] - configuration options for a {@link Config} object\n * @param {Array|String} [options.library.dir] - library directory or directories relative to the workspace directory\n * @return {Object} the Workspace object\n */\n constructor(dir, options={}) {\n const rootDir = fsDir(dir);\n const cfgDir = splitList(options.config?.dir || defaults.config.dir).map( dir => rootDir.dir(dir) );\n const cfgOpts = { ...defaults.config, ...(options.config||{}) };\n const config = new Config(cfgDir, cfgOpts);\n const libDirs = splitList(options.library?.dir || defaults.library.dir).map( dir => rootDir.dir(dir) );\n const libOpts = { ...defaults.library, ...(options.library||{}) };\n const library = new Library(libDirs, libOpts);\n\n this.case = {\n ...defaults.case,\n ...(options.case||{})\n };\n\n this.state = {\n rootDir,\n config,\n library\n }\n\n addDebug(this, options.debug, options.debugPrefix, options.debugColor);\n this.debug('root dir: ', rootDir.path());\n this.debug('config dir: ', cfgDir.map( d => d.path() ));\n this.debug('libDirs: ', libDirs);\n this.debug('libOpts: ', libOpts);\n }\n\n /**\n * Fetch a new {@link Directory} object for a sub-directory of the workspace directory.\n * @param {string} path - directory path relative to the workspace directory\n * @param {Object} [options] - directory configuration options\n * @param {String} [options.codec] - codec for encoding/decoding file data\n * @return {Object} a {@link Directory} object\n */\n dir(path, options) {\n this.debug(\"dir(%s, %o)\", path, options);\n return hasValue(path)\n ? this.state.rootDir.dir(path, options)\n : this.state.rootDir;\n }\n\n /**\n * Fetch a new {@link File} object for a file in the workspace.\n * @param {string} path - file path relative to the workspace directory\n * @param {Object} [options] - file configuration options\n * @param {String} [options.codec] - codec for encoding/decoding file data\n * @param {Boolean} [options.encoding=utf8] - character encoding for the file\n * @return {Object} a {@link File} object\n */\n file(path, options) {\n this.debug(\"file(%s, %o)\", path, options);\n return this.state.rootDir.file(path, options)\n }\n\n /**\n * Read the content of a file in the workspace.\n * @param {string} path - file path relative to the workspace directory\n * @param {Object} [options] - directory configuration options\n * @param {Boolean} [options.codec] - codec for encoding/decoding file data\n * @param {Boolean} [options.encoding=utf8] - character encoding for the file\n * @return {Promise} fulfills with the file content\n * @example\n * file('myfile.txt').read().then( text => console.log(text) );\n * @example\n * file('myfile.json', { codec: 'json' }).read().then( data => console.log(data) );\n * @example\n * file('myfile.json').read({ codec: 'json' }).then( data => console.log(data) );\n */\n read(path, options) {\n this.debug(\"read(%s, %o)\", path, options);\n return this.file(path, options).read();\n }\n\n /**\n * Writes content to a file. If a `codec` has been specified then the content will be encoded.\n * @param {string} path - file path relative to the workspace directory\n * @param {String|Object} data - directory configuration options\n * @param {Object} [options] - directory configuration options\n * @param {Boolean} [options.codec] - codec for encoding/decoding file data\n * @param {Boolean} [options.encoding=utf8] - codec for encoding/decoding file data\n * @return {Promise} fulfills with the file object\n * @example\n * file('myfile.txt').write('Hello World');\n * @example\n * file('myfile.json', { codec: 'json' }).write({ message: 'Hello World' });\n * @example\n * file('myfile.json').write({ message: 'Hello World' }, { codec: 'json' });\n */\n write(path, data, options) {\n this.debug(\"write(%s, %o, %o)\", path, data, options);\n return this.file(path, options).write(data);\n }\n\n /**\n * Fetch the configuration directory or a directory relative to it\n * @param {string} [path] - file path relative to the configuration directory\n * @param {Object} [options] - directory configuration options\n * @param {String} [options.codec] - codec for encoding/decoding data for files in the directory\n * @param {Boolean} [options.encoding=utf8] - character encoding for files in the directory\n * @return {Object} a {@link Directory} object\n */\n configDir(path, options) {\n this.debug(\"configDir(%s, %o)\", path, options);\n return hasValue(path)\n ? this.state.configDir.dir(path, options)\n : this.state.configDir;\n }\n\n /**\n * Fetches configuration data from a file in the configuration directory or returns the\n * {@link Config} object itself if no file uri is specified.\n * @param {string} [uri] - file path relative to the configuration directory\n * @param {Object} [defaults] - default configuration options if file isn't found\n * @return {Promise} fulfills to the configuration data read from the file\n * @example\n * workspace.config('myfile').then(\n * config => console.log(\"Loaded myfile config: \", config)\n * );\n */\n async config(uri, defaults) {\n this.debug(\"config(%s, %o)\", uri, defaults);\n return hasValue(uri)\n ? this.state.config.config(uri, defaults)\n : this.state.config;\n }\n\n /**\n * Loads a Javscript library from the library directory or returns the\n * {@link Library} object itself if no file uri is specified.\n * @param {string} [uri] - file path relative to the library directory\n * @return {Promise} fulfills to the configuration data read from the file\n * @example\n * workspace.library('mylib').then(\n * exports => console.log(\"Loaded mylib exports: \", exports)\n * );\n */\n async library(uri) {\n this.debug(\"library(%s, %o)\", uri);\n return hasValue(uri)\n ? this.state.library.library(uri)\n : this.state.library;\n }\n\n /**\n * Loads a Javscript library from the library directory and instantiates a\n * component.\n * @param {String} uri - component base name\n * @param {Object} [props] - optional configuration properties\n * @return {Promise} fulfills to a newly instantiated component\n * @example\n * workspace.component('mycomp').then(\n * component => console.log(\"Created component: \", component)\n * );\n */\n async component(uri, props) {\n const [base, fragment] = uri.split('#', 2);\n const cfgname = this.convertCase('config', base);\n const config = await this.config(cfgname, {});\n const libname = config.component?.library || this.convertCase('library', base);\n const lib = await this.library(libname);\n const exp = fragment || config.component?.export || 'default';\n const compcls = lib[exp] || fail(\"No '\", exp, \"' export from component library: \", uri);\n const comp = new compcls(this, { ...config, ...props });\n return comp;\n }\n\n convertCase(type, uri) {\n const fn = this.case[type];\n return fn\n ? fn(uri)\n : uri;\n }\n}\n\nexport const workspace = (dir, options) => new Workspace(dir, options);\n\nexport default Workspace;","import { addDebug } from \"./Utils/Debug.js\";\n\nexport class Component {\n constructor(workspace, props={}) {\n this.workspace = workspace;\n this.props = props;\n addDebug(this, props.debug, props.debugPrefix, props.debugColor);\n this.initComponent(props);\n }\n initComponent() {\n // stub for subclasses\n }\n}\n\nexport default Component","import process from 'node:process'\nimport { brightGreen, brightRed } from './Color.js';\n\nexport const appStatus = app => async function(...args) {\n try {\n const message = await app(...args);\n if (message) {\n console.log(brightGreen(`✓ ${message}`));\n }\n }\n catch (error) {\n console.log(\n process.env.DEBUG\n ? error\n : brightRed(`✗ ${error.message||error}`)\n )\n }\n}\n\nexport default appStatus","import process from \"node:process\"\n\n/**\n * Returns an array of the `process.argv` array from offset 2 onwards,\n * i.e. removing the node path and script name.\n * @param {Array} argv - list of arguments, defaults to `process.argv`\n * @return {Array} array of arguments excluding the first two\n */\nexport function args(argv=process.argv) {\n return argv.slice(2);\n}\n"],"names":["t","n","i","Array","isArray","a","f","s","p","h","Error","join","g","k","length","split","Intl","DateTimeFormat","resolvedOptions","locale","ANSIColors","reset","bold","bright","dark","black","red","green","yellow","blue","magenta","cyan","grey","white","fg","bg","ANSIescapeCode","color","base","codes","pair","hue","pop","code","push","shade","shift","ANSIescape","colors","col","escapes","ANSIreset","text","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightGrey","brightWhite","darkBlack","darkRed","darkGreen","darkYellow","darkBlue","darkMagenta","darkCyan","darkGrey","darkWhite","Debugger","enabled","prefix","format","args","console","log","bind","doNothing","addDebug","obj","debug","quotedEscapes","b","r","v","splitDataPath","path","parts","matchAll","map","single","double","other","optional","part","replace","all","one","hasValue","dataPath","data","root","done","word","opts","noValue","fail","defaults","codec","jsExt","Config","DirPath","constructor","dir","options","super","params","this","state","splitList","debugPrefix","debugColor","async","uri","exts","makeOptions","dirs","ext","file","exists","firstFileWithExt","fragment","jsFile","import","read","Library","load","prompt","question","name","isString","default","prompts","type","message","initial","cmdLineArg","argPrompt","process","argv","slice","exit","value","verboseColor","titleColor","underlineColor","infoColor","tickColor","questionColor","answerColor","sectionNewlines","vcol","command","Command","config","description","version","yes","option","verbose","quiet","filter","arg","title","forEach","about","deflt","handler","short","pattern","undefined","string","commands","cmd","argument","action","parse","cmdline","stdout","write","prompter","override","noArg","validate","required","toString","invalid","Number","isInteger","choices","findIndex","answer","info","section","answers","tcol","ucol","icol","nl","newlines","uline","repeat","qcol","acol","requiredParam","requiredParams","names","allParams","Workspace","rootDir","fsDir","cfgDir","cfgOpts","libDirs","library","libOpts","case","d","configDir","props","cfgname","convertCase","libname","component","lib","exp","export","fn","workspace","initComponent","found","nlist","values","e","o","T","joinListOr","app","error","env","DEBUG","argPrompts","results","response","match"],"mappings":"2JAAwC,SAASA,EAAEC,GAAG,MAAM,iBAAiBA,CAAC,CAAkH,SAASC,EAAED,GAAG,OAAOE,MAAMC,QAAQH,EAAE,CAA+H,SAASI,EAAEJ,GAAG,OAAO,OAAOA,CAAC,CAAC,SAASK,EAAEL,GAA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KAAKA,MAC9E,IAAI,oDK7BH,SAAc+C,GACnBO,GAAK,EAAGP,EACV,gJGwMyB,CAAC/B,EAAKC,IAAY,IAAIwG,GAAUzG,EAAKC","x_google_ignoreList":[0]}
@@ -1,2 +1,2 @@
1
- import{DirPath as t,dir as e}from"@abw/badger-filesystem";export*from"@abw/badger-filesystem";import r from"node:process";import o from"prompts";import{Command as i}from"commander";export*from"@abw/badger-codecs";function n(t){return"string"==typeof t}function s(t){return Array.isArray(t)}function a(t){return null===t}function l(t){return!(function(t){return void 0===t}(t)||a(t))}function c(t){return!l(t)}function u(...t){throw new Error(t.join(""))}function f(){}function g(t){return c(t)?[]:n(t)?t.length?t.split(/,\s*|\s+/):[]:s(t)?t:[t]}Intl.DateTimeFormat().resolvedOptions().locale;const d={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},h=(t,e="fg")=>{let r=[],o=t.split(/ /,2);const i=o.pop(),n=(e?d[e]:0)+d[i];if(r.push(n),o.length){const t=o.length?o.shift():"dark";r.push(d[t])}return"["+r.join(";")+"m"},p=(t={})=>{const e="object"!=typeof(r=t)||s(r)||a(r)?{fg:t}:t;var r;let o=[];return e.bg&&o.push(h(e.bg,"bg")),e.fg&&o.push(h(e.fg,"fg")),o.join("")},b=()=>h("reset",!1),m=t=>e=>p(t)+e+b(),y=m("black"),w=m("red"),v=m("green"),C=m("yellow"),x=m("blue"),k=m("magenta"),j=m("cyan"),$=m("grey"),E=m("white"),q=m("bright black"),D=m("bright red"),F=m("bright green"),N=m("bright yellow"),A=m("bright blue"),P=m("bright magenta"),I=m("bright cyan"),W=m("bright grey"),M=m("bright white"),O=m("dark black"),B=m("dark red"),G=m("dark green"),L=m("dark yellow"),Q=m("dark blue"),S=m("dark magenta"),T=m("dark cyan"),U=m("dark grey"),V=m("dark white");function Y(t,e="",r){return t?e?(t,...o)=>console.log("%s"+e+"%s"+t,r?p(r):"",b(),...o):console.log.bind(console):f}function z(t,e,r="",o){t.debug=Y(e,r,o)}class H{constructor(t,e={}){this.workspace=t,this.props=e,z(this,e.debug,e.debugPrefix,e.debugColor),this.initComponent(e)}initComponent(){}}const J={b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v",'"':'"',"'":"'","\\":"\\"},K=t=>{const e=t.match(/^"((?:\\[\\"nrt]|.)*?)"$/);return e?e[1].replace(/\\([\\"bfnrtv])/g,((t,e)=>J[e]||`\\${e}`)):null},R=t=>{const e=t.match(/^'((?:\\[\\']|.)*?)'$/);return e?e[1].replace(/\\([\\'bfnrtv])/g,((t,e)=>J[e]||`\\${e}`)):null},X=t=>{let e=[];return[...t.matchAll(/(?:(\/)|'((?:\\[\\']|.)*?)'|"((?:\\[\\"nrt]|.)*?)"|([^/?]+))(\??)/g)].map((([,,t,r,o,i])=>{let n;t?n=t.replace(/\\([\\'bfnrtv])/g,((t,e)=>J[e]||`\\${e}`)):r?n=r.replace(/\\([\\"bfnrtv])/g,((t,e)=>J[e]||`\\${e}`)):o&&(n=o),l(n)&&e.push(i?[n,{optional:!0}]:n)})),e},Z=(t,e)=>{let r=t,o=X(e),i=[];for(let t of o){const[e,o]=s(t)?t:[t,{}];if(r=r[e],i.push(e),c(r)){if(o.optional)return r;u("No value for data at path: ",i.join("/"))}}return r},_={codec:["yaml","json"],jsExt:["js","mjs"]};class tt extends t{constructor(t,e={}){super(t);const r={..._,...e};this.state.codec=g(r.codec),this.state.jsExt=g(r.jsExt),z(this,e.debug,e.debugPrefix,e.debugColor)}async firstFileWithExt(t,e,r=f){const o=await this.dirs();for(let i of o)for(let o of e){const e=t+"."+o,n=i.file(e,r(t,o));if(this.debug("looking for config file: ",n.path()),await n.exists())return this.debug("config file exists: ",n.path()),n}}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[r,o]=t.split("#",2);let i,n,s;if(i=await this.jsFile(r))s=await import(i.path());else if(n=await this.file(r))s=await n.read();else{if(!e)return u("No configuration file for "+r);s=e}return o?Z(s,o):s}}const et=(t,e)=>new tt(t,e),rt={jsExt:"js mjs"};class ot extends t{constructor(t,e={}){super(t);const r=g({...rt,...e}.jsExt).map((t=>t.replace(/^\./,"")));this.state.exts=r,z(this,e.debug,e.debugPrefix,e.debugColor),this.debug("state: ",this.state)}async library(t){const[e,r]=t.split("#",2),o=await this.dirs(),i=this.state.exts;for(let t of o)for(let o of i){const i=t.file(e+"."+o);this.debug("looking for module %s as",e,i.path());if(await i.exists()){const t=await import(i.path());return this.debug("loaded %s as",i.path()),r?Z(t,r):t}}u("Library not found: ",t)}}const it=(t,e)=>new ot(t,e),nt=t=>async function(...e){try{const r=await t(...e);r&&console.log(F(`✓ ${r}`))}catch(t){console.log(r.env.DEBUG?t:D(`✗ ${t.message||t}`))}},st=async(t,e={})=>{const r=(e=n(e)?{default:e}:e).name||"answer";return(await o([{name:r,type:e.type||"text",message:t,initial:e.default}]))[r]},at=async(t,e={})=>st(t,{...e,type:"confirm"});async function lt(t,e=r.argv.slice(2)){return e.length?e.shift():t?await st(t):void 0}async function ct(t,e=r.argv.slice(2)){let o=[];for(let r of t){const t=await lt(r,e);if(!t?.length)return;o.push(t)}return o}function ut(t,e){e&&console.log(e),r.exit(t)}function ft(t){ut(0,t)}function gt(t){ut(1,t)}function dt(t=r.argv){return t.slice(2)}const ht={verboseColor:"magenta",titleColor:"bright yellow",underlineColor:"dark yellow",infoColor:"cyan",tickColor:"green",questionColor:"bright white",answerColor:"bright green",sectionNewlines:!0},pt=async t=>{const e=m(pt.verboseColor||ht.verboseColor),n=new i;t.name&&n.name(t.name),t.description&&n.description(t.description),t.version&&n.version(t.version),t.yes&&n.option("-y, --yes","Accept default answers"),t.verbose&&n.option("-v, --verbose","Verbose output"),t.quiet&&n.option("-q, --quiet","Quiet output"),t.options?.filter((t=>!(l(t.arg)&&!t.arg)&&(t.title?void 0:l(t.name)))).forEach((t=>{const e=t.name,r=t.about,o=t.default,i=t.handler,s=t.short,a=t.type,c=t.pattern||(l(a)?`<${a}>`:void 0);let u=`--${e}`,f=[];l(s)&&(u=`-${s}, ${u}`),l(c)&&(u=`${u} ${c}`),f.push(u),l(r)&&f.push(r),l(i)&&f.push(i),l(o)&&f.push(o),console.log("command option: ",f),n.option(...f)}));let s={};t.commands?.forEach((t=>{const e=t.name,r=t.about,o=t.type,i=t.pattern||(l(o)?`<${o}>`:void 0);let a=e,c=n.command(a);l(i)&&c.argument(i),l(r)&&c.description(r),c.action((t=>{s[e]=t}))})),n.parse();const a=n.opts(),c=t.yes&&a.yes,u=t.verbose&&a.verbose,f=t.quiet&&a.quiet;c&&(u&&!f&&r.stdout.write(e("Accepting default answers (-y option is set)\n")),o.override(a));let g=[];t.options?.forEach((t=>{const e=t.type||"text",r=t.name,o=t.prompt,i=l(t.arg)&&!t.arg,n=t.validate||(t.required?t=>!(!l(t)||!t.toString().length)||(pt.invalid||`You must enter a value for ${r}`):void 0);let s=i?t.default:a[r];"select"===e&&l(s)&&(Number.isInteger(s)||(s=t.choices?.findIndex((t=>t.value===s)),s<0&&(s=0))),l(o)?g.push({...t,type:l(s)?()=>(c&&(f||mt({question:o,answer:s})),e):e,name:r,message:o,initial:s,validate:n}):(t.title||t.info)&&g.push({type:()=>(f||bt(t),!1)})}));const d=await o(g);return{...a,...d,...s}},bt=t=>{const e=t.title,o=m(t.titleColor||ht.titleColor),i=m(t.underlineColor||ht.underlineColor),n=m(t.infoColor||ht.infoColor),s=(l(t.newlines)?t.newlines:ht.sectionNewlines)?"\n":"";if(e){const t="-".repeat(e.length);r.stdout.write(s+o(e)+"\n"+i(t)+"\n"+s)}t.info&&r.stdout.write(n(t.info)+"\n"+s)},mt=t=>{const e=m(t.tickColor||ht.tickColor),o=m(t.questionColor||ht.questionColor),i=m(t.answerColor||ht.answerColor);r.stdout.write(e("✔ ")+o(t.question)+" "+i(t.answer)+"\n")};function yt(t={},e){const r=t[e];if(l(r))return r;u("Missing value for required parameter: ",e)}function wt(t={},e){return g(e).map((e=>yt(t,e)))}const vt=wt;function Ct(t,e){let r=!1;const o=g(e),i=o.map((e=>{const o=t[e];return l(o)&&(r=!0),o}));return r?i:u("Missing value for one of: ",function(t,e=", ",r=" or "){return function(t,e=" ",r=e){let o=[...t];const i=o.pop();return o.length?[o.join(e),i].join(r):i}(t,e,r)}(o))}const xt={dir:"config"},kt={dir:"lib library src components"},jt={};class $t{constructor(t,r={}){const o=e(t),i=g(r.config?.dir||xt.dir).map((t=>o.dir(t))),n={...xt,...r.config||{}},s=new tt(i,n),a=g(r.library?.dir||kt.dir).map((t=>o.dir(t))),l={...kt,...r.library||{}},c=new ot(a,l);this.case={...jt,...r.case||{}},this.state={rootDir:o,config:s,library:c},z(this,r.debug,r.debugPrefix,r.debugColor),this.debug("root dir: ",o.path()),this.debug("config dir: ",i.map((t=>t.path()))),this.debug("libDirs: ",a),this.debug("libOpts: ",l)}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,r){return this.debug("write(%s, %o, %o)",t,e,r),this.file(t,r).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[r,o]=t.split("#",2),i=this.convertCase("config",r),n=await this.config(i,{}),s=n.component?.library||this.convertCase("library",r),a=await this.library(s),l=o||n.component?.export||"default";return new(a[l]||u("No '",l,"' export from component library: ",t))(this,{...n,...e})}convertCase(t,e){const r=this.case[t];return r?r(e):e}}const Et=(t,e)=>new $t(t,e);export{p as ANSIescape,h as ANSIescapeCode,b as ANSIreset,H as Component,tt as Config,Y as Debugger,ot as Library,$t as Workspace,gt as abort,z as addDebug,vt as allParams,mt as answer,Ct as anyParams,nt as appStatus,dt as args,y as black,x as blue,q as brightBlack,A as brightBlue,I as brightCyan,F as brightGreen,W as brightGrey,P as brightMagenta,D as brightRed,M as brightWhite,N as brightYellow,lt as cmdLineArg,ct as cmdLineArgs,m as color,et as config,at as confirm,j as cyan,O as darkBlack,Q as darkBlue,T as darkCyan,G as darkGreen,U as darkGrey,S as darkMagenta,B as darkRed,V as darkWhite,L as darkYellow,Z as dataPath,ht as defaults,ut as exit,v as green,$ as grey,it as library,k as magenta,K as matchDoubleQuotedString,R as matchSingleQuotedString,pt as options,st as prompt,ft as quit,w as red,yt as requiredParam,wt as requiredParams,bt as section,X as splitDataPath,E as white,Et as workspace,C as yellow};
1
+ import{DirPath as t,dir as e}from"@abw/badger-filesystem";export*from"@abw/badger-filesystem";import r from"node:process";import o from"prompts";import{Command as i}from"commander";export*from"@abw/badger-codecs";function n(t){return"string"==typeof t}function s(t){return Array.isArray(t)}function a(t){return null===t}function l(t){return!(function(t){return void 0===t}(t)||a(t))}function c(t){return!l(t)}function u(...t){throw new Error(t.join(""))}function f(){}function g(t){return c(t)?[]:n(t)?t.length?t.split(/,\s*|\s+/):[]:s(t)?t:[t]}Intl.DateTimeFormat().resolvedOptions().locale;const d={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},h=(t,e="fg")=>{let r=[],o=t.split(/ /,2);const i=o.pop(),n=(e?d[e]:0)+d[i];if(r.push(n),o.length){const t=o.length?o.shift():"dark";r.push(d[t])}return"["+r.join(";")+"m"},p=(t={})=>{const e="object"!=typeof(r=t)||s(r)||a(r)?{fg:t}:t;var r;let o=[];return e.bg&&o.push(h(e.bg,"bg")),e.fg&&o.push(h(e.fg,"fg")),o.join("")},b=()=>h("reset",!1),m=t=>e=>p(t)+e+b(),y=m("black"),w=m("red"),v=m("green"),C=m("yellow"),x=m("blue"),k=m("magenta"),j=m("cyan"),$=m("grey"),E=m("white"),q=m("bright black"),D=m("bright red"),F=m("bright green"),N=m("bright yellow"),A=m("bright blue"),P=m("bright magenta"),I=m("bright cyan"),W=m("bright grey"),M=m("bright white"),O=m("dark black"),B=m("dark red"),G=m("dark green"),L=m("dark yellow"),Q=m("dark blue"),S=m("dark magenta"),T=m("dark cyan"),U=m("dark grey"),V=m("dark white");function Y(t,e="",r){return t?e?(t,...o)=>console.log("%s"+e+"%s"+t,r?p(r):"",b(),...o):console.log.bind(console):f}function z(t,e,r="",o){t.debug=Y(e,r,o)}class H{constructor(t,e={}){this.workspace=t,this.props=e,z(this,e.debug,e.debugPrefix,e.debugColor),this.initComponent(e)}initComponent(){}}const J={b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v",'"':'"',"'":"'","\\":"\\"},K=t=>{const e=t.match(/^"((?:\\[\\"nrt]|.)*?)"$/);return e?e[1].replace(/\\([\\"bfnrtv])/g,((t,e)=>J[e]||`\\${e}`)):null},R=t=>{const e=t.match(/^'((?:\\[\\']|.)*?)'$/);return e?e[1].replace(/\\([\\'bfnrtv])/g,((t,e)=>J[e]||`\\${e}`)):null},X=t=>{let e=[];return[...t.matchAll(/(?:(\/)|'((?:\\[\\']|.)*?)'|"((?:\\[\\"nrt]|.)*?)"|([^/?]+))(\??)/g)].map((([,,t,r,o,i])=>{let n;t?n=t.replace(/\\([\\'bfnrtv])/g,((t,e)=>J[e]||`\\${e}`)):r?n=r.replace(/\\([\\"bfnrtv])/g,((t,e)=>J[e]||`\\${e}`)):o&&(n=o),l(n)&&e.push(i?[n,{optional:!0}]:n)})),e},Z=(t,e)=>{let r=t,o=X(e),i=[];for(let t of o){const[e,o]=s(t)?t:[t,{}];if(r=r[e],i.push(e),c(r)){if(o.optional)return r;u("No value for data at path: ",i.join("/"))}}return r},_={codec:["yaml","json"],jsExt:["js","mjs"]};class tt extends t{constructor(t,e={}){super(t);const r={..._,...e};this.state.codec=g(r.codec),this.state.jsExt=g(r.jsExt),z(this,e.debug,e.debugPrefix,e.debugColor)}async firstFileWithExt(t,e,r=f){const o=await this.dirs();for(let i of o)for(let o of e){const e=t+"."+o,n=i.file(e,r(t,o));if(this.debug("looking for config file: ",n.path()),await n.exists())return this.debug("config file exists: ",n.path()),n}}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[r,o]=t.split("#",2);let i,n,s;if(i=await this.jsFile(r))s=await import(i.path());else if(n=await this.file(r))s=await n.read();else{if(!e)return u("No configuration file for "+r);s=e}return o?Z(s,o):s}}const et=(t,e)=>new tt(t,e),rt={jsExt:"js mjs"};class ot extends t{constructor(t,e={}){super(t);const r=g({...rt,...e}.jsExt).map((t=>t.replace(/^\./,"")));this.state.exts=r,z(this,e.debug,e.debugPrefix,e.debugColor),this.debug("state: ",this.state)}async library(t){const[e,r]=t.split("#",2),o=await this.dirs(),i=this.state.exts;for(let t of o)for(let o of i){const i=t.file(e+"."+o);this.debug("looking for module %s as",e,i.path());if(await i.exists()){const t=await import(i.path());return this.debug("loaded %s as",i.path()),r?Z(t,r):t}}u("Library not found: ",t)}}const it=(t,e)=>new ot(t,e),nt=t=>async function(...e){try{const r=await t(...e);r&&console.log(F(`✓ ${r}`))}catch(t){console.log(r.env.DEBUG?t:D(`✗ ${t.message||t}`))}},st=async(t,e={})=>{const r=(e=n(e)?{default:e}:e).name||"answer";return(await o([{name:r,type:e.type||"text",message:t,initial:e.default}]))[r]},at=async(t,e={})=>st(t,{...e,type:"confirm"});async function lt(t,e=r.argv.slice(2)){return e.length?e.shift():t?await st(t):void 0}async function ct(t,e=r.argv.slice(2)){let o=[];for(let r of t){const t=await lt(r,e);if(!t?.length)return;o.push(t)}return o}function ut(t,e){e&&console.log(e),r.exit(t)}function ft(t){ut(0,t)}function gt(t){ut(1,t)}function dt(t=r.argv){return t.slice(2)}const ht={verboseColor:"magenta",titleColor:"bright yellow",underlineColor:"dark yellow",infoColor:"cyan",tickColor:"green",questionColor:"bright white",answerColor:"bright green",sectionNewlines:!0},pt=async t=>{const e=m(pt.verboseColor||ht.verboseColor),n=new i;t.name&&n.name(t.name),t.description&&n.description(t.description),t.version&&n.version(t.version),t.yes&&n.option("-y, --yes","Accept default answers"),t.verbose&&n.option("-v, --verbose","Verbose output"),t.quiet&&n.option("-q, --quiet","Quiet output"),t.options?.filter((t=>!(l(t.arg)&&!t.arg)&&(t.title?void 0:l(t.name)))).forEach((t=>{const e=t.name,r=t.about,o=t.default,i=t.handler,s=t.short,a=t.type,c=t.pattern||(l(a)?`<${a}>`:void 0);let u=`--${e}`,f=[];l(s)&&(u=`-${s}, ${u}`),l(c)&&(u=`${u} ${c}`),f.push(u),l(r)&&f.push(r),l(i)&&f.push(i),l(o)&&f.push(o),n.option(...f)}));let s={};t.commands?.forEach((t=>{const e=t.name,r=t.about,o=t.type,i=t.pattern||(l(o)?`<${o}>`:void 0);let a=e,c=n.command(a);l(i)&&c.argument(i),l(r)&&c.description(r),c.action((t=>{s[e]=t}))})),n.parse();const a=n.opts(),c=t.yes&&a.yes,u=t.verbose&&a.verbose,f=t.quiet&&a.quiet;c&&(u&&!f&&r.stdout.write(e("Accepting default answers (-y option is set)\n")),o.override(a));let g=[];t.options?.forEach((t=>{const e=t.type||"text",r=t.name,o=t.prompt,i=l(t.arg)&&!t.arg,n=t.validate||(t.required?t=>!(!l(t)||!t.toString().length)||(pt.invalid||`You must enter a value for ${r}`):void 0);let s=i?t.default:a[r];"select"===e&&l(s)&&(Number.isInteger(s)||(s=t.choices?.findIndex((t=>t.value===s)),s<0&&(s=0))),l(o)?g.push({...t,type:l(s)?()=>(c&&(f||mt({question:o,answer:s})),e):e,name:r,message:o,initial:s,validate:n}):(t.title||t.info)&&g.push({type:()=>(f||bt(t),!1)})}));const d=await o(g);return{...a,...d,...s}},bt=t=>{const e=t.title,o=m(t.titleColor||ht.titleColor),i=m(t.underlineColor||ht.underlineColor),n=m(t.infoColor||ht.infoColor),s=(l(t.newlines)?t.newlines:ht.sectionNewlines)?"\n":"";if(e){const t="-".repeat(e.length);r.stdout.write(s+o(e)+"\n"+i(t)+"\n"+s)}t.info&&r.stdout.write(n(t.info)+"\n"+s)},mt=t=>{const e=m(t.tickColor||ht.tickColor),o=m(t.questionColor||ht.questionColor),i=m(t.answerColor||ht.answerColor);r.stdout.write(e("✔ ")+o(t.question)+" "+i(t.answer)+"\n")};function yt(t={},e){const r=t[e];if(l(r))return r;u("Missing value for required parameter: ",e)}function wt(t={},e){return g(e).map((e=>yt(t,e)))}const vt=wt;function Ct(t,e){let r=!1;const o=g(e),i=o.map((e=>{const o=t[e];return l(o)&&(r=!0),o}));return r?i:u("Missing value for one of: ",function(t,e=", ",r=" or "){return function(t,e=" ",r=e){let o=[...t];const i=o.pop();return o.length?[o.join(e),i].join(r):i}(t,e,r)}(o))}const xt={dir:"config"},kt={dir:"lib library src components"},jt={};class $t{constructor(t,r={}){const o=e(t),i=g(r.config?.dir||xt.dir).map((t=>o.dir(t))),n={...xt,...r.config||{}},s=new tt(i,n),a=g(r.library?.dir||kt.dir).map((t=>o.dir(t))),l={...kt,...r.library||{}},c=new ot(a,l);this.case={...jt,...r.case||{}},this.state={rootDir:o,config:s,library:c},z(this,r.debug,r.debugPrefix,r.debugColor),this.debug("root dir: ",o.path()),this.debug("config dir: ",i.map((t=>t.path()))),this.debug("libDirs: ",a),this.debug("libOpts: ",l)}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,r){return this.debug("write(%s, %o, %o)",t,e,r),this.file(t,r).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[r,o]=t.split("#",2),i=this.convertCase("config",r),n=await this.config(i,{}),s=n.component?.library||this.convertCase("library",r),a=await this.library(s),l=o||n.component?.export||"default";return new(a[l]||u("No '",l,"' export from component library: ",t))(this,{...n,...e})}convertCase(t,e){const r=this.case[t];return r?r(e):e}}const Et=(t,e)=>new $t(t,e);export{p as ANSIescape,h as ANSIescapeCode,b as ANSIreset,H as Component,tt as Config,Y as Debugger,ot as Library,$t as Workspace,gt as abort,z as addDebug,vt as allParams,mt as answer,Ct as anyParams,nt as appStatus,dt as args,y as black,x as blue,q as brightBlack,A as brightBlue,I as brightCyan,F as brightGreen,W as brightGrey,P as brightMagenta,D as brightRed,M as brightWhite,N as brightYellow,lt as cmdLineArg,ct as cmdLineArgs,m as color,et as config,at as confirm,j as cyan,O as darkBlack,Q as darkBlue,T as darkCyan,G as darkGreen,U as darkGrey,S as darkMagenta,B as darkRed,V as darkWhite,L as darkYellow,Z as dataPath,ht as defaults,ut as exit,v as green,$ as grey,it as library,k as magenta,K as matchDoubleQuotedString,R as matchSingleQuotedString,pt as options,st as prompt,ft as quit,w as red,yt as requiredParam,wt as requiredParams,bt as section,X as splitDataPath,E as white,Et as workspace,C as yellow};
2
2
  //# sourceMappingURL=badger.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"badger.esm.js","sources":["../node_modules/.pnpm/@abw+badger-utils@1.0.16/node_modules/@abw/badger-utils/dist/badger-utils.esm.js","../src/Badger/Utils/Color.js","../src/Badger/Utils/Debug.js","../src/Badger/Component.js","../src/Badger/Utils/DataPath.js","../src/Badger/Config.js","../src/Badger/Library.js","../src/Badger/Utils/AppStatus.js","../src/Badger/Utils/Prompt.js","../src/Badger/Utils/CmdLine.js","../src/Badger/Utils/Exit.js","../src/Badger/Utils/Misc.js","../src/Badger/Utils/Options.js","../src/Badger/Utils/Params.js","../src/Badger/Workspace.js"],"sourcesContent":["function n(n){return\"boolean\"==typeof n}function t(n){return\"string\"==typeof n}function e(n){return\"number\"==typeof n}function r(n){return Number.isInteger(n)}function o(n){return e(n)&&!r(n)}function i(n){return Array.isArray(n)}function u(n){return\"function\"==typeof n}function c(n){return\"object\"==typeof n&&!i(n)&&!a(n)}function s(n){return void 0===n}function a(n){return null===n}function f(n){return!(s(n)||a(n))}function l(...n){return n.every((n=>f(n)))}function p(n){return!f(n)}function d(...n){return n.find((n=>f(n)))}const m=(n,t)=>n.replace(/<(\\w+)>/g,((e,r)=>{const o=t[r];return p(o)&&h(`Invalid variable expansion <${r}> in message format: ${n}`),o}));function h(...n){throw new Error(n.join(\"\"))}function y(n,t){throw new Error(m(n,t))}function $(n){throw n}function g(){}function w(){return Intl.DateTimeFormat().resolvedOptions().locale}let b={locale:w(),currency:\"GBP\",currencySign:\"£\",thousands:\",\"};function j(n={}){b={...b,...n}}const v=(n,t,e=1)=>{const r=t<n?-Math.abs(e):e;return Array(1+Math.floor(Math.abs((t-n)/e))).fill(n).map(((n,t)=>n+t*r))};function I(n,t={}){return new Intl.NumberFormat(t.locale||b.locale,t).format(n)}function x(n,t={}){return I(n,{style:\"currency\",currency:b.currency,...t})}function O(n,t=b.thousands){if(p(n))return\"\";for(var e=n.toString().split(\".\"),r=/(\\d+)(\\d{3})/;r.test(e[0]);)e[0]=e[0].replace(r,`$1${t}$2`);return e.join(\".\")}function k(n){return p(n)?[]:t(n)?n.length?n.split(/,\\s*|\\s+/):[]:i(n)?n:[n]}function A(n,t=!0,e={}){if(c(n))return n;return k(n).reduce(((n,e)=>(n[e]=u(t)?t(e):t,n)),e)}function C(n){return t(n)&&0!==n.length?n.split(/\\s*\\n+\\s*/).filter((function(n){return n.length>0})):[]}function T(n,t=\" \",e=t){let r=[...n];const o=r.pop();return r.length?[r.join(t),o].join(e):o}function E(n,t=\", \",e=\" and \"){return T(n,t,e)}function F(n,t=\", \",e=\" or \"){return T(n,t,e)}function L(n){return n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()}function M(n){return n.replace(/(\\w+)/g,L)}function N(n){return n.split(\"/\").map((n=>n.split(\"_\").map(L).join(\"\"))).join(\"/\")}function S(n){return n.split(\"/\").map((n=>n.split(\"_\").map(((n,t)=>t?L(n):n)).join(\"\"))).join(\"/\")}function P(n,t={}){const e=t[n];if(f(e))return e;let r;return n.match(/(ss?|sh|ch|x)$/)?n+\"es\":(r=n.match(/(.*?[^aeiou])y$/))?r[1]+\"ies\":n.match(/([^s\\d\\W])$/)?n+\"s\":n}function W(n,t={}){const e=t[n];return f(e)?e:n.match(/(ss|sh|ch|x)es$/)?n.replace(/es$/,\"\"):n.match(/([^aeiou])ies$/)?n.replace(/ies$/,\"y\"):n.match(/([^s\\d\\W])s$/)?n.replace(/s$/,\"\"):n}function _(n,t,e,r=\"no\"){return(n?O(n):r)+\" \"+(1===n?t:e||P(t))}function B(n,t,e,r=\"No\"){return _(n,t,e,r)}const D=L,G=M,R=P,U=P;function q(n,t){return Object.keys(n).reduce(((e,r)=>(e[r]=t(n[r],r),e)),{})}const z=(n,e,r={})=>{let o,s={},a={delete:!1,...r};if(u(e))o=e;else if(e instanceof RegExp)o=n=>e.test(n);else if(c(e))o=n=>e[n];else if(i(e)||t(e)){const n=A(e);o=t=>n[t]}else h(\"Invalid specification for extract(): \"+e);return Object.keys(n).map((t=>{if(o(t)){let e=n[t];a.delete&&delete n[t],a.key&&(t=a.key(t)),a.value&&(e=a.value(e)),s[t]=e}})),s},H=z,J=(n,t)=>{const e=n[t];return delete n[t],e},K=Object.keys,Q=Object.values,V=Object.entries,X=(n,t)=>parseInt(n[t]||0),Y=(n,t)=>parseFloat(n[t]||0),Z=(n,t)=>(n[t]||\"\").toString(),nn=n=>(t,e)=>X(t,n)-X(e,n),tn=n=>(t,e)=>Y(t,n)-Y(e,n),en=n=>(t,e)=>{let r=Z(t,n).toLowerCase(),o=Z(e,n).toLowerCase();return r>o?1:o>r?-1:0},rn={num:tn,int:nn,str:en,number:tn,integer:nn,string:en},on=n=>n,un=n=>(t,e)=>n(e,t),cn={asc:on,desc:un,ascending:on,descending:un},sn=n=>{const e=k(n).map((n=>{if(u(n))return n;if(t(n)){const t=n.match(/^(\\w+)(?::(\\w+))?(?::(\\w+))?$/)||h(`Invalid sort field: ${n}`),e=rn[t[2]||\"string\"]||h(`Invalid sort type \"${t[2]}\" in sort field: ${n}`);return(cn[t[3]||\"asc\"]||h(`Invalid sort order \"${t[3]}\" in sort field: ${n}`))(e(t[1]))}h(`Invalid sort field: ${n}`)}));return(n,t)=>{for(let r=0;r<e.length;r++){const o=(0,e[r])(n,t);if(0!==o)return o}return 0}};function an(n,t=300){let e;return(...r)=>{clearTimeout(e),e=setTimeout((()=>n.apply(this,r)),t)}}function fn(n){return new Promise((t=>setTimeout(t,n)))}export{B as Inflect,on as ascendingOrder,L as capitalise,M as capitaliseWords,D as capitalize,G as capitalizeWords,O as commas,x as currency,an as debounce,w as defaultLocale,un as descendingOrder,g as doNothing,V as entries,z as extract,h as fail,y as failMsg,d as firstValue,m as format,I as formatNumber,f as hasValue,l as haveValue,_ as inflect,X as integerField,nn as integerSort,i as isArray,n as isBoolean,o as isFloat,u as isFunction,r as isInteger,a as isNull,e as isNumber,c as isObject,t as isString,s as isUndefined,T as joinList,E as joinListAnd,F as joinListOr,K as keys,sn as multiSort,p as noValue,Y as numberField,tn as numberSort,q as objMap,H as objSubset,P as plural,R as pluralise,U as pluralize,v as range,J as remove,$ as rethrow,j as setNumberDefaults,W as singular,fn as sleep,S as snakeToCamel,N as snakeToStudly,cn as sortOrders,rn as sortTypes,A as splitHash,C as splitLines,k as splitList,Z as stringField,en as stringSort,Q as values};\n//# sourceMappingURL=badger-utils.esm.js.map\n","import { isObject } from \"@abw/badger-utils\";\n\nconst ANSIStart = '\\u001B[';\nconst ANSIEnd = 'm';\nconst ANSIColors = {\n reset: 0,\n bold: 1,\n bright: 1,\n dark: 2,\n black: 0,\n red: 1,\n green: 2,\n yellow: 3,\n blue: 4,\n magenta: 5,\n cyan: 6,\n grey: 7,\n white: 8,\n fg: 30,\n bg: 40,\n};\n\n/**\n * Returns an ANSI escape code for a color string. This can be a single color\n * name, e.g. `red`, `green`, etc., or a color prefixed with `bright` or `dark`,\n * e.g. `bright red`, `dark green`, etc. An optional section argument can be\n * set to `fg` (default) to set a foreground color or `bg` for a background color.\n * @param {String} color - color name with optional modifier prefix\n * @param {String} [base='fg'] - `fg` or `bg` to set foreground or background color respectively\n * @return {String} ANSI escape code string\n * @example\n * const str = escapeCode('red')\n * @example\n * const str = escapeCode('bright red')\n * @example\n * const str = escapeCode('bright red', 'bg')\n */\nexport const ANSIescapeCode = (color, base='fg') => {\n let codes = [ ];\n let pair = color.split(/ /, 2);\n const hue = pair.pop();\n const code = (base ? ANSIColors[base] : 0) + ANSIColors[hue];\n codes.push(code);\n if (pair.length) {\n const shade = pair.length ? pair.shift() : 'dark';\n codes.push(ANSIColors[shade])\n }\n // console.log('escapeCode(%s, %s) => ', color, base, codes.join(';'));\n return ANSIStart + codes.join(';') + ANSIEnd;\n}\n\n/**\n * Returns an ANSI escape code for a color string or combination of foreground and\n * background colors.\n * @param {String|Object} colors - either a simple color name or object contain foreground and background colors\n * @param {String} [colors.fg] - foreground color\n * @param {String} [colors.fg] - background color\n * @return {String} ANSI escape code string\n * @example\n * const str = escape('red')\n * @example\n * const str = escape('bright red')\n * @example\n * const str = escape({ fg: 'bright yellow', bg: 'blue' })\n */\nexport const ANSIescape = (colors={}) => {\n const col = isObject(colors) ? colors : { fg: colors };\n let escapes = [ ];\n if (col.bg) {\n escapes.push(ANSIescapeCode(col.bg, 'bg'));\n }\n if (col.fg) {\n escapes.push(ANSIescapeCode(col.fg, 'fg'));\n }\n return escapes.join('');\n}\n\n/**\n * Returns an ANSI escape code to reset all colors.\n * @return {String} ANSI escape reset string\n */\nexport const ANSIreset = () => ANSIescapeCode('reset', false)\n\n/**\n * Returns a function to display strings in a particular color.\n * @param {String} colors - color(s) to display string\n * @return {Function} function to display strings in the pre-defined color(s)\n */\nexport const color = (colors) =>\n text => ANSIescape(colors) + text + ANSIreset();\n\nexport const black = color('black');\nexport const red = color('red');\nexport const green = color('green');\nexport const yellow = color('yellow');\nexport const blue = color('blue');\nexport const magenta = color('magenta');\nexport const cyan = color('cyan');\nexport const grey = color('grey');\nexport const white = color('white');\nexport const brightBlack = color('bright black');\nexport const brightRed = color('bright red');\nexport const brightGreen = color('bright green');\nexport const brightYellow = color('bright yellow');\nexport const brightBlue = color('bright blue');\nexport const brightMagenta = color('bright magenta');\nexport const brightCyan = color('bright cyan');\nexport const brightGrey = color('bright grey');\nexport const brightWhite = color('bright white');\nexport const darkBlack = color('dark black');\nexport const darkRed = color('dark red');\nexport const darkGreen = color('dark green');\nexport const darkYellow = color('dark yellow');\nexport const darkBlue = color('dark blue');\nexport const darkMagenta = color('dark magenta');\nexport const darkCyan = color('dark cyan');\nexport const darkGrey = color('dark grey');\nexport const darkWhite = color('dark white');\n","import { ANSIescape, ANSIreset } from './Color.js'\nimport { doNothing } from '@abw/badger-utils';\n\n/**\n * Returns a debugging function which is enabled by the first `enabled` argument.\n * If this is `false` then it returns a function which does nothing. If it is\n * true then it returns a function that forwards all arguments to `console.log`.\n * An optional `prefix` be be specified to prefix each debugging line. The\n * optional third argument `color` can be used to specify a color for the prefix.\n * @param {Boolean} enabled - is debugging enabled?\n * @param {String} [prefix] - optional prefix for debugging messages\n * @param {String|Object} [color] - a color name or object (see {@link Badger/Utils/Color})\n * @param {String} [color.fg] - foreground color\n * @param {String} [color.bg] - background color\n * @return {Function} a debugging function\n * @example\n * const debug = Debugger(true)\n * @example\n * const debug = Debugger(true, 'Debug > ')\n * @example\n * const debug = Debugger(true, 'Debug > ', 'blue')\n * @example\n * const debug = Debugger(true, 'Debug > ', { bg: 'blue', fg: 'bright yellow' })\n */\nexport function Debugger(enabled, prefix='', color) {\n return enabled\n ? prefix\n ? (format, ...args) =>\n console.log(\n '%s' + prefix + '%s' + format,\n color ? ANSIescape(color) : '',\n ANSIreset(),\n ...args,\n )\n : console.log.bind(console)\n : doNothing;\n}\n\n/**\n * Creates a debugging function via {@link Debugger} and attaches it to the object\n * passed as the first argument as the `debug` function.\n * @param {Object} obj - the object to receive the `debug` function\n * @param {Boolean} enabled - is debugging enabled?\n * @param {String} [prefix] - optional prefix for debugging messages\n * @param {String|Object} [color] - a color name or object (see {@link Badger/Utils/Color})\n * @param {String} [color.fg] - foreground color\n * @param {String} [color.bg] - background color\n * @example\n * const debug = addDebug(myObject, true)\n * @example\n * const debug = addDebug(myObject, true, 'Debug > ')\n * @example\n * const debug = addDebug(myObject, true, 'Debug > ', 'blue')\n * @example\n * const debug = addDebug(myObject, true, 'Debug > ', { bg: 'blue', fg: 'bright yellow' })\n */\nexport function addDebug(obj, enabled, prefix='', color) {\n obj.debug = Debugger(enabled, prefix, color);\n}\n","import { addDebug } from \"./Utils/Debug.js\";\n\nexport class Component {\n constructor(workspace, props={}) {\n this.workspace = workspace;\n this.props = props;\n addDebug(this, props.debug, props.debugPrefix, props.debugColor);\n this.initComponent(props);\n }\n initComponent() {\n // stub for subclasses\n }\n}\n\nexport default Component","import { fail, hasValue, isArray, noValue } from \"@abw/badger-utils\";\n\n/**\n * Characters that can be escaped in quoted strings.\n */\nconst quotedEscapes = {\n b: \"\\b\",\n f: \"\\f\",\n n: \"\\n\",\n r: \"\\r\",\n t: \"\\t\",\n v: \"\\v\",\n '\"': '\"',\n \"'\": \"'\",\n '\\\\': '\\\\',\n}\n\n/**\n * Match a double quoted string and expand escaped characters\n * @param {String} [string] - the string to match\n */\nexport const matchDoubleQuotedString = string => {\n const regex = /^\"((?:\\\\[\\\\\"nrt]|.)*?)\"$/\n const match = string.match(regex);\n return match\n ? match[1].replace(/\\\\([\\\\\"bfnrtv])/g, (all, one) => quotedEscapes[one] || `\\\\${one}`)\n : null;\n}\n\n/**\n * Match a single quoted string and expand escaped characters\n * @param {String} [string] - the string to match\n */\nexport const matchSingleQuotedString = string => {\n const regex = /^'((?:\\\\[\\\\']|.)*?)'$/\n const match = string.match(regex);\n return match\n ? match[1].replace(/\\\\([\\\\'bfnrtv])/g, (all, one) => quotedEscapes[one] || `\\\\${one}`)\n : null;\n}\n\n/**\n * Split a data path into component parts\n * @param {String} [path] - the path to split\n */\nexport const splitDataPath = path => {\n // * match a slash: \\/\n // * match a single quoted string: '...'\n // * match a double quoted string: \"...\"\n // * match anything else: hello world!\n let parts = [ ];\n const regex = /(?:(\\/)|'((?:\\\\[\\\\']|.)*?)'|\"((?:\\\\[\\\\\"nrt]|.)*?)\"|([^/?]+))(\\??)/g;\n const matches = [...path.matchAll(regex)];\n\n matches.map(\n ([ , , single, double, other, optional]) => {\n let part;\n // console.log('match [slash:%s] [single:%s] [double:%s] [other:%s]', slash, single, double, other);\n\n if (single) {\n part = single.replace(/\\\\([\\\\'bfnrtv])/g, (all, one) => quotedEscapes[one] || `\\\\${one}`);\n }\n else if (double) {\n part = double.replace(/\\\\([\\\\\"bfnrtv])/g, (all, one) => quotedEscapes[one] || `\\\\${one}`);\n }\n else if (other) {\n part = other\n }\n if (hasValue(part)) {\n parts.push(optional ? [part, {optional:true}] : part);\n }\n }\n )\n // console.log('MATCHED ', parts);\n\n return parts;\n}\n\n/**\n * Traverse a data structure using a path.\n * @param {Object} [data] - the data to traverse\n * @param {String} [path] - the data path\n */\nexport const dataPath = (data, path) => {\n let root = data;\n let parts = splitDataPath(path);\n let done = [ ];\n // console.log('parts: ', parts);\n\n for (let part of parts) {\n const [word, opts] = isArray(part) ? part : [part, {}];\n root = root[word];\n done.push(word);\n if (noValue(root)) {\n if (opts.optional) {\n return root;\n }\n else {\n fail(\"No value for data at path: \", done.join('/'));\n }\n }\n }\n return root;\n}\n","import { DirPath } from '@abw/badger-filesystem';\nimport { addDebug } from './Utils/Debug.js';\nimport { dataPath } from '../Badger/Utils/DataPath.js';\nimport { doNothing, fail, splitList } from '@abw/badger-utils';\n\n/**\n * Default configuration options.\n */\nconst defaults = {\n codec: ['yaml', 'json'],\n jsExt: ['js', 'mjs'],\n};\n\n/**\n * The Config class implements an object which can load configuration\n * files from a configuration directory. Files can be Javascript files\n * (with `.js` or `.mjs` extensions by default) or data files using any\n * of the standard codecs (`.yaml` or `.json` by default).\n */\nexport class Config extends DirPath {\n /**\n * Constructor for Config object.\n * @param {String} dir - one or more directories that contain configuration files\n * @param {Object} [options] - configuration options\n * @param {Array|String} [options.jsExt='js mjs'] - Array or comma/whitespace delimited string of Javascript file extensions\n * @param {Array|String} [options.codec='yaml json'] - Array or comma/whitespace delimited string of codec names\n * @return {Object} the Config object\n */\n constructor(dir, options={}) {\n super(dir);\n const params = { ...defaults, ...options };\n this.state.codec = splitList(params.codec),\n this.state.jsExt = splitList(params.jsExt),\n addDebug(this, options.debug, options.debugPrefix, options.debugColor);\n }\n\n /**\n * Internal method to locate the first config file with one of a number of file extensions.\n * @param {String} uri - base part of filename\n * @param {Array} [exts] - array of possible extensions\n * @param {Function} [makeOptions] - optional function to generate options for a {@link File} object\n * @return {Object} the {@link File} object if it exists or `undefined` if not\n */\n async firstFileWithExt(uri, exts, makeOptions=doNothing) {\n const dirs = await this.dirs();\n\n for (let dir of dirs) {\n for (let ext of exts) {\n const path = uri + '.' + ext;\n const file = dir.file(path, makeOptions(uri, ext));\n this.debug('looking for config file: ', file.path());\n if (await file.exists()) {\n this.debug('config file exists: ', file.path());\n return file;\n }\n }\n }\n return undefined;\n }\n\n /**\n * Internal method to locate a Javascript configuration file with one of the `jsExt` extensions (`.js` or `.mjs` by default)\n * @param {String} uri - base part of filename\n * @return {Object} the {@link File} object if it exists or `undefined` if not\n */\n async jsFile(uri) {\n return await this.firstFileWithExt(uri, this.state.jsExt);\n }\n\n /**\n * Internal method to locate a configuration file with one of the `codec` extensions (`.yaml` or `.json` by default)\n * @param {String} uri - base part of filename\n * @return {Object} the {@link File} object if it exists or `undefined` if not\n */\n async file(uri) {\n return await this.firstFileWithExt(uri, this.state.codec, (uri, codec) => ({ codec }));\n }\n\n /**\n * Method to fetch configuration data from a file. The file can be a Javascript file which should\n * return the configuration data as the default export, or a YAML (`.yaml`) or JSON (`.json`) file.\n * If the file isn't found then the method returns the `defaults` data if provided, or throws an\n * error if not.\n * @param {String} uri - base part of filename\n * @param {Object} [defaults] - default configuration options to be used if a file isn't found\n * @return {Object} the configuration data loaded from the file\n */\n async config(uri, defaults) {\n const [base, fragment] = uri.split('#', 2);\n let jsFile, file, data;\n\n // first look for a JS file, e.g. <uri>.js, <uri>.mjs\n if ((jsFile = await this.jsFile(base))) {\n data = await import(jsFile.path());\n }\n // then for a config file with a codec extension, e.g. <uri>.yaml, <uri>.yaml\n else if ((file = await this.file(base))) {\n data = await file.read();\n }\n // failing that use any default value\n else if (defaults) {\n data = defaults;\n }\n // anything else is a big pile of fail\n else {\n return fail(\"No configuration file for \" + base);\n }\n // resolve any data path in a #fragment\n return fragment\n ? dataPath(data, fragment)\n : data;\n }\n}\n\n/**\n * Function to create a new Config object\n * @param {String} dir - directory or directories containing configuration files\n * @param {Object} [options] - configuration options\n * @param {Array|String} [options.jsExt='js mjs'] - Array or comma/whitespace delimited string of Javascript file extensions\n * @param {Array|String} [options.codec='yaml json'] - Array or comma/whitespace delimited string of codec names\n * @return {Object} the Config object\n */\nexport const config = (dir, options) => new Config(dir, options)\n\nexport default Config\n","import { DirPath } from \"@abw/badger-filesystem\";\nimport { addDebug } from \"./Utils/Debug.js\";\nimport { dataPath } from \"./Utils/DataPath.js\";\nimport { fail, splitList } from \"@abw/badger-utils\";\n\n/**\n * Default configuration options.\n */\nconst defaults = {\n jsExt: 'js mjs',\n}\n\n/**\n * The Library class implements an object which can load Javascript files\n * from one or more library directories. Files can be Javascript files\n * (with `.js` or `.mjs` extensions by default)\n */\nexport class Library extends DirPath {\n /**\n * Constructor for Library object.\n * @param {String} dir - one or more directories that contain Javascript libraries\n * @param {Object} [options] - configuration options\n * @param {Array|String} [options.jsExt='js mjs'] - Array or comma/whitespace delimited string of Javascript file extensions\n * @return {Object} the Library object\n */\n constructor(dir, options={}) {\n super(dir);\n const params = { ...defaults, ...options };\n const exts = splitList(params.jsExt).map( ext => ext.replace(/^\\./, '') ); // remove leading '.'\n this.state.exts = exts;\n addDebug(this, options.debug, options.debugPrefix, options.debugColor);\n this.debug(\"state: \", this.state)\n }\n\n /**\n * Method to load a Javascript library in one of the library directories and with one of the `jsExt` extensions (`.js` or `.mjs` by default).\n * Returns the exports from the library if found or throws an error if not.\n * @param {String} uri - base part of filename\n * @return {Object} the exports from the loaded libary\n */\n async library(uri) {\n const [base, fragment] = uri.split('#', 2);\n const dirs = await this.dirs();\n const exts = this.state.exts;\n for (let dir of dirs) {\n for (let ext of exts) {\n const file = dir.file(base + '.' + ext);\n this.debug('looking for module %s as', base, file.path());\n const exists = await file.exists();\n if (exists) {\n const load = await import(file.path());\n this.debug('loaded %s as', file.path());\n return fragment\n ? dataPath(load, fragment)\n : load;\n }\n }\n }\n fail(\"Library not found: \", uri);\n }\n}\n\n/**\n * Function to create a new Library object\n * @param {String} dir - directory or directories containing configuration files\n * @param {Object} [options] - configuration options\n * @param {Array|String} [options.jsExt='js mjs'] - Array or comma/whitespace delimited string of Javascript file extensions\n * @return {Object} the Library object\n */\nexport const library = (dir, options) => new Library(dir, options);\n\nexport default library;","import process from 'node:process'\nimport { brightGreen, brightRed } from './Color.js';\n\nexport const appStatus = app => async function(...args) {\n try {\n const message = await app(...args);\n if (message) {\n console.log(brightGreen(`✓ ${message}`));\n }\n }\n catch (error) {\n console.log(\n process.env.DEBUG\n ? error\n : brightRed(`✗ ${error.message||error}`)\n )\n }\n}\n\nexport default appStatus","import { isString } from '@abw/badger-utils';\nimport prompts from 'prompts'\n\n/**\n * Prompt user to enter a value.\n * @param {String} question - question to prompt user to answer\n * @param {Object} [options] - optional options\n * @param {String} [options.default] - default value returned if user presses RETURN\n * @return {Promise} fulfills with response to question or default value\n * @example\n * prompt(\"What is your name?\")\n * .then( name => console.log(`Hello ${name}`) );\n * @example\n * prompt(\"What is your name?\", { default: 'Mr.Badger' })\n * .then( name => console.log(`Hello ${name}`) );\n */\nexport const prompt = async (question, options={}) => {\n options = isString(options)\n ? { default: options }\n : options;\n\n const name = options.name || 'answer';\n const answers = await prompts([\n {\n name,\n type: options.type || 'text',\n message: question,\n initial: options.default,\n },\n ]);\n return answers[name];\n}\n\n/**\n * Prompt user to confirm a choice.\n * @param {String} question - question to prompt user to answer\n * @param {Object} [options] - optional options\n * @param {String} [options.default] - default value returned if user presses RETURN\n * @return {Promise} fulfills with response to question or default value\n * @example\n * confirm(\"Are you sure?\")\n * .then( yes => console.log('You said \"%s\"', yes ? 'YES' : 'NO') );\n */\nexport const confirm = async (question, options={}) =>\n prompt(question, { ...options, type: 'confirm' });\n\nexport default prompt","import process from 'node:process'\nimport { prompt } from './Prompt.js';\n\n// quick hacks - use with caution\nexport async function cmdLineArg(argPrompt, args=process.argv.slice(2)) {\n if (args.length) {\n return args.shift();\n }\n else if (argPrompt) {\n return await prompt(argPrompt);\n }\n return undefined;\n}\n\nexport async function cmdLineArgs(argPrompts, args=process.argv.slice(2)) {\n let results = [ ];\n for (let argPrompt of argPrompts) {\n const response = await cmdLineArg(argPrompt, args);\n if (! response?.length) {\n return undefined;\n }\n results.push(response);\n }\n return results;\n}","import process from 'node:process'\n\nexport function exit(value, message) {\n if (message) {\n console.log(message);\n }\n process.exit(value);\n}\n\nexport function quit(message) {\n exit(0, message);\n}\n\nexport function abort(message) {\n exit(1, message);\n}","import process from \"node:process\"\n\n/**\n * Returns an array of the `process.argv` array from offset 2 onwards,\n * i.e. removing the node path and script name.\n * @param {Array} argv - list of arguments, defaults to `process.argv`\n * @return {Array} array of arguments excluding the first two\n */\nexport function args(argv=process.argv) {\n return argv.slice(2);\n}\n","import process from 'node:process';\nimport prompter from 'prompts'\nimport { Command } from 'commander';\nimport { color } from './Color.js';\nimport { hasValue } from '@abw/badger-utils';\n\nexport const defaults = {\n verboseColor: 'magenta',\n titleColor: 'bright yellow',\n underlineColor: 'dark yellow',\n infoColor: 'cyan',\n tickColor: 'green',\n questionColor: 'bright white',\n answerColor: 'bright green',\n sectionNewlines: true\n};\n\nexport const options = async config => {\n const vcol = color(options.verboseColor || defaults.verboseColor);\n const command = new Command;\n\n // set command name, description and version\n if (config.name) {\n command.name(config.name);\n }\n if (config.description) {\n command.description(config.description);\n }\n if (config.version) {\n command.version(config.version);\n }\n\n // define the -y / -yes and -v / --verbose options\n if (config.yes) {\n command.option('-y, --yes', 'Accept default answers')\n }\n if (config.verbose) {\n command.option('-v, --verbose', 'Verbose output')\n }\n if (config.quiet) {\n command.option('-q, --quiet', 'Quiet output')\n }\n\n // add in other command line options\n config.options\n ?.filter(\n option => {\n if (hasValue(option.arg) && ! option.arg) {\n // allow arg: false to indicate no command line argument\n return false;\n }\n if (option.title) {\n // section break\n return;\n }\n return hasValue(option.name);\n }\n )\n .forEach(\n option => {\n const name = option.name;\n const about = option.about;\n const deflt = option.default;\n const handler = option.handler;\n const short = option.short;\n const type = option.type;\n const pattern = option.pattern || (hasValue(type) ? `<${type}>` : undefined);\n let string = `--${name}`;\n let args = [];\n if (hasValue(short)) {\n string = `-${short}, ${string}`;\n }\n if (hasValue(pattern)) {\n string = `${string} ${pattern}`;\n }\n args.push(string);\n if (hasValue(about)) {\n args.push(about);\n }\n if (hasValue(handler)) {\n args.push(handler);\n }\n if (hasValue(deflt)) {\n args.push(deflt);\n }\n console.log('command option: ', args);\n\n command.option(...args)\n }\n )\n\n let commands = { };\n\n config.commands?.forEach(\n option => {\n const name = option.name;\n const about = option.about;\n const type = option.type;\n const pattern = option.pattern || (hasValue(type) ? `<${type}>` : undefined);\n let string = name;\n let cmd = command.command(string)\n if (hasValue(pattern)) {\n cmd.argument(pattern);\n // string = `${string} ${pattern}`;\n }\n if (hasValue(about)) {\n cmd.description(about);\n }\n cmd.action(\n args => {\n commands[name] = args;\n }\n )\n //console.log({ args });\n //command.command(...args)\n }\n )\n\n // parse the command line arguments\n command.parse();\n const cmdline = command.opts();\n\n // if the -y / --yes option has been specified then accept all\n // default answers automatically\n const yes = config.yes && cmdline.yes;\n const verbose = config.verbose && cmdline.verbose;\n const quiet = config.quiet && cmdline.quiet;\n\n if (yes) {\n if (verbose && ! quiet) {\n process.stdout.write(vcol('Accepting default answers (-y option is set)\\n'))\n }\n prompter.override(cmdline);\n }\n\n // build up the list of prompts for interactive questions\n let prompts = [ ];\n config.options?.forEach(\n option => {\n const type = option.type || 'text';\n const name = option.name;\n const prompt = option.prompt;\n const noArg = hasValue(option.arg) && ! option.arg;\n const validate = option.validate ||\n (option.required\n ? value => (hasValue(value) && value.toString().length)\n ? true\n : (options.invalid || `You must enter a value for ${name}`)\n : undefined\n )\n\n // special process for initial\n // - use cmdline[name]\n // - or if noArg, use option.default\n // - if a select list and not a number, find the index\n let initial = noArg ? option.default : cmdline[name];\n if (type === 'select' && hasValue(initial)) {\n if (! Number.isInteger(initial)) {\n // console.log('looking up select option for [%s]', initial);\n initial = option.choices?.findIndex( i => i.value === initial );\n if (initial < 0) {\n initial = 0;\n }\n }\n }\n\n if (hasValue(prompt)) {\n prompts.push(\n {\n ...option,\n type: (\n hasValue(initial)\n ? () => {\n yes && (quiet || answer({ question: prompt, answer: initial }));\n return type;\n }\n : type\n ),\n name,\n message: prompt,\n initial: initial,\n validate: validate,\n },\n )\n }\n else if (option.title || option.info) {\n prompts.push(\n {\n type: () => {\n quiet || section(option);\n return false;\n }\n }\n );\n }\n }\n );\n\n // prompt the user to answer/confirm questions\n const answers = await prompter(prompts);\n\n return {\n ...cmdline, ...answers, ...commands\n }\n}\n\nexport const section = option => {\n const title = option.title;\n const tcol = color(option.titleColor || defaults.titleColor);\n const ucol = color(option.underlineColor || defaults.underlineColor);\n const icol = color(option.infoColor || defaults.infoColor);\n const nl = (hasValue(option.newlines) ? option.newlines : defaults.sectionNewlines) ? \"\\n\" : \"\";\n\n if (title) {\n const uline = '-'.repeat(title.length);\n process.stdout.write(nl + tcol(title) + \"\\n\" + ucol(uline) + \"\\n\" + nl);\n }\n\n if (option.info) {\n process.stdout.write(icol(option.info) + \"\\n\" + nl);\n }\n}\n\nexport const answer = option => {\n const tcol = color(option.tickColor || defaults.tickColor);\n const qcol = color(option.questionColor || defaults.questionColor);\n const acol = color(option.answerColor || defaults.answerColor);\n process.stdout.write(tcol(\"✔ \") + qcol(option.question) + \" \" + acol(option.answer) + \"\\n\");\n}\n\nexport default options","import { joinListOr, splitList, hasValue, fail } from \"@abw/badger-utils\";\n\n/**\n * Assert that a parameter object contains an item with a defined/non-null value\n * @param {Object} params={} - parameters object\n * @param {String} name - parameter that must be included\n * @return {any} the parameter value\n * @throws {Error} if the parameter is not defined or null\n * @example\n * const foo = requiredParam({ foo: 10 }, 'foo');\n */\nexport function requiredParam(params={}, name) {\n const value = params[name];\n if (hasValue(value)) {\n return value;\n }\n else {\n fail(\"Missing value for required parameter: \", name);\n }\n}\n\n/**\n * Assert that a parameter object contains all specified item with a defined/non-null value\n * @param {Object} params={} - parameters object\n * @param {Array|String} names - parameters that must be included, as an Array or whitespace/comma delimited string (see {@link splitList})\n * @return {Array} the parameter values\n * @throws {Error} if any parameter is not defined or null\n * @example\n * const [foo, bar] = requiredParams({ foo: 10, bar: 20 }, 'foo bar');\n */\nexport function requiredParams(params={}, names) {\n return splitList(names).map( name => requiredParam(params, name) );\n}\n\n/**\n * An alias for {@link requiredParams} for people who don't like typing long names (and for symmetry with {@link anyParams}))\n */\nexport const allParams=requiredParams;\n\n/**\n * Assert that a parameter object contains any of the specified items with a defined/non-null value\n * @param {Object} params={} - parameters object\n * @param {Array|String} names - parameters of which at least one must be included, as an Array or whitespace/comma delimited string (see {@link splitList})\n * @return {Array} the parameter values\n * @throws {Error} if any parameter is not defined or null\n * @example\n * const [foo, bar] = anyParams({ foo: 10, wiz: 99 }, 'foo bar');\n */\nexport function anyParams(params, names) {\n let found = false;\n const nlist = splitList(names);\n const values = nlist.map(\n name => {\n const value = params[name];\n if (hasValue(value)) {\n found = true;\n }\n return value;\n }\n );\n return found\n ? values\n : fail(\"Missing value for one of: \", joinListOr(nlist));\n}\n","import { addDebug } from \"./Utils/Debug.js\";\nimport { Config } from \"./Config.js\";\nimport { Library } from \"./Library.js\";\nimport { dir as fsDir } from \"@abw/badger-filesystem\";\nimport { fail, hasValue, splitList } from \"@abw/badger-utils\";\n\n/**\n * Default configuration options.\n */\nconst defaults = {\n config: {\n dir: 'config',\n },\n library: {\n dir: 'lib library src components',\n },\n case: {\n // config and/or library case conversion functions\n }\n}\n\n/**\n * The Workspace class implements an object which acts as a central repository\n * for your project, providing access to directories, files, configuration files,\n * Javascript libraries and components.\n */\nexport class Workspace {\n /**\n * Constructor for Workspace object.\n * @param {String} dir - root directory for the workspace\n * @param {Object} [options] - configuration options\n * @param {Object} [options.config] - configuration options for a {@link Config} object\n * @param {Array|String} [options.config.dir] - configuration directory or directories relative to the workspace directory\n * @param {Object} [options.library] - configuration options for a {@link Config} object\n * @param {Array|String} [options.library.dir] - library directory or directories relative to the workspace directory\n * @return {Object} the Workspace object\n */\n constructor(dir, options={}) {\n const rootDir = fsDir(dir);\n const cfgDir = splitList(options.config?.dir || defaults.config.dir).map( dir => rootDir.dir(dir) );\n const cfgOpts = { ...defaults.config, ...(options.config||{}) };\n const config = new Config(cfgDir, cfgOpts);\n const libDirs = splitList(options.library?.dir || defaults.library.dir).map( dir => rootDir.dir(dir) );\n const libOpts = { ...defaults.library, ...(options.library||{}) };\n const library = new Library(libDirs, libOpts);\n\n this.case = {\n ...defaults.case,\n ...(options.case||{})\n };\n\n this.state = {\n rootDir,\n config,\n library\n }\n\n addDebug(this, options.debug, options.debugPrefix, options.debugColor);\n this.debug('root dir: ', rootDir.path());\n this.debug('config dir: ', cfgDir.map( d => d.path() ));\n this.debug('libDirs: ', libDirs);\n this.debug('libOpts: ', libOpts);\n }\n\n /**\n * Fetch a new {@link Directory} object for a sub-directory of the workspace directory.\n * @param {string} path - directory path relative to the workspace directory\n * @param {Object} [options] - directory configuration options\n * @param {String} [options.codec] - codec for encoding/decoding file data\n * @return {Object} a {@link Directory} object\n */\n dir(path, options) {\n this.debug(\"dir(%s, %o)\", path, options);\n return hasValue(path)\n ? this.state.rootDir.dir(path, options)\n : this.state.rootDir;\n }\n\n /**\n * Fetch a new {@link File} object for a file in the workspace.\n * @param {string} path - file path relative to the workspace directory\n * @param {Object} [options] - file configuration options\n * @param {String} [options.codec] - codec for encoding/decoding file data\n * @param {Boolean} [options.encoding=utf8] - character encoding for the file\n * @return {Object} a {@link File} object\n */\n file(path, options) {\n this.debug(\"file(%s, %o)\", path, options);\n return this.state.rootDir.file(path, options)\n }\n\n /**\n * Read the content of a file in the workspace.\n * @param {string} path - file path relative to the workspace directory\n * @param {Object} [options] - directory configuration options\n * @param {Boolean} [options.codec] - codec for encoding/decoding file data\n * @param {Boolean} [options.encoding=utf8] - character encoding for the file\n * @return {Promise} fulfills with the file content\n * @example\n * file('myfile.txt').read().then( text => console.log(text) );\n * @example\n * file('myfile.json', { codec: 'json' }).read().then( data => console.log(data) );\n * @example\n * file('myfile.json').read({ codec: 'json' }).then( data => console.log(data) );\n */\n read(path, options) {\n this.debug(\"read(%s, %o)\", path, options);\n return this.file(path, options).read();\n }\n\n /**\n * Writes content to a file. If a `codec` has been specified then the content will be encoded.\n * @param {string} path - file path relative to the workspace directory\n * @param {String|Object} data - directory configuration options\n * @param {Object} [options] - directory configuration options\n * @param {Boolean} [options.codec] - codec for encoding/decoding file data\n * @param {Boolean} [options.encoding=utf8] - codec for encoding/decoding file data\n * @return {Promise} fulfills with the file object\n * @example\n * file('myfile.txt').write('Hello World');\n * @example\n * file('myfile.json', { codec: 'json' }).write({ message: 'Hello World' });\n * @example\n * file('myfile.json').write({ message: 'Hello World' }, { codec: 'json' });\n */\n write(path, data, options) {\n this.debug(\"write(%s, %o, %o)\", path, data, options);\n return this.file(path, options).write(data);\n }\n\n /**\n * Fetch the configuration directory or a directory relative to it\n * @param {string} [path] - file path relative to the configuration directory\n * @param {Object} [options] - directory configuration options\n * @param {String} [options.codec] - codec for encoding/decoding data for files in the directory\n * @param {Boolean} [options.encoding=utf8] - character encoding for files in the directory\n * @return {Object} a {@link Directory} object\n */\n configDir(path, options) {\n this.debug(\"configDir(%s, %o)\", path, options);\n return hasValue(path)\n ? this.state.configDir.dir(path, options)\n : this.state.configDir;\n }\n\n /**\n * Fetches configuration data from a file in the configuration directory or returns the\n * {@link Config} object itself if no file uri is specified.\n * @param {string} [uri] - file path relative to the configuration directory\n * @param {Object} [defaults] - default configuration options if file isn't found\n * @return {Promise} fulfills to the configuration data read from the file\n * @example\n * workspace.config('myfile').then(\n * config => console.log(\"Loaded myfile config: \", config)\n * );\n */\n async config(uri, defaults) {\n this.debug(\"config(%s, %o)\", uri, defaults);\n return hasValue(uri)\n ? this.state.config.config(uri, defaults)\n : this.state.config;\n }\n\n /**\n * Loads a Javscript library from the library directory or returns the\n * {@link Library} object itself if no file uri is specified.\n * @param {string} [uri] - file path relative to the library directory\n * @return {Promise} fulfills to the configuration data read from the file\n * @example\n * workspace.library('mylib').then(\n * exports => console.log(\"Loaded mylib exports: \", exports)\n * );\n */\n async library(uri) {\n this.debug(\"library(%s, %o)\", uri);\n return hasValue(uri)\n ? this.state.library.library(uri)\n : this.state.library;\n }\n\n /**\n * Loads a Javscript library from the library directory and instantiates a\n * component.\n * @param {String} uri - component base name\n * @param {Object} [props] - optional configuration properties\n * @return {Promise} fulfills to a newly instantiated component\n * @example\n * workspace.component('mycomp').then(\n * component => console.log(\"Created component: \", component)\n * );\n */\n async component(uri, props) {\n const [base, fragment] = uri.split('#', 2);\n const cfgname = this.convertCase('config', base);\n const config = await this.config(cfgname, {});\n const libname = config.component?.library || this.convertCase('library', base);\n const lib = await this.library(libname);\n const exp = fragment || config.component?.export || 'default';\n const compcls = lib[exp] || fail(\"No '\", exp, \"' export from component library: \", uri);\n const comp = new compcls(this, { ...config, ...props });\n return comp;\n }\n\n convertCase(type, uri) {\n const fn = this.case[type];\n return fn\n ? fn(uri)\n : uri;\n }\n}\n\nexport const workspace = (dir, options) => new Workspace(dir, options);\n\nexport default Workspace;"],"names":["t","n","i","Array","isArray","a","f","s","p","h","Error","join","g","k","length","split","Intl","DateTimeFormat","resolvedOptions","locale","ANSIColors","reset","bold","bright","dark","black","red","green","yellow","blue","magenta","cyan","grey","white","fg","bg","ANSIescapeCode","color","base","codes","pair","hue","pop","code","push","shade","shift","ANSIescape","colors","col","escapes","ANSIreset","text","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightGrey","brightWhite","darkBlack","darkRed","darkGreen","darkYellow","darkBlue","darkMagenta","darkCyan","darkGrey","darkWhite","Debugger","enabled","prefix","format","args","console","log","bind","doNothing","addDebug","obj","debug","Component","constructor","workspace","props","this","debugPrefix","debugColor","initComponent","quotedEscapes","b","r","v","matchDoubleQuotedString","string","match","replace","all","one","matchSingleQuotedString","splitDataPath","path","parts","matchAll","map","single","double","other","optional","part","hasValue","dataPath","data","root","done","word","opts","noValue","fail","defaults","codec","jsExt","Config","DirPath","dir","options","super","params","state","splitList","async","uri","exts","makeOptions","dirs","ext","file","exists","firstFileWithExt","fragment","jsFile","import","read","config","Library","load","library","appStatus","app","message","error","process","env","DEBUG","prompt","question","name","isString","default","prompts","type","initial","confirm","cmdLineArg","argPrompt","argv","slice","cmdLineArgs","argPrompts","results","response","exit","value","quit","abort","verboseColor","titleColor","underlineColor","infoColor","tickColor","questionColor","answerColor","sectionNewlines","vcol","command","Command","description","version","yes","option","verbose","quiet","filter","arg","title","forEach","about","deflt","handler","short","pattern","undefined","commands","cmd","argument","action","parse","cmdline","stdout","write","prompter","override","noArg","validate","required","toString","invalid","Number","isInteger","choices","findIndex","answer","info","section","answers","tcol","ucol","icol","nl","newlines","uline","repeat","qcol","acol","requiredParam","requiredParams","names","allParams","anyParams","found","nlist","values","e","o","T","joinListOr","Workspace","rootDir","fsDir","cfgDir","cfgOpts","libDirs","libOpts","case","d","configDir","cfgname","convertCase","libname","component","lib","exp","export","fn"],"mappings":"qNAAwC,S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,EAAUnH,EAAOoH,WAAWjH,SAAW7D,KAAK4K,YAAY,UAAW7N,GACnEgO,QAAgB/K,KAAK6D,QAAQgH,GAC7BG,EAAU1H,GAAYI,EAAOoH,WAAWG,QAAU,UAGxD,OADgB,IADAF,EAAIC,IAAQ/I,EAAK,OAAQ+I,EAAK,oCAAqClI,IACvD9C,KAAM,IAAK0D,KAAW3D,GAEnD,CAED6K,YAAYjG,EAAM7B,GAChB,MAAMoI,EAAKlL,KAAKwK,KAAK7F,GACrB,OAAOuG,EACHA,EAAGpI,GACHA,CACL,EAGS,MAAChD,GAAY,CAACyC,EAAKC,IAAY,IAAIyH,GAAU1H,EAAKC","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"badger.esm.js","sources":["../node_modules/.pnpm/@abw+badger-utils@1.0.16/node_modules/@abw/badger-utils/dist/badger-utils.esm.js","../src/Badger/Utils/Color.js","../src/Badger/Utils/Debug.js","../src/Badger/Component.js","../src/Badger/Utils/DataPath.js","../src/Badger/Config.js","../src/Badger/Library.js","../src/Badger/Utils/AppStatus.js","../src/Badger/Utils/Prompt.js","../src/Badger/Utils/CmdLine.js","../src/Badger/Utils/Exit.js","../src/Badger/Utils/Misc.js","../src/Badger/Utils/Options.js","../src/Badger/Utils/Params.js","../src/Badger/Workspace.js"],"sourcesContent":["function n(n){return\"boolean\"==typeof n}function t(n){return\"string\"==typeof n}function e(n){return\"number\"==typeof n}function r(n){return Number.isInteger(n)}function o(n){return e(n)&&!r(n)}function i(n){return Array.isArray(n)}function u(n){return\"function\"==typeof n}function c(n){return\"object\"==typeof n&&!i(n)&&!a(n)}function s(n){return void 0===n}function a(n){return null===n}function f(n){return!(s(n)||a(n))}function l(...n){return n.every((n=>f(n)))}function p(n){return!f(n)}function d(...n){return n.find((n=>f(n)))}const m=(n,t)=>n.replace(/<(\\w+)>/g,((e,r)=>{const o=t[r];return p(o)&&h(`Invalid variable expansion <${r}> in message format: ${n}`),o}));function h(...n){throw new Error(n.join(\"\"))}function y(n,t){throw new Error(m(n,t))}function $(n){throw n}function g(){}function w(){return Intl.DateTimeFormat().resolvedOptions().locale}let b={locale:w(),currency:\"GBP\",currencySign:\"£\",thousands:\",\"};function j(n={}){b={...b,...n}}const v=(n,t,e=1)=>{const r=t<n?-Math.abs(e):e;return Array(1+Math.floor(Math.abs((t-n)/e))).fill(n).map(((n,t)=>n+t*r))};function I(n,t={}){return new Intl.NumberFormat(t.locale||b.locale,t).format(n)}function x(n,t={}){return I(n,{style:\"currency\",currency:b.currency,...t})}function O(n,t=b.thousands){if(p(n))return\"\";for(var e=n.toString().split(\".\"),r=/(\\d+)(\\d{3})/;r.test(e[0]);)e[0]=e[0].replace(r,`$1${t}$2`);return e.join(\".\")}function k(n){return p(n)?[]:t(n)?n.length?n.split(/,\\s*|\\s+/):[]:i(n)?n:[n]}function A(n,t=!0,e={}){if(c(n))return n;return k(n).reduce(((n,e)=>(n[e]=u(t)?t(e):t,n)),e)}function C(n){return t(n)&&0!==n.length?n.split(/\\s*\\n+\\s*/).filter((function(n){return n.length>0})):[]}function T(n,t=\" \",e=t){let r=[...n];const o=r.pop();return r.length?[r.join(t),o].join(e):o}function E(n,t=\", \",e=\" and \"){return T(n,t,e)}function F(n,t=\", \",e=\" or \"){return T(n,t,e)}function L(n){return n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()}function M(n){return n.replace(/(\\w+)/g,L)}function N(n){return n.split(\"/\").map((n=>n.split(\"_\").map(L).join(\"\"))).join(\"/\")}function S(n){return n.split(\"/\").map((n=>n.split(\"_\").map(((n,t)=>t?L(n):n)).join(\"\"))).join(\"/\")}function P(n,t={}){const e=t[n];if(f(e))return e;let r;return n.match(/(ss?|sh|ch|x)$/)?n+\"es\":(r=n.match(/(.*?[^aeiou])y$/))?r[1]+\"ies\":n.match(/([^s\\d\\W])$/)?n+\"s\":n}function W(n,t={}){const e=t[n];return f(e)?e:n.match(/(ss|sh|ch|x)es$/)?n.replace(/es$/,\"\"):n.match(/([^aeiou])ies$/)?n.replace(/ies$/,\"y\"):n.match(/([^s\\d\\W])s$/)?n.replace(/s$/,\"\"):n}function _(n,t,e,r=\"no\"){return(n?O(n):r)+\" \"+(1===n?t:e||P(t))}function B(n,t,e,r=\"No\"){return _(n,t,e,r)}const D=L,G=M,R=P,U=P;function q(n,t){return Object.keys(n).reduce(((e,r)=>(e[r]=t(n[r],r),e)),{})}const z=(n,e,r={})=>{let o,s={},a={delete:!1,...r};if(u(e))o=e;else if(e instanceof RegExp)o=n=>e.test(n);else if(c(e))o=n=>e[n];else if(i(e)||t(e)){const n=A(e);o=t=>n[t]}else h(\"Invalid specification for extract(): \"+e);return Object.keys(n).map((t=>{if(o(t)){let e=n[t];a.delete&&delete n[t],a.key&&(t=a.key(t)),a.value&&(e=a.value(e)),s[t]=e}})),s},H=z,J=(n,t)=>{const e=n[t];return delete n[t],e},K=Object.keys,Q=Object.values,V=Object.entries,X=(n,t)=>parseInt(n[t]||0),Y=(n,t)=>parseFloat(n[t]||0),Z=(n,t)=>(n[t]||\"\").toString(),nn=n=>(t,e)=>X(t,n)-X(e,n),tn=n=>(t,e)=>Y(t,n)-Y(e,n),en=n=>(t,e)=>{let r=Z(t,n).toLowerCase(),o=Z(e,n).toLowerCase();return r>o?1:o>r?-1:0},rn={num:tn,int:nn,str:en,number:tn,integer:nn,string:en},on=n=>n,un=n=>(t,e)=>n(e,t),cn={asc:on,desc:un,ascending:on,descending:un},sn=n=>{const e=k(n).map((n=>{if(u(n))return n;if(t(n)){const t=n.match(/^(\\w+)(?::(\\w+))?(?::(\\w+))?$/)||h(`Invalid sort field: ${n}`),e=rn[t[2]||\"string\"]||h(`Invalid sort type \"${t[2]}\" in sort field: ${n}`);return(cn[t[3]||\"asc\"]||h(`Invalid sort order \"${t[3]}\" in sort field: ${n}`))(e(t[1]))}h(`Invalid sort field: ${n}`)}));return(n,t)=>{for(let r=0;r<e.length;r++){const o=(0,e[r])(n,t);if(0!==o)return o}return 0}};function an(n,t=300){let e;return(...r)=>{clearTimeout(e),e=setTimeout((()=>n.apply(this,r)),t)}}function fn(n){return new Promise((t=>setTimeout(t,n)))}export{B as Inflect,on as ascendingOrder,L as capitalise,M as capitaliseWords,D as capitalize,G as capitalizeWords,O as commas,x as currency,an as debounce,w as defaultLocale,un as descendingOrder,g as doNothing,V as entries,z as extract,h as fail,y as failMsg,d as firstValue,m as format,I as formatNumber,f as hasValue,l as haveValue,_ as inflect,X as integerField,nn as integerSort,i as isArray,n as isBoolean,o as isFloat,u as isFunction,r as isInteger,a as isNull,e as isNumber,c as isObject,t as isString,s as isUndefined,T as joinList,E as joinListAnd,F as joinListOr,K as keys,sn as multiSort,p as noValue,Y as numberField,tn as numberSort,q as objMap,H as objSubset,P as plural,R as pluralise,U as pluralize,v as range,J as remove,$ as rethrow,j as setNumberDefaults,W as singular,fn as sleep,S as snakeToCamel,N as snakeToStudly,cn as sortOrders,rn as sortTypes,A as splitHash,C as splitLines,k as splitList,Z as stringField,en as stringSort,Q as values};\n//# sourceMappingURL=badger-utils.esm.js.map\n","import { isObject } from \"@abw/badger-utils\";\n\nconst ANSIStart = '\\u001B[';\nconst ANSIEnd = 'm';\nconst ANSIColors = {\n reset: 0,\n bold: 1,\n bright: 1,\n dark: 2,\n black: 0,\n red: 1,\n green: 2,\n yellow: 3,\n blue: 4,\n magenta: 5,\n cyan: 6,\n grey: 7,\n white: 8,\n fg: 30,\n bg: 40,\n};\n\n/**\n * Returns an ANSI escape code for a color string. This can be a single color\n * name, e.g. `red`, `green`, etc., or a color prefixed with `bright` or `dark`,\n * e.g. `bright red`, `dark green`, etc. An optional section argument can be\n * set to `fg` (default) to set a foreground color or `bg` for a background color.\n * @param {String} color - color name with optional modifier prefix\n * @param {String} [base='fg'] - `fg` or `bg` to set foreground or background color respectively\n * @return {String} ANSI escape code string\n * @example\n * const str = escapeCode('red')\n * @example\n * const str = escapeCode('bright red')\n * @example\n * const str = escapeCode('bright red', 'bg')\n */\nexport const ANSIescapeCode = (color, base='fg') => {\n let codes = [ ];\n let pair = color.split(/ /, 2);\n const hue = pair.pop();\n const code = (base ? ANSIColors[base] : 0) + ANSIColors[hue];\n codes.push(code);\n if (pair.length) {\n const shade = pair.length ? pair.shift() : 'dark';\n codes.push(ANSIColors[shade])\n }\n // console.log('escapeCode(%s, %s) => ', color, base, codes.join(';'));\n return ANSIStart + codes.join(';') + ANSIEnd;\n}\n\n/**\n * Returns an ANSI escape code for a color string or combination of foreground and\n * background colors.\n * @param {String|Object} colors - either a simple color name or object contain foreground and background colors\n * @param {String} [colors.fg] - foreground color\n * @param {String} [colors.fg] - background color\n * @return {String} ANSI escape code string\n * @example\n * const str = escape('red')\n * @example\n * const str = escape('bright red')\n * @example\n * const str = escape({ fg: 'bright yellow', bg: 'blue' })\n */\nexport const ANSIescape = (colors={}) => {\n const col = isObject(colors) ? colors : { fg: colors };\n let escapes = [ ];\n if (col.bg) {\n escapes.push(ANSIescapeCode(col.bg, 'bg'));\n }\n if (col.fg) {\n escapes.push(ANSIescapeCode(col.fg, 'fg'));\n }\n return escapes.join('');\n}\n\n/**\n * Returns an ANSI escape code to reset all colors.\n * @return {String} ANSI escape reset string\n */\nexport const ANSIreset = () => ANSIescapeCode('reset', false)\n\n/**\n * Returns a function to display strings in a particular color.\n * @param {String} colors - color(s) to display string\n * @return {Function} function to display strings in the pre-defined color(s)\n */\nexport const color = (colors) =>\n text => ANSIescape(colors) + text + ANSIreset();\n\nexport const black = color('black');\nexport const red = color('red');\nexport const green = color('green');\nexport const yellow = color('yellow');\nexport const blue = color('blue');\nexport const magenta = color('magenta');\nexport const cyan = color('cyan');\nexport const grey = color('grey');\nexport const white = color('white');\nexport const brightBlack = color('bright black');\nexport const brightRed = color('bright red');\nexport const brightGreen = color('bright green');\nexport const brightYellow = color('bright yellow');\nexport const brightBlue = color('bright blue');\nexport const brightMagenta = color('bright magenta');\nexport const brightCyan = color('bright cyan');\nexport const brightGrey = color('bright grey');\nexport const brightWhite = color('bright white');\nexport const darkBlack = color('dark black');\nexport const darkRed = color('dark red');\nexport const darkGreen = color('dark green');\nexport const darkYellow = color('dark yellow');\nexport const darkBlue = color('dark blue');\nexport const darkMagenta = color('dark magenta');\nexport const darkCyan = color('dark cyan');\nexport const darkGrey = color('dark grey');\nexport const darkWhite = color('dark white');\n","import { ANSIescape, ANSIreset } from './Color.js'\nimport { doNothing } from '@abw/badger-utils';\n\n/**\n * Returns a debugging function which is enabled by the first `enabled` argument.\n * If this is `false` then it returns a function which does nothing. If it is\n * true then it returns a function that forwards all arguments to `console.log`.\n * An optional `prefix` be be specified to prefix each debugging line. The\n * optional third argument `color` can be used to specify a color for the prefix.\n * @param {Boolean} enabled - is debugging enabled?\n * @param {String} [prefix] - optional prefix for debugging messages\n * @param {String|Object} [color] - a color name or object (see {@link Badger/Utils/Color})\n * @param {String} [color.fg] - foreground color\n * @param {String} [color.bg] - background color\n * @return {Function} a debugging function\n * @example\n * const debug = Debugger(true)\n * @example\n * const debug = Debugger(true, 'Debug > ')\n * @example\n * const debug = Debugger(true, 'Debug > ', 'blue')\n * @example\n * const debug = Debugger(true, 'Debug > ', { bg: 'blue', fg: 'bright yellow' })\n */\nexport function Debugger(enabled, prefix='', color) {\n return enabled\n ? prefix\n ? (format, ...args) =>\n console.log(\n '%s' + prefix + '%s' + format,\n color ? ANSIescape(color) : '',\n ANSIreset(),\n ...args,\n )\n : console.log.bind(console)\n : doNothing;\n}\n\n/**\n * Creates a debugging function via {@link Debugger} and attaches it to the object\n * passed as the first argument as the `debug` function.\n * @param {Object} obj - the object to receive the `debug` function\n * @param {Boolean} enabled - is debugging enabled?\n * @param {String} [prefix] - optional prefix for debugging messages\n * @param {String|Object} [color] - a color name or object (see {@link Badger/Utils/Color})\n * @param {String} [color.fg] - foreground color\n * @param {String} [color.bg] - background color\n * @example\n * const debug = addDebug(myObject, true)\n * @example\n * const debug = addDebug(myObject, true, 'Debug > ')\n * @example\n * const debug = addDebug(myObject, true, 'Debug > ', 'blue')\n * @example\n * const debug = addDebug(myObject, true, 'Debug > ', { bg: 'blue', fg: 'bright yellow' })\n */\nexport function addDebug(obj, enabled, prefix='', color) {\n obj.debug = Debugger(enabled, prefix, color);\n}\n","import { addDebug } from \"./Utils/Debug.js\";\n\nexport class Component {\n constructor(workspace, props={}) {\n this.workspace = workspace;\n this.props = props;\n addDebug(this, props.debug, props.debugPrefix, props.debugColor);\n this.initComponent(props);\n }\n initComponent() {\n // stub for subclasses\n }\n}\n\nexport default Component","import { fail, hasValue, isArray, noValue } from \"@abw/badger-utils\";\n\n/**\n * Characters that can be escaped in quoted strings.\n */\nconst quotedEscapes = {\n b: \"\\b\",\n f: \"\\f\",\n n: \"\\n\",\n r: \"\\r\",\n t: \"\\t\",\n v: \"\\v\",\n '\"': '\"',\n \"'\": \"'\",\n '\\\\': '\\\\',\n}\n\n/**\n * Match a double quoted string and expand escaped characters\n * @param {String} [string] - the string to match\n */\nexport const matchDoubleQuotedString = string => {\n const regex = /^\"((?:\\\\[\\\\\"nrt]|.)*?)\"$/\n const match = string.match(regex);\n return match\n ? match[1].replace(/\\\\([\\\\\"bfnrtv])/g, (all, one) => quotedEscapes[one] || `\\\\${one}`)\n : null;\n}\n\n/**\n * Match a single quoted string and expand escaped characters\n * @param {String} [string] - the string to match\n */\nexport const matchSingleQuotedString = string => {\n const regex = /^'((?:\\\\[\\\\']|.)*?)'$/\n const match = string.match(regex);\n return match\n ? match[1].replace(/\\\\([\\\\'bfnrtv])/g, (all, one) => quotedEscapes[one] || `\\\\${one}`)\n : null;\n}\n\n/**\n * Split a data path into component parts\n * @param {String} [path] - the path to split\n */\nexport const splitDataPath = path => {\n // * match a slash: \\/\n // * match a single quoted string: '...'\n // * match a double quoted string: \"...\"\n // * match anything else: hello world!\n let parts = [ ];\n const regex = /(?:(\\/)|'((?:\\\\[\\\\']|.)*?)'|\"((?:\\\\[\\\\\"nrt]|.)*?)\"|([^/?]+))(\\??)/g;\n const matches = [...path.matchAll(regex)];\n\n matches.map(\n ([ , , single, double, other, optional]) => {\n let part;\n // console.log('match [slash:%s] [single:%s] [double:%s] [other:%s]', slash, single, double, other);\n\n if (single) {\n part = single.replace(/\\\\([\\\\'bfnrtv])/g, (all, one) => quotedEscapes[one] || `\\\\${one}`);\n }\n else if (double) {\n part = double.replace(/\\\\([\\\\\"bfnrtv])/g, (all, one) => quotedEscapes[one] || `\\\\${one}`);\n }\n else if (other) {\n part = other\n }\n if (hasValue(part)) {\n parts.push(optional ? [part, {optional:true}] : part);\n }\n }\n )\n // console.log('MATCHED ', parts);\n\n return parts;\n}\n\n/**\n * Traverse a data structure using a path.\n * @param {Object} [data] - the data to traverse\n * @param {String} [path] - the data path\n */\nexport const dataPath = (data, path) => {\n let root = data;\n let parts = splitDataPath(path);\n let done = [ ];\n // console.log('parts: ', parts);\n\n for (let part of parts) {\n const [word, opts] = isArray(part) ? part : [part, {}];\n root = root[word];\n done.push(word);\n if (noValue(root)) {\n if (opts.optional) {\n return root;\n }\n else {\n fail(\"No value for data at path: \", done.join('/'));\n }\n }\n }\n return root;\n}\n","import { DirPath } from '@abw/badger-filesystem';\nimport { addDebug } from './Utils/Debug.js';\nimport { dataPath } from '../Badger/Utils/DataPath.js';\nimport { doNothing, fail, splitList } from '@abw/badger-utils';\n\n/**\n * Default configuration options.\n */\nconst defaults = {\n codec: ['yaml', 'json'],\n jsExt: ['js', 'mjs'],\n};\n\n/**\n * The Config class implements an object which can load configuration\n * files from a configuration directory. Files can be Javascript files\n * (with `.js` or `.mjs` extensions by default) or data files using any\n * of the standard codecs (`.yaml` or `.json` by default).\n */\nexport class Config extends DirPath {\n /**\n * Constructor for Config object.\n * @param {String} dir - one or more directories that contain configuration files\n * @param {Object} [options] - configuration options\n * @param {Array|String} [options.jsExt='js mjs'] - Array or comma/whitespace delimited string of Javascript file extensions\n * @param {Array|String} [options.codec='yaml json'] - Array or comma/whitespace delimited string of codec names\n * @return {Object} the Config object\n */\n constructor(dir, options={}) {\n super(dir);\n const params = { ...defaults, ...options };\n this.state.codec = splitList(params.codec),\n this.state.jsExt = splitList(params.jsExt),\n addDebug(this, options.debug, options.debugPrefix, options.debugColor);\n }\n\n /**\n * Internal method to locate the first config file with one of a number of file extensions.\n * @param {String} uri - base part of filename\n * @param {Array} [exts] - array of possible extensions\n * @param {Function} [makeOptions] - optional function to generate options for a {@link File} object\n * @return {Object} the {@link File} object if it exists or `undefined` if not\n */\n async firstFileWithExt(uri, exts, makeOptions=doNothing) {\n const dirs = await this.dirs();\n\n for (let dir of dirs) {\n for (let ext of exts) {\n const path = uri + '.' + ext;\n const file = dir.file(path, makeOptions(uri, ext));\n this.debug('looking for config file: ', file.path());\n if (await file.exists()) {\n this.debug('config file exists: ', file.path());\n return file;\n }\n }\n }\n return undefined;\n }\n\n /**\n * Internal method to locate a Javascript configuration file with one of the `jsExt` extensions (`.js` or `.mjs` by default)\n * @param {String} uri - base part of filename\n * @return {Object} the {@link File} object if it exists or `undefined` if not\n */\n async jsFile(uri) {\n return await this.firstFileWithExt(uri, this.state.jsExt);\n }\n\n /**\n * Internal method to locate a configuration file with one of the `codec` extensions (`.yaml` or `.json` by default)\n * @param {String} uri - base part of filename\n * @return {Object} the {@link File} object if it exists or `undefined` if not\n */\n async file(uri) {\n return await this.firstFileWithExt(uri, this.state.codec, (uri, codec) => ({ codec }));\n }\n\n /**\n * Method to fetch configuration data from a file. The file can be a Javascript file which should\n * return the configuration data as the default export, or a YAML (`.yaml`) or JSON (`.json`) file.\n * If the file isn't found then the method returns the `defaults` data if provided, or throws an\n * error if not.\n * @param {String} uri - base part of filename\n * @param {Object} [defaults] - default configuration options to be used if a file isn't found\n * @return {Object} the configuration data loaded from the file\n */\n async config(uri, defaults) {\n const [base, fragment] = uri.split('#', 2);\n let jsFile, file, data;\n\n // first look for a JS file, e.g. <uri>.js, <uri>.mjs\n if ((jsFile = await this.jsFile(base))) {\n data = await import(jsFile.path());\n }\n // then for a config file with a codec extension, e.g. <uri>.yaml, <uri>.yaml\n else if ((file = await this.file(base))) {\n data = await file.read();\n }\n // failing that use any default value\n else if (defaults) {\n data = defaults;\n }\n // anything else is a big pile of fail\n else {\n return fail(\"No configuration file for \" + base);\n }\n // resolve any data path in a #fragment\n return fragment\n ? dataPath(data, fragment)\n : data;\n }\n}\n\n/**\n * Function to create a new Config object\n * @param {String} dir - directory or directories containing configuration files\n * @param {Object} [options] - configuration options\n * @param {Array|String} [options.jsExt='js mjs'] - Array or comma/whitespace delimited string of Javascript file extensions\n * @param {Array|String} [options.codec='yaml json'] - Array or comma/whitespace delimited string of codec names\n * @return {Object} the Config object\n */\nexport const config = (dir, options) => new Config(dir, options)\n\nexport default Config\n","import { DirPath } from \"@abw/badger-filesystem\";\nimport { addDebug } from \"./Utils/Debug.js\";\nimport { dataPath } from \"./Utils/DataPath.js\";\nimport { fail, splitList } from \"@abw/badger-utils\";\n\n/**\n * Default configuration options.\n */\nconst defaults = {\n jsExt: 'js mjs',\n}\n\n/**\n * The Library class implements an object which can load Javascript files\n * from one or more library directories. Files can be Javascript files\n * (with `.js` or `.mjs` extensions by default)\n */\nexport class Library extends DirPath {\n /**\n * Constructor for Library object.\n * @param {String} dir - one or more directories that contain Javascript libraries\n * @param {Object} [options] - configuration options\n * @param {Array|String} [options.jsExt='js mjs'] - Array or comma/whitespace delimited string of Javascript file extensions\n * @return {Object} the Library object\n */\n constructor(dir, options={}) {\n super(dir);\n const params = { ...defaults, ...options };\n const exts = splitList(params.jsExt).map( ext => ext.replace(/^\\./, '') ); // remove leading '.'\n this.state.exts = exts;\n addDebug(this, options.debug, options.debugPrefix, options.debugColor);\n this.debug(\"state: \", this.state)\n }\n\n /**\n * Method to load a Javascript library in one of the library directories and with one of the `jsExt` extensions (`.js` or `.mjs` by default).\n * Returns the exports from the library if found or throws an error if not.\n * @param {String} uri - base part of filename\n * @return {Object} the exports from the loaded libary\n */\n async library(uri) {\n const [base, fragment] = uri.split('#', 2);\n const dirs = await this.dirs();\n const exts = this.state.exts;\n for (let dir of dirs) {\n for (let ext of exts) {\n const file = dir.file(base + '.' + ext);\n this.debug('looking for module %s as', base, file.path());\n const exists = await file.exists();\n if (exists) {\n const load = await import(file.path());\n this.debug('loaded %s as', file.path());\n return fragment\n ? dataPath(load, fragment)\n : load;\n }\n }\n }\n fail(\"Library not found: \", uri);\n }\n}\n\n/**\n * Function to create a new Library object\n * @param {String} dir - directory or directories containing configuration files\n * @param {Object} [options] - configuration options\n * @param {Array|String} [options.jsExt='js mjs'] - Array or comma/whitespace delimited string of Javascript file extensions\n * @return {Object} the Library object\n */\nexport const library = (dir, options) => new Library(dir, options);\n\nexport default library;","import process from 'node:process'\nimport { brightGreen, brightRed } from './Color.js';\n\nexport const appStatus = app => async function(...args) {\n try {\n const message = await app(...args);\n if (message) {\n console.log(brightGreen(`✓ ${message}`));\n }\n }\n catch (error) {\n console.log(\n process.env.DEBUG\n ? error\n : brightRed(`✗ ${error.message||error}`)\n )\n }\n}\n\nexport default appStatus","import { isString } from '@abw/badger-utils';\nimport prompts from 'prompts'\n\n/**\n * Prompt user to enter a value.\n * @param {String} question - question to prompt user to answer\n * @param {Object} [options] - optional options\n * @param {String} [options.default] - default value returned if user presses RETURN\n * @return {Promise} fulfills with response to question or default value\n * @example\n * prompt(\"What is your name?\")\n * .then( name => console.log(`Hello ${name}`) );\n * @example\n * prompt(\"What is your name?\", { default: 'Mr.Badger' })\n * .then( name => console.log(`Hello ${name}`) );\n */\nexport const prompt = async (question, options={}) => {\n options = isString(options)\n ? { default: options }\n : options;\n\n const name = options.name || 'answer';\n const answers = await prompts([\n {\n name,\n type: options.type || 'text',\n message: question,\n initial: options.default,\n },\n ]);\n return answers[name];\n}\n\n/**\n * Prompt user to confirm a choice.\n * @param {String} question - question to prompt user to answer\n * @param {Object} [options] - optional options\n * @param {String} [options.default] - default value returned if user presses RETURN\n * @return {Promise} fulfills with response to question or default value\n * @example\n * confirm(\"Are you sure?\")\n * .then( yes => console.log('You said \"%s\"', yes ? 'YES' : 'NO') );\n */\nexport const confirm = async (question, options={}) =>\n prompt(question, { ...options, type: 'confirm' });\n\nexport default prompt","import process from 'node:process'\nimport { prompt } from './Prompt.js';\n\n// quick hacks - use with caution\nexport async function cmdLineArg(argPrompt, args=process.argv.slice(2)) {\n if (args.length) {\n return args.shift();\n }\n else if (argPrompt) {\n return await prompt(argPrompt);\n }\n return undefined;\n}\n\nexport async function cmdLineArgs(argPrompts, args=process.argv.slice(2)) {\n let results = [ ];\n for (let argPrompt of argPrompts) {\n const response = await cmdLineArg(argPrompt, args);\n if (! response?.length) {\n return undefined;\n }\n results.push(response);\n }\n return results;\n}","import process from 'node:process'\n\nexport function exit(value, message) {\n if (message) {\n console.log(message);\n }\n process.exit(value);\n}\n\nexport function quit(message) {\n exit(0, message);\n}\n\nexport function abort(message) {\n exit(1, message);\n}","import process from \"node:process\"\n\n/**\n * Returns an array of the `process.argv` array from offset 2 onwards,\n * i.e. removing the node path and script name.\n * @param {Array} argv - list of arguments, defaults to `process.argv`\n * @return {Array} array of arguments excluding the first two\n */\nexport function args(argv=process.argv) {\n return argv.slice(2);\n}\n","import process from 'node:process';\nimport prompter from 'prompts'\nimport { Command } from 'commander';\nimport { color } from './Color.js';\nimport { hasValue } from '@abw/badger-utils';\n\nexport const defaults = {\n verboseColor: 'magenta',\n titleColor: 'bright yellow',\n underlineColor: 'dark yellow',\n infoColor: 'cyan',\n tickColor: 'green',\n questionColor: 'bright white',\n answerColor: 'bright green',\n sectionNewlines: true\n};\n\nexport const options = async config => {\n const vcol = color(options.verboseColor || defaults.verboseColor);\n const command = new Command;\n\n // set command name, description and version\n if (config.name) {\n command.name(config.name);\n }\n if (config.description) {\n command.description(config.description);\n }\n if (config.version) {\n command.version(config.version);\n }\n\n // define the -y / -yes and -v / --verbose options\n if (config.yes) {\n command.option('-y, --yes', 'Accept default answers')\n }\n if (config.verbose) {\n command.option('-v, --verbose', 'Verbose output')\n }\n if (config.quiet) {\n command.option('-q, --quiet', 'Quiet output')\n }\n\n // add in other command line options\n config.options\n ?.filter(\n option => {\n if (hasValue(option.arg) && ! option.arg) {\n // allow arg: false to indicate no command line argument\n return false;\n }\n if (option.title) {\n // section break\n return;\n }\n return hasValue(option.name);\n }\n )\n .forEach(\n option => {\n const name = option.name;\n const about = option.about;\n const deflt = option.default;\n const handler = option.handler;\n const short = option.short;\n const type = option.type;\n const pattern = option.pattern || (hasValue(type) ? `<${type}>` : undefined);\n let string = `--${name}`;\n let args = [];\n if (hasValue(short)) {\n string = `-${short}, ${string}`;\n }\n if (hasValue(pattern)) {\n string = `${string} ${pattern}`;\n }\n args.push(string);\n if (hasValue(about)) {\n args.push(about);\n }\n if (hasValue(handler)) {\n args.push(handler);\n }\n if (hasValue(deflt)) {\n args.push(deflt);\n }\n command.option(...args)\n }\n )\n\n let commands = { };\n\n config.commands?.forEach(\n option => {\n const name = option.name;\n const about = option.about;\n const type = option.type;\n const pattern = option.pattern || (hasValue(type) ? `<${type}>` : undefined);\n let string = name;\n let cmd = command.command(string)\n if (hasValue(pattern)) {\n cmd.argument(pattern);\n // string = `${string} ${pattern}`;\n }\n if (hasValue(about)) {\n cmd.description(about);\n }\n cmd.action(\n args => {\n commands[name] = args;\n }\n )\n //console.log({ args });\n //command.command(...args)\n }\n )\n\n // parse the command line arguments\n command.parse();\n const cmdline = command.opts();\n\n // if the -y / --yes option has been specified then accept all\n // default answers automatically\n const yes = config.yes && cmdline.yes;\n const verbose = config.verbose && cmdline.verbose;\n const quiet = config.quiet && cmdline.quiet;\n\n if (yes) {\n if (verbose && ! quiet) {\n process.stdout.write(vcol('Accepting default answers (-y option is set)\\n'))\n }\n prompter.override(cmdline);\n }\n\n // build up the list of prompts for interactive questions\n let prompts = [ ];\n config.options?.forEach(\n option => {\n const type = option.type || 'text';\n const name = option.name;\n const prompt = option.prompt;\n const noArg = hasValue(option.arg) && ! option.arg;\n const validate = option.validate ||\n (option.required\n ? value => (hasValue(value) && value.toString().length)\n ? true\n : (options.invalid || `You must enter a value for ${name}`)\n : undefined\n )\n\n // special process for initial\n // - use cmdline[name]\n // - or if noArg, use option.default\n // - if a select list and not a number, find the index\n let initial = noArg ? option.default : cmdline[name];\n if (type === 'select' && hasValue(initial)) {\n if (! Number.isInteger(initial)) {\n // console.log('looking up select option for [%s]', initial);\n initial = option.choices?.findIndex( i => i.value === initial );\n if (initial < 0) {\n initial = 0;\n }\n }\n }\n\n if (hasValue(prompt)) {\n prompts.push(\n {\n ...option,\n type: (\n hasValue(initial)\n ? () => {\n yes && (quiet || answer({ question: prompt, answer: initial }));\n return type;\n }\n : type\n ),\n name,\n message: prompt,\n initial: initial,\n validate: validate,\n },\n )\n }\n else if (option.title || option.info) {\n prompts.push(\n {\n type: () => {\n quiet || section(option);\n return false;\n }\n }\n );\n }\n }\n );\n\n // prompt the user to answer/confirm questions\n const answers = await prompter(prompts);\n\n return {\n ...cmdline, ...answers, ...commands\n }\n}\n\nexport const section = option => {\n const title = option.title;\n const tcol = color(option.titleColor || defaults.titleColor);\n const ucol = color(option.underlineColor || defaults.underlineColor);\n const icol = color(option.infoColor || defaults.infoColor);\n const nl = (hasValue(option.newlines) ? option.newlines : defaults.sectionNewlines) ? \"\\n\" : \"\";\n\n if (title) {\n const uline = '-'.repeat(title.length);\n process.stdout.write(nl + tcol(title) + \"\\n\" + ucol(uline) + \"\\n\" + nl);\n }\n\n if (option.info) {\n process.stdout.write(icol(option.info) + \"\\n\" + nl);\n }\n}\n\nexport const answer = option => {\n const tcol = color(option.tickColor || defaults.tickColor);\n const qcol = color(option.questionColor || defaults.questionColor);\n const acol = color(option.answerColor || defaults.answerColor);\n process.stdout.write(tcol(\"✔ \") + qcol(option.question) + \" \" + acol(option.answer) + \"\\n\");\n}\n\nexport default options","import { joinListOr, splitList, hasValue, fail } from \"@abw/badger-utils\";\n\n/**\n * Assert that a parameter object contains an item with a defined/non-null value\n * @param {Object} params={} - parameters object\n * @param {String} name - parameter that must be included\n * @return {any} the parameter value\n * @throws {Error} if the parameter is not defined or null\n * @example\n * const foo = requiredParam({ foo: 10 }, 'foo');\n */\nexport function requiredParam(params={}, name) {\n const value = params[name];\n if (hasValue(value)) {\n return value;\n }\n else {\n fail(\"Missing value for required parameter: \", name);\n }\n}\n\n/**\n * Assert that a parameter object contains all specified item with a defined/non-null value\n * @param {Object} params={} - parameters object\n * @param {Array|String} names - parameters that must be included, as an Array or whitespace/comma delimited string (see {@link splitList})\n * @return {Array} the parameter values\n * @throws {Error} if any parameter is not defined or null\n * @example\n * const [foo, bar] = requiredParams({ foo: 10, bar: 20 }, 'foo bar');\n */\nexport function requiredParams(params={}, names) {\n return splitList(names).map( name => requiredParam(params, name) );\n}\n\n/**\n * An alias for {@link requiredParams} for people who don't like typing long names (and for symmetry with {@link anyParams}))\n */\nexport const allParams=requiredParams;\n\n/**\n * Assert that a parameter object contains any of the specified items with a defined/non-null value\n * @param {Object} params={} - parameters object\n * @param {Array|String} names - parameters of which at least one must be included, as an Array or whitespace/comma delimited string (see {@link splitList})\n * @return {Array} the parameter values\n * @throws {Error} if any parameter is not defined or null\n * @example\n * const [foo, bar] = anyParams({ foo: 10, wiz: 99 }, 'foo bar');\n */\nexport function anyParams(params, names) {\n let found = false;\n const nlist = splitList(names);\n const values = nlist.map(\n name => {\n const value = params[name];\n if (hasValue(value)) {\n found = true;\n }\n return value;\n }\n );\n return found\n ? values\n : fail(\"Missing value for one of: \", joinListOr(nlist));\n}\n","import { addDebug } from \"./Utils/Debug.js\";\nimport { Config } from \"./Config.js\";\nimport { Library } from \"./Library.js\";\nimport { dir as fsDir } from \"@abw/badger-filesystem\";\nimport { fail, hasValue, splitList } from \"@abw/badger-utils\";\n\n/**\n * Default configuration options.\n */\nconst defaults = {\n config: {\n dir: 'config',\n },\n library: {\n dir: 'lib library src components',\n },\n case: {\n // config and/or library case conversion functions\n }\n}\n\n/**\n * The Workspace class implements an object which acts as a central repository\n * for your project, providing access to directories, files, configuration files,\n * Javascript libraries and components.\n */\nexport class Workspace {\n /**\n * Constructor for Workspace object.\n * @param {String} dir - root directory for the workspace\n * @param {Object} [options] - configuration options\n * @param {Object} [options.config] - configuration options for a {@link Config} object\n * @param {Array|String} [options.config.dir] - configuration directory or directories relative to the workspace directory\n * @param {Object} [options.library] - configuration options for a {@link Config} object\n * @param {Array|String} [options.library.dir] - library directory or directories relative to the workspace directory\n * @return {Object} the Workspace object\n */\n constructor(dir, options={}) {\n const rootDir = fsDir(dir);\n const cfgDir = splitList(options.config?.dir || defaults.config.dir).map( dir => rootDir.dir(dir) );\n const cfgOpts = { ...defaults.config, ...(options.config||{}) };\n const config = new Config(cfgDir, cfgOpts);\n const libDirs = splitList(options.library?.dir || defaults.library.dir).map( dir => rootDir.dir(dir) );\n const libOpts = { ...defaults.library, ...(options.library||{}) };\n const library = new Library(libDirs, libOpts);\n\n this.case = {\n ...defaults.case,\n ...(options.case||{})\n };\n\n this.state = {\n rootDir,\n config,\n library\n }\n\n addDebug(this, options.debug, options.debugPrefix, options.debugColor);\n this.debug('root dir: ', rootDir.path());\n this.debug('config dir: ', cfgDir.map( d => d.path() ));\n this.debug('libDirs: ', libDirs);\n this.debug('libOpts: ', libOpts);\n }\n\n /**\n * Fetch a new {@link Directory} object for a sub-directory of the workspace directory.\n * @param {string} path - directory path relative to the workspace directory\n * @param {Object} [options] - directory configuration options\n * @param {String} [options.codec] - codec for encoding/decoding file data\n * @return {Object} a {@link Directory} object\n */\n dir(path, options) {\n this.debug(\"dir(%s, %o)\", path, options);\n return hasValue(path)\n ? this.state.rootDir.dir(path, options)\n : this.state.rootDir;\n }\n\n /**\n * Fetch a new {@link File} object for a file in the workspace.\n * @param {string} path - file path relative to the workspace directory\n * @param {Object} [options] - file configuration options\n * @param {String} [options.codec] - codec for encoding/decoding file data\n * @param {Boolean} [options.encoding=utf8] - character encoding for the file\n * @return {Object} a {@link File} object\n */\n file(path, options) {\n this.debug(\"file(%s, %o)\", path, options);\n return this.state.rootDir.file(path, options)\n }\n\n /**\n * Read the content of a file in the workspace.\n * @param {string} path - file path relative to the workspace directory\n * @param {Object} [options] - directory configuration options\n * @param {Boolean} [options.codec] - codec for encoding/decoding file data\n * @param {Boolean} [options.encoding=utf8] - character encoding for the file\n * @return {Promise} fulfills with the file content\n * @example\n * file('myfile.txt').read().then( text => console.log(text) );\n * @example\n * file('myfile.json', { codec: 'json' }).read().then( data => console.log(data) );\n * @example\n * file('myfile.json').read({ codec: 'json' }).then( data => console.log(data) );\n */\n read(path, options) {\n this.debug(\"read(%s, %o)\", path, options);\n return this.file(path, options).read();\n }\n\n /**\n * Writes content to a file. If a `codec` has been specified then the content will be encoded.\n * @param {string} path - file path relative to the workspace directory\n * @param {String|Object} data - directory configuration options\n * @param {Object} [options] - directory configuration options\n * @param {Boolean} [options.codec] - codec for encoding/decoding file data\n * @param {Boolean} [options.encoding=utf8] - codec for encoding/decoding file data\n * @return {Promise} fulfills with the file object\n * @example\n * file('myfile.txt').write('Hello World');\n * @example\n * file('myfile.json', { codec: 'json' }).write({ message: 'Hello World' });\n * @example\n * file('myfile.json').write({ message: 'Hello World' }, { codec: 'json' });\n */\n write(path, data, options) {\n this.debug(\"write(%s, %o, %o)\", path, data, options);\n return this.file(path, options).write(data);\n }\n\n /**\n * Fetch the configuration directory or a directory relative to it\n * @param {string} [path] - file path relative to the configuration directory\n * @param {Object} [options] - directory configuration options\n * @param {String} [options.codec] - codec for encoding/decoding data for files in the directory\n * @param {Boolean} [options.encoding=utf8] - character encoding for files in the directory\n * @return {Object} a {@link Directory} object\n */\n configDir(path, options) {\n this.debug(\"configDir(%s, %o)\", path, options);\n return hasValue(path)\n ? this.state.configDir.dir(path, options)\n : this.state.configDir;\n }\n\n /**\n * Fetches configuration data from a file in the configuration directory or returns the\n * {@link Config} object itself if no file uri is specified.\n * @param {string} [uri] - file path relative to the configuration directory\n * @param {Object} [defaults] - default configuration options if file isn't found\n * @return {Promise} fulfills to the configuration data read from the file\n * @example\n * workspace.config('myfile').then(\n * config => console.log(\"Loaded myfile config: \", config)\n * );\n */\n async config(uri, defaults) {\n this.debug(\"config(%s, %o)\", uri, defaults);\n return hasValue(uri)\n ? this.state.config.config(uri, defaults)\n : this.state.config;\n }\n\n /**\n * Loads a Javscript library from the library directory or returns the\n * {@link Library} object itself if no file uri is specified.\n * @param {string} [uri] - file path relative to the library directory\n * @return {Promise} fulfills to the configuration data read from the file\n * @example\n * workspace.library('mylib').then(\n * exports => console.log(\"Loaded mylib exports: \", exports)\n * );\n */\n async library(uri) {\n this.debug(\"library(%s, %o)\", uri);\n return hasValue(uri)\n ? this.state.library.library(uri)\n : this.state.library;\n }\n\n /**\n * Loads a Javscript library from the library directory and instantiates a\n * component.\n * @param {String} uri - component base name\n * @param {Object} [props] - optional configuration properties\n * @return {Promise} fulfills to a newly instantiated component\n * @example\n * workspace.component('mycomp').then(\n * component => console.log(\"Created component: \", component)\n * );\n */\n async component(uri, props) {\n const [base, fragment] = uri.split('#', 2);\n const cfgname = this.convertCase('config', base);\n const config = await this.config(cfgname, {});\n const libname = config.component?.library || this.convertCase('library', base);\n const lib = await this.library(libname);\n const exp = fragment || config.component?.export || 'default';\n const compcls = lib[exp] || fail(\"No '\", exp, \"' export from component library: \", uri);\n const comp = new compcls(this, { ...config, ...props });\n return comp;\n }\n\n convertCase(type, uri) {\n const fn = this.case[type];\n return fn\n ? fn(uri)\n : uri;\n }\n}\n\nexport const workspace = (dir, options) => new Workspace(dir, options);\n\nexport default Workspace;"],"names":["t","n","i","Array","isArray","a","f","s","p","h","Error","join","g","k","length","split","Intl","DateTimeFormat","resolvedOptions","locale","ANSIColors","reset","bold","bright","dark","black","red","green","yellow","blue","magenta","cyan","grey","white","fg","bg","ANSIescapeCode","color","base","codes","pair","hue","pop","code","push","shade","shift","ANSIescape","colors","col","escapes","ANSIreset","text","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightGrey","brightWhite","darkBlack","darkRed","darkGreen","darkYellow","darkBlue","darkMagenta","darkCyan","darkGrey","darkWhite","Debugger","enabled","prefix","format","args","console","log","bind","doNothing","addDebug","obj","debug","Component","constructor","workspace","props","this","debugPrefix","debugColor","initComponent","quotedEscapes","b","r","v","matchDoubleQuotedString","string","match","replace","all","one","matchSingleQuotedString","splitDataPath","path","parts","matchAll","map","single","double","other","optional","part","hasValue","dataPath","data","root","done","word","opts","noValue","fail","defaults","codec","jsExt","Config","DirPath","dir","options","super","params","state","splitList","async","uri","exts","makeOptions","dirs","ext","file","exists","firstFileWithExt","fragment","jsFile","import","read","config","Library","load","library","appStatus","app","message","error","process","env","DEBUG","prompt","question","name","isString","default","prompts","type","initial","confirm","cmdLineArg","argPrompt","argv","slice","cmdLineArgs","argPrompts","results","response","exit","value","quit","abort","verboseColor","titleColor","underlineColor","infoColor","tickColor","questionColor","answerColor","sectionNewlines","vcol","command","Command","description","version","yes","option","verbose","quiet","filter","arg","title","forEach","about","deflt","handler","short","pattern","undefined","commands","cmd","argument","action","parse","cmdline","stdout","write","prompter","override","noArg","validate","required","toString","invalid","Number","isInteger","choices","findIndex","answer","info","section","answers","tcol","ucol","icol","nl","newlines","uline","repeat","qcol","acol","requiredParam","requiredParams","names","allParams","anyParams","found","nlist","values","e","o","T","joinListOr","Workspace","rootDir","fsDir","cfgDir","cfgOpts","libDirs","libOpts","case","d","configDir","cfgname","convertCase","libname","component","lib","exp","export","fn"],"mappings":"qNAAwC,SAASA,EAAEC,GAAG,MAAM,iBAAiBA,CAAC,CAAkH,SAASC,EAAED,GAAG,OAAOE,MAAMC,QAAQH,EAAE,CAA+H,SAASI,EAAEJ,GAAG,OAAO,OAAOA,CAAC,CAAC,SAASK,EAAEL,GAAG,QAA5E,SAAWA,GAAG,YAAO,IAASA,CAAC,CAAqDM,CAAEN,IAAII,EAAEJ,GAAG,CAA4C,SAASO,EAAEP,GAAG,OAAOK,EAAEL,EAAE,CAAsL,SAASQ,KAAKR,GAAG,MAAM,IAAIS,MAAMT,EAAEU,KAAK,IAAI,CAA+D,SAASC,IAAG,CAA2lB,SAASC,EAAEZ,GAAG,OAAOO,EAAEP,GAAG,GAAGD,EAAEC,GAAGA,EAAEa,OAAOb,EAAEc,MAAM,YAAY,G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version": "1.1.1",
4
4
  "description": "Component based framework and utility modules",
5
5
  "type": "module",
6
6
  "main": "dist/badger.cjs.js",