setup-pnpm/dist/index.js

10 lines
656 KiB
JavaScript
Raw Permalink Normal View History

(()=>{var e={276:function(e,A,t){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(A,"__esModule",{value:true});const r=t(9093);const n=s(t(1784));const i=s(t(2960));const o=s(t(7650));const a=s(t(9462));const c=s(t(8307));async function main(){const e=(0,n.default)();const A=(0,r.getState)("is_post");if(A==="true")return(0,c.default)(e);(0,r.saveState)("is_post","true");await(0,i.default)(e);console.log("Installation Completed!");(0,o.default)(e);(0,a.default)(e)}main().catch((e=>{console.error(e);(0,r.setFailed)(e)}))},1784:function(e,A,t){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(A,"__esModule",{value:true});A.getInputs=void 0;const r=t(9093);const n=s(t(1791));const i=t(7090);const o={required:true};const parseInputPath=e=>(0,n.default)((0,r.getInput)(e,o));const getInputs=()=>({version:(0,r.getInput)("version"),dest:parseInputPath("dest"),runInstall:(0,i.parseRunInstall)("run_install"),packageJsonFile:parseInputPath("package_json_file"),standalone:(0,r.getBooleanInput)("standalone")});A.getInputs=getInputs;A["default"]=A.getInputs},7090:function(e,A,t){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,A,t,s){if(s===undefined)s=t;var r=Object.getOwnPropertyDescriptor(A,t);if(!r||("get"in r?!A.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return A[t]}}}Object.defineProperty(e,s,r)}:function(e,A,t,s){if(s===undefined)s=t;e[s]=A[t]});var r=this&&this.__setModuleDefault||(Object.create?function(e,A){Object.defineProperty(e,"default",{enumerable:true,value:A})}:function(e,A){e["default"]=A});var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var A={};if(e!=null)for(var t in e)if(t!=="default"&&Object.prototype.hasOwnProperty.call(e,t))s(A,e,t);r(A,e);return A};Object.defineProperty(A,"__esModule",{value:true});A.parseRunInstall=void 0;const i=t(9093);const o=n(t(2825));const a=t(8553);const c=a.z.object({recursive:a.z.boolean().optional(),cwd:a.z.string().optional(),args:a.z.array(a.z.string()).optional()});const l=a.z.union([a.z.null(),a.z.boolean(),c,a.z.array(c)]);function parseRunInstall(e){const A=(0,i.getInput)(e,{required:true});const t=o.parse(A);try{const e=l.parse(t);if(!e)return[];if(e===true)return[{recursive:true}];if(Array.isArray(e))return e;return[e]}catch(t){(0,i.error)(`Error for input "${e}" = ${A}`);if(t instanceof a.ZodError){(0,i.error)(`Errors: ${t.errors}`)}else{(0,i.error)(`Exception: ${t}`)}process.exit(1)}}A.parseRunInstall=parseRunInstall},2960:function(e,A,t){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(A,"__esModule",{value:true});A.install=A.runSelfInstaller=void 0;const r=t(9093);const n=s(t(9530));A.runSelfInstaller=n.default;async function install(e){(0,r.startGroup)("Running self-installer...");const A=await(0,n.default)(e);(0,r.endGroup)();if(A){return(0,r.setFailed)(`Something went wrong, self-installer exits with code ${A}`)}}A.install=install;A["default"]=install},9530:function(e,A,t){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(A,"__esModule",{value:true});A.runSelfInstaller=void 0;const r=t(9093);const n=t(2081);const i=t(3292);const o=t(7147);const a=s(t(1017));const c=t(7282);const l=s(t(3837));async function runSelfInstaller(e){const{version:A,dest:t,packageJsonFile:s,standalone:o}=e;await(0,i.rm)(t,{recursive:true,force:true});await(0,i.mkdir)(t,{recursive:true});const l=a.default.join(t,"package.json");await(0,i.writeFile)(l,JSON.stringify({private:true}));const g=await readTarget({version:A,packageJsonFile:s,standalone:o});const u=(0,n.spawn)(c.execPath,[a.default.join(__dirname,"pnpm.cjs"),"install",g,"--no-lockfile"],{cwd:t,stdio:["pipe","inherit","inherit"]});const E=await new Promise(((e,A)=>{u.on("error",A);u.on("close",e)}));if(E===0){const e=a.default.join(t,"node_modules/.bin");(0,r.addPath)(e);(0,r.exportVar
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 s=t(9171);var r=t(1017);e.exports=function expandTilde(e){var A=s();if(e.charCodeAt(0)===126){if(e.charCodeAt(1)===43){return r.join(process.cwd(),e.slice(2))}return A?r.join(A,e.slice(1)):e}return e}},9171:(e,A,t)=>{"use strict";var s=t(2037);if(typeof s.homedir!=="undefined"){e.exports=s.homedir}else{e.exports=t(1952)}},1952:(e,A,t)=>{"use strict";var s=t(7147);var r=t(3794);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 A=find(r(e),getuid());if(A){return A}var t=process.env.LOGNAME||process.env.USER||process.env.LNAME||process.env.USERNAME;if(!t){return null}if(process.platform==="darwin"){return"/Users/"+t}return"/home/"+t}function find(e,A){var t=e.length;for(var s=0;s<t;s++){if(+e[s].uid===A){return e[s].homedir}}}function getuid(){if(typeof process.geteuid==="function"){return process.geteuid()}return process.getuid()}function tryReadFileSync(e){try{return s.readFileSync(e,"utf8")}catch(e){return""}}e.exports=homedir},3794:e=>{"use strict";e.exports=function(e){if(typeof e!=="string"){throw new Error("expected a string")}return e.split("\n").map(user).filter(Boolean)};function user(e,A){if(!e||!e.length||e.charAt(0)==="#"){return null}var t=e.split(":");return{username:t[0],password:t[1],uid:t[2],gid:t[3],gecos:t[4],homedir:t[5],shell:t[6]}}},4225:(e,A,t)=>{e.exports=t(4030)},4030:(e,A,t)=>{"use strict";var s=t(1808);var r=t(4404);var n=t(3685);var i=t(5687);var o=t(2361);var a=t(9491);var c=t(3837);A.httpOverHttp=httpOverHttp;A.httpsOverHttp=httpsOverHttp;A.httpOverHttps=httpOverHttps;A.httpsOverHttps=httpsOverHttps;function httpOverHttp(e){var A=new TunnelingAgent(e);A.request=n.request;return A}function httpsOverHttp(e){var A=new TunnelingAgent(e);A.request=n.request;A.createSocket=createSecureSocket;A.defaultPort=443;return A}function httpOverHttps(e){var A=new TunnelingAgent(e);A.request=i.request;return A}function httpsOverHttps(e){var A=new TunnelingAgent(e);A.request=i.request;A.createSocket=createSecureSocket;A.defaultPort=443;return A}function TunnelingAgent(e){var A=this;A.options=e||{};A.proxyOptions=A.options.proxy||{};A.maxSockets=A.options.maxSockets||n.Agent.defaultMaxSockets;A.requests=[];A.sockets=[];A.on("free",(function onFree(e,t,s,r){var n=toOptions(t,s,r);for(var i=0,o=A.requests.length;i<o;++i){var a=A.requests[i];if(a.host===n.host&&a.port===n.port){A.requests.splice(i,1);a.request.onSocket(e);return}}e.destroy();A.removeSocket(e)}))}c.inherits(TunnelingAgent,o.EventEmitter);TunnelingAgent.prototype.addRequest=function addRequest(e,A,t,s){var r=this;var n=mergeOptions({request:e},r.options,toOptions(A,t,s));if(r.sockets.length>=this.maxSockets){r.requests.push(n);return}r.createSocket(n,(function(A){A.on("free",onFree);A.on("close",onCloseOrRemove);A.on("agentRemove",onCloseOrRemove);e.onSocket(A);function onFree(){r.emit("free",A,n)}function onCloseOrRemove(e){r.removeSocket(A);A.removeListener("free",onFree);A.removeListener("close",onCloseOrRemove);A.removeListener("agentRemove",onCloseOrRemove)}}))};TunnelingAgent.prototype.createSocket=function createSocket(e,A){var t=this;var s={};t.sockets.push(s);var r=mergeOptions({},t.proxyOptions,{method:"CONNECT",path:e.host+":"+e.port,agent:false,headers:{host:e.host+":"+e.port}});if(e.localAddress){r.localAddress=e.localAddress}if(r.proxyAuth){r.headers=r.headers||{};r.headers["Proxy-Authorization"]="Basic "+new Buffer(r.proxyAuth).toString("base64")}l("making CONNECT request");var n=t.request(r);n.useChunkedEncodingByDefault=false;n.once("response",onResponse);n.once("upgrade",onUpgrade);n.once("connect",onConnect);n.once("error",onError);n.end();function onResponse(e){e.upgrade=true}function onUpgrade(e,A,t){process.nextTick((function(){onConnect(e,A,t)}))}function onConnect(r,i,o){n.removeAllListeners();i.removeAllListeners();if(r.status
/*! 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 s=[];const r=new Uint8Array([13,10]);g=0;let n=false;for(const[A,i]of e){if(typeof i==="string"){const e=R.encode(t+`; name="${escape(normalizeLinefeeds(A))}"`+`\r\n\r\n${normalizeLinefeeds(i)}\r\n`);s.push(e);g+=e.byteLength}else{const e=R.encode(`${t}; name="${escape(normalizeLinefeeds(A))}"`+(i.name?`; filename="${escape(i.name)}"`:"")+"\r\n"+`Content-Type: ${i.type||"application/octet-stream"}\r\n\r\n`);s.push(e,i,r);if(typeof i.size==="number"){g+=e.byteLength+i.size+r.byteLength}else{n=true}}}const i=R.encode(`--${A}--`);s.push(i);g+=i.byteLength;if(n){g=null}l=e;c=async function*(){for(const e of s){if(e.stream){yield*e.stream()}else{yield e}}};u="multipart/form-data; boundary="+A}else if(i(e)){l=e;g=e.size;if(e.type){u=e.type}}else if(typeof e[Symbol.asyncIterator]==="function"){if(A){throw new TypeError("keepalive")}if(r.isDisturbed(e)||e.locked){throw new TypeError("Response body object should not be disturbed or locked")}s=e instanceof D?e:n(e)}if(typeof l==="string"||r.isBuffer(l)){g=Buffer.byteLength(l)}if(c!=null){let A;s=new D({async start(){A=c(e)[Symbol.asyncIterator]()},async pull(e){const{value:t,done:r}=await A.next();if(r){queueMicrotask((()=>{e.close()}))}else{if(!B(s)){e.enqueue(new Uint8Array(t))}}return e.desiredSize>0},async cancel(e){await A.return()},type:undefined})}const E={stream:s,source:l,length:g};return[E,u]}function safelyExtractBody(e,A=false){if(!D){D=t(5356).ReadableStream}if(e instanceof D){f(!r.isDisturbed(e),"The body has already been consumed.");f(!e.locked,"The stream is locked.")}return extractBody(e,A)}function cloneBody(e){const[A,t]=e.stream.tee();const s=d(t,{transfer:[t]});const[,r]=s.tee();e.stream=A;return{stream:r,length:e.length,source:e.source}}async function*consumeBody(e){if(e){if(p(e)){yield e}else{const A=e.stream;if(r.isDisturbed(A)){throw new TypeError("The body has already been consumed.")}if(A.locked){throw new TypeError("The stream is locked.")}A[I]=true;yield*A}}}function throwIfAborted(e){if(e.aborted){throw new h("The operation was aborted.","AbortError")}}function bodyMixinMethods(e){const A={blob(){return specConsumeBody(this,(e=>{let A=bodyMimeType(this);if(A==="failure"){A=""}else if(A){A=k(A)}return new Q([e],{type:A})}),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(){E.brandCheck(this,e);throwIfAborted(this[u]);const A=this.headers.get("Content-Type");if(/multipart\/form-data/.test(A)){const e={};for(const[A,t]of this.headers)e[A.toLowerCase()]=t;const A=new g;let t;try{t=new s({headers:e,preservePath:true})}catch(e){throw new h(`${e}`,"AbortError")}t.on("field",((e,t)=>{A.append(e,t)}));t.on("file",((e,t,s,r,n)=>{const i=[];if(r==="base64"||r.toLowerCase()==="base64"){let r="";t.on("data",(e=>{r+=e.toString().replace(/[\r\n]/gm,"");const A=r.length-r.length%4;i.push(Buffer.from(r.slice(0,A),"base64"));r=r.slice(A)}));t.on("end",(()=>{i.push(Buffer.from(r,"base64"));A.append(e,new b(i,s,{type:n}))}))}else{t.on("data",(e=>{i.push(e)}));t.on("end",(()=>{A.append(e,new b(i,s,{type:n}))}))}}));const r=new Promise(((e,A)=>{t.on("finish",e);t.on("error",(e=>A(new TypeError(e))))}));if(this.body!==null)for await(const e of consumeBody(this[u].body))t.write(e);t.end();await r;return A}else if(/application\/x-www-form-urlencoded/.test(A)){let e;try{let A="";const t=new TextDecoder("utf-8",{ignoreBOM:true});for await(const e of consumeBody(this[u].body)){if(!p(e)){throw new TypeError("Expected Uint8Array chunk")}A+=t.decode(e,{stream:true})}A+=t.decode();e=new URLSearchParams(A)}catch(e){throw Object.assign(new TypeError,{cause:e})}const A=new g;for(const[t,s]of e){A.append(t,s)}return A}else{await Promise.resolve();throwIfAborted(this[u]);throw E.errors.exception({he
/*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */n[r-4]=this.maskKey[0];n[r-3]=this.maskKey[1];n[r-2]=this.maskKey[2];n[r-1]=this.maskKey[3];n[1]=t;if(t===126){n.writeUInt16BE(A,2)}else if(t===127){n[2]=n[3]=0;n.writeUIntBE(A,4,6)}n[1]|=128;for(let e=0;e<A;e++){n[r+e]=this.frameData[e]^this.maskKey[e%4]}return n}}e.exports={WebsocketFrameSend:WebsocketFrameSend}},8634:(e,A,t)=>{"use strict";const{Writable:s}=t(2781);const r=t(7643);const{parserStates:n,opcodes:i,states:o,emptyBuffer:a}=t(1937);const{kReadyState:c,kSentClose:l,kResponse:g,kReceivedClose:u}=t(2319);const{isValidStatusCode:E,failWebsocketConnection:h,websocketMessageReceived:d}=t(865);const{WebsocketFrameSend:Q}=t(7825);const C={};C.ping=r.channel("undici:websocket:ping");C.pong=r.channel("undici:websocket:pong");class ByteParser extends s{#i=[];#o=0;#a=n.INFO;#c={};#l=[];constructor(e){super();this.ws=e}_write(e,A,t){this.#i.push(e);this.#o+=e.length;this.run(t)}run(e){while(true){if(this.#a===n.INFO){if(this.#o<2){return e()}const A=this.consume(2);this.#c.fin=(A[0]&128)!==0;this.#c.opcode=A[0]&15;this.#c.originalOpcode??=this.#c.opcode;this.#c.fragmented=!this.#c.fin&&this.#c.opcode!==i.CONTINUATION;if(this.#c.fragmented&&this.#c.opcode!==i.BINARY&&this.#c.opcode!==i.TEXT){h(this.ws,"Invalid frame type was fragmented.");return}const t=A[1]&127;if(t<=125){this.#c.payloadLength=t;this.#a=n.READ_DATA}else if(t===126){this.#a=n.PAYLOADLENGTH_16}else if(t===127){this.#a=n.PAYLOADLENGTH_64}if(this.#c.fragmented&&t>125){h(this.ws,"Fragmented frame exceeded 125 bytes.");return}else if((this.#c.opcode===i.PING||this.#c.opcode===i.PONG||this.#c.opcode===i.CLOSE)&&t>125){h(this.ws,"Payload length for control frame exceeded 125 bytes.");return}else if(this.#c.opcode===i.CLOSE){if(t===1){h(this.ws,"Received close frame with a 1-byte body.");return}const e=this.consume(t);this.#c.closeInfo=this.parseCloseBody(false,e);if(!this.ws[l]){const e=Buffer.allocUnsafe(2);e.writeUInt16BE(this.#c.closeInfo.code,0);const A=new Q(e);this.ws[g].socket.write(A.createFrame(i.CLOSE),(e=>{if(!e){this.ws[l]=true}}))}this.ws[c]=o.CLOSING;this.ws[u]=true;this.end();return}else if(this.#c.opcode===i.PING){const A=this.consume(t);if(!this.ws[u]){const e=new Q(A);this.ws[g].socket.write(e.createFrame(i.PONG));if(C.ping.hasSubscribers){C.ping.publish({payload:A})}}this.#a=n.INFO;if(this.#o>0){continue}else{e();return}}else if(this.#c.opcode===i.PONG){const A=this.consume(t);if(C.pong.hasSubscribers){C.pong.publish({payload:A})}if(this.#o>0){continue}else{e();return}}}else if(this.#a===n.PAYLOADLENGTH_16){if(this.#o<2){return e()}const A=this.consume(2);this.#c.payloadLength=A.readUInt16BE(0);this.#a=n.READ_DATA}else if(this.#a===n.PAYLOADLENGTH_64){if(this.#o<8){return e()}const A=this.consume(8);const t=A.readUInt32BE(0);if(t>2**31-1){h(this.ws,"Received payload length > 2^31 bytes.");return}const s=A.readUInt32BE(4);this.#c.payloadLength=(t<<8)+s;this.#a=n.READ_DATA}else if(this.#a===n.READ_DATA){if(this.#o<this.#c.payloadLength){return e()}else if(this.#o>=this.#c.payloadLength){const e=this.consume(this.#c.payloadLength);this.#l.push(e);if(!this.#c.fragmented||this.#c.fin&&this.#c.opcode===i.CONTINUATION){const e=Buffer.concat(this.#l);d(this.ws,this.#c.originalOpcode,e);this.#c={};this.#l.length=0}this.#a=n.INFO}}if(this.#o>0){continue}else{e();break}}}consume(e){if(e>this.#o){return null}else if(e===0){return a}if(this.#i[0].length===e){this.#o-=this.#i[0].length;return this.#i.shift()}const A=Buffer.allocUnsafe(e);let t=0;while(t!==e){const s=this.#i[0];const{length:r}=s;if(r+t===e){A.set(this.#i.shift(),t);break}else if(r+t>e){A.set(s.subarray(0,e-t),t);this.#i[0]=s.subarray(e-t);break}else{A.set(this.#i.shift(),t);t+=s.length}}this.#o-=e;return A}parseCloseBody(e,A){let t;if(A.length>=2){t=A.readUInt16BE(0)}if(e){if(!E(t)){return null}return{code:t}}let s=A.subarray(2);if(s[0]===239&&s[1]===187&&s[2]===191){s=s.subarray(3)}if(t!==undefined&&!E(t)){return null}try{s=new TextDecoder("utf-8",{fatal:true}).decode(s)}catch{return null}return{code:t,reason:s}}get closingInf