ado-npm-auth 0.1.11 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ado-npm-auth.cjs +3 -3
- package/dist/index.js +187 -0
- package/lib/ado/make-ado-request.d.ts +15 -0
- package/lib/args.d.ts +7 -0
- package/lib/azureauth/ado.d.ts +26 -0
- package/lib/azureauth/ado.test.d.ts +2 -0
- package/lib/azureauth/azureauth-command.d.ts +11 -0
- package/lib/azureauth/index.d.ts +2 -0
- package/lib/azureauth/is-azureauth-installed.d.ts +7 -0
- package/lib/azureauth/is-azureauth-installed.test.d.ts +2 -0
- package/lib/azureauth/is-supported-platform-and-architecture.d.ts +6 -0
- package/lib/cli.d.ts +3 -0
- package/lib/fileProvider.d.ts +35 -0
- package/lib/index.d.ts +5 -0
- package/lib/npmrc/generate-npmrc-pat.d.ts +6 -0
- package/lib/npmrc/index.d.ts +2 -0
- package/lib/npmrc/npmrcFileProvider.d.ts +12 -0
- package/lib/telemetry/index.d.ts +20 -0
- package/lib/utils/encoding.d.ts +13 -0
- package/lib/utils/exec.d.ts +3 -0
- package/lib/utils/get-feed-without-protocol.d.ts +5 -0
- package/lib/utils/get-feed-without-protocol.test.d.ts +2 -0
- package/lib/utils/get-organization-from-feed-url.d.ts +8 -0
- package/lib/utils/get-organization-from-feed-url.test.d.ts +2 -0
- package/lib/utils/is-codespaces.d.ts +6 -0
- package/lib/utils/is-wsl.d.ts +6 -0
- package/lib/utils/partition.d.ts +2 -0
- package/lib/utils/request.d.ts +8 -0
- package/lib/yarnrc/yarnrcFileProvider.d.ts +29 -0
- package/package.json +4 -2
package/dist/ado-npm-auth.cjs
CHANGED
|
@@ -153,8 +153,8 @@ ${g.join(`
|
|
|
153
153
|
`;h.forEach(g=>{d+=g}),t.fail(d)}};let u={};s.conflicts=function(l,h){ce("<string|object> [array|string]",[l,h],arguments.length),typeof l=="object"?Object.keys(l).forEach(d=>{s.conflicts(d,l[d])}):(e.global(l),u[l]||(u[l]=[]),Array.isArray(h)?h.forEach(d=>s.conflicts(l,d)):u[l].push(h))},s.getConflicting=()=>u,s.conflicting=function(l){Object.keys(l).forEach(h=>{u[h]&&u[h].forEach(d=>{d&&l[h]!==void 0&&l[d]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",h,d))})}),e.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(u).forEach(h=>{u[h].forEach(d=>{d&&l[r.Parser.camelCase(h)]!==void 0&&l[r.Parser.camelCase(d)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",h,d))})})},s.recommendCommands=function(l,h){h=h.sort((y,F)=>F.length-y.length);let g=null,E=1/0;for(let y=0,F;(F=h[y])!==void 0;y++){let _=_g(l,F);_<=3&&_<E&&(E=_,g=F)}g&&t.fail(n("Did you mean %s?",g))},s.reset=function(l){return o=Xr(o,h=>!l[h]),u=Xr(u,h=>!l[h]),s};let c=[];return s.freeze=function(){c.push({implied:o,conflicting:u})},s.unfreeze=function(){let l=c.pop();mt(l,void 0,r),{implied:o,conflicting:u}=l},s}var Ic=[],Ps;function Ds(e,t,r,n){Ps=n;let i={};if(Object.prototype.hasOwnProperty.call(e,"extends")){if(typeof e.extends!="string")return i;let s=/\.json|\..*rc$/.test(e.extends),o=null;if(s)o=oO(t,e.extends);else try{o=require.resolve(e.extends)}catch{return e}sO(o),Ic.push(o),i=s?JSON.parse(Ps.readFileSync(o,"utf8")):require(e.extends),delete e.extends,i=Ds(i,Ps.path.dirname(o),r,Ps)}return Ic=[],r?Og(i,e):Object.assign({},i,e)}function sO(e){if(Ic.indexOf(e)>-1)throw new je(`Circular extended configurations: '${e}'.`)}function oO(e,t){return Ps.path.resolve(e,t)}function Og(e,t){let r={};function n(i){return i&&typeof i=="object"&&!Array.isArray(i)}Object.assign(r,e);for(let i of Object.keys(t))n(t[i])&&n(r[i])?r[i]=Og(e[i],t[i]):r[i]=t[i];return r}var le=function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},x=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},Ue,kn,ks,Ht,It,Vo,Jr,Tn,Ko,Wt,Xo,Gt,dr,Nt,Ut,Qo,bi,tt,he,Jo,Zo,Lt,In,wi,Nn,Zr,ea,Ae,Ln,jn,Mn,be,ta,pr,He;function zg(e){return(t=[],r=e.process.cwd(),n)=>{let i=new Uc(t,r,n,e);return Object.defineProperty(i,"argv",{get:()=>i.parse(),enumerable:!0}),i.help(),i.version(),i}}var Fg=Symbol("copyDoubleDash"),Rg=Symbol("copyDoubleDash"),Nc=Symbol("deleteFromParserHintObject"),Pg=Symbol("emitWarning"),Dg=Symbol("freeze"),kg=Symbol("getDollarZero"),$n=Symbol("getParserConfiguration"),Tg=Symbol("getUsageConfiguration"),Lc=Symbol("guessLocale"),Ig=Symbol("guessVersion"),Ng=Symbol("parsePositionalNumbers"),jc=Symbol("pkgUp"),en=Symbol("populateParserHintArray"),Si=Symbol("populateParserHintSingleValueDictionary"),Mc=Symbol("populateParserHintArrayDictionary"),$c=Symbol("populateParserHintDictionary"),Bc=Symbol("sanitizeKey"),qc=Symbol("setKey"),Hc=Symbol("unfreeze"),Lg=Symbol("validateAsync"),jg=Symbol("getCommandInstance"),Mg=Symbol("getContext"),$g=Symbol("getHasOutput"),Bg=Symbol("getLoggerInstance"),qg=Symbol("getParseContext"),Hg=Symbol("getUsageInstance"),Wg=Symbol("getValidationInstance"),ra=Symbol("hasParseCallback"),Gg=Symbol("isGlobalContext"),Bn=Symbol("postProcess"),Ug=Symbol("rebase"),Wc=Symbol("reset"),Ts=Symbol("runYargsParserAndExecuteCommands"),Gc=Symbol("runValidation"),Yg=Symbol("setHasOutput"),qn=Symbol("kTrackManuallySetKeys"),Uc=class{constructor(t=[],r,n,i){this.customScriptName=!1,this.parsed=!1,Ue.set(this,void 0),kn.set(this,void 0),ks.set(this,{commands:[],fullCommands:[]}),Ht.set(this,null),It.set(this,null),Vo.set(this,"show-hidden"),Jr.set(this,null),Tn.set(this,!0),Ko.set(this,{}),Wt.set(this,!0),Xo.set(this,[]),Gt.set(this,void 0),dr.set(this,{}),Nt.set(this,!1),Ut.set(this,null),Qo.set(this,!0),bi.set(this,void 0),tt.set(this,""),he.set(this,void 0),Jo.set(this,void 0),Zo.set(this,{}),Lt.set(this,null),In.set(this,null),wi.set(this,{}),Nn.set(this,{}),Zr.set(this,void 0),ea.set(this,!1),Ae.set(this,void 0),Ln.set(this,!1),jn.set(this,!1),Mn.set(this,!1),be.set(this,void 0),ta.set(this,{}),pr.set(this,null),He.set(this,void 0),le(this,Ae,i,"f"),le(this,Zr,t,"f"),le(this,kn,r,"f"),le(this,Jo,n,"f"),le(this,Gt,new Uo(this),"f"),this.$0=this[kg](),this[Wc](),le(this,Ue,x(this,Ue,"f"),"f"),le(this,be,x(this,be,"f"),"f"),le(this,He,x(this,He,"f"),"f"),le(this,he,x(this,he,"f"),"f"),x(this,he,"f").showHiddenOpt=x(this,Vo,"f"),le(this,bi,this[Rg](),"f")}addHelpOpt(t,r){let n="help";return ce("[string|boolean] [string]",[t,r],arguments.length),x(this,Ut,"f")&&(this[Nc](x(this,Ut,"f")),le(this,Ut,null,"f")),t===!1&&r===void 0?this:(le(this,Ut,typeof t=="string"?t:n,"f"),this.boolean(x(this,Ut,"f")),this.describe(x(this,Ut,"f"),r||x(this,be,"f").deferY18nLookup("Show help")),this)}help(t,r){return this.addHelpOpt(t,r)}addShowHiddenOpt(t,r){if(ce("[string|boolean] [string]",[t,r],arguments.length),t===!1&&r===void 0)return this;let n=typeof t=="string"?t:x(this,Vo,"f");return this.boolean(n),this.describe(n,r||x(this,be,"f").deferY18nLookup("Show hidden options")),x(this,he,"f").showHiddenOpt=n,this}showHidden(t,r){return this.addShowHiddenOpt(t,r)}alias(t,r){return ce("<object|string|array> [string|array]",[t,r],arguments.length),this[Mc](this.alias.bind(this),"alias",t,r),this}array(t){return ce("<array|string>",[t],arguments.length),this[en]("array",t),this[qn](t),this}boolean(t){return ce("<array|string>",[t],arguments.length),this[en]("boolean",t),this[qn](t),this}check(t,r){return ce("<function> [boolean]",[t,r],arguments.length),this.middleware((n,i)=>Dn(()=>t(n,i.getOptions()),s=>(s?(typeof s=="string"||s instanceof Error)&&x(this,be,"f").fail(s.toString(),s):x(this,be,"f").fail(x(this,Ae,"f").y18n.__("Argument check failed: %s",t.toString())),n),s=>(x(this,be,"f").fail(s.message?s.message:s.toString(),s),n)),!1,r),this}choices(t,r){return ce("<object|string|array> [string|array]",[t,r],arguments.length),this[Mc](this.choices.bind(this),"choices",t,r),this}coerce(t,r){if(ce("<object|string|array> [function]",[t,r],arguments.length),Array.isArray(t)){if(!r)throw new je("coerce callback must be provided");for(let n of t)this.coerce(n,r);return this}else if(typeof t=="object"){for(let n of Object.keys(t))this.coerce(n,t[n]);return this}if(!r)throw new je("coerce callback must be provided");return x(this,he,"f").key[t]=!0,x(this,Gt,"f").addCoerceMiddleware((n,i)=>{let s;return Object.prototype.hasOwnProperty.call(n,t)?Dn(()=>(s=i.getAliases(),r(n[t])),a=>{n[t]=a;let u=i.getInternalMethods().getParserConfiguration()["strip-aliased"];if(s[t]&&u!==!0)for(let c of s[t])n[c]=a;return n},a=>{throw new je(a.message)}):n},t),this}conflicts(t,r){return ce("<string|object> [string|array]",[t,r],arguments.length),x(this,He,"f").conflicts(t,r),this}config(t="config",r,n){return ce("[object|string] [string|function] [function]",[t,r,n],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=Ds(t,x(this,kn,"f"),this[$n]()["deep-merge-config"]||!1,x(this,Ae,"f")),x(this,he,"f").configObjects=(x(this,he,"f").configObjects||[]).concat(t),this):(typeof r=="function"&&(n=r,r=void 0),this.describe(t,r||x(this,be,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(i=>{x(this,he,"f").config[i]=n||!0}),this)}completion(t,r,n){return ce("[string] [string|boolean|function] [function]",[t,r,n],arguments.length),typeof r=="function"&&(n=r,r=void 0),le(this,It,t||x(this,It,"f")||"completion","f"),!r&&r!==!1&&(r="generate completion script"),this.command(x(this,It,"f"),r),n&&x(this,Ht,"f").registerFunction(n),this}command(t,r,n,i,s,o){return ce("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,r,n,i,s,o],arguments.length),x(this,Ue,"f").addHandler(t,r,n,i,s,o),this}commands(t,r,n,i,s,o){return this.command(t,r,n,i,s,o)}commandDir(t,r){ce("<string> [object]",[t,r],arguments.length);let n=x(this,Jo,"f")||x(this,Ae,"f").require;return x(this,Ue,"f").addDirectory(t,n,x(this,Ae,"f").getCallerFile(),r),this}count(t){return ce("<array|string>",[t],arguments.length),this[en]("count",t),this[qn](t),this}default(t,r,n){return ce("<object|string|array> [*] [string]",[t,r,n],arguments.length),n&&(Rc(t,x(this,Ae,"f")),x(this,he,"f").defaultDescription[t]=n),typeof r=="function"&&(Rc(t,x(this,Ae,"f")),x(this,he,"f").defaultDescription[t]||(x(this,he,"f").defaultDescription[t]=x(this,be,"f").functionDescription(r)),r=r.call()),this[Si](this.default.bind(this),"default",t,r),this}defaults(t,r,n){return this.default(t,r,n)}demandCommand(t=1,r,n,i){return ce("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,r,n,i],arguments.length),typeof r!="number"&&(n=r,r=1/0),this.global("_",!1),x(this,he,"f").demandedCommands._={min:t,max:r,minMsg:n,maxMsg:i},this}demand(t,r,n){return Array.isArray(r)?(r.forEach(i=>{mt(n,!0,x(this,Ae,"f")),this.demandOption(i,n)}),r=1/0):typeof r!="number"&&(n=r,r=1/0),typeof t=="number"?(mt(n,!0,x(this,Ae,"f")),this.demandCommand(t,r,n,n)):Array.isArray(t)?t.forEach(i=>{mt(n,!0,x(this,Ae,"f")),this.demandOption(i,n)}):typeof n=="string"?this.demandOption(t,n):(n===!0||typeof n>"u")&&this.demandOption(t),this}demandOption(t,r){return ce("<object|string|array> [string]",[t,r],arguments.length),this[Si](this.demandOption.bind(this),"demandedOptions",t,r),this}deprecateOption(t,r){return ce("<string> [string|boolean]",[t,r],arguments.length),x(this,he,"f").deprecatedOptions[t]=r,this}describe(t,r){return ce("<object|string|array> [string]",[t,r],arguments.length),this[qc](t,!0),x(this,be,"f").describe(t,r),this}detectLocale(t){return ce("<boolean>",[t],arguments.length),le(this,Tn,t,"f"),this}env(t){return ce("[string|boolean]",[t],arguments.length),t===!1?delete x(this,he,"f").envPrefix:x(this,he,"f").envPrefix=t||"",this}epilogue(t){return ce("<string>",[t],arguments.length),x(this,be,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,r){return ce("<string|array> [string]",[t,r],arguments.length),Array.isArray(t)?t.forEach(n=>this.example(...n)):x(this,be,"f").example(t,r),this}exit(t,r){le(this,Nt,!0,"f"),le(this,Jr,r,"f"),x(this,Wt,"f")&&x(this,Ae,"f").process.exit(t)}exitProcess(t=!0){return ce("[boolean]",[t],arguments.length),le(this,Wt,t,"f"),this}fail(t){if(ce("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new je("Invalid first argument. Expected function or boolean 'false'");return x(this,be,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,r){return ce("<array> [function]",[t,r],arguments.length),r?x(this,Ht,"f").getCompletion(t,r):new Promise((n,i)=>{x(this,Ht,"f").getCompletion(t,(s,o)=>{s?i(s):n(o)})})}getDemandedOptions(){return ce([],0),x(this,he,"f").demandedOptions}getDemandedCommands(){return ce([],0),x(this,he,"f").demandedCommands}getDeprecatedOptions(){return ce([],0),x(this,he,"f").deprecatedOptions}getDetectLocale(){return x(this,Tn,"f")}getExitProcess(){return x(this,Wt,"f")}getGroups(){return Object.assign({},x(this,dr,"f"),x(this,Nn,"f"))}getHelp(){if(le(this,Nt,!0,"f"),!x(this,be,"f").hasCachedHelpMessage()){if(!this.parsed){let r=this[Ts](x(this,Zr,"f"),void 0,void 0,0,!0);if(Me(r))return r.then(()=>x(this,be,"f").help())}let t=x(this,Ue,"f").runDefaultBuilderOn(this);if(Me(t))return t.then(()=>x(this,be,"f").help())}return Promise.resolve(x(this,be,"f").help())}getOptions(){return x(this,he,"f")}getStrict(){return x(this,Ln,"f")}getStrictCommands(){return x(this,jn,"f")}getStrictOptions(){return x(this,Mn,"f")}global(t,r){return ce("<string|array> [boolean]",[t,r],arguments.length),t=[].concat(t),r!==!1?x(this,he,"f").local=x(this,he,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{x(this,he,"f").local.includes(n)||x(this,he,"f").local.push(n)}),this}group(t,r){ce("<string|array> <string>",[t,r],arguments.length);let n=x(this,Nn,"f")[r]||x(this,dr,"f")[r];x(this,Nn,"f")[r]&&delete x(this,Nn,"f")[r];let i={};return x(this,dr,"f")[r]=(n||[]).concat(t).filter(s=>i[s]?!1:i[s]=!0),this}hide(t){return ce("<string>",[t],arguments.length),x(this,he,"f").hiddenOptions.push(t),this}implies(t,r){return ce("<string|object> [number|string|array]",[t,r],arguments.length),x(this,He,"f").implies(t,r),this}locale(t){return ce("[string]",[t],arguments.length),t===void 0?(this[Lc](),x(this,Ae,"f").y18n.getLocale()):(le(this,Tn,!1,"f"),x(this,Ae,"f").y18n.setLocale(t),this)}middleware(t,r,n){return x(this,Gt,"f").addMiddleware(t,!!r,n)}nargs(t,r){return ce("<string|object|array> [number]",[t,r],arguments.length),this[Si](this.nargs.bind(this),"narg",t,r),this}normalize(t){return ce("<array|string>",[t],arguments.length),this[en]("normalize",t),this}number(t){return ce("<array|string>",[t],arguments.length),this[en]("number",t),this[qn](t),this}option(t,r){if(ce("<string|object> [object]",[t,r],arguments.length),typeof t=="object")Object.keys(t).forEach(n=>{this.options(n,t[n])});else{typeof r!="object"&&(r={}),this[qn](t),x(this,pr,"f")&&(t==="version"||r?.alias==="version")&&this[Pg](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
|
|
154
154
|
`),void 0,"versionWarning"),x(this,he,"f").key[t]=!0,r.alias&&this.alias(t,r.alias);let n=r.deprecate||r.deprecated;n&&this.deprecateOption(t,n);let i=r.demand||r.required||r.require;i&&this.demand(t,i),r.demandOption&&this.demandOption(t,typeof r.demandOption=="string"?r.demandOption:void 0),r.conflicts&&this.conflicts(t,r.conflicts),"default"in r&&this.default(t,r.default),r.implies!==void 0&&this.implies(t,r.implies),r.nargs!==void 0&&this.nargs(t,r.nargs),r.config&&this.config(t,r.configParser),r.normalize&&this.normalize(t),r.choices&&this.choices(t,r.choices),r.coerce&&this.coerce(t,r.coerce),r.group&&this.group(t,r.group),(r.boolean||r.type==="boolean")&&(this.boolean(t),r.alias&&this.boolean(r.alias)),(r.array||r.type==="array")&&(this.array(t),r.alias&&this.array(r.alias)),(r.number||r.type==="number")&&(this.number(t),r.alias&&this.number(r.alias)),(r.string||r.type==="string")&&(this.string(t),r.alias&&this.string(r.alias)),(r.count||r.type==="count")&&this.count(t),typeof r.global=="boolean"&&this.global(t,r.global),r.defaultDescription&&(x(this,he,"f").defaultDescription[t]=r.defaultDescription),r.skipValidation&&this.skipValidation(t);let s=r.describe||r.description||r.desc,o=x(this,be,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(o,t)||typeof s=="string")&&this.describe(t,s),r.hidden&&this.hide(t),r.requiresArg&&this.requiresArg(t)}return this}options(t,r){return this.option(t,r)}parse(t,r,n){ce("[string|array] [function|boolean|object] [function]",[t,r,n],arguments.length),this[Dg](),typeof t>"u"&&(t=x(this,Zr,"f")),typeof r=="object"&&(le(this,In,r,"f"),r=n),typeof r=="function"&&(le(this,Lt,r,"f"),r=!1),r||le(this,Zr,t,"f"),x(this,Lt,"f")&&le(this,Wt,!1,"f");let i=this[Ts](t,!!r),s=this.parsed;return x(this,Ht,"f").setParsed(this.parsed),Me(i)?i.then(o=>(x(this,Lt,"f")&&x(this,Lt,"f").call(this,x(this,Jr,"f"),o,x(this,tt,"f")),o)).catch(o=>{throw x(this,Lt,"f")&&x(this,Lt,"f")(o,this.parsed.argv,x(this,tt,"f")),o}).finally(()=>{this[Hc](),this.parsed=s}):(x(this,Lt,"f")&&x(this,Lt,"f").call(this,x(this,Jr,"f"),i,x(this,tt,"f")),this[Hc](),this.parsed=s,i)}parseAsync(t,r,n){let i=this.parse(t,r,n);return Me(i)?i:Promise.resolve(i)}parseSync(t,r,n){let i=this.parse(t,r,n);if(Me(i))throw new je(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return i}parserConfiguration(t){return ce("<object>",[t],arguments.length),le(this,Zo,t,"f"),this}pkgConf(t,r){ce("<string> [string]",[t,r],arguments.length);let n=null,i=this[jc](r||x(this,kn,"f"));return i[t]&&typeof i[t]=="object"&&(n=Ds(i[t],r||x(this,kn,"f"),this[$n]()["deep-merge-config"]||!1,x(this,Ae,"f")),x(this,he,"f").configObjects=(x(this,he,"f").configObjects||[]).concat(n)),this}positional(t,r){ce("<string> <object>",[t,r],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];r=Xr(r,(o,a)=>o==="type"&&!["string","number","boolean"].includes(a)?!1:n.includes(o));let i=x(this,ks,"f").fullCommands[x(this,ks,"f").fullCommands.length-1],s=i?x(this,Ue,"f").cmdToParseOptions(i):{array:[],alias:{},default:{},demand:{}};return Ai(s).forEach(o=>{let a=s[o];Array.isArray(a)?a.indexOf(t)!==-1&&(r[o]=!0):a[t]&&!(o in r)&&(r[o]=a[t])}),this.group(t,x(this,be,"f").getPositionalGroupName()),this.option(t,r)}recommendCommands(t=!0){return ce("[boolean]",[t],arguments.length),le(this,ea,t,"f"),this}required(t,r,n){return this.demand(t,r,n)}require(t,r,n){return this.demand(t,r,n)}requiresArg(t){return ce("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&x(this,he,"f").narg[t]?this:(this[Si](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,r){return ce("[string] [string]",[t,r],arguments.length),t=t||this.$0,x(this,bi,"f").log(x(this,Ht,"f").generateCompletionScript(t,r||x(this,It,"f")||"completion")),this}showHelp(t){if(ce("[string|function]",[t],arguments.length),le(this,Nt,!0,"f"),!x(this,be,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[Ts](x(this,Zr,"f"),void 0,void 0,0,!0);if(Me(n))return n.then(()=>{x(this,be,"f").showHelp(t)}),this}let r=x(this,Ue,"f").runDefaultBuilderOn(this);if(Me(r))return r.then(()=>{x(this,be,"f").showHelp(t)}),this}return x(this,be,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,r){return ce("[boolean|string] [string]",[t,r],arguments.length),x(this,be,"f").showHelpOnFail(t,r),this}showVersion(t){return ce("[string|function]",[t],arguments.length),x(this,be,"f").showVersion(t),this}skipValidation(t){return ce("<array|string>",[t],arguments.length),this[en]("skipValidation",t),this}strict(t){return ce("[boolean]",[t],arguments.length),le(this,Ln,t!==!1,"f"),this}strictCommands(t){return ce("[boolean]",[t],arguments.length),le(this,jn,t!==!1,"f"),this}strictOptions(t){return ce("[boolean]",[t],arguments.length),le(this,Mn,t!==!1,"f"),this}string(t){return ce("<array|string>",[t],arguments.length),this[en]("string",t),this[qn](t),this}terminalWidth(){return ce([],0),x(this,Ae,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return ce("<object>",[t],arguments.length),le(this,Tn,!1,"f"),x(this,Ae,"f").y18n.updateLocale(t),this}usage(t,r,n,i){if(ce("<string|null|undefined> [string|boolean] [function|object] [function]",[t,r,n,i],arguments.length),r!==void 0){if(mt(t,null,x(this,Ae,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,r,n,i);throw new je(".usage() description must start with $0 if being used as alias for .command()")}else return x(this,be,"f").usage(t),this}usageConfiguration(t){return ce("<object>",[t],arguments.length),le(this,ta,t,"f"),this}version(t,r,n){let i="version";if(ce("[boolean|string] [string] [string]",[t,r,n],arguments.length),x(this,pr,"f")&&(this[Nc](x(this,pr,"f")),x(this,be,"f").version(void 0),le(this,pr,null,"f")),arguments.length===0)n=this[Ig](),t=i;else if(arguments.length===1){if(t===!1)return this;n=t,t=i}else arguments.length===2&&(n=r,r=void 0);return le(this,pr,typeof t=="string"?t:i,"f"),r=r||x(this,be,"f").deferY18nLookup("Show version number"),x(this,be,"f").version(n||void 0),this.boolean(x(this,pr,"f")),this.describe(x(this,pr,"f"),r),this}wrap(t){return ce("<number|null|undefined>",[t],arguments.length),x(this,be,"f").wrap(t),this}[(Ue=new WeakMap,kn=new WeakMap,ks=new WeakMap,Ht=new WeakMap,It=new WeakMap,Vo=new WeakMap,Jr=new WeakMap,Tn=new WeakMap,Ko=new WeakMap,Wt=new WeakMap,Xo=new WeakMap,Gt=new WeakMap,dr=new WeakMap,Nt=new WeakMap,Ut=new WeakMap,Qo=new WeakMap,bi=new WeakMap,tt=new WeakMap,he=new WeakMap,Jo=new WeakMap,Zo=new WeakMap,Lt=new WeakMap,In=new WeakMap,wi=new WeakMap,Nn=new WeakMap,Zr=new WeakMap,ea=new WeakMap,Ae=new WeakMap,Ln=new WeakMap,jn=new WeakMap,Mn=new WeakMap,be=new WeakMap,ta=new WeakMap,pr=new WeakMap,He=new WeakMap,Fg)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch{}return t}[Rg](){return{log:(...t)=>{this[ra]()||console.log(...t),le(this,Nt,!0,"f"),x(this,tt,"f").length&&le(this,tt,x(this,tt,"f")+`
|
|
155
155
|
`,"f"),le(this,tt,x(this,tt,"f")+t.join(" "),"f")},error:(...t)=>{this[ra]()||console.error(...t),le(this,Nt,!0,"f"),x(this,tt,"f").length&&le(this,tt,x(this,tt,"f")+`
|
|
156
|
-
`,"f"),le(this,tt,x(this,tt,"f")+t.join(" "),"f")}}}[Nc](t){Ai(x(this,he,"f")).forEach(r=>{if((i=>i==="configObjects")(r))return;let n=x(this,he,"f")[r];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete x(this,be,"f").getDescriptions()[t]}[Pg](t,r,n){x(this,Ko,"f")[n]||(x(this,Ae,"f").process.emitWarning(t,r),x(this,Ko,"f")[n]=!0)}[Dg](){x(this,Xo,"f").push({options:x(this,he,"f"),configObjects:x(this,he,"f").configObjects.slice(0),exitProcess:x(this,Wt,"f"),groups:x(this,dr,"f"),strict:x(this,Ln,"f"),strictCommands:x(this,jn,"f"),strictOptions:x(this,Mn,"f"),completionCommand:x(this,It,"f"),output:x(this,tt,"f"),exitError:x(this,Jr,"f"),hasOutput:x(this,Nt,"f"),parsed:this.parsed,parseFn:x(this,Lt,"f"),parseContext:x(this,In,"f")}),x(this,be,"f").freeze(),x(this,He,"f").freeze(),x(this,Ue,"f").freeze(),x(this,Gt,"f").freeze()}[kg](){let t="",r;return/\b(node|iojs|electron)(\.exe)?$/.test(x(this,Ae,"f").process.argv()[0])?r=x(this,Ae,"f").process.argv().slice(1,2):r=x(this,Ae,"f").process.argv().slice(0,1),t=r.map(n=>{let i=this[Ug](x(this,kn,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&i.length<n.length?i:n}).join(" ").trim(),x(this,Ae,"f").getEnv("_")&&x(this,Ae,"f").getProcessArgvBin()===x(this,Ae,"f").getEnv("_")&&(t=x(this,Ae,"f").getEnv("_").replace(`${x(this,Ae,"f").path.dirname(x(this,Ae,"f").process.execPath())}/`,"")),t}[$n](){return x(this,Zo,"f")}[Tg](){return x(this,ta,"f")}[Lc](){if(!x(this,Tn,"f"))return;let t=x(this,Ae,"f").getEnv("LC_ALL")||x(this,Ae,"f").getEnv("LC_MESSAGES")||x(this,Ae,"f").getEnv("LANG")||x(this,Ae,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[Ig](){return this[jc]().version||"unknown"}[Ng](t){let r=t["--"]?t["--"]:t._;for(let n=0,i;(i=r[n])!==void 0;n++)x(this,Ae,"f").Parser.looksLikeNumber(i)&&Number.isSafeInteger(Math.floor(parseFloat(`${i}`)))&&(r[n]=Number(i));return t}[jc](t){let r=t||"*";if(x(this,wi,"f")[r])return x(this,wi,"f")[r];let n={};try{let i=t||x(this,Ae,"f").mainFilename;!t&&x(this,Ae,"f").path.extname(i)&&(i=x(this,Ae,"f").path.dirname(i));let s=x(this,Ae,"f").findUp(i,(o,a)=>{if(a.includes("package.json"))return"package.json"});mt(s,void 0,x(this,Ae,"f")),n=JSON.parse(x(this,Ae,"f").readFileSync(s,"utf8"))}catch{}return x(this,wi,"f")[r]=n||{},x(this,wi,"f")[r]}[en](t,r){r=[].concat(r),r.forEach(n=>{n=this[Bc](n),x(this,he,"f")[t].push(n)})}[Si](t,r,n,i){this[$c](t,r,n,i,(s,o,a)=>{x(this,he,"f")[s][o]=a})}[Mc](t,r,n,i){this[$c](t,r,n,i,(s,o,a)=>{x(this,he,"f")[s][o]=(x(this,he,"f")[s][o]||[]).concat(a)})}[$c](t,r,n,i,s){if(Array.isArray(n))n.forEach(o=>{t(o,i)});else if((o=>typeof o=="object")(n))for(let o of Ai(n))t(o,n[o]);else s(r,this[Bc](n),i)}[Bc](t){return t==="__proto__"?"___proto___":t}[qc](t,r){return this[Si](this[qc].bind(this),"key",t,r),this}[Hc](){var t,r,n,i,s,o,a,u,c,f,l,h;let d=x(this,Xo,"f").pop();mt(d,void 0,x(this,Ae,"f"));let g;t=this,r=this,n=this,i=this,s=this,o=this,a=this,u=this,c=this,f=this,l=this,h=this,{options:{set value(E){le(t,he,E,"f")}}.value,configObjects:g,exitProcess:{set value(E){le(r,Wt,E,"f")}}.value,groups:{set value(E){le(n,dr,E,"f")}}.value,output:{set value(E){le(i,tt,E,"f")}}.value,exitError:{set value(E){le(s,Jr,E,"f")}}.value,hasOutput:{set value(E){le(o,Nt,E,"f")}}.value,parsed:this.parsed,strict:{set value(E){le(a,Ln,E,"f")}}.value,strictCommands:{set value(E){le(u,jn,E,"f")}}.value,strictOptions:{set value(E){le(c,Mn,E,"f")}}.value,completionCommand:{set value(E){le(f,It,E,"f")}}.value,parseFn:{set value(E){le(l,Lt,E,"f")}}.value,parseContext:{set value(E){le(h,In,E,"f")}}.value}=d,x(this,he,"f").configObjects=g,x(this,be,"f").unfreeze(),x(this,He,"f").unfreeze(),x(this,Ue,"f").unfreeze(),x(this,Gt,"f").unfreeze()}[Lg](t,r){return Dn(r,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[jg].bind(this),getContext:this[Mg].bind(this),getHasOutput:this[$g].bind(this),getLoggerInstance:this[Bg].bind(this),getParseContext:this[qg].bind(this),getParserConfiguration:this[$n].bind(this),getUsageConfiguration:this[Tg].bind(this),getUsageInstance:this[Hg].bind(this),getValidationInstance:this[Wg].bind(this),hasParseCallback:this[ra].bind(this),isGlobalContext:this[Gg].bind(this),postProcess:this[Bn].bind(this),reset:this[Wc].bind(this),runValidation:this[Gc].bind(this),runYargsParserAndExecuteCommands:this[Ts].bind(this),setHasOutput:this[Yg].bind(this)}}[jg](){return x(this,Ue,"f")}[Mg](){return x(this,ks,"f")}[$g](){return x(this,Nt,"f")}[Bg](){return x(this,bi,"f")}[qg](){return x(this,In,"f")||{}}[Hg](){return x(this,be,"f")}[Wg](){return x(this,He,"f")}[ra](){return!!x(this,Lt,"f")}[Gg](){return x(this,Qo,"f")}[Bn](t,r,n,i){return n||Me(t)||(r||(t=this[Fg](t)),(this[$n]()["parse-positional-numbers"]||this[$n]()["parse-positional-numbers"]===void 0)&&(t=this[Ng](t)),i&&(t=Pn(t,this,x(this,Gt,"f").getMiddleware(),!1))),t}[Wc](t={}){le(this,he,x(this,he,"f")||{},"f");let r={};r.local=x(this,he,"f").local||[],r.configObjects=x(this,he,"f").configObjects||[];let n={};r.local.forEach(o=>{n[o]=!0,(t[o]||[]).forEach(a=>{n[a]=!0})}),Object.assign(x(this,Nn,"f"),Object.keys(x(this,dr,"f")).reduce((o,a)=>{let u=x(this,dr,"f")[a].filter(c=>!(c in n));return u.length>0&&(o[a]=u),o},{})),le(this,dr,{},"f");let i=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return i.forEach(o=>{r[o]=(x(this,he,"f")[o]||[]).filter(a=>!n[a])}),s.forEach(o=>{r[o]=Xr(x(this,he,"f")[o],a=>!n[a])}),r.envPrefix=x(this,he,"f").envPrefix,le(this,he,r,"f"),le(this,be,x(this,be,"f")?x(this,be,"f").reset(n):Eg(this,x(this,Ae,"f")),"f"),le(this,He,x(this,He,"f")?x(this,He,"f").reset(n):xg(this,x(this,be,"f"),x(this,Ae,"f")),"f"),le(this,Ue,x(this,Ue,"f")?x(this,Ue,"f").reset():yg(x(this,be,"f"),x(this,He,"f"),x(this,Gt,"f"),x(this,Ae,"f")),"f"),x(this,Ht,"f")||le(this,Ht,Sg(this,x(this,be,"f"),x(this,Ue,"f"),x(this,Ae,"f")),"f"),x(this,Gt,"f").reset(),le(this,It,null,"f"),le(this,tt,"","f"),le(this,Jr,null,"f"),le(this,Nt,!1,"f"),this.parsed=!1,this}[Ug](t,r){return x(this,Ae,"f").path.relative(t,r)}[Ts](t,r,n,i=0,s=!1){let o=!!n||s;t=t||x(this,Zr,"f"),x(this,he,"f").__=x(this,Ae,"f").y18n.__,x(this,he,"f").configuration=this[$n]();let a=!!x(this,he,"f").configuration["populate--"],u=Object.assign({},x(this,he,"f").configuration,{"populate--":!0}),c=x(this,Ae,"f").Parser.detailed(t,Object.assign({},x(this,he,"f"),{configuration:{"parse-positional-numbers":!1,...u}})),f=Object.assign(c.argv,x(this,In,"f")),l,h=c.aliases,d=!1,g=!1;Object.keys(f).forEach(E=>{E===x(this,Ut,"f")&&f[E]?d=!0:E===x(this,pr,"f")&&f[E]&&(g=!0)}),f.$0=this.$0,this.parsed=c,i===0&&x(this,be,"f").clearCachedHelpMessage();try{if(this[Lc](),r)return this[Bn](f,a,!!n,!1);x(this,Ut,"f")&&[x(this,Ut,"f")].concat(h[x(this,Ut,"f")]||[]).filter(j=>j.length>1).includes(""+f._[f._.length-1])&&(f._.pop(),d=!0),le(this,Qo,!1,"f");let E=x(this,Ue,"f").getCommands(),y=x(this,Ht,"f").completionKey in f,F=d||y||s;if(f._.length){if(E.length){let _;for(let j=i||0,T;f._[j]!==void 0;j++)if(T=String(f._[j]),E.includes(T)&&T!==x(this,It,"f")){let w=x(this,Ue,"f").runCommand(T,this,c,j+1,s,d||g||s);return this[Bn](w,a,!!n,!1)}else if(!_&&T!==x(this,It,"f")){_=T;break}!x(this,Ue,"f").hasDefaultCommand()&&x(this,ea,"f")&&_&&!F&&x(this,He,"f").recommendCommands(_,E)}x(this,It,"f")&&f._.includes(x(this,It,"f"))&&!y&&(x(this,Wt,"f")&&Qr(!0),this.showCompletionScript(),this.exit(0))}if(x(this,Ue,"f").hasDefaultCommand()&&!F){let _=x(this,Ue,"f").runCommand(null,this,c,0,s,d||g||s);return this[Bn](_,a,!!n,!1)}if(y){x(this,Wt,"f")&&Qr(!0),t=[].concat(t);let _=t.slice(t.indexOf(`--${x(this,Ht,"f").completionKey}`)+1);return x(this,Ht,"f").getCompletion(_,(j,T)=>{if(j)throw new je(j.message);(T||[]).forEach(w=>{x(this,bi,"f").log(w)}),this.exit(0)}),this[Bn](f,!a,!!n,!1)}if(x(this,Nt,"f")||(d?(x(this,Wt,"f")&&Qr(!0),o=!0,this.showHelp("log"),this.exit(0)):g&&(x(this,Wt,"f")&&Qr(!0),o=!0,x(this,be,"f").showVersion("log"),this.exit(0))),!o&&x(this,he,"f").skipValidation.length>0&&(o=Object.keys(f).some(_=>x(this,he,"f").skipValidation.indexOf(_)>=0&&f[_]===!0)),!o){if(c.error)throw new je(c.error.message);if(!y){let _=this[Gc](h,{},c.error);n||(l=Pn(f,this,x(this,Gt,"f").getMiddleware(),!0)),l=this[Lg](_,l??f),Me(l)&&!n&&(l=l.then(()=>Pn(f,this,x(this,Gt,"f").getMiddleware(),!1)))}}}catch(E){if(E instanceof je)x(this,be,"f").fail(E.message,E);else throw E}return this[Bn](l??f,a,!!n,!0)}[Gc](t,r,n,i){let s={...this.getDemandedOptions()};return o=>{if(n)throw new je(n.message);x(this,He,"f").nonOptionCount(o),x(this,He,"f").requiredArguments(o,s);let a=!1;x(this,jn,"f")&&(a=x(this,He,"f").unknownCommands(o)),x(this,Ln,"f")&&!a?x(this,He,"f").unknownArguments(o,t,r,!!i):x(this,Mn,"f")&&x(this,He,"f").unknownArguments(o,t,{},!1,!1),x(this,He,"f").limitedChoices(o),x(this,He,"f").implications(o),x(this,He,"f").conflicting(o)}}[Yg](){le(this,Nt,!0,"f")}[qn](t){if(typeof t=="string")x(this,he,"f").key[t]=!0;else for(let r of t)x(this,he,"f").key[r]=!0}};function vg(e){return!!e&&typeof e.getInternalMethods=="function"}var aO=zg(Fc),Vg=aO;function Kg(e){let t=Vg(xc(e)).option({skipCheck:{type:"boolean",description:"Skip checking the validity of the feeds"},skipAuth:{type:"boolean",description:"Skip authenticating the feeds"},configFile:{alias:"c",type:"string",description:"Skip checking the validity of the feeds"}}).help().parseSync();return{skipAuth:t.skipAuth||!1,doValidCheck:!t.skipCheck,configFile:t.configFile}}var cC=Vr(RA(),1);var oC=Vr(rC(),1),wp=require("node:path"),aC=Vr(require("node:fs/promises"),1),Sp=Vr(require("node:path"),1),uC=require("node:os");var dq=e=>{try{e.startsWith("https://")||(e="https://"+e);let t=new URL(e),r=t.hostname,n=t.pathname;if(r.endsWith("dev.azure.com")){let i=n.split("/").filter(Boolean);if(i.length>=2)return{organization:i[0],project:i[1]};throw new Error("Not enough segments in path for a valid organization and project extraction.")}if(r.endsWith("visualstudio.com")){let i=r.split(".")[0],s=n.split("/").filter(Boolean);if(i&&s.length>=1)return{organization:i,project:s[0]};throw new Error("Not enough segments in path or missing subdomain for a valid organization and project extraction.")}throw new Error("URL format not recognized or does not contain enough information.")}catch{throw new Error("Invalid URL or unsupported format")}},ys=(e,t="")=>{try{let{organization:r}=dq(e);return r}catch{return t}};function _n(e){return Buffer.from(e||"").toString("base64")}var Ju=e=>Buffer.from(e,"base64").toString("utf8");var nC=Vr(require("https"),1),pq={port:443,method:"GET"},iC=async e=>new Promise((t,r)=>{let n={...pq,...e};nC.default.request(n,s=>{let o="",a={},u=s.statusCode===200;s.on("data",c=>{o+=c}),s.on("end",()=>{o&&n?.headers?.Accept==="application/json"&&(a=JSON.parse(o.toString().trim())),u?t(a||o):(a&&(a={...a,statusCode:s.statusCode}),r(a||o||new Error(`Error code: ${s.statusCode}.`)))}),s.on("error",c=>{r(new Error(c))})}).end()});var sC=async({password:e,organization:t})=>{let r=`Basic ${_n(`.:${e}`)}`,n={hostname:"feeds.dev.azure.com",port:443,path:`/${t}/_apis/packaging/feeds/1?api-version=6.1-preview.1`,method:"GET",headers:{Accept:"application/json",Authorization:r}};try{await iC(n)}catch(i){if(i.statusCode===404)return;throw i}};var Zu="me",ec="me@example.com",vs=class{constructor(t,r,n){this.id=t;this.workspaceFileName=r;let i;if(n&&Sp.default.basename(n)===this.workspaceFileName)i=Sp.default.resolve(n);else{let o=(0,oC.getWorkspaceRoot)(process.cwd())||"";i=(0,wp.join)(o,this.workspaceFileName)}this.workspaceFilePath=i;let s=process.env.HOME||process.env.USERPROFILE||(0,uC.homedir)()||"";this.userFilePath=(0,wp.join)(s,r),this.feeds=new Map}async isSupportedInRepo(){try{await aC.default.access(this.workspaceFilePath)}catch{return!1}return!0}async validateAllUsedFeeds(){await this.prepUserFile();let t=[],r=await this.getWorkspaceRegistries(),n=await this.getUserFeeds();for(let i of r){let s=n.get(i);if(s){let o=!0;try{await sC({password:s.authToken||"",organization:s.adoOrganization})}catch{o=!1}t.push({feed:s,isValid:o,fileProvider:this})}else t.push({feed:{registry:i,adoOrganization:ys(i)},isValid:!1,fileProvider:this})}return t}};var As=Vr(require("node:fs/promises"),1),rc=require("node:os");var tc=e=>{let t=new URL(e),n=t.protocol.length+2;return t.toString().slice(n)};var lC=Vr(require("node:path"),1),nc=class extends vs{constructor(t){super("NpmRc",".npmrc",t)}async prepUserFile(){try{let r=(await As.default.readFile(this.userFilePath,"utf-8")).split(rc.EOL).filter(n=>!n.includes("registry=")).join(rc.EOL);await As.default.writeFile(this.userFilePath,r)}catch{await As.default.writeFile(this.userFilePath,"")}}async getWorkspaceRegistries(){let t;try{t=new cC.default({npmPath:this.workspaceFilePath,argv:["<dummy_node>","<dummy_pnpm_js>",`--prefix=${lC.default.dirname(this.workspaceFilePath)}`],shorthands:{},definitions:{}}),await t.load()}catch(i){throw i instanceof TypeError&&i.message.includes("Invalid URL")?new Error("Registry URL missing or invalid"):new Error("Error loading .npmrc")}return Object.keys((t.data?.get("project")||{}).data||{}).filter(i=>i.includes("registry")).map(i=>t.get(i,"project")).map(i=>tc(i))}async getUserFeeds(){let t=new Map;return await this.processNpmRcFile(this.userFilePath,(r,n,i,s)=>{let o=t.get(n);switch(o||(o={registry:n,adoOrganization:ys(n)},t.set(o.registry,o)),i){case"_password":o.authToken=Ju(s).trim();break;case"username":o.userName=s;break;case"email":o.email=s;break}}),t}async patchUserNpmRcFile(t){let r=new Set(t.values()),n=await this.processNpmRcFile(this.userFilePath,(i,s,o,a)=>{let u=t.get(this.toRegistryAndFunctionKey(s,o));return u!==void 0?(r.delete(u),u):i},i=>i);for(let i of r)n.push(i);return n}toRegistryAndFunctionKey(t,r){return`//${t}:${r}=`}async writeWorspaceRegistries(t){let r=new Map;for(var n of t)r.set(this.toRegistryAndFunctionKey(n.registry,"username"),`//${n.registry}:username=${n.userName||Zu}`),r.set(this.toRegistryAndFunctionKey(n.registry,"email"),`//${n.registry}:email=${n.email||ec}`),r.set(this.toRegistryAndFunctionKey(n.registry,"_password"),`//${n.registry}:_password=${_n(n.authToken)}`);let i=await this.patchUserNpmRcFile(r);await As.default.writeFile(this.userFilePath,i.join(rc.EOL),{encoding:"utf-8"})}async processNpmRcFile(t,r,n){let s=(await As.default.readFile(t,{encoding:"utf8"})).split(`
|
|
157
|
-
`).map(a=>a.trim()),o=[];for(let a of s){let u=a.indexOf("/:");if(a.startsWith("//")&&u>=2){let c=a.substring(2,u+1),f=a.substring(u+2),l=f.substring(0,f.indexOf("=")),h=f.substring(f.indexOf("=")+1),d=r(a,c,l,h);d&&o.push(d)}else if(n){let c=n(a);c&&o.push(c)}}return o}};var mC=require("os");var ac=require("os");var fC=require("node:child_process"),hC=require("node:util"),ic=(0,hC.promisify)(fC.exec);var _p;var gq=["npm","exec","--silent","--yes","azureauth","--"],mq={...process.env,npm_config_registry:"https://registry.npmjs.org"},sc=()=>(_p||(_p=xr()?["azureauth.exe"]:gq),{command:_p,env:mq});var pC=require("child_process");var oc;var dC=async()=>{if(oc===void 0){let{command:e,env:t}=sc(),r=`${e.join(" ")} --version`;try{let n=await ic(r,{env:t}),[,i]=n.stdout.split(".");oc=parseInt(i)>=8}catch{oc=!1}}return oc};var gC=async
|
|
156
|
+
`,"f"),le(this,tt,x(this,tt,"f")+t.join(" "),"f")}}}[Nc](t){Ai(x(this,he,"f")).forEach(r=>{if((i=>i==="configObjects")(r))return;let n=x(this,he,"f")[r];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete x(this,be,"f").getDescriptions()[t]}[Pg](t,r,n){x(this,Ko,"f")[n]||(x(this,Ae,"f").process.emitWarning(t,r),x(this,Ko,"f")[n]=!0)}[Dg](){x(this,Xo,"f").push({options:x(this,he,"f"),configObjects:x(this,he,"f").configObjects.slice(0),exitProcess:x(this,Wt,"f"),groups:x(this,dr,"f"),strict:x(this,Ln,"f"),strictCommands:x(this,jn,"f"),strictOptions:x(this,Mn,"f"),completionCommand:x(this,It,"f"),output:x(this,tt,"f"),exitError:x(this,Jr,"f"),hasOutput:x(this,Nt,"f"),parsed:this.parsed,parseFn:x(this,Lt,"f"),parseContext:x(this,In,"f")}),x(this,be,"f").freeze(),x(this,He,"f").freeze(),x(this,Ue,"f").freeze(),x(this,Gt,"f").freeze()}[kg](){let t="",r;return/\b(node|iojs|electron)(\.exe)?$/.test(x(this,Ae,"f").process.argv()[0])?r=x(this,Ae,"f").process.argv().slice(1,2):r=x(this,Ae,"f").process.argv().slice(0,1),t=r.map(n=>{let i=this[Ug](x(this,kn,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&i.length<n.length?i:n}).join(" ").trim(),x(this,Ae,"f").getEnv("_")&&x(this,Ae,"f").getProcessArgvBin()===x(this,Ae,"f").getEnv("_")&&(t=x(this,Ae,"f").getEnv("_").replace(`${x(this,Ae,"f").path.dirname(x(this,Ae,"f").process.execPath())}/`,"")),t}[$n](){return x(this,Zo,"f")}[Tg](){return x(this,ta,"f")}[Lc](){if(!x(this,Tn,"f"))return;let t=x(this,Ae,"f").getEnv("LC_ALL")||x(this,Ae,"f").getEnv("LC_MESSAGES")||x(this,Ae,"f").getEnv("LANG")||x(this,Ae,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[Ig](){return this[jc]().version||"unknown"}[Ng](t){let r=t["--"]?t["--"]:t._;for(let n=0,i;(i=r[n])!==void 0;n++)x(this,Ae,"f").Parser.looksLikeNumber(i)&&Number.isSafeInteger(Math.floor(parseFloat(`${i}`)))&&(r[n]=Number(i));return t}[jc](t){let r=t||"*";if(x(this,wi,"f")[r])return x(this,wi,"f")[r];let n={};try{let i=t||x(this,Ae,"f").mainFilename;!t&&x(this,Ae,"f").path.extname(i)&&(i=x(this,Ae,"f").path.dirname(i));let s=x(this,Ae,"f").findUp(i,(o,a)=>{if(a.includes("package.json"))return"package.json"});mt(s,void 0,x(this,Ae,"f")),n=JSON.parse(x(this,Ae,"f").readFileSync(s,"utf8"))}catch{}return x(this,wi,"f")[r]=n||{},x(this,wi,"f")[r]}[en](t,r){r=[].concat(r),r.forEach(n=>{n=this[Bc](n),x(this,he,"f")[t].push(n)})}[Si](t,r,n,i){this[$c](t,r,n,i,(s,o,a)=>{x(this,he,"f")[s][o]=a})}[Mc](t,r,n,i){this[$c](t,r,n,i,(s,o,a)=>{x(this,he,"f")[s][o]=(x(this,he,"f")[s][o]||[]).concat(a)})}[$c](t,r,n,i,s){if(Array.isArray(n))n.forEach(o=>{t(o,i)});else if((o=>typeof o=="object")(n))for(let o of Ai(n))t(o,n[o]);else s(r,this[Bc](n),i)}[Bc](t){return t==="__proto__"?"___proto___":t}[qc](t,r){return this[Si](this[qc].bind(this),"key",t,r),this}[Hc](){var t,r,n,i,s,o,a,u,c,f,l,h;let d=x(this,Xo,"f").pop();mt(d,void 0,x(this,Ae,"f"));let g;t=this,r=this,n=this,i=this,s=this,o=this,a=this,u=this,c=this,f=this,l=this,h=this,{options:{set value(E){le(t,he,E,"f")}}.value,configObjects:g,exitProcess:{set value(E){le(r,Wt,E,"f")}}.value,groups:{set value(E){le(n,dr,E,"f")}}.value,output:{set value(E){le(i,tt,E,"f")}}.value,exitError:{set value(E){le(s,Jr,E,"f")}}.value,hasOutput:{set value(E){le(o,Nt,E,"f")}}.value,parsed:this.parsed,strict:{set value(E){le(a,Ln,E,"f")}}.value,strictCommands:{set value(E){le(u,jn,E,"f")}}.value,strictOptions:{set value(E){le(c,Mn,E,"f")}}.value,completionCommand:{set value(E){le(f,It,E,"f")}}.value,parseFn:{set value(E){le(l,Lt,E,"f")}}.value,parseContext:{set value(E){le(h,In,E,"f")}}.value}=d,x(this,he,"f").configObjects=g,x(this,be,"f").unfreeze(),x(this,He,"f").unfreeze(),x(this,Ue,"f").unfreeze(),x(this,Gt,"f").unfreeze()}[Lg](t,r){return Dn(r,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[jg].bind(this),getContext:this[Mg].bind(this),getHasOutput:this[$g].bind(this),getLoggerInstance:this[Bg].bind(this),getParseContext:this[qg].bind(this),getParserConfiguration:this[$n].bind(this),getUsageConfiguration:this[Tg].bind(this),getUsageInstance:this[Hg].bind(this),getValidationInstance:this[Wg].bind(this),hasParseCallback:this[ra].bind(this),isGlobalContext:this[Gg].bind(this),postProcess:this[Bn].bind(this),reset:this[Wc].bind(this),runValidation:this[Gc].bind(this),runYargsParserAndExecuteCommands:this[Ts].bind(this),setHasOutput:this[Yg].bind(this)}}[jg](){return x(this,Ue,"f")}[Mg](){return x(this,ks,"f")}[$g](){return x(this,Nt,"f")}[Bg](){return x(this,bi,"f")}[qg](){return x(this,In,"f")||{}}[Hg](){return x(this,be,"f")}[Wg](){return x(this,He,"f")}[ra](){return!!x(this,Lt,"f")}[Gg](){return x(this,Qo,"f")}[Bn](t,r,n,i){return n||Me(t)||(r||(t=this[Fg](t)),(this[$n]()["parse-positional-numbers"]||this[$n]()["parse-positional-numbers"]===void 0)&&(t=this[Ng](t)),i&&(t=Pn(t,this,x(this,Gt,"f").getMiddleware(),!1))),t}[Wc](t={}){le(this,he,x(this,he,"f")||{},"f");let r={};r.local=x(this,he,"f").local||[],r.configObjects=x(this,he,"f").configObjects||[];let n={};r.local.forEach(o=>{n[o]=!0,(t[o]||[]).forEach(a=>{n[a]=!0})}),Object.assign(x(this,Nn,"f"),Object.keys(x(this,dr,"f")).reduce((o,a)=>{let u=x(this,dr,"f")[a].filter(c=>!(c in n));return u.length>0&&(o[a]=u),o},{})),le(this,dr,{},"f");let i=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return i.forEach(o=>{r[o]=(x(this,he,"f")[o]||[]).filter(a=>!n[a])}),s.forEach(o=>{r[o]=Xr(x(this,he,"f")[o],a=>!n[a])}),r.envPrefix=x(this,he,"f").envPrefix,le(this,he,r,"f"),le(this,be,x(this,be,"f")?x(this,be,"f").reset(n):Eg(this,x(this,Ae,"f")),"f"),le(this,He,x(this,He,"f")?x(this,He,"f").reset(n):xg(this,x(this,be,"f"),x(this,Ae,"f")),"f"),le(this,Ue,x(this,Ue,"f")?x(this,Ue,"f").reset():yg(x(this,be,"f"),x(this,He,"f"),x(this,Gt,"f"),x(this,Ae,"f")),"f"),x(this,Ht,"f")||le(this,Ht,Sg(this,x(this,be,"f"),x(this,Ue,"f"),x(this,Ae,"f")),"f"),x(this,Gt,"f").reset(),le(this,It,null,"f"),le(this,tt,"","f"),le(this,Jr,null,"f"),le(this,Nt,!1,"f"),this.parsed=!1,this}[Ug](t,r){return x(this,Ae,"f").path.relative(t,r)}[Ts](t,r,n,i=0,s=!1){let o=!!n||s;t=t||x(this,Zr,"f"),x(this,he,"f").__=x(this,Ae,"f").y18n.__,x(this,he,"f").configuration=this[$n]();let a=!!x(this,he,"f").configuration["populate--"],u=Object.assign({},x(this,he,"f").configuration,{"populate--":!0}),c=x(this,Ae,"f").Parser.detailed(t,Object.assign({},x(this,he,"f"),{configuration:{"parse-positional-numbers":!1,...u}})),f=Object.assign(c.argv,x(this,In,"f")),l,h=c.aliases,d=!1,g=!1;Object.keys(f).forEach(E=>{E===x(this,Ut,"f")&&f[E]?d=!0:E===x(this,pr,"f")&&f[E]&&(g=!0)}),f.$0=this.$0,this.parsed=c,i===0&&x(this,be,"f").clearCachedHelpMessage();try{if(this[Lc](),r)return this[Bn](f,a,!!n,!1);x(this,Ut,"f")&&[x(this,Ut,"f")].concat(h[x(this,Ut,"f")]||[]).filter(j=>j.length>1).includes(""+f._[f._.length-1])&&(f._.pop(),d=!0),le(this,Qo,!1,"f");let E=x(this,Ue,"f").getCommands(),y=x(this,Ht,"f").completionKey in f,F=d||y||s;if(f._.length){if(E.length){let _;for(let j=i||0,T;f._[j]!==void 0;j++)if(T=String(f._[j]),E.includes(T)&&T!==x(this,It,"f")){let w=x(this,Ue,"f").runCommand(T,this,c,j+1,s,d||g||s);return this[Bn](w,a,!!n,!1)}else if(!_&&T!==x(this,It,"f")){_=T;break}!x(this,Ue,"f").hasDefaultCommand()&&x(this,ea,"f")&&_&&!F&&x(this,He,"f").recommendCommands(_,E)}x(this,It,"f")&&f._.includes(x(this,It,"f"))&&!y&&(x(this,Wt,"f")&&Qr(!0),this.showCompletionScript(),this.exit(0))}if(x(this,Ue,"f").hasDefaultCommand()&&!F){let _=x(this,Ue,"f").runCommand(null,this,c,0,s,d||g||s);return this[Bn](_,a,!!n,!1)}if(y){x(this,Wt,"f")&&Qr(!0),t=[].concat(t);let _=t.slice(t.indexOf(`--${x(this,Ht,"f").completionKey}`)+1);return x(this,Ht,"f").getCompletion(_,(j,T)=>{if(j)throw new je(j.message);(T||[]).forEach(w=>{x(this,bi,"f").log(w)}),this.exit(0)}),this[Bn](f,!a,!!n,!1)}if(x(this,Nt,"f")||(d?(x(this,Wt,"f")&&Qr(!0),o=!0,this.showHelp("log"),this.exit(0)):g&&(x(this,Wt,"f")&&Qr(!0),o=!0,x(this,be,"f").showVersion("log"),this.exit(0))),!o&&x(this,he,"f").skipValidation.length>0&&(o=Object.keys(f).some(_=>x(this,he,"f").skipValidation.indexOf(_)>=0&&f[_]===!0)),!o){if(c.error)throw new je(c.error.message);if(!y){let _=this[Gc](h,{},c.error);n||(l=Pn(f,this,x(this,Gt,"f").getMiddleware(),!0)),l=this[Lg](_,l??f),Me(l)&&!n&&(l=l.then(()=>Pn(f,this,x(this,Gt,"f").getMiddleware(),!1)))}}}catch(E){if(E instanceof je)x(this,be,"f").fail(E.message,E);else throw E}return this[Bn](l??f,a,!!n,!0)}[Gc](t,r,n,i){let s={...this.getDemandedOptions()};return o=>{if(n)throw new je(n.message);x(this,He,"f").nonOptionCount(o),x(this,He,"f").requiredArguments(o,s);let a=!1;x(this,jn,"f")&&(a=x(this,He,"f").unknownCommands(o)),x(this,Ln,"f")&&!a?x(this,He,"f").unknownArguments(o,t,r,!!i):x(this,Mn,"f")&&x(this,He,"f").unknownArguments(o,t,{},!1,!1),x(this,He,"f").limitedChoices(o),x(this,He,"f").implications(o),x(this,He,"f").conflicting(o)}}[Yg](){le(this,Nt,!0,"f")}[qn](t){if(typeof t=="string")x(this,he,"f").key[t]=!0;else for(let r of t)x(this,he,"f").key[r]=!0}};function vg(e){return!!e&&typeof e.getInternalMethods=="function"}var aO=zg(Fc),Vg=aO;function Kg(e){let t=Vg(xc(e)).option({skipCheck:{type:"boolean",description:"Skip checking the validity of the feeds"},skipAuth:{type:"boolean",description:"Skip authenticating the feeds"},configFile:{alias:"c",type:"string",description:"Skip checking the validity of the feeds"}}).help().parseSync();return{skipAuth:t.skipAuth||!1,doValidCheck:!t.skipCheck,configFile:t.configFile}}var cC=Vr(RA(),1);var oC=Vr(rC(),1),wp=require("node:path"),aC=Vr(require("node:fs/promises"),1),Sp=Vr(require("node:path"),1),uC=require("node:os");var dq=e=>{try{e.startsWith("https://")||(e="https://"+e);let t=new URL(e),r=t.hostname,n=t.pathname;if(r.endsWith("dev.azure.com")){let i=n.split("/").filter(Boolean);if(i.length>=2)return{organization:i[0],project:i[1]};throw new Error("Not enough segments in path for a valid organization and project extraction.")}if(r.endsWith("visualstudio.com")){let i=r.split(".")[0],s=n.split("/").filter(Boolean);if(i&&s.length>=1)return{organization:i,project:s[0]};throw new Error("Not enough segments in path or missing subdomain for a valid organization and project extraction.")}throw new Error("URL format not recognized or does not contain enough information.")}catch{throw new Error("Invalid URL or unsupported format")}},ys=(e,t="")=>{try{let{organization:r}=dq(e);return r}catch{return t}};function _n(e){return Buffer.from(e||"").toString("base64")}var Ju=e=>Buffer.from(e,"base64").toString("utf8");var nC=Vr(require("https"),1),pq={port:443,method:"GET"},iC=async e=>new Promise((t,r)=>{let n={...pq,...e};nC.default.request(n,s=>{let o="",a={},u=s.statusCode===200;s.on("data",c=>{o+=c}),s.on("end",()=>{o&&n?.headers?.Accept==="application/json"&&(a=JSON.parse(o.toString().trim())),u?t(a||o):(a&&(a={...a,statusCode:s.statusCode}),r(a||o||new Error(`Error code: ${s.statusCode}.`)))}),s.on("error",c=>{r(new Error(c))})}).end()});var sC=async({password:e,organization:t})=>{let r=`Basic ${_n(`.:${e}`)}`,n={hostname:"feeds.dev.azure.com",port:443,path:`/${t}/_apis/packaging/feeds/1?api-version=6.1-preview.1`,method:"GET",headers:{Accept:"application/json",Authorization:r}};try{await iC(n)}catch(i){if(i.statusCode===404)return;throw i}};var Zu="me",ec="me@example.com",vs=class{constructor(t,r,n){this.id=t;this.workspaceFileName=r;let i;if(n&&Sp.default.basename(n)===this.workspaceFileName)i=Sp.default.resolve(n);else{let o=(0,oC.getWorkspaceRoot)(process.cwd())||"";i=(0,wp.join)(o,this.workspaceFileName)}this.workspaceFilePath=i;let s=process.env.HOME||process.env.USERPROFILE||(0,uC.homedir)()||"";this.userFilePath=(0,wp.join)(s,r),this.feeds=new Map}async isSupportedInRepo(){try{await aC.default.access(this.workspaceFilePath)}catch{return!1}return!0}async validateAllUsedFeeds(){await this.prepUserFile();let t=[],r=await this.getWorkspaceRegistries(),n=await this.getUserFeeds();for(let i of r){let s=n.get(i);if(s){let o=!0;try{await sC({password:s.authToken||"",organization:s.adoOrganization})}catch{o=!1}t.push({feed:s,isValid:o,fileProvider:this})}else t.push({feed:{registry:i,adoOrganization:ys(i)},isValid:!1,fileProvider:this})}return t}};var As=Vr(require("node:fs/promises"),1),rc=require("node:os");var tc=e=>{let t=new URL(e),n=t.protocol.length+2;return t.toString().slice(n)};var lC=Vr(require("node:path"),1),nc=class extends vs{constructor(t){super("NpmRc",".npmrc",t)}async prepUserFile(){try{let r=(await As.default.readFile(this.userFilePath,"utf-8")).split(rc.EOL).filter(n=>!n.includes("registry=")).join(rc.EOL);await As.default.writeFile(this.userFilePath,r)}catch{await As.default.writeFile(this.userFilePath,"")}}async getWorkspaceRegistries(){let t;try{t=new cC.default({npmPath:this.workspaceFilePath,argv:["<dummy_node>","<dummy_pnpm_js>",`--prefix=${lC.default.dirname(this.workspaceFilePath)}`],shorthands:{},definitions:{}}),await t.load()}catch(i){throw i instanceof TypeError&&i.message.includes("Invalid URL")?new Error("Registry URL missing or invalid"):new Error("Error loading .npmrc")}return Object.keys((t.data?.get("project")||{}).data||{}).filter(i=>i.includes("registry")).map(i=>t.get(i,"project")).map(i=>tc(i))}async getUserFeeds(){let t=new Map;return await this.processNpmRcFile(this.userFilePath,(r,n,i,s)=>{let o=t.get(n);switch(o||(o={registry:n,adoOrganization:ys(n)},t.set(o.registry,o)),i){case"_password":o.authToken=Ju(s).trim();break;case"username":o.userName=s;break;case"email":o.email=s;break}}),t}async patchUserNpmRcFile(t){let r=new Set(t.values()),n=await this.processNpmRcFile(this.userFilePath,(i,s,o,a)=>{let u=t.get(this.toRegistryAndFunctionKey(s,o));return u!==void 0?(r.delete(u),u):i},i=>i);for(let i of r)n.push(i);return n}toRegistryAndFunctionKey(t,r){return`//${t}:${r}=`}async writeWorkspaceRegistries(t){let r=new Map;for(var n of t)r.set(this.toRegistryAndFunctionKey(n.registry,"username"),`//${n.registry}:username=${n.userName||Zu}`),r.set(this.toRegistryAndFunctionKey(n.registry,"email"),`//${n.registry}:email=${n.email||ec}`),r.set(this.toRegistryAndFunctionKey(n.registry,"_password"),`//${n.registry}:_password=${_n(n.authToken)}`);let i=await this.patchUserNpmRcFile(r);await As.default.writeFile(this.userFilePath,i.join(rc.EOL),{encoding:"utf-8"})}async processNpmRcFile(t,r,n){let s=(await As.default.readFile(t,{encoding:"utf8"})).split(`
|
|
157
|
+
`).map(a=>a.trim()),o=[];for(let a of s){let u=a.indexOf("/:");if(a.startsWith("//")&&u>=2){let c=a.substring(2,u+1),f=a.substring(u+2),l=f.substring(0,f.indexOf("=")),h=f.substring(f.indexOf("=")+1),d=r(a,c,l,h);d&&o.push(d)}else if(n){let c=n(a);c&&o.push(c)}}return o}};var mC=require("os");var ac=require("os");var fC=require("node:child_process"),hC=require("node:util"),ic=(0,hC.promisify)(fC.exec);var _p;var gq=["npm","exec","--silent","--yes","azureauth","--"],mq={...process.env,npm_config_registry:"https://registry.npmjs.org"},sc=()=>(_p||(_p=xr()?["azureauth.exe"]:gq),{command:_p,env:mq});var pC=require("child_process");var oc;var dC=async()=>{if(oc===void 0){let{command:e,env:t}=sc(),r=`${e.join(" ")} --version`;try{let n=await ic(r,{env:t}),[,i]=n.stdout.split(".");oc=parseInt(i)>=8}catch{oc=!1}}return oc};var gC=async(e,t)=>{if(!No())throw new Error(`AzureAuth is not supported for platform ${(0,ac.platform)()} and architecture ${(0,ac.arch)()}`);let{command:r,env:n}=t?{command:[t],env:process.env}:sc(),i=[...r,"ado","pat",`--prompt-hint ${xr()?e.promptHint:`"${e.promptHint}"`}`,`--organization ${e.organization}`,`--display-name ${e.displayName}`,...e.scope.map(s=>`--scope ${s}`)];e.output&&i.push(`--output ${e.output}`),e.mode&&i.push(`--mode ${e.mode}`),e.domain&&i.push(`--domain ${e.domain}`),e.timeout&&i.push(`--timeout ${e.timeout}`);try{let s;if(xr())try{if(s=(0,pC.spawnSync)(i[0],i.slice(1),{encoding:"utf-8"}),s.status===0||s.stderr&&!s.stdout)throw new Error(`Azure Auth failed with exit code ${s.status}: ${s.stderr}`)}catch(o){throw new Error(`Failed to get Ado Pat from system AzureAuth: ${o.message}`)}else try{if(s=await ic(i.join(" "),{env:n}),s.stderr&&!s.stdout)throw new Error(s.stderr)}catch(o){throw new Error(`Failed to get Ado Pat from npx AzureAuth: ${o.message}`)}if(e.output==="json")try{return JSON.parse(s.stdout)}catch{throw new Error(`Failed to parse JSON output: ${s.stdout}`)}return s.stdout}catch(s){throw await dC()?new Error(s.message):new Error(`AzureAuth is not installed: ${s}`)}};var yC=async(e,t=!1,r)=>{let n=`${(0,mC.hostname)()}-${e}`,s=(await gC({promptHint:`${n} .npmrc PAT`,organization:e,displayName:`${n}-npmrc-pat`,scope:["vso.packaging"],timeout:"30",output:"json"},r)).token;return t?_n(s):s};function vC(e,t){let r=new Map;for(var n of e){let i=t(n),s=r.get(i);s?s.push(n):r.set(i,[n])}return r}function IC(e){return typeof e>"u"||e===null}function yq(e){return typeof e=="object"&&e!==null}function vq(e){return Array.isArray(e)?e:IC(e)?[]:[e]}function Aq(e,t){var r,n,i,s;if(t)for(s=Object.keys(t),r=0,n=s.length;r<n;r+=1)i=s[r],e[i]=t[i];return e}function Eq(e,t){var r="",n;for(n=0;n<t;n+=1)r+=e;return r}function bq(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var wq=IC,Sq=yq,_q=vq,Cq=Eq,xq=bq,Oq=Aq,et={isNothing:wq,isObject:Sq,toArray:_q,repeat:Cq,isNegativeZero:xq,extend:Oq};function NC(e,t){var r="",n=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(r+=`
|
|
158
158
|
|
|
159
159
|
`+e.mark.snippet),n+" "+r):n}function Fo(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=NC(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Fo.prototype=Object.create(Error.prototype);Fo.prototype.constructor=Fo;Fo.prototype.toString=function(t){return this.name+": "+NC(this,t)};var Et=Fo;function Cp(e,t,r,n,i){var s="",o="",a=Math.floor(i/2)-1;return n-t>a&&(s=" ... ",t=n-a+s.length),r-n>a&&(o=" ...",r=n+a-o.length),{str:s+e.slice(t,r).replace(/\t/g,"\u2192")+o,pos:n-t+s.length}}function xp(e,t){return et.repeat(" ",t-e.length)+e}function Fq(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var r=/\r?\n|\r|\0/g,n=[0],i=[],s,o=-1;s=r.exec(e.buffer);)i.push(s.index),n.push(s.index+s[0].length),e.position<=s.index&&o<0&&(o=n.length-2);o<0&&(o=n.length-1);var a="",u,c,f=Math.min(e.line+t.linesAfter,i.length).toString().length,l=t.maxLength-(t.indent+f+3);for(u=1;u<=t.linesBefore&&!(o-u<0);u++)c=Cp(e.buffer,n[o-u],i[o-u],e.position-(n[o]-n[o-u]),l),a=et.repeat(" ",t.indent)+xp((e.line-u+1).toString(),f)+" | "+c.str+`
|
|
160
160
|
`+a;for(c=Cp(e.buffer,n[o],i[o],e.position,l),a+=et.repeat(" ",t.indent)+xp((e.line+1).toString(),f)+" | "+c.str+`
|
|
@@ -185,7 +185,7 @@ ${g.join(`
|
|
|
185
185
|
`+e.slice(i,s),i=s+1),o=a;return u+=`
|
|
186
186
|
`,e.length-i>t&&o>i?u+=e.slice(i,o)+`
|
|
187
187
|
`+e.slice(o+1):u+=e.slice(i),u.slice(1)}function p6(e){for(var t="",r=0,n,i=0;i<e.length;r>=65536?i+=2:i++)r=Oo(e,i),n=lt[r],!n&&Do(r)?(t+=e[i],r>=65536&&(t+=e[i+1])):t+=n||s6(r);return t}function g6(e,t,r){var n="",i=e.tag,s,o,a;for(s=0,o=r.length;s<o;s+=1)a=r[s],e.replacer&&(a=e.replacer.call(r,String(s),a)),(Hr(e,t,a,!1,!1)||typeof a>"u"&&Hr(e,t,null,!1,!1))&&(n!==""&&(n+=","+(e.condenseFlow?"":" ")),n+=e.dump);e.tag=i,e.dump="["+n+"]"}function kC(e,t,r,n){var i="",s=e.tag,o,a,u;for(o=0,a=r.length;o<a;o+=1)u=r[o],e.replacer&&(u=e.replacer.call(r,String(o),u)),(Hr(e,t+1,u,!0,!0,!1,!0)||typeof u>"u"&&Hr(e,t+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=Pp(e,t)),e.dump&&Ro===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=s,e.dump=i||"[]"}function m6(e,t,r){var n="",i=e.tag,s=Object.keys(r),o,a,u,c,f;for(o=0,a=s.length;o<a;o+=1)f="",n!==""&&(f+=", "),e.condenseFlow&&(f+='"'),u=s[o],c=r[u],e.replacer&&(c=e.replacer.call(r,u,c)),Hr(e,t,u,!1,!1)&&(e.dump.length>1024&&(f+="? "),f+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Hr(e,t,c,!1,!1)&&(f+=e.dump,n+=f));e.tag=i,e.dump="{"+n+"}"}function y6(e,t,r,n){var i="",s=e.tag,o=Object.keys(r),a,u,c,f,l,h;if(e.sortKeys===!0)o.sort();else if(typeof e.sortKeys=="function")o.sort(e.sortKeys);else if(e.sortKeys)throw new Et("sortKeys must be a boolean or a function");for(a=0,u=o.length;a<u;a+=1)h="",(!n||i!=="")&&(h+=Pp(e,t)),c=o[a],f=r[c],e.replacer&&(f=e.replacer.call(r,c,f)),Hr(e,t+1,c,!0,!0,!0)&&(l=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,l&&(e.dump&&Ro===e.dump.charCodeAt(0)?h+="?":h+="? "),h+=e.dump,l&&(h+=Pp(e,t)),Hr(e,t+1,f,!0,l)&&(e.dump&&Ro===e.dump.charCodeAt(0)?h+=":":h+=": ",h+=e.dump,i+=h));e.tag=s,e.dump=i||"{}"}function TC(e,t,r){var n,i,s,o,a,u;for(i=r?e.explicitTypes:e.implicitTypes,s=0,o=i.length;s<o;s+=1)if(a=i[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof t=="object"&&t instanceof a.instanceOf)&&(!a.predicate||a.predicate(t))){if(r?a.multi&&a.representName?e.tag=a.representName(t):e.tag=a.tag:e.tag="?",a.represent){if(u=e.styleMap[a.tag]||a.defaultStyle,lx.call(a.represent)==="[object Function]")n=a.represent(t,u);else if(fx.call(a.represent,u))n=a.represent[u](t,u);else throw new Et("!<"+a.tag+'> tag resolver accepts not "'+u+'" style');e.dump=n}return!0}return!1}function Hr(e,t,r,n,i,s,o){e.tag=null,e.dump=r,TC(e,r,!1)||TC(e,r,!0);var a=lx.call(e.dump),u=n,c;n&&(n=e.flowLevel<0||e.flowLevel>t);var f=a==="[object Object]"||a==="[object Array]",l,h;if(f&&(l=e.duplicates.indexOf(r),h=l!==-1),(e.tag!==null&&e.tag!=="?"||h||e.indent!==2&&t>0)&&(i=!1),h&&e.usedDuplicates[l])e.dump="*ref_"+l;else{if(f&&h&&!e.usedDuplicates[l]&&(e.usedDuplicates[l]=!0),a==="[object Object]")n&&Object.keys(e.dump).length!==0?(y6(e,t,e.dump,i),h&&(e.dump="&ref_"+l+e.dump)):(m6(e,t,e.dump),h&&(e.dump="&ref_"+l+" "+e.dump));else if(a==="[object Array]")n&&e.dump.length!==0?(e.noArrayIndent&&!o&&t>0?kC(e,t-1,e.dump,i):kC(e,t,e.dump,i),h&&(e.dump="&ref_"+l+e.dump)):(g6(e,t,e.dump),h&&(e.dump="&ref_"+l+" "+e.dump));else if(a==="[object String]")e.tag!=="?"&&h6(e,e.dump,t,s,u);else{if(a==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new Et("unacceptable kind of an object to dump "+a)}e.tag!==null&&e.tag!=="?"&&(c=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",e.dump=c+" "+e.dump)}return!0}function v6(e,t){var r=[],n=[],i,s;for(kp(e,r,n),i=0,s=n.length;i<s;i+=1)t.duplicates.push(r[n[i]]);t.usedDuplicates=new Array(s)}function kp(e,t,r){var n,i,s;if(e!==null&&typeof e=="object")if(i=t.indexOf(e),i!==-1)r.indexOf(i)===-1&&r.push(i);else if(t.push(e),Array.isArray(e))for(i=0,s=e.length;i<s;i+=1)kp(e[i],t,r);else for(n=Object.keys(e),i=0,s=n.length;i<s;i+=1)kp(e[n[i]],t,r)}function A6(e,t){t=t||{};var r=new a6(t);r.noRefs||v6(e,r);var n=e;return r.replacer&&(n=r.replacer.call({"":n},"",n)),Hr(r,0,n,!0,!0)?r.dump+`
|
|
188
|
-
`:""}var E6=A6,b6={dump:E6};function Mp(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var w6=it,S6=LC,_6=BC,C6=UC,x6=YC,O6=Ip,F6=cx.load,R6=cx.loadAll,P6=b6.dump,D6=Et,k6={binary:QC,float:GC,map:$C,null:qC,pairs:ZC,set:ex,timestamp:KC,bool:HC,int:WC,merge:XC,omap:JC,seq:MC,str:jC},T6=Mp("safeLoad","load"),I6=Mp("safeLoadAll","loadAll"),N6=Mp("safeDump","dump"),L6={Type:w6,Schema:S6,FAILSAFE_SCHEMA:_6,JSON_SCHEMA:C6,CORE_SCHEMA:x6,DEFAULT_SCHEMA:O6,load:F6,loadAll:R6,dump:P6,YAMLException:D6,types:k6,safeLoad:T6,safeLoadAll:I6,safeDump:N6},$p=L6;var Bp=Vr(require("node:fs/promises"),1);var pc=class extends vs{constructor(t){super("YarnRc",".yarnrc.yml",t)}async prepUserFile(){}async getUserFeeds(){let t=new Map,r=await this.paseYarnRc(this.userFilePath);if(!r)return t;let n=r.npmRegistries||{};for(var i of Object.keys(n)){let s=n[i]||{},o=i.startsWith("//")?i.substring(2):i,a={registry:o,adoOrganization:ys(o)},u=Ju(s.npmAuthIdent||""),c=u.indexOf(":");c>0&&(a.userName=u.substring(0,c),a.authToken=u.substring(c+1)),t.set(o,a)}return t}async getWorkspaceRegistries(){let t=[],r=await this.paseYarnRc(this.workspaceFilePath);if(r.npmRegistryServer&&t.push(tc(r.npmRegistryServer)),r.npmScopes)for(var n of Object.keys(r.npmScopes)){let i=r.npmScopes[n]?.npmRegistryServer;i&&t.push(i)}return t}async
|
|
188
|
+
`:""}var E6=A6,b6={dump:E6};function Mp(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var w6=it,S6=LC,_6=BC,C6=UC,x6=YC,O6=Ip,F6=cx.load,R6=cx.loadAll,P6=b6.dump,D6=Et,k6={binary:QC,float:GC,map:$C,null:qC,pairs:ZC,set:ex,timestamp:KC,bool:HC,int:WC,merge:XC,omap:JC,seq:MC,str:jC},T6=Mp("safeLoad","load"),I6=Mp("safeLoadAll","loadAll"),N6=Mp("safeDump","dump"),L6={Type:w6,Schema:S6,FAILSAFE_SCHEMA:_6,JSON_SCHEMA:C6,CORE_SCHEMA:x6,DEFAULT_SCHEMA:O6,load:F6,loadAll:R6,dump:P6,YAMLException:D6,types:k6,safeLoad:T6,safeLoadAll:I6,safeDump:N6},$p=L6;var Bp=Vr(require("node:fs/promises"),1);var pc=class extends vs{constructor(t){super("YarnRc",".yarnrc.yml",t)}async prepUserFile(){}async getUserFeeds(){let t=new Map,r=await this.paseYarnRc(this.userFilePath);if(!r)return t;let n=r.npmRegistries||{};for(var i of Object.keys(n)){let s=n[i]||{},o=i.startsWith("//")?i.substring(2):i,a={registry:o,adoOrganization:ys(o)},u=Ju(s.npmAuthIdent||""),c=u.indexOf(":");c>0&&(a.userName=u.substring(0,c),a.authToken=u.substring(c+1)),t.set(o,a)}return t}async getWorkspaceRegistries(){let t=[],r=await this.paseYarnRc(this.workspaceFilePath);if(r.npmRegistryServer&&t.push(tc(r.npmRegistryServer)),r.npmScopes)for(var n of Object.keys(r.npmScopes)){let i=r.npmScopes[n]?.npmRegistryServer;i&&t.push(i)}return t}async writeWorkspaceRegistries(t){let r=await this.paseYarnRc(this.userFilePath)||{};r.npmRegistries||(r.npmRegistries={});for(var n of t){let s="//"+n.registry,o=r.npmRegistries[s]||{};o.npmAlwaysAuth===void 0&&(o.npmAlwaysAuth=!0),o.npmAuthIdent=_n(`${n.userName}:${n.authToken}`),r.npmRegistries[s]=o}let i=$p.dump(r);await Bp.default.writeFile(this.userFilePath,i)}async paseYarnRc(t){let r=await Bp.default.readFile(t,"utf8");return $p.load(r,{filename:t})}};var bx=async e=>{let t=[new nc(e.configFile),new pc(e.configFile)],r=[];if(e.doValidCheck||e.skipAuth)for(let s of t)await s.isSupportedInRepo()&&r.push(...await s.validateAllUsedFeeds());let n=r.filter(s=>!s.isValid),i=n.length;if(e.doValidCheck&&i==0)return null;if(e.skipAuth&&i!=0)return mi({success:!1,automaticSuccess:!1,error:"invalid token(s)"},!0),console.log(i==1?"\u274C Your token is invalid.":`\u274C ${i} tokens are invalid.`),!1;try{console.log("\u{1F511} Authenticating to package feed...");let s=new Set;for(let u of n.map(c=>c.feed.adoOrganization))s.add(u);let o={};for(let u of s)o[u]=await yC(u,!1);for(let u of n){let c=u.feed,f=o[c.adoOrganization];if(!f)return console.log(`\u274C Failed to obtain pat for ${c.registry} via ${u.fileProvider.id}`),!1;c.authToken=f,c.email||(c.email=ec),c.userName||(c.userName=Zu)}let a=vC(n,u=>u.fileProvider);for(let[u,c]of a)await u.writeWorkspaceRegistries(c.map(f=>f.feed));return!0}catch(s){return mi({success:!1,automaticSuccess:!1,error:s.message},!0),console.log("Encountered error while performing auth",s),!1}};Wp()&&process.exit(0);if(!No()){let e=`Platform ${(0,gc.platform)()} and architecture ${(0,gc.arch)()} not supported for automatic authentication.`;console.log(e),mi({success:!1,error:e},!0),process.exit(0)}var j6=Kg(process.argv);bx(j6).then(e=>{e===null?(mi({success:!0}),console.log("\u2705 Current authentication is valid")):e?(mi({success:!0,automaticSuccess:!0}),console.log("\u2705 Automatic authentication successful")):(console.log("\u274C Authentication to package feed failed."),process.exitCode=1)}).catch(e=>{console.error(e),console.log("\u274C Authentication to package feed failed."),process.exitCode=1});0&&(module.exports={run});
|
|
189
189
|
/*! Bundled license information:
|
|
190
190
|
|
|
191
191
|
is-extglob/index.js:
|