nwui-cli 0.5.4 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # nwui-cli
2
2
 
3
+ ## 0.5.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 794360d: Use @/ type alias instead of ~/
8
+
3
9
  ## 0.5.4
4
10
 
5
11
  ### Patch Changes
package/build/index.cjs CHANGED
@@ -49,7 +49,7 @@ ${t}`,G6=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),q6=Objec
49
49
  ${t}`,D5=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),v5=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),g5=(e,t,a)=>{let i=a===""?"":`with ${a.trim()}() `,r=f5.bind(null,i,t.toString());Object.defineProperty(r,"name",v5),Object.defineProperty(e,"toString",{...D5,value:r})};function Cp(e,t,{ignoreNonConfigurable:a=!1}={}){let{name:i}=e;for(let r of Reflect.ownKeys(t))m5(e,t,r,a);return h5(e,t),g5(e,t,i),e}var Vi=new WeakMap,al=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let a,i=0,r=e.displayName||e.name||"<anonymous>",p=function(...s){if(Vi.set(p,++i),i===1)a=e.apply(this,s),e=null;else if(t.throw===!0)throw new Error(`Function \`${r}\` can only be called once`);return a};return Cp(p,e),Vi.set(p,i),p};al.callCount=e=>{if(!Vi.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Vi.get(e)};var il=al;var ul=E(require("process"),1);var ol=require("os");var rl=()=>{let e=pl-sl+1;return Array.from({length:e},_5)},_5=(e,t)=>({name:`SIGRT${t+1}`,number:sl+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),sl=34,pl=64;var dl=require("os");var nl=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];var Sp=()=>{let e=rl();return[...nl,...e].map(w5)},w5=({name:e,number:t,description:a,action:i,forced:r=!1,standard:p})=>{let{signals:{[e]:s}}=dl.constants,n=s!==void 0;return{name:e,number:n?s:t,description:a,supported:n,action:i,forced:r,standard:p}};var F5=()=>{let e=Sp();return Object.fromEntries(e.map(E5))},E5=({name:e,number:t,description:a,supported:i,action:r,forced:p,standard:s})=>[e,{name:e,number:t,description:a,supported:i,action:r,forced:p,standard:s}],ll=F5(),y5=()=>{let e=Sp(),t=65,a=Array.from({length:t},(i,r)=>b5(r,e));return Object.assign({},...a)},b5=(e,t)=>{let a=C5(e,t);if(a===void 0)return{};let{name:i,description:r,supported:p,action:s,forced:n,standard:d}=a;return{[e]:{name:i,number:e,description:r,supported:p,action:s,forced:n,standard:d}}},C5=(e,t)=>{let a=t.find(({name:i})=>ol.constants.signals[i]===e);return a!==void 0?a:t.find(i=>i.number===e)},dv=y5();var S5=({timedOut:e,timeout:t,errorCode:a,signal:i,signalDescription:r,exitCode:p,isCanceled:s})=>e?`timed out after ${t} milliseconds`:s?"was canceled":a!==void 0?`failed with ${a}`:i!==void 0?`was killed with ${i} (${r})`:p!==void 0?`failed with exit code ${p}`:"failed",fa=({stdout:e,stderr:t,all:a,error:i,signal:r,exitCode:p,command:s,escapedCommand:n,timedOut:d,isCanceled:o,killed:l,parsed:{options:{timeout:u,cwd:m=ul.default.cwd()}}})=>{p=p===null?void 0:p,r=r===null?void 0:r;let f=r===void 0?void 0:ll[r].description,c=i&&i.code,h=`Command ${S5({timedOut:d,timeout:u,errorCode:c,signal:r,signalDescription:f,exitCode:p,isCanceled:o})}: ${s}`,D=Object.prototype.toString.call(i)==="[object Error]",g=D?`${h}
50
50
  ${i.message}`:h,y=[g,t,e].filter(Boolean).join(`
51
51
  `);return D?(i.originalMessage=i.message,i.message=y):i=new Error(y),i.shortMessage=g,i.command=s,i.escapedCommand=n,i.exitCode=p,i.signal=r,i.signalDescription=f,i.stdout=e,i.stderr=t,i.cwd=m,a!==void 0&&(i.all=a),"bufferedData"in i&&delete i.bufferedData,i.failed=!0,i.timedOut=!!d,i.isCanceled=o,i.killed=l&&!d,i};var Li=["stdin","stdout","stderr"],x5=e=>Li.some(t=>e[t]!==void 0),ml=e=>{if(!e)return;let{stdio:t}=e;if(t===void 0)return Li.map(i=>e[i]);if(x5(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Li.map(i=>`\`${i}\``).join(", ")}`);if(typeof t=="string")return t;if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let a=Math.max(t.length,Li.length);return Array.from({length:a},(i,r)=>t[r])};var cl=E(require("os"),1);var A5=1e3*5,hl=(e,t="SIGTERM",a={})=>{let i=e(t);return T5(e,t,a,i),i},T5=(e,t,a,i)=>{if(!B5(t,a,i))return;let r=O5(a),p=setTimeout(()=>{e("SIGKILL")},r);p.unref&&p.unref()},B5=(e,{forceKillAfterTimeout:t},a)=>N5(e)&&t!==!1&&a,N5=e=>e===cl.default.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",O5=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return A5;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},fl=(e,t)=>{e.kill()&&(t.isCanceled=!0)},k5=(e,t,a)=>{e.kill(t),a(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},Dl=(e,{timeout:t,killSignal:a="SIGTERM"},i)=>{if(t===0||t===void 0)return i;let r,p=new Promise((n,d)=>{r=setTimeout(()=>{k5(e,a,d)},t)}),s=i.finally(()=>{clearTimeout(r)});return Promise.race([p,s])},vl=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},gl=async(e,{cleanup:t,detached:a},i)=>{if(!t||a)return i;let r=Va(()=>{e.kill()});return i.finally(()=>{r()})};var _l=require("fs"),wl=require("child_process");function $i(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}function xp(e){return $i(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object"}var P5=e=>e instanceof wl.ChildProcess&&typeof e.then=="function",Ap=(e,t,a)=>{if(typeof a=="string")return e[t].pipe((0,_l.createWriteStream)(a)),e;if(xp(a))return e[t].pipe(a),e;if(!P5(a))throw new TypeError("The second argument must be a string, a stream or an Execa child process.");if(!xp(a.stdin))throw new TypeError("The target child process's stdin must be available.");return e[t].pipe(a.stdin),a},Fl=e=>{e.stdout!==null&&(e.pipeStdout=Ap.bind(void 0,e,"stdout")),e.stderr!==null&&(e.pipeStderr=Ap.bind(void 0,e,"stderr")),e.all!==void 0&&(e.pipeAll=Ap.bind(void 0,e,"all"))};var zi=require("fs"),kl=require("timers/promises");var Da=async(e,{init:t,convertChunk:a,getSize:i,truncateChunk:r,addChunk:p,getFinalChunk:s,finalize:n},{maxBuffer:d=Number.POSITIVE_INFINITY}={})=>{if(!I5(e))throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");let o=t();o.length=0;try{for await(let l of e){let u=V5(l),m=a[u](l,o);bl({convertedChunk:m,state:o,getSize:i,truncateChunk:r,addChunk:p,maxBuffer:d})}return R5({state:o,convertChunk:a,getSize:i,truncateChunk:r,addChunk:p,getFinalChunk:s,maxBuffer:d}),n(o)}catch(l){throw l.bufferedData=n(o),l}},R5=({state:e,getSize:t,truncateChunk:a,addChunk:i,getFinalChunk:r,maxBuffer:p})=>{let s=r(e);s!==void 0&&bl({convertedChunk:s,state:e,getSize:t,truncateChunk:a,addChunk:i,maxBuffer:p})},bl=({convertedChunk:e,state:t,getSize:a,truncateChunk:i,addChunk:r,maxBuffer:p})=>{let s=a(e),n=t.length+s;if(n<=p){El(e,t,r,n);return}let d=i(e,p-t.length);throw d!==void 0&&El(d,t,r,p),new ji},El=(e,t,a,i)=>{t.contents=a(e,t,i),t.length=i},I5=e=>typeof e=="object"&&e!==null&&typeof e[Symbol.asyncIterator]=="function",V5=e=>{let t=typeof e;if(t==="string")return"string";if(t!=="object"||e===null)return"others";if(globalThis.Buffer?.isBuffer(e))return"buffer";let a=yl.call(e);return a==="[object ArrayBuffer]"?"arrayBuffer":a==="[object DataView]"?"dataView":Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&yl.call(e.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:yl}=Object.prototype,ji=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}};var Tp=e=>e,Bp=()=>{},Np=({contents:e})=>e,Ui=e=>{throw new Error(`Streams in object mode are not supported: ${String(e)}`)},Mi=e=>e.length;async function Op(e,t){return Da(e,W5,t)}var L5=()=>({contents:new ArrayBuffer(0)}),$5=e=>j5.encode(e),j5=new TextEncoder,Cl=e=>new Uint8Array(e),Sl=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),U5=(e,t)=>e.slice(0,t),M5=(e,{contents:t,length:a},i)=>{let r=Tl()?q5(t,i):G5(t,i);return new Uint8Array(r).set(e,a),r},G5=(e,t)=>{if(t<=e.byteLength)return e;let a=new ArrayBuffer(Al(t));return new Uint8Array(a).set(new Uint8Array(e),0),a},q5=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let a=new ArrayBuffer(t,{maxByteLength:Al(t)});return new Uint8Array(a).set(new Uint8Array(e),0),a},Al=e=>xl**Math.ceil(Math.log(e)/Math.log(xl)),xl=2,z5=({contents:e,length:t})=>Tl()?e:e.slice(0,t),Tl=()=>"resize"in ArrayBuffer.prototype,W5={init:L5,convertChunk:{string:$5,buffer:Cl,arrayBuffer:Cl,dataView:Sl,typedArray:Sl,others:Ui},getSize:Mi,truncateChunk:U5,addChunk:M5,getFinalChunk:Bp,finalize:z5};async function Gi(e,t){if(!("Buffer"in globalThis))throw new Error("getStreamAsBuffer() is only supported in Node.js");try{return Bl(await Op(e,t))}catch(a){throw a.bufferedData!==void 0&&(a.bufferedData=Bl(a.bufferedData)),a}}var Bl=e=>globalThis.Buffer.from(e);async function kp(e,t){return Da(e,X5,t)}var H5=()=>({contents:"",textDecoder:new TextDecoder}),qi=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),K5=(e,{contents:t})=>t+e,Y5=(e,t)=>e.slice(0,t),J5=({textDecoder:e})=>{let t=e.decode();return t===""?void 0:t},X5={init:H5,convertChunk:{string:Tp,buffer:qi,arrayBuffer:qi,dataView:qi,typedArray:qi,others:Ui},getSize:Mi,truncateChunk:Y5,addChunk:K5,getFinalChunk:J5,finalize:Np};var Pl=E(Ol(),1),Rl=e=>{if(e!==void 0)throw new TypeError("The `input` and `inputFile` options cannot be both set.")},Q5=({input:e,inputFile:t})=>typeof t!="string"?e:(Rl(e),(0,zi.readFileSync)(t)),Il=e=>{let t=Q5(e);if($i(t))throw new TypeError("The `input` option cannot be a stream in sync mode");return t},em=({input:e,inputFile:t})=>typeof t!="string"?e:(Rl(e),(0,zi.createReadStream)(t)),Vl=(e,t)=>{let a=em(t);a!==void 0&&($i(a)?a.pipe(e.stdin):e.stdin.end(a))},Ll=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;let a=(0,Pl.default)();return e.stdout&&a.add(e.stdout),e.stderr&&a.add(e.stderr),a},Pp=async(e,t)=>{if(!(!e||t===void 0)){await(0,kl.setTimeout)(0),e.destroy();try{return await t}catch(a){return a.bufferedData}}},Rp=(e,{encoding:t,buffer:a,maxBuffer:i})=>{if(!(!e||!a))return t==="utf8"||t==="utf-8"?kp(e,{maxBuffer:i}):t===null||t==="buffer"?Gi(e,{maxBuffer:i}):tm(e,i,t)},tm=async(e,t,a)=>(await Gi(e,{maxBuffer:t})).toString(a),$l=async({stdout:e,stderr:t,all:a},{encoding:i,buffer:r,maxBuffer:p},s)=>{let n=Rp(e,{encoding:i,buffer:r,maxBuffer:p}),d=Rp(t,{encoding:i,buffer:r,maxBuffer:p}),o=Rp(a,{encoding:i,buffer:r,maxBuffer:p*2});try{return await Promise.all([s,n,d,o])}catch(l){return Promise.all([{error:l,signal:l.signal,timedOut:l.timedOut},Pp(e,n),Pp(t,d),Pp(a,o)])}};var am=(async()=>{})().constructor.prototype,im=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(am,e)]),Ip=(e,t)=>{for(let[a,i]of im){let r=typeof t=="function"?(...p)=>Reflect.apply(i.value,t(),p):i.value.bind(t);Reflect.defineProperty(e,a,{...i,value:r})}},jl=e=>new Promise((t,a)=>{e.on("exit",(i,r)=>{t({exitCode:i,signal:r})}),e.on("error",i=>{a(i)}),e.stdin&&e.stdin.on("error",i=>{a(i)})});var Gl=require("buffer"),ql=require("child_process"),zl=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],rm=/^[\w.-]+$/,sm=e=>typeof e!="string"||rm.test(e)?e:`"${e.replaceAll('"','\\"')}"`,Vp=(e,t)=>zl(e,t).join(" "),Lp=(e,t)=>zl(e,t).map(a=>sm(a)).join(" "),pm=/ +/g;var Ul=e=>{let t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(t==="object"&&e!==null&&!(e instanceof ql.ChildProcess)&&"stdout"in e){let a=typeof e.stdout;if(a==="string")return e.stdout;if(Gl.Buffer.isBuffer(e.stdout))return e.stdout.toString();throw new TypeError(`Unexpected "${a}" stdout in template expression`)}throw new TypeError(`Unexpected "${t}" in template expression`)},Ml=(e,t,a)=>a||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],nm=({templates:e,expressions:t,tokens:a,index:i,template:r})=>{let p=r??e.raw[i],s=p.split(pm).filter(Boolean),n=Ml(a,s,p.startsWith(" "));if(i===t.length)return n;let d=t[i],o=Array.isArray(d)?d.map(l=>Ul(l)):[Ul(d)];return Ml(n,o,p.endsWith(" "))},$p=(e,t)=>{let a=[];for(let[i,r]of e.entries())a=nm({templates:e,expressions:t,tokens:a,index:i,template:r});return a};var Wl=require("util"),Hl=E(require("process"),1),Kl=(0,Wl.debuglog)("execa").enabled,Wi=(e,t)=>String(e).padStart(t,"0"),dm=()=>{let e=new Date;return`${Wi(e.getHours(),2)}:${Wi(e.getMinutes(),2)}:${Wi(e.getSeconds(),2)}.${Wi(e.getMilliseconds(),3)}`},jp=(e,{verbose:t})=>{t&&Hl.default.stderr.write(`[${dm()}] ${e}
52
- `)};var om=1e3*1e3*100,lm=({env:e,extendEnv:t,preferLocal:a,localDir:i,execPath:r})=>{let p=t?{...va.default.env,...e}:e;return a?tl({env:p,cwd:i,execPath:r}):p},Ql=(e,t,a={})=>{let i=Zl.default._parse(e,t,a);return e=i.command,t=i.args,a=i.options,a={maxBuffer:om,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:a.cwd||va.default.cwd(),execPath:va.default.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:Kl,...a},a.env=lm(a),a.stdio=ml(a),va.default.platform==="win32"&&Xl.default.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:a,parsed:i}},ga=(e,t,a)=>typeof t!="string"&&!Jl.Buffer.isBuffer(t)?a===void 0?void 0:"":e.stripFinalNewline?yp(t):t;function k1(e,t,a){let i=Ql(e,t,a),r=Vp(e,t),p=Lp(e,t);jp(p,i.options),vl(i.options);let s;try{s=Hi.default.spawn(i.file,i.args,i.options)}catch(f){let c=new Hi.default.ChildProcess,v=Promise.reject(fa({error:f,stdout:"",stderr:"",all:"",command:r,escapedCommand:p,parsed:i,timedOut:!1,isCanceled:!1,killed:!1}));return Ip(c,v),c}let n=jl(s),d=Dl(s,i.options,n),o=gl(s,i.options,d),l={isCanceled:!1};s.kill=hl.bind(null,s.kill.bind(s)),s.cancel=fl.bind(null,s,l);let m=il(async()=>{let[{error:f,exitCode:c,signal:v,timedOut:h},D,g,y]=await $l(s,i.options,o),C=ga(i.options,D),F=ga(i.options,g),B=ga(i.options,y);if(f||c!==0||v!==null){let T=fa({error:f,exitCode:c,signal:v,stdout:C,stderr:F,all:B,command:r,escapedCommand:p,parsed:i,timedOut:h,isCanceled:l.isCanceled||(i.options.signal?i.options.signal.aborted:!1),killed:s.killed});if(!i.options.reject)return T;throw T}return{command:r,escapedCommand:p,exitCode:0,stdout:C,stderr:F,all:B,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return Vl(s,i.options),s.all=Ll(s,i.options),Fl(s),Ip(s,m),s}function um(e,t,a){let i=Ql(e,t,a),r=Vp(e,t),p=Lp(e,t);jp(p,i.options);let s=Il(i.options),n;try{n=Hi.default.spawnSync(i.file,i.args,{...i.options,input:s})}catch(l){throw fa({error:l,stdout:"",stderr:"",all:"",command:r,escapedCommand:p,parsed:i,timedOut:!1,isCanceled:!1,killed:!1})}let d=ga(i.options,n.stdout,n.error),o=ga(i.options,n.stderr,n.error);if(n.error||n.status!==0||n.signal!==null){let l=fa({stdout:d,stderr:o,error:n.error,signal:n.signal,exitCode:n.status,command:r,escapedCommand:p,parsed:i,timedOut:n.error&&n.error.code==="ETIMEDOUT",isCanceled:!1,killed:n.signal!==null});if(!i.options.reject)return l;throw l}return{command:r,escapedCommand:p,exitCode:0,stdout:d,stderr:o,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}}var mm=({input:e,inputFile:t,stdio:a})=>e===void 0&&t===void 0&&a===void 0?{stdin:"inherit"}:{},Yl=(e={})=>({preferLocal:!0,...mm(e),...e});function eu(e){function t(a,...i){if(!Array.isArray(a))return eu({...e,...a});let[r,...p]=$p(a,i);return k1(r,p,Yl(e))}return t.sync=(a,...i)=>{if(!Array.isArray(a))throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");let[r,...p]=$p(a,i);return um(r,p,Yl(e))},t}var rg=eu();var e2=E(require("memoizee"),1);ht();var tr=E(Xp(),1);ht();var ku=E(Xp(),1);function Pu(...e){console.warn(...e.map(t=>ku.default.yellow(t)))}function er(...e){console.log(...e)}var Zp,Iu=e=>{Zp=e},Lm=(e,t)=>k1(e,t,Zp?{cwd:Zp}:void 0);async function Vu(){return await $m()||$.EXPO_NO_GIT_STATUS?!1:(er(),await l1({message:"Continue with uncommited changes?"})?(er(),!1):!0)}async function $m(){let e="unknown";try{e=(await Lm("git",["status","--porcelain"])).stdout===""?"clean":"dirty"}catch{}return e==="clean"?!0:(e==="dirty"?$.EXPO_QUIET||Ru("Git branch has uncommited file changes","It's recommended to commit all changes before proceeding in case you want to revert generated changes."):$.EXPO_QUIET||Ru("No git repo found in current directory","Use git to track file changes before running commands that modify project files."),!1)}function Ru(e,t){$.EXPO_QUIET||(Pu(tr.default.bold`! `+e),er(tr.default.gray`\u203A `+tr.default.gray(t)))}var Lu=async(e,t=!1,a=`.${n1.sep}`,i=!1,r=!1,p=!1,s=!1)=>{let n=n1.resolve(a),d=Be({text:"Fetching component metadata...",isSilent:s});s||d.start();let o=await zm(),l=o.filter(h=>!h.free).map(h=>h.slug),u=new Set((await Promise.all(e.map(async h=>{if(["paid","free","all"].includes(h)){let D=o.slice().filter(g=>g.type!=="screen");return h!=="all"&&(D=D.filter(g=>g.free===(h==="free"))),D.map(g=>g.slug)}return h==="screens"?o.filter(D=>D.type==="screen").map(D=>D.slug):[h]}))).flat());if(Array.from(u).some(h=>l.includes(h))&&!await Pi()&&(s||d.stop(),!await Wm(s)))throw"unauthenticated";s||d.stopAndPersist({text:"Received component metadata."}),d=Be({text:"Checking for expo-router...",isSilent:s}),s||d.start();try{await k1("npm",["ls","expo-router"],{cwd:n}),await te.promises.access(n1.join(n,`app${n1.sep}`)),s||d.stopAndPersist({text:"Found expo-router."})}catch(h){if(s||d.stop(),h?.code==="ENOENT"||h?.exitCode===1){if(!r&&!await l1({message:"The working directory provided does not appear to be an expo-router project. Continue anyway?"}))throw"aborted";s||d.stopAndPersist({text:"Ignored expo-router."})}else throw s||console.error("error:",h),h}try{if(Iu(n),await Vu())return}catch(h){s||console.error("error checking git:",h);return}let m=await qm(u,i);$.NODE_ENV==="development"&&(console.log("components:",u),console.log("resolution:",m)),d=Be({text:"Installing libraries and primitives...",isSilent:s}),s||d.start();let f=Array.from(m.libraries).concat(Array.from(m.primitives));if(f.length>0)try{let h=["expo","install"],D=["--silent","--no-audit","--progress=false","--legacy-peer-deps"],g=!1,y=!1;if(p){if(h.push("--npm",...f,"--","--package-lock-only","--no-package-lock",...D),$.NODE_ENV==="development"&&console.log("lockfile:",se(n,"package-lock.json")),await te.promises.access(se(n,"package-lock.json")).then(()=>!0).catch(()=>!1)||(g=!0),!await te.promises.access(se(n,"node_modules")).then(()=>!0).catch(()=>!1)){y=!0;let T=await k1("npm",["install",...D],{cwd:n});if(T.exitCode!==0)throw s||d.stop(),s||console.log(T.all),s||console.error("command:",T.command),`npx expo install failed with exit code ${T.exitCode}`}}else await te.promises.access(se(n,"package-lock.json")).then(()=>!0).catch(()=>!1)?h.push("--npm",...f,"--","--legacy-peer-deps"):h.push(...f);$.NODE_ENV==="development"&&console.log("> npx",h);let C=await k1("npx",h,{cwd:n});if(C.exitCode!==0)throw s||d.stop(),s||console.log(C.all),s||console.error("command:",C.command),`npx expo install failed with exit code ${C.exitCode}`;g&&(await te.promises.rm(se(n,"package-lock.json"),{force:!0}),$.NODE_ENV==="development"&&console.log("deleted package-lock.json")),y&&(await te.promises.rm(se(n,"node_modules"),{recursive:!0,force:!0}),$.NODE_ENV==="development"&&console.log("deleted node_modules"))}catch(h){if(h)throw s||console.error(h),"npx expo install failed"}s||d.stopAndPersist({text:"Libraries and primitives successfully installed."}),d=Be({text:"Installing component files...",isSilent:s}),s||d.start();let c=Array.from(m.components.entries()).flatMap(([h,D])=>D.additionalFiles||[]),v=new Set(c.map(h=>h.path.replace(/[/][^/]*$/,"")));for(let h of v)try{await te.promises.mkdir(se(n,h),{recursive:!0})}catch(D){throw typeof D=="object"&&D&&"code"in D&&D.code==="EEXIST"?`a file exists at the same path where a directory needs to exists: ${h}`:D}for(let h of c){if(h.path==="~/app/_layout.tsx")continue;let D=se(n,h.path);if(!t)try{throw await te.promises.access(D),"file exists"}catch(g){if(g==="file exists"&&(s||d.stop(),!await l1({message:`File at path ${h.path} already exists, overwrite it?`}))){s||console.log("Skipped file",h.path),s||d.start();continue}}try{await te.promises.writeFile(se(n,h.path),h.code)}catch(g){throw g}}s||d.stopAndPersist({text:"Component files installed."}),await Mm(m,n,s),i&&await Gm(m,n,t,s),s||console.log(""),s||console.log("If you're looking to move even faster, I may be able to help!"),s||console.log("- dan@ronindevs.com")},se=(e,t)=>n1.join(e,...t.replace(/^[~][/]/,"").split("/")),Um=[["selectable-text","text"]];async function Mm(e,t,a=!1){let i=Be({text:"Cleaning up old files...",isSilent:a});a||i.start();let r="~/components/nativewindui/examples";try{await te.promises.access(se(t,r)).catch(()=>{throw $.NODE_ENV==="development"&&console.log("no examples folder found"),"examples not found"});let p=Array.from(e.components.entries()).map(([s,n])=>s);Um.forEach(([s,n])=>{p.includes(n)&&p.push(s)});for(let s of p){let n=`${r}/${s}.tsx`,d=se(t,n);try{await te.promises.rm(d,{force:!0})}catch(o){$.NODE_ENV==="development"&&console.error(`error cleaning up old example file ${s}:`,o)}}}catch(p){p!=="examples not found"&&(a||console.error("error cleaning up depreated files:",p?p.message||p:"unknown"))}a||i.stopAndPersist({text:"Cleaned up old files."})}async function Gm(e,t,a,i=!1){let r=Be({text:"Installing example files...",isSilent:i});i||r.start();let p="~/components/nativewindui-examples";try{await te.promises.mkdir(se(t,p),{recursive:!0})}catch(n){throw typeof n=="object"&&n&&"code"in n&&n.code==="EEXIST"?`a file exists at the same path where a directory needs to exists: ${p}`:n}let s=Array.from(e.components.entries()).map(([n,d])=>({slug:n,code:d.type==="component"?d.implementationCode:null}));for(let n of s){if(!n.code)continue;let d=`${p}/${n.slug}.tsx`,o=se(t,d);if(!a)try{throw await te.promises.access(o),"file exists"}catch(l){if(l==="file exists"&&(i||r.stop(),!await l1({message:`File at path ${d} already exists, overwrite it?`}))){i||console.log("Skipped file",d),i||r.start();continue}}try{await te.promises.writeFile(se(t,d),n.code)}catch(l){throw l}}i||r.stopAndPersist({text:`Example usage files installed to ${p}`})}async function qm(e,t){let a=await Promise.all(Array.from(e).map(async p=>{try{return await Qp(p)}catch(s){throw console.error("error grabbing component:",s),s}}));if(t){let p=new Set(a.flatMap(s=>s.type!=="component"?[]:(s.exampleDependencies||[]).filter(n=>n.type==="component").filter(n=>!e.has(n.name)).map(n=>n.url.replace("/component/",""))));a.push(...await Promise.all(Array.from(p).map(async s=>{try{return await Qp(s)}catch(n){throw console.error("error grabbing component:",n),n}})))}let i={libraries:new Set,primitives:new Set,components:new Map};for(let p of a)i.components.set(p.slug,p);async function r(p){let s=p.dependencies||[];t&&p.type==="component"&&s.push(...(p.exampleDependencies||[]).filter(n=>n.type!="component")),await Promise.all(s.map(async n=>{switch(n.type){case"library":i.libraries.add(n.name);break;case"primitive":i.primitives.add(n.name);break;case"component":let d=n.url.replace("/component/",""),o=i.components.get(d)||await Qp(d,!0);i.components.set(d,o),await r(o);break}}))}return await Promise.all(a.map(async p=>{await r(p)})),i}var Qp=(0,e2.default)(async(e,t=!1)=>{let{data:{session:a},error:i}=await Ke.auth.getSession(),{access_token:r,refresh_token:p}=a||{};try{let s=await mp(`/api/components/${e}`,{headers:r&&p?{access_token:r,refresh_token:p}:{}});if(s.status===401)throw"unauthorized";return await s.json()}catch(s){throw s==="unauthorized"&&!t?"unauthorized":(console.error("error fetching component:",e),console.error(s),s)}},{promise:!0}),zm=(0,e2.default)(async()=>await(await mp("/api/components")).json());async function Wm(e=!1){if(await l1({message:"To download paid components, you need to sign in to a paid account. Sign in now?"}))try{if(await ca(e))return!0}catch{e||console.error("error logging in:")}return!1}var ae=E(ba(),1),$u="Welcome to ",ju="NativewindUI",t2="type 'help' for help";async function Uu(){let e="\u2500",t="\u250C",a="\u2510",i="\u2514",r="\u2518",p="\u2502",n=`cwd: ${process.cwd()}`,d=$u+ju+"!",o=Math.max(d.length,t2.length,n.length),l=2,u=o+l*2+2,m=t+e.repeat(u-2)+a,f=i+e.repeat(u-2)+r,c=p+" ".repeat(u-2)+p;console.log(""),console.log(ae.default.blue(m)),console.log(ae.default.blue(c)),console.log(ae.default.blue(p)+" ".repeat(l)+$u+ae.default.bold(ju)+"!"+" ".repeat(u-2-l-d.length)+ae.default.blue(p)),console.log(ae.default.blue(c)),console.log(ae.default.blue(p)+" ".repeat(l)+ae.default.italic(t2)+" ".repeat(u-2-l-t2.length)+ae.default.blue(p)),console.log(ae.default.blue(c)),console.log(ae.default.blue(p)+" ".repeat(l)+n+" ".repeat(u-2-l-n.length)+ae.default.blue(p)),console.log(ae.default.blue(c)),console.log(ae.default.blue(f)),console.log("")}var Km={},Mu=async()=>{try{let e=typeof __dirname<"u"?__dirname:ar.default.dirname((0,Gu.fileURLToPath)(Km.url)),t=ar.default.join(e,"../package.json");return JSON.parse(await a2.promises.readFile(t,"utf-8")).version||"unknown"}catch{return"unknown"}},Hm=async()=>{let e=!1;try{!process.argv.includes("--quiet")&&!process.argv.includes("-q")&&await Uu()}catch{e||console.log(`
52
+ `)};var om=1e3*1e3*100,lm=({env:e,extendEnv:t,preferLocal:a,localDir:i,execPath:r})=>{let p=t?{...va.default.env,...e}:e;return a?tl({env:p,cwd:i,execPath:r}):p},Ql=(e,t,a={})=>{let i=Zl.default._parse(e,t,a);return e=i.command,t=i.args,a=i.options,a={maxBuffer:om,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:a.cwd||va.default.cwd(),execPath:va.default.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:Kl,...a},a.env=lm(a),a.stdio=ml(a),va.default.platform==="win32"&&Xl.default.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:a,parsed:i}},ga=(e,t,a)=>typeof t!="string"&&!Jl.Buffer.isBuffer(t)?a===void 0?void 0:"":e.stripFinalNewline?yp(t):t;function k1(e,t,a){let i=Ql(e,t,a),r=Vp(e,t),p=Lp(e,t);jp(p,i.options),vl(i.options);let s;try{s=Hi.default.spawn(i.file,i.args,i.options)}catch(f){let c=new Hi.default.ChildProcess,v=Promise.reject(fa({error:f,stdout:"",stderr:"",all:"",command:r,escapedCommand:p,parsed:i,timedOut:!1,isCanceled:!1,killed:!1}));return Ip(c,v),c}let n=jl(s),d=Dl(s,i.options,n),o=gl(s,i.options,d),l={isCanceled:!1};s.kill=hl.bind(null,s.kill.bind(s)),s.cancel=fl.bind(null,s,l);let m=il(async()=>{let[{error:f,exitCode:c,signal:v,timedOut:h},D,g,y]=await $l(s,i.options,o),C=ga(i.options,D),F=ga(i.options,g),B=ga(i.options,y);if(f||c!==0||v!==null){let T=fa({error:f,exitCode:c,signal:v,stdout:C,stderr:F,all:B,command:r,escapedCommand:p,parsed:i,timedOut:h,isCanceled:l.isCanceled||(i.options.signal?i.options.signal.aborted:!1),killed:s.killed});if(!i.options.reject)return T;throw T}return{command:r,escapedCommand:p,exitCode:0,stdout:C,stderr:F,all:B,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return Vl(s,i.options),s.all=Ll(s,i.options),Fl(s),Ip(s,m),s}function um(e,t,a){let i=Ql(e,t,a),r=Vp(e,t),p=Lp(e,t);jp(p,i.options);let s=Il(i.options),n;try{n=Hi.default.spawnSync(i.file,i.args,{...i.options,input:s})}catch(l){throw fa({error:l,stdout:"",stderr:"",all:"",command:r,escapedCommand:p,parsed:i,timedOut:!1,isCanceled:!1,killed:!1})}let d=ga(i.options,n.stdout,n.error),o=ga(i.options,n.stderr,n.error);if(n.error||n.status!==0||n.signal!==null){let l=fa({stdout:d,stderr:o,error:n.error,signal:n.signal,exitCode:n.status,command:r,escapedCommand:p,parsed:i,timedOut:n.error&&n.error.code==="ETIMEDOUT",isCanceled:!1,killed:n.signal!==null});if(!i.options.reject)return l;throw l}return{command:r,escapedCommand:p,exitCode:0,stdout:d,stderr:o,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}}var mm=({input:e,inputFile:t,stdio:a})=>e===void 0&&t===void 0&&a===void 0?{stdin:"inherit"}:{},Yl=(e={})=>({preferLocal:!0,...mm(e),...e});function eu(e){function t(a,...i){if(!Array.isArray(a))return eu({...e,...a});let[r,...p]=$p(a,i);return k1(r,p,Yl(e))}return t.sync=(a,...i)=>{if(!Array.isArray(a))throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");let[r,...p]=$p(a,i);return um(r,p,Yl(e))},t}var rg=eu();var e2=E(require("memoizee"),1);ht();var tr=E(Xp(),1);ht();var ku=E(Xp(),1);function Pu(...e){console.warn(...e.map(t=>ku.default.yellow(t)))}function er(...e){console.log(...e)}var Zp,Iu=e=>{Zp=e},Lm=(e,t)=>k1(e,t,Zp?{cwd:Zp}:void 0);async function Vu(){return await $m()||$.EXPO_NO_GIT_STATUS?!1:(er(),await l1({message:"Continue with uncommited changes?"})?(er(),!1):!0)}async function $m(){let e="unknown";try{e=(await Lm("git",["status","--porcelain"])).stdout===""?"clean":"dirty"}catch{}return e==="clean"?!0:(e==="dirty"?$.EXPO_QUIET||Ru("Git branch has uncommited file changes","It's recommended to commit all changes before proceeding in case you want to revert generated changes."):$.EXPO_QUIET||Ru("No git repo found in current directory","Use git to track file changes before running commands that modify project files."),!1)}function Ru(e,t){$.EXPO_QUIET||(Pu(tr.default.bold`! `+e),er(tr.default.gray`\u203A `+tr.default.gray(t)))}var Lu=async(e,t=!1,a=`.${n1.sep}`,i=!1,r=!1,p=!1,s=!1)=>{let n=n1.resolve(a),d=Be({text:"Fetching component metadata...",isSilent:s});s||d.start();let o=await zm(),l=o.filter(h=>!h.free).map(h=>h.slug),u=new Set((await Promise.all(e.map(async h=>{if(["paid","free","all"].includes(h)){let D=o.slice().filter(g=>g.type!=="screen");return h!=="all"&&(D=D.filter(g=>g.free===(h==="free"))),D.map(g=>g.slug)}return h==="screens"?o.filter(D=>D.type==="screen").map(D=>D.slug):[h]}))).flat());if(Array.from(u).some(h=>l.includes(h))&&!await Pi()&&(s||d.stop(),!await Wm(s)))throw"unauthenticated";s||d.stopAndPersist({text:"Received component metadata."}),d=Be({text:"Checking for expo-router...",isSilent:s}),s||d.start();try{await k1("npm",["ls","expo-router"],{cwd:n}),await te.promises.access(n1.join(n,`app${n1.sep}`)),s||d.stopAndPersist({text:"Found expo-router."})}catch(h){if(s||d.stop(),h?.code==="ENOENT"||h?.exitCode===1){if(!r&&!await l1({message:"The working directory provided does not appear to be an expo-router project. Continue anyway?"}))throw"aborted";s||d.stopAndPersist({text:"Ignored expo-router."})}else throw s||console.error("error:",h),h}try{if(Iu(n),await Vu())return}catch(h){s||console.error("error checking git:",h);return}let m=await qm(u,i);$.NODE_ENV==="development"&&(console.log("components:",u),console.log("resolution:",m)),d=Be({text:"Installing libraries and primitives...",isSilent:s}),s||d.start();let f=Array.from(m.libraries).concat(Array.from(m.primitives));if(f.length>0)try{let h=["expo","install"],D=["--silent","--no-audit","--progress=false","--legacy-peer-deps"],g=!1,y=!1;if(p){if(h.push("--npm",...f,"--","--package-lock-only","--no-package-lock",...D),$.NODE_ENV==="development"&&console.log("lockfile:",se(n,"package-lock.json")),await te.promises.access(se(n,"package-lock.json")).then(()=>!0).catch(()=>!1)||(g=!0),!await te.promises.access(se(n,"node_modules")).then(()=>!0).catch(()=>!1)){y=!0;let T=await k1("npm",["install",...D],{cwd:n});if(T.exitCode!==0)throw s||d.stop(),s||console.log(T.all),s||console.error("command:",T.command),`npx expo install failed with exit code ${T.exitCode}`}}else await te.promises.access(se(n,"package-lock.json")).then(()=>!0).catch(()=>!1)?h.push("--npm",...f,"--","--legacy-peer-deps"):h.push(...f);$.NODE_ENV==="development"&&console.log("> npx",h);let C=await k1("npx",h,{cwd:n});if(C.exitCode!==0)throw s||d.stop(),s||console.log(C.all),s||console.error("command:",C.command),`npx expo install failed with exit code ${C.exitCode}`;g&&(await te.promises.rm(se(n,"package-lock.json"),{force:!0}),$.NODE_ENV==="development"&&console.log("deleted package-lock.json")),y&&(await te.promises.rm(se(n,"node_modules"),{recursive:!0,force:!0}),$.NODE_ENV==="development"&&console.log("deleted node_modules"))}catch(h){if(h)throw s||console.error(h),"npx expo install failed"}s||d.stopAndPersist({text:"Libraries and primitives successfully installed."}),d=Be({text:"Installing component files...",isSilent:s}),s||d.start();let c=Array.from(m.components.entries()).flatMap(([h,D])=>D.additionalFiles||[]),v=new Set(c.map(h=>h.path.replace(/[/][^/]*$/,"")));for(let h of v)try{await te.promises.mkdir(se(n,h),{recursive:!0})}catch(D){throw typeof D=="object"&&D&&"code"in D&&D.code==="EEXIST"?`a file exists at the same path where a directory needs to exists: ${h}`:D}for(let h of c){if(h.path==="@/app/_layout.tsx")continue;let D=se(n,h.path);if(!t)try{throw await te.promises.access(D),"file exists"}catch(g){if(g==="file exists"&&(s||d.stop(),!await l1({message:`File at path ${h.path} already exists, overwrite it?`}))){s||console.log("Skipped file",h.path),s||d.start();continue}}try{await te.promises.writeFile(se(n,h.path),h.code)}catch(g){throw g}}s||d.stopAndPersist({text:"Component files installed."}),await Mm(m,n,s),i&&await Gm(m,n,t,s),s||console.log(""),s||console.log("If you're looking to move even faster, I may be able to help!"),s||console.log("- dan@ronindevs.com")},se=(e,t)=>n1.join(e,...t.replace(/^[@][/]/,"").split("/")),Um=[["selectable-text","text"]];async function Mm(e,t,a=!1){let i=Be({text:"Cleaning up old files...",isSilent:a});a||i.start();let r="@/components/nativewindui/examples";try{await te.promises.access(se(t,r)).catch(()=>{throw $.NODE_ENV==="development"&&console.log("no examples folder found"),"examples not found"});let p=Array.from(e.components.entries()).map(([s,n])=>s);Um.forEach(([s,n])=>{p.includes(n)&&p.push(s)});for(let s of p){let n=`${r}/${s}.tsx`,d=se(t,n);try{await te.promises.rm(d,{force:!0})}catch(o){$.NODE_ENV==="development"&&console.error(`error cleaning up old example file ${s}:`,o)}}}catch(p){p!=="examples not found"&&(a||console.error("error cleaning up depreated files:",p?p.message||p:"unknown"))}a||i.stopAndPersist({text:"Cleaned up old files."})}async function Gm(e,t,a,i=!1){let r=Be({text:"Installing example files...",isSilent:i});i||r.start();let p="@/components/nativewindui-examples";try{await te.promises.mkdir(se(t,p),{recursive:!0})}catch(n){throw typeof n=="object"&&n&&"code"in n&&n.code==="EEXIST"?`a file exists at the same path where a directory needs to exists: ${p}`:n}let s=Array.from(e.components.entries()).map(([n,d])=>({slug:n,code:d.type==="component"?d.implementationCode:null}));for(let n of s){if(!n.code)continue;let d=`${p}/${n.slug}.tsx`,o=se(t,d);if(!a)try{throw await te.promises.access(o),"file exists"}catch(l){if(l==="file exists"&&(i||r.stop(),!await l1({message:`File at path ${d} already exists, overwrite it?`}))){i||console.log("Skipped file",d),i||r.start();continue}}try{await te.promises.writeFile(se(t,d),n.code)}catch(l){throw l}}i||r.stopAndPersist({text:`Example usage files installed to ${p}`})}async function qm(e,t){let a=await Promise.all(Array.from(e).map(async p=>{try{return await Qp(p)}catch(s){throw console.error("error grabbing component:",s),s}}));if(t){let p=new Set(a.flatMap(s=>s.type!=="component"?[]:(s.exampleDependencies||[]).filter(n=>n.type==="component").filter(n=>!e.has(n.name)).map(n=>n.url.replace("/component/",""))));a.push(...await Promise.all(Array.from(p).map(async s=>{try{return await Qp(s)}catch(n){throw console.error("error grabbing component:",n),n}})))}let i={libraries:new Set,primitives:new Set,components:new Map};for(let p of a)i.components.set(p.slug,p);async function r(p){let s=p.dependencies||[];t&&p.type==="component"&&s.push(...(p.exampleDependencies||[]).filter(n=>n.type!="component")),await Promise.all(s.map(async n=>{switch(n.type){case"library":i.libraries.add(n.name);break;case"primitive":i.primitives.add(n.name);break;case"component":let d=n.url.replace("/component/",""),o=i.components.get(d)||await Qp(d,!0);i.components.set(d,o),await r(o);break}}))}return await Promise.all(a.map(async p=>{await r(p)})),i}var Qp=(0,e2.default)(async(e,t=!1)=>{let{data:{session:a},error:i}=await Ke.auth.getSession(),{access_token:r,refresh_token:p}=a||{};try{let s=await mp(`/api/components/${e}`,{headers:r&&p?{access_token:r,refresh_token:p}:{}});if(s.status===401)throw"unauthorized";return await s.json()}catch(s){throw s==="unauthorized"&&!t?"unauthorized":(console.error("error fetching component:",e),console.error(s),s)}},{promise:!0}),zm=(0,e2.default)(async()=>await(await mp("/api/components")).json());async function Wm(e=!1){if(await l1({message:"To download paid components, you need to sign in to a paid account. Sign in now?"}))try{if(await ca(e))return!0}catch{e||console.error("error logging in:")}return!1}var ae=E(ba(),1),$u="Welcome to ",ju="NativewindUI",t2="type 'help' for help";async function Uu(){let e="\u2500",t="\u250C",a="\u2510",i="\u2514",r="\u2518",p="\u2502",n=`cwd: ${process.cwd()}`,d=$u+ju+"!",o=Math.max(d.length,t2.length,n.length),l=2,u=o+l*2+2,m=t+e.repeat(u-2)+a,f=i+e.repeat(u-2)+r,c=p+" ".repeat(u-2)+p;console.log(""),console.log(ae.default.blue(m)),console.log(ae.default.blue(c)),console.log(ae.default.blue(p)+" ".repeat(l)+$u+ae.default.bold(ju)+"!"+" ".repeat(u-2-l-d.length)+ae.default.blue(p)),console.log(ae.default.blue(c)),console.log(ae.default.blue(p)+" ".repeat(l)+ae.default.italic(t2)+" ".repeat(u-2-l-t2.length)+ae.default.blue(p)),console.log(ae.default.blue(c)),console.log(ae.default.blue(p)+" ".repeat(l)+n+" ".repeat(u-2-l-n.length)+ae.default.blue(p)),console.log(ae.default.blue(c)),console.log(ae.default.blue(f)),console.log("")}var Km={},Mu=async()=>{try{let e=typeof __dirname<"u"?__dirname:ar.default.dirname((0,Gu.fileURLToPath)(Km.url)),t=ar.default.join(e,"../package.json");return JSON.parse(await a2.promises.readFile(t,"utf-8")).version||"unknown"}catch{return"unknown"}},Hm=async()=>{let e=!1;try{!process.argv.includes("--quiet")&&!process.argv.includes("-q")&&await Uu()}catch{e||console.log(`
53
53
  ${b.default.blue("welcome to the")} ${b.default.cyan("nativewindui cli")}`)}try{switch(process.argv[2]){case"add":let t=process.argv.slice(3),a=!1,i=!1,r=!1,p=!1,s;for(;["--big-examples-with-deps","--overwrite","--yes","-d","--no-install","--quiet","-q"].includes(t[0]);)switch(t[0]){case"--quiet":case"-q":e=!0,$.EXPO_QUIET=!0,t.shift();break;case"--big-examples-with-deps":i=!0,t.shift();break;case"--no-install":a=!0,t.shift();break;case"--overwrite":r=!0,t.shift();break;case"--yes":r=!0,p=!0,$.EXPO_NO_GIT_STATUS=!0,t.shift();break;case"--directory":case"-d":if(t.shift(),!await a2.promises.access(ar.default.resolve(t[0])).then(()=>!0).catch(()=>!1))throw"provided directory does not exist.";s=t[0],t.shift();break;default:break}await Lu(t,r,s,i,p,a,e);break;case"init":let n=`${$.API_BASE_URL}/installation/manual`;e||(console.log(`To setup Nativewind UI, follow the instructions at ${n}`),await Ba({message:"Go there now?"})&&(await import("open")).default(n));break;case"login":if(!e&&await Pi()&&!await Ba({message:"You are already logged in. Login again?"}))return;await ca(e);break;case"logout":await mo(e);break;case"version":case"--version":case"-v":let d=await Mu();console.log(d);break;case"help":e||(console.log(`${b.default.cyan(b.default.bold("NativewindUI CLI"))}`),console.log(`Native feeling components and templates for React Native/Expo built with Nativewind
54
54
  `),console.log(`${b.default.green("Usage:")}`),console.log(` nwui-cli ${b.default.yellow("<command>")} ${b.default.gray("[options]")}
55
55
  `),console.log(`${b.default.green("Commands:")}`),console.log(` ${b.default.yellow("add")} ${b.default.gray("Add components to your project")}`),console.log(` ${b.default.yellow("init")} ${b.default.gray("Initialize NativewindUI in your project")}`),console.log(` ${b.default.yellow("login")} ${b.default.gray("Authenticate with NativewindUI")}`),console.log(` ${b.default.yellow("logout")} ${b.default.gray("Sign out of NativewindUI")}`),console.log(` ${b.default.yellow("version")} ${b.default.gray("Show version information")}`),console.log(` ${b.default.yellow("help")} ${b.default.gray("Show this help message")}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nwui-cli",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "NativewindUI CLI",
5
5
  "type": "module",
6
6
  "main": "./build/index.cjs",