stera-ui 0.8.1 → 0.9.0
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/add-JTKZDMNI.js +2 -0
- package/dist/chunk-42DL2YAQ.js +2 -0
- package/dist/chunk-FZGIVCWE.js +42175 -0
- package/dist/chunk-LUUYMQIF.js +97 -0
- package/dist/chunk-MBBLZJIK.js +2 -0
- package/dist/chunk-OPVLMYW5.js +2 -0
- package/dist/chunk-OSMC63WJ.js +2 -0
- package/dist/chunk-P2O7D5BG.js +2 -0
- package/dist/chunk-UVHQPGZ3.js +7 -0
- package/dist/chunk-XJ6VM67K.js +2 -0
- package/dist/cli.js +29 -32
- package/dist/index.js +2 -86
- package/dist/init-XAKB27HW.js +12 -0
- package/dist/list-W7ECLPKW.js +5 -0
- package/dist/registry/index.d.ts +3 -1
- package/dist/registry/index.js +2 -17
- package/dist/schema/index.js +2 -18
- package/dist/utils/index.d.ts +26 -3
- package/dist/utils/index.js +2 -58
- package/package.json +6 -8
- package/dist/add-DBC33IWM.js +0 -201
- package/dist/chunk-4E46BULJ.js +0 -79
- package/dist/chunk-BJNLGEZJ.js +0 -100
- package/dist/chunk-KGMF6UW4.js +0 -21
- package/dist/chunk-KKUJRJ2N.js +0 -209
- package/dist/chunk-RQ7T7RF5.js +0 -880
- package/dist/chunk-UKHKFX2A.js +0 -376
- package/dist/init-EQHYR7MG.js +0 -763
- package/dist/list-M73QTIWR.js +0 -44
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import{g as o}from"./chunk-OPVLMYW5.js";o();var c="\x1B[38;2;166;244;48m",e="\x1B[2m",p="\x1B[0m",x=process.stdout.isTTY&&!process.env.NO_COLOR,n=(s,t)=>x?`${s}${t}${p}`:t,r=s=>n(c,s),b=s=>n(e,s),R=r("\u273B"),d=r("\u2713"),g="\u2717",m="!";export{r as a,b,R as c,d,g as e,m as f};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
var a=Object.create;var r=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var u=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var s=(t,e)=>()=>(t&&(e=t(t=0)),e);var D=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),F=(t,e)=>{for(var o in e)r(t,o,{get:e[o],enumerable:!0})},_=(t,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of c(e))!l.call(t,m)&&m!==o&&r(t,m,{get:()=>e[m],enumerable:!(i=p(e,m))||i.enumerable});return t};var L=(t,e,o)=>(o=t!=null?a(f(t)):{},_(e||!t||!t.__esModule?r(o,"default",{value:t,enumerable:!0}):o,t));import d from"path";import{fileURLToPath as g}from"url";var n,h,U,b,x=s(()=>{"use strict";n=()=>g(import.meta.url),h=()=>d.dirname(n()),U=h(),b=n()});export{u as a,D as b,F as c,L as d,U as e,b as f,x as g};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import{g as p}from"./chunk-OPVLMYW5.js";p();function a(e,i,r){return r.reduce((n,m)=>m(n,i),e)}p();var o={utils:"@/lib/utils",ui:"@/components/ui",components:"@/components",lib:"@/lib",hooks:"@/hooks"},y=(e,i)=>{if(!i.filename.endsWith(".ts")&&!i.filename.endsWith(".tsx"))return e;let{aliases:r}=i.config,n=[];return r.utils!==o.utils&&n.push({type:"exact",from:o.utils,to:r.utils}),r.ui!==o.ui&&n.push({type:"prefix",from:o.ui,to:r.ui}),r.components!==o.components&&n.push({type:"prefix",from:o.components,to:r.components}),r.lib!==o.lib&&n.push({type:"prefix",from:o.lib,to:r.lib}),r.hooks!==o.hooks&&n.push({type:"prefix",from:o.hooks,to:r.hooks}),n.length===0?e:e.replace(/from\s+(["'])([^"']+)\1/g,(m,s,f)=>{for(let t of n){if(t.type==="exact"&&f===t.from)return`from ${s}${t.to}${s}`;if(t.type==="prefix"&&f.startsWith(t.from+"/")){let l=f.slice(t.from.length);return`from ${s}${t.to}${l}${s}`}if(t.type==="prefix"&&f===t.from)return`from ${s}${t.to}${s}`}return m})};export{a,y as b};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import{a as f,d as o,e as c}from"./chunk-MBBLZJIK.js";import{g as d}from"./chunk-OPVLMYW5.js";d();var S=["\u2022","\u2726","\u2736","\u273B"].map(f),I=150,w="\x1B[?25l",g="\x1B[?25h",i="\x1B[2K\r";function E(s){let t=process.stderr;if(!t.isTTY||process.env.CI)return t.write(`${s}...
|
|
3
|
+
`),{update(e){},stop(){},succeed(e){process.stdout.write(`${o} ${e}
|
|
4
|
+
`)},fail(e){process.stderr.write(`${c} ${e}
|
|
5
|
+
`)}};let p=0,a=!0,l=()=>{let e=s.slice(0,Math.max(0,(t.columns||80)-3));t.write(`${i}${S[p%S.length]} ${e}`),p++},r=()=>t.write(g),u=()=>{t.write(i),r(),process.exit(130)};t.write(w),process.once("exit",r),process.once("SIGINT",u),l();let $=setInterval(l,I),n=()=>{a&&(a=!1,clearInterval($),process.off("exit",r),process.off("SIGINT",u),t.write(i),r())};return{update(e){s=e},stop:n,succeed(e){n(),process.stdout.write(`${o} ${e}
|
|
6
|
+
`)},fail(e){n(),process.stderr.write(`${c} ${e}
|
|
7
|
+
`)}}}export{E as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import{d as f,f as h}from"./chunk-42DL2YAQ.js";import{g as m}from"./chunk-OPVLMYW5.js";m();var o=process.env.REGISTRY_URL??"https://ui.stera.sh/r",p=15e3,d=class extends Error{components;constructor(e){super(e.length===1?`Component "${e[0]}" not found in registry.`:`Components not found in registry: ${e.map(n=>`"${n}"`).join(", ")}.`),this.name="ComponentNotFoundError",this.components=e}},s=null;async function x(t){let e;try{e=await fetch(t,{signal:AbortSignal.timeout(p)})}catch(n){throw n instanceof Error&&n.name==="TimeoutError"?new Error(`Timed out fetching ${t} after ${p/1e3}s. Check your network connection.`):new Error(`Failed to fetch ${t}: ${n instanceof Error?n.message:String(n)}`)}if(!e.ok)throw new Error(`Failed to fetch ${t}: ${e.status} ${e.statusText}`);return e.json()}async function g(){if(s)return s;let t=await x(`${o}/index.json`),e=h.safeParse(t);if(!e.success)throw new Error(`Registry index at ${o}/index.json returned unexpected data.`);return s=e.data.items,s}async function l(t){let e=await x(`${o}/${t}.json`),n=f.safeParse(e);if(!n.success)throw new Error(`Registry item "${t}" returned unexpected data from ${o}/${t}.json.`);return n.data}async function $(t){return(await g()).find(n=>n.name===t)}async function P(){return g()}async function S(t,e){let n=await g(),w=new Map(n.map(r=>[r.name,r])),i=[],u=new Set,a=[],c=[...t];for(;c.length>0;){let r=c.shift();if(u.has(r))continue;u.add(r);let y=w.get(r);if(!y){a.push(r);continue}i.push(r),c.push(...y.registryDependencies??[])}if(a.length>0)throw new d(a);return e?.("downloading",i.length),Promise.all(i.map(r=>l(r)))}export{d as a,g as b,l as c,$ as d,P as e,S as f};
|
package/dist/cli.js
CHANGED
|
@@ -1,33 +1,30 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
`);
|
|
32
|
-
process.exit(1);
|
|
33
|
-
});
|
|
2
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
3
|
+
import{e as U}from"./chunk-MBBLZJIK.js";import{a as A,b as C,d as ot,g as m}from"./chunk-OPVLMYW5.js";var b=C($=>{"use strict";m();var w=class extends Error{constructor(t,e,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=e,this.exitCode=t,this.nestedError=void 0}},v=class extends w{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};$.CommanderError=w;$.InvalidArgumentError=v});var x=C(V=>{"use strict";m();var{InvalidArgumentError:at}=b(),S=class{constructor(t,e){switch(this.description=e||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(t,e){return e===this.defaultValue||!Array.isArray(e)?[t]:e.concat(t)}default(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(e,i)=>{if(!this.argChoices.includes(e))throw new at(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,i):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function ht(h){let t=h.name()+(h.variadic===!0?"...":"");return h.required?"<"+t+">":"["+t+"]"}V.Argument=S;V.humanReadableArgName=ht});var T=C(k=>{"use strict";m();var{humanReadableArgName:lt}=x(),H=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let e=t.commands.filter(n=>!n._hidden),i=t._getHelpCommand();return i&&!i._hidden&&e.push(i),this.sortSubcommands&&e.sort((n,s)=>n.name().localeCompare(s.name())),e}compareOptions(t,e){let i=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return i(t).localeCompare(i(e))}visibleOptions(t){let e=t.options.filter(n=>!n.hidden),i=t._getHelpOption();if(i&&!i.hidden){let n=i.short&&t._findOption(i.short),s=i.long&&t._findOption(i.long);!n&&!s?e.push(i):i.long&&!s?e.push(t.createOption(i.long,i.description)):i.short&&!n&&e.push(t.createOption(i.short,i.description))}return this.sortOptions&&e.sort(this.compareOptions),e}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let e=[];for(let i=t.parent;i;i=i.parent){let n=i.options.filter(s=>!s.hidden);e.push(...n)}return this.sortOptions&&e.sort(this.compareOptions),e}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(e=>{e.description=e.description||t._argsDescription[e.name()]||""}),t.registeredArguments.find(e=>e.description)?t.registeredArguments:[]}subcommandTerm(t){let e=t.registeredArguments.map(i=>lt(i)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(e?" "+e:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,e){return e.visibleCommands(t).reduce((i,n)=>Math.max(i,this.displayWidth(e.styleSubcommandTerm(e.subcommandTerm(n)))),0)}longestOptionTermLength(t,e){return e.visibleOptions(t).reduce((i,n)=>Math.max(i,this.displayWidth(e.styleOptionTerm(e.optionTerm(n)))),0)}longestGlobalOptionTermLength(t,e){return e.visibleGlobalOptions(t).reduce((i,n)=>Math.max(i,this.displayWidth(e.styleOptionTerm(e.optionTerm(n)))),0)}longestArgumentTermLength(t,e){return e.visibleArguments(t).reduce((i,n)=>Math.max(i,this.displayWidth(e.styleArgumentTerm(e.argumentTerm(n)))),0)}commandUsage(t){let e=t._name;t._aliases[0]&&(e=e+"|"+t._aliases[0]);let i="";for(let n=t.parent;n;n=n.parent)i=n.name()+" "+i;return i+e+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let e=[];return t.argChoices&&e.push(`choices: ${t.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&e.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&e.push(`env: ${t.envVar}`),e.length>0?`${t.description} (${e.join(", ")})`:t.description}argumentDescription(t){let e=[];if(t.argChoices&&e.push(`choices: ${t.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),t.defaultValue!==void 0&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),e.length>0){let i=`(${e.join(", ")})`;return t.description?`${t.description} ${i}`:i}return t.description}formatHelp(t,e){let i=e.padWidth(t,e),n=e.helpWidth??80;function s(c,d){return e.formatItem(c,i,d,e)}let r=[`${e.styleTitle("Usage:")} ${e.styleUsage(e.commandUsage(t))}`,""],a=e.commandDescription(t);a.length>0&&(r=r.concat([e.boxWrap(e.styleCommandDescription(a),n),""]));let o=e.visibleArguments(t).map(c=>s(e.styleArgumentTerm(e.argumentTerm(c)),e.styleArgumentDescription(e.argumentDescription(c))));o.length>0&&(r=r.concat([e.styleTitle("Arguments:"),...o,""]));let u=e.visibleOptions(t).map(c=>s(e.styleOptionTerm(e.optionTerm(c)),e.styleOptionDescription(e.optionDescription(c))));if(u.length>0&&(r=r.concat([e.styleTitle("Options:"),...u,""])),e.showGlobalOptions){let c=e.visibleGlobalOptions(t).map(d=>s(e.styleOptionTerm(e.optionTerm(d)),e.styleOptionDescription(e.optionDescription(d))));c.length>0&&(r=r.concat([e.styleTitle("Global Options:"),...c,""]))}let l=e.visibleCommands(t).map(c=>s(e.styleSubcommandTerm(e.subcommandTerm(c)),e.styleSubcommandDescription(e.subcommandDescription(c))));return l.length>0&&(r=r.concat([e.styleTitle("Commands:"),...l,""])),r.join(`
|
|
4
|
+
`)}displayWidth(t){return B(t).length}styleTitle(t){return t}styleUsage(t){return t.split(" ").map(e=>e==="[options]"?this.styleOptionText(e):e==="[command]"?this.styleSubcommandText(e):e[0]==="["||e[0]==="<"?this.styleArgumentText(e):this.styleCommandText(e)).join(" ")}styleCommandDescription(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(e=>e==="[options]"?this.styleOptionText(e):e[0]==="["||e[0]==="<"?this.styleArgumentText(e):this.styleSubcommandText(e)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,e){return Math.max(e.longestOptionTermLength(t,e),e.longestGlobalOptionTermLength(t,e),e.longestSubcommandTermLength(t,e),e.longestArgumentTermLength(t,e))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,e,i,n){let r=" ".repeat(2);if(!i)return r+t;let a=t.padEnd(e+t.length-n.displayWidth(t)),o=2,l=(this.helpWidth??80)-e-o-2,c;return l<this.minWidthToWrap||n.preformatted(i)?c=i:c=n.boxWrap(i,l).replace(/\n/g,`
|
|
5
|
+
`+" ".repeat(e+o)),r+a+" ".repeat(o)+c.replace(/\n/g,`
|
|
6
|
+
${r}`)}boxWrap(t,e){if(e<this.minWidthToWrap)return t;let i=t.split(/\r\n|\n/),n=/[\s]*[^\s]+/g,s=[];return i.forEach(r=>{let a=r.match(n);if(a===null){s.push("");return}let o=[a.shift()],u=this.displayWidth(o[0]);a.forEach(l=>{let c=this.displayWidth(l);if(u+c<=e){o.push(l),u+=c;return}s.push(o.join(""));let d=l.trimStart();o=[d],u=this.displayWidth(d)}),s.push(o.join(""))}),s.join(`
|
|
7
|
+
`)}};function B(h){let t=/\x1b\[\d*(;\d*)*m/g;return h.replace(t,"")}k.Help=H;k.stripColor=B});var F=C(D=>{"use strict";m();var{InvalidArgumentError:ut}=b(),P=class{constructor(t,e){this.flags=t,this.description=e||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let i=ct(t);this.short=i.shortFlag,this.long=i.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let e=t;return typeof t=="string"&&(e={[t]:!0}),this.implied=Object.assign(this.implied||{},e),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_concatValue(t,e){return e===this.defaultValue||!Array.isArray(e)?[t]:e.concat(t)}choices(t){return this.argChoices=t.slice(),this.parseArg=(e,i)=>{if(!this.argChoices.includes(e))throw new ut(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,i):e},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?G(this.name().replace(/^no-/,"")):G(this.name())}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},W=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(t,e){let i=e.attributeName();if(!this.dualOptions.has(i))return!0;let n=this.negativeOptions.get(i).presetArg,s=n!==void 0?n:!1;return e.negate===(s===t)}};function G(h){return h.split("-").reduce((t,e)=>t+e[0].toUpperCase()+e.slice(1))}function ct(h){let t,e,i=/^-[^-]$/,n=/^--[^-]/,s=h.split(/[ |,]+/).concat("guard");if(i.test(s[0])&&(t=s.shift()),n.test(s[0])&&(e=s.shift()),!t&&i.test(s[0])&&(t=s.shift()),!t&&n.test(s[0])&&(t=e,e=s.shift()),s[0].startsWith("-")){let r=s[0],a=`option creation failed due to '${r}' in option flags '${h}'`;throw/^-[^-][^-]/.test(r)?new Error(`${a}
|
|
8
|
+
- a short flag is a single dash and a single character
|
|
9
|
+
- either use a single dash and a single character (for a short flag)
|
|
10
|
+
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`):i.test(r)?new Error(`${a}
|
|
11
|
+
- too many short flags`):n.test(r)?new Error(`${a}
|
|
12
|
+
- too many long flags`):new Error(`${a}
|
|
13
|
+
- unrecognised flag format`)}if(t===void 0&&e===void 0)throw new Error(`option creation failed due to no flags found in '${h}'.`);return{shortFlag:t,longFlag:e}}D.Option=P;D.DualOptions=W});var K=C(J=>{"use strict";m();function pt(h,t){if(Math.abs(h.length-t.length)>3)return Math.max(h.length,t.length);let e=[];for(let i=0;i<=h.length;i++)e[i]=[i];for(let i=0;i<=t.length;i++)e[0][i]=i;for(let i=1;i<=t.length;i++)for(let n=1;n<=h.length;n++){let s=1;h[n-1]===t[i-1]?s=0:s=1,e[n][i]=Math.min(e[n-1][i]+1,e[n][i-1]+1,e[n-1][i-1]+s),n>1&&i>1&&h[n-1]===t[i-2]&&h[n-2]===t[i-1]&&(e[n][i]=Math.min(e[n][i],e[n-2][i-2]+1))}return e[h.length][t.length]}function mt(h,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let e=h.startsWith("--");e&&(h=h.slice(2),t=t.map(r=>r.slice(2)));let i=[],n=3,s=.4;return t.forEach(r=>{if(r.length<=1)return;let a=pt(h,r),o=Math.max(h.length,r.length);(o-a)/o>s&&(a<n?(n=a,i=[r]):a===n&&i.push(r))}),i.sort((r,a)=>r.localeCompare(a)),e&&(i=i.map(r=>`--${r}`)),i.length>1?`
|
|
14
|
+
(Did you mean one of ${i.join(", ")}?)`:i.length===1?`
|
|
15
|
+
(Did you mean ${i[0]}?)`:""}J.suggestSimilar=mt});var X=C(M=>{"use strict";m();var dt=A("events").EventEmitter,I=A("child_process"),g=A("path"),E=A("fs"),p=A("process"),{Argument:ft,humanReadableArgName:gt}=x(),{CommanderError:q}=b(),{Help:_t,stripColor:Ot}=T(),{Option:Y,DualOptions:Ct}=F(),{suggestSimilar:z}=K(),N=class h extends dt{constructor(t){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=t||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:e=>p.stdout.write(e),writeErr:e=>p.stderr.write(e),outputError:(e,i)=>i(e),getOutHelpWidth:()=>p.stdout.isTTY?p.stdout.columns:void 0,getErrHelpWidth:()=>p.stderr.isTTY?p.stderr.columns:void 0,getOutHasColors:()=>j()??(p.stdout.isTTY&&p.stdout.hasColors?.()),getErrHasColors:()=>j()??(p.stderr.isTTY&&p.stderr.hasColors?.()),stripColor:e=>Ot(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let e=this;e;e=e.parent)t.push(e);return t}command(t,e,i){let n=e,s=i;typeof n=="object"&&n!==null&&(s=n,n=null),s=s||{};let[,r,a]=t.match(/([^ ]+) *(.*)/),o=this.createCommand(r);return n&&(o.description(n),o._executableHandler=!0),s.isDefault&&(this._defaultCommandName=o._name),o._hidden=!!(s.noHelp||s.hidden),o._executableFile=s.executableFile||null,a&&o.arguments(a),this._registerCommand(o),o.parent=this,o.copyInheritedSettings(this),n?this:o}createCommand(t){return new h(t)}createHelp(){return Object.assign(new _t,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,t),this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,e){if(!t._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
16
|
+
- specify the name in Command constructor or using .name()`);return e=e||{},e.isDefault&&(this._defaultCommandName=t._name),(e.noHelp||e.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,e){return new ft(t,e)}argument(t,e,i,n){let s=this.createArgument(t,e);return typeof i=="function"?s.default(n).argParser(i):s.default(i),this.addArgument(s),this}arguments(t){return t.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(t){let e=this.registeredArguments.slice(-1)[0];if(e&&e.variadic)throw new Error(`only the last argument can be variadic '${e.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,e){if(typeof t=="boolean")return this._addImplicitHelpCommand=t,this;t=t??"help [command]";let[,i,n]=t.match(/([^ ]+) *(.*)/),s=e??"display help for command",r=this.createCommand(i);return r.helpOption(!1),n&&r.arguments(n),s&&r.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=r,this}addHelpCommand(t,e){return typeof t!="object"?(this.helpCommand(t,e),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(t,e){let i=["preSubcommand","preAction","postAction"];if(!i.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
|
|
17
|
+
Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(e):this._lifeCycleHooks[t]=[e],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=e=>{if(e.code!=="commander.executeSubCommandAsync")throw e},this}_exit(t,e,i){this._exitCallback&&this._exitCallback(new q(t,e,i)),p.exit(t)}action(t){let e=i=>{let n=this.registeredArguments.length,s=i.slice(0,n);return this._storeOptionsAsProperties?s[n]=this:s[n]=this.opts(),s.push(this),t.apply(this,s)};return this._actionHandler=e,this}createOption(t,e){return new Y(t,e)}_callParseArg(t,e,i,n){try{return t.parseArg(e,i)}catch(s){if(s.code==="commander.invalidArgument"){let r=`${n} ${s.message}`;this.error(r,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(t){let e=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(e){let i=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'
|
|
18
|
+
- already used by option '${e.flags}'`)}this.options.push(t)}_registerCommand(t){let e=n=>[n.name()].concat(n.aliases()),i=e(t).find(n=>this._findCommand(n));if(i){let n=e(this._findCommand(i)).join("|"),s=e(t).join("|");throw new Error(`cannot add command '${s}' as already have command '${n}'`)}this.commands.push(t)}addOption(t){this._registerOption(t);let e=t.name(),i=t.attributeName();if(t.negate){let s=t.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(i,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(i,t.defaultValue,"default");let n=(s,r,a)=>{s==null&&t.presetArg!==void 0&&(s=t.presetArg);let o=this.getOptionValue(i);s!==null&&t.parseArg?s=this._callParseArg(t,s,o,r):s!==null&&t.variadic&&(s=t._concatValue(s,o)),s==null&&(t.negate?s=!1:t.isBoolean()||t.optional?s=!0:s=""),this.setOptionValueWithSource(i,s,a)};return this.on("option:"+e,s=>{let r=`error: option '${t.flags}' argument '${s}' is invalid.`;n(s,r,"cli")}),t.envVar&&this.on("optionEnv:"+e,s=>{let r=`error: option '${t.flags}' value '${s}' from env '${t.envVar}' is invalid.`;n(s,r,"env")}),this}_optionEx(t,e,i,n,s){if(typeof e=="object"&&e instanceof Y)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let r=this.createOption(e,i);if(r.makeOptionMandatory(!!t.mandatory),typeof n=="function")r.default(s).argParser(n);else if(n instanceof RegExp){let a=n;n=(o,u)=>{let l=a.exec(o);return l?l[0]:u},r.default(s).argParser(n)}else r.default(n);return this.addOption(r)}option(t,e,i,n){return this._optionEx({},t,e,i,n)}requiredOption(t,e,i,n){return this._optionEx({mandatory:!0},t,e,i,n)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(t=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,e){return this.setOptionValueWithSource(t,e,void 0)}setOptionValueWithSource(t,e,i){return this._storeOptionsAsProperties?this[t]=e:this._optionValues[t]=e,this._optionValueSources[t]=i,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let e;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(t)!==void 0&&(e=i.getOptionValueSource(t))}),e}_prepareUserArgs(t,e){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");if(e=e||{},t===void 0&&e.from===void 0){p.versions?.electron&&(e.from="electron");let n=p.execArgv??[];(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))&&(e.from="eval")}t===void 0&&(t=p.argv),this.rawArgs=t.slice();let i;switch(e.from){case void 0:case"node":this._scriptPath=t[1],i=t.slice(2);break;case"electron":p.defaultApp?(this._scriptPath=t[1],i=t.slice(2)):i=t.slice(1);break;case"user":i=t.slice(0);break;case"eval":i=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${e.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",i}parse(t,e){this._prepareForParse();let i=this._prepareUserArgs(t,e);return this._parseCommand([],i),this}async parseAsync(t,e){this._prepareForParse();let i=this._prepareUserArgs(t,e);return await this._parseCommand([],i),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
19
|
+
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(t,e,i){if(E.existsSync(t))return;let n=e?`searched for local subcommand relative to directory '${e}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",s=`'${t}' does not exist
|
|
20
|
+
- if '${i}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
21
|
+
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
22
|
+
- ${n}`;throw new Error(s)}_executeSubCommand(t,e){e=e.slice();let i=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function s(l,c){let d=g.resolve(l,c);if(E.existsSync(d))return d;if(n.includes(g.extname(c)))return;let L=n.find(rt=>E.existsSync(`${d}${rt}`));if(L)return`${d}${L}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=t._executableFile||`${this._name}-${t._name}`,a=this._executableDir||"";if(this._scriptPath){let l;try{l=E.realpathSync(this._scriptPath)}catch{l=this._scriptPath}a=g.resolve(g.dirname(l),a)}if(a){let l=s(a,r);if(!l&&!t._executableFile&&this._scriptPath){let c=g.basename(this._scriptPath,g.extname(this._scriptPath));c!==this._name&&(l=s(a,`${c}-${t._name}`))}r=l||r}i=n.includes(g.extname(r));let o;p.platform!=="win32"?i?(e.unshift(r),e=Q(p.execArgv).concat(e),o=I.spawn(p.argv[0],e,{stdio:"inherit"})):o=I.spawn(r,e,{stdio:"inherit"}):(this._checkForMissingExecutable(r,a,t._name),e.unshift(r),e=Q(p.execArgv).concat(e),o=I.spawn(p.execPath,e,{stdio:"inherit"})),o.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(c=>{p.on(c,()=>{o.killed===!1&&o.exitCode===null&&o.kill(c)})});let u=this._exitCallback;o.on("close",l=>{l=l??1,u?u(new q(l,"commander.executeSubCommandAsync","(close)")):p.exit(l)}),o.on("error",l=>{if(l.code==="ENOENT")this._checkForMissingExecutable(r,a,t._name);else if(l.code==="EACCES")throw new Error(`'${r}' not executable`);if(!u)p.exit(1);else{let c=new q(1,"commander.executeSubCommandAsync","(error)");c.nestedError=l,u(c)}}),this.runningCommand=o}_dispatchSubcommand(t,e,i){let n=this._findCommand(t);n||this.help({error:!0}),n._prepareForParse();let s;return s=this._chainOrCallSubCommandHook(s,n,"preSubcommand"),s=this._chainOrCall(s,()=>{if(n._executableHandler)this._executeSubCommand(n,e.concat(i));else return n._parseCommand(e,i)}),s}_dispatchHelpCommand(t){t||this.help();let e=this._findCommand(t);return e&&!e._executableHandler&&e.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,e)=>{t.required&&this.args[e]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(i,n,s)=>{let r=n;if(n!==null&&i.parseArg){let a=`error: command-argument value '${n}' is invalid for argument '${i.name()}'.`;r=this._callParseArg(i,n,s,a)}return r};this._checkNumberOfArguments();let e=[];this.registeredArguments.forEach((i,n)=>{let s=i.defaultValue;i.variadic?n<this.args.length?(s=this.args.slice(n),i.parseArg&&(s=s.reduce((r,a)=>t(i,a,r),i.defaultValue))):s===void 0&&(s=[]):n<this.args.length&&(s=this.args[n],i.parseArg&&(s=t(i,s,i.defaultValue))),e[n]=s}),this.processedArgs=e}_chainOrCall(t,e){return t&&t.then&&typeof t.then=="function"?t.then(()=>e()):e()}_chainOrCallHooks(t,e){let i=t,n=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[e]!==void 0).forEach(s=>{s._lifeCycleHooks[e].forEach(r=>{n.push({hookedCommand:s,callback:r})})}),e==="postAction"&&n.reverse(),n.forEach(s=>{i=this._chainOrCall(i,()=>s.callback(s.hookedCommand,this))}),i}_chainOrCallSubCommandHook(t,e,i){let n=t;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(s=>{n=this._chainOrCall(n,()=>s(this,e))}),n}_parseCommand(t,e){let i=this.parseOptions(e);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(i.operands),e=i.unknown,this.args=t.concat(e),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),e);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(e),this._dispatchSubcommand(this._defaultCommandName,t,e);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let r;return r=this._chainOrCallHooks(r,"preAction"),r=this._chainOrCall(r,()=>this._actionHandler(this.processedArgs)),this.parent&&(r=this._chainOrCall(r,()=>{this.parent.emit(s,t,e)})),r=this._chainOrCallHooks(r,"postAction"),r}if(this.parent&&this.parent.listenerCount(s))n(),this._processArguments(),this.parent.emit(s,t,e);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,e);this.listenerCount("command:*")?this.emit("command:*",t,e):this.commands.length?this.unknownCommand():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(e=>e._name===t||e._aliases.includes(t))}_findOption(t){return this.options.find(e=>e.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(e=>{e.mandatory&&t.getOptionValue(e.attributeName())===void 0&&t.missingMandatoryOptionValue(e)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(i=>{let n=i.attributeName();return this.getOptionValue(n)===void 0?!1:this.getOptionValueSource(n)!=="default"});t.filter(i=>i.conflictsWith.length>0).forEach(i=>{let n=t.find(s=>i.conflictsWith.includes(s.attributeName()));n&&this._conflictingOption(i,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let e=[],i=[],n=e,s=t.slice();function r(o){return o.length>1&&o[0]==="-"}let a=null;for(;s.length;){let o=s.shift();if(o==="--"){n===i&&n.push(o),n.push(...s);break}if(a&&!r(o)){this.emit(`option:${a.name()}`,o);continue}if(a=null,r(o)){let u=this._findOption(o);if(u){if(u.required){let l=s.shift();l===void 0&&this.optionMissingArgument(u),this.emit(`option:${u.name()}`,l)}else if(u.optional){let l=null;s.length>0&&!r(s[0])&&(l=s.shift()),this.emit(`option:${u.name()}`,l)}else this.emit(`option:${u.name()}`);a=u.variadic?u:null;continue}}if(o.length>2&&o[0]==="-"&&o[1]!=="-"){let u=this._findOption(`-${o[1]}`);if(u){u.required||u.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${u.name()}`,o.slice(2)):(this.emit(`option:${u.name()}`),s.unshift(`-${o.slice(2)}`));continue}}if(/^--[^=]+=/.test(o)){let u=o.indexOf("="),l=this._findOption(o.slice(0,u));if(l&&(l.required||l.optional)){this.emit(`option:${l.name()}`,o.slice(u+1));continue}}if(r(o)&&(n=i),(this._enablePositionalOptions||this._passThroughOptions)&&e.length===0&&i.length===0){if(this._findCommand(o)){e.push(o),s.length>0&&i.push(...s);break}else if(this._getHelpCommand()&&o===this._getHelpCommand().name()){e.push(o),s.length>0&&e.push(...s);break}else if(this._defaultCommandName){i.push(o),s.length>0&&i.push(...s);break}}if(this._passThroughOptions){n.push(o),s.length>0&&n.push(...s);break}n.push(o)}return{operands:e,unknown:i}}opts(){if(this._storeOptionsAsProperties){let t={},e=this.options.length;for(let i=0;i<e;i++){let n=this.options[i].attributeName();t[n]=n===this._versionOptionName?this._version:this[n]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,e)=>Object.assign(t,e.opts()),{})}error(t,e){this._outputConfiguration.outputError(`${t}
|
|
23
|
+
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
24
|
+
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
25
|
+
`),this.outputHelp({error:!0}));let i=e||{},n=i.exitCode||1,s=i.code||"commander.error";this._exit(n,s,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in p.env){let e=t.attributeName();(this.getOptionValue(e)===void 0||["default","config","env"].includes(this.getOptionValueSource(e)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,p.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new Ct(this.options),e=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&e(i.attributeName())&&t.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(n=>!e(n)).forEach(n=>{this.setOptionValueWithSource(n,i.implied[n],"implied")})})}missingArgument(t){let e=`error: missing required argument '${t}'`;this.error(e,{code:"commander.missingArgument"})}optionMissingArgument(t){let e=`error: option '${t.flags}' argument missing`;this.error(e,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let e=`error: required option '${t.flags}' not specified`;this.error(e,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,e){let i=r=>{let a=r.attributeName(),o=this.getOptionValue(a),u=this.options.find(c=>c.negate&&a===c.attributeName()),l=this.options.find(c=>!c.negate&&a===c.attributeName());return u&&(u.presetArg===void 0&&o===!1||u.presetArg!==void 0&&o===u.presetArg)?u:l||r},n=r=>{let a=i(r),o=a.attributeName();return this.getOptionValueSource(o)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},s=`error: ${n(t)} cannot be used with ${n(e)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let e="";if(t.startsWith("--")&&this._showSuggestionAfterError){let n=[],s=this;do{let r=s.createHelp().visibleOptions(s).filter(a=>a.long).map(a=>a.long);n=n.concat(r),s=s.parent}while(s&&!s._enablePositionalOptions);e=z(t,n)}let i=`error: unknown option '${t}'${e}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let e=this.registeredArguments.length,i=e===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${e} argument${i} but got ${t.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],e="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(s=>{n.push(s.name()),s.alias()&&n.push(s.alias())}),e=z(t,n)}let i=`error: unknown command '${t}'${e}`;this.error(i,{code:"commander.unknownCommand"})}version(t,e,i){if(t===void 0)return this._version;this._version=t,e=e||"-V, --version",i=i||"output the version number";let n=this.createOption(e,i);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${t}
|
|
26
|
+
`),this._exit(0,"commander.version",t)}),this}description(t,e){return t===void 0&&e===void 0?this._description:(this._description=t,e&&(this._argsDescription=e),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let e=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(e=this.commands[this.commands.length-1]),t===e._name)throw new Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(t);if(i){let n=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${n}'`)}return e._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(e=>this.alias(e)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(i=>gt(i));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?e:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}nameFromFilename(t){return this._name=g.basename(t,g.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let e=this.createHelp(),i=this._getOutputContext(t);e.prepareContext({error:i.error,helpWidth:i.helpWidth,outputHasColors:i.hasColors});let n=e.formatHelp(this,e);return i.hasColors?n:this._outputConfiguration.stripColor(n)}_getOutputContext(t){t=t||{};let e=!!t.error,i,n,s;return e?(i=a=>this._outputConfiguration.writeErr(a),n=this._outputConfiguration.getErrHasColors(),s=this._outputConfiguration.getErrHelpWidth()):(i=a=>this._outputConfiguration.writeOut(a),n=this._outputConfiguration.getOutHasColors(),s=this._outputConfiguration.getOutHelpWidth()),{error:e,write:a=>(n||(a=this._outputConfiguration.stripColor(a)),i(a)),hasColors:n,helpWidth:s}}outputHelp(t){let e;typeof t=="function"&&(e=t,t=void 0);let i=this._getOutputContext(t),n={error:i.error,write:i.write,command:this};this._getCommandAndAncestors().reverse().forEach(r=>r.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let s=this.helpInformation({error:i.error});if(e&&(s=e(s),typeof s!="string"&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(s),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(r=>r.emit("afterAllHelp",n))}helpOption(t,e){return typeof t=="boolean"?(t?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(t=t??"-h, --help",e=e??"display help for command",this._helpOption=this.createOption(t,e),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this}help(t){this.outputHelp(t);let e=Number(p.exitCode??0);e===0&&t&&typeof t!="function"&&t.error&&(e=1),this._exit(e,"commander.help","(outputHelp)")}addHelpText(t,e){let i=["beforeAll","before","after","afterAll"];if(!i.includes(t))throw new Error(`Unexpected value for position to addHelpText.
|
|
27
|
+
Expecting one of '${i.join("', '")}'`);let n=`${t}Help`;return this.on(n,s=>{let r;typeof e=="function"?r=e({error:s.error,command:s.command}):r=e,r&&s.write(`${r}
|
|
28
|
+
`)}),this}_outputHelpIfRequested(t){let e=this._getHelpOption();e&&t.find(n=>e.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Q(h){return h.map(t=>{if(!t.startsWith("--inspect"))return t;let e,i="127.0.0.1",n="9229",s;return(s=t.match(/^(--inspect(-brk)?)$/))!==null?e=s[1]:(s=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(e=s[1],/^\d+$/.test(s[3])?n=s[3]:i=s[3]):(s=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(e=s[1],i=s[3],n=s[4]),e&&n!=="0"?`${e}=${i}:${parseInt(n)+1}`:t})}function j(){if(p.env.NO_COLOR||p.env.FORCE_COLOR==="0"||p.env.FORCE_COLOR==="false")return!1;if(p.env.FORCE_COLOR||p.env.CLICOLOR_FORCE!==void 0)return!0}M.Command=N;M.useColor=j});var it=C(f=>{"use strict";m();var{Argument:Z}=x(),{Command:R}=X(),{CommanderError:At,InvalidArgumentError:tt}=b(),{Help:bt}=T(),{Option:et}=F();f.program=new R;f.createCommand=h=>new R(h);f.createOption=(h,t)=>new et(h,t);f.createArgument=(h,t)=>new Z(h,t);f.Command=R;f.Option=et;f.Argument=Z;f.Help=bt;f.CommanderError=At;f.InvalidArgumentError=tt;f.InvalidOptionArgumentError=tt});m();import{createRequire as yt}from"module";m();var nt=ot(it(),1),{program:qt,createCommand:Nt,createArgument:jt,createOption:Mt,CommanderError:Rt,InvalidArgumentError:Lt,InvalidOptionArgumentError:Ut,Command:st,Argument:Bt,Option:Gt,Help:Jt}=nt.default;var wt=yt(import.meta.url)("../package.json"),y=new st;y.name("stera-ui").description("Add Stera UI components to your project.").version(wt.version);y.command("init").description("Initialize Stera UI in your project.").option("-c, --cwd <path>","Working directory",process.cwd()).option("-y, --yes","Skip confirmation prompts").action(async h=>{let{init:t}=await import("./init-XAKB27HW.js");await t(h)});y.command("add").description("Add components to your project.").argument("<components...>","Components to add").option("-c, --cwd <path>","Working directory",process.cwd()).option("-y, --yes","Never prompt; keep existing files that differ").option("-o, --overwrite","Replace existing files, including dependencies").action(async(h,t)=>{let{add:e}=await import("./add-JTKZDMNI.js");await e(h,t)});y.command("list").description("List all available components.").action(async()=>{let{list:h}=await import("./list-W7ECLPKW.js");await h()});y.parseAsync().catch(h=>{h instanceof Error&&h.name==="ExitPromptError"&&process.exit(130);let t=h instanceof Error?h.message:String(h);console.error(`
|
|
29
|
+
${U} ${t}
|
|
30
|
+
`),process.exit(1)});
|
package/dist/index.js
CHANGED
|
@@ -1,86 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
CONFIG_FILE,
|
|
4
|
-
CROSS,
|
|
5
|
-
INDEX_TARGET,
|
|
6
|
-
LEGACY_CONFIG_FILE,
|
|
7
|
-
LOGO,
|
|
8
|
-
TYPOGRAPHY_TARGET,
|
|
9
|
-
WARN,
|
|
10
|
-
applyTransforms,
|
|
11
|
-
brand,
|
|
12
|
-
createSpinner,
|
|
13
|
-
detectAliasPrefix,
|
|
14
|
-
detectPackageManager,
|
|
15
|
-
detectProject,
|
|
16
|
-
dim,
|
|
17
|
-
findConfigPath,
|
|
18
|
-
insertImportLine,
|
|
19
|
-
installDependencies,
|
|
20
|
-
loadConfig,
|
|
21
|
-
massageTreeForFonts,
|
|
22
|
-
migrateLegacyStyles,
|
|
23
|
-
resolveOutputPath,
|
|
24
|
-
transformImports,
|
|
25
|
-
updateFonts,
|
|
26
|
-
writeComponentFiles,
|
|
27
|
-
writeStyles
|
|
28
|
-
} from "./chunk-RQ7T7RF5.js";
|
|
29
|
-
import {
|
|
30
|
-
ComponentNotFoundError,
|
|
31
|
-
fetchRegistryIndex,
|
|
32
|
-
fetchRegistryItem,
|
|
33
|
-
getAllComponents,
|
|
34
|
-
getComponent,
|
|
35
|
-
resolveDependencies
|
|
36
|
-
} from "./chunk-BJNLGEZJ.js";
|
|
37
|
-
import {
|
|
38
|
-
configSchema,
|
|
39
|
-
registryIndexEntrySchema,
|
|
40
|
-
registryIndexSchema,
|
|
41
|
-
registryItemFileSchema,
|
|
42
|
-
registryItemFontSchema,
|
|
43
|
-
registryItemSchema,
|
|
44
|
-
registryItemTypeSchema
|
|
45
|
-
} from "./chunk-4E46BULJ.js";
|
|
46
|
-
export {
|
|
47
|
-
CHECK,
|
|
48
|
-
CONFIG_FILE,
|
|
49
|
-
CROSS,
|
|
50
|
-
ComponentNotFoundError,
|
|
51
|
-
INDEX_TARGET,
|
|
52
|
-
LEGACY_CONFIG_FILE,
|
|
53
|
-
LOGO,
|
|
54
|
-
TYPOGRAPHY_TARGET,
|
|
55
|
-
WARN,
|
|
56
|
-
applyTransforms,
|
|
57
|
-
brand,
|
|
58
|
-
configSchema,
|
|
59
|
-
createSpinner,
|
|
60
|
-
detectAliasPrefix,
|
|
61
|
-
detectPackageManager,
|
|
62
|
-
detectProject,
|
|
63
|
-
dim,
|
|
64
|
-
fetchRegistryIndex,
|
|
65
|
-
fetchRegistryItem,
|
|
66
|
-
findConfigPath,
|
|
67
|
-
getAllComponents,
|
|
68
|
-
getComponent,
|
|
69
|
-
insertImportLine,
|
|
70
|
-
installDependencies,
|
|
71
|
-
loadConfig,
|
|
72
|
-
massageTreeForFonts,
|
|
73
|
-
migrateLegacyStyles,
|
|
74
|
-
registryIndexEntrySchema,
|
|
75
|
-
registryIndexSchema,
|
|
76
|
-
registryItemFileSchema,
|
|
77
|
-
registryItemFontSchema,
|
|
78
|
-
registryItemSchema,
|
|
79
|
-
registryItemTypeSchema,
|
|
80
|
-
resolveDependencies,
|
|
81
|
-
resolveOutputPath,
|
|
82
|
-
transformImports,
|
|
83
|
-
updateFonts,
|
|
84
|
-
writeComponentFiles,
|
|
85
|
-
writeStyles
|
|
86
|
-
};
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import"./chunk-OSMC63WJ.js";import{a as B,b as C,c as D,d as E}from"./chunk-FZGIVCWE.js";import{a as M,b as N}from"./chunk-P2O7D5BG.js";import{c as x,d as a,e as b,f as c,g as z,h as A,k as F,l as G,m as H,n as I,o as J,p as K,q as L}from"./chunk-LUUYMQIF.js";import{a as y}from"./chunk-UVHQPGZ3.js";import{a as r,b as e,c as f,d as m,e as p,f as t}from"./chunk-MBBLZJIK.js";import{a as n,b as q,c as s,d as u,e as v,f as w}from"./chunk-XJ6VM67K.js";import{a as d,b as g,c as h,d as i,e as j,f as k,g as l}from"./chunk-42DL2YAQ.js";import{g as o}from"./chunk-OPVLMYW5.js";o();export{m as CHECK,x as CONFIG_FILE,p as CROSS,n as ComponentNotFoundError,I as INDEX_TARGET,a as LEGACY_CONFIG_FILE,f as LOGO,J as TYPOGRAPHY_TARGET,t as WARN,M as applyTransforms,r as brand,l as configSchema,y as createSpinner,C as detectAliasPrefix,z as detectPackageManager,B as detectProject,e as dim,q as fetchRegistryIndex,s as fetchRegistryItem,b as findConfigPath,v as getAllComponents,u as getComponent,F as insertImportLine,A as installDependencies,c as loadConfig,D as massageTreeForFonts,K as migrateLegacyStyles,j as registryIndexEntrySchema,k as registryIndexSchema,g as registryItemFileSchema,h as registryItemFontSchema,i as registryItemSchema,d as registryItemTypeSchema,w as resolveDependencies,G as resolveOutputPath,N as transformImports,E as updateFonts,H as writeComponentFiles,L as writeStyles};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import{a as E,b as V,c as A,d as O}from"./chunk-FZGIVCWE.js";import{a as v,b as R,c as F,d as $,e as L,h as j,j as C,k as b,o as T,p as U,q as _}from"./chunk-LUUYMQIF.js";import{a as k}from"./chunk-UVHQPGZ3.js";import{b as N,c as G,d as p}from"./chunk-MBBLZJIK.js";import{c as D}from"./chunk-XJ6VM67K.js";import"./chunk-42DL2YAQ.js";import{g as S}from"./chunk-OPVLMYW5.js";S();import y from"fs";import H from"fs/promises";import i from"path";S();import Q from"fs";import x from"path";function w(e){try{return Q.readFileSync(e,"utf-8")}catch{return null}}function X(e){let o=/import.*from\s+['"]next\/font/.test(e)||/import.*from\s+['"]@next\/font/.test(e)||/import.*from\s+['"]geist\/font/.test(e),t=null,s=e.match(/variable:\s*['"](--.+?)['"]/);return s&&(t=s[1]),{hasNextFont:o,nextFontVariable:t}}function M(e){let o=/@font-face\s*\{/.test(e),t=[],s=/font-family:\s*['"]?([^'";}\n]+?)['"]?\s*;/g,n;for(;(n=s.exec(e))!==null;){let a=n[1].trim();a&&!t.includes(a)&&t.push(a)}return{hasFontFace:o,fontFamilies:t}}function P(e){return e.includes("fonts.googleapis.com")||e.includes("fonts.gstatic.com")}function Y(e,o){let t={hasNextFont:!1,hasFontFace:!1,hasGoogleFontsLink:!1,fontFamilies:[],nextFontVariable:null};if(o.layoutFile){let s=w(x.join(e,o.layoutFile));if(s){let n=X(s);t.hasNextFont=n.hasNextFont,t.nextFontVariable=n.nextFontVariable,P(s)&&(t.hasGoogleFontsLink=!0)}}if(o.existingCssFile){let s=w(x.join(e,o.existingCssFile));if(s){let n=M(s);t.hasFontFace=n.hasFontFace,t.fontFamilies.push(...n.fontFamilies),P(s)&&(t.hasGoogleFontsLink=!0);let a=/@import\s+['"](.+?)['"]/g,r;for(;(r=a.exec(s))!==null;){let m=r[1],c=x.join(e,x.dirname(o.existingCssFile),m),f=w(c);if(f){let g=M(f);g.hasFontFace&&(t.hasFontFace=!0);for(let u of g.fontFamilies)t.fontFamilies.includes(u)||t.fontFamilies.push(u)}}}}for(let s of["index.html","src/index.html"]){let n=w(x.join(e,s));n&&P(n)&&(t.hasGoogleFontsLink=!0)}return t}var Z=["font-geist","font-geist-mono"];function K(e){return e.existingCssFile?e.existingCssFile:e.hasSrc?"src/styles/globals.css":"styles/globals.css"}function tt(e,o,t){return{$schema:"https://ui.stera.sh/schema.json",version:1,css:K(e),aliases:{components:`${t}/components`,utils:`${t}/lib/utils`,ui:`${t}/components/ui`,lib:`${t}/lib`,hooks:`${t}/hooks`},fonts:{strategy:o}}}async function et(e,o){let t=e.hasNextFont||e.hasFontFace||e.hasGoogleFontsLink,s=t?"keep-existing":"stera-default";if(o)return s;if(t){let r=[];e.fontFamilies.length>0&&r.push(e.fontFamilies.join(", ")),e.hasNextFont&&r.push("next/font"),e.hasGoogleFontsLink&&r.push("Google Fonts"),console.log(`Detected existing fonts: ${r.join(" via ")}
|
|
3
|
+
`)}let n=[];t&&n.push({value:"keep-existing",name:"Keep my current fonts",description:"Update CSS variables to use your existing fonts"}),n.push({value:"stera-default",name:"Use Stera UI default fonts (Geist Sans + Geist Mono)",description:"Optimized variable fonts via next/font or fontsource"}),n.push({value:"skip",name:"Skip font setup",description:"Configure fonts manually later"});let a=await R({message:"How would you like to set up fonts?",choices:n,default:s});return console.log(""),a}async function ot(){let e=k("Fetching fonts"),o=await Promise.all(Z.map(async t=>{try{let s=await D(t);return s.type==="registry:font"?s:null}catch{return null}}));return e.succeed("Fonts resolved"),o.filter(t=>t!==null)}async function nt(e,o,t,s,n){if(e==="skip")return;let a=i.dirname(i.resolve(n,s.css)),r=i.join(a,T);if(e==="keep-existing"){let f=t.fontFamilies.length>0?t.fontFamilies[0]:null,g=t.nextFontVariable?`var(${t.nextFontVariable})`:f??"Geist";C(r,{"--font-heading":g,"--font-sans":g}).length>0&&console.log(`${p} Updated font variables to use ${g}`);return}let m=await ot();if(m.length===0)return;let c=A(m,o);if(c.dependencies.length>0&&await j(c.dependencies,n),c.cssImports.length>0){for(let f of c.cssImports)await b(r,f);console.log(`${p} Added font imports to ${i.relative(n,r)}`)}Object.keys(c.cssVars).length>0&&C(r,c.cssVars).length>0&&console.log(`${p} Updated font variables in ${i.relative(n,r)}`),await O(m,o,n)}async function wt(e){let o=e.cwd?i.resolve(e.cwd):process.cwd();console.log(`
|
|
4
|
+
${G} Stera UI
|
|
5
|
+
`);let t=L(o);if(t){if(i.basename(t)===$){if(console.log(`Found legacy ${$} at ${t}`),e.yes?!0:await v({message:`Rename it to ${F}?`,default:!0})){let J=i.join(i.dirname(t),F);y.renameSync(t,J),console.log(`${p} Renamed to ${F}`),console.log(`Run "stera-ui add <component>" to add components.
|
|
6
|
+
`)}else console.log(`Keeping ${$} for now. Legacy filename support will be removed in a future release.
|
|
7
|
+
`);return}console.log(`${F} already exists at ${t}`),console.log(`Run "stera-ui add <component>" to add components.
|
|
8
|
+
`);return}let s=i.join(o,"package.json");y.existsSync(s)||(console.error("Error: No package.json found. Please run this in a project directory."),process.exit(1));let n=E(o),a=V(o);a||(console.error(""),console.error("Error: No import alias found in your tsconfig.json file."),console.error('Stera UI requires a path alias (e.g. "@/*": ["./src/*"]) in compilerOptions.paths.'),console.error("See https://ui.stera.sh/docs/installation for setup instructions per framework."),console.error(""),process.exit(1));let r=n.framework==="next"?"Next.js":n.framework==="vite"?"Vite":null,m=[];r&&m.push(r),n.hasSrc&&m.push("src/ directory"),m.length>0&&console.log(`Detected ${m.join(" project with ")} project
|
|
9
|
+
`);let c=Y(o,n),f=i.join(i.dirname(i.resolve(o,K(n))),"ui");if(y.existsSync(f)&&y.readdirSync(f).length>0){let l=i.relative(o,f);if(console.log(""),console.log(`${l} already exists and is not empty.`),!(e.yes||process.stdin.isTTY&&await v({message:`Write the style partials into ${l}?`,default:!1}))){console.log(""),console.log(`Aborted. Move ${l} aside, or point "css" in ${F} at a different stylesheet, then run init again.`);return}}let g=await et(c,e.yes??!1),u=tt(n,g,a),q=i.join(o,F);y.writeFileSync(q,JSON.stringify(u,null,2)+`
|
|
10
|
+
`,"utf-8"),console.log(`${p} Created ${F}`);let I=k("Downloading base styles"),d;try{await U(u,o),d=await _(u,o,{yes:e.yes,onFetched:()=>I.stop()})}catch(l){throw I.fail("Failed to fetch base styles"),l}console.log(`${p} Created ${i.relative(o,d.indexPath)}`);let h=n.existingCssFile?i.resolve(o,n.existingCssFile):i.resolve(o,u.css);if(y.existsSync(h)){for(let l of d.extraImports)await b(h,l);await b(h,'@import "./ui/index.css";'),console.log(`${p} Added @import to ${i.relative(o,h)}`)}else{await H.mkdir(i.dirname(h),{recursive:!0});let l=['@import "tailwindcss";',...d.extraImports,'@import "./ui/index.css";'].join(`
|
|
11
|
+
`)+`
|
|
12
|
+
`;await H.writeFile(h,l,"utf-8"),console.log(`${p} Created ${i.relative(o,h)}`)}if(await nt(g,n,c,u,o),d.dependencies.length>0){let l=[...new Set(d.dependencies)].sort();console.log(""),await j(l,o)}console.log(""),console.log("Next steps:"),console.log(" stera-ui add <component>"),g==="skip"&&(console.log(""),console.log(`${N("Font setup was skipped. See https://ui.stera.sh for font configuration docs.")}`)),console.log("")}export{wt as init};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import{a as g}from"./chunk-UVHQPGZ3.js";import{b as r,c}from"./chunk-MBBLZJIK.js";import{e as p}from"./chunk-XJ6VM67K.js";import"./chunk-42DL2YAQ.js";import{g as l}from"./chunk-OPVLMYW5.js";l();async function $(){let i=g("Resolving"),n;try{n=await p()}catch(e){throw i.fail("Failed to fetch registry"),e}i.stop();let t=new Map;for(let e of n){let o=e.type.replace("registry:","");t.has(o)||t.set(o,[]),t.get(o).push(e)}console.log(`
|
|
3
|
+
${c} Available components
|
|
4
|
+
`);for(let[e,o]of t){console.log(e);for(let s of o){let a=s.registryDependencies?.length?r(` (depends on: ${s.registryDependencies.join(", ")})`):"";console.log(` ${s.name}${a}`)}console.log("")}console.log(`${r(`${n.length} components available`)}
|
|
5
|
+
`)}export{$ as list};
|
package/dist/registry/index.d.ts
CHANGED
|
@@ -30,9 +30,11 @@ declare function getAllComponents(): Promise<RegistryIndexEntry[]>;
|
|
|
30
30
|
* request), then all needed items are fetched in one parallel batch.
|
|
31
31
|
* Order is preserved: requested components first, then dependencies.
|
|
32
32
|
*
|
|
33
|
+
* `onPhase` fires once the graph is known, just before the items download.
|
|
34
|
+
*
|
|
33
35
|
* @throws ComponentNotFoundError when any name (requested or transitive)
|
|
34
36
|
* is missing from the registry index.
|
|
35
37
|
*/
|
|
36
|
-
declare function resolveDependencies(names: string[]): Promise<RegistryItem[]>;
|
|
38
|
+
declare function resolveDependencies(names: string[], onPhase?: (phase: "downloading", count: number) => void): Promise<RegistryItem[]>;
|
|
37
39
|
|
|
38
40
|
export { ComponentNotFoundError, RegistryIndexEntry, RegistryItem, fetchRegistryIndex, fetchRegistryItem, getAllComponents, getComponent, resolveDependencies };
|
package/dist/registry/index.js
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
fetchRegistryIndex,
|
|
4
|
-
fetchRegistryItem,
|
|
5
|
-
getAllComponents,
|
|
6
|
-
getComponent,
|
|
7
|
-
resolveDependencies
|
|
8
|
-
} from "../chunk-BJNLGEZJ.js";
|
|
9
|
-
import "../chunk-4E46BULJ.js";
|
|
10
|
-
export {
|
|
11
|
-
ComponentNotFoundError,
|
|
12
|
-
fetchRegistryIndex,
|
|
13
|
-
fetchRegistryItem,
|
|
14
|
-
getAllComponents,
|
|
15
|
-
getComponent,
|
|
16
|
-
resolveDependencies
|
|
17
|
-
};
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import{a,b,c,d,e,f}from"../chunk-XJ6VM67K.js";import"../chunk-42DL2YAQ.js";import"../chunk-OPVLMYW5.js";export{a as ComponentNotFoundError,b as fetchRegistryIndex,c as fetchRegistryItem,e as getAllComponents,d as getComponent,f as resolveDependencies};
|
package/dist/schema/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
registryIndexEntrySchema,
|
|
4
|
-
registryIndexSchema,
|
|
5
|
-
registryItemFileSchema,
|
|
6
|
-
registryItemFontSchema,
|
|
7
|
-
registryItemSchema,
|
|
8
|
-
registryItemTypeSchema
|
|
9
|
-
} from "../chunk-4E46BULJ.js";
|
|
10
|
-
export {
|
|
11
|
-
configSchema,
|
|
12
|
-
registryIndexEntrySchema,
|
|
13
|
-
registryIndexSchema,
|
|
14
|
-
registryItemFileSchema,
|
|
15
|
-
registryItemFontSchema,
|
|
16
|
-
registryItemSchema,
|
|
17
|
-
registryItemTypeSchema
|
|
18
|
-
};
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import{a,b,c,d,e,f,g}from"../chunk-42DL2YAQ.js";import"../chunk-OPVLMYW5.js";export{g as configSchema,e as registryIndexEntrySchema,f as registryIndexSchema,b as registryItemFileSchema,c as registryItemFontSchema,d as registryItemSchema,a as registryItemTypeSchema};
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -79,12 +79,24 @@ declare function detectProject(cwd: string): ProjectInfo;
|
|
|
79
79
|
declare function detectAliasPrefix(cwd: string): string | null;
|
|
80
80
|
|
|
81
81
|
interface WriteOptions {
|
|
82
|
+
/** Replace every existing file without asking. */
|
|
82
83
|
overwrite?: boolean;
|
|
84
|
+
/** Never prompt — existing files that differ are kept. */
|
|
85
|
+
yes?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Names of the items the user explicitly asked for. Items outside this list
|
|
88
|
+
* were pulled in as dependencies, and their existing files are kept without
|
|
89
|
+
* prompting. When omitted, every item is treated as requested.
|
|
90
|
+
*/
|
|
91
|
+
requested?: string[];
|
|
83
92
|
}
|
|
84
93
|
interface SkippedFile {
|
|
85
94
|
path: string;
|
|
86
|
-
/**
|
|
87
|
-
|
|
95
|
+
/**
|
|
96
|
+
* "unchanged" — identical content on disk; "declined" — user kept their
|
|
97
|
+
* version; "kept" — an existing dependency file, left alone without asking.
|
|
98
|
+
*/
|
|
99
|
+
reason: "unchanged" | "declined" | "kept";
|
|
88
100
|
}
|
|
89
101
|
interface WriteResult {
|
|
90
102
|
written: string[];
|
|
@@ -92,7 +104,8 @@ interface WriteResult {
|
|
|
92
104
|
}
|
|
93
105
|
/**
|
|
94
106
|
* Write component files to the consumer's project.
|
|
95
|
-
*
|
|
107
|
+
* Existing files that differ prompt before being overwritten, but only for
|
|
108
|
+
* the items the user asked for — dependencies they already have are kept.
|
|
96
109
|
*/
|
|
97
110
|
declare function writeComponentFiles(items: RegistryItem[], config: SteraConfig, projectRoot: string, options?: WriteOptions): Promise<WriteResult>;
|
|
98
111
|
|
|
@@ -140,6 +153,10 @@ declare function migrateLegacyStyles(config: SteraConfig, cwd: string): Promise<
|
|
|
140
153
|
*/
|
|
141
154
|
declare function writeStyles(config: SteraConfig, cwd: string, options?: {
|
|
142
155
|
overwrite?: boolean;
|
|
156
|
+
/** Never prompt — protected partials that differ are kept. */
|
|
157
|
+
yes?: boolean;
|
|
158
|
+
/** Called once the registry fetch is done, before any prompt can appear. */
|
|
159
|
+
onFetched?: () => void;
|
|
143
160
|
}): Promise<WriteStylesResult>;
|
|
144
161
|
|
|
145
162
|
/**
|
|
@@ -165,7 +182,13 @@ declare const CHECK: string;
|
|
|
165
182
|
declare const CROSS = "\u2717";
|
|
166
183
|
declare const WARN = "!";
|
|
167
184
|
|
|
185
|
+
/**
|
|
186
|
+
* A single-line status indicator. The animation is progress, not output, so
|
|
187
|
+
* it goes to stderr — result lines from `succeed` stay on stdout.
|
|
188
|
+
*/
|
|
168
189
|
declare function createSpinner(text: string): {
|
|
190
|
+
update(_text: string): void;
|
|
191
|
+
stop(): void;
|
|
169
192
|
succeed(msg: string): void;
|
|
170
193
|
fail(msg: string): void;
|
|
171
194
|
};
|
package/dist/utils/index.js
CHANGED
|
@@ -1,58 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
CONFIG_FILE,
|
|
4
|
-
CROSS,
|
|
5
|
-
INDEX_TARGET,
|
|
6
|
-
LEGACY_CONFIG_FILE,
|
|
7
|
-
LOGO,
|
|
8
|
-
TYPOGRAPHY_TARGET,
|
|
9
|
-
WARN,
|
|
10
|
-
applyTransforms,
|
|
11
|
-
brand,
|
|
12
|
-
createSpinner,
|
|
13
|
-
detectAliasPrefix,
|
|
14
|
-
detectPackageManager,
|
|
15
|
-
detectProject,
|
|
16
|
-
dim,
|
|
17
|
-
findConfigPath,
|
|
18
|
-
insertImportLine,
|
|
19
|
-
installDependencies,
|
|
20
|
-
loadConfig,
|
|
21
|
-
massageTreeForFonts,
|
|
22
|
-
migrateLegacyStyles,
|
|
23
|
-
resolveOutputPath,
|
|
24
|
-
transformImports,
|
|
25
|
-
updateFonts,
|
|
26
|
-
writeComponentFiles,
|
|
27
|
-
writeStyles
|
|
28
|
-
} from "../chunk-RQ7T7RF5.js";
|
|
29
|
-
import "../chunk-BJNLGEZJ.js";
|
|
30
|
-
import "../chunk-4E46BULJ.js";
|
|
31
|
-
export {
|
|
32
|
-
CHECK,
|
|
33
|
-
CONFIG_FILE,
|
|
34
|
-
CROSS,
|
|
35
|
-
INDEX_TARGET,
|
|
36
|
-
LEGACY_CONFIG_FILE,
|
|
37
|
-
LOGO,
|
|
38
|
-
TYPOGRAPHY_TARGET,
|
|
39
|
-
WARN,
|
|
40
|
-
applyTransforms,
|
|
41
|
-
brand,
|
|
42
|
-
createSpinner,
|
|
43
|
-
detectAliasPrefix,
|
|
44
|
-
detectPackageManager,
|
|
45
|
-
detectProject,
|
|
46
|
-
dim,
|
|
47
|
-
findConfigPath,
|
|
48
|
-
insertImportLine,
|
|
49
|
-
installDependencies,
|
|
50
|
-
loadConfig,
|
|
51
|
-
massageTreeForFonts,
|
|
52
|
-
migrateLegacyStyles,
|
|
53
|
-
resolveOutputPath,
|
|
54
|
-
transformImports,
|
|
55
|
-
updateFonts,
|
|
56
|
-
writeComponentFiles,
|
|
57
|
-
writeStyles
|
|
58
|
-
};
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import"../chunk-OSMC63WJ.js";import{a as n,b as o,c as p,d as q}from"../chunk-FZGIVCWE.js";import{a as y,b as z}from"../chunk-P2O7D5BG.js";import{c as g,d as h,e as i,f as j,g as l,h as m,k as r,l as s,m as t,n as u,o as v,p as w,q as x}from"../chunk-LUUYMQIF.js";import{a as k}from"../chunk-UVHQPGZ3.js";import{a,b,c,d,e,f}from"../chunk-MBBLZJIK.js";import"../chunk-XJ6VM67K.js";import"../chunk-42DL2YAQ.js";import"../chunk-OPVLMYW5.js";export{d as CHECK,g as CONFIG_FILE,e as CROSS,u as INDEX_TARGET,h as LEGACY_CONFIG_FILE,c as LOGO,v as TYPOGRAPHY_TARGET,f as WARN,y as applyTransforms,a as brand,k as createSpinner,o as detectAliasPrefix,l as detectPackageManager,n as detectProject,b as dim,i as findConfigPath,r as insertImportLine,m as installDependencies,j as loadConfig,p as massageTreeForFonts,w as migrateLegacyStyles,s as resolveOutputPath,z as transformImports,q as updateFonts,t as writeComponentFiles,x as writeStyles};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stera-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Add Stera UI components to your project.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,19 +32,17 @@
|
|
|
32
32
|
"files": [
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
|
-
"
|
|
36
|
-
"@antfu/ni": "^30.0.0",
|
|
35
|
+
"devDependencies": {
|
|
37
36
|
"@inquirer/prompts": "^7.0.0",
|
|
37
|
+
"@types/node": "^25.1.0",
|
|
38
38
|
"commander": "^13.1.0",
|
|
39
39
|
"execa": "^9.6.1",
|
|
40
|
+
"package-manager-detector": "^1.9.0",
|
|
40
41
|
"ts-morph": "^27.0.2",
|
|
41
42
|
"tsconfig-paths": "^4.2.0",
|
|
42
|
-
"zod": "^3.24.0"
|
|
43
|
-
},
|
|
44
|
-
"devDependencies": {
|
|
45
|
-
"@types/node": "^25.1.0",
|
|
46
43
|
"tsup": "^8.5.0",
|
|
47
|
-
"typescript": "^5.9.3"
|
|
44
|
+
"typescript": "^5.9.3",
|
|
45
|
+
"zod": "^3.24.0"
|
|
48
46
|
},
|
|
49
47
|
"scripts": {
|
|
50
48
|
"build": "tsup",
|