shadcn-svelte 0.14.0 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +66 -66
- package/package.json +2 -4
package/dist/index.js
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var Cr=Object.create;var ot=Object.defineProperty;var Ar=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Sr=Object.getPrototypeOf,Ir=Object.prototype.hasOwnProperty;var ut=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var Or=(e,n,r,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of Tr(n))!Ir.call(e,i)&&i!==r&&ot(e,i,{get:()=>n[i],enumerable:!(t=Ar(n,i))||t.enumerable});return e};var lt=(e,n,r)=>(r=e!=null?Cr(Sr(e)):{},Or(n||!e||!e.__esModule?ot(r,"default",{value:e,enumerable:!0}):r,e));var Ot=ut((ro,It)=>{"use strict";var Pn="\x1B",I=`${Pn}[`,vi="\x07",jn={to(e,n){return n?`${I}${n+1};${e+1}H`:`${I}${e+1}G`},move(e,n){let r="";return e<0?r+=`${I}${-e}D`:e>0&&(r+=`${I}${e}C`),n<0?r+=`${I}${-n}A`:n>0&&(r+=`${I}${n}B`),r},up:(e=1)=>`${I}${e}A`,down:(e=1)=>`${I}${e}B`,forward:(e=1)=>`${I}${e}C`,backward:(e=1)=>`${I}${e}D`,nextLine:(e=1)=>`${I}E`.repeat(e),prevLine:(e=1)=>`${I}F`.repeat(e),left:`${I}G`,hide:`${I}?25l`,show:`${I}?25h`,save:`${Pn}7`,restore:`${Pn}8`},gi={up:(e=1)=>`${I}S`.repeat(e),down:(e=1)=>`${I}T`.repeat(e)},bi={screen:`${I}2J`,up:(e=1)=>`${I}1J`.repeat(e),down:(e=1)=>`${I}J`.repeat(e),line:`${I}2K`,lineEnd:`${I}K`,lineStart:`${I}1K`,lines(e){let n="";for(let r=0;r<e;r++)n+=this.line+(r<e-1?jn.up():"");return e&&(n+=jn.left),n}};It.exports={cursor:jn,scroll:gi,erase:bi,beep:vi}});var yr=ut((su,fr)=>{"use strict";function sr(e){return Array.isArray(e)?e:[e]}var Jn="",or=" ",zn="\\",us=/^\s+$/,ls=/(?:[^\\]|^)\\$/,as=/^\\!/,cs=/^\\#/,ps=/\r?\n/g,fs=/^\.*\/|^\.+$/,Xn="/",ar="node-ignore";typeof Symbol<"u"&&(ar=Symbol.for("node-ignore"));var ur=ar,ys=(e,n,r)=>Object.defineProperty(e,n,{value:r}),ms=/([0-z])-([0-z])/g,cr=()=>!1,hs=e=>e.replace(ms,(n,r,t)=>r.charCodeAt(0)<=t.charCodeAt(0)?n:Jn),ds=e=>{let{length:n}=e;return e.slice(0,n-n%2)},vs=[[/^\uFEFF/,()=>Jn],[/\\?\s+$/,e=>e.indexOf("\\")===0?or:Jn],[/\\\s/g,()=>or],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,n,r)=>n+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,n,r)=>{let t=r.replace(/\\\*/g,"[^\\/]*");return n+t}],[/\\\\\\(?=[$.|*+(){^])/g,()=>zn],[/\\\\/g,()=>zn],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,n,r,t,i)=>n===zn?`\\[${r}${ds(t)}${i}`:i==="]"&&t.length%2===0?`[${hs(r)}${t}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,n)=>`${n?`${n}[^/]+`:"[^/]*"}(?=$|\\/$)`]],lr=Object.create(null),gs=(e,n)=>{let r=lr[e];return r||(r=vs.reduce((t,i)=>t.replace(i[0],i[1].bind(e)),e),lr[e]=r),n?new RegExp(r,"i"):new RegExp(r)},Yn=e=>typeof e=="string",bs=e=>e&&Yn(e)&&!us.test(e)&&!ls.test(e)&&e.indexOf("#")!==0,ks=e=>e.split(ps),Kn=class{constructor(n,r,t,i){this.origin=n,this.pattern=r,this.negative=t,this.regex=i}},$s=(e,n)=>{let r=e,t=!1;e.indexOf("!")===0&&(t=!0,e=e.substr(1)),e=e.replace(as,"!").replace(cs,"#");let i=gs(e,n);return new Kn(r,e,t,i)},xs=(e,n)=>{throw new n(e)},H=(e,n,r)=>Yn(e)?e?H.isNotRelative(e)?r(`path should be a \`path.relative()\`d string, but got "${n}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${n}\``,TypeError),pr=e=>fs.test(e);H.isNotRelative=pr;H.convert=e=>e;var Hn=class{constructor({ignorecase:n=!0,ignoreCase:r=n,allowRelativePaths:t=!1}={}){ys(this,ur,!0),this._rules=[],this._ignoreCase=r,this._allowRelativePaths=t,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(n){if(n&&n[ur]){this._rules=this._rules.concat(n._rules),this._added=!0;return}if(bs(n)){let r=$s(n,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(n){return this._added=!1,sr(Yn(n)?ks(n):n).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(n){return this.add(n)}_testOne(n,r){let t=!1,i=!1;return this._rules.forEach(s=>{let{negative:o}=s;if(i===o&&t!==i||o&&!t&&!i&&!r)return;s.regex.test(n)&&(t=!o,i=o)}),{ignored:t,unignored:i}}_test(n,r,t,i){let s=n&&H.convert(n);return H(s,n,this._allowRelativePaths?cr:xs),this._t(s,r,t,i)}_t(n,r,t,i){if(n in r)return r[n];if(i||(i=n.split(Xn)),i.pop(),!i.length)return r[n]=this._testOne(n,t);let s=this._t(i.join(Xn)+Xn,r,t,i);return r[n]=s.ignored?s:this._testOne(n,t)}ignores(n){return this._test(n,this._ignoreCache,!1).ignored}createFilter(){return n=>!this.ignores(n)}filter(n){return sr(n).filter(this.createFilter())}test(n){return this._test(n,this._testCache,!0)}},pn=e=>new Hn(e),_s=e=>H(e&&H.convert(e),e,cr);pn.isPathValid=_s;pn.default=pn;fr.exports=pn;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let e=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");H.convert=e;let n=/^[a-z]:\//i;H.isNotRelative=r=>n.test(r)||pr(r)}});import Se from"process";import{Command as Ws}from"commander";import{existsSync as fn,promises as et}from"fs";import ue from"path";import ne from"process";import q from"chalk";import{Command as Ts}from"commander";import{execa as Ss}from"execa";var dn;function Pr(e){return{lang:e?.lang??dn?.lang,message:e?.message,abortEarly:e?.abortEarly??dn?.abortEarly,abortPipeEarly:e?.abortPipeEarly??dn?.abortPipeEarly}}var jr;function Dr(e){return jr?.get(e)}var Rr;function Lr(e){return Rr?.get(e)}var Nr;function Fr(e,n){return Nr?.get(e)?.get(n)}function at(e){let n=typeof e;return n==="string"?`"${e}"`:n==="number"||n==="bigint"||n==="boolean"?`${e}`:n==="object"||n==="function"?(e&&Object.getPrototypeOf(e)?.constructor?.name)??"null":n}function ae(e,n,r,t,i){let s=i&&"input"in i?i.input:r.value,o=i?.expected??e.expects??null,u=i?.received??at(s),p={kind:e.kind,type:e.type,input:s,expected:o,received:u,message:`Invalid ${n}: ${o?`Expected ${o} but r`:"R"}eceived ${u}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:t.lang,abortEarly:t.abortEarly,abortPipeEarly:t.abortPipeEarly},f=e.kind==="schema",b=i?.message??e.message??Fr(e.reference,p.lang)??(f?Lr(p.lang):null)??t.message??Dr(p.lang);b&&(p.message=typeof b=="function"?b(p):b),f&&(r.typed=!1),r.issues?r.issues.push(p):r.issues=[p]}function Vr(e,n){return Object.hasOwn(e,n)&&n!=="__proto__"&&n!=="prototype"&&n!=="constructor"}var Mr=class extends Error{issues;constructor(e){super(e[0].message),this.name="ValiError",this.issues=e}};function qe(e){return{kind:"transformation",type:"transform",reference:qe,async:!1,operation:e,_run(n){return n.value=this.operation(n.value),n}}}function Gr(e,n,r){return typeof e.default=="function"?e.default(n,r):e.default}function W(e,n){return{kind:"schema",type:"array",reference:W,expects:"Array",async:!1,item:e,message:n,_run(r,t){let i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let s=0;s<i.length;s++){let o=i[s],u=this.item._run({typed:!1,value:o},t);if(u.issues){let p={type:"array",origin:"value",input:i,key:s,value:o};for(let f of u.issues)f.path?f.path.unshift(p):f.path=[p],r.issues?.push(f);if(r.issues||(r.issues=u.issues),t.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),r.value.push(u.value)}}else ae(this,"type",r,t);return r}}}function z(e){return{kind:"schema",type:"boolean",reference:z,expects:"boolean",async:!1,message:e,_run(n,r){return typeof n.value=="boolean"?n.typed=!0:ae(this,"type",n,r),n}}}function S(e,n){return{kind:"schema",type:"object",reference:S,expects:"Object",async:!1,entries:e,message:n,_run(r,t){let i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(let s in this.entries){let o=i[s],u=this.entries[s]._run({typed:!1,value:o},t);if(u.issues){let p={type:"object",origin:"value",input:i,key:s,value:o};for(let f of u.issues)f.path?f.path.unshift(p):f.path=[p],r.issues?.push(f);if(r.issues||(r.issues=u.issues),t.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),(u.value!==void 0||s in i)&&(r.value[s]=u.value)}}else ae(this,"type",r,t);return r}}}function F(e,...n){let r={kind:"schema",type:"optional",reference:F,expects:`${e.expects} | undefined`,async:!1,wrapped:e,_run(t,i){return t.value===void 0&&("default"in this&&(t.value=Gr(this,t,i)),t.value===void 0)?(t.typed=!0,t):this.wrapped._run(t,i)}};return 0 in n&&(r.default=n[0]),r}function vn(e,n){return{kind:"schema",type:"picklist",reference:vn,expects:e.map(at).join(" | ")||"never",async:!1,options:e,message:n,_run(r,t){return this.options.includes(r.value)?r.typed=!0:ae(this,"type",r,t),r}}}function ce(e,n,r){return{kind:"schema",type:"record",reference:ce,expects:"Object",async:!1,key:e,value:n,message:r,_run(t,i){let s=t.value;if(s&&typeof s=="object"){t.typed=!0,t.value={};for(let o in s)if(Vr(s,o)){let u=s[o],p=this.key._run({typed:!1,value:o},i);if(p.issues){let b={type:"object",origin:"key",input:s,key:o,value:u};for(let h of p.issues)h.path=[b],t.issues?.push(h);if(t.issues||(t.issues=p.issues),i.abortEarly){t.typed=!1;break}}let f=this.value._run({typed:!1,value:u},i);if(f.issues){let b={type:"object",origin:"value",input:s,key:o,value:u};for(let h of f.issues)h.path?h.path.unshift(b):h.path=[b],t.issues?.push(h);if(t.issues||(t.issues=f.issues),i.abortEarly){t.typed=!1;break}}(!p.typed||!f.typed)&&(t.typed=!1),p.typed&&(t.value[p.value]=f.value)}}else ae(this,"type",t,i);return t}}}function g(e){return{kind:"schema",type:"string",reference:g,expects:"string",async:!1,message:e,_run(n,r){return typeof n.value=="string"?n.typed=!0:ae(this,"type",n,r),n}}}function M(e,n,r){let t=e._run({typed:!1,value:n},Pr(r));if(t.issues)throw new Mr(t.issues);return t.value}function gn(...e){return{...e[0],pipe:e,_run(n,r){for(let t=0;t<e.length;t++){if(n.issues&&(e[t].kind==="schema"||e[t].kind==="transformation")){n.typed=!1;break}(!n.issues||!r.abortEarly&&!r.abortPipeEarly)&&(n=e[t]._run(n,r))}return n}}}import zt from"fs";import un from"path";import Re from"chalk";import x from"path";import Tn from"fs";import Yr from"module";var ct=e=>e!==null&&typeof e=="object",fe=(e,n)=>Object.assign(new Error(`[${e}]: ${n}`),{code:e}),pt="ERR_INVALID_PACKAGE_CONFIG",bn="ERR_INVALID_PACKAGE_TARGET",Ur="ERR_PACKAGE_PATH_NOT_EXPORTED";var Br=/^\d+$/,qr=/^(\.{1,2}|node_modules)$/i,Wr=/\/|\\/,ft=(e=>(e.Export="exports",e.Import="imports",e))(ft||{}),kn=(e,n,r,t,i)=>{if(n==null)return[];if(typeof n=="string"){let[s,...o]=n.split(Wr);if(s===".."||o.some(u=>qr.test(u)))throw fe(bn,`Invalid "${e}" target "${n}" defined in the package config`);return[i?n.replace(/\*/g,i):n]}if(Array.isArray(n))return n.flatMap(s=>kn(e,s,r,t,i));if(ct(n)){for(let s of Object.keys(n)){if(Br.test(s))throw fe(pt,"Cannot contain numeric property keys");if(s==="default"||t.includes(s))return kn(e,n[s],r,t,i)}return[]}throw fe(bn,`Invalid "${e}" target "${n}"`)},Ie="*",zr=(e,n)=>{let r=e.indexOf(Ie),t=n.indexOf(Ie);return r===t?n.length>e.length:t>r};function Xr(e,n){if(!n.includes(Ie)&&e.hasOwnProperty(n))return[n];let r,t;for(let i of Object.keys(e))if(i.includes(Ie)){let[s,o,u]=i.split(Ie);if(u===void 0&&n.startsWith(s)&&n.endsWith(o)){let p=n.slice(s.length,-o.length||void 0);p&&(!r||zr(r,i))&&(r=i,t=p)}}return[r,t]}var Jr=e=>Object.keys(e).reduce((n,r)=>{let t=r===""||r[0]!==".";if(n===void 0||n===t)return t;throw fe(pt,'"exports" cannot contain some keys starting with "." and some not')},void 0),Kr=/^\w+:/,yt=(e,n,r)=>{if(!e)throw new Error('"exports" is required');n=n===""?".":`./${n}`,(typeof e=="string"||Array.isArray(e)||ct(e)&&Jr(e))&&(e={".":e});let[t,i]=Xr(e,n),s=kn(ft.Export,e[t],n,r,i);if(s.length===0)throw fe(Ur,n==="."?'No "exports" main defined':`Package subpath '${n}' is not defined by "exports"`);for(let o of s)if(!o.startsWith("./")&&!Kr.test(o))throw fe(bn,`Invalid "exports" target "${o}" defined in the package config`);return s};var Hr=Object.defineProperty,v=(e,n)=>Hr(e,"name",{value:n,configurable:!0});function B(e){return e.startsWith("\\\\?\\")?e:e.replace(/\\/g,"/")}v(B,"slash");var In=v(e=>{let n=Tn[e];return(r,...t)=>{let i=`${e}:${t.join(":")}`,s=r?.get(i);return s===void 0&&(s=Reflect.apply(n,Tn,t),r?.set(i,s)),s}},"cacheFs"),J=In("existsSync"),Zr=In("readFileSync"),We=In("statSync"),_t=v((e,n,r)=>{for(;;){let t=x.posix.join(e,n);if(J(r,t))return t;let i=x.dirname(e);if(i===e)return;e=i}},"findUp"),On=/^\.{1,2}(\/.*)?$/,$n=v(e=>{let n=B(e);return On.test(n)?n:`./${n}`},"normalizePath");function wt(e,n=!1){let r=e.length,t=0,i="",s=0,o=16,u=0,p=0,f=0,b=0,h=0;function k(m,E){let $=0,A=0;for(;$<m||!E;){let L=e.charCodeAt(t);if(L>=48&&L<=57)A=A*16+L-48;else if(L>=65&&L<=70)A=A*16+L-65+10;else if(L>=97&&L<=102)A=A*16+L-97+10;else break;t++,$++}return $<m&&(A=-1),A}v(k,"scanHexDigits");function y(m){t=m,i="",s=0,o=16,h=0}v(y,"setPosition");function a(){let m=t;if(e.charCodeAt(t)===48)t++;else for(t++;t<e.length&&ie(e.charCodeAt(t));)t++;if(t<e.length&&e.charCodeAt(t)===46)if(t++,t<e.length&&ie(e.charCodeAt(t)))for(t++;t<e.length&&ie(e.charCodeAt(t));)t++;else return h=3,e.substring(m,t);let E=t;if(t<e.length&&(e.charCodeAt(t)===69||e.charCodeAt(t)===101))if(t++,(t<e.length&&e.charCodeAt(t)===43||e.charCodeAt(t)===45)&&t++,t<e.length&&ie(e.charCodeAt(t))){for(t++;t<e.length&&ie(e.charCodeAt(t));)t++;E=t}else h=3;return e.substring(m,E)}v(a,"scanNumber");function c(){let m="",E=t;for(;;){if(t>=r){m+=e.substring(E,t),h=2;break}let $=e.charCodeAt(t);if($===34){m+=e.substring(E,t),t++;break}if($===92){if(m+=e.substring(E,t),t++,t>=r){h=2;break}switch(e.charCodeAt(t++)){case 34:m+='"';break;case 92:m+="\\";break;case 47:m+="/";break;case 98:m+="\b";break;case 102:m+="\f";break;case 110:m+=`
|
|
3
|
-
`;break;case 114:m+="\r";break;case 116:m+=" ";break;case 117:let
|
|
4
|
-
`),u++,f=t,o=14;switch(m){case 123:return t++,o=1;case 125:return t++,o=2;case 91:return t++,o=3;case 93:return t++,o=4;case 58:return t++,o=6;case 44:return t++,o=5;case 34:return t++,i=
|
|
5
|
-
`+" ".repeat(n)),new Array(
|
|
6
|
-
`+" ".repeat(n)),new Array(
|
|
7
|
-
`+" ".repeat(n)),new Array(
|
|
8
|
-
`+" ".repeat(n));var Ke;(function(e){e.DEFAULT={allowTrailingComma:!1}})(Ke||(Ke={}));function Et(e,n=[],r=Ke.DEFAULT){let t=null,i=[],s=[];function o(u){Array.isArray(i)?i.push(u):t!==null&&(i[t]=u)}return v(o,"onValue"),Ct(e,{onObjectBegin:()=>{let u={};o(u),s.push(i),i=u,t=null},onObjectProperty:u=>{t=u},onObjectEnd:()=>{i=s.pop()},onArrayBegin:()=>{let u=[];o(u),s.push(i),i=u,t=null},onArrayEnd:()=>{i=s.pop()},onLiteralValue:o,onError:(u,p,f)=>{n.push({error:u,offset:p,length:f})}},r),i[0]}v(Et,"parse$1");function Ct(e,n,r=Ke.DEFAULT){let t=wt(e,!1),i=[];function s(C){return C?()=>C(t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter()):()=>!0}v(s,"toNoArgVisit");function o(C){return C?()=>C(t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter(),()=>i.slice()):()=>!0}v(o,"toNoArgVisitWithPath");function u(C){return C?N=>C(N,t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter()):()=>!0}v(u,"toOneArgVisit");function p(C){return C?N=>C(N,t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter(),()=>i.slice()):()=>!0}v(p,"toOneArgVisitWithPath");let f=o(n.onObjectBegin),b=p(n.onObjectProperty),h=s(n.onObjectEnd),k=o(n.onArrayBegin),y=s(n.onArrayEnd),a=p(n.onLiteralValue),c=u(n.onSeparator),d=s(n.onComment),w=u(n.onError),R=r&&r.disallowComments,m=r&&r.allowTrailingComma;function E(){for(;;){let C=t.scan();switch(t.getTokenError()){case 4:$(14);break;case 5:$(15);break;case 3:$(13);break;case 1:R||$(11);break;case 2:$(12);break;case 6:$(16);break}switch(C){case 12:case 13:R?$(10):d();break;case 16:$(1);break;case 15:case 14:break;default:return C}}}v(E,"scanNext");function $(C,N=[],st=[]){if(w(C),N.length+st.length>0){let Be=t.getToken();for(;Be!==17;){if(N.indexOf(Be)!==-1){E();break}else if(st.indexOf(Be)!==-1)break;Be=E()}}}v($,"handleError");function A(C){let N=t.getTokenValue();return C?a(N):(b(N),i.push(N)),E(),!0}v(A,"parseString");function L(){switch(t.getToken()){case 11:let C=t.getTokenValue(),N=Number(C);isNaN(N)&&($(2),N=0),a(N);break;case 7:a(null);break;case 8:a(!0);break;case 9:a(!1);break;default:return!1}return E(),!0}v(L,"parseLiteral");function Ge(){return t.getToken()!==10?($(3,[],[2,5]),!1):(A(!1),t.getToken()===6?(c(":"),E(),Ue()||$(4,[],[2,5])):$(5,[],[2,5]),i.pop(),!0)}v(Ge,"parseProperty");function rt(){f(),E();let C=!1;for(;t.getToken()!==2&&t.getToken()!==17;){if(t.getToken()===5){if(C||$(4,[],[]),c(","),E(),t.getToken()===2&&m)break}else C&&$(6,[],[]);Ge()||$(4,[],[2,5]),C=!0}return h(),t.getToken()!==2?$(7,[2],[]):E(),!0}v(rt,"parseObject");function it(){k(),E();let C=!0,N=!1;for(;t.getToken()!==4&&t.getToken()!==17;){if(t.getToken()===5){if(N||$(4,[],[]),c(","),E(),t.getToken()===4&&m)break}else N&&$(6,[],[]);C?(i.push(0),C=!1):i[i.length-1]++,Ue()||$(4,[],[4,5]),N=!0}return y(),C||i.pop(),t.getToken()!==4?$(8,[4],[]):E(),!0}v(it,"parseArray");function Ue(){switch(t.getToken()){case 3:return it();case 1:return rt();case 10:return A(!0);default:return L()}}return v(Ue,"parseValue"),E(),t.getToken()===17?r.allowEmptyContent?!0:($(4,[],[]),!1):Ue()?(t.getToken()!==17&&$(9,[],[]),!0):($(4,[],[]),!1)}v(Ct,"visit");var ht;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(ht||(ht={}));var dt;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(dt||(dt={}));var Qr=Et,vt;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(vt||(vt={}));var At=v((e,n)=>Qr(Zr(n,e,"utf8")),"readJsonc"),Sn=Symbol("implicitBaseUrl"),ei=v(()=>{let{findPnpApi:e}=Yr;return e&&e(process.cwd())},"getPnpApi"),xn=v((e,n,r,t)=>{let i=`resolveFromPackageJsonPath:${e}:${n}:${r}`;if(t!=null&&t.has(i))return t.get(i);let s=At(e,t);if(!s)return;let o=n||"tsconfig.json";if(!r&&s.exports)try{let[u]=yt(s.exports,n,["require","types"]);o=u}catch{return!1}else!n&&s.tsconfig&&(o=s.tsconfig);return o=x.join(e,"..",o),t?.set(i,o),o},"resolveFromPackageJsonPath"),_n="package.json",wn="tsconfig.json",ni=v((e,n,r)=>{let t=e;if(e===".."&&(t=x.join(t,wn)),e[0]==="."&&(t=x.resolve(n,t)),x.isAbsolute(t)){if(J(r,t)){if(We(r,t).isFile())return t}else if(!t.endsWith(".json")){let y=`${t}.json`;if(J(r,y))return y}return}let[i,...s]=e.split("/"),o=i[0]==="@"?`${i}/${s.shift()}`:i,u=s.join("/"),p=ei();if(p){let{resolveRequest:y}=p;try{if(o===e){let a=y(x.join(o,_n),n);if(a){let c=xn(a,u,!1,r);if(c&&J(r,c))return c}}else{let a;try{a=y(e,n,{extensions:[".json"]})}catch{a=y(x.join(e,wn),n)}if(a)return a}}catch{}}let f=_t(x.resolve(n),x.join("node_modules",o),r);if(!f||!We(r,f).isDirectory())return;let b=x.join(f,_n);if(J(r,b)){let y=xn(b,u,!1,r);if(y===!1)return;if(y&&J(r,y)&&We(r,y).isFile())return y}let h=x.join(f,u),k=h.endsWith(".json");if(!k){let y=`${h}.json`;if(J(r,y))return y}if(J(r,h)){if(We(r,h).isDirectory()){let y=x.join(h,_n);if(J(r,y)){let c=xn(y,"",!0,r);if(c&&J(r,c))return c}let a=x.join(h,wn);if(J(r,a))return a}else if(k)return h}},"resolveExtendsPath"),ti=v((e,n,r,t)=>{let i=ni(e,n,t);if(!i)throw new Error(`File '${e}' not found.`);if(r.has(i))throw new Error(`Circularity detected while resolving configuration: ${i}`);r.add(i);let s=x.dirname(i),o=Tt(i,t,r);delete o.references;let{compilerOptions:u}=o;if(u){let p=["baseUrl","outDir"];for(let f of p){let b=u[f];b&&(u[f]=B(x.relative(n,x.join(s,b)))||"./")}}return o.files&&(o.files=o.files.map(p=>B(x.relative(n,x.join(s,p))))),o.include&&(o.include=o.include.map(p=>B(x.relative(n,x.join(s,p))))),o.exclude&&(o.exclude=o.exclude.map(p=>B(x.relative(n,x.join(s,p))))),o},"resolveExtends"),Tt=v((e,n,r=new Set)=>{let t;try{t=At(e,n)||{}}catch{throw new Error(`Cannot resolve tsconfig at path: ${e}`)}if(typeof t!="object")throw new SyntaxError(`Failed to parse tsconfig at: ${e}`);let i=x.dirname(e);if(t.compilerOptions){let{compilerOptions:s}=t;s.paths&&!s.baseUrl&&(s[Sn]=i)}if(t.extends){let s=Array.isArray(t.extends)?t.extends:[t.extends];delete t.extends;for(let o of s.reverse()){let u=ti(o,i,new Set(r),n),p={...u,...t,compilerOptions:{...u.compilerOptions,...t.compilerOptions}};u.watchOptions&&(p.watchOptions={...u.watchOptions,...t.watchOptions}),t=p}}if(t.compilerOptions){let{compilerOptions:s}=t,o=["baseUrl","rootDir"];for(let p of o){let f=s[p];if(f){let b=x.resolve(i,f),h=$n(x.relative(i,b));s[p]=h}}let{outDir:u}=s;u&&(Array.isArray(t.exclude)||(t.exclude=[]),t.exclude.includes(u)||t.exclude.push(u),s.outDir=$n(u))}else t.compilerOptions={};if(t.files&&(t.files=t.files.map($n)),t.include&&(t.include=t.include.map(B)),t.watchOptions){let{watchOptions:s}=t;s.excludeDirectories&&(s.excludeDirectories=s.excludeDirectories.map(o=>B(x.resolve(i,o))))}return t},"_parseTsconfig"),ri=v((e,n=new Map)=>Tt(x.resolve(e),n),"parseTsconfig"),Oe=v((e=process.cwd(),n="tsconfig.json",r=new Map)=>{let t=_t(B(e),n,r);if(!t)return null;let i=ri(t,r);return{path:t,config:i}},"getTsconfig"),ii=/\*/g,gt=v((e,n)=>{let r=e.match(ii);if(r&&r.length>1)throw new Error(n)},"assertStarCount"),si=v(e=>{if(e.includes("*")){let[n,r]=e.split("*");return{prefix:n,suffix:r}}return e},"parsePattern"),oi=v(({prefix:e,suffix:n},r)=>r.startsWith(e)&&r.endsWith(n),"isPatternMatch"),ui=v((e,n,r)=>Object.entries(e).map(([t,i])=>(gt(t,`Pattern '${t}' can have at most one '*' character.`),{pattern:si(t),substitutions:i.map(s=>{if(gt(s,`Substitution '${s}' in pattern '${t}' can have at most one '*' character.`),!n&&!On.test(s))throw new Error("Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?");return x.resolve(r,s)})})),"parsePaths"),St=v(e=>{let{compilerOptions:n}=e.config;if(!n)return null;let{baseUrl:r,paths:t}=n;if(!r&&!t)return null;let i=Sn in n&&n[Sn],s=x.resolve(x.dirname(e.path),r||i||"."),o=t?ui(t,r,s):[];return u=>{if(On.test(u))return[];let p=[];for(let k of o){if(k.pattern===u)return k.substitutions.map(B);typeof k.pattern!="string"&&p.push(k)}let f,b=-1;for(let k of p)oi(k.pattern,u)&&k.pattern.prefix.length>b&&(b=k.pattern.prefix.length,f=k);if(!f)return r?[B(x.join(s,u))]:[];let h=u.slice(f.pattern.prefix.length,u.length-f.pattern.suffix.length);return f.substitutions.map(k=>B(k.replace("*",h)))}},"createPathsMatcher"),bt=v(e=>{let n="";for(let r=0;r<e.length;r+=1){let t=e[r],i=t.toUpperCase();n+=t===i?t.toLowerCase():i}return n},"s"),li=65,ai=97,ci=v(()=>Math.floor(Math.random()*26),"m"),pi=v(e=>Array.from({length:e},()=>String.fromCodePoint(ci()+(Math.random()>.5?li:ai))).join(""),"S"),fi=v((e=Tn)=>{let n=process.execPath;if(e.existsSync(n))return!e.existsSync(bt(n));let r=`/${pi(10)}`;e.writeFileSync(r,"");let t=!e.existsSync(bt(r));return e.unlinkSync(r),t},"l"),{join:ze}=x.posix,En={ts:[".ts",".tsx",".d.ts"],cts:[".cts",".d.cts"],mts:[".mts",".d.mts"]},yi=v(e=>{let n=[...En.ts],r=[...En.cts],t=[...En.mts];return e!=null&&e.allowJs&&(n.push(".js",".jsx"),r.push(".cjs"),t.push(".mjs")),[...n,...r,...t]},"getSupportedExtensions"),mi=v(e=>{let n=[];if(!e)return n;let{outDir:r,declarationDir:t}=e;return r&&n.push(r),t&&n.push(t),n},"getDefaultExcludeSpec"),kt=v(e=>e.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeForRegexp"),hi=["node_modules","bower_components","jspm_packages"],Cn=`(?!(${hi.join("|")})(/|$))`,di=/(?:^|\/)[^.*?]+$/,$t="**/*",Xe="[^/]",An="[^./]",xt=process.platform==="win32",no=v(({config:e,path:n},r=fi())=>{if("extends"in e)throw new Error("tsconfig#extends must be resolved. Use getTsconfig or parseTsconfig to resolve it.");if(!x.isAbsolute(n))throw new Error("The tsconfig path must be absolute");xt&&(n=B(n));let t=x.dirname(n),{files:i,include:s,exclude:o,compilerOptions:u}=e,p=i?.map(a=>ze(t,a)),f=yi(u),b=r?"":"i",h=(o||mi(u)).map(a=>{let c=ze(t,a),d=kt(c).replaceAll("\\*\\*/","(.+/)?").replaceAll("\\*",`${Xe}*`).replaceAll("\\?",Xe);return new RegExp(`^${d}($|/)`,b)}),k=i||s?s:[$t],y=k?k.map(a=>{let c=ze(t,a);di.test(c)&&(c=ze(c,$t));let d=kt(c).replaceAll("/\\*\\*",`(/${Cn}${An}${Xe}*)*?`).replaceAll(/(\/)?\\\*/g,(w,R)=>{let m=`(${An}|(\\.(?!min\\.js$))?)*`;return R?`/${Cn}${An}${m}`:m}).replaceAll(/(\/)?\\\?/g,(w,R)=>{let m=Xe;return R?`/${Cn}${m}`:m});return new RegExp(`^${d}$`,b)}):void 0;return a=>{if(!x.isAbsolute(a))throw new Error("filePath must be absolute");if(xt&&(a=B(a)),p!=null&&p.includes(a)||!(!f.some(c=>a.endsWith(c))||h.some(c=>c.test(a)))&&y&&y.some(c=>c.test(a)))return e}},"createFilesMatcher");import Qe from"process";var he=lt(Ot(),1);import D from"process";import{ConfirmPrompt as ki,GroupMultiSelectPrompt as oo,MultiSelectPrompt as $i,PasswordPrompt as uo,SelectKeyPrompt as lo,SelectPrompt as xi,TextPrompt as _i,block as wi,isCancel as ao}from"@clack/core";import Ei from"is-unicode-supported";import l from"chalk";import{isCancel as V}from"@clack/core";var Rn=Ei(),j=(e,n)=>Rn?e:n,Ci=j("\u25C6","*"),Dt=j("\u25A0","x"),Rt=j("\u25B2","x"),He=j("\u25C7","o"),Ai=j("\u250C","T"),_=j("\u2502","|"),Z=j("\u2514","\u2014"),Ln=j("\u25CF",">"),Nn=j("\u25CB"," "),Ti=j("\u25FB","[\u2022]"),Pt=j("\u25FC","[+]"),Si=j("\u25FB","[ ]"),fo=j("\u25AA","\u2022"),jt=j("\u2500","-"),Ii=j("\u256E","+"),Oi=j("\u251C","+"),Pi=j("\u256F","+"),ji=j("\u25CF","\u2022"),Di=j("\u25C6","*"),Ri=j("\u25B2","!"),Li=j("\u25A0","x");function Ye(e){switch(e){case"initial":case"active":return l.cyan(Ci);case"cancel":return l.red(Dt);case"error":return l.yellow(Rt);case"submit":return l.green(He)}}function Fn(e){let{cursor:n,options:r,style:t}=e,i=e.maxItems===void 0?Number.POSITIVE_INFINITY:Math.max(e.maxItems,5),s=0;n>=s+i-3?s=Math.max(Math.min(n-i+3,r.length-i),0):n<s+2&&(s=Math.max(n-2,0));let o=i<r.length&&s>0,u=i<r.length&&s+i<r.length;return r.slice(s,s+i).map((p,f,b)=>{let h=f===0&&o,k=f===b.length-1&&u;return h||k?l.dim("..."):t(p,f+s===n)})}function Pe(e){return new _i({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,render(){let n=`${l.gray(_)}
|
|
9
|
-
${
|
|
10
|
-
`,r=e.placeholder?
|
|
11
|
-
${
|
|
12
|
-
${
|
|
13
|
-
`;case"submit":return`${n}${
|
|
14
|
-
${
|
|
15
|
-
${
|
|
16
|
-
`}}}).prompt()}function
|
|
17
|
-
${
|
|
18
|
-
`,i=this.value?n:r;switch(this.state){case"submit":return`${t}${
|
|
19
|
-
${
|
|
20
|
-
${
|
|
21
|
-
`}}}).prompt()}function
|
|
22
|
-
${
|
|
23
|
-
`;switch(this.state){case"submit":return`${r}${
|
|
24
|
-
${
|
|
25
|
-
${
|
|
26
|
-
${
|
|
27
|
-
`}}}).prompt()}function
|
|
28
|
-
${
|
|
29
|
-
${
|
|
30
|
-
`,t=(i,s)=>{let o=this.value.includes(i.value);return s&&o?n(i,"active-selected"):o?n(i,"selected"):n(i,s?"active":"inactive")};switch(this.state){case"submit":return`${r}${
|
|
31
|
-
${
|
|
32
|
-
`).map((s,o)=>o===0?`${
|
|
33
|
-
`);return`${r+
|
|
34
|
-
${
|
|
2
|
+
var jr=Object.create;var lt=Object.defineProperty;var Pr=Object.getOwnPropertyDescriptor;var Dr=Object.getOwnPropertyNames;var Rr=Object.getPrototypeOf,Lr=Object.prototype.hasOwnProperty;var ct=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var Nr=(e,n,r,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of Dr(n))!Lr.call(e,i)&&i!==r&<(e,i,{get:()=>n[i],enumerable:!(t=Pr(n,i))||t.enumerable});return e};var pt=(e,n,r)=>(r=e!=null?jr(Rr(e)):{},Nr(n||!e||!e.__esModule?lt(r,"default",{value:e,enumerable:!0}):r,e));var Ut=ct((So,Gt)=>{"use strict";var Ln="\x1B",I=`${Ln}[`,ji="\x07",Nn={to(e,n){return n?`${I}${n+1};${e+1}H`:`${I}${e+1}G`},move(e,n){let r="";return e<0?r+=`${I}${-e}D`:e>0&&(r+=`${I}${e}C`),n<0?r+=`${I}${-n}A`:n>0&&(r+=`${I}${n}B`),r},up:(e=1)=>`${I}${e}A`,down:(e=1)=>`${I}${e}B`,forward:(e=1)=>`${I}${e}C`,backward:(e=1)=>`${I}${e}D`,nextLine:(e=1)=>`${I}E`.repeat(e),prevLine:(e=1)=>`${I}F`.repeat(e),left:`${I}G`,hide:`${I}?25l`,show:`${I}?25h`,save:`${Ln}7`,restore:`${Ln}8`},Pi={up:(e=1)=>`${I}S`.repeat(e),down:(e=1)=>`${I}T`.repeat(e)},Di={screen:`${I}2J`,up:(e=1)=>`${I}1J`.repeat(e),down:(e=1)=>`${I}J`.repeat(e),line:`${I}2K`,lineEnd:`${I}K`,lineStart:`${I}1K`,lines(e){let n="";for(let r=0;r<e;r++)n+=this.line+(r<e-1?Nn.up():"");return e&&(n+=Nn.left),n}};Gt.exports={cursor:Nn,scroll:Pi,erase:Di,beep:ji}});var br=ct(($u,gr)=>{"use strict";function pr(e){return Array.isArray(e)?e:[e]}var Yn="",fr=" ",Jn="\\",bs=/^\s+$/,ks=/(?:[^\\]|^)\\$/,xs=/^\\!/,$s=/^\\#/,_s=/\r?\n/g,ws=/^\.*\/|^\.+$/,Hn="/",hr="node-ignore";typeof Symbol<"u"&&(hr=Symbol.for("node-ignore"));var yr=hr,Es=(e,n,r)=>Object.defineProperty(e,n,{value:r}),As=/([0-z])-([0-z])/g,dr=()=>!1,Cs=e=>e.replace(As,(n,r,t)=>r.charCodeAt(0)<=t.charCodeAt(0)?n:Yn),Ts=e=>{let{length:n}=e;return e.slice(0,n-n%2)},Ss=[[/^\uFEFF/,()=>Yn],[/\\?\s+$/,e=>e.indexOf("\\")===0?fr:Yn],[/\\\s/g,()=>fr],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,n,r)=>n+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,n,r)=>{let t=r.replace(/\\\*/g,"[^\\/]*");return n+t}],[/\\\\\\(?=[$.|*+(){^])/g,()=>Jn],[/\\\\/g,()=>Jn],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,n,r,t,i)=>n===Jn?`\\[${r}${Ts(t)}${i}`:i==="]"&&t.length%2===0?`[${Cs(r)}${t}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,n)=>`${n?`${n}[^/]+`:"[^/]*"}(?=$|\\/$)`]],mr=Object.create(null),Is=(e,n)=>{let r=mr[e];return r||(r=Ss.reduce((t,i)=>t.replace(i[0],i[1].bind(e)),e),mr[e]=r),n?new RegExp(r,"i"):new RegExp(r)},et=e=>typeof e=="string",Os=e=>e&&et(e)&&!bs.test(e)&&!ks.test(e)&&e.indexOf("#")!==0,js=e=>e.split(_s),Zn=class{constructor(n,r,t,i){this.origin=n,this.pattern=r,this.negative=t,this.regex=i}},Ps=(e,n)=>{let r=e,t=!1;e.indexOf("!")===0&&(t=!0,e=e.substr(1)),e=e.replace(xs,"!").replace($s,"#");let i=Is(e,n);return new Zn(r,e,t,i)},Ds=(e,n)=>{throw new n(e)},Y=(e,n,r)=>et(e)?e?Y.isNotRelative(e)?r(`path should be a \`path.relative()\`d string, but got "${n}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${n}\``,TypeError),vr=e=>ws.test(e);Y.isNotRelative=vr;Y.convert=e=>e;var Qn=class{constructor({ignorecase:n=!0,ignoreCase:r=n,allowRelativePaths:t=!1}={}){Es(this,yr,!0),this._rules=[],this._ignoreCase=r,this._allowRelativePaths=t,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(n){if(n&&n[yr]){this._rules=this._rules.concat(n._rules),this._added=!0;return}if(Os(n)){let r=Ps(n,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(n){return this._added=!1,pr(et(n)?js(n):n).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(n){return this.add(n)}_testOne(n,r){let t=!1,i=!1;return this._rules.forEach(s=>{let{negative:o}=s;if(i===o&&t!==i||o&&!t&&!i&&!r)return;s.regex.test(n)&&(t=!o,i=o)}),{ignored:t,unignored:i}}_test(n,r,t,i){let s=n&&Y.convert(n);return Y(s,n,this._allowRelativePaths?dr:Ds),this._t(s,r,t,i)}_t(n,r,t,i){if(n in r)return r[n];if(i||(i=n.split(Hn)),i.pop(),!i.length)return r[n]=this._testOne(n,t);let s=this._t(i.join(Hn)+Hn,r,t,i);return r[n]=s.ignored?s:this._testOne(n,t)}ignores(n){return this._test(n,this._ignoreCache,!1).ignored}createFilter(){return n=>!this.ignores(n)}filter(n){return pr(n).filter(this.createFilter())}test(n){return this._test(n,this._testCache,!0)}},yn=e=>new Qn(e),Rs=e=>Y(e&&Y.convert(e),e,dr);yn.isPathValid=Rs;yn.default=yn;gr.exports=yn;if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let e=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");Y.convert=e;let n=/^[a-z]:\//i;Y.isNotRelative=r=>n.test(r)||vr(r)}});import Oe from"process";import{Command as io}from"commander";import{existsSync as mn,promises as rt}from"fs";import le from"path";import te from"process";import q from"chalk";import{Command as Gs}from"commander";import{execa as Us}from"execa";var gn;function Fr(e){return{lang:e?.lang??gn?.lang,message:e?.message,abortEarly:e?.abortEarly??gn?.abortEarly,abortPipeEarly:e?.abortPipeEarly??gn?.abortPipeEarly}}var Vr;function Mr(e){return Vr?.get(e)}var Gr;function Ur(e){return Gr?.get(e)}var Br;function qr(e,n){return Br?.get(e)?.get(n)}function ft(e){let n=typeof e;return n==="string"?`"${e}"`:n==="number"||n==="bigint"||n==="boolean"?`${e}`:n==="object"||n==="function"?(e&&Object.getPrototypeOf(e)?.constructor?.name)??"null":n}function pe(e,n,r,t,i){let s=i&&"input"in i?i.input:r.value,o=i?.expected??e.expects??null,u=i?.received??ft(s),c={kind:e.kind,type:e.type,input:s,expected:o,received:u,message:`Invalid ${n}: ${o?`Expected ${o} but r`:"R"}eceived ${u}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:t.lang,abortEarly:t.abortEarly,abortPipeEarly:t.abortPipeEarly},f=e.kind==="schema",b=i?.message??e.message??qr(e.reference,c.lang)??(f?Ur(c.lang):null)??t.message??Mr(c.lang);b&&(c.message=typeof b=="function"?b(c):b),f&&(r.typed=!1),r.issues?r.issues.push(c):r.issues=[c]}function Wr(e,n){return Object.hasOwn(e,n)&&n!=="__proto__"&&n!=="prototype"&&n!=="constructor"}var zr=class extends Error{issues;constructor(e){super(e[0].message),this.name="ValiError",this.issues=e}};function Xe(e){return{kind:"transformation",type:"transform",reference:Xe,async:!1,operation:e,_run(n){return n.value=this.operation(n.value),n}}}function Xr(e,n,r){return typeof e.default=="function"?e.default(n,r):e.default}function W(e,n){return{kind:"schema",type:"array",reference:W,expects:"Array",async:!1,item:e,message:n,_run(r,t){let i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let s=0;s<i.length;s++){let o=i[s],u=this.item._run({typed:!1,value:o},t);if(u.issues){let c={type:"array",origin:"value",input:i,key:s,value:o};for(let f of u.issues)f.path?f.path.unshift(c):f.path=[c],r.issues?.push(f);if(r.issues||(r.issues=u.issues),t.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),r.value.push(u.value)}}else pe(this,"type",r,t);return r}}}function z(e){return{kind:"schema",type:"boolean",reference:z,expects:"boolean",async:!1,message:e,_run(n,r){return typeof n.value=="boolean"?n.typed=!0:pe(this,"type",n,r),n}}}function S(e,n){return{kind:"schema",type:"object",reference:S,expects:"Object",async:!1,entries:e,message:n,_run(r,t){let i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(let s in this.entries){let o=i[s],u=this.entries[s]._run({typed:!1,value:o},t);if(u.issues){let c={type:"object",origin:"value",input:i,key:s,value:o};for(let f of u.issues)f.path?f.path.unshift(c):f.path=[c],r.issues?.push(f);if(r.issues||(r.issues=u.issues),t.abortEarly){r.typed=!1;break}}u.typed||(r.typed=!1),(u.value!==void 0||s in i)&&(r.value[s]=u.value)}}else pe(this,"type",r,t);return r}}}function F(e,...n){let r={kind:"schema",type:"optional",reference:F,expects:`${e.expects} | undefined`,async:!1,wrapped:e,_run(t,i){return t.value===void 0&&("default"in this&&(t.value=Xr(this,t,i)),t.value===void 0)?(t.typed=!0,t):this.wrapped._run(t,i)}};return 0 in n&&(r.default=n[0]),r}function bn(e,n){return{kind:"schema",type:"picklist",reference:bn,expects:e.map(ft).join(" | ")||"never",async:!1,options:e,message:n,_run(r,t){return this.options.includes(r.value)?r.typed=!0:pe(this,"type",r,t),r}}}function fe(e,n,r){return{kind:"schema",type:"record",reference:fe,expects:"Object",async:!1,key:e,value:n,message:r,_run(t,i){let s=t.value;if(s&&typeof s=="object"){t.typed=!0,t.value={};for(let o in s)if(Wr(s,o)){let u=s[o],c=this.key._run({typed:!1,value:o},i);if(c.issues){let b={type:"object",origin:"key",input:s,key:o,value:u};for(let h of c.issues)h.path=[b],t.issues?.push(h);if(t.issues||(t.issues=c.issues),i.abortEarly){t.typed=!1;break}}let f=this.value._run({typed:!1,value:u},i);if(f.issues){let b={type:"object",origin:"value",input:s,key:o,value:u};for(let h of f.issues)h.path?h.path.unshift(b):h.path=[b],t.issues?.push(h);if(t.issues||(t.issues=f.issues),i.abortEarly){t.typed=!1;break}}(!c.typed||!f.typed)&&(t.typed=!1),c.typed&&(t.value[c.value]=f.value)}}else pe(this,"type",t,i);return t}}}function g(e){return{kind:"schema",type:"string",reference:g,expects:"string",async:!1,message:e,_run(n,r){return typeof n.value=="string"?n.typed=!0:pe(this,"type",n,r),n}}}function M(e,n,r){let t=e._run({typed:!1,value:n},Fr(r));if(t.issues)throw new zr(t.issues);return t.value}function kn(...e){return{...e[0],pipe:e,_run(n,r){for(let t=0;t<e.length;t++){if(n.issues&&(e[t].kind==="schema"||e[t].kind==="transformation")){n.typed=!1;break}(!n.issues||!r.abortEarly&&!r.abortPipeEarly)&&(n=e[t]._run(n,r))}return n}}}function mt(e){return n=>n.length>1?[e,"run",n[0],"--",...n.slice(1)]:[e,"run",n[0]]}function Kr(){return e=>["deno","run",`npm:${e[0]}`,...e.slice(1)]}var Jr={agent:["npm",0],run:mt("npm"),install:["npm","i",0],frozen:["npm","ci",0],global:["npm","i","-g",0],add:["npm","i",0],upgrade:["npm","update",0],"upgrade-interactive":null,execute:["npx",0],"execute-local":["npx",0],uninstall:["npm","uninstall",0],global_uninstall:["npm","uninstall","-g",0]},ht={agent:["yarn",0],run:["yarn","run",0],install:["yarn","install",0],frozen:["yarn","install","--frozen-lockfile",0],global:["yarn","global","add",0],add:["yarn","add",0],upgrade:["yarn","upgrade",0],"upgrade-interactive":["yarn","upgrade-interactive",0],execute:["npx",0],"execute-local":["yarn","exec",0],uninstall:["yarn","remove",0],global_uninstall:["yarn","global","remove",0]},Hr={...ht,frozen:["yarn","install","--immutable",0],upgrade:["yarn","up",0],"upgrade-interactive":["yarn","up","-i",0],execute:["yarn","dlx",0],"execute-local":["yarn","exec",0],global:["npm","i","-g",0],global_uninstall:["npm","uninstall","-g",0]},yt={agent:["pnpm",0],run:["pnpm","run",0],install:["pnpm","i",0],frozen:["pnpm","i","--frozen-lockfile",0],global:["pnpm","add","-g",0],add:["pnpm","add",0],upgrade:["pnpm","update",0],"upgrade-interactive":["pnpm","update","-i",0],execute:["pnpm","dlx",0],"execute-local":["pnpm","exec",0],uninstall:["pnpm","remove",0],global_uninstall:["pnpm","remove","--global",0]},Yr={agent:["bun",0],run:["bun","run",0],install:["bun","install",0],frozen:["bun","install","--frozen-lockfile",0],global:["bun","add","-g",0],add:["bun","add",0],upgrade:["bun","update",0],"upgrade-interactive":["bun","update",0],execute:["bun","x",0],"execute-local":["bun","x",0],uninstall:["bun","remove",0],global_uninstall:["bun","remove","-g",0]},Zr={agent:["deno",0],run:["deno","task",0],install:["deno","install",0],frozen:["deno","install","--frozen",0],global:["deno","install","-g",0],add:["deno","add",0],upgrade:["deno","outdated","--update",0],"upgrade-interactive":["deno","outdated","--update",0],execute:Kr(),"execute-local":["deno","task","--eval",0],uninstall:["deno","remove",0],global_uninstall:["deno","uninstall","-g",0]},dt={npm:Jr,yarn:ht,"yarn@berry":Hr,pnpm:yt,"pnpm@6":{...yt,run:mt("pnpm")},bun:Yr,deno:Zr};function H(e,n,r){let t=dt[e][n];return vt(t,r)}function vt(e,n){if(e==null)return null;let r=typeof e=="function"?e(n):e.flatMap(t=>typeof t=="number"?n:[t]);return{command:r[0],args:r.slice(1)}}var me=["npm","yarn","yarn@berry","pnpm","pnpm@6","bun","deno"],Ke={"bun.lock":"bun","bun.lockb":"bun","deno.lock":"deno","pnpm-lock.yaml":"pnpm","pnpm-workspace.yaml":"pnpm","yarn.lock":"yarn","package-lock.json":"npm","npm-shrinkwrap.json":"npm"},Je={"node_modules/.deno/":"deno","node_modules/.pnpm/":"pnpm","node_modules/.yarn-state.yml":"yarn","node_modules/.yarn_integrity":"yarn","node_modules/.package-lock.json":"npm",".pnp.cjs":"yarn",".pnp.js":"yarn","bun.lock":"bun","bun.lockb":"bun"};import bt from"fs/promises";import se from"path";import kt from"process";async function xn(e,n){try{let r=await bt.stat(e);return n==="file"?r.isFile():r.isDirectory()}catch{return!1}}function $n(){let e=kt.env.npm_config_user_agent;if(!e)return null;let n=e.split("/")[0];return me.includes(n)?n:null}function*Qr(e=kt.cwd()){let n=se.resolve(e),{root:r}=se.parse(n);for(;n&&n!==r;)yield n,n=se.dirname(n)}async function gt(e,n){return!e||!xn(e,"file")?null:await ni(e,n)}async function je(e={}){let{cwd:n,strategies:r=["lockfile","packageManager-field","devEngines-field"],onUnknown:t}=e;for(let i of Qr(n))for(let s of r)switch(s){case"lockfile":{for(let o of Object.keys(Ke))if(await xn(se.join(i,o),"file")){let u=Ke[o],c=await gt(se.join(i,"package.json"),t);return c||{name:u,agent:u}}break}case"packageManager-field":case"devEngines-field":{let o=await gt(se.join(i,"package.json"),t);if(o)return o;break}case"install-metadata":{for(let o of Object.keys(Je)){let u=o.endsWith("/")?"dir":"file";if(await xn(se.join(i,o),u)){let c=Je[o],f=c==="yarn"?ti(o)?"yarn":"yarn@berry":c;return{name:c,agent:f}}}break}}return null}function ei(e){let n=r=>r?.match(/\d+(\.\d+){0,2}/)?.[0]??r;if(typeof e.packageManager=="string"){let[r,t]=e.packageManager.replace(/^\^/,"").split("@");return{name:r,ver:n(t)}}if(typeof e.devEngines?.packageManager?.name=="string")return{name:e.devEngines.packageManager.name,ver:n(e.devEngines.packageManager.version)}}async function ni(e,n){try{let r=JSON.parse(await bt.readFile(e,"utf8")),t,i=ei(r);if(i){let s=i.name,o=i.ver,u=o;return s==="yarn"&&o&&Number.parseInt(o)>1?(t="yarn@berry",u="berry",{name:s,agent:t,version:u}):s==="pnpm"&&o&&Number.parseInt(o)<7?(t="pnpm@6",{name:s,agent:t,version:u}):me.includes(s)?(t=s,{name:s,agent:t,version:u}):n?.(r.packageManager)??null}}catch{}return null}function ti(e){return e.endsWith(".yarn_integrity")}import Zt from"fs";import ln from"path";import Fe from"chalk";import $ from"path";import jn from"fs";import fi from"module";var xt=e=>e!==null&&typeof e=="object",he=(e,n)=>Object.assign(new Error(`[${e}]: ${n}`),{code:e}),$t="ERR_INVALID_PACKAGE_CONFIG",_n="ERR_INVALID_PACKAGE_TARGET",ri="ERR_PACKAGE_PATH_NOT_EXPORTED";var ii=/^\d+$/,si=/^(\.{1,2}|node_modules)$/i,oi=/\/|\\/,_t=(e=>(e.Export="exports",e.Import="imports",e))(_t||{}),wn=(e,n,r,t,i)=>{if(n==null)return[];if(typeof n=="string"){let[s,...o]=n.split(oi);if(s===".."||o.some(u=>si.test(u)))throw he(_n,`Invalid "${e}" target "${n}" defined in the package config`);return[i?n.replace(/\*/g,i):n]}if(Array.isArray(n))return n.flatMap(s=>wn(e,s,r,t,i));if(xt(n)){for(let s of Object.keys(n)){if(ii.test(s))throw he($t,"Cannot contain numeric property keys");if(s==="default"||t.includes(s))return wn(e,n[s],r,t,i)}return[]}throw he(_n,`Invalid "${e}" target "${n}"`)},Pe="*",ui=(e,n)=>{let r=e.indexOf(Pe),t=n.indexOf(Pe);return r===t?n.length>e.length:t>r};function ai(e,n){if(!n.includes(Pe)&&e.hasOwnProperty(n))return[n];let r,t;for(let i of Object.keys(e))if(i.includes(Pe)){let[s,o,u]=i.split(Pe);if(u===void 0&&n.startsWith(s)&&n.endsWith(o)){let c=n.slice(s.length,-o.length||void 0);c&&(!r||ui(r,i))&&(r=i,t=c)}}return[r,t]}var li=e=>Object.keys(e).reduce((n,r)=>{let t=r===""||r[0]!==".";if(n===void 0||n===t)return t;throw he($t,'"exports" cannot contain some keys starting with "." and some not')},void 0),ci=/^\w+:/,wt=(e,n,r)=>{if(!e)throw new Error('"exports" is required');n=n===""?".":`./${n}`,(typeof e=="string"||Array.isArray(e)||xt(e)&&li(e))&&(e={".":e});let[t,i]=ai(e,n),s=wn(_t.Export,e[t],n,r,i);if(s.length===0)throw he(ri,n==="."?'No "exports" main defined':`Package subpath '${n}' is not defined by "exports"`);for(let o of s)if(!o.startsWith("./")&&!ci.test(o))throw he(_n,`Invalid "exports" target "${o}" defined in the package config`);return s};var pi=Object.defineProperty,d=(e,n)=>pi(e,"name",{value:n,configurable:!0});function B(e){return e.startsWith("\\\\?\\")?e:e.replace(/\\/g,"/")}d(B,"slash");var Dn=d(e=>{let n=jn[e];return(r,...t)=>{let i=`${e}:${t.join(":")}`,s=r?.get(i);return s===void 0&&(s=Reflect.apply(n,jn,t),r?.set(i,s)),s}},"cacheFs"),K=Dn("existsSync"),yi=Dn("readFileSync"),He=Dn("statSync"),Dt=d((e,n,r)=>{for(;;){let t=$.posix.join(e,n);if(K(r,t))return t;let i=$.dirname(e);if(i===e)return;e=i}},"findUp"),Rn=/^\.{1,2}(\/.*)?$/,En=d(e=>{let n=B(e);return Rn.test(n)?n:`./${n}`},"normalizePath");function Rt(e,n=!1){let r=e.length,t=0,i="",s=0,o=16,u=0,c=0,f=0,b=0,h=0;function k(m,E){let x=0,C=0;for(;x<m||!E;){let L=e.charCodeAt(t);if(L>=48&&L<=57)C=C*16+L-48;else if(L>=65&&L<=70)C=C*16+L-65+10;else if(L>=97&&L<=102)C=C*16+L-97+10;else break;t++,x++}return x<m&&(C=-1),C}d(k,"scanHexDigits");function y(m){t=m,i="",s=0,o=16,h=0}d(y,"setPosition");function l(){let m=t;if(e.charCodeAt(t)===48)t++;else for(t++;t<e.length&&oe(e.charCodeAt(t));)t++;if(t<e.length&&e.charCodeAt(t)===46)if(t++,t<e.length&&oe(e.charCodeAt(t)))for(t++;t<e.length&&oe(e.charCodeAt(t));)t++;else return h=3,e.substring(m,t);let E=t;if(t<e.length&&(e.charCodeAt(t)===69||e.charCodeAt(t)===101))if(t++,(t<e.length&&e.charCodeAt(t)===43||e.charCodeAt(t)===45)&&t++,t<e.length&&oe(e.charCodeAt(t))){for(t++;t<e.length&&oe(e.charCodeAt(t));)t++;E=t}else h=3;return e.substring(m,E)}d(l,"scanNumber");function p(){let m="",E=t;for(;;){if(t>=r){m+=e.substring(E,t),h=2;break}let x=e.charCodeAt(t);if(x===34){m+=e.substring(E,t),t++;break}if(x===92){if(m+=e.substring(E,t),t++,t>=r){h=2;break}switch(e.charCodeAt(t++)){case 34:m+='"';break;case 92:m+="\\";break;case 47:m+="/";break;case 98:m+="\b";break;case 102:m+="\f";break;case 110:m+=`
|
|
3
|
+
`;break;case 114:m+="\r";break;case 116:m+=" ";break;case 117:let C=k(4,!0);C>=0?m+=String.fromCharCode(C):h=4;break;default:h=5}E=t;continue}if(x>=0&&x<=31)if(ve(x)){m+=e.substring(E,t),h=2;break}else h=6;t++}return m}d(p,"scanString");function v(){if(i="",h=0,s=t,c=u,b=f,t>=r)return s=r,o=17;let m=e.charCodeAt(t);if(Qe(m)){do t++,i+=String.fromCharCode(m),m=e.charCodeAt(t);while(Qe(m));return o=15}if(ve(m))return t++,i+=String.fromCharCode(m),m===13&&e.charCodeAt(t)===10&&(t++,i+=`
|
|
4
|
+
`),u++,f=t,o=14;switch(m){case 123:return t++,o=1;case 125:return t++,o=2;case 91:return t++,o=3;case 93:return t++,o=4;case 58:return t++,o=6;case 44:return t++,o=5;case 34:return t++,i=p(),o=10;case 47:let E=t-1;if(e.charCodeAt(t+1)===47){for(t+=2;t<r&&!ve(e.charCodeAt(t));)t++;return i=e.substring(E,t),o=12}if(e.charCodeAt(t+1)===42){t+=2;let x=r-1,C=!1;for(;t<x;){let L=e.charCodeAt(t);if(L===42&&e.charCodeAt(t+1)===47){t+=2,C=!0;break}t++,ve(L)&&(L===13&&e.charCodeAt(t)===10&&t++,u++,f=t)}return C||(t++,h=1),i=e.substring(E,t),o=13}return i+=String.fromCharCode(m),t++,o=16;case 45:if(i+=String.fromCharCode(m),t++,t===r||!oe(e.charCodeAt(t)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=l(),o=11;default:for(;t<r&&w(m);)t++,m=e.charCodeAt(t);if(s!==t){switch(i=e.substring(s,t),i){case"true":return o=8;case"false":return o=9;case"null":return o=7}return o=16}return i+=String.fromCharCode(m),t++,o=16}}d(v,"scanNext");function w(m){if(Qe(m)||ve(m))return!1;switch(m){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}d(w,"isUnknownContentCharacter");function R(){let m;do m=v();while(m>=12&&m<=15);return m}return d(R,"scanNextNonTrivia"),{setPosition:y,getPosition:()=>t,scan:n?R:v,getToken:()=>o,getTokenValue:()=>i,getTokenOffset:()=>s,getTokenLength:()=>t-s,getTokenStartLine:()=>c,getTokenStartCharacter:()=>s-b,getTokenError:()=>h}}d(Rt,"createScanner");function Qe(e){return e===32||e===9}d(Qe,"isWhiteSpace");function ve(e){return e===10||e===13}d(ve,"isLineBreak");function oe(e){return e>=48&&e<=57}d(oe,"isDigit");var Et;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(Et||(Et={})),new Array(20).fill(0).map((e,n)=>" ".repeat(n));var de=200;new Array(de).fill(0).map((e,n)=>`
|
|
5
|
+
`+" ".repeat(n)),new Array(de).fill(0).map((e,n)=>"\r"+" ".repeat(n)),new Array(de).fill(0).map((e,n)=>`\r
|
|
6
|
+
`+" ".repeat(n)),new Array(de).fill(0).map((e,n)=>`
|
|
7
|
+
`+" ".repeat(n)),new Array(de).fill(0).map((e,n)=>"\r"+" ".repeat(n)),new Array(de).fill(0).map((e,n)=>`\r
|
|
8
|
+
`+" ".repeat(n));var en;(function(e){e.DEFAULT={allowTrailingComma:!1}})(en||(en={}));function Lt(e,n=[],r=en.DEFAULT){let t=null,i=[],s=[];function o(u){Array.isArray(i)?i.push(u):t!==null&&(i[t]=u)}return d(o,"onValue"),Nt(e,{onObjectBegin:()=>{let u={};o(u),s.push(i),i=u,t=null},onObjectProperty:u=>{t=u},onObjectEnd:()=>{i=s.pop()},onArrayBegin:()=>{let u=[];o(u),s.push(i),i=u,t=null},onArrayEnd:()=>{i=s.pop()},onLiteralValue:o,onError:(u,c,f)=>{n.push({error:u,offset:c,length:f})}},r),i[0]}d(Lt,"parse$1");function Nt(e,n,r=en.DEFAULT){let t=Rt(e,!1),i=[];function s(A){return A?()=>A(t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter()):()=>!0}d(s,"toNoArgVisit");function o(A){return A?()=>A(t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter(),()=>i.slice()):()=>!0}d(o,"toNoArgVisitWithPath");function u(A){return A?N=>A(N,t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter()):()=>!0}d(u,"toOneArgVisit");function c(A){return A?N=>A(N,t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter(),()=>i.slice()):()=>!0}d(c,"toOneArgVisitWithPath");let f=o(n.onObjectBegin),b=c(n.onObjectProperty),h=s(n.onObjectEnd),k=o(n.onArrayBegin),y=s(n.onArrayEnd),l=c(n.onLiteralValue),p=u(n.onSeparator),v=s(n.onComment),w=u(n.onError),R=r&&r.disallowComments,m=r&&r.allowTrailingComma;function E(){for(;;){let A=t.scan();switch(t.getTokenError()){case 4:x(14);break;case 5:x(15);break;case 3:x(13);break;case 1:R||x(11);break;case 2:x(12);break;case 6:x(16);break}switch(A){case 12:case 13:R?x(10):v();break;case 16:x(1);break;case 15:case 14:break;default:return A}}}d(E,"scanNext");function x(A,N=[],at=[]){if(w(A),N.length+at.length>0){let ze=t.getToken();for(;ze!==17;){if(N.indexOf(ze)!==-1){E();break}else if(at.indexOf(ze)!==-1)break;ze=E()}}}d(x,"handleError");function C(A){let N=t.getTokenValue();return A?l(N):(b(N),i.push(N)),E(),!0}d(C,"parseString");function L(){switch(t.getToken()){case 11:let A=t.getTokenValue(),N=Number(A);isNaN(N)&&(x(2),N=0),l(N);break;case 7:l(null);break;case 8:l(!0);break;case 9:l(!1);break;default:return!1}return E(),!0}d(L,"parseLiteral");function qe(){return t.getToken()!==10?(x(3,[],[2,5]),!1):(C(!1),t.getToken()===6?(p(":"),E(),We()||x(4,[],[2,5])):x(5,[],[2,5]),i.pop(),!0)}d(qe,"parseProperty");function ot(){f(),E();let A=!1;for(;t.getToken()!==2&&t.getToken()!==17;){if(t.getToken()===5){if(A||x(4,[],[]),p(","),E(),t.getToken()===2&&m)break}else A&&x(6,[],[]);qe()||x(4,[],[2,5]),A=!0}return h(),t.getToken()!==2?x(7,[2],[]):E(),!0}d(ot,"parseObject");function ut(){k(),E();let A=!0,N=!1;for(;t.getToken()!==4&&t.getToken()!==17;){if(t.getToken()===5){if(N||x(4,[],[]),p(","),E(),t.getToken()===4&&m)break}else N&&x(6,[],[]);A?(i.push(0),A=!1):i[i.length-1]++,We()||x(4,[],[4,5]),N=!0}return y(),A||i.pop(),t.getToken()!==4?x(8,[4],[]):E(),!0}d(ut,"parseArray");function We(){switch(t.getToken()){case 3:return ut();case 1:return ot();case 10:return C(!0);default:return L()}}return d(We,"parseValue"),E(),t.getToken()===17?r.allowEmptyContent?!0:(x(4,[],[]),!1):We()?(t.getToken()!==17&&x(9,[],[]),!0):(x(4,[],[]),!1)}d(Nt,"visit");var At;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(At||(At={}));var Ct;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(Ct||(Ct={}));var mi=Lt,Tt;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(Tt||(Tt={}));var Ft=d((e,n)=>mi(yi(n,e,"utf8")),"readJsonc"),Pn=Symbol("implicitBaseUrl"),hi=d(()=>{let{findPnpApi:e}=fi;return e&&e(process.cwd())},"getPnpApi"),An=d((e,n,r,t)=>{let i=`resolveFromPackageJsonPath:${e}:${n}:${r}`;if(t!=null&&t.has(i))return t.get(i);let s=Ft(e,t);if(!s)return;let o=n||"tsconfig.json";if(!r&&s.exports)try{let[u]=wt(s.exports,n,["require","types"]);o=u}catch{return!1}else!n&&s.tsconfig&&(o=s.tsconfig);return o=$.join(e,"..",o),t?.set(i,o),o},"resolveFromPackageJsonPath"),Cn="package.json",Tn="tsconfig.json",di=d((e,n,r)=>{let t=e;if(e===".."&&(t=$.join(t,Tn)),e[0]==="."&&(t=$.resolve(n,t)),$.isAbsolute(t)){if(K(r,t)){if(He(r,t).isFile())return t}else if(!t.endsWith(".json")){let y=`${t}.json`;if(K(r,y))return y}return}let[i,...s]=e.split("/"),o=i[0]==="@"?`${i}/${s.shift()}`:i,u=s.join("/"),c=hi();if(c){let{resolveRequest:y}=c;try{if(o===e){let l=y($.join(o,Cn),n);if(l){let p=An(l,u,!1,r);if(p&&K(r,p))return p}}else{let l;try{l=y(e,n,{extensions:[".json"]})}catch{l=y($.join(e,Tn),n)}if(l)return l}}catch{}}let f=Dt($.resolve(n),$.join("node_modules",o),r);if(!f||!He(r,f).isDirectory())return;let b=$.join(f,Cn);if(K(r,b)){let y=An(b,u,!1,r);if(y===!1)return;if(y&&K(r,y)&&He(r,y).isFile())return y}let h=$.join(f,u),k=h.endsWith(".json");if(!k){let y=`${h}.json`;if(K(r,y))return y}if(K(r,h)){if(He(r,h).isDirectory()){let y=$.join(h,Cn);if(K(r,y)){let p=An(y,"",!0,r);if(p&&K(r,p))return p}let l=$.join(h,Tn);if(K(r,l))return l}else if(k)return h}},"resolveExtendsPath"),vi=d((e,n,r,t)=>{let i=di(e,n,t);if(!i)throw new Error(`File '${e}' not found.`);if(r.has(i))throw new Error(`Circularity detected while resolving configuration: ${i}`);r.add(i);let s=$.dirname(i),o=Vt(i,t,r);delete o.references;let{compilerOptions:u}=o;if(u){let c=["baseUrl","outDir"];for(let f of c){let b=u[f];b&&(u[f]=B($.relative(n,$.join(s,b)))||"./")}}return o.files&&(o.files=o.files.map(c=>B($.relative(n,$.join(s,c))))),o.include&&(o.include=o.include.map(c=>B($.relative(n,$.join(s,c))))),o.exclude&&(o.exclude=o.exclude.map(c=>B($.relative(n,$.join(s,c))))),o},"resolveExtends"),Vt=d((e,n,r=new Set)=>{let t;try{t=Ft(e,n)||{}}catch{throw new Error(`Cannot resolve tsconfig at path: ${e}`)}if(typeof t!="object")throw new SyntaxError(`Failed to parse tsconfig at: ${e}`);let i=$.dirname(e);if(t.compilerOptions){let{compilerOptions:s}=t;s.paths&&!s.baseUrl&&(s[Pn]=i)}if(t.extends){let s=Array.isArray(t.extends)?t.extends:[t.extends];delete t.extends;for(let o of s.reverse()){let u=vi(o,i,new Set(r),n),c={...u,...t,compilerOptions:{...u.compilerOptions,...t.compilerOptions}};u.watchOptions&&(c.watchOptions={...u.watchOptions,...t.watchOptions}),t=c}}if(t.compilerOptions){let{compilerOptions:s}=t,o=["baseUrl","rootDir"];for(let c of o){let f=s[c];if(f){let b=$.resolve(i,f),h=En($.relative(i,b));s[c]=h}}let{outDir:u}=s;u&&(Array.isArray(t.exclude)||(t.exclude=[]),t.exclude.includes(u)||t.exclude.push(u),s.outDir=En(u))}else t.compilerOptions={};if(t.files&&(t.files=t.files.map(En)),t.include&&(t.include=t.include.map(B)),t.watchOptions){let{watchOptions:s}=t;s.excludeDirectories&&(s.excludeDirectories=s.excludeDirectories.map(o=>B($.resolve(i,o))))}return t},"_parseTsconfig"),gi=d((e,n=new Map)=>Vt($.resolve(e),n),"parseTsconfig"),De=d((e=process.cwd(),n="tsconfig.json",r=new Map)=>{let t=Dt(B(e),n,r);if(!t)return null;let i=gi(t,r);return{path:t,config:i}},"getTsconfig"),bi=/\*/g,St=d((e,n)=>{let r=e.match(bi);if(r&&r.length>1)throw new Error(n)},"assertStarCount"),ki=d(e=>{if(e.includes("*")){let[n,r]=e.split("*");return{prefix:n,suffix:r}}return e},"parsePattern"),xi=d(({prefix:e,suffix:n},r)=>r.startsWith(e)&&r.endsWith(n),"isPatternMatch"),$i=d((e,n,r)=>Object.entries(e).map(([t,i])=>(St(t,`Pattern '${t}' can have at most one '*' character.`),{pattern:ki(t),substitutions:i.map(s=>{if(St(s,`Substitution '${s}' in pattern '${t}' can have at most one '*' character.`),!n&&!Rn.test(s))throw new Error("Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?");return $.resolve(r,s)})})),"parsePaths"),Mt=d(e=>{let{compilerOptions:n}=e.config;if(!n)return null;let{baseUrl:r,paths:t}=n;if(!r&&!t)return null;let i=Pn in n&&n[Pn],s=$.resolve($.dirname(e.path),r||i||"."),o=t?$i(t,r,s):[];return u=>{if(Rn.test(u))return[];let c=[];for(let k of o){if(k.pattern===u)return k.substitutions.map(B);typeof k.pattern!="string"&&c.push(k)}let f,b=-1;for(let k of c)xi(k.pattern,u)&&k.pattern.prefix.length>b&&(b=k.pattern.prefix.length,f=k);if(!f)return r?[B($.join(s,u))]:[];let h=u.slice(f.pattern.prefix.length,u.length-f.pattern.suffix.length);return f.substitutions.map(k=>B(k.replace("*",h)))}},"createPathsMatcher"),It=d(e=>{let n="";for(let r=0;r<e.length;r+=1){let t=e[r],i=t.toUpperCase();n+=t===i?t.toLowerCase():i}return n},"s"),_i=65,wi=97,Ei=d(()=>Math.floor(Math.random()*26),"m"),Ai=d(e=>Array.from({length:e},()=>String.fromCodePoint(Ei()+(Math.random()>.5?_i:wi))).join(""),"S"),Ci=d((e=jn)=>{let n=process.execPath;if(e.existsSync(n))return!e.existsSync(It(n));let r=`/${Ai(10)}`;e.writeFileSync(r,"");let t=!e.existsSync(It(r));return e.unlinkSync(r),t},"l"),{join:Ye}=$.posix,Sn={ts:[".ts",".tsx",".d.ts"],cts:[".cts",".d.cts"],mts:[".mts",".d.mts"]},Ti=d(e=>{let n=[...Sn.ts],r=[...Sn.cts],t=[...Sn.mts];return e!=null&&e.allowJs&&(n.push(".js",".jsx"),r.push(".cjs"),t.push(".mjs")),[...n,...r,...t]},"getSupportedExtensions"),Si=d(e=>{let n=[];if(!e)return n;let{outDir:r,declarationDir:t}=e;return r&&n.push(r),t&&n.push(t),n},"getDefaultExcludeSpec"),Ot=d(e=>e.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeForRegexp"),Ii=["node_modules","bower_components","jspm_packages"],In=`(?!(${Ii.join("|")})(/|$))`,Oi=/(?:^|\/)[^.*?]+$/,jt="**/*",Ze="[^/]",On="[^./]",Pt=process.platform==="win32",Co=d(({config:e,path:n},r=Ci())=>{if("extends"in e)throw new Error("tsconfig#extends must be resolved. Use getTsconfig or parseTsconfig to resolve it.");if(!$.isAbsolute(n))throw new Error("The tsconfig path must be absolute");Pt&&(n=B(n));let t=$.dirname(n),{files:i,include:s,exclude:o,compilerOptions:u}=e,c=i?.map(l=>Ye(t,l)),f=Ti(u),b=r?"":"i",h=(o||Si(u)).map(l=>{let p=Ye(t,l),v=Ot(p).replaceAll("\\*\\*/","(.+/)?").replaceAll("\\*",`${Ze}*`).replaceAll("\\?",Ze);return new RegExp(`^${v}($|/)`,b)}),k=i||s?s:[jt],y=k?k.map(l=>{let p=Ye(t,l);Oi.test(p)&&(p=Ye(p,jt));let v=Ot(p).replaceAll("/\\*\\*",`(/${In}${On}${Ze}*)*?`).replaceAll(/(\/)?\\\*/g,(w,R)=>{let m=`(${On}|(\\.(?!min\\.js$))?)*`;return R?`/${In}${On}${m}`:m}).replaceAll(/(\/)?\\\?/g,(w,R)=>{let m=Ze;return R?`/${In}${m}`:m});return new RegExp(`^${v}$`,b)}):void 0;return l=>{if(!$.isAbsolute(l))throw new Error("filePath must be absolute");if(Pt&&(l=B(l)),c!=null&&c.includes(l)||!(!f.some(p=>l.endsWith(p))||h.some(p=>p.test(l)))&&y&&y.some(p=>p.test(l)))return e}},"createFilesMatcher");import sn from"process";var ge=pt(Ut(),1);import D from"process";import{ConfirmPrompt as Ri,GroupMultiSelectPrompt as jo,MultiSelectPrompt as Li,PasswordPrompt as Po,SelectKeyPrompt as Do,SelectPrompt as Ni,TextPrompt as Fi,block as Vi,isCancel as Ro}from"@clack/core";import Mi from"is-unicode-supported";import a from"chalk";import{isCancel as V}from"@clack/core";var Vn=Mi(),P=(e,n)=>Vn?e:n,Gi=P("\u25C6","*"),Wt=P("\u25A0","x"),zt=P("\u25B2","x"),nn=P("\u25C7","o"),Ui=P("\u250C","T"),_=P("\u2502","|"),Q=P("\u2514","\u2014"),Mn=P("\u25CF",">"),Gn=P("\u25CB"," "),Bi=P("\u25FB","[\u2022]"),Bt=P("\u25FC","[+]"),qi=P("\u25FB","[ ]"),Fo=P("\u25AA","\u2022"),qt=P("\u2500","-"),Wi=P("\u256E","+"),zi=P("\u251C","+"),Xi=P("\u256F","+"),Ki=P("\u25CF","\u2022"),Ji=P("\u25C6","*"),Hi=P("\u25B2","!"),Yi=P("\u25A0","x");function tn(e){switch(e){case"initial":case"active":return a.cyan(Gi);case"cancel":return a.red(Wt);case"error":return a.yellow(zt);case"submit":return a.green(nn)}}function Un(e){let{cursor:n,options:r,style:t}=e,i=e.maxItems===void 0?Number.POSITIVE_INFINITY:Math.max(e.maxItems,5),s=0;n>=s+i-3?s=Math.max(Math.min(n-i+3,r.length-i),0):n<s+2&&(s=Math.max(n-2,0));let o=i<r.length&&s>0,u=i<r.length&&s+i<r.length;return r.slice(s,s+i).map((c,f,b)=>{let h=f===0&&o,k=f===b.length-1&&u;return h||k?a.dim("..."):t(c,f+s===n)})}function Re(e){return new Fi({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,render(){let n=`${a.gray(_)}
|
|
9
|
+
${tn(this.state)} ${e.message}
|
|
10
|
+
`,r=e.placeholder?a.inverse(e.placeholder[0])+a.dim(e.placeholder.slice(1)):a.inverse(a.hidden("_")),t=this.value?this.valueWithCursor:r;switch(this.state){case"error":return`${n.trim()}
|
|
11
|
+
${a.yellow(_)} ${t}
|
|
12
|
+
${a.yellow(Q)} ${a.yellow(this.error)}
|
|
13
|
+
`;case"submit":return`${n}${a.gray(_)} ${a.dim(this.value||e.placeholder)}`;case"cancel":return`${n}${a.gray(_)} ${a.strikethrough(a.dim(this.value??""))}${this.value?.trim()?`
|
|
14
|
+
${a.gray(_)}`:""}`;default:return`${n}${a.cyan(_)} ${t}
|
|
15
|
+
${a.cyan(Q)}
|
|
16
|
+
`}}}).prompt()}function be(e){let n=e.active??"Yes",r=e.inactive??"No";return new Ri({active:n,inactive:r,initialValue:e.initialValue??!0,render(){let t=`${a.gray(_)}
|
|
17
|
+
${tn(this.state)} ${e.message}
|
|
18
|
+
`,i=this.value?n:r;switch(this.state){case"submit":return`${t}${a.gray(_)} ${a.dim(i)}`;case"cancel":return`${t}${a.gray(_)} ${a.strikethrough(a.dim(i))}
|
|
19
|
+
${a.gray(_)}`;default:return`${t}${a.cyan(_)} ${this.value?`${a.green(Mn)} ${n}`:`${a.dim(Gn)} ${a.dim(n)}`} ${a.dim("/")} ${this.value?`${a.dim(Gn)} ${a.dim(r)}`:`${a.green(Mn)} ${r}`}
|
|
20
|
+
${a.cyan(Q)}
|
|
21
|
+
`}}}).prompt()}function Le(e){let n=(r,t)=>{let i=r.label??String(r.value);switch(t){case"selected":return`${a.dim(i)}`;case"active":return`${a.green(Mn)} ${i} ${r.hint?a.dim(`(${r.hint})`):""}`;case"cancelled":return`${a.strikethrough(a.dim(i))}`;default:return`${a.dim(Gn)} ${a.dim(i)}`}};return new Ni({options:e.options,initialValue:e.initialValue,render(){let r=`${a.gray(_)}
|
|
22
|
+
${tn(this.state)} ${e.message}
|
|
23
|
+
`;switch(this.state){case"submit":return`${r}${a.gray(_)} ${n(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${a.gray(_)} ${n(this.options[this.cursor],"cancelled")}
|
|
24
|
+
${a.gray(_)}`;default:return`${r}${a.cyan(_)} ${Un({cursor:this.cursor,options:this.options,maxItems:e.maxItems,style:(t,i)=>n(t,i?"active":"inactive")}).join(`
|
|
25
|
+
${a.cyan(_)} `)}
|
|
26
|
+
${a.cyan(Q)}
|
|
27
|
+
`}}}).prompt()}function rn(e){let n=(r,t)=>{let i=r.label??String(r.value);return t==="active"?`${a.cyan(Bi)} ${i} ${r.hint?a.dim(`(${r.hint})`):""}`:t==="selected"?`${a.green(Bt)} ${a.dim(i)}`:t==="cancelled"?`${a.strikethrough(a.dim(i))}`:t==="active-selected"?`${a.green(Bt)} ${i} ${r.hint?a.dim(`(${r.hint})`):""}`:t==="submitted"?`${a.dim(i)}`:`${a.dim(qi)} ${a.dim(i)}`};return new Li({options:e.options,initialValues:e.initialValues,required:e.required??!0,cursorAt:e.cursorAt,validate(r){if(this.required&&r.length===0)return`Please select at least one option.
|
|
28
|
+
${a.reset(a.dim(`Press ${a.gray(a.bgWhite(a.inverse(" space ")))} to select, ${a.gray(a.bgWhite(a.inverse(" enter ")))} to submit`))}`},render(){let r=`${a.gray(_)}
|
|
29
|
+
${tn(this.state)} ${e.message}
|
|
30
|
+
`,t=(i,s)=>{let o=this.value.includes(i.value);return s&&o?n(i,"active-selected"):o?n(i,"selected"):n(i,s?"active":"inactive")};switch(this.state){case"submit":return`${r}${a.gray(_)} ${this.options.filter(({value:i})=>this.value.includes(i)).map(i=>n(i,"submitted")).join(a.dim(", "))||a.dim("none")}`;case"cancel":{let i=this.options.filter(({value:s})=>this.value.includes(s)).map(s=>n(s,"cancelled")).join(a.dim(", "));return`${r}${a.gray(_)} ${i.trim()?`${i}
|
|
31
|
+
${a.gray(_)}`:""}`}case"error":{let i=this.error.split(`
|
|
32
|
+
`).map((s,o)=>o===0?`${a.yellow(Q)} ${a.yellow(s)}`:` ${s}`).join(`
|
|
33
|
+
`);return`${r+a.yellow(_)} ${Un({options:this.options,cursor:this.cursor,maxItems:e.maxItems,style:t}).join(`
|
|
34
|
+
${a.yellow(_)} `)}
|
|
35
35
|
${i}
|
|
36
|
-
`}default:return`${r}${
|
|
37
|
-
${
|
|
38
|
-
${
|
|
39
|
-
`}}}).prompt()}var
|
|
36
|
+
`}default:return`${r}${a.cyan(_)} ${Un({options:this.options,cursor:this.cursor,maxItems:e.maxItems,style:t}).join(`
|
|
37
|
+
${a.cyan(_)} `)}
|
|
38
|
+
${a.cyan(Q)}
|
|
39
|
+
`}}}).prompt()}var Fn=e=>e.replace(Qi(),"");function Xt(e="",n=""){let r=`
|
|
40
40
|
${e}
|
|
41
41
|
`.split(`
|
|
42
|
-
`),t=
|
|
43
|
-
`);D.stdout.write(`${
|
|
44
|
-
${
|
|
42
|
+
`),t=Fn(n).length,i=Math.max(r.reduce((o,u)=>(u=Fn(u),u.length>o?u.length:o),0),t)+2,s=r.map(o=>`${a.gray(_)} ${a.dim(o)}${" ".repeat(i-Fn(o).length)}${a.gray(_)}`).join(`
|
|
43
|
+
`);D.stdout.write(`${a.gray(_)}
|
|
44
|
+
${a.green(nn)} ${a.reset(n)} ${a.gray(qt.repeat(Math.max(i-t-1,1))+Wi)}
|
|
45
45
|
${s}
|
|
46
|
-
${
|
|
47
|
-
`)}function O(e=""){D.stdout.write(`${
|
|
46
|
+
${a.gray(zi+qt.repeat(i+2)+Xi)}
|
|
47
|
+
`)}function O(e=""){D.stdout.write(`${a.gray(Q)} ${a.red(e)}
|
|
48
48
|
|
|
49
|
-
`)}function
|
|
50
|
-
`)}function
|
|
51
|
-
${
|
|
49
|
+
`)}function Kt(e=""){D.stdout.write(`${a.gray(Ui)} ${e}
|
|
50
|
+
`)}function ke(e=""){D.stdout.write(`${a.gray(_)}
|
|
51
|
+
${a.gray(Q)} ${e}
|
|
52
52
|
|
|
53
|
-
`)}var T={message:(e="",{symbol:n=
|
|
54
|
-
`);r.push(`${n} ${t}`,...i.map(s=>`${
|
|
53
|
+
`)}var T={message:(e="",{symbol:n=a.gray(_)}={})=>{let r=[`${a.gray(_)}`];if(e){let[t,...i]=e.split(`
|
|
54
|
+
`);r.push(`${n} ${t}`,...i.map(s=>`${a.gray(_)} ${s}`))}D.stdout.write(`${r.join(`
|
|
55
55
|
`)}
|
|
56
|
-
`)},info:e=>{T.message(e,{symbol:
|
|
57
|
-
`);let
|
|
58
|
-
`),b(),r()}return{start:h,stop:k,message:(
|
|
59
|
-
- Import aliases ${
|
|
60
|
-
- See: ${
|
|
61
|
-
${t}`:`${r}, ${t}`)}var
|
|
62
|
-
${q.gray(
|
|
63
|
-
${q.gray(
|
|
64
|
-
${q.gray(
|
|
56
|
+
`)},info:e=>{T.message(e,{symbol:a.blue(Ki)})},success:e=>{T.message(e,{symbol:a.green(Ji)})},step:e=>{T.message(e,{symbol:a.green(nn)})},warn:e=>{T.message(e,{symbol:a.yellow(Hi)})},warning:e=>{T.warn(e)},error:e=>{T.message(e,{symbol:a.red(Yi)})}};function Zi(){let e=Vn?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],n=Vn?80:120,r,t,i=!1,s="";function o(l){let p=l>1?"Something went wrong":"Canceled";i&&k(p,l)}let u=()=>o(2),c=()=>o(1);function f(){D.on("uncaughtExceptionMonitor",u),D.on("unhandledRejection",u),D.on("SIGINT",c),D.on("SIGTERM",c)}function b(){D.removeListener("uncaughtExceptionMonitor",u),D.removeListener("unhandledRejection",u),D.removeListener("SIGINT",c),D.removeListener("SIGTERM",c)}function h(l=""){i=!0,r=Vi(),s=l.replace(/\.+$/,""),D.stdout.write(`${a.gray(_)}
|
|
57
|
+
`);let p=0,v=0;f(),t=setInterval(()=>{let w=a.magenta(e[p]),R=".".repeat(Math.floor(v)).slice(0,3);D.stdout.write(ge.cursor.move(-999,0)),D.stdout.write(ge.erase.down(1)),D.stdout.write(`${w} ${s}${R}`),p=p+1<e.length?p+1:0,v=v<e.length?v+.125:0},n)}function k(l="",p=0){s=l??s,i=!1,clearInterval(t);let v=p===0?a.green(nn):p===1?a.red(Wt):a.red(zt);D.stdout.write(ge.cursor.move(-999,0)),D.stdout.write(ge.erase.down(1)),D.stdout.write(`${v} ${s}
|
|
58
|
+
`),b(),r()}return{start:h,stop:k,message:(l="")=>{s=l??s}}}function Qi(){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,"g")}async function xe(e){for(let n of e){if(n.enabled===!1)continue;let r=Zi();r.start(n.title);let t=await n.task(r.message);r.stop(t||n.title)}}function _e(e){T.message(),typeof e=="string"&&(O(e),sn.exit(1)),(e instanceof on||e instanceof ee)&&(O(`[${e.name}]: ${e.message}`),sn.exit(1)),e instanceof Error&&(O(e.stack),sn.exit(1)),O("Something went wrong. Please try again."),sn.exit(1)}function j(e){return new on(e)}var on=class extends Error{name="CLI Error"},ee=class extends Error{name="Config Error"};function Ne(e,n){let r=Mt(n);return r===null?void 0:r(e)[0]}import rs from"fs";import is from"path";import{execa as ss}from"execa";import Jt from"path";import es from"fs";import{fileURLToPath as ns}from"url";function un(){let e=ts("../package.json");return Yt(e)}function ts(e){let n=ns(new URL(".",import.meta.url));return Jt.resolve(n,e)}function Ht(e){let n=Jt.resolve(e,"package.json");return Yt(n)}function Yt(e){let n=es.readFileSync(e,{encoding:"utf8"});return JSON.parse(n)}async function an(e){if(os(e)){if(rs.existsSync(is.join(e,".svelte-kit")))return;let r=(await je({cwd:e}))?.agent??"npm",t=H(r,"execute-local",["svelte-kit","sync"]);await ss(t.command,t.args,{cwd:e})}}function os(e){let n=Ht(e);return{...n.devDependencies,...n.dependencies}["@sveltejs/kit"]!==void 0}var Qt="default",Bn="$lib/components",qn="$lib/utils",Wn="src/app.pcss",zn="tailwind.config.cjs",er="slate";var ue=(...e)=>Fe.bold.cyan(...e),Ve=S({$schema:F(g()),style:g(),tailwind:S({config:g(),css:g(),baseColor:g()}),aliases:S({components:kn(g(),Xe(e=>e.replace(/[\u{0080}-\u{FFFF}]/gu,""))),utils:kn(g(),Xe(e=>e.replace(/[\u{0080}-\u{FFFF}]/gu,"")))}),typescript:F(z(),!0)}),us=S({...Ve.entries,...S({resolvedPaths:S({tailwindConfig:g(),tailwindCss:g(),utils:g(),components:g()})}).entries});async function we(e){let n=await ls(e);return n?await Xn(e,n):null}async function Xn(e,n){await an(e);let r=n.typescript?"tsconfig.json":"jsconfig.json",t=as(e,r);if(t===null)throw j(`Missing ${ue("paths")} field in your ${ue(r)} for path aliases. See: ${Fe.underline("https://www.shadcn-svelte.com/docs/installation/manual#configure-path-aliases")}`);let i=Ne(n.aliases.utils,t),s=Ne(n.aliases.components,t),o=(u,c)=>new ee(`Invalid import alias found: (${ue(`"${u}": "${c}"`)}) in ${ue("components.json")}.
|
|
59
|
+
- Import aliases ${Fe.underline("must use")} existing path aliases defined in your ${ue(r)} (e.g. "${u}": "$lib/${u}").
|
|
60
|
+
- See: ${Fe.underline("https://www.shadcn-svelte.com/docs/installation/manual#configure-path-aliases")}.`);if(i===void 0)throw o("utils",n.aliases.utils);if(s===void 0)throw o("components",n.aliases.components);return M(us,{...n,resolvedPaths:{tailwindConfig:ln.resolve(e,n.tailwind.config),tailwindCss:ln.resolve(e,n.tailwind.css),utils:i,components:s}})}function as(e,n){let r=De(ln.resolve(e,"package.json"),n);if(r===null)throw j(`Failed to find ${ue(n)}. See: ${Fe.underline("https://www.shadcn-svelte.com/docs/installation#opt-out-of-typescript")}`);return r}async function ls(e){let n=ln.resolve(e,"components.json");if(!Zt.existsSync(n))return null;try{let r=Zt.readFileSync(n,{encoding:"utf8"}),t=JSON.parse(r);return M(Ve,t)}catch{throw new ee(`Invalid configuration found in ${ue(n)}.`)}}import ps from"process";function Ee(){let{env:e}=ps;return e.HTTP_PROXY||e.http_proxy||e.HTTPS_PROXY||e.https_proxy||e.npm_config_proxy||e.npm_config_https_proxy}import ms from"path";import hs from"process";import{fetch as ds}from"node-fetch-native";import{createProxy as vs}from"node-fetch-native/proxy";var nr=S({name:g(),dependencies:W(g()),registryDependencies:W(g()),files:W(g()),type:bn(["components:ui","components:component","components:example"])}),tr=W(nr),fs=S({...nr.entries,...S({files:W(S({name:g(),content:g()}))}).entries}),rr=W(fs),lu=W(S({name:g(),label:g()})),ir=S({inlineColors:S({light:fe(g(),g()),dark:fe(g(),g())}),cssVars:S({light:fe(g(),g()),dark:fe(g(),g())}),inlineColorsTemplate:g(),cssVarsTemplate:g()});var sr=hs.env.COMPONENTS_REGISTRY_URL??"https://shadcn-svelte.com";async function cn(){try{let[e]=await Kn(["index.json"]);return M(tr,e)}catch{throw j("Failed to fetch components from registry.")}}function or(){return[{name:"slate",label:"Slate"},{name:"gray",label:"Gray"},{name:"zinc",label:"Zinc"},{name:"neutral",label:"Neutral"},{name:"stone",label:"Stone"}]}function ur(){return[{name:"default",label:"Default"},{name:"new-york",label:"New York"}]}async function ar(e){try{let[n]=await Kn([`colors/${e}.json`]);return M(ir,n)}catch{throw j("Failed to fetch base color from registry.")}}async function Me(e,n,r=!0){let t=[];for(let i of n){let s=e.find(o=>o.name===i);if(s&&(t.push(s),r&&s.registryDependencies)){let o=await Me(e,s.registryDependencies);t.push(...o)}}return t.filter((i,s,o)=>o.findIndex(u=>u.name===i.name)===s)}async function pn(e,n){try{let r=e.typescript?e.style:`${e.style}-js`,t=n.map(s=>`styles/${r}/${s.name}.json`),i=await Kn(t);return M(rr,i)}catch{throw j("Failed to fetch tree from registry.")}}function Ge(e,n,r){if(r&&n.type!=="components:ui")return r;let[t,i]=n.type.split(":");return!t||!i||!(t in e.resolvedPaths)?null:ms.join(e.resolvedPaths[t],i)}async function Kn(e){let n=Ee(),r=n?vs({url:n}):{};try{return await Promise.all(e.map(async i=>await(await ds(`${sr}/registry/${i}`,{...r})).json()))}catch{throw j(`Failed to fetch registry from ${sr}.`)}}function fn(e,n){let r=e.replace(/\$lib\/registry\/[^/]+/g,n.aliases.components);return r=r.replace(/\$lib\/utils/g,n.aliases.utils),r}import gs from"process";import lr from"chalk";function Ae(){let e=un(),n=lr.bgHex("#FF5500").black(" shadcn-svelte "),r=lr.gray(` v${e.version} `);Kt(n+r),(typeof Bun<"u"||typeof Deno<"u")&&T.warn("You are currently using an unsupported runtime. Only Node.js v18 or higher is officially supported. Continue at your own risk.")}function cr(){O("Operation cancelled."),gs.exit(0)}function ne(e,n=9){return e.reduce((r,t,i)=>i%n===0?`${r},
|
|
61
|
+
${t}`:`${r}, ${t}`)}var tt=pt(br(),1);import nt from"fs";import ae from"path";var Ls=["app.css","app.pcss","app.postcss","main.css","main.pcss","main.postcss","globals.css","globals.pcss","globals.postcss"],Ns=["tailwind.config.js","tailwind.config.cjs","tailwind.config.mjs","tailwind.config.ts"],Fs=["node_modules",".git",".svelte-kit"];function kr(e,n){let r,t,i=Vs(e);for(let s of i){let o=ae.parse(s).base;t===void 0&&Ls.includes(o)&&(t=n?.relative?ae.relative(e,s):s),r===void 0&&Ns.includes(o)&&(r=n?.relative?ae.relative(e,s):s)}return{tailwindPath:r,cssPath:t}}function Vs(e){return xr(e,[])}function xr(e,n){let r=[],t=nt.readdirSync(e,{withFileTypes:!0}),i=ae.join(e,".gitignore");if(nt.existsSync(i)){let s=nt.readFileSync(i,{encoding:"utf8"}),o=(0,tt.default)().add(s);n.push({dirPath:e,ig:o})}for(let s of t){let o=ae.join(e,s.name);Fs.some(c=>e.includes(c))||n.some(c=>{let f=ae.relative(c.dirPath,o);return tt.default.isPathValid(f)===!1?!1:c.ig.ignores(f)})||(s.isFile()&&r.push(o),s.isDirectory()&&r.push(...xr(o,n)))}return r}function $r(e){let n=ae.resolve(e,"package.json"),r=De(n,"tsconfig.json");if(r!==null)return{type:"tsconfig.json",config:r};let t=De(n,"jsconfig.json");if(t!==null)return{type:"jsconfig.json",config:t}}var Ms=me.filter(e=>!e.includes("@"));async function Ce(e,n){let r=(await je({cwd:e}))?.agent;if(!r&&n){let t=Ms.map(o=>({value:o,label:o}));t.unshift({label:"None",value:void 0});let i=$n()??void 0,s=await Le({options:t,message:"Which package manager do you want to use?",initialValue:i});return V(s)&&cr(),s}return r}var J=(...e)=>q.bold.cyan(...e),Bs=S({components:F(W(g())),yes:z(),all:z(),overwrite:z(),cwd:g(),path:F(g()),deps:z(),proxy:F(g())}),_r=new Gs().command("add").description("add components to your project").argument("[components...]","name of components").option("-c, --cwd <cwd>","the working directory",te.cwd()).option("--no-deps","skips adding & installing package dependencies").option("-a, --all","install all components to your project",!1).option("-y, --yes","skip confirmation prompt",!1).option("-o, --overwrite","overwrite existing files",!1).option("--proxy <proxy>","fetch components from registry using a proxy",Ee()).option("-p, --path <path>","the path to add the component to").action(async(e,n)=>{try{Ae();let r=M(Bs,{components:e,...n}),t=le.resolve(r.cwd);if(!mn(t))throw j(`The path ${q.cyan(t)} does not exist. Please try again.`);let i=await we(t);if(!i)throw new ee(`Configuration file is missing. Please run ${q.green("init")} to create a ${J("components.json")} file.`);await qs(t,i,r),ke(`${q.green("Success!")} Component installation completed.`)}catch(r){_e(r)}});async function qs(e,n,r){r.proxy!==void 0&&(te.env.HTTP_PROXY=r.proxy,T.info(`You are using the provided proxy: ${q.green(r.proxy)}`));let t=await cn(),i=new Set(r.all?t.map(({name:l})=>l):r.components),s=new Map;for(let l of t)s.set(l.name,l.registryDependencies);if(i===void 0||i.size===0){let l=await rn({message:`Which ${J("components")} would you like to install?`,maxItems:10,options:t.map(({name:p,dependencies:v,registryDependencies:w})=>{let R=[...r.deps?v:[],...w];return{label:p,value:p,hint:R.length?`also installs: ${R.join(", ")}`:void 0}})});V(l)&&(O("Operation cancelled."),te.exit(0)),i=new Set(l)}else{let l=ne(Array.from(i));T.step(`Components to install:
|
|
62
|
+
${q.gray(l)}`)}for(let l of i)s.get(l)?.forEach(v=>i.add(v));let o=await Me(t,Array.from(i),!1),u=await pn(n,o);u.length===0&&(O("Selected components not found."),te.exit(0));let c=[],f=r.path?le.resolve(e,r.path):void 0;for(let l of u){if(i.has(l.name)===!1)continue;let p=Ge(n,l,f);if(p===null)continue;l.files.some(w=>mn(le.resolve(p,l.name,w.name)))&&c.push(l.name)}if(r.overwrite===!1&&c.length>0){let l=ne(c);T.warn(`The following components ${q.bold.yellow("already exists")}:
|
|
63
|
+
${q.gray(l)}`);let p=await be({message:`Would you like to ${q.bold.red("overwrite")} all existing components?`,active:"Yes, overwrite everything",inactive:"No, let me decide individually",initialValue:!1});V(p)&&(O("Operation cancelled."),te.exit(0)),r.overwrite=p}if(r.yes===!1){let l=await be({message:`Ready to install ${J("components")}${r.deps?` and ${J("dependencies")}?`:"?"}`,initialValue:!0});(V(l)||l===!1)&&(O("Operation cancelled."),te.exit(0))}let b=new Set,h=new Set,k=[];for(let l of u){let p=Ge(n,l,f);if(p===null)continue;mn(p)||await rt.mkdir(p,{recursive:!0});let v=le.relative(te.cwd(),le.resolve(p,l.name));if(!r.overwrite&&c.includes(l.name)&&i.has(l.name)){T.warn(`Component ${J(l.name)} already exists at ${q.gray(v)}`);let w=await be({message:`Would you like to ${q.bold.red("overwrite")} your existing ${J(l.name)} component?`});if(V(w)&&(O("Operation cancelled."),te.exit(0)),w===!1)continue}r.deps?l.dependencies.forEach(w=>h.add(w)):l.dependencies.forEach(w=>b.add(w)),k.push({title:`Installing ${J(l.name)}`,async task(){for(let w of l.files){let R=le.resolve(p,l.name),m=le.resolve(p,l.name,w.name),E=fn(w.content,n);mn(R)||await rt.mkdir(R,{recursive:!0}),await rt.writeFile(m,E)}return`${J(l.name)} installed at ${q.gray(v)}`}})}let y=await Ce(e,r.deps);if(y){let l=H(y,"add",["-D",...h]);k.push({title:`${J(y)}: Installing dependencies`,enabled:h.size>0,async task(){return await Us(l.command,l.args,{cwd:e}),`Dependencies installed with ${J(y)}`}})}if(await xe(k),!r.deps){let l=ne([...b],7);T.warn(`Components have been installed ${q.bold.red("without")} the following ${J("dependencies")}:
|
|
64
|
+
${q.gray(l)}`)}}import{existsSync as Se,promises as Te}from"fs";import re from"path";import ce from"process";import G from"chalk";import{Command as Ks,Option as Ar}from"commander";import{execa as Js}from"execa";var hn=`import { type ClassValue, clsx } from "clsx";
|
|
65
65
|
import { twMerge } from "tailwind-merge";
|
|
66
66
|
import { cubicOut } from "svelte/easing";
|
|
67
67
|
import type { TransitionConfig } from "svelte/transition";
|
|
@@ -122,7 +122,7 @@ export const flyAndScale = (
|
|
|
122
122
|
},
|
|
123
123
|
easing: cubicOut
|
|
124
124
|
};
|
|
125
|
-
};`,
|
|
125
|
+
};`,dn=`import { clsx } from "clsx";
|
|
126
126
|
import { twMerge } from "tailwind-merge";
|
|
127
127
|
import { cubicOut } from "svelte/easing";
|
|
128
128
|
|
|
@@ -169,13 +169,13 @@ export const flyAndScale = (
|
|
|
169
169
|
},
|
|
170
170
|
easing: cubicOut
|
|
171
171
|
};
|
|
172
|
-
};`,
|
|
172
|
+
};`,Ws=`import { fontFamily } from "tailwindcss/defaultTheme";
|
|
173
173
|
|
|
174
174
|
/** @type {import('tailwindcss').Config} */
|
|
175
|
-
const config = {`,
|
|
175
|
+
const config = {`,zs=`import { fontFamily } from "tailwindcss/defaultTheme";
|
|
176
176
|
import type { Config } from "tailwindcss";
|
|
177
177
|
|
|
178
|
-
const config: Config = {`,
|
|
178
|
+
const config: Config = {`,wr=`
|
|
179
179
|
darkMode: ["class"],
|
|
180
180
|
content: ["./src/**/*.{html,js,svelte,ts}"],
|
|
181
181
|
safelist: ["dark"],
|
|
@@ -236,10 +236,10 @@ const config: Config = {`,gr=`
|
|
|
236
236
|
};
|
|
237
237
|
|
|
238
238
|
export default config;
|
|
239
|
-
`,
|
|
240
|
-
${G.gray(s)}`)}}import{existsSync as
|
|
239
|
+
`,Er={TS:zs+wr,JS:Ws+wr};var Cr=["tailwind-variants","clsx","tailwind-merge"],X=(...e)=>G.bold.cyan(...e),it=or(),st=ur(),Hs=S({cwd:g(),style:F(g()),baseColor:F(g()),css:F(g()),tailwindConfig:F(g()),componentsAlias:F(g()),utilsAlias:F(g()),deps:z()}),Tr=new Ks().command("init").description("initialize your project and install dependencies").option("-c, --cwd <cwd>","the working directory",ce.cwd()).option("--no-deps","disable adding & installing dependencies").addOption(new Ar("--style <name>","the style for the components").choices(st.map(e=>e.name))).addOption(new Ar("--base-color <name>","the base color for the components").choices(it.map(e=>e.name))).option("--css <path>","path to the global CSS file").option("--tailwind-config <path>","path to the tailwind config file").option("--components-alias <path>","import alias for components").option("--utils-alias <path>","import alias for utils").action(async e=>{Ae();let n=M(Hs,e),r=re.resolve(n.cwd);try{if(!Se(r))throw j(`The path ${G.cyan(r)} does not exist. Please try again.`);let t=await we(r),i=await Zs(r,t,n);await Qs(r,i,n),ke(`${G.green("Success!")} Project initialization completed.`)}catch(t){_e(t)}});function Ys(e,n,r){if(n.css&&!Se(re.resolve(e,n.css)))throw j(`The provided global CSS file path ${G.cyan(n.css)} does not exist. Please enter a valid path.`);if(n.tailwindConfig&&!Se(re.resolve(e,n.tailwindConfig)))throw j(`The provided tailwind config file path ${G.cyan(n.tailwindConfig)} does not exist. Please enter a valid path.`);if(n.componentsAlias){let t=vn(n.componentsAlias,r);if(t)throw j(t)}if(n.utilsAlias){let t=vn(n.utilsAlias,r);if(t)throw j(t)}}async function Zs(e,n,r){await an(e);let t=kr(e,{relative:!0}),i=$r(e);if(i===void 0)throw j(`Failed to find a ${X("tsconfig.json")} or ${X("jsconfig.json")} file. See: ${G.underline("https://www.shadcn-svelte.com/docs/installation#opt-out-of-typescript")}`);Ys(e,r,i);let s=st.find(y=>y.name===r.style)?.name;if(s===void 0){let y=await Le({message:`Which ${X("style")} would you like to use?`,initialValue:n?.style??Qt,options:st.map(l=>({label:l.label,value:l.name}))});V(y)&&(O("Operation cancelled."),ce.exit(0)),s=y}let o=it.find(y=>y.name===r.baseColor)?.name;if(o===void 0){let y=await Le({message:`Which ${X("base color")} would you like to use?`,initialValue:n?.tailwind.baseColor??er,options:it.map(l=>({label:l.label,value:l.name}))});V(y)&&(O("Operation cancelled."),ce.exit(0)),o=y}let u=r.css;if(u===void 0){let y=await Re({message:`Where is your ${X("global CSS")} file? ${G.gray("(this file will be overwritten)")}`,initialValue:n?.tailwind.css??t.cssPath??Wn,placeholder:t.cssPath??Wn,validate:l=>{if(!(l&&Se(re.resolve(e,l))))return`"${G.bold(l)}" does not exist. Please enter a valid path.`}});V(y)&&(O("Operation cancelled."),ce.exit(0)),u=y}let c=r.tailwindConfig;if(c===void 0){let y=await Re({message:`Where is your ${X("Tailwind config")} located? ${G.gray("(this file will be overwritten)")}`,initialValue:n?.tailwind.config??t.tailwindPath??zn,placeholder:t.tailwindPath??zn,validate:l=>{if(!(l&&Se(re.resolve(e,l))))return`"${G.bold(l)}" does not exist. Please enter a valid path.`}});V(y)&&(O("Operation cancelled."),ce.exit(0)),c=y}let f=r.componentsAlias;if(f===void 0){let y=await Re({message:`Configure the import alias for ${X("components")}:`,initialValue:n?.aliases.components??Bn,placeholder:Bn,validate:l=>vn(l,i)});V(y)&&(O("Operation cancelled."),ce.exit(0)),f=y}let b=r.utilsAlias;if(b===void 0){let y=await Re({message:`Configure the import alias for ${X("utils")}:`,initialValue:n?.aliases.utils??`${f?.split("/").slice(0,-1).join("/")}/utils`??qn,placeholder:qn,validate:l=>vn(l,i)});V(y)&&(O("Operation cancelled."),ce.exit(0)),b=y}let h=M(Ve,{$schema:"https://shadcn-svelte.com/schema.json",style:s,typescript:i.type==="tsconfig.json",tailwind:{config:c,css:u,baseColor:o},aliases:{utils:b,components:f}});if(h.tailwind.config.endsWith(".cjs")){T.info(`Your tailwind config has been renamed to ${X("tailwind.config.js")}.`),await Te.unlink(h.tailwind.config).catch(()=>null);let y=h.tailwind.config.replace(".cjs",".js");h.tailwind.config=y}return await Xn(e,h)}function vn(e,n){if(Ne(e,n.config)===void 0)return`"${G.bold(e)}" does not use an existing path alias defined in your ${G.bold(n.type)}. See: ${G.underline("https://www.shadcn-svelte.com/docs/installation/manual#configure-path-aliases")}`}async function Qs(e,n,r){let t=[];t.push({title:"Creating config file",async task(){let s=re.resolve(e,"components.json"),o=M(Ve,n);return await Te.writeFile(s,JSON.stringify(o,null," "),"utf8"),`Config file ${X("components.json")} created`}}),t.push({title:"Initializing project",async task(){for(let[h,k]of Object.entries(n.resolvedPaths)){let y=re.extname(k)?re.dirname(k):k;h==="utils"&&k.endsWith("/utils")&&(y=y.replace(/\/utils$/,"")),!Se(y)&&h!=="utils"&&await Te.mkdir(y,{recursive:!0})}let{TS:s,JS:o}=Er,u=n.resolvedPaths.tailwindConfig.endsWith(".ts")?s:o;await Te.writeFile(n.resolvedPaths.tailwindConfig,u,"utf8");let c=await ar(n.tailwind.baseColor);c&&await Te.writeFile(n.resolvedPaths.tailwindCss,c.cssVarsTemplate,"utf8");let f=n.resolvedPaths.utils+(n.typescript?".ts":".js"),b=n.typescript?hn:dn;return await Te.writeFile(f,b,"utf8"),"Project initialized"}});let i=await Ce(e,r.deps);if(i){let s=H(i,"add",["-D",...Cr]);t.push({title:`${X(i)}: Installing dependencies`,enabled:r.deps,async task(){return await Js(s.command,s.args,{cwd:e}),`Dependencies installed with ${X(i)}`}})}if(await xe(t),!r.deps){let s=ne([...Cr],7);T.warn(`shadcn-svelte has been initialized ${G.bold.red("without")} the following ${X("dependencies")}:
|
|
240
|
+
${G.gray(s)}`)}}import{existsSync as Ue,promises as Ie}from"fs";import ie from"path";import Be from"process";import U from"chalk";import{Command as eo}from"commander";import{execa as no}from"execa";var Z=e=>U.bold.cyan(e),to=S({all:z(),components:F(W(g())),cwd:g(),proxy:F(g()),yes:z()}),Sr=new eo().command("update").description("update components in your project").argument("[components...]","name of components").option("-c, --cwd <cwd>","the working directory",Be.cwd()).option("-a, --all","update all existing components",!1).option("-y, --yes","skip confirmation prompt",!1).option("--proxy <proxy>","fetch components from registry using a proxy",Ee()).action(async(e,n)=>{Ae();try{let r=M(to,{components:e,...n}),t=ie.resolve(r.cwd);if(!Ue(t))throw j(`The path ${U.cyan(t)} does not exist. Please try again.`);let i=await we(t);if(!i)throw j(`Configuration file is missing. Please run ${U.green("init")} to create a ${Z("components.json")} file.`);await ro(t,i,r),Xt(`This action ${U.underline("does not")} update your ${Z("dependencies")} to their ${U.bold("latest")} versions.
|
|
241
241
|
|
|
242
|
-
Consider updating them as well.`),
|
|
243
|
-
${U.gray(
|
|
244
|
-
${
|
|
245
|
-
`)}`);Object.keys(h).length>0&&T.message(U.bold("You may want to delete them."))}
|
|
242
|
+
Consider updating them as well.`),ke(`${U.green("Success!")} Component update completed.`)}catch(r){_e(r)}});async function ro(e,n,r){r.proxy!==void 0&&(Be.env.HTTP_PROXY=r.proxy,T.info(`You are using the provided proxy: ${U.green(r.proxy)}`));let t=r.components,i=await cn(),s=ie.resolve(n.resolvedPaths.components,"ui");if(!Ue(s))throw j(`Component directory ${U.cyan(s)} does not exist.`);let o=[],u=await Ie.readdir(s,{withFileTypes:!0});for(let p of u)if(p.isDirectory()){let v=i.find(w=>w.name===p.name);v&&o.push(v)}o.push({name:"utils",type:"components:ui",files:[],dependencies:[],registryDependencies:[]});let c=r.all?o:[];if(c.length===0&&t!==void 0&&(c=o.filter(p=>t.includes(p.name))),c.length===0){let p=await rn({message:"Which components would you like to update?",maxItems:10,options:o.map(v=>({label:v.name,value:v,hint:v.registryDependencies.length?`also updates: ${v.registryDependencies.join(", ")}`:void 0}))});V(p)&&(O("Operation cancelled."),Be.exit(0)),c=p}else{let p=ne(c.map(({name:v})=>v));T.step(`Components to update:
|
|
243
|
+
${U.gray(p)}`)}if(r.yes===!1){let p=await be({message:`Ready to update ${Z("components")}? ${U.gray("(Make sure you have committed your changes before proceeding!)")}`,initialValue:!0});(V(p)||p===!1)&&(O("Operation cancelled."),Be.exit(0))}if(c.find(p=>p.name==="utils")){let p=n.typescript?".ts":".js",v=n.resolvedPaths.utils+p;if(!Ue(v))throw j(`Failed to find ${Z("utils")} at ${U.cyan(v)}`);await Ie.writeFile(v,n.typescript?hn:dn)}let f=await Me(i,c.map(p=>p.name)),b=(await pn(n,f)).sort((p,v)=>p.name.localeCompare(v.name)),h={},k=new Set,y=[];for(let p of b){let v=Ge(n,p);v&&(p.dependencies.forEach(w=>k.add(w)),y.push({title:`Updating ${Z(p.name)}`,async task(){Ue(v)||await Ie.mkdir(v,{recursive:!0});let w=ie.resolve(v,p.name);Ue(w)||await Ie.mkdir(w,{recursive:!0});for(let C of p.files){let L=ie.resolve(v,p.name,C.name),qe=fn(C.content,n);await Ie.writeFile(L,qe)}let R=await Ie.readdir(w),m=p.files.map(C=>C.name),E=R.filter(C=>!m.includes(C)).map(C=>ie.resolve(v,p.name,C));E.length>0&&(h[p.name]=E);let x=ie.relative(Be.cwd(),ie.resolve(v,p.name));return`${Z(p.name)} updated at ${U.gray(x)}`}}))}let l=await Ce(e,!0);if(l){let p=H(l,"add",["-D",...k]);y.push({title:`${Z(l)}: Installing dependencies`,enabled:k.size>0,async task(){return await no(p.command,p.args,{cwd:e}),`Dependencies installed with ${Z(l)}`}})}await xe(y);for(let[p,v]of Object.entries(h))T.warn(`The ${Z(p)} component does not use the following files:
|
|
244
|
+
${v.map(w=>U.white(`- ${U.gray(ie.relative(e,w))}`)).join(`
|
|
245
|
+
`)}`);Object.keys(h).length>0&&T.message(U.bold("You may want to delete them."))}Oe.on("SIGINT",()=>Oe.exit(0));Oe.on("SIGTERM",()=>Oe.exit(0));var Or=Oe.versions.node,so=Number.parseInt(Or.split(".")[0],10),Ir=18;so<Ir&&(console.error(`Node.js v${Or} is out of date and unsupported!`),console.error(`Please use Node.js v${Ir} or higher.`),Oe.exit(1));async function oo(){console.clear();let e=un(),n=new io().name("shadcn-svelte").description("Add shadcn-svelte components to your project").version(e.version||"0.0.0","-v, --version","display the version number");n.addCommand(Tr).addCommand(_r).addCommand(Sr),n.parse()}oo();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shadcn-svelte",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.2",
|
|
4
4
|
"description": "Add components to your apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -13,8 +13,6 @@
|
|
|
13
13
|
"directory": "packages/cli"
|
|
14
14
|
},
|
|
15
15
|
"type": "module",
|
|
16
|
-
"exports": "./dist/index.js",
|
|
17
|
-
"main": "./dist/index.js",
|
|
18
16
|
"bin": "./dist/index.js",
|
|
19
17
|
"files": [
|
|
20
18
|
"dist"
|
|
@@ -42,7 +40,7 @@
|
|
|
42
40
|
"cross-env": "^7.0.3",
|
|
43
41
|
"get-tsconfig": "^4.7.3",
|
|
44
42
|
"ignore": "^5.3.1",
|
|
45
|
-
"package-manager-detector": "^
|
|
43
|
+
"package-manager-detector": "^1.2.0",
|
|
46
44
|
"sisteransi": "^1.0.5",
|
|
47
45
|
"tsup": "^8.0.0",
|
|
48
46
|
"type-fest": "^3.13.1",
|