@stacksjs/rpx 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +1 -1
- package/dist/chunk-wn28gp4d.js +37 -0
- package/dist/src/index.js +1 -1
- package/dist/start.d.ts +1 -2
- package/package.json +1 -1
- package/dist/chunk-p7h1y8j7.js +0 -37
package/dist/bin/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as j,D,a as O,b as S,w as _}from"../chunk-
|
|
1
|
+
import{C as j,D,a as O,b as S,w as _}from"../chunk-wn28gp4d.js";import"../chunk-en36kajt.js";import"../chunk-2y0c08hn.js";import"../chunk-e794mmrn.js";import{EventEmitter as P}from"events";function b(t){return t==null?[]:Array.isArray(t)?t:[t]}function R(t,e,s,o){var n,i=t[e],l=~o.string.indexOf(e)?s==null||s===!0?"":String(s):typeof s==="boolean"?s:~o.boolean.indexOf(e)?s==="false"?!1:s==="true"||(t._.push((n=+s,n*0===0)?n:s),!!s):(n=+s,n*0===0)?n:s;t[e]=i==null?l:Array.isArray(i)?i.concat(l):[i,l]}function V(t,e){t=t||[],e=e||{};var s,o,n,i,l,h={_:[]},r=0,a=0,m=0,c=t.length;let u=e.alias!==void 0,g=e.unknown!==void 0,w=e.default!==void 0;if(e.alias=e.alias||{},e.string=b(e.string),e.boolean=b(e.boolean),u)for(s in e.alias){o=e.alias[s]=b(e.alias[s]);for(r=0;r<o.length;r++)(e.alias[o[r]]=o.concat(s)).splice(r,1)}for(r=e.boolean.length;r-- >0;){o=e.alias[e.boolean[r]]||[];for(a=o.length;a-- >0;)e.boolean.push(o[a])}for(r=e.string.length;r-- >0;){o=e.alias[e.string[r]]||[];for(a=o.length;a-- >0;)e.string.push(o[a])}if(w){for(s in e.default)if(i=typeof e.default[s],o=e.alias[s]=e.alias[s]||[],e[i]!==void 0){e[i].push(s);for(r=0;r<o.length;r++)e[i].push(o[r])}}let v=g?Object.keys(e.alias):[];for(r=0;r<c;r++){if(n=t[r],n==="--"){h._=h._.concat(t.slice(++r));break}for(a=0;a<n.length;a++)if(n.charCodeAt(a)!==45)break;if(a===0)h._.push(n);else if(n.substring(a,a+3)==="no-"){if(i=n.substring(a+3),g&&!~v.indexOf(i))return e.unknown(n);h[i]=!1}else{for(m=a+1;m<n.length;m++)if(n.charCodeAt(m)===61)break;i=n.substring(a,m),l=n.substring(++m)||(r+1===c||(""+t[r+1]).charCodeAt(0)===45||t[++r]),o=a===2?[i]:i;for(m=0;m<o.length;m++){if(i=o[m],g&&!~v.indexOf(i))return e.unknown("-".repeat(a)+i);R(h,i,m+1<o.length||l,e)}}}if(w){for(s in e.default)if(h[s]===void 0)h[s]=e.default[s]}if(u)for(s in h){o=e.alias[s]||[];while(o.length>0)h[o.shift()]=h[s]}return h}var A=(t)=>t.replace(/[<[].+/,"").trim(),L=(t)=>{let e=/<([^>]+)>/g,s=/\[([^\]]+)\]/g,o=[],n=(h)=>{let r=!1,a=h[1];if(a.startsWith("..."))a=a.slice(3),r=!0;return{required:h[0].startsWith("<"),value:a,variadic:r}},i;while(i=e.exec(t))o.push(n(i));let l;while(l=s.exec(t))o.push(n(l));return o},T=(t)=>{let e={alias:{},boolean:[]};for(let[s,o]of t.entries()){if(o.names.length>1)e.alias[o.names[0]]=o.names.slice(1);if(o.isBoolean)if(o.negated){if(!t.some((i,l)=>{return l!==s&&i.names.some((h)=>o.names.includes(h))&&typeof i.required==="boolean"}))e.boolean.push(o.names[0])}else e.boolean.push(o.names[0])}return e},k=(t)=>{return t.sort((e,s)=>{return e.length>s.length?-1:1})[0]},$=(t,e)=>{return t.length>=e?t:`${t}${" ".repeat(e-t.length)}`},U=(t)=>{return t.replace(/([a-z])-([a-z])/g,(e,s,o)=>{return s+o.toUpperCase()})},q=(t,e,s)=>{let o=0,n=e.length,i=t,l;for(;o<n;++o)l=i[e[o]],i=i[e[o]]=o===n-1?s:l!=null?l:!!~e[o+1].indexOf(".")||!(+e[o+1]>-1)?{}:[]},M=(t,e)=>{for(let s of Object.keys(e)){let o=e[s];if(o.shouldTransform){if(t[s]=Array.prototype.concat.call([],t[s]),typeof o.transformFunction==="function")t[s]=t[s].map(o.transformFunction)}}},B=(t)=>{let e=/([^\\\/]+)$/.exec(t);return e?e[1]:""},N=(t)=>{return t.split(".").map((e,s)=>{return s===0?U(e):e}).join(".")};class d extends Error{constructor(t){super(t);if(this.name=this.constructor.name,typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,this.constructor);else this.stack=new Error(t).stack}}class E{constructor(t,e,s){if(this.rawName=t,this.description=e,this.config=Object.assign({},s),t=t.replace(/\.\*/g,""),this.negated=!1,this.names=A(t).split(",").map((o)=>{let n=o.trim().replace(/^-{1,2}/,"");if(n.startsWith("no-"))this.negated=!0,n=n.replace(/^no-/,"");return N(n)}).sort((o,n)=>o.length>n.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null)this.config.default=!0;if(t.includes("<"))this.required=!0;else if(t.includes("["))this.required=!1;else this.isBoolean=!0}}var I=process.argv,H=`${process.platform}-${process.arch} node-${process.version}`;class y{constructor(t,e,s={},o){this.rawName=t,this.description=e,this.config=s,this.cli=o,this.options=[],this.aliasNames=[],this.name=A(t),this.args=L(t),this.examples=[]}usage(t){return this.usageText=t,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(t,e="-v, --version"){return this.versionNumber=t,this.option(e,"Display version number"),this}example(t){return this.examples.push(t),this}option(t,e,s){let o=new E(t,e,s);return this.options.push(o),this}alias(t){return this.aliasNames.push(t),this}action(t){return this.commandAction=t,this}isMatched(t){return this.name===t||this.aliasNames.includes(t)}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof x}hasOption(t){return t=t.split(".")[0],this.options.find((e)=>{return e.names.includes(t)})}outputHelp(){let{name:t,commands:e}=this.cli,{versionNumber:s,options:o,helpCallback:n}=this.cli.globalCommand,i=[{body:`${t}${s?`/${s}`:""}`}];if(i.push({title:"Usage",body:` $ ${t} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&e.length>0){let r=k(e.map((a)=>a.rawName));i.push({title:"Commands",body:e.map((a)=>{return` ${$(a.rawName,r.length)} ${a.description}`}).join(`
|
|
2
2
|
`)}),i.push({title:"For more info, run any command with the `--help` flag",body:e.map((a)=>` $ ${t}${a.name===""?"":` ${a.name}`} --help`).join(`
|
|
3
3
|
`)})}let h=this.isGlobalCommand?o:[...this.options,...o||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand)h=h.filter((r)=>r.name!=="version");if(h.length>0){let r=k(h.map((a)=>a.rawName));i.push({title:"Options",body:h.map((a)=>{return` ${$(a.rawName,r.length)} ${a.description} ${a.config.default===void 0?"":`(default: ${a.config.default})`}`}).join(`
|
|
4
4
|
`)})}if(this.examples.length>0)i.push({title:"Examples",body:this.examples.map((r)=>{if(typeof r==="function")return r(t);return r}).join(`
|