137 lines
185 KiB
Diff
137 lines
185 KiB
Diff
|
diff --git a/node_modules/termost/.DS_Store b/node_modules/termost/.DS_Store
|
||
|
new file mode 100644
|
||
|
index 0000000..5008ddf
|
||
|
Binary files /dev/null and b/node_modules/termost/.DS_Store differ
|
||
|
diff --git a/node_modules/termost/dist/index.cjs b/node_modules/termost/dist/index.cjs
|
||
|
index b9f3a12..fb19857 100644
|
||
|
--- a/node_modules/termost/dist/index.cjs
|
||
|
+++ b/node_modules/termost/dist/index.cjs
|
||
|
@@ -1,5 +1,5 @@
|
||
|
-"use strict";var U=Object.create;var C=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var Y=(e,t)=>{for(var o in t)C(e,o,{get:t[o],enumerable:!0})},L=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of B(t))!z.call(e,n)&&n!==o&&C(e,n,{get:()=>t[n],enumerable:!(s=X(t,n))||s.enumerable});return e};var h=(e,t,o)=>(o=e!=null?U(W(e)):{},L(t||!e||!e.__esModule?C(o,"default",{value:e,enumerable:!0}):o,e)),Z=e=>L(C({},"__esModule",{value:!0}),e);var pe={};Y(pe,{helpers:()=>ue,termost:()=>Q});module.exports=Z(pe);var I=require("child_process"),v=async(e,t={hasLiveOutput:!1})=>new Promise((o,s)=>{let n="",l="",[r,...a]=e.split(" "),i=(0,I.spawn)(r,a,{cwd:t.cwd,shell:!0,stdio:t.hasLiveOutput?"inherit":"pipe",env:{...process.env,FORCE_COLOR:"1"}});i.stdout?.on("data",c=>{n+=c}),i.stderr?.on("data",c=>{l+=c}),i.on("close",c=>{if(c!==0){let u=`${l}${n}`;s(u.trim())}else o(n.trim())})});var O=h(require("picocolors")),y=(e,{color:t,modifiers:o}={color:"white",modifiers:[]})=>{let s=[];return s.push(O.default[oe[t??"white"]]),(o??[]).forEach(n=>{n==="uppercase"?e=e.toUpperCase():n==="lowercase"?e=e.toLowerCase():s.push(O.default[ne[n]])}),ee(...s)(e)},ee=(...e)=>e.reduce((t,o)=>s=>t(o(s)),e[0]),M=(e,{label:t,type:o="information"}={})=>{let{color:s,defaultLabel:n,icon:l,method:r}=te[o],a=typeof e=="string"?[e]:e;r(y(`
|
||
|
-${l} ${t??n}`,{color:s,modifiers:["bold"]}));for(let i of a)r(y(` ${i}`,{color:s}))},te={error:{color:"red",defaultLabel:"Error",icon:"\u274C",method:console.error},information:{color:"blue",defaultLabel:"Information",icon:"\u2139\uFE0F ",method:console.info},success:{color:"green",defaultLabel:"Success",icon:"\u2705",method:console.log},warning:{color:"yellow",defaultLabel:"Warning",icon:"\u26A0\uFE0F ",method:console.warn}},oe={black:"black",blue:"blue",cyan:"cyan",green:"green",grey:"gray",magenta:"magenta",red:"red",white:"white",yellow:"yellow"},ne={bold:"bold",italic:"italic",strikethrough:"strikethrough",underline:"underline"};var P=h(require("fs")),b=h(require("path")),K=e=>{let t=b.default.resolve(e,"package.json");return re(t)?require(t):K(b.default.resolve(e,".."))},re=e=>{try{return P.default.accessSync(e,P.default.constants.F_OK),!0}catch{return!1}},j=()=>{let e=require.main?.filename;if(!e)throw new Error("Termost was unable to retrieve automatically the package name and version. To fix it, use `termost({ name, description, version })` to define them manually.");return K(b.default.dirname(e))};var T=()=>{let e=process.argv.slice(2),t,o=[],s={},n,l=(a,i)=>{i?s[a]=typeof i=="string"?w(i):!0:n=a},r=()=>{n&&(s[n]=!0,n=void 0)};for(let a of e){let i=se.exec(a)?.groups,c=ae.exec(a)?.groups;if(i?.name){r();let u=i.name.split(""),p=u.length-1;u.forEach((f,m)=>{l(f,p===m?void 0:!0)})}else c?.name?(r(),l(c.name,c.value)):n?(s[n]=w(a),n=void 0):t?o.push(a):t=a}return r(),{command:t,operands:o,options:s}},se=/^-(?<name>(?!-).*)$/,ae=/^--(?<name>.*?)(?:=(?<value>.+))?$/,w=e=>{try{return JSON.parse(e)}catch{return e}};var E=()=>{let e=[];return{enqueue(t){e.push(t)},dequeue(){return e.shift()},isEmpty(){return e.length===0}}};var g=e=>{let t=$[e];if(!t)throw new Error(`No controller has been set for the \`${e}\` command.
|
||
|
-Have you run the \`termost\` constructor?`);return t},N=(e,t)=>{let o=E(),s={},n={description:t,options:{"-h, --help":"Display the help center","-v, --version":"Print the version"}},l={addOptionDescription(r,a){n.options[r]=a},addValue(r,a){s[r]=a},addInstruction(r){o.enqueue(r)},async enable(){for(;!o.isEmpty();){let r=o.dequeue();r&&await r()}},getContext(r){return e!==r&&(s={...g(r).getContext(r),...s}),s},getMetadata(r){if(e!==r){let a=g(r).getMetadata(r);n.options={...a.options,...n.options}}return n}};return S[e]=t,$[e]=l,l},R=()=>S,$={},S={};var F=({name:e,description:t},{argv:o,name:s,version:n})=>{let l=e===s,r=o.command===e,a=N(e,t),i=g(s);return setTimeout(()=>{if(l&&!r&&i.enable(),r){let c=Object.keys(o.options);if(c.includes(_[0])||c.includes(_[1])){ie({controller:a,currentCommandName:e,isRootCommand:l,rootCommandName:s});return}if(c.includes(A[0])||c.includes(A[1])){console.info(n);return}a.enable()}},0),e},_=["help","h"],A=["version","v"],ie=({rootCommandName:e,currentCommandName:t,isRootCommand:o,controller:s})=>{let n=s.getMetadata(e),{options:l,description:r}=n,a=R(),i=Object.keys(n.options),c=Object.keys(a),u=i.length>0,p=o&&c.length>1;k("Usage"),x(`${y(`${e}${o?"":` ${String(t)}`}`,{color:"green"})} ${p?"<command> ":""}${u?"[...options]":""}`),r&&(k("Description"),x(r));let f=[...c,...i].reduce((m,d)=>Math.max(m,d.length),0);if(p){k("Commands");for(let m of c){if(m===e)continue;let d=a[m];d&&D(m,d,f)}}if(u){k("Options");for(let m of i)D(m,l[m],f)}},x=(...e)=>{console.log(y(...e))},k=e=>{x(`
|
||
|
-${e}:`,{color:"yellow",modifiers:["bold","underline","uppercase"]})},D=(e,t,o)=>{x(` ${y(e.padEnd(o+1," "),{color:"green"})} ${t}`)};var G=require("enquirer"),q=e=>{let{key:t,defaultValue:o,label:s,type:n}=e;return async function(r,a){let i={initial:o,message:typeof s=="function"?s(r,a):s,name:t,type:n};if(e.type==="select"||e.type==="multiselect"){let u=e.type==="multiselect",f=e.options.map(m=>({title:m,value:m,...u&&{selected:(o||[]).includes(m)}}));i.choices=f}let c=await(0,G.prompt)(i);return{key:t,value:c[t]}}};var H=(e,{argv:t})=>o=>{let{key:s,name:n,description:l,defaultValue:r}=o,a=typeof n=="string"?[n]:[n.short,n.long],i=a.map((c,u)=>"-".repeat(a.length>1?u+1:2)+c).join(", ");return e.addOptionDescription(i,l),async function(){let u;for(let p of a)if(p in t.options){u=t.options[p];break}return Promise.resolve({key:s,value:u??r})}};var V=require("listr2"),J=e=>{let{key:t,label:o,handler:s}=e,n=o?new V.Listr([],{rendererOptions:{collapseErrors:!1,formatOutput:"wrap",showErrorMessage:!0,timer:V.PRESET_TIMER}}):null;return async function(r,a){let i;return n?(n.add({...o&&{title:typeof o=="function"?o(r,a):o},task:async()=>i=await s(r,a)}),await n.run()):i=await s(r,a),{key:t,value:i}}};function Q(e,t={}){let o=me(e)?e:{description:e},s=j(),n=o.name??s.name,{command:l=n,options:r,operands:a}=T();return le(t),ce({argv:{command:l,options:r,operands:a},description:o.description??s.description,name:n,version:o.version??s.version})}var ce=e=>{let{argv:t,name:o,description:s}=e,n=o,l=n,r=(i,c)=>{let u=i(c),p=g(l);p.addInstruction(async()=>{let{skip:f}=c,m=p.getContext(n);if(f?.(m,t))return;let d=await u(m,t);!d||!d.key||p.addValue(d.key,d.value)})},a={command(i){return l=F(i,e),this},input(i){return r(q,i),this},option(i){return r(H(g(l),e),i),this},task(i){return r(J,i),this}};return a.command({name:o,description:s}),a},le=({onShutdown:e=()=>{},onException:t=()=>{}})=>{process.on("SIGTERM",()=>{e(),process.exit(0)}),process.on("SIGINT",()=>{e(),process.exit(0)}),process.on("uncaughtException",o=>{t(o),process.exit(1)}),process.on("unhandledRejection",o=>{o instanceof Error&&t(o),process.exit(1)})},me=e=>e!==null&&typeof e=="object";var ue={exec:v,format:y,message:M};0&&(module.exports={helpers,termost});
|
||
|
+"use strict";var U=Object.create;var C=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var Y=(e,t)=>{for(var n in t)C(e,n,{get:t[n],enumerable:!0})},L=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of B(t))!z.call(e,o)&&o!==n&&C(e,o,{get:()=>t[o],enumerable:!(r=X(t,o))||r.enumerable});return e};var h=(e,t,n)=>(n=e!=null?U(W(e)):{},L(t||!e||!e.__esModule?C(n,"default",{value:e,enumerable:!0}):n,e)),Z=e=>L(C({},"__esModule",{value:!0}),e);var pe={};Y(pe,{helpers:()=>ue,termost:()=>Q});module.exports=Z(pe);var I=require("child_process"),v=async(e,t={hasLiveOutput:!1})=>new Promise((n,r)=>{let o="",c="",[s,...i]=e.split(" "),a=(0,I.spawn)(s,i,{cwd:t.cwd,env:{...process.env,FORCE_COLOR:"1"},shell:!0,stdio:t.hasLiveOutput?"inherit":"pipe"});a.stdout?.on("data",l=>{o+=l}),a.stderr?.on("data",l=>{c+=l}),a.on("close",l=>{if(l!==0){let u=`${c}${o}`;r(u.trim())}else n(o.trim())})});var O=h(require("picocolors")),y=(e,{color:t,modifiers:n}={color:"white",modifiers:[]})=>{let r=[];return r.push(O.default[ne[t??"white"]]),(n??[]).forEach(o=>{o==="uppercase"?e=e.toUpperCase():o==="lowercase"?e=e.toLowerCase():r.push(O.default[oe[o]])}),ee(...r)(e)},ee=(...e)=>e.reduce((t,n)=>r=>t(n(r)),e[0]),K=(e,{label:t,type:n="information"}={})=>{let{color:r,defaultLabel:o,icon:c,method:s}=te[n],i=typeof e=="string"?[e]:e;s(y(`
|
||
|
+${c} ${t??o}`,{color:r,modifiers:["bold"]}));for(let a of i)s(y(` ${a}`,{color:r}))},te={error:{color:"red",defaultLabel:"Error",icon:"\u274C",method:console.error},information:{color:"blue",defaultLabel:"Information",icon:"\u2139\uFE0F ",method:console.info},success:{color:"green",defaultLabel:"Success",icon:"\u2705",method:console.log},warning:{color:"yellow",defaultLabel:"Warning",icon:"\u26A0\uFE0F ",method:console.warn}},ne={black:"black",blue:"blue",cyan:"cyan",green:"green",grey:"gray",magenta:"magenta",red:"red",white:"white",yellow:"yellow"},oe={bold:"bold",italic:"italic",strikethrough:"strikethrough",underline:"underline"};var j=()=>{let e=[];return{dequeue(){return e.shift()},enqueue(t){e.push(t)},isEmpty(){return e.length===0}}};var g=e=>{let t=T[e];if(!t)throw new Error(`No controller has been set for the \`${e}\` command.
|
||
|
+Have you run the \`termost\` constructor?`);return t},M=(e,t)=>{let n=j(),r={},o={description:t,options:{"-h, --help":"Display the help center","-v, --version":"Print the version"}},c={addInstruction(s){n.enqueue(s)},addOptionDescription(s,i){o.options[s]=i},addValue(s,i){r[s]=i},async enable(){for(;!n.isEmpty();){let s=n.dequeue();s&&await s()}},getContext(s){return e!==s&&(r={...g(s).getContext(s),...r}),r},getMetadata(s){if(e!==s){let i=g(s).getMetadata(s);o.options={...i.options,...o.options}}return o}};return E[e]=t,T[e]=c,c},w=()=>E,T={},E={};var S=({name:e,description:t},{name:n,argv:r,version:o})=>{let c=e===n,s=r.command===e,i=M(e,t),a=g(n);return setTimeout(()=>{if(c&&!s&&a.enable(),s){let l=Object.keys(r.options);if(l.includes(N[0])||l.includes(N[1])){re({controller:i,currentCommandName:e,isRootCommand:c,rootCommandName:n});return}if(l.includes(R[0])||l.includes(R[1])){console.info(o);return}i.enable()}},0),e},N=["help","h"],R=["version","v"],re=({controller:e,currentCommandName:t,isRootCommand:n,rootCommandName:r})=>{let o=e.getMetadata(r),{description:c,options:s}=o,i=w(),a=Object.keys(o.options),l=Object.keys(i),u=a.length>0,p=n&&l.length>1;b("Usage"),k(`${y(`${r}${n?"":` ${String(t)}`}`,{color:"green"})} ${p?"<command> ":""}${u?"[...options]":""}`),c&&(b("Description"),k(c));let f=[...l,...a].reduce((m,d)=>Math.max(m,d.length),0);if(p){b("Commands");for(let m of l){if(m===r)continue;let d=i[m];d&&$(m,d,f)}}if(u){b("Options");for(let m of a)$(m,s[m],f)}},k=(...e)=>{console.log(y(...e))},b=e=>{k(`
|
||
|
+${e}:`,{color:"yellow",modifiers:["bold","underline","uppercase"]})},$=(e,t,n)=>{k(` ${y(e.padEnd(n+1," "),{color:"green"})} ${t}`)};var _=require("enquirer"),A=e=>{let{key:t,label:n,defaultValue:r,type:o}=e;return async function(s,i){let a={name:t,initial:r,message:typeof n=="function"?n(s,i):n,type:o};if(e.type==="select"||e.type==="multiselect"){let u=e.type==="multiselect",f=e.options.map(m=>({title:m,value:m,...u&&{selected:(r||[]).includes(m)}}));a.choices=f}let l=await(0,_.prompt)(a);return{key:t,value:l[t]}}};var D=(e,{argv:t})=>n=>{let{key:r,name:o,description:c,defaultValue:s}=n,i=typeof o=="string"?[o]:[o.short,o.long],a=i.map((l,u)=>"-".repeat(i.length>1?u+1:2)+l).join(", ");return e.addOptionDescription(a,c),async function(){let u;for(let p of i)if(p in t.options){u=t.options[p];break}return Promise.resolve({key:r,value:u??s})}};var x=require("listr2"),F=e=>{let{key:t,label:n,handler:r}=e,o=n?new x.Listr([],{rendererOptions:{collapseErrors:!1,formatOutput:"wrap",showErrorMessage:!0,timer:x.PRESET_TIMER}}):null;return async function(s,i){let a;return o?(o.add({...n&&{title:typeof n=="function"?n(s,i):n},task:async()=>a=await r(s,i)}),await o.run()):a=await r(s,i),{key:t,value:a}}};var P=h(require("fs")),V=h(require("path")),G=e=>{let t=V.default.resolve(e,"package.json");return se(t)?require(t):G(V.default.resolve(e,".."))},se=e=>{try{return P.default.accessSync(e,P.default.constants.F_OK),!0}catch{return!1}},q=()=>{let e=require.main?.filename;if(!e)throw new Error("Termost was unable to retrieve automatically the package name and version. To fix it, use `termost({ name, description, version })` to define them manually.");return G(V.default.dirname(e))};var J=()=>{let e=process.argv.slice(2),t,n=[],r={},o,c=(i,a)=>{a?r[i]=typeof a=="string"?H(a):!0:o=i},s=()=>{o&&(r[o]=!0,o=void 0)};for(let i of e){let a=ae.exec(i)?.groups,l=ie.exec(i)?.groups;if(a?.name){s();let u=a.name.split(""),p=u.length-1;u.forEach((f,m)=>{c(f,p===m?void 0:!0)})}else l?.name?(s(),c(l.name,l.value)):o?(r[o]=H(i),o=void 0):t?n.push(i):t=i}return s(),{command:t,operands:n,options:r}},ae=/^-(?<name>(?!-).*)$/,ie=/^--(?<name>.*?)(?:=(?<value>.+))?$/,H=e=>{try{return JSON.parse(e)}catch{return e}};function Q(e,t={}){let{name:n,description:r,version:o}=me(e)?e:{name:void 0,description:e,version:void 0};if(n===void 0||r===void 0||o===void 0){let a=q();n??(n=a.name),r??(r=a.description),o??(o=a.version)}let{command:c=n,operands:s,options:i}=J();return le(t),ce({name:n,description:r,argv:{command:c,operands:s,options:i},version:o})}var ce=e=>{let{name:t,description:n,argv:r}=e,o=t,c=o,s=(a,l)=>{let u=a(l),p=g(c);p.addInstruction(async()=>{let{skip:f}=l,m=p.getContext(o);if(f?.(m,r))return;let d=await u(m,r);!d||!d.key||p.addValue(d.key,d.value)})},i={command(a){return c=S(a,e),this},input(a){return s(A,a),this},option(a){return s(D(g(c),e),a),this},task(a){return s(F,a),this}};return i.command({name:t,description:n}),i},le=({onException:e=()=>{},onShutdown:t=()=>{}})=>{process.on("SIGTERM",()=>{t(),process.exit(0)}),process.on("SIGINT",()=>{t(),process.exit(0)}),process.on("uncaughtException",n=>{e(n),process.exit(1)}),process.on("unhandledRejection",n=>{n instanceof Error&&e(n),process.exit(1)})},me=e=>e!==null&&typeof e=="object";var ue={exec:v,format:y,message:K};0&&(module.exports={helpers,termost});
|
||
|
//# sourceMappingURL=index.cjs.map
|
||
|
diff --git a/node_modules/termost/dist/index.cjs.map b/node_modules/termost/dist/index.cjs.map
|
||
|
index 6ae5d95..3a2ae79 100644
|
||
|
--- a/node_modules/termost/dist/index.cjs.map
|
||
|
+++ b/node_modules/termost/dist/index.cjs.map
|
||
|
@@ -1,7 +1,7 @@
|
||
|
{
|
||
|
"version": 3,
|
||
|
- "sources": ["../src/index.ts", "../src/helpers/process/index.ts", "../src/helpers/stdout/index.ts", "../src/helpers/package/index.ts", "../src/helpers/stdin/index.ts", "../src/api/command/controller/queue.ts", "../src/api/command/controller/index.ts", "../src/api/command/command.ts", "../src/api/input/index.ts", "../src/api/option/index.ts", "../src/api/task/index.ts", "../src/termost.ts"],
|
||
|
- "sourcesContent": ["import { exec } from \"./helpers/process\";\nimport { format, message } from \"./helpers/stdout\";\n\nexport { termost } from \"./termost\";\nexport type { Termost } from \"./termost\";\nexport const helpers = {\n\texec,\n\tformat,\n\tmessage,\n};\n", "import { spawn } from \"child_process\";\n\nexport const exec = async (\n\tcommand: string,\n\toptions: ExecOptions = { hasLiveOutput: false },\n) => {\n\treturn new Promise<string>((resolve, reject) => {\n\t\tlet stdout = \"\";\n\t\tlet stderr = \"\";\n\t\tconst [bin, ...args] = command.split(\" \") as [string, ...string[]];\n\n\t\tconst childProcess = spawn(bin, args, {\n\t\t\tcwd: options.cwd,\n\t\t\tshell: true,\n\t\t\tstdio: options.hasLiveOutput ? \"inherit\" : \"pipe\",\n\t\t\tenv: {\n\t\t\t\t...process.env,\n\t\t\t\t// @note: make sure to force color display for spawned processes\n\t\t\t\tFORCE_COLOR: \"1\",\n\t\t\t},\n\t\t});\n\n\t\tchildProcess.stdout?.on(\"data\", (chunk) => {\n\t\t\tstdout += chunk;\n\t\t});\n\n\t\tchildProcess.stderr?.on(\"data\", (chunk) => {\n\t\t\tstderr += chunk;\n\t\t});\n\n\t\tchildProcess.on(\"close\", (exitCode) => {\n\t\t\tif (exitCode !== 0) {\n\t\t\t\tconst output = `${stderr}${stdout}`;\n\n\t\t\t\treject(output.trim());\n\t\t\t} else {\n\t\t\t\tresolve(stdout.trim());\n\t\t\t}\n\t\t});\n\t});\n};\n\ntype ExecOptions = {\n\tcwd?: string;\n\thasLiveOutput?: boolean;\n};\n", "import pico from \"picocolors\";\n\n/**\n * A helper to format an arbitrary text as a message input\n * @param message The text to display\n * @param options The configuration object to control the formatting properties\n * @returns The formatted text\n */\nexport const format = (\n\tmessage: string,\n\t{\n\t\tcolor,\n\t\tmodifiers,\n\t}: {\n\t\tcolor?: Color;\n\t\tmodifiers?: Modifier[];\n\t} = {\n\t\tcolor: \"white\",\n\t\tmodifiers: [],\n\t},\n) => {\n\tconst transformers: ((input: string) => string)[] = [];\n\n\ttransformers.push(pico[colorMapper[color ?? \"white\"]]);\n\n\t(modifiers ?? []).forEach((mod: Modifier) => {\n\t\tif (mod === \"uppercase\") {\n\t\t\tmessage = message.toUpperCase();\n\t\t} else if (mod === \"lowercase\") {\n\t\t\tmessage = message.toLowerCase();\n\t\t} else {\n\t\t\ttransformers.push(pico[modifierMapper[mod]]);\n\t\t}\n\t});\n\n\treturn compose(...transformers)(message);\n};\n\nconst compose = <T>(...fns: ((a: T) => T)[]) =>\n\tfns.reduce(\n\t\t(prevFn, nextFn) => (value) => prevFn(nextFn(value)),\n\t\tfns[0] as (a: T) => T,\n\t);\n\n/**\n * An opinionated helper to display arbitrary text on the console\n * @param message The text to display. Use an array if you need to display a message in several lines\n * @param options The configuration object to define the display type and/or override the default label\n */\nexport const message = (\n\tcontent: string[] | string,\n\t{\n\t\tlabel,\n\t\ttype = \"information\",\n\t}: { type?: MessageType; label?: string } = {},\n) => {\n\tconst { color, defaultLabel, icon, method } = formatPropertiesByType[type];\n\tconst messages = typeof content === \"string\" ? [content] : content;\n\n\tmethod(\n\t\tformat(`\\n${icon} ${label ?? defaultLabel}`, {\n\t\t\tcolor,\n\t\t\tmodifiers: [\"bold\"],\n\t\t}),\n\t);\n\n\tfor (const msg of messages) {\n\t\tmethod(format(` ${msg}`, { color }));\n\t}\n};\n\nconst formatPropertiesByType = {\n\terror: {\n\t\tcolor: \"red\",\n\t\tdefaultLabel: \"Error\",\n\t\ticon: \"\u274C\",\n\t\tmethod: console.error,\n\t},\n\tinformation: {\n\t\tcolor: \"blue\",\n\t\tdefaultLabel: \"Information\",\n\t\ticon: \"\u2139\uFE0F \",\n\t\tmethod: console.info,\n\t},\n\tsuccess: {\n\t\tcolor: \"green\",\n\t\tdefaultLabel: \"Success\",\n\t\ticon: \"\u2705\",\n\t\tmethod: console.log,\n\t},\n\twarning: {\n\t\tcolor: \"yellow\",\n\t\tdefaultLabel: \"Warning\",\n\t\ticon: \"\u26A0\uFE0F \",\n\t\tmethod: console.warn,\n\t},\n} as const;\n\nconst colorMapper = {\n\tblack: \"black\",\n\tblue: \"blue\",\n\tcyan: \"cyan\",\n\tgreen: \"green\",\n\tgrey: \"gray\",\n\tmagenta: \"magenta\",\n\tred: \"red\",\n\twhite: \"white\",\n\tyellow: \"yellow\",\n} as const;\n\ncon
|
||
|
- "mappings": "0jBAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,aAAAE,GAAA,YAAAC,IAAA,eAAAC,EAAAJ,ICAA,IAAAK,EAAsB,yBAETC,EAAO,MACnBC,EACAC,EAAuB,CAAE,cAAe,EAAM,IAEvC,IAAI,QAAgB,CAACC,EAASC,IAAW,CAC/C,IAAIC,EAAS,GACTC,EAAS,GACP,CAACC,EAAK,GAAGC,CAAI,EAAIP,EAAQ,MAAM,GAAG,EAElCQ,KAAe,SAAMF,EAAKC,EAAM,CACrC,IAAKN,EAAQ,IACb,MAAO,GACP,MAAOA,EAAQ,cAAgB,UAAY,OAC3C,IAAK,CACJ,GAAG,QAAQ,IAEX,YAAa,GACd,CACD,CAAC,EAEDO,EAAa,QAAQ,GAAG,OAASC,GAAU,CAC1CL,GAAUK,CACX,CAAC,EAEDD,EAAa,QAAQ,GAAG,OAASC,GAAU,CAC1CJ,GAAUI,CACX,CAAC,EAEDD,EAAa,GAAG,QAAUE,GAAa,CACtC,GAAIA,IAAa,EAAG,CACnB,IAAMC,EAAS,GAAGN,IAASD,IAE3BD,EAAOQ,EAAO,KAAK,CAAC,OAEpBT,EAAQE,EAAO,KAAK,CAAC,CAEvB,CAAC,CACF,C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,EAAQE,CAAG,EAAIC,CAChB,EACA,eAAeC,EAAa,CAC3BN,EAAa,QAAQM,CAAW,CACjC,EACA,MAAM,QAAS,CACd,KAAO,CAACN,EAAa,QAAQ,GAAG,CAC/B,IAAMO,EAAOP,EAAa,QAAQ,EAE9BO,GACH,MAAMA,EAAK,EAGd,EACA,WAAWC,EAAiB,CAG3B,OAAIb,IAASa,IAMZN,EAAU,CACT,GANsBR,EAAqBc,CAAe,EAG3C
|
||
|
- "names": ["src_exports", "__export", "helpers", "termost", "__toCommonJS", "import_child_process", "exec", "command", "options", "resolve", "reject", "stdout", "stderr", "bin", "args", "childProcess", "chunk", "exitCode", "output", "import_picocolors", "format", "message", "color", "modifiers", "transformers", "pico", "colorMapper", "mod", "modifierMapper", "compose", "fns", "prevFn", "nextFn", "value", "content", "label", "type", "defaultLabel", "icon", "method", "formatPropertiesByType", "messages", "msg", "import_fs", "import_path", "findNearestPackageJson", "pathname", "packagePathname", "path", "isFileExists", "fs", "getPackageMetadata", "mainFilename", "getArguments", "parameters", "command", "operands", "options", "currentOptionName", "addOptimisticOption", "name", "value", "castValue", "flushOptimisticOption", "parameter", "shortFlagMatchResult", "SHORT_FLAG_REGEX", "longFlagMatchResult", "LONG_FLAG_REGEX", "optionFlags", "lastIndex", "flag", "index", "createQueue", "items", "item", "getCommandController", "name", "controller", "commandControllerCollection", "createCommandController", "description", "instructions", "createQueue", "context", "metadata", "key", "value", "instruction", "task", "rootCommandName", "globalMetadata", "commandDescriptionCollection", "getCommandDescriptionCollection", "createCommand", "name", "description", "argv", "rootCommandName", "version", "isRootCommand", "isActiveCommand", "controller", "createCommandController", "rootController", "getCommandController", "optionKeys", "OPTION_HELP_NAMES", "showHelp", "OPTION_VERSION_NAMES", "currentCommandName", "commandMetadata", "options", "commands", "getCommandDescriptionCollection", "commandKeys", "hasOptions", "hasCommands", "printTitle", "print", "format", "padding", "value", "item", "commandDescription", "printLabelValue", "key", "parameters", "message", "label", "import_enquirer", "createInput", "parameters", "key", "defaultValue", "label", "type", "context", "argv", "promptObject", "isMultiSelect", "choices", "option", "data", "createOption", "commandController", "argv", "parameters", "key", "name", "description", "defaultValue", "aliases", "metadataKey", "alias", "index", "value", "import_listr2", "createTask", "parameters", "key", "label", "handler", "receiver", "context", "argv", "value", "termost", "metadata", "callbacks", "paramsMetadata", "isObject", "packageMetadata", "getPackageMetadata", "programName", "command", "options", "operands", "getArguments", "setGracefulListeners", "createProgram", "argv", "name", "description", "rootCommandName", "currentCommandName", "createInstruction", "factory", "params", "instruction", "controller", "getCommandController", "skip", "context", "output", "program", "createCommand", "createInput", "createOption", "createTask", "onShutdown", "onException", "error", "reason", "value", "helpers", "exec", "format", "message"]
|
||
|
+ "sources": ["../src/index.ts", "../src/helpers/process/index.ts", "../src/helpers/stdout/index.ts", "../src/api/command/controller/queue.ts", "../src/api/command/controller/index.ts", "../src/api/command/command.ts", "../src/api/input/index.ts", "../src/api/option/index.ts", "../src/api/task/index.ts", "../src/helpers/package/index.ts", "../src/helpers/stdin/index.ts", "../src/termost.ts"],
|
||
|
+ "sourcesContent": ["import { exec } from \"./helpers/process\";\nimport { format, message } from \"./helpers/stdout\";\n\nexport { termost } from \"./termost\";\nexport type { Termost } from \"./termost\";\nexport const helpers = {\n\texec,\n\tformat,\n\tmessage,\n};\n", "import { spawn } from \"child_process\";\n\nexport const exec = async (\n\tcommand: string,\n\toptions: ExecOptions = { hasLiveOutput: false },\n) => {\n\treturn new Promise<string>((resolve, reject) => {\n\t\tlet stdout = \"\";\n\t\tlet stderr = \"\";\n\t\tconst [bin, ...args] = command.split(\" \") as [string, ...string[]];\n\n\t\tconst childProcess = spawn(bin, args, {\n\t\t\tcwd: options.cwd,\n\t\t\tenv: {\n\t\t\t\t...process.env,\n\t\t\t\t// @note: make sure to force color display for spawned processes\n\t\t\t\tFORCE_COLOR: \"1\",\n\t\t\t},\n\t\t\tshell: true,\n\t\t\tstdio: options.hasLiveOutput ? \"inherit\" : \"pipe\",\n\t\t});\n\n\t\tchildProcess.stdout?.on(\"data\", (chunk) => {\n\t\t\tstdout += chunk;\n\t\t});\n\n\t\tchildProcess.stderr?.on(\"data\", (chunk) => {\n\t\t\tstderr += chunk;\n\t\t});\n\n\t\tchildProcess.on(\"close\", (exitCode) => {\n\t\t\tif (exitCode !== 0) {\n\t\t\t\tconst output = `${stderr}${stdout}`;\n\n\t\t\t\treject(output.trim());\n\t\t\t} else {\n\t\t\t\tresolve(stdout.trim());\n\t\t\t}\n\t\t});\n\t});\n};\n\ntype ExecOptions = {\n\tcwd?: string;\n\thasLiveOutput?: boolean;\n};\n", "import pico from \"picocolors\";\n\n/**\n * A helper to format an arbitrary text as a message input\n * @param message The text to display\n * @param options The configuration object to control the formatting properties\n * @returns The formatted text\n */\nexport const format = (\n\tmessage: string,\n\t{\n\t\tcolor,\n\t\tmodifiers,\n\t}: {\n\t\tcolor?: Color;\n\t\tmodifiers?: Modifier[];\n\t} = {\n\t\tcolor: \"white\",\n\t\tmodifiers: [],\n\t},\n) => {\n\tconst transformers: ((input: string) => string)[] = [];\n\n\ttransformers.push(pico[colorMapper[color ?? \"white\"]]);\n\n\t(modifiers ?? []).forEach((mod: Modifier) => {\n\t\tif (mod === \"uppercase\") {\n\t\t\tmessage = message.toUpperCase();\n\t\t} else if (mod === \"lowercase\") {\n\t\t\tmessage = message.toLowerCase();\n\t\t} else {\n\t\t\ttransformers.push(pico[modifierMapper[mod]]);\n\t\t}\n\t});\n\n\treturn compose(...transformers)(message);\n};\n\nconst compose = <T>(...fns: ((a: T) => T)[]) =>\n\tfns.reduce(\n\t\t(prevFn, nextFn) => (value) => prevFn(nextFn(value)),\n\t\tfns[0] as (a: T) => T,\n\t);\n\n/**\n * An opinionated helper to display arbitrary text on the console\n * @param message The text to display. Use an array if you need to display a message in several lines\n * @param options The configuration object to define the display type and/or override the default label\n */\nexport const message = (\n\tcontent: string[] | string,\n\t{\n\t\tlabel,\n\t\ttype = \"information\",\n\t}: { label?: string; type?: MessageType } = {},\n) => {\n\tconst { color, defaultLabel, icon, method } = formatPropertiesByType[type];\n\tconst messages = typeof content === \"string\" ? [content] : content;\n\n\tmethod(\n\t\tformat(`\\n${icon} ${label ?? defaultLabel}`, {\n\t\t\tcolor,\n\t\t\tmodifiers: [\"bold\"],\n\t\t}),\n\t);\n\n\tfor (const msg of messages) {\n\t\tmethod(format(` ${msg}`, { color }));\n\t}\n};\n\nconst formatPropertiesByType = {\n\terror: {\n\t\tcolor: \"red\",\n\t\tdefaultLabel: \"Error\",\n\t\ticon: \"\u274C\",\n\t\tmethod: console.error,\n\t},\n\tinformation: {\n\t\tcolor: \"blue\",\n\t\tdefaultLabel: \"Information\",\n\t\ticon: \"\u2139\uFE0F \",\n\t\tmethod: console.info,\n\t},\n\tsuccess: {\n\t\tcolor: \"green\",\n\t\tdefaultLabel: \"Success\",\n\t\ticon: \"\u2705\",\n\t\tmethod: console.log,\n\t},\n\twarning: {\n\t\tcolor: \"yellow\",\n\t\tdefaultLabel: \"Warning\",\n\t\ticon: \"\u26A0\uFE0F \",\n\t\tmethod: console.warn,\n\t},\n} as const;\n\nconst colorMapper = {\n\tblack: \"black\",\n\tblue: \"blue\",\n\tcyan: \"cyan\",\n\tgreen: \"green\",\n\tgrey: \"gray\",\n\tmagenta: \"magenta\",\n\tred: \"red\",\n\twhite: \"white\",\n\tyellow: \"yellow\",\n} as const;\n\ncon
|
||
|
+ "mappings": "0jBAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,aAAAE,GAAA,YAAAC,IAAA,eAAAC,EAAAJ,ICAA,IAAAK,EAAsB,yBAETC,EAAO,MACnBC,EACAC,EAAuB,CAAE,cAAe,EAAM,IAEvC,IAAI,QAAgB,CAACC,EAASC,IAAW,CAC/C,IAAIC,EAAS,GACTC,EAAS,GACP,CAACC,EAAK,GAAGC,CAAI,EAAIP,EAAQ,MAAM,GAAG,EAElCQ,KAAe,SAAMF,EAAKC,EAAM,CACrC,IAAKN,EAAQ,IACb,IAAK,CACJ,GAAG,QAAQ,I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,EAED,OAGD,GACCS,EAAW,SAASG,EAAqB,CAAC,CAAC,GAC3CH,EAAW,SAASG,EAAqB,CAAC,CAAC,EAC1C,CACD,QAAQ,KAAKV,CAAO,EAEpB,OAGIG,EAAW,OAAO,EAEzB,EAAG,CAAC,EAEGP,CACR,EAEMY,EAAoB,CAAC,OAAQ,GAAG,EAChCE,EAAuB,CAAC,UAAW,GAAG,EAEtCD,GAAW,CAAC,CACjB,WAAAN,EACA,mBAAAQ,EACA,cAAAV,EACA,gBAAAH,CACD,IAMM,CACL,IAAMc,EAAkBT,EAAW,YAAYL,CAAe,EACxD,CAAE,YAAAD,EAAa,QAAAgB,CAAQ,EAAID,EAC3BE,EAAWC,EAAgC,EAC3CR,EAAa,OAAO,KAAKK,EAAgB,OAAO,EAChDI,EAAc,OAAO,KAAKF,CAAQ,EAClCG,EAAaV,EAAW,OAAS,EACjCW,EAAcjB,GAAiBe,EAAY,OAAS,EAE1DG,EAAW,OAAO,EAClBC,EACC,GAAGC,EACF,GAAGvB,IACFG,EAAgB,GAAK,IAA
|
||
|
+ "names": ["src_exports", "__export", "helpers", "termost", "__toCommonJS", "import_child_process", "exec", "command", "options", "resolve", "reject", "stdout", "stderr", "bin", "args", "childProcess", "chunk", "exitCode", "output", "import_picocolors", "format", "message", "color", "modifiers", "transformers", "pico", "colorMapper", "mod", "modifierMapper", "compose", "fns", "prevFn", "nextFn", "value", "content", "label", "type", "defaultLabel", "icon", "method", "formatPropertiesByType", "messages", "msg", "createQueue", "items", "item", "getCommandController", "name", "controller", "commandControllerCollection", "createCommandController", "description", "instructions", "createQueue", "context", "metadata", "instruction", "key", "value", "task", "rootCommandName", "globalMetadata", "commandDescriptionCollection", "getCommandDescriptionCollection", "createCommand", "name", "description", "rootCommandName", "argv", "version", "isRootCommand", "isActiveCommand", "controller", "createCommandController", "rootController", "getCommandController", "optionKeys", "OPTION_HELP_NAMES", "showHelp", "OPTION_VERSION_NAMES", "currentCommandName", "commandMetadata", "options", "commands", "getCommandDescriptionCollection", "commandKeys", "hasOptions", "hasCommands", "printTitle", "print", "format", "padding", "value", "item", "commandDescription", "printLabelValue", "key", "parameters", "message", "label", "import_enquirer", "createInput", "parameters", "key", "label", "defaultValue", "type", "context", "argv", "promptObject", "isMultiSelect", "choices", "option", "data", "createOption", "commandController", "argv", "parameters", "key", "name", "description", "defaultValue", "aliases", "metadataKey", "alias", "index", "value", "import_listr2", "createTask", "parameters", "key", "label", "handler", "receiver", "context", "argv", "value", "import_fs", "import_path", "findNearestPackageJson", "pathname", "packagePathname", "path", "isFileExists", "fs", "getPackageMetadata", "mainFilename", "getArguments", "parameters", "command", "operands", "options", "currentOptionName", "addOptimisticOption", "name", "value", "castValue", "flushOptimisticOption", "parameter", "shortFlagMatchResult", "SHORT_FLAG_REGEX", "longFlagMatchResult", "LONG_FLAG_REGEX", "optionFlags", "lastIndex", "flag", "index", "termost", "metadata", "callbacks", "name", "description", "version", "isObject", "packageMetadata", "getPackageMetadata", "command", "operands", "options", "getArguments", "setGracefulListeners", "createProgram", "argv", "rootCommandName", "currentCommandName", "createInstruction", "factory", "params", "instruction", "controller", "getCommandController", "skip", "context", "output", "program", "createCommand", "createInput", "createOption", "createTask", "onException", "onShutdown", "error", "reason", "value", "helpers", "exec", "format", "message"]
|
||
|
}
|
||
|
diff --git a/node_modules/termost/dist/index.d.ts b/node_modules/termost/dist/index.d.ts
|
||
|
index 4fc7d15..c8befdd 100644
|
||
|
--- a/node_modules/termost/dist/index.d.ts
|
||
|
+++ b/node_modules/termost/dist/index.d.ts
|
||
|
@@ -6,13 +6,13 @@ export type EmptyObject = {};
|
||
|
*/
|
||
|
export type ArgumentValues = {
|
||
|
command: CommandName;
|
||
|
- options: Record<string, boolean | number | string>;
|
||
|
operands: string[];
|
||
|
+ options: Record<string, boolean | number | string>;
|
||
|
};
|
||
|
export type PackageMetadata = {
|
||
|
name: string;
|
||
|
- version: string;
|
||
|
description: string;
|
||
|
+ version: string;
|
||
|
};
|
||
|
export type Context<Values extends ObjectLikeConstraint> = Values;
|
||
|
export type InstructionParameters<Values extends ObjectLikeConstraint, ExtraParameters extends ObjectLikeConstraint = EmptyObject> = ExtraParameters & {
|
||
|
@@ -31,23 +31,23 @@ export type CommandParameters = {
|
||
|
description: string;
|
||
|
};
|
||
|
export type InputParameters<Values extends ObjectLikeConstraint, Key extends keyof Values> = InstructionParameters<Values, InstructionKey<Key> & ({
|
||
|
- type: "confirm";
|
||
|
label: Label<Values>;
|
||
|
defaultValue?: Values[Key] extends boolean ? Values[Key] : never;
|
||
|
+ type: "confirm";
|
||
|
} | {
|
||
|
- type: "multiselect";
|
||
|
label: Label<Values>;
|
||
|
- options: Values[Key] extends string[] ? Values[Key] : never;
|
||
|
- defaultValue?: Values[Key] extends string[] ? Values[Key] : never;
|
||
|
-} | {
|
||
|
+ defaultValue?: Values[Key] extends string ? Values[Key] : never;
|
||
|
+ options: Values[Key] extends string ? Values[Key][] : never;
|
||
|
type: "select";
|
||
|
+} | {
|
||
|
label: Label<Values>;
|
||
|
- options: Values[Key] extends string ? Values[Key][] : never;
|
||
|
defaultValue?: Values[Key] extends string ? Values[Key] : never;
|
||
|
-} | {
|
||
|
type: "text";
|
||
|
+} | {
|
||
|
label: Label<Values>;
|
||
|
- defaultValue?: Values[Key] extends string ? Values[Key] : never;
|
||
|
+ defaultValue?: Values[Key] extends string[] ? Values[Key] : never;
|
||
|
+ options: Values[Key] extends string[] ? Values[Key] : never;
|
||
|
+ type: "multiselect";
|
||
|
})>;
|
||
|
export type OptionParameters<Values extends ObjectLikeConstraint, Key extends keyof Values> = InstructionParameters<Values, InstructionKey<Key> & {
|
||
|
name: string | {
|
||
|
@@ -78,8 +78,8 @@ export type Termost<Values extends ObjectLikeConstraint = EmptyObject> = {
|
||
|
};
|
||
|
export declare function termost<Values extends ObjectLikeConstraint = EmptyObject>(metadata: Partial<PackageMetadata> | string, callbacks?: TerminationCallbacks): Termost<Values>;
|
||
|
export type TerminationCallbacks = Partial<{
|
||
|
- onShutdown: () => void;
|
||
|
onException: (error: Error) => void;
|
||
|
+ onShutdown: () => void;
|
||
|
}>;
|
||
|
export declare const helpers: {
|
||
|
exec: (command: string, options?: {
|
||
|
@@ -91,8 +91,8 @@ export declare const helpers: {
|
||
|
modifiers?: ("bold" | "italic" | "lowercase" | "strikethrough" | "underline" | "uppercase")[];
|
||
|
}) => string;
|
||
|
message: (content: string | string[], { label, type, }?: {
|
||
|
- type?: "error" | "information" | "success" | "warning";
|
||
|
label?: string;
|
||
|
+ type?: "error" | "information" | "success" | "warning";
|
||
|
}) => void;
|
||
|
};
|
||
|
|
||
|
diff --git a/node_modules/termost/dist/index.mjs b/node_modules/termost/dist/index.mjs
|
||
|
index ae1fb10..28fbfac 100644
|
||
|
--- a/node_modules/termost/dist/index.mjs
|
||
|
+++ b/node_modules/termost/dist/index.mjs
|
||
|
@@ -1,5 +1,5 @@
|
||
|
-var k=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,o)=>(typeof require<"u"?require:t)[o]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});import{spawn as F}from"child_process";var V=async(e,t={hasLiveOutput:!1})=>new Promise((o,s)=>{let r="",l="",[n,...a]=e.split(" "),i=F(n,a,{cwd:t.cwd,shell:!0,stdio:t.hasLiveOutput?"inherit":"pipe",env:{...process.env,FORCE_COLOR:"1"}});i.stdout?.on("data",c=>{r+=c}),i.stderr?.on("data",c=>{l+=c}),i.on("close",c=>{if(c!==0){let u=`${l}${r}`;s(u.trim())}else o(r.trim())})});import h from"picocolors";var y=(e,{color:t,modifiers:o}={color:"white",modifiers:[]})=>{let s=[];return s.push(h[H[t??"white"]]),(o??[]).forEach(r=>{r==="uppercase"?e=e.toUpperCase():r==="lowercase"?e=e.toLowerCase():s.push(h[J[r]])}),G(...s)(e)},G=(...e)=>e.reduce((t,o)=>s=>t(o(s)),e[0]),O=(e,{label:t,type:o="information"}={})=>{let{color:s,defaultLabel:r,icon:l,method:n}=q[o],a=typeof e=="string"?[e]:e;n(y(`
|
||
|
-${l} ${t??r}`,{color:s,modifiers:["bold"]}));for(let i of a)n(y(` ${i}`,{color:s}))},q={error:{color:"red",defaultLabel:"Error",icon:"\u274C",method:console.error},information:{color:"blue",defaultLabel:"Information",icon:"\u2139\uFE0F ",method:console.info},success:{color:"green",defaultLabel:"Success",icon:"\u2705",method:console.log},warning:{color:"yellow",defaultLabel:"Warning",icon:"\u26A0\uFE0F ",method:console.warn}},H={black:"black",blue:"blue",cyan:"cyan",green:"green",grey:"gray",magenta:"magenta",red:"red",white:"white",yellow:"yellow"},J={bold:"bold",italic:"italic",strikethrough:"strikethrough",underline:"underline"};import P from"fs";import x from"path";var L=e=>{let t=x.resolve(e,"package.json");return Q(t)?k(t):L(x.resolve(e,".."))},Q=e=>{try{return P.accessSync(e,P.constants.F_OK),!0}catch{return!1}},I=()=>{let e=k.main?.filename;if(!e)throw new Error("Termost was unable to retrieve automatically the package name and version. To fix it, use `termost({ name, description, version })` to define them manually.");return L(x.dirname(e))};var M=()=>{let e=process.argv.slice(2),t,o=[],s={},r,l=(a,i)=>{i?s[a]=typeof i=="string"?v(i):!0:r=a},n=()=>{r&&(s[r]=!0,r=void 0)};for(let a of e){let i=U.exec(a)?.groups,c=X.exec(a)?.groups;if(i?.name){n();let u=i.name.split(""),p=u.length-1;u.forEach((f,m)=>{l(f,p===m?void 0:!0)})}else c?.name?(n(),l(c.name,c.value)):r?(s[r]=v(a),r=void 0):t?o.push(a):t=a}return n(),{command:t,operands:o,options:s}},U=/^-(?<name>(?!-).*)$/,X=/^--(?<name>.*?)(?:=(?<value>.+))?$/,v=e=>{try{return JSON.parse(e)}catch{return e}};var K=()=>{let e=[];return{enqueue(t){e.push(t)},dequeue(){return e.shift()},isEmpty(){return e.length===0}}};var g=e=>{let t=T[e];if(!t)throw new Error(`No controller has been set for the \`${e}\` command.
|
||
|
-Have you run the \`termost\` constructor?`);return t},j=(e,t)=>{let o=K(),s={},r={description:t,options:{"-h, --help":"Display the help center","-v, --version":"Print the version"}},l={addOptionDescription(n,a){r.options[n]=a},addValue(n,a){s[n]=a},addInstruction(n){o.enqueue(n)},async enable(){for(;!o.isEmpty();){let n=o.dequeue();n&&await n()}},getContext(n){return e!==n&&(s={...g(n).getContext(n),...s}),s},getMetadata(n){if(e!==n){let a=g(n).getMetadata(n);r.options={...a.options,...r.options}}return r}};return E[e]=t,T[e]=l,l},w=()=>E,T={},E={};var S=({name:e,description:t},{argv:o,name:s,version:r})=>{let l=e===s,n=o.command===e,a=j(e,t),i=g(s);return setTimeout(()=>{if(l&&!n&&i.enable(),n){let c=Object.keys(o.options);if(c.includes(N[0])||c.includes(N[1])){B({controller:a,currentCommandName:e,isRootCommand:l,rootCommandName:s});return}if(c.includes(R[0])||c.includes(R[1])){console.info(r);return}a.enable()}},0),e},N=["help","h"],R=["version","v"],B=({rootCommandName:e,currentCommandName:t,isRootCommand:o,controller:s})=>{let r=s.getMetadata(e),{options:l,description:n}=r,a=w(),i=Object.keys(r.options),c=Object.keys(a),u=i.length>0,p=o&&c.length>1;C("Usage"),b(`${y(`${e}${o?"":` ${String(t)}`}`,{color:"green"})} ${p?"<command> ":""}${u?"[...options]":""}`),n&&(C("Description"),b(n));let f=[...c,...i].reduce((m,d)=>Math.max(m,d.length),0);if(p){C("Commands");for(let m of c){if(m===e)continue;let d=a[m];d&&$(m,d,f)}}if(u){C("Options");for(let m of i)$(m,l[m],f)}},b=(...e)=>{console.log(y(...e))},C=e=>{b(`
|
||
|
-${e}:`,{color:"yellow",modifiers:["bold","underline","uppercase"]})},$=(e,t,o)=>{b(` ${y(e.padEnd(o+1," "),{color:"green"})} ${t}`)};import{prompt as W}from"enquirer";var _=e=>{let{key:t,defaultValue:o,label:s,type:r}=e;return async function(n,a){let i={initial:o,message:typeof s=="function"?s(n,a):s,name:t,type:r};if(e.type==="select"||e.type==="multiselect"){let u=e.type==="multiselect",f=e.options.map(m=>({title:m,value:m,...u&&{selected:(o||[]).includes(m)}}));i.choices=f}let c=await W(i);return{key:t,value:c[t]}}};var A=(e,{argv:t})=>o=>{let{key:s,name:r,description:l,defaultValue:n}=o,a=typeof r=="string"?[r]:[r.short,r.long],i=a.map((c,u)=>"-".repeat(a.length>1?u+1:2)+c).join(", ");return e.addOptionDescription(i,l),async function(){let u;for(let p of a)if(p in t.options){u=t.options[p];break}return Promise.resolve({key:s,value:u??n})}};import{Listr as z,PRESET_TIMER as Y}from"listr2";var D=e=>{let{key:t,label:o,handler:s}=e,r=o?new z([],{rendererOptions:{collapseErrors:!1,formatOutput:"wrap",showErrorMessage:!0,timer:Y}}):null;return async function(n,a){let i;return r?(r.add({...o&&{title:typeof o=="function"?o(n,a):o},task:async()=>i=await s(n,a)}),await r.run()):i=await s(n,a),{key:t,value:i}}};function Z(e,t={}){let o=oe(e)?e:{description:e},s=I(),r=o.name??s.name,{command:l=r,options:n,operands:a}=M();return te(t),ee({argv:{command:l,options:n,operands:a},description:o.description??s.description,name:r,version:o.version??s.version})}var ee=e=>{let{argv:t,name:o,description:s}=e,r=o,l=r,n=(i,c)=>{let u=i(c),p=g(l);p.addInstruction(async()=>{let{skip:f}=c,m=p.getContext(r);if(f?.(m,t))return;let d=await u(m,t);!d||!d.key||p.addValue(d.key,d.value)})},a={command(i){return l=S(i,e),this},input(i){return n(_,i),this},option(i){return n(A(g(l),e),i),this},task(i){return n(D,i),this}};return a.command({name:o,description:s}),a},te=({onShutdown:e=()=>{},onException:t=()=>{}})=>{process.on("SIGTERM",()=>{e(),process.exit(0)}),process.on("SIGINT",()=>{e(),process.exit(0)}),process.on("uncaughtException",o=>{t(o),process.exit(1)}),process.on("unhandledRejection",o=>{o instanceof Error&&t(o),process.exit(1)})},oe=e=>e!==null&&typeof e=="object";var Ee={exec:V,format:y,message:O};export{Ee as helpers,Z as termost};
|
||
|
+var k=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(n,t)=>(typeof require<"u"?require:n)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});import{spawn as F}from"child_process";var V=async(e,n={hasLiveOutput:!1})=>new Promise((t,s)=>{let o="",c="",[r,...i]=e.split(" "),a=F(r,i,{cwd:n.cwd,env:{...process.env,FORCE_COLOR:"1"},shell:!0,stdio:n.hasLiveOutput?"inherit":"pipe"});a.stdout?.on("data",l=>{o+=l}),a.stderr?.on("data",l=>{c+=l}),a.on("close",l=>{if(l!==0){let u=`${c}${o}`;s(u.trim())}else t(o.trim())})});import h from"picocolors";var y=(e,{color:n,modifiers:t}={color:"white",modifiers:[]})=>{let s=[];return s.push(h[H[n??"white"]]),(t??[]).forEach(o=>{o==="uppercase"?e=e.toUpperCase():o==="lowercase"?e=e.toLowerCase():s.push(h[J[o]])}),G(...s)(e)},G=(...e)=>e.reduce((n,t)=>s=>n(t(s)),e[0]),O=(e,{label:n,type:t="information"}={})=>{let{color:s,defaultLabel:o,icon:c,method:r}=q[t],i=typeof e=="string"?[e]:e;r(y(`
|
||
|
+${c} ${n??o}`,{color:s,modifiers:["bold"]}));for(let a of i)r(y(` ${a}`,{color:s}))},q={error:{color:"red",defaultLabel:"Error",icon:"\u274C",method:console.error},information:{color:"blue",defaultLabel:"Information",icon:"\u2139\uFE0F ",method:console.info},success:{color:"green",defaultLabel:"Success",icon:"\u2705",method:console.log},warning:{color:"yellow",defaultLabel:"Warning",icon:"\u26A0\uFE0F ",method:console.warn}},H={black:"black",blue:"blue",cyan:"cyan",green:"green",grey:"gray",magenta:"magenta",red:"red",white:"white",yellow:"yellow"},J={bold:"bold",italic:"italic",strikethrough:"strikethrough",underline:"underline"};var P=()=>{let e=[];return{dequeue(){return e.shift()},enqueue(n){e.push(n)},isEmpty(){return e.length===0}}};var g=e=>{let n=v[e];if(!n)throw new Error(`No controller has been set for the \`${e}\` command.
|
||
|
+Have you run the \`termost\` constructor?`);return n},L=(e,n)=>{let t=P(),s={},o={description:n,options:{"-h, --help":"Display the help center","-v, --version":"Print the version"}},c={addInstruction(r){t.enqueue(r)},addOptionDescription(r,i){o.options[r]=i},addValue(r,i){s[r]=i},async enable(){for(;!t.isEmpty();){let r=t.dequeue();r&&await r()}},getContext(r){return e!==r&&(s={...g(r).getContext(r),...s}),s},getMetadata(r){if(e!==r){let i=g(r).getMetadata(r);o.options={...i.options,...o.options}}return o}};return K[e]=n,v[e]=c,c},I=()=>K,v={},K={};var T=({name:e,description:n},{name:t,argv:s,version:o})=>{let c=e===t,r=s.command===e,i=L(e,n),a=g(t);return setTimeout(()=>{if(c&&!r&&a.enable(),r){let l=Object.keys(s.options);if(l.includes(j[0])||l.includes(j[1])){Q({controller:i,currentCommandName:e,isRootCommand:c,rootCommandName:t});return}if(l.includes(M[0])||l.includes(M[1])){console.info(o);return}i.enable()}},0),e},j=["help","h"],M=["version","v"],Q=({controller:e,currentCommandName:n,isRootCommand:t,rootCommandName:s})=>{let o=e.getMetadata(s),{description:c,options:r}=o,i=I(),a=Object.keys(o.options),l=Object.keys(i),u=a.length>0,p=t&&l.length>1;C("Usage"),b(`${y(`${s}${t?"":` ${String(n)}`}`,{color:"green"})} ${p?"<command> ":""}${u?"[...options]":""}`),c&&(C("Description"),b(c));let f=[...l,...a].reduce((m,d)=>Math.max(m,d.length),0);if(p){C("Commands");for(let m of l){if(m===s)continue;let d=i[m];d&&w(m,d,f)}}if(u){C("Options");for(let m of a)w(m,r[m],f)}},b=(...e)=>{console.log(y(...e))},C=e=>{b(`
|
||
|
+${e}:`,{color:"yellow",modifiers:["bold","underline","uppercase"]})},w=(e,n,t)=>{b(` ${y(e.padEnd(t+1," "),{color:"green"})} ${n}`)};import{prompt as U}from"enquirer";var E=e=>{let{key:n,label:t,defaultValue:s,type:o}=e;return async function(r,i){let a={name:n,initial:s,message:typeof t=="function"?t(r,i):t,type:o};if(e.type==="select"||e.type==="multiselect"){let u=e.type==="multiselect",f=e.options.map(m=>({title:m,value:m,...u&&{selected:(s||[]).includes(m)}}));a.choices=f}let l=await U(a);return{key:n,value:l[n]}}};var N=(e,{argv:n})=>t=>{let{key:s,name:o,description:c,defaultValue:r}=t,i=typeof o=="string"?[o]:[o.short,o.long],a=i.map((l,u)=>"-".repeat(i.length>1?u+1:2)+l).join(", ");return e.addOptionDescription(a,c),async function(){let u;for(let p of i)if(p in n.options){u=n.options[p];break}return Promise.resolve({key:s,value:u??r})}};import{Listr as X,PRESET_TIMER as B}from"listr2";var R=e=>{let{key:n,label:t,handler:s}=e,o=t?new X([],{rendererOptions:{collapseErrors:!1,formatOutput:"wrap",showErrorMessage:!0,timer:B}}):null;return async function(r,i){let a;return o?(o.add({...t&&{title:typeof t=="function"?t(r,i):t},task:async()=>a=await s(r,i)}),await o.run()):a=await s(r,i),{key:n,value:a}}};import $ from"fs";import x from"path";var S=e=>{let n=x.resolve(e,"package.json");return W(n)?k(n):S(x.resolve(e,".."))},W=e=>{try{return $.accessSync(e,$.constants.F_OK),!0}catch{return!1}},_=()=>{let e=k.main?.filename;if(!e)throw new Error("Termost was unable to retrieve automatically the package name and version. To fix it, use `termost({ name, description, version })` to define them manually.");return S(x.dirname(e))};var D=()=>{let e=process.argv.slice(2),n,t=[],s={},o,c=(i,a)=>{a?s[i]=typeof a=="string"?A(a):!0:o=i},r=()=>{o&&(s[o]=!0,o=void 0)};for(let i of e){let a=z.exec(i)?.groups,l=Y.exec(i)?.groups;if(a?.name){r();let u=a.name.split(""),p=u.length-1;u.forEach((f,m)=>{c(f,p===m?void 0:!0)})}else l?.name?(r(),c(l.name,l.value)):o?(s[o]=A(i),o=void 0):n?t.push(i):n=i}return r(),{command:n,operands:t,options:s}},z=/^-(?<name>(?!-).*)$/,Y=/^--(?<name>.*?)(?:=(?<value>.+))?$/,A=e=>{try{return JSON.parse(e)}catch{return e}};function Z(e,n={}){let{name:t,description:s,version:o}=ne(e)?e:{name:void 0,description:e,version:void 0};if(t===void 0||s===void 0||o===void 0){let a=_();t??(t=a.name),s??(s=a.description),o??(o=a.version)}let{command:c=t,operands:r,options:i}=D();return te(n),ee({name:t,description:s,argv:{command:c,operands:r,options:i},version:o})}var ee=e=>{let{name:n,description:t,argv:s}=e,o=n,c=o,r=(a,l)=>{let u=a(l),p=g(c);p.addInstruction(async()=>{let{skip:f}=l,m=p.getContext(o);if(f?.(m,s))return;let d=await u(m,s);!d||!d.key||p.addValue(d.key,d.value)})},i={command(a){return c=T(a,e),this},input(a){return r(E,a),this},option(a){return r(N(g(c),e),a),this},task(a){return r(R,a),this}};return i.command({name:n,description:t}),i},te=({onException:e=()=>{},onShutdown:n=()=>{}})=>{process.on("SIGTERM",()=>{n(),process.exit(0)}),process.on("SIGINT",()=>{n(),process.exit(0)}),process.on("uncaughtException",t=>{e(t),process.exit(1)}),process.on("unhandledRejection",t=>{t instanceof Error&&e(t),process.exit(1)})},ne=e=>e!==null&&typeof e=="object";var Ee={exec:V,format:y,message:O};export{Ee as helpers,Z as termost};
|
||
|
//# sourceMappingURL=index.mjs.map
|
||
|
diff --git a/node_modules/termost/dist/index.mjs.map b/node_modules/termost/dist/index.mjs.map
|
||
|
index bfe0ab9..9901423 100644
|
||
|
--- a/node_modules/termost/dist/index.mjs.map
|
||
|
+++ b/node_modules/termost/dist/index.mjs.map
|
||
|
@@ -1,7 +1,7 @@
|
||
|
{
|
||
|
"version": 3,
|
||
|
- "sources": ["../src/helpers/process/index.ts", "../src/helpers/stdout/index.ts", "../src/helpers/package/index.ts", "../src/helpers/stdin/index.ts", "../src/api/command/controller/queue.ts", "../src/api/command/controller/index.ts", "../src/api/command/command.ts", "../src/api/input/index.ts", "../src/api/option/index.ts", "../src/api/task/index.ts", "../src/termost.ts", "../src/index.ts"],
|
||
|
- "sourcesContent": ["import { spawn } from \"child_process\";\n\nexport const exec = async (\n\tcommand: string,\n\toptions: ExecOptions = { hasLiveOutput: false },\n) => {\n\treturn new Promise<string>((resolve, reject) => {\n\t\tlet stdout = \"\";\n\t\tlet stderr = \"\";\n\t\tconst [bin, ...args] = command.split(\" \") as [string, ...string[]];\n\n\t\tconst childProcess = spawn(bin, args, {\n\t\t\tcwd: options.cwd,\n\t\t\tshell: true,\n\t\t\tstdio: options.hasLiveOutput ? \"inherit\" : \"pipe\",\n\t\t\tenv: {\n\t\t\t\t...process.env,\n\t\t\t\t// @note: make sure to force color display for spawned processes\n\t\t\t\tFORCE_COLOR: \"1\",\n\t\t\t},\n\t\t});\n\n\t\tchildProcess.stdout?.on(\"data\", (chunk) => {\n\t\t\tstdout += chunk;\n\t\t});\n\n\t\tchildProcess.stderr?.on(\"data\", (chunk) => {\n\t\t\tstderr += chunk;\n\t\t});\n\n\t\tchildProcess.on(\"close\", (exitCode) => {\n\t\t\tif (exitCode !== 0) {\n\t\t\t\tconst output = `${stderr}${stdout}`;\n\n\t\t\t\treject(output.trim());\n\t\t\t} else {\n\t\t\t\tresolve(stdout.trim());\n\t\t\t}\n\t\t});\n\t});\n};\n\ntype ExecOptions = {\n\tcwd?: string;\n\thasLiveOutput?: boolean;\n};\n", "import pico from \"picocolors\";\n\n/**\n * A helper to format an arbitrary text as a message input\n * @param message The text to display\n * @param options The configuration object to control the formatting properties\n * @returns The formatted text\n */\nexport const format = (\n\tmessage: string,\n\t{\n\t\tcolor,\n\t\tmodifiers,\n\t}: {\n\t\tcolor?: Color;\n\t\tmodifiers?: Modifier[];\n\t} = {\n\t\tcolor: \"white\",\n\t\tmodifiers: [],\n\t},\n) => {\n\tconst transformers: ((input: string) => string)[] = [];\n\n\ttransformers.push(pico[colorMapper[color ?? \"white\"]]);\n\n\t(modifiers ?? []).forEach((mod: Modifier) => {\n\t\tif (mod === \"uppercase\") {\n\t\t\tmessage = message.toUpperCase();\n\t\t} else if (mod === \"lowercase\") {\n\t\t\tmessage = message.toLowerCase();\n\t\t} else {\n\t\t\ttransformers.push(pico[modifierMapper[mod]]);\n\t\t}\n\t});\n\n\treturn compose(...transformers)(message);\n};\n\nconst compose = <T>(...fns: ((a: T) => T)[]) =>\n\tfns.reduce(\n\t\t(prevFn, nextFn) => (value) => prevFn(nextFn(value)),\n\t\tfns[0] as (a: T) => T,\n\t);\n\n/**\n * An opinionated helper to display arbitrary text on the console\n * @param message The text to display. Use an array if you need to display a message in several lines\n * @param options The configuration object to define the display type and/or override the default label\n */\nexport const message = (\n\tcontent: string[] | string,\n\t{\n\t\tlabel,\n\t\ttype = \"information\",\n\t}: { type?: MessageType; label?: string } = {},\n) => {\n\tconst { color, defaultLabel, icon, method } = formatPropertiesByType[type];\n\tconst messages = typeof content === \"string\" ? [content] : content;\n\n\tmethod(\n\t\tformat(`\\n${icon} ${label ?? defaultLabel}`, {\n\t\t\tcolor,\n\t\t\tmodifiers: [\"bold\"],\n\t\t}),\n\t);\n\n\tfor (const msg of messages) {\n\t\tmethod(format(` ${msg}`, { color }));\n\t}\n};\n\nconst formatPropertiesByType = {\n\terror: {\n\t\tcolor: \"red\",\n\t\tdefaultLabel: \"Error\",\n\t\ticon: \"\u274C\",\n\t\tmethod: console.error,\n\t},\n\tinformation: {\n\t\tcolor: \"blue\",\n\t\tdefaultLabel: \"Information\",\n\t\ticon: \"\u2139\uFE0F \",\n\t\tmethod: console.info,\n\t},\n\tsuccess: {\n\t\tcolor: \"green\",\n\t\tdefaultLabel: \"Success\",\n\t\ticon: \"\u2705\",\n\t\tmethod: console.log,\n\t},\n\twarning: {\n\t\tcolor: \"yellow\",\n\t\tdefaultLabel: \"Warning\",\n\t\ticon: \"\u26A0\uFE0F \",\n\t\tmethod: console.warn,\n\t},\n} as const;\n\nconst colorMapper = {\n\tblack: \"black\",\n\tblue: \"blue\",\n\tcyan: \"cyan\",\n\tgreen: \"green\",\n\tgrey: \"gray\",\n\tmagenta: \"magenta\",\n\tred: \"red\",\n\twhite: \"white\",\n\tyellow: \"yellow\",\n} as const;\n\nconst modifierMapper = {\n\tbold: \"bold\",\n\titalic: \"italic\",\n\tstrikethrough: \"strikethrough\",\n\tunderline: \"underline\",\n} as const;\n\ntype MessageType = \"error\" | \"information\" | \"success\" | \"warning\";\n\ntype Color =\n\t| \"black\"\
|
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,KAAK,MAAMA,CAAK,CACxB,MAAE,CACD,OAAOA,CACR,CACD,ECrEO,IAAMY,EAAc,IAAY,CACtC,IAAMC,EAAgB,CAAC,EAEvB,MAAO,CACN,QAAQC,EAAY,CACnBD,EAAM,KAAKC,CAAI,CAChB,EACA,SAAU,CACT,OAAOD,EAAM,MAAM,CACpB,EACA,SAAU,CACT,OAAOA,EAAM,SAAW,CACzB,CACD,CACD,ECSO,IAAME,EACZC,GACI,CACJ,IAAMC,EAAaC,EAA4BF,CAAI,EAEnD,GAAI,CAACC,EACJ,MAAM,IAAI,MACT,wCAAwCD;AAAA,0CACzC,EAGD,OAAOC,CACR,EAEaE,EAA0B,CACtCH,EACAI,IACI,CACJ,IAAMC,EAAeC,EAAyB,EAE1CC,EAAU,CAAC,EAETC,EAA4B,CACjC,YAAAJ,EACA,QAAS,CACR,aAAc,0BACd,gBAAiB,mBAClB,CACD,EAEMH,EAAwC,CAC7C,qBAAqBQ,EAAKC,EAAO,CAChCF,EAAS,QAAQC,CAAG,EAAIC,CACzB,EACA,SAASD,EAAKC,EAAO,CACpBH,EAAQE,CAAG,EAAIC,CAChB,EACA,eAAeC,EAAa,CAC3BN,EAAa,QAAQM,CAAW,CACjC,EACA,MAAM,QAAS,CACd,KAAO,CAACN,EAAa,QAAQ,GAAG,CAC/B,IAAMO,EAAOP,EAAa,QAAQ,EAE9BO,GACH,MAAMA,EAAK,EAGd,EACA,WAAWC,EAAiB,CAG3B,OAAIb,IAASa,IAMZN,EAAU,CACT,GANsBR,EAAqBc,CAAe,EAG3C,WAAWA,CAAe,EAIzC,GAAGN,CACJ,GAGMA,CACR,EACA,YAAYM,EAAiB,CAC5B,GAAIb,IAASa,E
|
||
|
- "names": ["spawn", "exec", "command", "options", "resolve", "reject", "stdout", "stderr", "bin", "args", "childProcess", "chunk", "exitCode", "output", "pico", "format", "message", "color", "modifiers", "transformers", "colorMapper", "mod", "modifierMapper", "compose", "fns", "prevFn", "nextFn", "value", "content", "label", "type", "defaultLabel", "icon", "method", "formatPropertiesByType", "messages", "msg", "fs", "path", "findNearestPackageJson", "pathname", "packagePathname", "path", "isFileExists", "__require", "fs", "getPackageMetadata", "mainFilename", "getArguments", "parameters", "command", "operands", "options", "currentOptionName", "addOptimisticOption", "name", "value", "castValue", "flushOptimisticOption", "parameter", "shortFlagMatchResult", "SHORT_FLAG_REGEX", "longFlagMatchResult", "LONG_FLAG_REGEX", "optionFlags", "lastIndex", "flag", "index", "createQueue", "items", "item", "getCommandController", "name", "controller", "commandControllerCollection", "createCommandController", "description", "instructions", "createQueue", "context", "metadata", "key", "value", "instruction", "task", "rootCommandName", "globalMetadata", "commandDescriptionCollection", "getCommandDescriptionCollection", "createCommand", "name", "description", "argv", "rootCommandName", "version", "isRootCommand", "isActiveCommand", "controller", "createCommandController", "rootController", "getCommandController", "optionKeys", "OPTION_HELP_NAMES", "showHelp", "OPTION_VERSION_NAMES", "currentCommandName", "commandMetadata", "options", "commands", "getCommandDescriptionCollection", "commandKeys", "hasOptions", "hasCommands", "printTitle", "print", "format", "padding", "value", "item", "commandDescription", "printLabelValue", "key", "parameters", "message", "label", "prompt", "createInput", "parameters", "key", "defaultValue", "label", "type", "context", "argv", "promptObject", "isMultiSelect", "choices", "option", "data", "createOption", "commandController", "argv", "parameters", "key", "name", "description", "defaultValue", "aliases", "metadataKey", "alias", "index", "value", "Listr", "PRESET_TIMER", "createTask", "parameters", "key", "label", "handler", "receiver", "context", "argv", "value", "termost", "metadata", "callbacks", "paramsMetadata", "isObject", "packageMetadata", "getPackageMetadata", "programName", "command", "options", "operands", "getArguments", "setGracefulListeners", "createProgram", "argv", "name", "description", "rootCommandName", "currentCommandName", "createInstruction", "factory", "params", "instruction", "controller", "getCommandController", "skip", "context", "output", "program", "createCommand", "createInput", "createOption", "createTask", "onShutdown", "onException", "error", "reason", "value", "helpers", "exec", "format", "message"]
|
||
|
+ "sources": ["../src/helpers/process/index.ts", "../src/helpers/stdout/index.ts", "../src/api/command/controller/queue.ts", "../src/api/command/controller/index.ts", "../src/api/command/command.ts", "../src/api/input/index.ts", "../src/api/option/index.ts", "../src/api/task/index.ts", "../src/helpers/package/index.ts", "../src/helpers/stdin/index.ts", "../src/termost.ts", "../src/index.ts"],
|
||
|
+ "sourcesContent": ["import { spawn } from \"child_process\";\n\nexport const exec = async (\n\tcommand: string,\n\toptions: ExecOptions = { hasLiveOutput: false },\n) => {\n\treturn new Promise<string>((resolve, reject) => {\n\t\tlet stdout = \"\";\n\t\tlet stderr = \"\";\n\t\tconst [bin, ...args] = command.split(\" \") as [string, ...string[]];\n\n\t\tconst childProcess = spawn(bin, args, {\n\t\t\tcwd: options.cwd,\n\t\t\tenv: {\n\t\t\t\t...process.env,\n\t\t\t\t// @note: make sure to force color display for spawned processes\n\t\t\t\tFORCE_COLOR: \"1\",\n\t\t\t},\n\t\t\tshell: true,\n\t\t\tstdio: options.hasLiveOutput ? \"inherit\" : \"pipe\",\n\t\t});\n\n\t\tchildProcess.stdout?.on(\"data\", (chunk) => {\n\t\t\tstdout += chunk;\n\t\t});\n\n\t\tchildProcess.stderr?.on(\"data\", (chunk) => {\n\t\t\tstderr += chunk;\n\t\t});\n\n\t\tchildProcess.on(\"close\", (exitCode) => {\n\t\t\tif (exitCode !== 0) {\n\t\t\t\tconst output = `${stderr}${stdout}`;\n\n\t\t\t\treject(output.trim());\n\t\t\t} else {\n\t\t\t\tresolve(stdout.trim());\n\t\t\t}\n\t\t});\n\t});\n};\n\ntype ExecOptions = {\n\tcwd?: string;\n\thasLiveOutput?: boolean;\n};\n", "import pico from \"picocolors\";\n\n/**\n * A helper to format an arbitrary text as a message input\n * @param message The text to display\n * @param options The configuration object to control the formatting properties\n * @returns The formatted text\n */\nexport const format = (\n\tmessage: string,\n\t{\n\t\tcolor,\n\t\tmodifiers,\n\t}: {\n\t\tcolor?: Color;\n\t\tmodifiers?: Modifier[];\n\t} = {\n\t\tcolor: \"white\",\n\t\tmodifiers: [],\n\t},\n) => {\n\tconst transformers: ((input: string) => string)[] = [];\n\n\ttransformers.push(pico[colorMapper[color ?? \"white\"]]);\n\n\t(modifiers ?? []).forEach((mod: Modifier) => {\n\t\tif (mod === \"uppercase\") {\n\t\t\tmessage = message.toUpperCase();\n\t\t} else if (mod === \"lowercase\") {\n\t\t\tmessage = message.toLowerCase();\n\t\t} else {\n\t\t\ttransformers.push(pico[modifierMapper[mod]]);\n\t\t}\n\t});\n\n\treturn compose(...transformers)(message);\n};\n\nconst compose = <T>(...fns: ((a: T) => T)[]) =>\n\tfns.reduce(\n\t\t(prevFn, nextFn) => (value) => prevFn(nextFn(value)),\n\t\tfns[0] as (a: T) => T,\n\t);\n\n/**\n * An opinionated helper to display arbitrary text on the console\n * @param message The text to display. Use an array if you need to display a message in several lines\n * @param options The configuration object to define the display type and/or override the default label\n */\nexport const message = (\n\tcontent: string[] | string,\n\t{\n\t\tlabel,\n\t\ttype = \"information\",\n\t}: { label?: string; type?: MessageType } = {},\n) => {\n\tconst { color, defaultLabel, icon, method } = formatPropertiesByType[type];\n\tconst messages = typeof content === \"string\" ? [content] : content;\n\n\tmethod(\n\t\tformat(`\\n${icon} ${label ?? defaultLabel}`, {\n\t\t\tcolor,\n\t\t\tmodifiers: [\"bold\"],\n\t\t}),\n\t);\n\n\tfor (const msg of messages) {\n\t\tmethod(format(` ${msg}`, { color }));\n\t}\n};\n\nconst formatPropertiesByType = {\n\terror: {\n\t\tcolor: \"red\",\n\t\tdefaultLabel: \"Error\",\n\t\ticon: \"\u274C\",\n\t\tmethod: console.error,\n\t},\n\tinformation: {\n\t\tcolor: \"blue\",\n\t\tdefaultLabel: \"Information\",\n\t\ticon: \"\u2139\uFE0F \",\n\t\tmethod: console.info,\n\t},\n\tsuccess: {\n\t\tcolor: \"green\",\n\t\tdefaultLabel: \"Success\",\n\t\ticon: \"\u2705\",\n\t\tmethod: console.log,\n\t},\n\twarning: {\n\t\tcolor: \"yellow\",\n\t\tdefaultLabel: \"Warning\",\n\t\ticon: \"\u26A0\uFE0F \",\n\t\tmethod: console.warn,\n\t},\n} as const;\n\nconst colorMapper = {\n\tblack: \"black\",\n\tblue: \"blue\",\n\tcyan: \"cyan\",\n\tgreen: \"green\",\n\tgrey: \"gray\",\n\tmagenta: \"magenta\",\n\tred: \"red\",\n\twhite: \"white\",\n\tyellow: \"yellow\",\n} as const;\n\nconst modifierMapper = {\n\tbold: \"bold\",\n\titalic: \"italic\",\n\tstrikethrough: \"strikethrough\",\n\tunderline: \"underline\",\n} as const;\n\ntype MessageType = \"error\" | \"information\" | \"success\" | \"warning\";\n\ntype Color =\n\t| \"black\"\
|
||
|
+ "mappings": "6PAAA,OAAS,SAAAA,MAAa,gBAEf,IAAMC,EAAO,MACnBC,EACAC,EAAuB,CAAE,cAAe,EAAM,IAEvC,IAAI,QAAgB,CAACC,EAASC,IAAW,CAC/C,IAAIC,EAAS,GACTC,EAAS,GACP,CAACC,EAAK,GAAGC,CAAI,EAAIP,EAAQ,MAAM,GAAG,EAElCQ,EAAeV,EAAMQ,EAAKC,EAAM,CACrC,IAAKN,EAAQ,IACb,IAAK,CACJ,GAAG,QAAQ,IAEX,YAAa,GACd,EACA,MAAO,GACP,MAAOA,EAAQ,cAAgB,UAAY,MAC5C,CAAC,EAEDO,EAAa,QAAQ,GAAG,OAASC,GAAU,CAC1CL,GAAUK,CACX,CAAC,EAEDD,EAAa,QAAQ,GAAG,OAASC,GAAU,CAC1CJ,GAAUI,CACX,CAAC,EAEDD,EAAa,GAAG,QAAUE,GAAa,CACtC,GAAIA,IAAa,EAAG,CACnB,IAAMC,EAAS,GAAGN,IAASD,IAE3BD,EAAOQ,EAAO,KAAK,CAAC,OAEpBT,EAAQE,EAAO,KAAK,CAAC,CAEvB,CAAC,CACF,CAAC,ECvCF,OAAOQ,MAAU,aAQV,IAAMC,EAAS,CACrBC,EACA,CACC,MAAAC,EACA,UAAAC,CACD,EAGI,CACH,MAAO,QACP,UAAW,CAAC,CACb,IACI,CACJ,IAAMC,EAA8C,CAAC,EAErD,OAAAA,EAAa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EAAY,OAAS,EAE1DG,EAAW,OAAO,EAClBC,EACC,GAAGC,EACF,GAAGvB,IACFG,EAAgB,GAAK,IAAI,OAAOU,CAAkB,MAEnD,CACC,MAAO,OACR,CACD,KAAKO,EAAc,aAAe,KACjCD,EA
|
||
|
+ "names": ["spawn", "exec", "command", "options", "resolve", "reject", "stdout", "stderr", "bin", "args", "childProcess", "chunk", "exitCode", "output", "pico", "format", "message", "color", "modifiers", "transformers", "colorMapper", "mod", "modifierMapper", "compose", "fns", "prevFn", "nextFn", "value", "content", "label", "type", "defaultLabel", "icon", "method", "formatPropertiesByType", "messages", "msg", "createQueue", "items", "item", "getCommandController", "name", "controller", "commandControllerCollection", "createCommandController", "description", "instructions", "createQueue", "context", "metadata", "instruction", "key", "value", "task", "rootCommandName", "globalMetadata", "commandDescriptionCollection", "getCommandDescriptionCollection", "createCommand", "name", "description", "rootCommandName", "argv", "version", "isRootCommand", "isActiveCommand", "controller", "createCommandController", "rootController", "getCommandController", "optionKeys", "OPTION_HELP_NAMES", "showHelp", "OPTION_VERSION_NAMES", "currentCommandName", "commandMetadata", "options", "commands", "getCommandDescriptionCollection", "commandKeys", "hasOptions", "hasCommands", "printTitle", "print", "format", "padding", "value", "item", "commandDescription", "printLabelValue", "key", "parameters", "message", "label", "prompt", "createInput", "parameters", "key", "label", "defaultValue", "type", "context", "argv", "promptObject", "isMultiSelect", "choices", "option", "data", "createOption", "commandController", "argv", "parameters", "key", "name", "description", "defaultValue", "aliases", "metadataKey", "alias", "index", "value", "Listr", "PRESET_TIMER", "createTask", "parameters", "key", "label", "handler", "receiver", "context", "argv", "value", "fs", "path", "findNearestPackageJson", "pathname", "packagePathname", "path", "isFileExists", "__require", "fs", "getPackageMetadata", "mainFilename", "getArguments", "parameters", "command", "operands", "options", "currentOptionName", "addOptimisticOption", "name", "value", "castValue", "flushOptimisticOption", "parameter", "shortFlagMatchResult", "SHORT_FLAG_REGEX", "longFlagMatchResult", "LONG_FLAG_REGEX", "optionFlags", "lastIndex", "flag", "index", "termost", "metadata", "callbacks", "name", "description", "version", "isObject", "packageMetadata", "getPackageMetadata", "command", "operands", "options", "getArguments", "setGracefulListeners", "createProgram", "argv", "rootCommandName", "currentCommandName", "createInstruction", "factory", "params", "instruction", "controller", "getCommandController", "skip", "context", "output", "program", "createCommand", "createInput", "createOption", "createTask", "onException", "onShutdown", "error", "reason", "value", "helpers", "exec", "format", "message"]
|
||
|
}
|