ado-npm-auth 0.10.0 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ado-npm-auth.cjs +1 -1
- package/package.json +2 -2
package/dist/ado-npm-auth.cjs
CHANGED
|
@@ -98,7 +98,7 @@ ${p}`:`No matching version found for ${l}.`,g=h?"E403":"ETARGET";throw Object.as
|
|
|
98
98
|
`+e.slice(i,s),i=s+1),o=a;return u+=`
|
|
99
99
|
`,e.length-i>t&&o>i?u+=e.slice(i,o)+`
|
|
100
100
|
`+e.slice(o+1):u+=e.slice(i),u.slice(1)}function fB(e){for(var t="",r=0,n,i=0;i<e.length;r>=65536?i+=2:i++)r=is(e,i),n=et[r],!n&&us(r)?(t+=e[i],r>=65536&&(t+=e[i+1])):t+=n||rB(r);return t}function hB(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)),(Ar(e,t,a,!1,!1)||typeof a>"u"&&Ar(e,t,null,!1,!1))&&(n!==""&&(n+=","+(e.condenseFlow?"":" ")),n+=e.dump);e.tag=i,e.dump="["+n+"]"}function Ab(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)),(Ar(e,t+1,u,!0,!0,!1,!0)||typeof u>"u"&&Ar(e,t+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=Ah(e,t)),e.dump&&os===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=s,e.dump=i||"[]"}function pB(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)),Ar(e,t,u,!1,!1)&&(e.dump.length>1024&&(f+="? "),f+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Ar(e,t,c,!1,!1)&&(f+=e.dump,n+=f));e.tag=i,e.dump="{"+n+"}"}function dB(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 at("sortKeys must be a boolean or a function");for(a=0,u=o.length;a<u;a+=1)h="",(!n||i!=="")&&(h+=Ah(e,t)),c=o[a],f=r[c],e.replacer&&(f=e.replacer.call(r,c,f)),Ar(e,t+1,c,!0,!0,!0)&&(l=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,l&&(e.dump&&os===e.dump.charCodeAt(0)?h+="?":h+="? "),h+=e.dump,l&&(h+=Ah(e,t)),Ar(e,t+1,f,!0,l)&&(e.dump&&os===e.dump.charCodeAt(0)?h+=":":h+=": ",h+=e.dump,i+=h));e.tag=s,e.dump=i||"{}"}function wb(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,Jb.call(a.represent)==="[object Function]")n=a.represent(t,u);else if(Qb.call(a.represent,u))n=a.represent[u](t,u);else throw new at("!<"+a.tag+'> tag resolver accepts not "'+u+'" style');e.dump=n}return!0}return!1}function Ar(e,t,r,n,i,s,o){e.tag=null,e.dump=r,wb(e,r,!1)||wb(e,r,!0);var a=Jb.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?(dB(e,t,e.dump,i),h&&(e.dump="&ref_"+l+e.dump)):(pB(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?Ab(e,t-1,e.dump,i):Ab(e,t,e.dump,i),h&&(e.dump="&ref_"+l+e.dump)):(hB(e,t,e.dump),h&&(e.dump="&ref_"+l+" "+e.dump));else if(a==="[object String]")e.tag!=="?"&&cB(e,e.dump,t,s,u);else{if(a==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new at("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 gB(e,t){var r=[],n=[],i,s;for(bh(e,r,n),i=0,s=n.length;i<s;i+=1)t.duplicates.push(r[n[i]]);t.usedDuplicates=new Array(s)}function bh(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)bh(e[i],t,r);else for(n=Object.keys(e),i=0,s=n.length;i<s;i+=1)bh(e[n[i]],t,r)}function mB(e,t){t=t||{};var r=new iB(t);r.noRefs||gB(e,r);var n=e;return r.replacer&&(n=r.replacer.call({"":n},"",n)),Ar(r,0,n,!0,!0)?r.dump+`
|
|
101
|
-
`:""}var yB=mB,AB={dump:yB};function xh(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 wB=ze,bB=_b,EB=xb,_B=Lb,vB=Db,SB=_h,CB=Xb.load,xB=Xb.loadAll,PB=AB.dump,OB=at,RB={binary:$b,float:Fb,map:Cb,null:Pb,pairs:Mb,set:jb,timestamp:Nb,bool:Ob,int:Rb,merge:Ib,omap:Bb,seq:Sb,str:vb},FB=xh("safeLoad","load"),LB=xh("safeLoadAll","loadAll"),DB=xh("safeDump","dump"),Ph={Type:wB,Schema:bB,FAILSAFE_SCHEMA:EB,JSON_SCHEMA:_B,CORE_SCHEMA:vB,DEFAULT_SCHEMA:SB,load:CB,loadAll:xB,dump:PB,YAMLException:OB,types:RB,safeLoad:FB,safeLoadAll:LB,safeDump:DB};var uE=Ve(require("node:fs/promises"),1);var Aa=e=>{let t=new URL(e),n=t.protocol.length+2;return t.toString().slice(n)};var Oh=Ve(require("node:fs/promises"),1);async function gi(e,t){try{if(await Oh.default.readFile(e,{encoding:"utf-8"})===t)return}catch{}await Oh.default.writeFile(e,t,{encoding:"utf-8"})}var wa=class extends li{constructor(t){super("YarnRc",".yarnrc.yml",t)}async prepUserFile(){try{let t=await this.paseYarnRc(this.userFilePath);t&&t.npmRegistryServer&&(delete t.npmRegistryServer,await this.writeYarnRc(this.userFilePath,t))}catch{await gi(this.userFilePath,"")}}async getUserFeeds(){let t=new Map,r=await this.paseYarnRc(this.userFilePath);if(!r)return t;let n=r.npmRegistries||{};for(let i of Object.keys(n)){let s=n[i]||{},o=i.startsWith("//")?i.substring(2):i,a={registry:o,adoOrganization:ci(o)},u=ua(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(){var t;let r=[],n=await this.paseYarnRc(this.workspaceFilePath);if(n.npmRegistryServer&&r.push(Aa(n.npmRegistryServer)),n.npmScopes)for(let i of Object.keys(n.npmScopes)){let s=(t=n.npmScopes[i])===null||t===void 0?void 0:t.npmRegistryServer;s&&r.push(s)}return r}async writeWorkspaceRegistries(t){let r=await this.paseYarnRc(this.userFilePath)||{};r.npmRegistries||(r.npmRegistries={});for(let n of t){let i="//"+n.registry,s=r.npmRegistries[i]||{};s.npmAlwaysAuth===void 0&&(s.npmAlwaysAuth=!0),s.npmAuthIdent=Wr(`${n.userName}:${n.authToken}`),r.npmRegistries[i]=s}await this.writeYarnRc(this.userFilePath,r)}async writeYarnRc(t,r){let n=Ph.dump(r);await gi(t,n)}async paseYarnRc(t){let r=await uE.default.readFile(t,"utf8");return Ph.load(r,{filename:t})}};var Ux=Ve(Wx(),1);var Tu=Ve(require("node:fs/promises"),1),ku=require("node:os");var Gx=Ve(require("node:path"),1);var Nu=class extends li{constructor(t){super("NpmRc",".npmrc",t)}async prepUserFile(){try{let r=(await Tu.default.readFile(this.userFilePath,"utf-8")).split(ku.EOL).filter(n=>!n.includes("registry=")).join(ku.EOL);await gi(this.userFilePath,r)}catch{await gi(this.userFilePath,"")}}async getWorkspaceRegistries(){var t;let r;try{r=new Ux.default({npmPath:this.workspaceFilePath,argv:["<dummy_node>","<dummy_pnpm_js>",`--prefix=${Gx.default.dirname(this.workspaceFilePath)}`],shorthands:{},definitions:{}}),await r.load()}catch(s){throw s instanceof TypeError&&s.message.includes("Invalid URL")?new Error("Registry URL missing or invalid"):new Error("Error loading .npmrc")}return Object.keys((((t=r.data)===null||t===void 0?void 0:t.get("project"))||{}).data||{}).filter(s=>s.
|
|
101
|
+
`:""}var yB=mB,AB={dump:yB};function xh(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 wB=ze,bB=_b,EB=xb,_B=Lb,vB=Db,SB=_h,CB=Xb.load,xB=Xb.loadAll,PB=AB.dump,OB=at,RB={binary:$b,float:Fb,map:Cb,null:Pb,pairs:Mb,set:jb,timestamp:Nb,bool:Ob,int:Rb,merge:Ib,omap:Bb,seq:Sb,str:vb},FB=xh("safeLoad","load"),LB=xh("safeLoadAll","loadAll"),DB=xh("safeDump","dump"),Ph={Type:wB,Schema:bB,FAILSAFE_SCHEMA:EB,JSON_SCHEMA:_B,CORE_SCHEMA:vB,DEFAULT_SCHEMA:SB,load:CB,loadAll:xB,dump:PB,YAMLException:OB,types:RB,safeLoad:FB,safeLoadAll:LB,safeDump:DB};var uE=Ve(require("node:fs/promises"),1);var Aa=e=>{let t=new URL(e),n=t.protocol.length+2;return t.toString().slice(n)};var Oh=Ve(require("node:fs/promises"),1);async function gi(e,t){try{if(await Oh.default.readFile(e,{encoding:"utf-8"})===t)return}catch{}await Oh.default.writeFile(e,t,{encoding:"utf-8"})}var wa=class extends li{constructor(t){super("YarnRc",".yarnrc.yml",t)}async prepUserFile(){try{let t=await this.paseYarnRc(this.userFilePath);t&&t.npmRegistryServer&&(delete t.npmRegistryServer,await this.writeYarnRc(this.userFilePath,t))}catch{await gi(this.userFilePath,"")}}async getUserFeeds(){let t=new Map,r=await this.paseYarnRc(this.userFilePath);if(!r)return t;let n=r.npmRegistries||{};for(let i of Object.keys(n)){let s=n[i]||{},o=i.startsWith("//")?i.substring(2):i,a={registry:o,adoOrganization:ci(o)},u=ua(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(){var t;let r=[],n=await this.paseYarnRc(this.workspaceFilePath);if(n.npmRegistryServer&&r.push(Aa(n.npmRegistryServer)),n.npmScopes)for(let i of Object.keys(n.npmScopes)){let s=(t=n.npmScopes[i])===null||t===void 0?void 0:t.npmRegistryServer;s&&r.push(s)}return r}async writeWorkspaceRegistries(t){let r=await this.paseYarnRc(this.userFilePath)||{};r.npmRegistries||(r.npmRegistries={});for(let n of t){let i="//"+n.registry,s=r.npmRegistries[i]||{};s.npmAlwaysAuth===void 0&&(s.npmAlwaysAuth=!0),s.npmAuthIdent=Wr(`${n.userName}:${n.authToken}`),r.npmRegistries[i]=s}await this.writeYarnRc(this.userFilePath,r)}async writeYarnRc(t,r){let n=Ph.dump(r);await gi(t,n)}async paseYarnRc(t){let r=await uE.default.readFile(t,"utf8");return Ph.load(r,{filename:t})}};var Ux=Ve(Wx(),1);var Tu=Ve(require("node:fs/promises"),1),ku=require("node:os");var Gx=Ve(require("node:path"),1);var Nu=class extends li{constructor(t){super("NpmRc",".npmrc",t)}async prepUserFile(){try{let r=(await Tu.default.readFile(this.userFilePath,"utf-8")).split(ku.EOL).filter(n=>!n.includes("registry=")).join(ku.EOL);await gi(this.userFilePath,r)}catch{await gi(this.userFilePath,"")}}async getWorkspaceRegistries(){var t;let r;try{r=new Ux.default({npmPath:this.workspaceFilePath,argv:["<dummy_node>","<dummy_pnpm_js>",`--prefix=${Gx.default.dirname(this.workspaceFilePath)}`],shorthands:{},definitions:{}}),await r.load()}catch(s){throw s instanceof TypeError&&s.message.includes("Invalid URL")?new Error("Registry URL missing or invalid"):new Error("Error loading .npmrc")}return Object.keys((((t=r.data)===null||t===void 0?void 0:t.get("project"))||{}).data||{}).filter(s=>s==="registry"||s.endsWith(":registry")).map(s=>r.get(s,"project")).map(s=>Aa(s))}async getUserFeeds(){let t=new Map;return await this.processFeeds(this.userFilePath,t),await this.processFeeds(this.workspaceFilePath,t),t}async processFeeds(t,r){await this.processNpmRcFile(t,(n,i,s,o)=>{let a=r.get(i);switch(a||(a={registry:i,adoOrganization:ci(i)},r.set(a.registry,a)),s){case"_password":case"_auth":a.authToken=ua(o).trim();break;case"_authToken":a.authToken=o.trim();break;case"username":a.userName=o;break;case"email":a.email=o;break}})}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(let i of t)r.set(this.toRegistryAndFunctionKey(i.registry,"username"),`//${i.registry}:username=${i.userName||la}`),r.set(this.toRegistryAndFunctionKey(i.registry,"email"),`//${i.registry}:email=${i.email||fa}`),r.set(this.toRegistryAndFunctionKey(i.registry,"_password"),`//${i.registry}:_password=${Wr(i.authToken)}`);let n=await this.patchUserNpmRcFile(r);await Tu.default.writeFile(this.userFilePath,n.join(ku.EOL),{encoding:"utf-8"})}async processNpmRcFile(t,r,n){let s=(await Tu.default.readFile(t,{encoding:"utf8"})).split(`
|
|
102
102
|
`).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),p=r(a,c,l,h);p&&o.push(p)}else if(n){let c=n(a);c&&o.push(c)}}return o}};var Zs=require("node:os");var Wu=require("node:os"),Yx=require("node:child_process");var Iu=require("node:child_process"),Hx=require("node:util"),$u=(0,Hx.promisify)(Iu.exec);function kd(e,t,r){return new Promise((n,i)=>{var s,o,a,u;let c=r?.cwd||process.cwd();console.log(`\u{1F680} Launching [${e} ${t.join(" ")}] in ${c}`);let f=(0,Iu.spawn)(e,t,{cwd:c,env:r?.env||process.env,stdio:r?.stdio||"inherit",shell:r?.shell||!1});r?.stdio==="pipe"&&((s=f.stdout)===null||s===void 0||s.setEncoding("utf8"),(o=f.stdout)===null||o===void 0||o.on("data",function(l){var h;let p=l.toString("utf8");(h=r?.processStdOut)===null||h===void 0||h.call(r,p)}),(a=f.stderr)===null||a===void 0||a.setEncoding("utf8"),(u=f.stderr)===null||u===void 0||u.on("data",function(l){var h;let p=l.toString("utf8");(h=r?.processStdErr)===null||h===void 0||h.call(r,p)})),f.on("exit",l=>{l==0?n():i(new Error(`Process ${e} exited with code ${l}`))})})}var Js=require("node:os");var Bu=require("node:os"),Cr=()=>(0,Bu.platform)()==="linux"&&(0,Bu.release)().toLowerCase().includes("wsl");var Mu=()=>{let e={win32:["x64"],darwin:["x64","arm64"]};return Cr()||e[(0,Js.platform)()]&&e[(0,Js.platform)()].includes((0,Js.arch)())};var Nd;var o8=["npm","exec","--silent","--yes","azureauth","--"],a8={...process.env,npm_config_registry:"https://registry.npmjs.org"},ju=()=>(Nd||(Nd=Cr()?["azureauth.exe"]:o8),{command:Nd,env:a8});var qu;var zx=async()=>{if(qu===void 0){let{command:e,env:t}=ju(),r=`${e.join(" ")} --version`;try{let n=await $u(r,{env:t}),[,i]=n.stdout.split(".");qu=parseInt(i)>=8}catch{qu=!1}}return qu};var Vx=async(e,t)=>{if(!Mu())throw new Error(`AzureAuth is not supported for platform ${(0,Wu.platform)()} and architecture ${(0,Wu.arch)()}`);let{command:r,env:n}=t?{command:[t],env:process.env}:ju(),i=[...r,"ado","pat",`--prompt-hint ${Cr()?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(Cr())try{if(s=(0,Yx.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 $u(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 zx()?new Error(s.message):new Error(`AzureAuth is not installed: ${s}`)}};var Uu=Ve(require("node:os"),1),Gu=Ve(require("node:fs"),1),Qs=Ve(require("node:path"),1);var Kx="1.4.1",$d=Qs.default.resolve("..",".bin","CredentialProvider.Microsoft","v"+Kx);async function Xx(e){let t=u8(e),r=await l8();return await c8(r,t)}function u8(e){if(!e.endsWith("/npm/registry/"))throw new Error(`Registry URL ${e} is not a valid Azure Artifacts npm registry URL. Expected it to end with '/npm/registry/'`);return"https://"+e.replace("/npm/registry/","/nuget/v3/index.json")}async function c8(e,t){let r="";await kd(e,["-U",t,"-I","-F","Json"],{stdio:"pipe",processStdOut:n=>{r+=n},processStdErr:n=>{console.error(n)}});try{return JSON.parse(r)}catch{throw new Error(`Failed to parse CredentialProvider output: ${r}`)}}function Id(e){if(Gu.default.existsSync(e))return e;if(Gu.default.existsSync(e+".exe"))return e+".exe"}async function l8(){let e=Id(Qs.default.join(Uu.default.homedir(),".nuget","plugins","netcore","CredentialProvider.Microsoft","CredentialProvider.Microsoft"));if(e)return e;let t=Qs.default.join($d,"plugins","netcore","CredentialProvider.Microsoft","CredentialProvider.Microsoft");if(e=Id(t),e)return e;if(await f8(),e=Id(t),e)Gu.default.chmodSync(e,493);else throw new Error(`CredentialProvider was not found at expected path after download: ${e}`);return e}async function f8(){let e=`https://github.com/microsoft/artifacts-credprovider/releases/download/v${Kx}/Microsoft.Net8.${Uu.default.platform()}-${Uu.default.arch()}.NuGet.CredentialProvider.tar.gz`,t=Qs.default.join($d,"CredentialProvider.Microsoft.tar.gz");console.log(`\u{1F310} Downloading ${e}`),await lh(e,t),await kd("tar",["-xzf",t,"-C",$d],{stdio:"inherit"})}var Jx=async(e,t,r=!1,n)=>{let i=`${(0,Zs.hostname)()}-${e}`,s=await h8(i,e,t,n);return r?Wr(s):s};async function h8(e,t,r,n){let i="vso.packaging_write";switch((0,Zs.platform)()){case"win32":case"darwin":return(await Vx({promptHint:`Authenticate to ${t} to generate a temporary token for npm`,organization:t,displayName:e,scope:[i],timeout:"30",output:"json"},n)).token;case"linux":return(await Xx(r)).Password;default:throw new Error(`Platform ${(0,Zs.platform)()} is not supported for ADO authentication`)}}function Qx(e,t){let r=new Map;for(let n of e){let i=t(n),s=r.get(i);s?s.push(n):r.set(i,[n])}return r}var Hu=require("node:os");var Ri=(e,t,r)=>{let n=new Map;n.set("success",e.success?"true":"false"),n.set("automaticSuccess",e.automaticSuccess?"true":"false"),n.set("error",e.error||""),n.set("platform",Cr()?"wsl":(0,Hu.platform)()),n.set("arch",(0,Hu.arch)()),r&&(r.LogEvent("node-azure-auth",n),t&&r.flush())};var hc=require("node:os"),oo=Ve(require("node:process"),1);var p8=[!0,"true","TRUE",1],Zx=()=>{let e=process.env.CODESPACES||"";return p8.includes(e)};var Zu=require("assert");var d8={right:w8,center:b8},g8=0,zu=1,m8=2,Yu=3,Bd=class{constructor(t){var r;this.width=t.width,this.wrap=(r=t.wrap)!==null&&r!==void 0?r:!0,this.rows=[]}span(...t){let r=this.div(...t);r.span=!0}resetOutput(){this.rows=[]}div(...t){if(t.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...t)&&typeof t[0]=="string")return this.applyLayoutDSL(t[0]);let r=t.map(n=>typeof n=="string"?this.colFromString(n):n);return this.rows.push(r),r}shouldApplyLayoutDSL(...t){return t.length===1&&typeof t[0]=="string"&&/[\t\n]/.test(t[0])}applyLayoutDSL(t){let r=t.split(`
|
|
103
103
|
`).map(i=>i.split(" ")),n=0;return r.forEach(i=>{i.length>1&&xt.stringWidth(i[0])>n&&(n=Math.min(Math.floor(this.width*.5),xt.stringWidth(i[0])))}),r.forEach(i=>{this.div(...i.map((s,o)=>({text:s.trim(),padding:this.measurePadding(s),width:o===0&&i.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(t){return{text:t,padding:this.measurePadding(t)}}measurePadding(t){let r=xt.stripAnsi(t);return[0,r.match(/\s*$/)[0].length,0,r.match(/^\s*/)[0].length]}toString(){let t=[];return this.rows.forEach(r=>{this.rowToString(r,t)}),t.filter(r=>!r.hidden).map(r=>r.text).join(`
|
|
104
104
|
`)}rowToString(t,r){return this.rasterize(t).forEach((n,i)=>{let s="";n.forEach((o,a)=>{let{width:u}=t[a],c=this.negatePadding(t[a]),f=o;if(c>xt.stringWidth(o)&&(f+=" ".repeat(c-xt.stringWidth(o))),t[a].align&&t[a].align!=="left"&&this.wrap){let h=d8[t[a].align];f=h(f,c),xt.stringWidth(f)<c&&(f+=" ".repeat((u||0)-xt.stringWidth(f)-1))}let l=t[a].padding||[0,0,0,0];l[Yu]&&(s+=" ".repeat(l[Yu])),s+=eP(t[a],f,"| "),s+=f,s+=eP(t[a],f," |"),l[zu]&&(s+=" ".repeat(l[zu])),i===0&&r.length>0&&(s=this.renderInline(s,r[r.length-1]))}),r.push({text:s.replace(/ +$/,""),span:t.span})}),r}renderInline(t,r){let n=t.match(/^ */),i=n?n[0].length:0,s=r.text,o=xt.stringWidth(s.trimRight());return r.span?this.wrap?i<o?t:(r.hidden=!0,s.trimRight()+" ".repeat(i-o)+t.trimLeft()):(r.hidden=!0,s+t):t}rasterize(t){let r=[],n=this.columnWidths(t),i;return t.forEach((s,o)=>{s.width=n[o],this.wrap?i=xt.wrap(s.text,this.negatePadding(s),{hard:!0}).split(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ado-npm-auth",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "The ado-npm-auth package can automatically use the azureauth CLI to fetch tokens and update a user's .npmrc file for authenticating to ADO package feeds.",
|
|
5
5
|
"repository": "https://github.com/microsoft/ado-npm-auth",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"azureauth": "^0.14.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@microsoft/ado-npm-auth-lib": "^0.
|
|
27
|
+
"@microsoft/ado-npm-auth-lib": "^0.10.0",
|
|
28
28
|
"@microsoft/eslint-plugin-sdl": "^1.1.0",
|
|
29
29
|
"@types/node": "^20.17.28",
|
|
30
30
|
"esbuild": "^0.27.0",
|