Files
setup-pnpm/dist/index.js

10 lines
1.4 MiB
JavaScript
Raw Normal View History

(()=>{var __webpack_modules__={64928:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.restoreCache=restoreCache;const i=n(18715);const o=n(59999);const d=n(93573);async function restoreCache(e){if(!e.cache)return;if(!(0,i.isFeatureAvailable)()){(0,o.warning)("Cache is not available, skipping cache restoration");return}(0,o.startGroup)("Restoring cache...");await(0,d.runRestoreCache)(e);(0,o.endGroup)()}t["default"]=restoreCache},93573:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.runRestoreCache=runRestoreCache;const o=n(18715);const d=n(59999);const p=n(58872);const f=n(8505);const y=i(n(70857));async function runRestoreCache(e){const t=await getCacheDirectory();(0,d.saveState)("cache_path",t);const n=await(0,f.hashFiles)(e.cacheDependencyPath);if(!n){throw new Error("Some specified paths were not resolved, unable to cache dependencies.")}const i=`pnpm-cache-${process.env.RUNNER_OS}-${y.default.arch()}-${n}`;(0,d.debug)(`Primary key is ${i}`);(0,d.saveState)("cache_primary_key",i);let p=await(0,o.restoreCache)([t],i);(0,d.setOutput)("cache-hit",Boolean(p));if(!p){(0,d.info)(`Cache is not found`);return}(0,d.saveState)("cache_restored_key",p);(0,d.info)(`Cache restored from key: ${p}`)}async function getCacheDirectory(){const{stdout:e}=await(0,p.getExecOutput)("pnpm store path --silent");const t=e.trim();(0,d.debug)(`Cache folder is set to "${t}"`);return t}},26171:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.saveCache=saveCache;const i=n(59999);const o=n(98086);async function saveCache(e){if(!e.cache)return;try{await(0,o.runSaveCache)()}catch(e){(0,i.setFailed)(e.message)}}t["default"]=saveCache},98086:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.runSaveCache=runSaveCache;const i=n(18715);const o=n(59999);async function runSaveCache(){const e=(0,o.getState)("cache_restored_key");const t=(0,o.getState)("cache_primary_key");const n=(0,o.getState)("cache_path");if(t===e){(0,o.info)(`Cache hit occurred on the primary key ${t}, not saving cache.`);return}const d=await(0,i.saveCache)([n],t);if(d==-1)return;(0,o.info)(`Cache saved with the key: ${t}`)}},21046:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const o=n(59999);const d=i(n(64928));const p=i(n(26171));const f=i(n(66414));const y=i(n(13144));const v=i(n(9596));const D=i(n(4728));const M=i(n(96879));async function main(){const e=(0,f.default)();if((0,o.getState)("is_post")==="true"){await runPost(e)}else{await runMain(e)}}async function runMain(e){(0,o.saveState)("is_post","true");await(0,y.default)(e);console.log("Installation Completed!");(0,v.default)(e);await(0,d.default)(e);(0,D.default)(e)}async function runPost(e){(0,M.default)(e);await(0,p.default)(e)}main().catch((e=>{console.error(e);(0,o.setFailed)(e)}))},66414:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.getInputs=void 0;const o=n(59999);const d=i(n(66746));const p=n(9065);const f={required:true};const parseInputPath=e=>(0,d.default)((0,o.getInput)(e,f));const getInputs=()=>({version:(0,o.getInput)("version"),dest:parseInputPath("dest"),cache:(0,o.getBooleanInput)("cache"),cacheDependencyPath:parseInputPath("cache_dependency_path"),runInstall:(0,p.parseRunInstall)("run_install"),packageJsonFile:parseInputPath("package_json_file"),standalone:(0,o.getBooleanInput)("standalone")});t.getInputs=getInputs;t["default"]=t.getInputs},9065:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){if(i===undefined)i=n;var o=Object.getOwnPropertyDescriptor(t,n);if(!o||("get"in o?!t.__esModule:o.writable||o.configurable)){o={enumerable:true,get:function(){return t[n]}}}Object.defineProperty(e,i,o)}:function(e,t,n,i){if(i===undefined)i=n;e[i]=t
2022-02-22 12:26:05 +08:00
/*!
* expand-tilde <https://github.com/jonschlinkert/expand-tilde>
*
* Copyright (c) 2015 Jon Schlinkert.
* Licensed under the MIT license.
*/
var i=n(39048);var o=n(16928);e.exports=function expandTilde(e){var t=i();if(e.charCodeAt(0)===126){if(e.charCodeAt(1)===43){return o.join(process.cwd(),e.slice(2))}return t?o.join(t,e.slice(1)):e}return e}},39048:(e,t,n)=>{"use strict";var i=n(70857);if(typeof i.homedir!=="undefined"){e.exports=i.homedir}else{e.exports=n(58873)}},58873:(e,t,n)=>{"use strict";var i=n(79896);var o=n(37393);function homedir(){if(process.platform==="win32"){if(process.env.USERPROFILE){return process.env.USERPROFILE}if(process.env.HOMEDRIVE&&process.env.HOMEPATH){return process.env.HOMEDRIVE+process.env.HOMEPATH}if(process.env.HOME){return process.env.HOME}return null}if(process.env.HOME){return process.env.HOME}var e=tryReadFileSync("/etc/passwd");var t=find(o(e),getuid());if(t){return t}var n=process.env.LOGNAME||process.env.USER||process.env.LNAME||process.env.USERNAME;if(!n){return null}if(process.platform==="darwin"){return"/Users/"+n}return"/home/"+n}function find(e,t){var n=e.length;for(var i=0;i<n;i++){if(+e[i].uid===t){return e[i].homedir}}}function getuid(){if(typeof process.geteuid==="function"){return process.geteuid()}return process.getuid()}function tryReadFileSync(e){try{return i.readFileSync(e,"utf8")}catch(e){return""}}e.exports=homedir},64702:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){if(i===undefined)i=n;var o=Object.getOwnPropertyDescriptor(t,n);if(!o||("get"in o?!t.__esModule:o.writable||o.configurable)){o={enumerable:true,get:function(){return t[n]}}}Object.defineProperty(e,i,o)}:function(e,t,n,i){if(i===undefined)i=n;e[i]=t[n]});var o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var d=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)if(n!=="default"&&Object.prototype.hasOwnProperty.call(e,n))i(t,e,n);o(t,e);return t};var p=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.HttpProxyAgent=void 0;const f=d(n(69278));const y=d(n(64756));const v=p(n(69592));const D=n(24434);const M=n(83249);const U=n(87016);const j=(0,v.default)("http-proxy-agent");class HttpProxyAgent extends M.Agent{constructor(e,t){super(t);this.proxy=typeof e==="string"?new U.URL(e):e;this.proxyHeaders=t?.headers??{};j("Creating new HttpProxyAgent instance: %o",this.proxy.href);const n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,"");const i=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={...t?omit(t,"headers"):null,host:n,port:i}}addRequest(e,t){e._header=null;this.setRequestProps(e,t);super.addRequest(e,t)}setRequestProps(e,t){const{proxy:n}=this;const i=t.secureEndpoint?"https:":"http:";const o=e.getHeader("host")||"localhost";const d=`${i}//${o}`;const p=new U.URL(e.path,d);if(t.port!==80){p.port=String(t.port)}e.path=String(p);const f=typeof this.proxyHeaders==="function"?this.proxyHeaders():{...this.proxyHeaders};if(n.username||n.password){const e=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;f["Proxy-Authorization"]=`Basic ${Buffer.from(e).toString("base64")}`}if(!f["Proxy-Connection"]){f["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close"}for(const t of Object.keys(f)){const n=f[t];if(n){e.setHeader(t,n)}}}async connect(e,t){e._header=null;if(!e.path.includes("://")){this.setRequestProps(e,t)}let n;let i;j("Regenerating stored HTTP header string for request");e._implicitHeader();if(e.outputData&&e.outputData.length>0){j("Patching connection write() output buffer with updated header");n=e.outputData[0].data;i=n.indexOf("\r\n\r\n")+4;e.outputData[0].data=e._header+n.substring(i);j("Output buffer: %o",e.outputData[0].data)}let o;if(this.proxy.protocol==="https:"){j("Creating `tls.Socket`: %o",this.connectOpts);o=y.connect(this.connectOpts)}else{j("Creating `net.Socket`: %o",this.connectOpts);o=f.connect(this.connectOpts)}await(0,D.once)(o,"connect");return o}}HttpProx
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */;const escape=e=>e.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22");const normalizeLinefeeds=e=>e.replace(/\r?\n|\r/g,"\r\n");const i=[];const o=new Uint8Array([13,10]);M=0;let d=false;for(const[t,p]of e){if(typeof p==="string"){const e=pe.encode(n+`; name="${escape(normalizeLinefeeds(t))}"`+`\r\n\r\n${normalizeLinefeeds(p)}\r\n`);i.push(e);M+=e.byteLength}else{const e=pe.encode(`${n}; name="${escape(normalizeLinefeeds(t))}"`+(p.name?`; filename="${escape(p.name)}"`:"")+"\r\n"+`Content-Type: ${p.type||"application/octet-stream"}\r\n\r\n`);i.push(e,p,o);if(typeof p.size==="number"){M+=e.byteLength+p.size+o.byteLength}else{d=true}}}const p=pe.encode(`--${t}--`);i.push(p);M+=p.byteLength;if(d){M=null}D=e;v=async function*(){for(const e of i){if(e.stream){yield*e.stream()}else{yield e}}};U="multipart/form-data; boundary="+t}else if(p(e)){D=e;M=e.size;if(e.type){U=e.type}}else if(typeof e[Symbol.asyncIterator]==="function"){if(t){throw new TypeError("keepalive")}if(o.isDisturbed(e)||e.locked){throw new TypeError("Response body object should not be disturbed or locked")}i=e instanceof ue?e:d(e)}if(typeof D==="string"||o.isBuffer(D)){M=Buffer.byteLength(D)}if(v!=null){let t;i=new ue({async start(){t=v(e)[Symbol.asyncIterator]()},async pull(e){const{value:n,done:o}=await t.next();if(o){queueMicrotask((()=>{e.close()}))}else{if(!se(i)){e.enqueue(new Uint8Array(n))}}return e.desiredSize>0},async cancel(e){await t.return()},type:undefined})}const j={stream:i,source:D,length:M};return[j,U]}function safelyExtractBody(e,t=false){if(!ue){ue=n(63774).ReadableStream}if(e instanceof ue){ne(!o.isDisturbed(e),"The body has already been consumed.");ne(!e.locked,"The stream is locked.")}return extractBody(e,t)}function cloneBody(e){const[t,n]=e.stream.tee();const i=K(n,{transfer:[n]});const[,o]=i.tee();e.stream=t;return{stream:o,length:e.length,source:e.source}}async function*consumeBody(e){if(e){if(ie(e)){yield e}else{const t=e.stream;if(o.isDisturbed(t)){throw new TypeError("The body has already been consumed.")}if(t.locked){throw new TypeError("The stream is locked.")}t[re]=true;yield*t}}}function throwIfAborted(e){if(e.aborted){throw new V("The operation was aborted.","AbortError")}}function bodyMixinMethods(e){const t={blob(){return specConsumeBody(this,(e=>{let t=bodyMimeType(this);if(t==="failure"){t=""}else if(t){t=ce(t)}return new ee([e],{type:t})}),e)},arrayBuffer(){return specConsumeBody(this,(e=>new Uint8Array(e).buffer),e)},text(){return specConsumeBody(this,utf8DecodeBytes,e)},json(){return specConsumeBody(this,parseJSONFromBytes,e)},async formData(){j.brandCheck(this,e);throwIfAborted(this[U]);const t=this.headers.get("Content-Type");if(/multipart\/form-data/.test(t)){const e={};for(const[t,n]of this.headers)e[t.toLowerCase()]=n;const t=new M;let n;try{n=new i({headers:e,preservePath:true})}catch(e){throw new V(`${e}`,"AbortError")}n.on("field",((e,n)=>{t.append(e,n)}));n.on("file",((e,n,i,o,d)=>{const p=[];if(o==="base64"||o.toLowerCase()==="base64"){let o="";n.on("data",(e=>{o+=e.toString().replace(/[\r\n]/gm,"");const t=o.length-o.length%4;p.push(Buffer.from(o.slice(0,t),"base64"));o=o.slice(t)}));n.on("end",(()=>{p.push(Buffer.from(o,"base64"));t.append(e,new de(p,i,{type:d}))}))}else{n.on("data",(e=>{p.push(e)}));n.on("end",(()=>{t.append(e,new de(p,i,{type:d}))}))}}));const o=new Promise(((e,t)=>{n.on("finish",e);n.on("error",(e=>t(new TypeError(e))))}));if(this.body!==null)for await(const e of consumeBody(this[U].body))n.write(e);n.end();await o;return t}else if(/application\/x-www-form-urlencoded/.test(t)){let e;try{let t="";const n=new TextDecoder("utf-8",{ignoreBOM:true});for await(const e of consumeBody(this[U].body)){if(!ie(e)){throw new TypeError("Expected Uint8Array chunk")}t+=n.decode(e,{stream:true})}t+=n.decode();e=new URLSearchParams(t)}catch(e){throw Object.assign(new TypeError,{cause:e})}const t=new M;for(const[n,i]of e){t.append(n,i)}return t}else{await Promise.resolve();throwIfAborted(this[U]);throw j.e
/*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */d[o-4]=this.maskKey[0];d[o-3]=this.maskKey[1];d[o-2]=this.maskKey[2];d[o-1]=this.maskKey[3];d[1]=n;if(n===126){d.writeUInt16BE(t,2)}else if(n===127){d[2]=d[3]=0;d.writeUIntBE(t,4,6)}d[1]|=128;for(let e=0;e<t;e++){d[o+e]=this.frameData[e]^this.maskKey[e%4]}return d}}e.exports={WebsocketFrameSend:WebsocketFrameSend}},60833:(e,t,n)=>{"use strict";const{Writable:i}=n(2203);const o=n(31637);const{parserStates:d,opcodes:p,states:f,emptyBuffer:y}=n(67875);const{kReadyState:v,kSentClose:D,kResponse:M,kReceivedClose:U}=n(16063);const{isValidStatusCode:j,failWebsocketConnection:V,websocketMessageReceived:K}=n(10588);const{WebsocketFrameSend:ee}=n(54391);const te={};te.ping=o.channel("undici:websocket:ping");te.pong=o.channel("undici:websocket:pong");class ByteParser extends i{#o=[];#a=0;#A=d.INFO;#c={};#l=[];constructor(e){super();this.ws=e}_write(e,t,n){this.#o.push(e);this.#a+=e.length;this.run(n)}run(e){while(true){if(this.#A===d.INFO){if(this.#a<2){return e()}const t=this.consume(2);this.#c.fin=(t[0]&128)!==0;this.#c.opcode=t[0]&15;this.#c.originalOpcode??=this.#c.opcode;this.#c.fragmented=!this.#c.fin&&this.#c.opcode!==p.CONTINUATION;if(this.#c.fragmented&&this.#c.opcode!==p.BINARY&&this.#c.opcode!==p.TEXT){V(this.ws,"Invalid frame type was fragmented.");return}const n=t[1]&127;if(n<=125){this.#c.payloadLength=n;this.#A=d.READ_DATA}else if(n===126){this.#A=d.PAYLOADLENGTH_16}else if(n===127){this.#A=d.PAYLOADLENGTH_64}if(this.#c.fragmented&&n>125){V(this.ws,"Fragmented frame exceeded 125 bytes.");return}else if((this.#c.opcode===p.PING||this.#c.opcode===p.PONG||this.#c.opcode===p.CLOSE)&&n>125){V(this.ws,"Payload length for control frame exceeded 125 bytes.");return}else if(this.#c.opcode===p.CLOSE){if(n===1){V(this.ws,"Received close frame with a 1-byte body.");return}const e=this.consume(n);this.#c.closeInfo=this.parseCloseBody(false,e);if(!this.ws[D]){const e=Buffer.allocUnsafe(2);e.writeUInt16BE(this.#c.closeInfo.code,0);const t=new ee(e);this.ws[M].socket.write(t.createFrame(p.CLOSE),(e=>{if(!e){this.ws[D]=true}}))}this.ws[v]=f.CLOSING;this.ws[U]=true;this.end();return}else if(this.#c.opcode===p.PING){const t=this.consume(n);if(!this.ws[U]){const e=new ee(t);this.ws[M].socket.write(e.createFrame(p.PONG));if(te.ping.hasSubscribers){te.ping.publish({payload:t})}}this.#A=d.INFO;if(this.#a>0){continue}else{e();return}}else if(this.#c.opcode===p.PONG){const t=this.consume(n);if(te.pong.hasSubscribers){te.pong.publish({payload:t})}if(this.#a>0){continue}else{e();return}}}else if(this.#A===d.PAYLOADLENGTH_16){if(this.#a<2){return e()}const t=this.consume(2);this.#c.payloadLength=t.readUInt16BE(0);this.#A=d.READ_DATA}else if(this.#A===d.PAYLOADLENGTH_64){if(this.#a<8){return e()}const t=this.consume(8);const n=t.readUInt32BE(0);if(n>2**31-1){V(this.ws,"Received payload length > 2^31 bytes.");return}const i=t.readUInt32BE(4);this.#c.payloadLength=(n<<8)+i;this.#A=d.READ_DATA}else if(this.#A===d.READ_DATA){if(this.#a<this.#c.payloadLength){return e()}else if(this.#a>=this.#c.payloadLength){const e=this.consume(this.#c.payloadLength);this.#l.push(e);if(!this.#c.fragmented||this.#c.fin&&this.#c.opcode===p.CONTINUATION){const e=Buffer.concat(this.#l);K(this.ws,this.#c.originalOpcode,e);this.#c={};this.#l.length=0}this.#A=d.INFO}}if(this.#a>0){continue}else{e();break}}}consume(e){if(e>this.#a){return null}else if(e===0){return y}if(this.#o[0].length===e){this.#a-=this.#o[0].length;return this.#o.shift()}const t=Buffer.allocUnsafe(e);let n=0;while(n!==e){const i=this.#o[0];const{length:o}=i;if(o+n===e){t.set(this.#o.shift(),n);break}else if(o+n>e){t.set(i.subarray(0,e-n),n);this.#o[0]=i.subarray(e-n);break}else{t.set(this.#o.shift(),n);n+=i.length}}this.#a-=e;return t}parseCloseBody(e,t){let n;if(t.length>=2){n=t.readUInt16BE(0)}if(e){if(!j(n)){return null}return{code:n}}let i=t.subarray(2);if(i[0]===239&&i[1]===187&&i[2]===191){i=i.subarray(3)}if(n!==undefined&&!j(n)){return null}try{i=new TextDecoder("utf-8",{fatal:true}).decode(i)}catch{return null}return{code:n,reason: