@mintlify/cli 4.1.79 → 4.1.81
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/{build-DF0EjyfW.js → build-B-oc3MuD.js} +1 -1
- package/dist/{build-Nkr-5oHQ.js → build-dp785b-C.js} +10 -10
- package/dist/{cli-DziAQRrh.js → cli-F5_520xC.js} +138 -148
- package/dist/{config-Bl8bCVjS.js → config-DLwNRkEH.js} +8 -8
- package/dist/{config-CLPKBsM0.js → config-o7H193Xj.js} +1 -1
- package/dist/{converter-D-xOhkG2.js → converter-D-AXgjro.js} +1 -1
- package/dist/{currencyMath-JTNtcXni.js → currencyMath-DWVndHDc.js} +1 -1
- package/dist/dist-B9Tpyt5G.js +7 -0
- package/dist/dist-BVY4bzYW.js +7 -0
- package/dist/{dist-DM6gzXTY.js → dist-Cgbskz5I.js} +120 -120
- package/dist/{dist-BZO00XVw.js → dist-Ds9rgRXa.js} +273 -273
- package/dist/{esm-BtDK7B-d.js → esm-Bzf2rZuk.js} +3 -3
- package/dist/{lib-5Y5r5XbK.js → lib-B_P28NMU.js} +1 -1
- package/dist/live-BR7YGuvT.js +19 -0
- package/dist/live-C37won3z.js +7 -0
- package/dist/{multi-repo-cache-BXVYZO0d.js → multi-repo-cache-DQ4-qH_V.js} +1 -1
- package/dist/multi-repo-command-DmTEZuwj.js +101 -0
- package/dist/{multi-repo-command-BvmMS6Mn.js → multi-repo-command-jpsmcxmw.js} +1 -1
- package/dist/{multi-repo-config-B0iQPfHD.js → multi-repo-config-fDV9HAT5.js} +1 -1
- package/dist/multi-repo-preview-C-LdbybQ.js +12 -0
- package/dist/{multi-repo-setup-D5E45UWW.js → multi-repo-setup-CRaAzjLQ.js} +3 -3
- package/dist/{remark-utils-snuBUKxh.js → remark-utils-FAwkaMKD.js} +1 -1
- package/dist/start.js +1 -1
- package/dist/{utils-D9fHH3a7.js → utils-B1yewEzF.js} +2 -2
- package/package.json +9 -9
- package/dist/dist-AJImR0IV.js +0 -7
- package/dist/dist-C6IwWwv9.js +0 -7
- package/dist/multi-repo-command-LiEtu41m.js +0 -101
- package/dist/multi-repo-preview-0rxIuj2v.js +0 -12
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { createRequire as __mintCreateRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __mintFileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __mintDirname } from 'node:path';
|
|
4
|
+
const require = __mintCreateRequire(import.meta.url);
|
|
5
|
+
const __filename = __mintFileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __mintDirname(__filename);
|
|
7
|
+
import{i as e,o as t}from"./rolldown-runtime-CEAe2Uac.js";import{t as n}from"./multi-repo-config-fDV9HAT5.js";import{basename as r,dirname as i,extname as a,normalize as o,relative as s,resolve as c}from"path";import{fileURLToPath as l}from"url";import u from"node:os";import d from"node:path";import{format as f,inspect as p}from"util";import{readFileSync as m,readdirSync as h,statSync as g,writeFile as ee}from"fs";import{notStrictEqual as _,strictEqual as te}from"assert";var v={fs:{readFileSync:m,writeFile:ee},format:f,resolve:c,exists:e=>{try{return g(e).isFile()}catch{return!1}}};let y;var ne=class{constructor(e){e||={},this.directory=e.directory||`./locales`,this.updateFiles=typeof e.updateFiles!=`boolean`||e.updateFiles,this.locale=e.locale||`en`,this.fallbackToLanguage=typeof e.fallbackToLanguage!=`boolean`||e.fallbackToLanguage,this.cache=Object.create(null),this.writeQueue=[]}__(...e){if(typeof arguments[0]!=`string`)return this._taggedLiteral(arguments[0],...arguments);let t=e.shift(),n=function(){};return typeof e[e.length-1]==`function`&&(n=e.pop()),n||=function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][t]&&this.updateFiles?(this.cache[this.locale][t]=t,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),y.format.apply(y.format,[this.cache[this.locale][t]||t].concat(e))}__n(){let e=Array.prototype.slice.call(arguments),t=e.shift(),n=e.shift(),r=e.shift(),i=function(){};typeof e[e.length-1]==`function`&&(i=e.pop()),this.cache[this.locale]||this._readLocaleFile();let a=r===1?t:n;this.cache[this.locale][t]&&(a=this.cache[this.locale][t][r===1?`one`:`other`]),!this.cache[this.locale][t]&&this.updateFiles?(this.cache[this.locale][t]={one:t,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:i})):i();let o=[a];return~a.indexOf(`%d`)&&o.push(r),y.format.apply(y.format,o.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(this.cache[this.locale][t]=e[t])}_taggedLiteral(e,...t){let n=``;return e.forEach(function(e,r){let i=t[r+1];n+=e,i!==void 0&&(n+=`%s`)}),this.__.apply(this,[n].concat([].slice.call(t,1)))}_enqueueWrite(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let e=this,t=this.writeQueue[0],n=t.directory,r=t.locale,i=t.cb,a=this._resolveLocaleFile(n,r),o=JSON.stringify(this.cache[r],null,2);y.fs.writeFile(a,o,`utf-8`,function(t){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),i(t)})}_readLocaleFile(){let e={},t=this._resolveLocaleFile(this.directory,this.locale);try{y.fs.readFileSync&&(e=JSON.parse(y.fs.readFileSync(t,`utf-8`)))}catch(n){if(n instanceof SyntaxError&&(n.message=`syntax error in `+t),n.code===`ENOENT`)e={};else throw n}this.cache[this.locale]=e}_resolveLocaleFile(e,t){let n=y.resolve(e,`./`,t+`.json`);if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~t.lastIndexOf(`_`)){let r=y.resolve(e,`./`,t.split(`_`)[0]+`.json`);this._fileExistsSync(r)&&(n=r)}return n}_fileExistsSync(e){return y.exists(e)}};function re(e,t){y=t;let n=new ne(e);return{__:n.__.bind(n),__n:n.__n.bind(n),setLocale:n.setLocale.bind(n),getLocale:n.getLocale.bind(n),updateLocale:n.updateLocale.bind(n),locale:n.locale}}const b=e=>re(e,v),x={right:ae,center:oe};var S=class{constructor(e){this.width=e.width,this.wrap=e.wrap??!0,this.rows=[]}span(...e){let t=this.div(...e);t.span=!0}resetOutput(){this.rows=[]}div(...e){if(e.length===0&&this.div(``),this.wrap&&this.shouldApplyLayoutDSL(...e)&&typeof e[0]==`string`)return this.applyLayoutDSL(e[0]);let t=e.map(e=>typeof e==`string`?this.colFromString(e):e);return this.rows.push(t),t}shouldApplyLayoutDSL(...e){return e.length===1&&typeof e[0]==`string`&&/[\t\n]/.test(e[0])}applyLayoutDSL(e){let t=e.split(`
|
|
8
|
+
`).map(e=>e.split(` `)),n=0;return t.forEach(e=>{e.length>1&&T.stringWidth(e[0])>n&&(n=Math.min(Math.floor(this.width*.5),T.stringWidth(e[0])))}),t.forEach(e=>{this.div(...e.map((t,r)=>({text:t.trim(),padding:this.measurePadding(t),width:r===0&&e.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(e){return{text:e,padding:this.measurePadding(e)}}measurePadding(e){let t=T.stripAnsi(e);return[0,t.match(/\s*$/)[0].length,0,t.match(/^\s*/)[0].length]}toString(){let e=[];return this.rows.forEach(t=>{this.rowToString(t,e)}),e.filter(e=>!e.hidden).map(e=>e.text).join(`
|
|
9
|
+
`)}rowToString(e,t){return this.rasterize(e).forEach((n,r)=>{let i=``;n.forEach((n,a)=>{let{width:o}=e[a],s=this.negatePadding(e[a]),c=n;if(s>T.stringWidth(n)&&(c+=` `.repeat(s-T.stringWidth(n))),e[a].align&&e[a].align!==`left`&&this.wrap){let t=x[e[a].align];c=t(c,s),T.stringWidth(c)<s&&(c+=` `.repeat((o||0)-T.stringWidth(c)-1))}let l=e[a].padding||[0,0,0,0];l[3]&&(i+=` `.repeat(l[3])),i+=C(e[a],c,`| `),i+=c,i+=C(e[a],c,` |`),l[1]&&(i+=` `.repeat(l[1])),r===0&&t.length>0&&(i=this.renderInline(i,t[t.length-1]))}),t.push({text:i.replace(/ +$/,``),span:e.span})}),t}renderInline(e,t){let n=e.match(/^ */),r=n?n[0].length:0,i=t.text,a=T.stringWidth(i.trimRight());return t.span?this.wrap?r<a?e:(t.hidden=!0,i.trimRight()+` `.repeat(r-a)+e.trimLeft()):(t.hidden=!0,i+e):e}rasterize(e){let t=[],n=this.columnWidths(e),r;return e.forEach((e,i)=>{e.width=n[i],r=this.wrap?T.wrap(e.text,this.negatePadding(e),{hard:!0}).split(`
|
|
10
|
+
`):e.text.split(`
|
|
11
|
+
`),e.border&&(r.unshift(`.`+`-`.repeat(this.negatePadding(e)+2)+`.`),r.push(`'`+`-`.repeat(this.negatePadding(e)+2)+`'`)),e.padding&&(r.unshift(...Array(e.padding[0]||0).fill(``)),r.push(...Array(e.padding[2]||0).fill(``))),r.forEach((e,n)=>{t[n]||t.push([]);let r=t[n];for(let e=0;e<i;e++)r[e]===void 0&&r.push(``);r.push(e)})}),t}negatePadding(e){let t=e.width||0;return e.padding&&(t-=(e.padding[3]||0)+(e.padding[1]||0)),e.border&&(t-=4),t}columnWidths(e){if(!this.wrap)return e.map(e=>e.width||T.stringWidth(e.text));let t=e.length,n=this.width,r=e.map(e=>{if(e.width)return t--,n-=e.width,e.width}),i=t?Math.floor(n/t):0;return r.map((t,n)=>t===void 0?Math.max(i,w(e[n])):t)}};function C(e,t,n){return e.border?/[.']-+[.']/.test(t)?``:t.trim().length===0?` `:n:``}function w(e){let t=e.padding||[],n=1+(t[3]||0)+(t[1]||0);return e.border?n+4:n}function ie(){return typeof process==`object`&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function ae(e,t){e=e.trim();let n=T.stringWidth(e);return n<t?` `.repeat(t-n)+e:e}function oe(e,t){e=e.trim();let n=T.stringWidth(e);return n>=t?e:` `.repeat(t-n>>1)+e}let T;function se(e,t){return T=t,new S({width:e?.width||ie(),wrap:e?.wrap})}const ce=/* @__PURE__ */ RegExp(`\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)`,`g`);function le(e){return e.replace(ce,``)}function ue(e,t){let[n,r]=e.match(ce)||[``,``];e=le(e);let i=``;for(let n=0;n<e.length;n++)n!==0&&n%t===0&&(i+=`
|
|
12
|
+
`),i+=e.charAt(n);return n&&r&&(i=`${n}${i}${r}`),i}function de(e){return se(e,{stringWidth:e=>[...e].length,stripAnsi:le,wrap:ue})}function fe(e,t){let n=c(`.`,e),r;for(g(n).isDirectory()||(n=i(n));;){if(r=t(n,h(n)),r)return c(n,r);if(n=i(r=n),r===n)break}}
|
|
13
|
+
/**
|
|
14
|
+
* @license
|
|
15
|
+
* Copyright (c) 2016, Contributors
|
|
16
|
+
* SPDX-License-Identifier: ISC
|
|
17
|
+
*/
|
|
18
|
+
function pe(e){if((e===e.toLowerCase()||e===e.toUpperCase())&&(e=e.toLowerCase()),e.indexOf(`-`)===-1&&e.indexOf(`_`)===-1)return e;{let t=``,n=!1,r=e.match(/^-+/);for(let i=r?r[0].length:0;i<e.length;i++){let r=e.charAt(i);n&&(n=!1,r=r.toUpperCase()),i!==0&&(r===`-`||r===`_`)?n=!0:r!==`-`&&r!==`_`&&(t+=r)}return t}}function me(e,t){let n=e.toLowerCase();t||=`-`;let r=``;for(let i=0;i<e.length;i++){let a=n.charAt(i),o=e.charAt(i);r+=a!==o&&i>0?`${t}${n.charAt(i)}`:o}return r}function he(e){return e==null?!1:typeof e==`number`||/^0x[0-9a-f]+$/i.test(e)?!0:!/^0[^.]/.test(e)&&/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}
|
|
19
|
+
/**
|
|
20
|
+
* @license
|
|
21
|
+
* Copyright (c) 2016, Contributors
|
|
22
|
+
* SPDX-License-Identifier: ISC
|
|
23
|
+
*/
|
|
24
|
+
function ge(e){if(Array.isArray(e))return e.map(e=>typeof e==`string`?e:e+``);e=e.trim();let t=0,n=null,r=null,i=null,a=[];for(let o=0;o<e.length;o++)n=r,r=e.charAt(o),r===` `&&!i?n!==` `&&t++:(r===i?i=null:r!==`'`&&r!==`"`||i||(i=r),a[t]||(a[t]=``),a[t]+=r);return a}
|
|
25
|
+
/**
|
|
26
|
+
* @license
|
|
27
|
+
* Copyright (c) 2016, Contributors
|
|
28
|
+
* SPDX-License-Identifier: ISC
|
|
29
|
+
*/
|
|
30
|
+
var E;(function(e){e.BOOLEAN=`boolean`,e.STRING=`string`,e.NUMBER=`number`,e.ARRAY=`array`})(E||={});
|
|
31
|
+
/**
|
|
32
|
+
* @license
|
|
33
|
+
* Copyright (c) 2016, Contributors
|
|
34
|
+
* SPDX-License-Identifier: ISC
|
|
35
|
+
*/
|
|
36
|
+
let D;var O=class{constructor(e){D=e}parse(e,t){let n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},t),r=ge(e),i=typeof e==`string`,a=_e(Object.assign(Object.create(null),n.alias)),o=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":`no-`,"parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),s=Object.assign(Object.create(null),n.default),c=n.configObjects||[],l=n.envPrefix,u=o[`populate--`],d=u?`--`:`_`,f=Object.create(null),p=Object.create(null),m=n.__||D.format,h={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},g=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,ee=RegExp(`^--`+o[`negation-prefix`]+`(.+)`);[].concat(n.array||[]).filter(Boolean).forEach(function(e){let t=typeof e==`object`?e.key:e,n=Object.keys(e).map(function(e){return{boolean:`bools`,string:`strings`,number:`numbers`}[e]}).filter(Boolean).pop();n&&(h[n][t]=!0),h.arrays[t]=!0,h.keys.push(t)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(e){h.bools[e]=!0,h.keys.push(e)}),[].concat(n.string||[]).filter(Boolean).forEach(function(e){h.strings[e]=!0,h.keys.push(e)}),[].concat(n.number||[]).filter(Boolean).forEach(function(e){h.numbers[e]=!0,h.keys.push(e)}),[].concat(n.count||[]).filter(Boolean).forEach(function(e){h.counts[e]=!0,h.keys.push(e)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(e){h.normalize[e]=!0,h.keys.push(e)}),typeof n.narg==`object`&&Object.entries(n.narg).forEach(([e,t])=>{typeof t==`number`&&(h.nargs[e]=t,h.keys.push(e))}),typeof n.coerce==`object`&&Object.entries(n.coerce).forEach(([e,t])=>{typeof t==`function`&&(h.coercions[e]=t,h.keys.push(e))}),n.config!==void 0&&(Array.isArray(n.config)||typeof n.config==`string`?[].concat(n.config).filter(Boolean).forEach(function(e){h.configs[e]=!0}):typeof n.config==`object`&&Object.entries(n.config).forEach(([e,t])=>{(typeof t==`boolean`||typeof t==`function`)&&(h.configs[e]=t)})),fe(n.key,a,n.default,h.arrays),Object.keys(s).forEach(function(e){(h.aliases[e]||[]).forEach(function(t){s[t]=s[e]})});let _=null;Oe();let te=[],v=Object.assign(Object.create(null),{_:[]}),y={};for(let e=0;e<r.length;e++){let t=r[e],n=t.replace(/^-{3,}/,`---`),i,a,s,c,l,u;if(t!==`--`&&/^-/.test(t)&&we(t))ne(t);else if(n.match(/^---+(=|$)/)){ne(t);continue}else if(t.match(/^--.+=/)||!o[`short-option-groups`]&&t.match(/^-.+=/))c=t.match(/^--?([^=]+)=([\s\S]*)$/),c!==null&&Array.isArray(c)&&c.length>=3&&(O(c[1],h.arrays)?e=b(e,c[1],r,c[2]):O(c[1],h.nargs)===!1?x(c[1],c[2],!0):e=re(e,c[1],r,c[2]));else if(t.match(ee)&&o[`boolean-negation`])c=t.match(ee),c!==null&&Array.isArray(c)&&c.length>=2&&(a=c[1],x(a,O(a,h.arrays)?[!1]:!1));else if(t.match(/^--.+/)||!o[`short-option-groups`]&&t.match(/^-[^-]+/))c=t.match(/^--?(.+)/),c!==null&&Array.isArray(c)&&c.length>=2&&(a=c[1],O(a,h.arrays)?e=b(e,a,r):O(a,h.nargs)===!1?(l=r[e+1],l!==void 0&&(!l.match(/^-/)||l.match(g))&&!O(a,h.bools)&&!O(a,h.counts)||/^(true|false)$/.test(l)?(x(a,l),e++):x(a,k(a))):e=re(e,a,r));else if(t.match(/^-.\..+=/))c=t.match(/^-([^=]+)=([\s\S]*)$/),c!==null&&Array.isArray(c)&&c.length>=3&&x(c[1],c[2]);else if(t.match(/^-.\..+/)&&!t.match(g))l=r[e+1],c=t.match(/^-(.\..+)/),c!==null&&Array.isArray(c)&&c.length>=2&&(a=c[1],l!==void 0&&!l.match(/^-/)&&!O(a,h.bools)&&!O(a,h.counts)?(x(a,l),e++):x(a,k(a)));else if(t.match(/^-[^-]+/)&&!t.match(g)){s=t.slice(1,-1).split(``),i=!1;for(let n=0;n<s.length;n++){if(l=t.slice(n+2),s[n+1]&&s[n+1]===`=`){u=t.slice(n+3),a=s[n],O(a,h.arrays)?e=b(e,a,r,u):O(a,h.nargs)===!1?x(a,u):e=re(e,a,r,u),i=!0;break}if(l===`-`)x(s[n],l);else{if(/[A-Za-z]/.test(s[n])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(l)&&O(l,h.bools)===!1||s[n+1]&&s[n+1].match(/\W/)){x(s[n],l),i=!0;break}x(s[n],k(s[n]))}}a=t.slice(-1)[0],!i&&a!==`-`&&(O(a,h.arrays)?e=b(e,a,r):O(a,h.nargs)===!1?(l=r[e+1],l!==void 0&&(!/^(-|--)[^-]/.test(l)||l.match(g))&&!O(a,h.bools)&&!O(a,h.counts)||/^(true|false)$/.test(l)?(x(a,l),e++):x(a,k(a))):e=re(e,a,r))}else if(t.match(/^-[0-9]$/)&&t.match(g)&&O(t.slice(1),h.bools))a=t.slice(1),x(a,k(a));else if(t===`--`){te=r.slice(e+1);break}else if(o[`halt-at-non-option`]){te=r.slice(e);break}else ne(t)}T(v,!0),T(v,!1),ie(v),oe(),le(v,h.aliases,s,!0),se(v),o[`set-placeholder-key`]&&ce(v),Object.keys(h.counts).forEach(function(e){ue(v,e.split(`.`))||x(e,0)}),u&&te.length&&(v[d]=[]),te.forEach(function(e){v[d].push(e)}),o[`camel-case-expansion`]&&o[`strip-dashed`]&&Object.keys(v).filter(e=>e!==`--`&&e.includes(`-`)).forEach(e=>{delete v[e]}),o[`strip-aliased`]&&[].concat(...Object.keys(a).map(e=>a[e])).forEach(e=>{o[`camel-case-expansion`]&&e.includes(`-`)&&delete v[e.split(`.`).map(e=>pe(e)).join(`.`)],delete v[e]});function ne(e){let t=w(`_`,e);(typeof t==`string`||typeof t==`number`)&&v._.push(t)}function re(e,t,n,r){let i,a=O(t,h.nargs);if(a=typeof a!=`number`||isNaN(a)?1:a,a===0)return A(r)||(_=Error(m(`Argument unexpected for: %s`,t))),x(t,k(t)),e;let s=+!A(r);if(o[`nargs-eats-options`])n.length-(e+1)+s<a&&(_=Error(m(`Not enough arguments following: %s`,t))),s=a;else{for(i=e+1;i<n.length&&(!n[i].match(/^-[^0-9]/)||n[i].match(g)||we(n[i]));i++)s++;s<a&&(_=Error(m(`Not enough arguments following: %s`,t)))}let c=Math.min(s,a);for(!A(r)&&c>0&&(x(t,r),c--),i=e+1;i<c+e+1;i++)x(t,n[i]);return e+c}function b(e,t,n,r){let a=[],c=r||n[e+1],l=O(t,h.nargs);if(O(t,h.bools)&&!/^(true|false)$/.test(c))a.push(!0);else if(A(c)||A(r)&&/^-/.test(c)&&!g.test(c)&&!we(c)){if(s[t]!==void 0){let e=s[t];a=Array.isArray(e)?e:[e]}}else{A(r)||a.push(C(t,r,!0));for(let r=e+1;r<n.length&&!(!o[`greedy-arrays`]&&a.length>0||l&&typeof l==`number`&&a.length>=l||(c=n[r],/^-/.test(c)&&!g.test(c)&&!we(c)));r++)e=r,a.push(C(t,c,i))}return typeof l==`number`&&(l&&a.length<l||isNaN(l)&&a.length===0)&&(_=Error(m(`Not enough arguments following: %s`,t))),x(t,a),e}function x(e,t,n=i){/-/.test(e)&&o[`camel-case-expansion`]&&S(e,e.split(`.`).map(function(e){return pe(e)}).join(`.`));let r=C(e,t,n),a=e.split(`.`);de(v,a,r),h.aliases[e]&&h.aliases[e].forEach(function(e){let t=e.split(`.`);de(v,t,r)}),a.length>1&&o[`dot-notation`]&&(h.aliases[a[0]]||[]).forEach(function(t){let n=t.split(`.`),i=[].concat(a);i.shift(),n=n.concat(i),(h.aliases[e]||[]).includes(n.join(`.`))||de(v,n,r)}),O(e,h.normalize)&&!O(e,h.arrays)&&[e].concat(h.aliases[e]||[]).forEach(function(e){Object.defineProperty(y,e,{enumerable:!0,get(){return t},set(e){t=typeof e==`string`?D.normalize(e):e}})})}function S(e,t){h.aliases[e]&&h.aliases[e].length||(h.aliases[e]=[t],f[t]=!0),h.aliases[t]&&h.aliases[t].length||S(t,e)}function C(e,t,n){n&&(t=be(t)),(O(e,h.bools)||O(e,h.counts))&&typeof t==`string`&&(t=t===`true`);let r=Array.isArray(t)?t.map(function(t){return w(e,t)}):w(e,t);return O(e,h.counts)&&(A(r)||typeof r==`boolean`)&&(r=ve()),O(e,h.normalize)&&O(e,h.arrays)&&(r=Array.isArray(t)?t.map(e=>D.normalize(e)):D.normalize(t)),r}function w(e,t){return!o[`parse-positional-numbers`]&&e===`_`||!O(e,h.strings)&&!O(e,h.bools)&&!Array.isArray(t)&&(he(t)&&o[`parse-numbers`]&&Number.isSafeInteger(Math.floor(parseFloat(`${t}`)))||!A(t)&&O(e,h.numbers))&&(t=Number(t)),t}function ie(e){let t=Object.create(null);le(t,h.aliases,s),Object.keys(h.configs).forEach(function(n){let r=e[n]||t[n];if(r)try{let e=null,t=D.resolve(D.cwd(),r),i=h.configs[n];if(typeof i==`function`){try{e=i(t)}catch(t){e=t}if(e instanceof Error){_=e;return}}else e=D.require(t);ae(e)}catch(t){t.name===`PermissionDenied`?_=t:e[n]&&(_=Error(m(`Invalid JSON config file: %s`,r)))}})}function ae(e,t){Object.keys(e).forEach(function(n){let r=e[n],i=t?t+`.`+n:n;typeof r==`object`&&r&&!Array.isArray(r)&&o[`dot-notation`]?ae(r,i):(!ue(v,i.split(`.`))||O(i,h.arrays)&&o[`combine-arrays`])&&x(i,r)})}function oe(){c!==void 0&&c.forEach(function(e){ae(e)})}function T(e,t){if(l===void 0)return;let n=typeof l==`string`?l:``,r=D.env();Object.keys(r).forEach(function(i){if(n===``||i.lastIndexOf(n,0)===0){let a=i.split(`__`).map(function(e,t){return t===0&&(e=e.substring(n.length)),pe(e)});(t&&h.configs[a.join(`.`)]||!t)&&!ue(e,a)&&x(a.join(`.`),r[i])}})}function se(e){let t,n=/* @__PURE__ */ new Set;Object.keys(e).forEach(function(r){if(!n.has(r)&&(t=O(r,h.coercions),typeof t==`function`))try{let i=w(r,t(e[r]));[].concat(h.aliases[r]||[],r).forEach(t=>{n.add(t),e[t]=i})}catch(e){_=e}})}function ce(e){return h.keys.forEach(t=>{~t.indexOf(`.`)||e[t]===void 0&&(e[t]=void 0)}),e}function le(e,t,n,r=!1){Object.keys(n).forEach(function(i){ue(e,i.split(`.`))||(de(e,i.split(`.`),n[i]),r&&(p[i]=!0),(t[i]||[]).forEach(function(t){ue(e,t.split(`.`))||de(e,t.split(`.`),n[i])}))})}function ue(e,t){let n=e;o[`dot-notation`]||(t=[t.join(`.`)]),t.slice(0,-1).forEach(function(e){n=n[e]||{}});let r=t[t.length-1];return typeof n==`object`&&r in n}function de(e,t,n){let r=e;o[`dot-notation`]||(t=[t.join(`.`)]),t.slice(0,-1).forEach(function(e){e=ye(e),typeof r==`object`&&r[e]===void 0&&(r[e]={}),typeof r[e]!=`object`||Array.isArray(r[e])?(Array.isArray(r[e])?r[e].push({}):r[e]=[r[e],{}],r=r[e][r[e].length-1]):r=r[e]});let i=ye(t[t.length-1]),a=O(t.join(`.`),h.arrays),s=Array.isArray(n),c=o[`duplicate-arguments-array`];!c&&O(i,h.nargs)&&(c=!0,(!A(r[i])&&h.nargs[i]===1||Array.isArray(r[i])&&r[i].length===h.nargs[i])&&(r[i]=void 0)),n===ve()?r[i]=ve(r[i]):Array.isArray(r[i])?c&&a&&s?r[i]=o[`flatten-duplicate-arrays`]?r[i].concat(n):(Array.isArray(r[i][0])?r[i]:[r[i]]).concat([n]):!c&&!!a==!!s?r[i]=n:r[i]=r[i].concat([n]):r[i]===void 0&&a?r[i]=s?n:[n]:c&&!(r[i]===void 0||O(i,h.counts)||O(i,h.bools))?r[i]=[r[i],n]:r[i]=n}function fe(...e){e.forEach(function(e){Object.keys(e||{}).forEach(function(e){h.aliases[e]||(h.aliases[e]=[].concat(a[e]||[]),h.aliases[e].concat(e).forEach(function(t){if(/-/.test(t)&&o[`camel-case-expansion`]){let n=pe(t);n!==e&&h.aliases[e].indexOf(n)===-1&&(h.aliases[e].push(n),f[n]=!0)}}),h.aliases[e].concat(e).forEach(function(t){if(t.length>1&&/[A-Z]/.test(t)&&o[`camel-case-expansion`]){let n=me(t,`-`);n!==e&&h.aliases[e].indexOf(n)===-1&&(h.aliases[e].push(n),f[n]=!0)}}),h.aliases[e].forEach(function(t){h.aliases[t]=[e].concat(h.aliases[e].filter(function(e){return t!==e}))}))})})}function O(e,t){let n=[].concat(h.aliases[e]||[],e),r=Object.keys(t),i=n.find(e=>r.includes(e));return i?t[i]:!1}function xe(e){let t=Object.keys(h);return[].concat(t.map(e=>h[e])).some(function(t){return Array.isArray(t)?t.includes(e):t[e]})}function Se(e,...t){return[].concat(...t).some(function(t){let n=e.match(t);return n&&xe(n[1])})}function Ce(e){if(e.match(g)||!e.match(/^-[^-]+/))return!1;let t=!0,n,r=e.slice(1).split(``);for(let i=0;i<r.length;i++){if(n=e.slice(i+2),!xe(r[i])){t=!1;break}if(r[i+1]&&r[i+1]===`=`||n===`-`||/[A-Za-z]/.test(r[i])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(n)||r[i+1]&&r[i+1].match(/\W/))break}return t}function we(e){return o[`unknown-options-as-args`]&&Te(e)}function Te(e){return e=e.replace(/^-{3,}/,`--`),e.match(g)||Ce(e)?!1:!Se(e,/^-+([^=]+?)=[\s\S]*$/,ee,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function k(e){return!O(e,h.bools)&&!O(e,h.counts)&&`${e}`in s?s[e]:Ee(De(e))}function Ee(e){return{[E.BOOLEAN]:!0,[E.STRING]:``,[E.NUMBER]:void 0,[E.ARRAY]:[]}[e]}function De(e){let t=E.BOOLEAN;return O(e,h.strings)?t=E.STRING:O(e,h.numbers)?t=E.NUMBER:O(e,h.bools)?t=E.BOOLEAN:O(e,h.arrays)&&(t=E.ARRAY),t}function A(e){return e===void 0}function Oe(){Object.keys(h.counts).find(e=>O(e,h.arrays)?(_=Error(m(`Invalid configuration: %s, opts.count excludes opts.array.`,e)),!0):O(e,h.nargs)?(_=Error(m(`Invalid configuration: %s, opts.count excludes opts.narg.`,e)),!0):!1)}return{aliases:Object.assign({},h.aliases),argv:Object.assign(y,v),configuration:o,defaulted:Object.assign({},p),error:_,newAliases:Object.assign({},f)}}};function _e(e){let t=[],n=Object.create(null),r=!0;for(Object.keys(e).forEach(function(n){t.push([].concat(e[n],n))});r;){r=!1;for(let e=0;e<t.length;e++)for(let n=e+1;n<t.length;n++)if(t[e].filter(function(e){return t[n].indexOf(e)!==-1}).length){t[e]=t[e].concat(t[n]),t.splice(n,1),r=!0;break}}return t.forEach(function(e){e=e.filter(function(e,t,n){return n.indexOf(e)===t});let t=e.pop();t!==void 0&&typeof t==`string`&&(n[t]=e)}),n}function ve(e){return e===void 0?1:e+1}function ye(e){return e===`__proto__`?`___proto___`:e}function be(e){return typeof e==`string`&&(e[0]===`'`||e[0]===`"`)&&e[e.length-1]===e[0]?e.substring(1,e.length-1):e}
|
|
37
|
+
/**
|
|
38
|
+
* @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
|
|
39
|
+
* CJS and ESM environments.
|
|
40
|
+
*
|
|
41
|
+
* @license
|
|
42
|
+
* Copyright (c) 2016, Contributors
|
|
43
|
+
* SPDX-License-Identifier: ISC
|
|
44
|
+
*/
|
|
45
|
+
const xe=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Se=(process==null?void 0:process.versions)?.node??(process==null?void 0:process.version)?.slice(1);if(Se&&Number(Se.match(/^([^.]+)/)[1])<xe)throw Error(`yargs parser supports a minimum Node.js version of ${xe}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const Ce=process?process.env:{},we=new O({cwd:process.cwd,env:()=>Ce,format:f,normalize:o,resolve:c,require:t=>{if(e!==void 0)return e(t);if(t.match(/\.json$/))return JSON.parse(m(t,`utf8`));throw Error(`only .json config files are supported in ESM`)}}),Te=function(e,t){return we.parse(e.slice(),t).argv};Te.detailed=function(e,t){return we.parse(e.slice(),t)},Te.camelCase=pe,Te.decamelize=me,Te.looksLikeNumber=he;function k(){return+!Ee()}function Ee(){return De()&&!process.defaultApp}function De(){return!!process.versions.electron}function A(e){return e.slice(k()+1)}function Oe(){return process.argv[k()]}var j=class e extends Error{constructor(t){super(t||`yargs error`),this.name=`YError`,Error.captureStackTrace&&Error.captureStackTrace(this,e)}};const ke=`loading a directory of commands is not supported yet for ESM`;let Ae;try{Ae=l(import.meta.url)}catch{Ae=process.cwd()}const je=Ae.substring(0,Ae.lastIndexOf(`node_modules`));var Me={assert:{notStrictEqual:_,strictEqual:te},cliui:de,findUp:fe,getEnv:e=>process.env[e],inspect:p,getCallerFile:()=>{throw new j(ke)},getProcessArgvBin:Oe,mainFilename:je||process.cwd(),Parser:Te,path:{basename:r,dirname:i,extname:a,relative:s,resolve:c},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(e,t)=>process.emitWarning(e,t),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:process.stdout.columns===void 0?null:process.stdout.columns},readFileSync:m,require:()=>{throw new j(`require is not supported by ESM`)},requireDirectory:()=>{throw new j(ke)},stringWidth:e=>[...e].length,y18n:b({directory:c(Ae,`../assets/yargs-locales`),updateFiles:!1})};function M(e,t,n,r){n.assert.notStrictEqual(e,t,r)}function Ne(e,t){t.assert.strictEqual(typeof e,`string`)}function Pe(e){return Object.keys(e)}function N(e){return!!e&&!!e.then&&typeof e.then==`function`}function Fe(e){let t=e.replace(/\s{2,}/g,` `).split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,r=t.shift();if(!r)throw Error(`No command found in: ${e}`);let i={cmd:r.replace(n,``),demanded:[],optional:[]};return t.forEach((e,r)=>{let a=!1;e=e.replace(/\s/g,``),/\.+[\]>]/.test(e)&&r===t.length-1&&(a=!0),/^\[/.test(e)?i.optional.push({cmd:e.replace(n,``).split(`|`),variadic:a}):i.demanded.push({cmd:e.replace(n,``).split(`|`),variadic:a})}),i}const Ie=[`first`,`second`,`third`,`fourth`,`fifth`,`sixth`];function P(e,t,n){function r(){return typeof e==`object`?[{demanded:[],optional:[]},e,t]:[Fe(`cmd ${e}`),t,n]}try{let e=0,[t,n,i]=r(),a=[].slice.call(n);for(;a.length&&a[a.length-1]===void 0;)a.pop();let o=i||a.length;if(o<t.demanded.length)throw new j(`Not enough arguments provided. Expected ${t.demanded.length} but received ${a.length}.`);let s=t.demanded.length+t.optional.length;if(o>s)throw new j(`Too many arguments provided. Expected max ${s} but received ${o}.`);t.demanded.forEach(t=>{let n=Le(a.shift());t.cmd.filter(e=>e===n||e===`*`).length===0&&Re(n,t.cmd,e),e+=1}),t.optional.forEach(t=>{if(a.length===0)return;let n=Le(a.shift());t.cmd.filter(e=>e===n||e===`*`).length===0&&Re(n,t.cmd,e),e+=1})}catch(e){console.warn(e.stack)}}function Le(e){return Array.isArray(e)?`array`:e===null?`null`:typeof e}function Re(e,t,n){throw new j(`Invalid ${Ie[n]||`manyith`} argument. Expected ${t.join(` or `)} but received ${e}.`)}var ze=class{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,t,n=!0,r=!1){if(P(`<array|function> [boolean] [boolean] [boolean]`,[e,t,n],arguments.length),Array.isArray(e)){for(let r=0;r<e.length;r++){if(typeof e[r]!=`function`)throw Error(`middleware must be a function`);let i=e[r];i.applyBeforeValidation=t,i.global=n}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e==`function`){let i=e;i.applyBeforeValidation=t,i.global=n,i.mutates=r,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,t){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(e=>{let r=[...n[t]||[],t];return!e.option||!r.includes(e.option)}),e.option=t,this.addMiddleware(e,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let e=this.frozens.pop();e!==void 0&&(this.globalMiddleware=e)}reset(){this.globalMiddleware=this.globalMiddleware.filter(e=>e.global)}};function Be(e){return e?e.map(e=>(e.applyBeforeValidation=!1,e)):[]}function Ve(e,t,n,r){return n.reduce((e,n)=>{if(n.applyBeforeValidation!==r)return e;if(n.mutates){if(n.applied)return e;n.applied=!0}if(N(e))return e.then(e=>Promise.all([e,n(e,t)])).then(([e,t])=>Object.assign(e,t));{let r=n(e,t);return N(r)?r.then(t=>Object.assign(e,t)):Object.assign(e,r)}},e)}function He(e,t,n=e=>{throw e}){try{let n=Ue(e)?e():e;return N(n)?n.then(e=>t(e)):t(n)}catch(e){return n(e)}}function Ue(e){return typeof e==`function`}function We(t){if(e===void 0)return null;for(let n=0,r=Object.keys(e.cache),i;n<r.length;n++)if(i=e.cache[r[n]],i.exports===t)return i;return null}const Ge=/(^\*)|(^\$0)/;var Ke=class{constructor(e,t,n,r){this.requireCache=/* @__PURE__ */ new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=r,this.usage=e,this.globalMiddleware=n,this.validation=t}addDirectory(e,t,n,r){r||={},typeof r.recurse!=`boolean`&&(r.recurse=!1),Array.isArray(r.extensions)||(r.extensions=[`js`]);let i=typeof r.visit==`function`?r.visit:e=>e;r.visit=(e,t,n)=>{let r=i(e,t,n);if(r){if(this.requireCache.has(t))return r;this.requireCache.add(t),this.addHandler(r)}return r},this.shim.requireDirectory({require:t,filename:n},e,r)}addHandler(e,t,n,r,i,a){let o=[],s=Be(i);if(r||=(()=>{}),Array.isArray(e)){if(Ye(e))[e,...o]=e;else for(let t of e)this.addHandler(t)}else if(Qe(e)){let t=Array.isArray(e.command)||typeof e.command==`string`?e.command:this.moduleName(e);e.aliases&&(t=[].concat(t,e.aliases)),this.addHandler(t,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(Je(n)){this.addHandler([e].concat(o),t,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e==`string`){let i=Fe(e);o=o.map(e=>Fe(e).cmd);let c=!1,l=[i.cmd].concat(o).filter(e=>!Ge.test(e)||(c=!0,!1));l.length===0&&c&&l.push(`$0`),c&&(i.cmd=l[0],o=l.slice(1),e=e.replace(Ge,i.cmd)),o.forEach(e=>{this.aliasMap[e]=i.cmd}),t!==!1&&this.usage.command(e,t,c,o,a),this.handlers[i.cmd]={original:e,description:t,handler:r,builder:n||{},middlewares:s,deprecated:a,demanded:i.demanded,optional:i.optional},c&&(this.defaultCommand=this.handlers[i.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,t,n,r,i,a){let o=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,s=t.getInternalMethods().getContext(),c=s.commands.slice(),l=!e;e&&(s.commands.push(e),s.fullCommands.push(o.original));let u=this.applyBuilderUpdateUsageAndParse(l,o,t,n.aliases,c,r,i,a);return N(u)?u.then(e=>this.applyMiddlewareAndGetResult(l,o,e.innerArgv,s,i,e.aliases,t)):this.applyMiddlewareAndGetResult(l,o,u.innerArgv,s,i,u.aliases,t)}applyBuilderUpdateUsageAndParse(e,t,n,r,i,a,o,s){let c=t.builder,l=n;if(Xe(c)){n.getInternalMethods().getUsageInstance().freeze();let u=c(n.getInternalMethods().reset(r),s);if(N(u))return u.then(r=>(l=Cn(r)?r:n,this.parseAndUpdateUsage(e,t,l,i,a,o)))}else Ze(c)&&(n.getInternalMethods().getUsageInstance().freeze(),l=n.getInternalMethods().reset(r),Object.keys(t.builder).forEach(e=>{l.option(e,c[e])}));return this.parseAndUpdateUsage(e,t,l,i,a,o)}parseAndUpdateUsage(e,t,n,r,i,a){e&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(r,t),t.description);let o=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,i,a);return N(o)?o.then(e=>({aliases:n.parsed.aliases,innerArgv:e})):{aliases:n.parsed.aliases,innerArgv:o}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,t){let n=Ge.test(t.original)?t.original.replace(Ge,``).trim():t.original,r=e.filter(e=>!Ge.test(e));return r.push(n),`$0 ${r.join(` `)}`}handleValidationAndGetResult(e,t,n,r,i,a,o,s){if(!a.getInternalMethods().getHasOutput()){let t=a.getInternalMethods().runValidation(i,s,a.parsed.error,e);n=He(n,e=>(t(e),e))}if(t.handler&&!a.getInternalMethods().getHasOutput()){a.getInternalMethods().setHasOutput();let r=!!a.getOptions().configuration[`populate--`];a.getInternalMethods().postProcess(n,r,!1,!1),n=Ve(n,a,o,!1),n=He(n,e=>{let n=t.handler(e);return N(n)?n.then(()=>e):e}),e||a.getInternalMethods().getUsageInstance().cacheHelpMessage(),N(n)&&!a.getInternalMethods().hasParseCallback()&&n.catch(e=>{try{a.getInternalMethods().getUsageInstance().fail(null,e)}catch{}})}return e||(r.commands.pop(),r.fullCommands.pop()),n}applyMiddlewareAndGetResult(e,t,n,r,i,a,o){let s={};if(i)return n;o.getInternalMethods().getHasOutput()||(s=this.populatePositionals(t,n,r,o));let c=this.globalMiddleware.getMiddleware().slice(0).concat(t.middlewares),l=Ve(n,o,c,!0);return N(l)?l.then(n=>this.handleValidationAndGetResult(e,t,n,r,a,o,c,s)):this.handleValidationAndGetResult(e,t,l,r,a,o,c,s)}populatePositionals(e,t,n,r){t._=t._.slice(n.commands.length);let i=e.demanded.slice(0),a=e.optional.slice(0),o={};for(this.validation.positionalCount(i.length,t._.length);i.length;){let e=i.shift();this.populatePositional(e,t,o)}for(;a.length;){let e=a.shift();this.populatePositional(e,t,o)}return t._=n.commands.concat(t._.map(e=>``+e)),this.postProcessPositionals(t,o,this.cmdToParseOptions(e.original),r),o}populatePositional(e,t,n){let r=e.cmd[0];e.variadic?n[r]=t._.splice(0).map(String):t._.length&&(n[r]=[String(t._.shift())])}cmdToParseOptions(e){let t={array:[],default:{},alias:{},demand:{}},n=Fe(e);return n.demanded.forEach(e=>{let[n,...r]=e.cmd;e.variadic&&(t.array.push(n),t.default[n]=[]),t.alias[n]=r,t.demand[n]=!0}),n.optional.forEach(e=>{let[n,...r]=e.cmd;e.variadic&&(t.array.push(n),t.default[n]=[]),t.alias[n]=r}),t}postProcessPositionals(e,t,n,r){let i=Object.assign({},r.getOptions());i.default=Object.assign(n.default,i.default);for(let e of Object.keys(n.alias))i.alias[e]=(i.alias[e]||[]).concat(n.alias[e]);i.array=i.array.concat(n.array),i.config={};let a=[];if(Object.keys(t).forEach(e=>{t[e].map(t=>{i.configuration[`unknown-options-as-args`]&&(i.key[e]=!0),a.push(`--${e}`),a.push(t)})}),!a.length)return;let o=Object.assign({},i.configuration,{"populate--":!1}),s=this.shim.Parser.detailed(a,Object.assign({},i,{configuration:o}));if(s.error)r.getInternalMethods().getUsageInstance().fail(s.error.message,s.error);else{let n=Object.keys(t);Object.keys(t).forEach(e=>{n.push(...s.aliases[e])}),Object.keys(s.argv).forEach(i=>{n.includes(i)&&(t[i]||(t[i]=s.argv[i]),e[i]=!this.isInConfigs(r,i)&&!this.isDefaulted(r,i)&&Object.prototype.hasOwnProperty.call(e,i)&&Object.prototype.hasOwnProperty.call(s.argv,i)&&(Array.isArray(e[i])||Array.isArray(s.argv[i]))?[].concat(e[i],s.argv[i]):s.argv[i])})}}isDefaulted(e,t){let{default:n}=e.getOptions();return Object.prototype.hasOwnProperty.call(n,t)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(t))}isInConfigs(e,t){let{configObjects:n}=e.getOptions();return n.some(e=>Object.prototype.hasOwnProperty.call(e,t))||n.some(e=>Object.prototype.hasOwnProperty.call(e,this.shim.Parser.camelCase(t)))}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){let t=Ge.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,`$0 `);e.getInternalMethods().getUsageInstance().usage(t,this.defaultCommand.description)}let t=this.defaultCommand.builder;if(Xe(t))return t(e,!0);Je(t)||Object.keys(t).forEach(n=>{e.option(n,t[n])})}moduleName(e){let t=We(e);if(!t)throw Error(`No command name given for module: ${this.shim.inspect(e)}`);return this.commandFromFilename(t.filename)}commandFromFilename(e){return this.shim.path.basename(e,this.shim.path.extname(e))}extractDesc({describe:e,description:t,desc:n}){for(let r of[e,t,n]){if(typeof r==`string`||r===!1)return r;M(r,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let e=this.frozens.pop();M(e,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=e}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=/* @__PURE__ */ new Set,this}};function qe(e,t,n,r){return new Ke(e,t,n,r)}function Je(e){return typeof e==`object`&&!!e.builder&&typeof e.handler==`function`}function Ye(e){return e.every(e=>typeof e==`string`)}function Xe(e){return typeof e==`function`}function Ze(e){return typeof e==`object`}function Qe(e){return typeof e==`object`&&!Array.isArray(e)}function $e(e={},t=()=>!0){let n={};return Pe(e).forEach(r=>{t(r,e[r])&&(n[r]=e[r])}),n}function et(e){typeof process<`u`&&[process.stdout,process.stderr].forEach(t=>{let n=t;n._handle&&n.isTTY&&typeof n._handle.setBlocking==`function`&&n._handle.setBlocking(e)})}function tt(e){return typeof e==`boolean`}function nt(e,t){let n=t.y18n.__,r={},i=[];r.failFn=function(e){i.push(e)};let a=null,o=null,s=!0;r.showHelpOnFail=function(t=!0,n){let[i,c]=typeof t==`string`?[!0,t]:[t,n];return e.getInternalMethods().isGlobalContext()&&(o=c),a=c,s=i,r};let c=!1;r.fail=function(t,n){let l=e.getInternalMethods().getLoggerInstance();if(i.length)for(let e=i.length-1;e>=0;--e){let a=i[e];if(tt(a)){if(n)throw n;if(t)throw Error(t)}else a(t,n,r)}else{if(e.getExitProcess()&&et(!0),!c){c=!0,s&&(e.showHelp(`error`),l.error()),(t||n)&&l.error(t||n);let r=a||o;r&&((t||n)&&l.error(``),l.error(r))}if(n||=new j(t),e.getExitProcess())return e.exit(1);if(e.getInternalMethods().hasParseCallback())return e.exit(1,n);throw n}};let l=[],u=!1;r.usage=(e,t)=>e===null?(u=!0,l=[],r):(u=!1,l.push([e,t||``]),r),r.getUsage=()=>l,r.getUsageDisabled=()=>u,r.getPositionalGroupName=()=>n(`Positionals:`);let d=[];r.example=(e,t)=>{d.push([e,t||``])};let f=[];r.command=function(e,t,n,r,i=!1){n&&(f=f.map(e=>(e[2]=!1,e))),f.push([e,t||``,n,r,i])},r.getCommands=()=>f;let p={};r.describe=function(e,t){Array.isArray(e)?e.forEach(e=>{r.describe(e,t)}):typeof e==`object`?Object.keys(e).forEach(t=>{r.describe(t,e[t])}):p[e]=t},r.getDescriptions=()=>p;let m=[];r.epilog=e=>{m.push(e)};let h=!1,g;r.wrap=e=>{h=!0,g=e},r.getWrap=()=>t.getEnv(`YARGS_DISABLE_WRAP`)?null:(h||=(g=b(),!0),g);let ee=`__yargsString__:`;r.deferY18nLookup=e=>ee+e,r.help=function(){if(v)return v;te();let i=e.customScriptName?e.$0:t.path.basename(e.$0),a=e.getDemandedOptions(),o=e.getDemandedCommands(),s=e.getDeprecatedOptions(),c=e.getGroups(),h=e.getOptions(),g=[];g=g.concat(Object.keys(p)),g=g.concat(Object.keys(a)),g=g.concat(Object.keys(o)),g=g.concat(Object.keys(h.default)),g=g.filter(ne),g=Object.keys(g.reduce((e,t)=>(t!==`_`&&(e[t]=!0),e),{}));let b=r.getWrap(),x=t.cliui({width:b,wrap:!!b});if(!u){if(l.length)l.forEach(e=>{x.div({text:`${e[0].replace(/\$0/g,i)}`}),e[1]&&x.div({text:`${e[1]}`,padding:[1,0,0,0]})}),x.div();else if(f.length){let e=null;e=o._?`${i} <${n(`command`)}>\n`:`${i} [${n(`command`)}]\n`,x.div(`${e}`)}}if(f.length>1||f.length===1&&!f[0][2]){x.div(n(`Commands:`));let t=e.getInternalMethods().getContext(),r=t.commands.length?`${t.commands.join(` `)} `:``;e.getInternalMethods().getParserConfiguration()[`sort-commands`]===!0&&(f=f.sort((e,t)=>e[0].localeCompare(t[0])));let a=i?`${i} `:``;f.forEach(e=>{let t=`${a}${r}${e[0].replace(/^\$0 ?/,``)}`;x.span({text:t,padding:[0,2,0,2],width:_(f,b,`${i}${r}`)+4},{text:e[1]});let o=[];e[2]&&o.push(`[${n(`default`)}]`),e[3]&&e[3].length&&o.push(`[${n(`aliases:`)} ${e[3].join(`, `)}]`),e[4]&&(typeof e[4]==`string`?o.push(`[${n(`deprecated: %s`,e[4])}]`):o.push(`[${n(`deprecated`)}]`)),o.length?x.div({text:o.join(` `),padding:[0,0,0,2],align:`right`}):x.div()}),x.div()}let S=(Object.keys(h.alias)||[]).concat(Object.keys(e.parsed.newAliases)||[]);g=g.filter(t=>!e.parsed.newAliases[t]&&S.every(e=>(h.alias[e]||[]).indexOf(t)===-1));let C=n(`Options:`);c[C]||(c[C]=[]),y(g,h.alias,c,C);let w=e=>/^--/.test(ot(e)),ie=Object.keys(c).filter(e=>c[e].length>0).map(e=>({groupName:e,normalizedKeys:c[e].filter(ne).map(e=>{if(S.includes(e))return e;for(let t=0,n;(n=S[t])!==void 0;t++)if((h.alias[n]||[]).includes(e))return n;return e})})).filter(({normalizedKeys:e})=>e.length>0).map(({groupName:e,normalizedKeys:t})=>({groupName:e,normalizedKeys:t,switches:t.reduce((t,n)=>(t[n]=[n].concat(h.alias[n]||[]).map(t=>e===r.getPositionalGroupName()?t:(/^[0-9]$/.test(t)?h.boolean.includes(n)?`-`:`--`:t.length>1?`--`:`-`)+t).sort((e,t)=>w(e)===w(t)?0:w(e)?1:-1).join(`, `),t),{})}));if(ie.filter(({groupName:e})=>e!==r.getPositionalGroupName()).some(({normalizedKeys:e,switches:t})=>!e.every(e=>w(t[e])))&&ie.filter(({groupName:e})=>e!==r.getPositionalGroupName()).forEach(({normalizedKeys:e,switches:t})=>{e.forEach(e=>{w(t[e])&&(t[e]=it(t[e],4))})}),ie.forEach(({groupName:t,normalizedKeys:i,switches:o})=>{x.div(t),i.forEach(t=>{let i=o[t],c=p[t]||``,l=null;c.includes(ee)&&(c=n(c.substring(16))),h.boolean.includes(t)&&(l=`[${n(`boolean`)}]`),h.count.includes(t)&&(l=`[${n(`count`)}]`),h.string.includes(t)&&(l=`[${n(`string`)}]`),h.normalize.includes(t)&&(l=`[${n(`string`)}]`),h.array.includes(t)&&(l=`[${n(`array`)}]`),h.number.includes(t)&&(l=`[${n(`number`)}]`);let u=[t in s?(e=>typeof e==`string`?`[${n(`deprecated: %s`,e)}]`:`[${n(`deprecated`)}]`)(s[t]):null,l,t in a?`[${n(`required`)}]`:null,h.choices&&h.choices[t]?`[${n(`choices:`)} ${r.stringifiedValues(h.choices[t])}]`:null,re(h.default[t],h.defaultDescription[t])].filter(Boolean).join(` `);x.span({text:ot(i),padding:[0,2,0,2+at(i)],width:_(o,b)+4},c);let d=e.getInternalMethods().getUsageConfiguration()[`hide-types`]===!0;u&&!d?x.div({text:u,padding:[0,0,0,2],align:`right`}):x.div()}),x.div()}),d.length&&(x.div(n(`Examples:`)),d.forEach(e=>{e[0]=e[0].replace(/\$0/g,i)}),d.forEach(e=>{e[1]===``?x.div({text:e[0],padding:[0,2,0,2]}):x.div({text:e[0],padding:[0,2,0,2],width:_(d,b)+4},{text:e[1]})}),x.div()),m.length>0){let e=m.map(e=>e.replace(/\$0/g,i)).join(`
|
|
46
|
+
`);x.div(`${e}\n`)}return x.toString().replace(/\s*$/,``)};function _(e,n,r){let i=0;return Array.isArray(e)||(e=Object.values(e).map(e=>[e])),e.forEach(e=>{i=Math.max(t.stringWidth(r?`${r} ${ot(e[0])}`:ot(e[0]))+at(e[0]),i)}),n&&(i=Math.min(i,parseInt((n*.5).toString(),10))),i}function te(){let t=e.getDemandedOptions(),n=e.getOptions();(Object.keys(n.alias)||[]).forEach(i=>{n.alias[i].forEach(a=>{p[a]&&r.describe(i,p[a]),a in t&&e.demandOption(i,t[a]),n.boolean.includes(a)&&e.boolean(i),n.count.includes(a)&&e.count(i),n.string.includes(a)&&e.string(i),n.normalize.includes(a)&&e.normalize(i),n.array.includes(a)&&e.array(i),n.number.includes(a)&&e.number(i)})})}let v;r.cacheHelpMessage=function(){v=this.help()},r.clearCachedHelpMessage=function(){v=void 0},r.hasCachedHelpMessage=function(){return!!v};function y(e,t,n,r){let i=[],a=null;return Object.keys(n).forEach(e=>{i=i.concat(n[e])}),e.forEach(e=>{a=[e].concat(t[e]),a.some(e=>i.indexOf(e)!==-1)||n[r].push(e)}),i}function ne(t){return e.getOptions().hiddenOptions.indexOf(t)<0||e.parsed.argv[e.getOptions().showHiddenOpt]}r.showHelp=t=>{let n=e.getInternalMethods().getLoggerInstance();t||=`error`,(typeof t==`function`?t:n[t])(r.help())},r.functionDescription=e=>[`(`,e.name?t.Parser.decamelize(e.name,`-`):n(`generated-value`),`)`].join(``),r.stringifiedValues=function(e,t){let n=``,r=t||`, `,i=[].concat(e);return!e||!i.length||i.forEach(e=>{n.length&&(n+=r),n+=JSON.stringify(e)}),n};function re(e,t){let r=`[${n(`default:`)} `;if(e===void 0&&!t)return null;if(t)r+=t;else switch(typeof e){case`string`:r+=`"${e}"`;break;case`object`:r+=JSON.stringify(e);break;default:r+=e}return`${r}]`}function b(){return t.process.stdColumns?Math.min(80,t.process.stdColumns):80}let x=null;r.version=e=>{x=e},r.showVersion=t=>{let n=e.getInternalMethods().getLoggerInstance();t||=`error`,(typeof t==`function`?t:n[t])(x)},r.reset=function(e){return a=null,c=!1,l=[],u=!1,m=[],d=[],f=[],p=$e(p,t=>!e[t]),r};let S=[];return r.freeze=function(){S.push({failMessage:a,failureOutput:c,usages:l,usageDisabled:u,epilogs:m,examples:d,commands:f,descriptions:p})},r.unfreeze=function(e=!1){let t=S.pop();t&&(e?(p={...t.descriptions,...p},f=[...t.commands,...f],l=[...t.usages,...l],d=[...t.examples,...d],m=[...t.epilogs,...m]):{failMessage:a,failureOutput:c,usages:l,usageDisabled:u,epilogs:m,examples:d,commands:f,descriptions:p}=t)},r}function rt(e){return typeof e==`object`}function it(e,t){return rt(e)?{text:e.text,indentation:e.indentation+t}:{text:e,indentation:t}}function at(e){return rt(e)?e.indentation:0}function ot(e){return rt(e)?e.text:e}var st=class{constructor(e,t,n,r){this.yargs=e,this.usage=t,this.command=n,this.shim=r,this.completionKey=`get-yargs-completions`,this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(this.shim.getEnv(`SHELL`)?.includes(`zsh`)||this.shim.getEnv(`ZSH_NAME`)?.includes(`zsh`))??!1}defaultCompletion(e,t,n,r){let i=this.command.getCommandHandlers();for(let t=0,n=e.length;t<n;++t)if(i[e[t]]&&i[e[t]].builder){let n=i[e[t]].builder;if(Xe(n)){this.indexAfterLastReset=t+1;let e=this.yargs.getInternalMethods().reset();return n(e,!0),e.argv}}let a=[];this.commandCompletions(a,e,n),this.optionCompletions(a,e,t,n),this.choicesFromOptionsCompletions(a,e,t,n),this.choicesFromPositionalsCompletions(a,e,t,n),r(null,a)}commandCompletions(e,t,n){let r=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&r[r.length-1]!==n&&!this.previousArgHasChoices(t)&&this.usage.getCommands().forEach(n=>{let r=Fe(n[0]).cmd;if(t.indexOf(r)===-1){if(!this.zshShell)e.push(r);else{let t=n[1]||``;e.push(r.replace(/:/g,`\\:`)+`:`+t)}}})}optionCompletions(e,t,n,r){if((r.match(/^-/)||r===``&&e.length===0)&&!this.previousArgHasChoices(t)){let n=this.yargs.getOptions(),i=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(n.key).forEach(a=>{let o=!!n.configuration[`boolean-negation`]&&n.boolean.includes(a);i.includes(a)||n.hiddenOptions.includes(a)||this.argsContainKey(t,a,o)||(this.completeOptionKey(a,e,r),o&&n.default[a]&&this.completeOptionKey(`no-${a}`,e,r))})}}choicesFromOptionsCompletions(e,t,n,r){if(this.previousArgHasChoices(t)){let n=this.getPreviousArgChoices(t);n&&n.length>0&&e.push(...n.map(e=>e.replace(/:/g,`\\:`)))}}choicesFromPositionalsCompletions(e,t,n,r){if(r===``&&e.length>0&&this.previousArgHasChoices(t))return;let i=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],a=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),o=i[n._.length-a-1];if(!o)return;let s=this.yargs.getOptions().choices[o]||[];for(let t of s)t.startsWith(r)&&e.push(t.replace(/:/g,`\\:`))}getPreviousArgChoices(e){if(e.length<1)return;let t=e[e.length-1],n=``;if(!t.startsWith(`-`)&&e.length>1&&(n=t,t=e[e.length-2]),!t.startsWith(`-`))return;let r=t.replace(/^-+/,``),i=this.yargs.getOptions(),a=[r,...this.yargs.getAliases()[r]||[]],o;for(let e of a)if(Object.prototype.hasOwnProperty.call(i.key,e)&&Array.isArray(i.choices[e])){o=i.choices[e];break}if(o)return o.filter(e=>!n||e.startsWith(n))}previousArgHasChoices(e){let t=this.getPreviousArgChoices(e);return t!==void 0&&t.length>0}argsContainKey(e,t,n){let r=t=>e.indexOf((/^[^0-9]$/.test(t)?`-`:`--`)+t)!==-1;if(r(t)||n&&r(`no-${t}`))return!0;if(this.aliases){for(let e of this.aliases[t])if(r(e))return!0}return!1}completeOptionKey(e,t,n){let r=this.usage.getDescriptions(),i=!(e=>/^--/.test(e))(n)&&(e=>/^[^0-9]$/.test(e))(e)?`-`:`--`;if(!this.zshShell)t.push(i+e);else{let n=(this===null||this===void 0?void 0:this.aliases)?.[e].find(e=>{let t=r[e];return typeof t==`string`&&t.length>0}),a=n?r[n]:void 0,o=r[e]??a??``;t.push(i+`${e.replace(/:/g,`\\:`)}:${o.replace(`__yargsString__:`,``).replace(/(\r\n|\n|\r)/gm,` `)}`)}}customCompletion(e,t,n,r){if(M(this.customCompletionFunction,null,this.shim),lt(this.customCompletionFunction)){let e=this.customCompletionFunction(n,t);return N(e)?e.then(e=>{this.shim.process.nextTick(()=>{r(null,e)})}).catch(e=>{this.shim.process.nextTick(()=>{r(e,void 0)})}):r(null,e)}return ut(this.customCompletionFunction)?this.customCompletionFunction(n,t,(i=r)=>this.defaultCompletion(e,t,n,i),e=>{r(null,e)}):this.customCompletionFunction(n,t,e=>{r(null,e)})}getCompletion(e,t){let n=e.length?e[e.length-1]:``,r=this.yargs.parse(e,!0),i=this.customCompletionFunction?r=>this.customCompletion(e,r,n,t):r=>this.defaultCompletion(e,r,n,t);return N(r)?r.then(i):i(r)}generateCompletionScript(e,t){let n=this.zshShell?`#compdef {{app_name}}
|
|
47
|
+
###-begin-{{app_name}}-completions-###
|
|
48
|
+
#
|
|
49
|
+
# yargs command completion script
|
|
50
|
+
#
|
|
51
|
+
# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
|
|
52
|
+
# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.
|
|
53
|
+
#
|
|
54
|
+
_{{app_name}}_yargs_completions()
|
|
55
|
+
{
|
|
56
|
+
local reply
|
|
57
|
+
local si=$IFS
|
|
58
|
+
IFS=$'
|
|
59
|
+
' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
|
|
60
|
+
IFS=$si
|
|
61
|
+
_describe 'values' reply
|
|
62
|
+
}
|
|
63
|
+
compdef _{{app_name}}_yargs_completions {{app_name}}
|
|
64
|
+
###-end-{{app_name}}-completions-###
|
|
65
|
+
`:`###-begin-{{app_name}}-completions-###
|
|
66
|
+
#
|
|
67
|
+
# yargs command completion script
|
|
68
|
+
#
|
|
69
|
+
# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
|
|
70
|
+
# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
|
|
71
|
+
#
|
|
72
|
+
_{{app_name}}_yargs_completions()
|
|
73
|
+
{
|
|
74
|
+
local cur_word args type_list
|
|
75
|
+
|
|
76
|
+
cur_word="\${COMP_WORDS[COMP_CWORD]}"
|
|
77
|
+
args=("\${COMP_WORDS[@]}")
|
|
78
|
+
|
|
79
|
+
# ask yargs to generate completions.
|
|
80
|
+
type_list=$({{app_path}} --get-yargs-completions "\${args[@]}")
|
|
81
|
+
|
|
82
|
+
COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) )
|
|
83
|
+
|
|
84
|
+
# if no match was found, fall back to filename completion
|
|
85
|
+
if [ \${#COMPREPLY[@]} -eq 0 ]; then
|
|
86
|
+
COMPREPLY=()
|
|
87
|
+
fi
|
|
88
|
+
|
|
89
|
+
return 0
|
|
90
|
+
}
|
|
91
|
+
complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
|
|
92
|
+
###-end-{{app_name}}-completions-###
|
|
93
|
+
`,r=this.shim.path.basename(e);return e.match(/\.js$/)&&(e=`./${e}`),n=n.replace(/{{app_name}}/g,r),n=n.replace(/{{completion_command}}/g,t),n.replace(/{{app_path}}/g,e)}registerFunction(e){this.customCompletionFunction=e}setParsed(e){this.aliases=e.aliases}};function ct(e,t,n,r){return new st(e,t,n,r)}function lt(e){return e.length<3}function ut(e){return e.length>3}function dt(e,t){if(e.length===0)return t.length;if(t.length===0)return e.length;let n=[],r=0;for(;r<=t.length;r++)n[r]=[r];let i=0;for(;i<=e.length;i++)n[0][i]=i;for(r=1;r<=t.length;r++)for(i=1;i<=e.length;i++)t.charAt(r-1)===e.charAt(i-1)?n[r][i]=n[r-1][i-1]:r>1&&i>1&&t.charAt(r-2)===e.charAt(i-1)&&t.charAt(r-1)===e.charAt(i-2)?n[r][i]=n[r-2][i-2]+1:n[r][i]=Math.min(n[r-1][i-1]+1,Math.min(n[r][i-1]+1,n[r-1][i]+1));return n[t.length][e.length]}const ft=[`$0`,`--`,`_`];function pt(e,t,n){let r=n.y18n.__,i=n.y18n.__n,a={};a.nonOptionCount=function(n){let r=e.getDemandedCommands(),a=n._.length+(n[`--`]?n[`--`].length:0)-e.getInternalMethods().getContext().commands.length;r._&&(a<r._.min||a>r._.max)&&(a<r._.min?r._.minMsg===void 0?t.fail(i(`Not enough non-option arguments: got %s, need at least %s`,`Not enough non-option arguments: got %s, need at least %s`,a,a.toString(),r._.min.toString())):t.fail(r._.minMsg?r._.minMsg.replace(/\$0/g,a.toString()).replace(/\$1/,r._.min.toString()):null):a>r._.max&&(r._.maxMsg===void 0?t.fail(i(`Too many non-option arguments: got %s, maximum of %s`,`Too many non-option arguments: got %s, maximum of %s`,a,a.toString(),r._.max.toString())):t.fail(r._.maxMsg?r._.maxMsg.replace(/\$0/g,a.toString()).replace(/\$1/,r._.max.toString()):null)))},a.positionalCount=function(e,n){n<e&&t.fail(i(`Not enough non-option arguments: got %s, need at least %s`,`Not enough non-option arguments: got %s, need at least %s`,n,n+``,e+``))},a.requiredArguments=function(e,n){let r=null;for(let t of Object.keys(n))Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0||(r||={},r[t]=n[t]);if(r){let e=[];for(let t of Object.keys(r)){let n=r[t];n&&e.indexOf(n)<0&&e.push(n)}let n=e.length?`\n${e.join(`
|
|
94
|
+
`)}`:``;t.fail(i(`Missing required argument: %s`,`Missing required arguments: %s`,Object.keys(r).length,Object.keys(r).join(`, `)+n))}},a.unknownArguments=function(n,r,o,s,c=!0){let l=e.getInternalMethods().getCommandInstance().getCommands(),u=[],d=e.getInternalMethods().getContext();if(Object.keys(n).forEach(t=>{ft.includes(t)||Object.prototype.hasOwnProperty.call(o,t)||Object.prototype.hasOwnProperty.call(e.getInternalMethods().getParseContext(),t)||a.isValidAndSomeAliasIsNotNew(t,r)||u.push(t)}),c&&(d.commands.length>0||l.length>0||s)&&n._.slice(d.commands.length).forEach(e=>{l.includes(``+e)||u.push(``+e)}),c){let t=e.getDemandedCommands()._?.max||0,r=d.commands.length+t;r<n._.length&&n._.slice(r).forEach(e=>{e=String(e),!d.commands.includes(e)&&!u.includes(e)&&u.push(e)})}u.length&&t.fail(i(`Unknown argument: %s`,`Unknown arguments: %s`,u.length,u.map(e=>e.trim()?e:`"${e}"`).join(`, `)))},a.unknownCommands=function(n){let r=e.getInternalMethods().getCommandInstance().getCommands(),a=[],o=e.getInternalMethods().getContext();return(o.commands.length>0||r.length>0)&&n._.slice(o.commands.length).forEach(e=>{r.includes(``+e)||a.push(``+e)}),a.length>0&&(t.fail(i(`Unknown command: %s`,`Unknown commands: %s`,a.length,a.join(`, `))),!0)},a.isValidAndSomeAliasIsNotNew=function(t,n){if(!Object.prototype.hasOwnProperty.call(n,t))return!1;let r=e.parsed.newAliases;return[t,...n[t]].some(e=>!Object.prototype.hasOwnProperty.call(r,e)||!r[t])},a.limitedChoices=function(n){let i=e.getOptions(),a={};if(!Object.keys(i.choices).length)return;Object.keys(n).forEach(e=>{ft.indexOf(e)===-1&&Object.prototype.hasOwnProperty.call(i.choices,e)&&[].concat(n[e]).forEach(t=>{i.choices[e].indexOf(t)===-1&&t!==void 0&&(a[e]=(a[e]||[]).concat(t))})});let o=Object.keys(a);if(!o.length)return;let s=r(`Invalid values:`);o.forEach(e=>{s+=`\n ${r(`Argument: %s, Given: %s, Choices: %s`,e,t.stringifiedValues(a[e]),t.stringifiedValues(i.choices[e]))}`}),t.fail(s)};let o={};a.implies=function(t,r){P(`<string|object> [array|number|string]`,[t,r],arguments.length),typeof t==`object`?Object.keys(t).forEach(e=>{a.implies(e,t[e])}):(e.global(t),o[t]||(o[t]=[]),Array.isArray(r)?r.forEach(e=>a.implies(t,e)):(M(r,void 0,n),o[t].push(r)))},a.getImplied=function(){return o};function s(e,t){let n=Number(t);return t=isNaN(n)?t:n,typeof t==`number`?t=e._.length>=t:t.match(/^--no-.+/)?(t=t.match(/^--no-(.+)/)[1],t=!Object.prototype.hasOwnProperty.call(e,t)):t=Object.prototype.hasOwnProperty.call(e,t),t}a.implications=function(e){let n=[];if(Object.keys(o).forEach(t=>{let r=t;(o[t]||[]).forEach(t=>{let i=r,a=t;i=s(e,i),t=s(e,t),i&&!t&&n.push(` ${r} -> ${a}`)})}),n.length){let e=`${r(`Implications failed:`)}\n`;n.forEach(t=>{e+=t}),t.fail(e)}};let c={};a.conflicts=function(t,n){P(`<string|object> [array|string]`,[t,n],arguments.length),typeof t==`object`?Object.keys(t).forEach(e=>{a.conflicts(e,t[e])}):(e.global(t),c[t]||(c[t]=[]),Array.isArray(n)?n.forEach(e=>a.conflicts(t,e)):c[t].push(n))},a.getConflicting=()=>c,a.conflicting=function(i){Object.keys(i).forEach(e=>{c[e]&&c[e].forEach(n=>{n&&i[e]!==void 0&&i[n]!==void 0&&t.fail(r(`Arguments %s and %s are mutually exclusive`,e,n))})}),e.getInternalMethods().getParserConfiguration()[`strip-dashed`]&&Object.keys(c).forEach(e=>{c[e].forEach(a=>{a&&i[n.Parser.camelCase(e)]!==void 0&&i[n.Parser.camelCase(a)]!==void 0&&t.fail(r(`Arguments %s and %s are mutually exclusive`,e,a))})})},a.recommendCommands=function(e,n){n=n.sort((e,t)=>t.length-e.length);let i=null,a=1/0;for(let t=0,r;(r=n[t])!==void 0;t++){let t=dt(e,r);t<=3&&t<a&&(a=t,i=r)}i&&t.fail(r(`Did you mean %s?`,i))},a.reset=function(e){return o=$e(o,t=>!e[t]),c=$e(c,t=>!e[t]),a};let l=[];return a.freeze=function(){l.push({implied:o,conflicting:c})},a.unfreeze=function(){let e=l.pop();M(e,void 0,n),{implied:o,conflicting:c}=e},a}let mt=[],ht;function gt(t,n,r,i){ht=i;let a={};if(Object.prototype.hasOwnProperty.call(t,`extends`)){if(typeof t.extends!=`string`)return a;let i=/\.json|\..*rc$/.test(t.extends),o=null;if(i)o=vt(n,t.extends);else try{o=e.resolve(t.extends)}catch{return t}_t(o),mt.push(o),a=i?JSON.parse(ht.readFileSync(o,`utf8`)):e(t.extends),delete t.extends,a=gt(a,ht.path.dirname(o),r,ht)}return mt=[],r?yt(a,t):Object.assign({},a,t)}function _t(e){if(mt.indexOf(e)>-1)throw new j(`Circular extended configurations: '${e}'.`)}function vt(e,t){return ht.path.resolve(e,t)}function yt(e,t){let n={};function r(e){return e&&typeof e==`object`&&!Array.isArray(e)}Object.assign(n,e);for(let i of Object.keys(t))n[i]=r(t[i])&&r(n[i])?yt(e[i],t[i]):t[i];return n}var F=function(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n},I=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},L,bt,xt,R,z,St,B,Ct,wt,V,Tt,H,U,W,G,Et,Dt,K,q,Ot,kt,J,At,jt,Mt,Y,Nt,X,Pt,Ft,It,Z,Lt,Q,$;function Rt(e){return(t=[],n=e.process.cwd(),r)=>{let i=new Sn(t,n,r,e);return Object.defineProperty(i,"argv",{get:()=>i.parse(),enumerable:!0}),i.help(),i.version(),i}}const zt=Symbol(`copyDoubleDash`),Bt=Symbol(`copyDoubleDash`),Vt=Symbol(`deleteFromParserHintObject`),Ht=Symbol(`emitWarning`),Ut=Symbol(`freeze`),Wt=Symbol(`getDollarZero`),Gt=Symbol(`getParserConfiguration`),Kt=Symbol(`getUsageConfiguration`),qt=Symbol(`guessLocale`),Jt=Symbol(`guessVersion`),Yt=Symbol(`parsePositionalNumbers`),Xt=Symbol(`pkgUp`),Zt=Symbol(`populateParserHintArray`),Qt=Symbol(`populateParserHintSingleValueDictionary`),$t=Symbol(`populateParserHintArrayDictionary`),en=Symbol(`populateParserHintDictionary`),tn=Symbol(`sanitizeKey`),nn=Symbol(`setKey`),rn=Symbol(`unfreeze`),an=Symbol(`validateAsync`),on=Symbol(`getCommandInstance`),sn=Symbol(`getContext`),cn=Symbol(`getHasOutput`),ln=Symbol(`getLoggerInstance`),un=Symbol(`getParseContext`),dn=Symbol(`getUsageInstance`),fn=Symbol(`getValidationInstance`),pn=Symbol(`hasParseCallback`),mn=Symbol(`isGlobalContext`),hn=Symbol(`postProcess`),gn=Symbol(`rebase`),_n=Symbol(`reset`),vn=Symbol(`runYargsParserAndExecuteCommands`),yn=Symbol(`runValidation`),bn=Symbol(`setHasOutput`),xn=Symbol(`kTrackManuallySetKeys`);var Sn=class{constructor(e=[],t,n,r){this.customScriptName=!1,this.parsed=!1,L.set(this,void 0),bt.set(this,void 0),xt.set(this,{commands:[],fullCommands:[]}),R.set(this,null),z.set(this,null),St.set(this,`show-hidden`),B.set(this,null),Ct.set(this,!0),wt.set(this,{}),V.set(this,!0),Tt.set(this,[]),H.set(this,void 0),U.set(this,{}),W.set(this,!1),G.set(this,null),Et.set(this,!0),Dt.set(this,void 0),K.set(this,``),q.set(this,void 0),Ot.set(this,void 0),kt.set(this,{}),J.set(this,null),At.set(this,null),jt.set(this,{}),Mt.set(this,{}),Y.set(this,void 0),Nt.set(this,!1),X.set(this,void 0),Pt.set(this,!1),Ft.set(this,!1),It.set(this,!1),Z.set(this,void 0),Lt.set(this,{}),Q.set(this,null),$.set(this,void 0),F(this,X,r,`f`),F(this,Y,e,`f`),F(this,bt,t,`f`),F(this,Ot,n,`f`),F(this,H,new ze(this),`f`),this.$0=this[Wt](),this[_n](),F(this,L,I(this,L,`f`),`f`),F(this,Z,I(this,Z,`f`),`f`),F(this,$,I(this,$,`f`),`f`),F(this,q,I(this,q,`f`),`f`),I(this,q,`f`).showHiddenOpt=I(this,St,`f`),F(this,Dt,this[Bt](),`f`)}addHelpOpt(e,t){return P(`[string|boolean] [string]`,[e,t],arguments.length),I(this,G,`f`)&&(this[Vt](I(this,G,`f`)),F(this,G,null,`f`)),e===!1&&t===void 0||(F(this,G,typeof e==`string`?e:`help`,`f`),this.boolean(I(this,G,`f`)),this.describe(I(this,G,`f`),t||I(this,Z,`f`).deferY18nLookup(`Show help`))),this}help(e,t){return this.addHelpOpt(e,t)}addShowHiddenOpt(e,t){if(P(`[string|boolean] [string]`,[e,t],arguments.length),e===!1&&t===void 0)return this;let n=typeof e==`string`?e:I(this,St,`f`);return this.boolean(n),this.describe(n,t||I(this,Z,`f`).deferY18nLookup(`Show hidden options`)),I(this,q,`f`).showHiddenOpt=n,this}showHidden(e,t){return this.addShowHiddenOpt(e,t)}alias(e,t){return P(`<object|string|array> [string|array]`,[e,t],arguments.length),this[$t](this.alias.bind(this),`alias`,e,t),this}array(e){return P(`<array|string>`,[e],arguments.length),this[Zt](`array`,e),this[xn](e),this}boolean(e){return P(`<array|string>`,[e],arguments.length),this[Zt](`boolean`,e),this[xn](e),this}check(e,t){return P(`<function> [boolean]`,[e,t],arguments.length),this.middleware((t,n)=>He(()=>e(t,n.getOptions()),n=>(n?(typeof n==`string`||n instanceof Error)&&I(this,Z,`f`).fail(n.toString(),n):I(this,Z,`f`).fail(I(this,X,`f`).y18n.__(`Argument check failed: %s`,e.toString())),t),e=>(I(this,Z,`f`).fail(e.message?e.message:e.toString(),e),t)),!1,t),this}choices(e,t){return P(`<object|string|array> [string|array]`,[e,t],arguments.length),this[$t](this.choices.bind(this),`choices`,e,t),this}coerce(e,t){if(P(`<object|string|array> [function]`,[e,t],arguments.length),Array.isArray(e)){if(!t)throw new j(`coerce callback must be provided`);for(let n of e)this.coerce(n,t);return this}if(typeof e==`object`){for(let t of Object.keys(e))this.coerce(t,e[t]);return this}if(!t)throw new j(`coerce callback must be provided`);return I(this,q,`f`).key[e]=!0,I(this,H,`f`).addCoerceMiddleware((n,r)=>{let i;return Object.prototype.hasOwnProperty.call(n,e)?He(()=>(i=r.getAliases(),t(n[e])),t=>{n[e]=t;let a=r.getInternalMethods().getParserConfiguration()[`strip-aliased`];if(i[e]&&a!==!0)for(let r of i[e])n[r]=t;return n},e=>{throw new j(e.message)}):n},e),this}conflicts(e,t){return P(`<string|object> [string|array]`,[e,t],arguments.length),I(this,$,`f`).conflicts(e,t),this}config(e=`config`,t,n){return P(`[object|string] [string|function] [function]`,[e,t,n],arguments.length),typeof e==`object`&&!Array.isArray(e)?(e=gt(e,I(this,bt,`f`),this[Gt]()[`deep-merge-config`]||!1,I(this,X,`f`)),I(this,q,`f`).configObjects=(I(this,q,`f`).configObjects||[]).concat(e),this):(typeof t==`function`&&(n=t,t=void 0),this.describe(e,t||I(this,Z,`f`).deferY18nLookup(`Path to JSON config file`)),(Array.isArray(e)?e:[e]).forEach(e=>{I(this,q,`f`).config[e]=n||!0}),this)}completion(e,t,n){return P(`[string] [string|boolean|function] [function]`,[e,t,n],arguments.length),typeof t==`function`&&(n=t,t=void 0),F(this,z,e||I(this,z,`f`)||`completion`,`f`),!t&&t!==!1&&(t=`generate completion script`),this.command(I(this,z,`f`),t),n&&I(this,R,`f`).registerFunction(n),this}command(e,t,n,r,i,a){return P(`<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]`,[e,t,n,r,i,a],arguments.length),I(this,L,`f`).addHandler(e,t,n,r,i,a),this}commands(e,t,n,r,i,a){return this.command(e,t,n,r,i,a)}commandDir(e,t){P(`<string> [object]`,[e,t],arguments.length);let n=I(this,Ot,`f`)||I(this,X,`f`).require;return I(this,L,`f`).addDirectory(e,n,I(this,X,`f`).getCallerFile(),t),this}count(e){return P(`<array|string>`,[e],arguments.length),this[Zt](`count`,e),this[xn](e),this}default(e,t,n){return P(`<object|string|array> [*] [string]`,[e,t,n],arguments.length),n&&(Ne(e,I(this,X,`f`)),I(this,q,`f`).defaultDescription[e]=n),typeof t==`function`&&(Ne(e,I(this,X,`f`)),I(this,q,`f`).defaultDescription[e]||(I(this,q,`f`).defaultDescription[e]=I(this,Z,`f`).functionDescription(t)),t=t.call()),this[Qt](this.default.bind(this),`default`,e,t),this}defaults(e,t,n){return this.default(e,t,n)}demandCommand(e=1,t,n,r){return P(`[number] [number|string] [string|null|undefined] [string|null|undefined]`,[e,t,n,r],arguments.length),typeof t!=`number`&&(n=t,t=1/0),this.global(`_`,!1),I(this,q,`f`).demandedCommands._={min:e,max:t,minMsg:n,maxMsg:r},this}demand(e,t,n){return Array.isArray(t)?(t.forEach(e=>{M(n,!0,I(this,X,`f`)),this.demandOption(e,n)}),t=1/0):typeof t!=`number`&&(n=t,t=1/0),typeof e==`number`?(M(n,!0,I(this,X,`f`)),this.demandCommand(e,t,n,n)):Array.isArray(e)?e.forEach(e=>{M(n,!0,I(this,X,`f`)),this.demandOption(e,n)}):typeof n==`string`?this.demandOption(e,n):(n===!0||n===void 0)&&this.demandOption(e),this}demandOption(e,t){return P(`<object|string|array> [string]`,[e,t],arguments.length),this[Qt](this.demandOption.bind(this),`demandedOptions`,e,t),this}deprecateOption(e,t){return P(`<string> [string|boolean]`,[e,t],arguments.length),I(this,q,`f`).deprecatedOptions[e]=t,this}describe(e,t){return P(`<object|string|array> [string]`,[e,t],arguments.length),this[nn](e,!0),I(this,Z,`f`).describe(e,t),this}detectLocale(e){return P(`<boolean>`,[e],arguments.length),F(this,Ct,e,`f`),this}env(e){return P(`[string|boolean]`,[e],arguments.length),e===!1?delete I(this,q,`f`).envPrefix:I(this,q,`f`).envPrefix=e||``,this}epilogue(e){return P(`<string>`,[e],arguments.length),I(this,Z,`f`).epilog(e),this}epilog(e){return this.epilogue(e)}example(e,t){return P(`<string|array> [string]`,[e,t],arguments.length),Array.isArray(e)?e.forEach(e=>this.example(...e)):I(this,Z,`f`).example(e,t),this}exit(e,t){F(this,W,!0,`f`),F(this,B,t,`f`),I(this,V,`f`)&&I(this,X,`f`).process.exit(e)}exitProcess(e=!0){return P(`[boolean]`,[e],arguments.length),F(this,V,e,`f`),this}fail(e){if(P(`<function|boolean>`,[e],arguments.length),typeof e==`boolean`&&e!==!1)throw new j(`Invalid first argument. Expected function or boolean 'false'`);return I(this,Z,`f`).failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,t){return P(`<array> [function]`,[e,t],arguments.length),t?I(this,R,`f`).getCompletion(e,t):new Promise((t,n)=>{I(this,R,`f`).getCompletion(e,(e,r)=>{e?n(e):t(r)})})}getDemandedOptions(){return P([],0),I(this,q,`f`).demandedOptions}getDemandedCommands(){return P([],0),I(this,q,`f`).demandedCommands}getDeprecatedOptions(){return P([],0),I(this,q,`f`).deprecatedOptions}getDetectLocale(){return I(this,Ct,`f`)}getExitProcess(){return I(this,V,`f`)}getGroups(){return Object.assign({},I(this,U,`f`),I(this,Mt,`f`))}getHelp(){if(F(this,W,!0,`f`),!I(this,Z,`f`).hasCachedHelpMessage()){if(!this.parsed){let e=this[vn](I(this,Y,`f`),void 0,void 0,0,!0);if(N(e))return e.then(()=>I(this,Z,`f`).help())}let e=I(this,L,`f`).runDefaultBuilderOn(this);if(N(e))return e.then(()=>I(this,Z,`f`).help())}return Promise.resolve(I(this,Z,`f`).help())}getOptions(){return I(this,q,`f`)}getStrict(){return I(this,Pt,`f`)}getStrictCommands(){return I(this,Ft,`f`)}getStrictOptions(){return I(this,It,`f`)}global(e,t){return P(`<string|array> [boolean]`,[e,t],arguments.length),e=[].concat(e),t===!1?e.forEach(e=>{I(this,q,`f`).local.includes(e)||I(this,q,`f`).local.push(e)}):I(this,q,`f`).local=I(this,q,`f`).local.filter(t=>e.indexOf(t)===-1),this}group(e,t){P(`<string|array> <string>`,[e,t],arguments.length);let n=I(this,Mt,`f`)[t]||I(this,U,`f`)[t];I(this,Mt,`f`)[t]&&delete I(this,Mt,`f`)[t];let r={};return I(this,U,`f`)[t]=(n||[]).concat(e).filter(e=>r[e]?!1:r[e]=!0),this}hide(e){return P(`<string>`,[e],arguments.length),I(this,q,`f`).hiddenOptions.push(e),this}implies(e,t){return P(`<string|object> [number|string|array]`,[e,t],arguments.length),I(this,$,`f`).implies(e,t),this}locale(e){return P(`[string]`,[e],arguments.length),e===void 0?(this[qt](),I(this,X,`f`).y18n.getLocale()):(F(this,Ct,!1,`f`),I(this,X,`f`).y18n.setLocale(e),this)}middleware(e,t,n){return I(this,H,`f`).addMiddleware(e,!!t,n)}nargs(e,t){return P(`<string|object|array> [number]`,[e,t],arguments.length),this[Qt](this.nargs.bind(this),`narg`,e,t),this}normalize(e){return P(`<array|string>`,[e],arguments.length),this[Zt](`normalize`,e),this}number(e){return P(`<array|string>`,[e],arguments.length),this[Zt](`number`,e),this[xn](e),this}option(e,t){if(P(`<string|object> [object]`,[e,t],arguments.length),typeof e==`object`)Object.keys(e).forEach(t=>{this.options(t,e[t])});else{typeof t!=`object`&&(t={}),this[xn](e),I(this,Q,`f`)&&(e===`version`||t?.alias===`version`)&&this[Ht](`"version" is a reserved word.
|
|
95
|
+
Please do one of the following:
|
|
96
|
+
- Disable version with \`yargs.version(false)\` if using "version" as an option
|
|
97
|
+
- Use the built-in \`yargs.version\` method instead (if applicable)
|
|
98
|
+
- Use a different option key
|
|
99
|
+
https://yargs.js.org/docs/#api-reference-version`,void 0,`versionWarning`),I(this,q,`f`).key[e]=!0,t.alias&&this.alias(e,t.alias);let n=t.deprecate||t.deprecated;n&&this.deprecateOption(e,n);let r=t.demand||t.required||t.require;r&&this.demand(e,r),t.demandOption&&this.demandOption(e,typeof t.demandOption==`string`?t.demandOption:void 0),t.conflicts&&this.conflicts(e,t.conflicts),`default`in t&&this.default(e,t.default),t.implies!==void 0&&this.implies(e,t.implies),t.nargs!==void 0&&this.nargs(e,t.nargs),t.config&&this.config(e,t.configParser),t.normalize&&this.normalize(e),t.choices&&this.choices(e,t.choices),t.coerce&&this.coerce(e,t.coerce),t.group&&this.group(e,t.group),(t.boolean||t.type===`boolean`)&&(this.boolean(e),t.alias&&this.boolean(t.alias)),(t.array||t.type===`array`)&&(this.array(e),t.alias&&this.array(t.alias)),(t.number||t.type===`number`)&&(this.number(e),t.alias&&this.number(t.alias)),(t.string||t.type===`string`)&&(this.string(e),t.alias&&this.string(t.alias)),(t.count||t.type===`count`)&&this.count(e),typeof t.global==`boolean`&&this.global(e,t.global),t.defaultDescription&&(I(this,q,`f`).defaultDescription[e]=t.defaultDescription),t.skipValidation&&this.skipValidation(e);let i=t.describe||t.description||t.desc,a=I(this,Z,`f`).getDescriptions();Object.prototype.hasOwnProperty.call(a,e)&&typeof i!=`string`||this.describe(e,i),t.hidden&&this.hide(e),t.requiresArg&&this.requiresArg(e)}return this}options(e,t){return this.option(e,t)}parse(e,t,n){P(`[string|array] [function|boolean|object] [function]`,[e,t,n],arguments.length),this[Ut](),e===void 0&&(e=I(this,Y,`f`)),typeof t==`object`&&(F(this,At,t,`f`),t=n),typeof t==`function`&&(F(this,J,t,`f`),t=!1),t||F(this,Y,e,`f`),I(this,J,`f`)&&F(this,V,!1,`f`);let r=this[vn](e,!!t),i=this.parsed;return I(this,R,`f`).setParsed(this.parsed),N(r)?r.then(e=>(I(this,J,`f`)&&I(this,J,`f`).call(this,I(this,B,`f`),e,I(this,K,`f`)),e)).catch(e=>{throw I(this,J,`f`)&&I(this,J,`f`)(e,this.parsed.argv,I(this,K,`f`)),e}).finally(()=>{this[rn](),this.parsed=i}):(I(this,J,`f`)&&I(this,J,`f`).call(this,I(this,B,`f`),r,I(this,K,`f`)),this[rn](),this.parsed=i,r)}parseAsync(e,t,n){let r=this.parse(e,t,n);return N(r)?r:Promise.resolve(r)}parseSync(e,t,n){let r=this.parse(e,t,n);if(N(r))throw new j(`.parseSync() must not be used with asynchronous builders, handlers, or middleware`);return r}parserConfiguration(e){return P(`<object>`,[e],arguments.length),F(this,kt,e,`f`),this}pkgConf(e,t){P(`<string> [string]`,[e,t],arguments.length);let n=null,r=this[Xt](t||I(this,bt,`f`));return r[e]&&typeof r[e]==`object`&&(n=gt(r[e],t||I(this,bt,`f`),this[Gt]()[`deep-merge-config`]||!1,I(this,X,`f`)),I(this,q,`f`).configObjects=(I(this,q,`f`).configObjects||[]).concat(n)),this}positional(e,t){P(`<string> <object>`,[e,t],arguments.length);let n=[`default`,`defaultDescription`,`implies`,`normalize`,`choices`,`conflicts`,`coerce`,`type`,`describe`,`desc`,`description`,`alias`];t=$e(t,(e,t)=>e===`type`&&![`string`,`number`,`boolean`].includes(t)?!1:n.includes(e));let r=I(this,xt,`f`).fullCommands[I(this,xt,`f`).fullCommands.length-1],i=r?I(this,L,`f`).cmdToParseOptions(r):{array:[],alias:{},default:{},demand:{}};return Pe(i).forEach(n=>{let r=i[n];Array.isArray(r)?r.indexOf(e)!==-1&&(t[n]=!0):r[e]&&!(n in t)&&(t[n]=r[e])}),this.group(e,I(this,Z,`f`).getPositionalGroupName()),this.option(e,t)}recommendCommands(e=!0){return P(`[boolean]`,[e],arguments.length),F(this,Nt,e,`f`),this}required(e,t,n){return this.demand(e,t,n)}require(e,t,n){return this.demand(e,t,n)}requiresArg(e){return P(`<array|string|object> [number]`,[e],arguments.length),typeof e==`string`&&I(this,q,`f`).narg[e]||this[Qt](this.requiresArg.bind(this),`narg`,e,NaN),this}showCompletionScript(e,t){return P(`[string] [string]`,[e,t],arguments.length),e||=this.$0,I(this,Dt,`f`).log(I(this,R,`f`).generateCompletionScript(e,t||I(this,z,`f`)||`completion`)),this}showHelp(e){if(P(`[string|function]`,[e],arguments.length),F(this,W,!0,`f`),!I(this,Z,`f`).hasCachedHelpMessage()){if(!this.parsed){let t=this[vn](I(this,Y,`f`),void 0,void 0,0,!0);if(N(t))return t.then(()=>{I(this,Z,`f`).showHelp(e)}),this}let t=I(this,L,`f`).runDefaultBuilderOn(this);if(N(t))return t.then(()=>{I(this,Z,`f`).showHelp(e)}),this}return I(this,Z,`f`).showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,t){return P(`[boolean|string] [string]`,[e,t],arguments.length),I(this,Z,`f`).showHelpOnFail(e,t),this}showVersion(e){return P(`[string|function]`,[e],arguments.length),I(this,Z,`f`).showVersion(e),this}skipValidation(e){return P(`<array|string>`,[e],arguments.length),this[Zt](`skipValidation`,e),this}strict(e){return P(`[boolean]`,[e],arguments.length),F(this,Pt,e!==!1,`f`),this}strictCommands(e){return P(`[boolean]`,[e],arguments.length),F(this,Ft,e!==!1,`f`),this}strictOptions(e){return P(`[boolean]`,[e],arguments.length),F(this,It,e!==!1,`f`),this}string(e){return P(`<array|string>`,[e],arguments.length),this[Zt](`string`,e),this[xn](e),this}terminalWidth(){return P([],0),I(this,X,`f`).process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return P(`<object>`,[e],arguments.length),F(this,Ct,!1,`f`),I(this,X,`f`).y18n.updateLocale(e),this}usage(e,t,n,r){if(P(`<string|null|undefined> [string|boolean] [function|object] [function]`,[e,t,n,r],arguments.length),t!==void 0){if(M(e,null,I(this,X,`f`)),(e||``).match(/^\$0( |$)/))return this.command(e,t,n,r);throw new j(`.usage() description must start with $0 if being used as alias for .command()`)}return I(this,Z,`f`).usage(e),this}usageConfiguration(e){return P(`<object>`,[e],arguments.length),F(this,Lt,e,`f`),this}version(e,t,n){let r=`version`;if(P(`[boolean|string] [string] [string]`,[e,t,n],arguments.length),I(this,Q,`f`)&&(this[Vt](I(this,Q,`f`)),I(this,Z,`f`).version(void 0),F(this,Q,null,`f`)),arguments.length===0)n=this[Jt](),e=r;else if(arguments.length===1){if(e===!1)return this;n=e,e=r}else arguments.length===2&&(n=t,t=void 0);return F(this,Q,typeof e==`string`?e:r,`f`),t||=I(this,Z,`f`).deferY18nLookup(`Show version number`),I(this,Z,`f`).version(n||void 0),this.boolean(I(this,Q,`f`)),this.describe(I(this,Q,`f`),t),this}wrap(e){return P(`<number|null|undefined>`,[e],arguments.length),I(this,Z,`f`).wrap(e),this}[(L=/* @__PURE__ */ new WeakMap,bt=/* @__PURE__ */ new WeakMap,xt=/* @__PURE__ */ new WeakMap,R=/* @__PURE__ */ new WeakMap,z=/* @__PURE__ */ new WeakMap,St=/* @__PURE__ */ new WeakMap,B=/* @__PURE__ */ new WeakMap,Ct=/* @__PURE__ */ new WeakMap,wt=/* @__PURE__ */ new WeakMap,V=/* @__PURE__ */ new WeakMap,Tt=/* @__PURE__ */ new WeakMap,H=/* @__PURE__ */ new WeakMap,U=/* @__PURE__ */ new WeakMap,W=/* @__PURE__ */ new WeakMap,G=/* @__PURE__ */ new WeakMap,Et=/* @__PURE__ */ new WeakMap,Dt=/* @__PURE__ */ new WeakMap,K=/* @__PURE__ */ new WeakMap,q=/* @__PURE__ */ new WeakMap,Ot=/* @__PURE__ */ new WeakMap,kt=/* @__PURE__ */ new WeakMap,J=/* @__PURE__ */ new WeakMap,At=/* @__PURE__ */ new WeakMap,jt=/* @__PURE__ */ new WeakMap,Mt=/* @__PURE__ */ new WeakMap,Y=/* @__PURE__ */ new WeakMap,Nt=/* @__PURE__ */ new WeakMap,X=/* @__PURE__ */ new WeakMap,Pt=/* @__PURE__ */ new WeakMap,Ft=/* @__PURE__ */ new WeakMap,It=/* @__PURE__ */ new WeakMap,Z=/* @__PURE__ */ new WeakMap,Lt=/* @__PURE__ */ new WeakMap,Q=/* @__PURE__ */ new WeakMap,$=/* @__PURE__ */ new WeakMap,zt)](e){if(!e._||!e[`--`])return e;e._.push.apply(e._,e[`--`]);try{delete e[`--`]}catch{}return e}[Bt](){return{log:(...e)=>{this[pn]()||console.log(...e),F(this,W,!0,`f`),I(this,K,`f`).length&&F(this,K,I(this,K,`f`)+`
|
|
100
|
+
`,`f`),F(this,K,I(this,K,`f`)+e.join(` `),`f`)},error:(...e)=>{this[pn]()||console.error(...e),F(this,W,!0,`f`),I(this,K,`f`).length&&F(this,K,I(this,K,`f`)+`
|
|
101
|
+
`,`f`),F(this,K,I(this,K,`f`)+e.join(` `),`f`)}}}[Vt](e){Pe(I(this,q,`f`)).forEach(t=>{if((e=>e===`configObjects`)(t))return;let n=I(this,q,`f`)[t];Array.isArray(n)?n.includes(e)&&n.splice(n.indexOf(e),1):typeof n==`object`&&delete n[e]}),delete I(this,Z,`f`).getDescriptions()[e]}[Ht](e,t,n){I(this,wt,`f`)[n]||(I(this,X,`f`).process.emitWarning(e,t),I(this,wt,`f`)[n]=!0)}[Ut](){I(this,Tt,`f`).push({options:I(this,q,`f`),configObjects:I(this,q,`f`).configObjects.slice(0),exitProcess:I(this,V,`f`),groups:I(this,U,`f`),strict:I(this,Pt,`f`),strictCommands:I(this,Ft,`f`),strictOptions:I(this,It,`f`),completionCommand:I(this,z,`f`),output:I(this,K,`f`),exitError:I(this,B,`f`),hasOutput:I(this,W,`f`),parsed:this.parsed,parseFn:I(this,J,`f`),parseContext:I(this,At,`f`)}),I(this,Z,`f`).freeze(),I(this,$,`f`).freeze(),I(this,L,`f`).freeze(),I(this,H,`f`).freeze()}[Wt](){let e=``,t;return t=/\b(node|iojs|electron)(\.exe)?$/.test(I(this,X,`f`).process.argv()[0])?I(this,X,`f`).process.argv().slice(1,2):I(this,X,`f`).process.argv().slice(0,1),e=t.map(e=>{let t=this[gn](I(this,bt,`f`),e);return e.match(/^(\/|([a-zA-Z]:)?\\)/)&&t.length<e.length?t:e}).join(` `).trim(),I(this,X,`f`).getEnv(`_`)&&I(this,X,`f`).getProcessArgvBin()===I(this,X,`f`).getEnv(`_`)&&(e=I(this,X,`f`).getEnv(`_`).replace(`${I(this,X,`f`).path.dirname(I(this,X,`f`).process.execPath())}/`,``)),e}[Gt](){return I(this,kt,`f`)}[Kt](){return I(this,Lt,`f`)}[qt](){if(!I(this,Ct,`f`))return;let e=I(this,X,`f`).getEnv(`LC_ALL`)||I(this,X,`f`).getEnv(`LC_MESSAGES`)||I(this,X,`f`).getEnv(`LANG`)||I(this,X,`f`).getEnv(`LANGUAGE`)||`en_US`;this.locale(e.replace(/[.:].*/,``))}[Jt](){return this[Xt]().version||`unknown`}[Yt](e){let t=e[`--`]?e[`--`]:e._;for(let e=0,n;(n=t[e])!==void 0;e++)I(this,X,`f`).Parser.looksLikeNumber(n)&&Number.isSafeInteger(Math.floor(parseFloat(`${n}`)))&&(t[e]=Number(n));return e}[Xt](e){let t=e||`*`;if(I(this,jt,`f`)[t])return I(this,jt,`f`)[t];let n={};try{let t=e||I(this,X,`f`).mainFilename;!e&&I(this,X,`f`).path.extname(t)&&(t=I(this,X,`f`).path.dirname(t));let r=I(this,X,`f`).findUp(t,(e,t)=>{if(t.includes(`package.json`))return`package.json`});M(r,void 0,I(this,X,`f`)),n=JSON.parse(I(this,X,`f`).readFileSync(r,`utf8`))}catch{}return I(this,jt,`f`)[t]=n||{},I(this,jt,`f`)[t]}[Zt](e,t){t=[].concat(t),t.forEach(t=>{t=this[tn](t),I(this,q,`f`)[e].push(t)})}[Qt](e,t,n,r){this[en](e,t,n,r,(e,t,n)=>{I(this,q,`f`)[e][t]=n})}[$t](e,t,n,r){this[en](e,t,n,r,(e,t,n)=>{I(this,q,`f`)[e][t]=(I(this,q,`f`)[e][t]||[]).concat(n)})}[en](e,t,n,r,i){if(Array.isArray(n))n.forEach(t=>{e(t,r)});else if((e=>typeof e==`object`)(n))for(let t of Pe(n))e(t,n[t]);else i(t,this[tn](n),r)}[tn](e){return e===`__proto__`?`___proto___`:e}[nn](e,t){return this[Qt](this[nn].bind(this),`key`,e,t),this}[rn](){var e,t,n,r,i,a,o,s,c,l,u,d;let f=I(this,Tt,`f`).pop();M(f,void 0,I(this,X,`f`));let p;e=this,t=this,n=this,r=this,i=this,a=this,o=this,s=this,c=this,l=this,u=this,d=this,{options:{set value(t){F(e,q,t,`f`)}}.value,configObjects:p,exitProcess:{set value(e){F(t,V,e,`f`)}}.value,groups:{set value(e){F(n,U,e,`f`)}}.value,output:{set value(e){F(r,K,e,`f`)}}.value,exitError:{set value(e){F(i,B,e,`f`)}}.value,hasOutput:{set value(e){F(a,W,e,`f`)}}.value,parsed:this.parsed,strict:{set value(e){F(o,Pt,e,`f`)}}.value,strictCommands:{set value(e){F(s,Ft,e,`f`)}}.value,strictOptions:{set value(e){F(c,It,e,`f`)}}.value,completionCommand:{set value(e){F(l,z,e,`f`)}}.value,parseFn:{set value(e){F(u,J,e,`f`)}}.value,parseContext:{set value(e){F(d,At,e,`f`)}}.value}=f,I(this,q,`f`).configObjects=p,I(this,Z,`f`).unfreeze(),I(this,$,`f`).unfreeze(),I(this,L,`f`).unfreeze(),I(this,H,`f`).unfreeze()}[an](e,t){return He(t,t=>(e(t),t))}getInternalMethods(){return{getCommandInstance:this[on].bind(this),getContext:this[sn].bind(this),getHasOutput:this[cn].bind(this),getLoggerInstance:this[ln].bind(this),getParseContext:this[un].bind(this),getParserConfiguration:this[Gt].bind(this),getUsageConfiguration:this[Kt].bind(this),getUsageInstance:this[dn].bind(this),getValidationInstance:this[fn].bind(this),hasParseCallback:this[pn].bind(this),isGlobalContext:this[mn].bind(this),postProcess:this[hn].bind(this),reset:this[_n].bind(this),runValidation:this[yn].bind(this),runYargsParserAndExecuteCommands:this[vn].bind(this),setHasOutput:this[bn].bind(this)}}[on](){return I(this,L,`f`)}[sn](){return I(this,xt,`f`)}[cn](){return I(this,W,`f`)}[ln](){return I(this,Dt,`f`)}[un](){return I(this,At,`f`)||{}}[dn](){return I(this,Z,`f`)}[fn](){return I(this,$,`f`)}[pn](){return!!I(this,J,`f`)}[mn](){return I(this,Et,`f`)}[hn](e,t,n,r){return n||N(e)||(t||(e=this[zt](e)),(this[Gt]()[`parse-positional-numbers`]||this[Gt]()[`parse-positional-numbers`]===void 0)&&(e=this[Yt](e)),r&&(e=Ve(e,this,I(this,H,`f`).getMiddleware(),!1))),e}[_n](e={}){F(this,q,I(this,q,`f`)||{},`f`);let t={};t.local=I(this,q,`f`).local||[],t.configObjects=I(this,q,`f`).configObjects||[];let n={};return t.local.forEach(t=>{n[t]=!0,(e[t]||[]).forEach(e=>{n[e]=!0})}),Object.assign(I(this,Mt,`f`),Object.keys(I(this,U,`f`)).reduce((e,t)=>{let r=I(this,U,`f`)[t].filter(e=>!(e in n));return r.length>0&&(e[t]=r),e},{})),F(this,U,{},`f`),[`array`,`boolean`,`string`,`skipValidation`,`count`,`normalize`,`number`,`hiddenOptions`].forEach(e=>{t[e]=(I(this,q,`f`)[e]||[]).filter(e=>!n[e])}),[`narg`,`key`,`alias`,`default`,`defaultDescription`,`config`,`choices`,`demandedOptions`,`demandedCommands`,`deprecatedOptions`].forEach(e=>{t[e]=$e(I(this,q,`f`)[e],e=>!n[e])}),t.envPrefix=I(this,q,`f`).envPrefix,F(this,q,t,`f`),F(this,Z,I(this,Z,`f`)?I(this,Z,`f`).reset(n):nt(this,I(this,X,`f`)),`f`),F(this,$,I(this,$,`f`)?I(this,$,`f`).reset(n):pt(this,I(this,Z,`f`),I(this,X,`f`)),`f`),F(this,L,I(this,L,`f`)?I(this,L,`f`).reset():qe(I(this,Z,`f`),I(this,$,`f`),I(this,H,`f`),I(this,X,`f`)),`f`),I(this,R,`f`)||F(this,R,ct(this,I(this,Z,`f`),I(this,L,`f`),I(this,X,`f`)),`f`),I(this,H,`f`).reset(),F(this,z,null,`f`),F(this,K,``,`f`),F(this,B,null,`f`),F(this,W,!1,`f`),this.parsed=!1,this}[gn](e,t){return I(this,X,`f`).path.relative(e,t)}[vn](e,t,n,r=0,i=!1){let a=!!n||i;e||=I(this,Y,`f`),I(this,q,`f`).__=I(this,X,`f`).y18n.__,I(this,q,`f`).configuration=this[Gt]();let o=!!I(this,q,`f`).configuration[`populate--`],s=Object.assign({},I(this,q,`f`).configuration,{"populate--":!0}),c=I(this,X,`f`).Parser.detailed(e,Object.assign({},I(this,q,`f`),{configuration:{"parse-positional-numbers":!1,...s}})),l=Object.assign(c.argv,I(this,At,`f`)),u,d=c.aliases,f=!1,p=!1;Object.keys(l).forEach(e=>{e===I(this,G,`f`)&&l[e]?f=!0:e===I(this,Q,`f`)&&l[e]&&(p=!0)}),l.$0=this.$0,this.parsed=c,r===0&&I(this,Z,`f`).clearCachedHelpMessage();try{if(this[qt](),t)return this[hn](l,o,!!n,!1);I(this,G,`f`)&&[I(this,G,`f`)].concat(d[I(this,G,`f`)]||[]).filter(e=>e.length>1).includes(``+l._[l._.length-1])&&(l._.pop(),f=!0),F(this,Et,!1,`f`);let s=I(this,L,`f`).getCommands(),m=I(this,R,`f`).completionKey in l,h=f||m||i;if(l._.length){if(s.length){let e;for(let t=r||0,a;l._[t]!==void 0;t++){if(a=String(l._[t]),s.includes(a)&&a!==I(this,z,`f`)){let e=I(this,L,`f`).runCommand(a,this,c,t+1,i,f||p||i);return this[hn](e,o,!!n,!1)}if(!e&&a!==I(this,z,`f`)){e=a;break}}!I(this,L,`f`).hasDefaultCommand()&&I(this,Nt,`f`)&&e&&!h&&I(this,$,`f`).recommendCommands(e,s)}I(this,z,`f`)&&l._.includes(I(this,z,`f`))&&!m&&(I(this,V,`f`)&&et(!0),this.showCompletionScript(),this.exit(0))}if(I(this,L,`f`).hasDefaultCommand()&&!h){let e=I(this,L,`f`).runCommand(null,this,c,0,i,f||p||i);return this[hn](e,o,!!n,!1)}if(m){I(this,V,`f`)&&et(!0),e=[].concat(e);let t=e.slice(e.indexOf(`--${I(this,R,`f`).completionKey}`)+1);return I(this,R,`f`).getCompletion(t,(e,t)=>{if(e)throw new j(e.message);(t||[]).forEach(e=>{I(this,Dt,`f`).log(e)}),this.exit(0)}),this[hn](l,!o,!!n,!1)}if(I(this,W,`f`)||(f?(I(this,V,`f`)&&et(!0),a=!0,this.showHelp(`log`),this.exit(0)):p&&(I(this,V,`f`)&&et(!0),a=!0,I(this,Z,`f`).showVersion(`log`),this.exit(0))),!a&&I(this,q,`f`).skipValidation.length>0&&(a=Object.keys(l).some(e=>I(this,q,`f`).skipValidation.indexOf(e)>=0&&l[e]===!0)),!a){if(c.error)throw new j(c.error.message);if(!m){let e=this[yn](d,{},c.error);n||(u=Ve(l,this,I(this,H,`f`).getMiddleware(),!0)),u=this[an](e,u??l),N(u)&&!n&&(u=u.then(()=>Ve(l,this,I(this,H,`f`).getMiddleware(),!1)))}}}catch(e){if(e instanceof j)I(this,Z,`f`).fail(e.message,e);else throw e}return this[hn](u??l,o,!!n,!0)}[yn](e,t,n,r){let i={...this.getDemandedOptions()};return a=>{if(n)throw new j(n.message);I(this,$,`f`).nonOptionCount(a),I(this,$,`f`).requiredArguments(a,i);let o=!1;I(this,Ft,`f`)&&(o=I(this,$,`f`).unknownCommands(a)),I(this,Pt,`f`)&&!o?I(this,$,`f`).unknownArguments(a,e,t,!!r):I(this,It,`f`)&&I(this,$,`f`).unknownArguments(a,e,{},!1,!1),I(this,$,`f`).limitedChoices(a),I(this,$,`f`).implications(a),I(this,$,`f`).conflicting(a)}}[bn](){F(this,W,!0,`f`)}[xn](e){if(typeof e==`string`)I(this,q,`f`).key[e]=!0;else for(let t of e)I(this,q,`f`).key[t]=!0}};function Cn(e){return!!e&&typeof e.getInternalMethods==`function`}const wn=Rt(Me);var Tn=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const En=e=>e.option(`multi-repo`,{type:`boolean`,description:`Compose local repositories; set up a workspace if no config exists`}).option(`workspace`,{type:`string`,requiresArg:!0,description:`Path to a local multi-repo config (implies --multi-repo)`}).option(`setup`,{type:`boolean`,description:`Review saved setup (requires --multi-repo or --workspace); preserve cache`}).option(`non-interactive`,{type:`boolean`,description:`Never prompt (requires --multi-repo or --workspace and a valid config)`}).wrap(null).epilog(n),Dn=(e,t)=>En(wn(e).scriptName(t).usage(`$0 dev --multi-repo [options]`)).option(`port`,{type:`number`,default:3e3,description:`Local preview port`}).option(`open`,{type:`boolean`,default:!1,description:`Open the preview in a browser`}).option(`client-version`,{type:`string`,hidden:!0}).option(`local-client-version`,{type:`string`,hidden:!0}).option(`local-schema`,{type:`boolean`,hidden:!0}).option(`classic`,{type:`boolean`,default:!1,description:`Preview with the classic client`}).option(`beta`,{type:`boolean`,default:!1,hidden:!0}).option(`groups`,{type:`array`,description:`Mock user groups`}).option(`signed-in`,{type:`boolean`,default:!1}).option(`disable-openapi`,{type:`boolean`,default:!1}).option(`disable-prefetch`,{type:`boolean`,default:!1}).option(`host`,{type:`boolean`,default:!1}).option(`telemetry`,{alias:`t`,type:`boolean`}).help().alias(`help`,`h`).exitProcess(!1).strictOptions().fail(e=>{throw Error(e)});function On(e){return Dn(e,`mint`).help(!1).version(!1).strictOptions(!1).parseSync()._[0]===`dev`}function kn(e,n,r,i){return Tn(this,void 0,void 0,function*(){let a=Dn(e,n).parseSync();if(a.help||a.version)return;if(a.workspace!==void 0&&!a.workspace.trim())throw Error(`--workspace requires a config path.`);if(!a[`multi-repo`]&&!a.workspace)throw Error(`Use --multi-repo with --setup or --non-interactive.`);if(!Number.isInteger(a.port)||a.port<1||a.port>65535)throw Error(`--port must be an integer from 1 to 65535.`);let{resolveWorkspace:o}=yield import(`./multi-repo-setup-CRaAzjLQ.js`),s;console.log(`Checking multi-repo configuration…`);let c=yield o({cwd:process.cwd(),workspace:a.workspace,setup:a.setup,nonInteractive:a[`non-interactive`],onSaved:e=>{s=`Saved ${e}. Keep machine-specific paths out of Git; add the local config to .gitignore.`}}),{prepareMultiRepoPreview:l}=yield import(`./multi-repo-preview-C-LdbybQ.js`),f=performance.now(),p=0,m=yield l(c,!0,{compositionCacheDirectory:d.join(u.homedir(),`.mintlify`,`multi-repo-compositions`),onProgress:e=>{e.stage===`cold`&&console.log(`Preparing the workspace for the first time. Large repositories can take around two minutes; later runs reuse the saved workspace.`),e.stage===`cached`&&console.log(`Checking the saved workspace for changes…`),e.stage===`watching`&&console.log(`Starting repository watchers…`),e.stage===`files`&&performance.now()-p>=1e3&&(p=performance.now(),console.log(`Checked ${e.files.toLocaleString()} files…`))}});r(m.close);let h=m.getStats();console.log(`Workspace ready in ${((performance.now()-f)/1e3).toFixed(1)}s: ${h?.reusedFiles??0} files reused. Starting preview…`);for(let e of m.sources)console.log(` ${e.repo} → /${e.mountPath}`);if(process.chdir(m.directory),typeof a.telemetry==`boolean`){let{setTelemetryEnabled:e}=yield import(`./config-o7H193Xj.js`);yield e(a.telemetry)}let[{dev:g,Logs:ee},{render:_},{createElement:te}]=yield Promise.all([import(`./dist-BVY4bzYW.js`),import(`./build-B-oc3MuD.js`),import(`./react-CA8V--cT.js`).then(e=>/* @__PURE__ */ t(e.default,1))]);if(_(te(ee)),a.classic!==!0){let{watchComponentUsage:e}=yield import(`./live-C37won3z.js`);e(m.directory).catch(()=>void 0)}yield g(Object.assign(Object.assign({},a),{groups:a.groups??(a[`signed-in`]?[]:void 0),packageName:n,previewReadyMessage:s,onExit:i}))})}export{A as a,wn as i,En as n,kn as r,On as t};
|
|
@@ -4,4 +4,4 @@ import { dirname as __mintDirname } from 'node:path';
|
|
|
4
4
|
const require = __mintCreateRequire(import.meta.url);
|
|
5
5
|
const __filename = __mintFileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __mintDirname(__filename);
|
|
7
|
-
export{t as isMultiRepoDev,n as multiRepoOptions,r as runMultiRepoDev}from"./multi-repo-command-
|
|
7
|
+
export{t as isMultiRepoDev,n as multiRepoOptions,r as runMultiRepoDev}from"./multi-repo-command-DmTEZuwj.js";
|
|
@@ -4,7 +4,7 @@ import { dirname as __mintDirname } from 'node:path';
|
|
|
4
4
|
const require = __mintCreateRequire(import.meta.url);
|
|
5
5
|
const __filename = __mintFileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __mintDirname(__filename);
|
|
7
|
-
import{f as e,g as t,m as n,o as r,p as i,s as a}from"./schemas-CVKidklE.js";import o from"node:os";import{access as
|
|
7
|
+
import{f as e,g as t,m as n,o as r,p as i,s as a}from"./schemas-CVKidklE.js";import o from"node:os";import s from"node:path";import{access as c,readFile as l,realpath as u}from"node:fs/promises";var d=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const f=`.mint-workspace.local.json`,p=e({sources:r(e({repo:n().trim().min(1),directory:n().trim().min(1),mountPath:n(),base:a().optional()}).strict()).min(1)}).strict(),m=(e,t)=>s.resolve(t,e===`~`?o.homedir():e.startsWith(`~/`)?s.join(o.homedir(),e.slice(2)):e);function h(e){return d(this,void 0,void 0,function*(){try{return yield c(e),!0}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return!1;throw e}})}function g(e,t){return d(this,void 0,void 0,function*(){if(t)return m(t,e);let n=s.resolve(e);for(;;){let e=s.join(n,f);if(yield h(e))return e;if((yield h(s.join(n,`.git`)))||n===o.homedir()||s.dirname(n)===n)return;n=s.dirname(n)}})}function _(e){return d(this,void 0,void 0,function*(){let{resolveFileRefs:t}=yield import(`./dist-B9Tpyt5G.js`),{resolved:n,referencedFiles:r}=yield t(JSON.parse(yield l(s.join(e,`docs.json`),`utf8`)),e);return{config:n,referencedFiles:r}})}function v(e){return d(this,void 0,void 0,function*(){try{return p.parse(JSON.parse(yield l(e,`utf8`)))}catch(t){throw Error(`Invalid workspace config ${e}: ${t instanceof Error?t.message:String(t)}. Run mint dev --multi-repo --setup --workspace "${e}" to review it.`)}})}function y(e,r){return d(this,void 0,void 0,function*(){let a=p.parse(e);if(a.sources.filter(e=>e.base).length!==1)throw Error(`Exactly one source must set base: true.`);let o=/* @__PURE__ */ new Set,c=/* @__PURE__ */ new Set,l=/* @__PURE__ */ new Set,d=[],f=[];for(let e of a.sources){let a=e.mountPath.replace(/^\/+|\/+$/g,``);if((/[\\?#]/.test(a)||a.split(`/`).some(e=>e===`.`||e===`..`||e===``))&&a!==``)throw Error(`Invalid mountPath for ${e.repo}: ${e.mountPath}`);if(e.base&&a)throw Error(`The base repository must use mountPath: "".`);if(o.has(e.repo.toLowerCase()))throw Error(`Duplicate repo: ${e.repo}`);if(c.has(a)||[...c].some(e=>e&&a&&(a.startsWith(e+`/`)||e.startsWith(a+`/`))))throw Error(`Conflicting mountPath: /${a}`);let p=m(e.directory,s.dirname(r)),h,g;try{h=yield u(p),g=(yield _(p)).config}catch(t){throw Error(`Cannot load ${e.repo} at ${p}. Select a folder containing docs.json. ${t instanceof Error?t.message:String(t)}`)}if(l.has(h))throw Error(`The same folder is configured more than once: ${p}`);if(typeof g!=`object`||!g||Array.isArray(g))throw Error(`Invalid docs.json in ${p}`);f.push(i(n(),t()).parse(g)),d.push(Object.assign(Object.assign({},e),{directory:p,mountPath:a})),o.add(e.repo.toLowerCase()),c.add(a),l.add(h)}let{composeConfig:h}=yield import(`./multi-repo-preview-C-LdbybQ.js`);return h(d,f),{sources:d}})}const b=`
|
|
8
8
|
Multi-repo local configuration
|
|
9
9
|
|
|
10
10
|
Default: ${f}. Search from the current directory upward, stopping
|