setup-pnpm/dist/index.js

10 lines
620 KiB
JavaScript
Raw Normal View History

2024-01-23 13:17:43 -08:00
(()=>{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:(e,A,t)=>{"use strict";Object.defineProperty(A,"__esModule",{value:true});A.parseRunInstall=void 0;const s=t(9093);const r=t(2825);const n={required:true};function parseRunInstall(e){const A=(0,r.parse)((0,s.getInput)(e,n));if(!A)return[];if(A===true)return[{recursive:true}];validateRunInstallInput(A);if(Array.isArray(A))return A;return A}A.parseRunInstall=parseRunInstall;function validateRunInstallInput(e){if(Array.isArray(e)){for(const A of e){validateRunInstallEntry(A)}}else{validateRunInstallEntry(e)}}function validateRunInstallEntry(e){if(typeof e!=="object"){throw new Error("Invalid input for run_install")}if(e.recursive!==undefined&&typeof e.recursive!=="boolean"){throw new Error("Invalid input for run_install.recursive")}if(e.cwd!==undefined&&typeof e.cwd!=="string"){throw new Error("Invalid input for run_install.cwd")}if(e.args!==undefined&&!Array.isArray(e.args)){throw new Error("Invalid input for run_install.args")}}},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(3175);const o=s(t(1017));const a=t(7282);async function runSelfInstaller(e){const{version:A,dest:t,packageJsonFile:s,standalone:c}=e;await(0,i.remove)(t);const l=o.default.join(t,"package.json");await(0,i.ensureFile)(l);await(0,i.writeFile)(l,JSON.stringify({private:true}));const g=await readTarget({version:A,packageJsonFile:s,standalone:c});const E=(0,n.spawn)(a.execPath,[o.default.join(__dirname,"pnpm.cjs"),"install",g,"--no-lockfile"],{cwd:t,stdio:["pipe","inherit","inherit"]});const u=await new Promise(((e,A)=>{E.on("error",A);E.on("close",e)}));if(u===0){const e=o.default.join(t,"node_modules/.bin");(0,r.addPath)(e);(0,r.exportVariable)("PNPM_HOME",e)}return u}A.runSelfInstaller=runSelfInstaller;async function readTarget(e){const{version:A,packageJsonFile:t,standalone:s}=e;if(A)return`${s?"@pnpm/exe":"pnpm"}@${A}`;const{GITHUB_WORKSPACE:r}=process.env;if(!r){throw new Error(`No workspace is found.\nIf you're intended to let pnpm/action-setup read preferred pnpm version from the "packageManager" field in the package.json file,\nplease run the actions/checkout before pnpm/action-setup.\nOtherwise, please specify the pnpm version in the action configuration.`)}const{packag
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.
*/
2024-01-23 13:17:43 -08:00
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}},5524:(e,A,t)=>{"use strict";const s=t(7804);const r=t(1017);const n=t(8516).mkdirsSync;const i=t(7227).utimesMillisSync;const o=t(8826);function copySync(e,A,t){if(typeof t==="function"){t={filter:t}}t=t||{};t.clobber="clobber"in t?!!t.clobber:true;t.overwrite="overwrite"in t?!!t.overwrite:t.clobber;if(t.preserveTimestamps&&process.arch==="ia32"){process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n"+"\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0002")}const{srcStat:i,destStat:a}=o.checkPathsSync(e,A,"copy",t);o.checkParentPathsSync(e,i,A,"copy");if(t.filter&&!t.filter(e,A))return;const c=r.dirname(A);if(!s.existsSync(c))n(c);return getStats(a,e,A,t)}function getStats(e,A,t,r){const n=r.dereference?s.statSync:s.lstatSync;const i=n(A);if(i.isDirectory())return onDir(i,e,A,t,r);else if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return onFile(i,e,A,t,r);else if(i.isSymbolicLink())return onLink(e,A,t,r);else if(i.isSocket())throw new Error(`Cannot copy a socket file: ${A}`);else if(i.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${A}`);throw new Error(`Unknown file: ${A}`)}function onFile(e,A,t,s,r){if(!A)return copyFile(e,t,s,r);return mayCopyFile(e,t,s,r)}function mayCopyFile(e,A,t,r){if(r.overwrite){s.unlinkSync(t);return copyFile(e,A,t,r)}else if(r.errorOnExist){throw new Error(`'${t}' already exists`)}}function copyFile(e,A,t,r){s.copyFileSync(A,t);if(r.preserveTimestamps)handleTimestamps(e.mode,A,t);return setDestMode(t,e.mode)}function handleTimestamps(e,A,t){if(fileIsNotWritable(e))makeFileWritable(t,e);return setDestTimestamps(A,t)}function fileIsNotWritable(e){return(e&128)===0}function makeFileWritable(e,A){return setDestMode(e,A|128)}function setDestMode(e,A){return s.chmodSync(e,A)}function setDestTimestamps(e,A){const t=s.statSync(e);return i(A,t.atime,t.mtime)}function onDir(e,A,t,s,r){if(!A)return mkDirAndCopy(e.mode,t,s,r);return copyDir(t,s,r)}function mkDirAndCopy(e,A,t,r){s.mkdirSync(t);copyDir(A,t,r);return setDestMode(t,e)}function copyDir(e,A,t){s.readdirSync(e).forEach((s=>copyDirItem(s,e,A,t)))}function copyDirItem(e,A,t,s){const n=r.join(A,e);const i=r.join(t,e);if(s.filter&&!s.filter(n,i))return;const{destStat:a}=o.checkPathsSync(n,i,"copy",s);return getStats(a,n,i,s)}function onLink(e,A,t,n){let i=s.readlinkSync(A);if(n.dereference){i=r.resolve(process.cwd(),i)}if(!e){return s.symlinkSync(i,t)}else{let e;try{e=s.readlinkSync(t)}catch(e){if(e.code==="EINVAL"||e.code==="UNKNOWN")return s.symlinkSync(i,t);throw e}if(n.dereference){e=r.resolve(process.cwd(),e)}if(o.isSrcSubdir(i,e)){throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${e}'.`)}if(o.isSrcSubdir(e,i)){throw new Error(`Cannot overwrite '${e}' with '${i}'.`)}return copyLink(i,t)}}function copyLink(e,A){s.unlinkSync(A);return s.symlinkSync(e,A)}e.exports=copySync},5770:(e,A,t)=>{"use strict";const s=t(5845);const r=t(1017);const{mkdirs:n}=t(8516);const{pathExists:i}=t(9667);const{utimesMillis:o}=t(7227);const a=t(8826);async function copy(e,A,t={}){if(typeof t==="function"){t={filter:t}}t.clobber="clobber"in t?!!t.clobber:true;t.overwrite="overwrite"in t?!!t.overwrite:t.clobber;if(t.preserveTimestamps&&process.arch==="ia32"){process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n"+"\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0001")}const{srcStat:s,destStat:o}=await a.checkPaths(e,A,"copy",t);await a.checkParentPaths(e,s,A,"copy");const c=await runFilter(e,A,t);if(!c)return;const l=r.dirname(A);const g=await i(l);if(!g){await n(l)}await getStatsAndPerformCopy(o,e,A,t)}async function runFilter(e,A,t){if(!t.filter)return true;return t.filter(e,A)}async function getStatsAndPerformCopy(e,A,t,r){const n=r.dereference?s.stat:s.lstat;const i=await n(A
/*! 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=b.encode(t+`; name="${escape(normalizeLinefeeds(A))}"`+`\r\n\r\n${normalizeLinefeeds(i)}\r\n`);s.push(e);g+=e.byteLength}else{const e=b.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=b.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}}};E="multipart/form-data; boundary="+A}else if(i(e)){l=e;g=e.size;if(e.type){E=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(!d(s)){e.enqueue(new Uint8Array(t))}}return e.desiredSize>0},async cancel(e){await A.return()},type:undefined})}const u={stream:s,source:l,length:g};return[u,E]}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=Q(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 C([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(){u.brandCheck(this,e);throwIfAborted(this[E]);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 R(i,s,{type:n}))}))}else{t.on("data",(e=>{i.push(e)}));t.on("end",(()=>{A.append(e,new R(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[E].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[E].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[E]);throw u.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:E}=t(2319);const{isValidStatusCode:u,failWebsocketConnection:h,websocketMessageReceived:Q}=t(865);const{WebsocketFrameSend:C}=t(7825);const B={};B.ping=r.channel("undici:websocket:ping");B.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 C(e);this.ws[g].socket.write(A.createFrame(i.CLOSE),(e=>{if(!e){this.ws[l]=true}}))}this.ws[c]=o.CLOSING;this.ws[E]=true;this.end();return}else if(this.#c.opcode===i.PING){const A=this.consume(t);if(!this.ws[E]){const e=new C(A);this.ws[g].socket.write(e.createFrame(i.PONG));if(B.ping.hasSubscribers){B.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(B.pong.hasSubscribers){B.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);Q(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(!u(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&&!u(t)){return null}try{s=new TextDecoder("utf-8",{fatal:true}).decode(s)}catch{return null}return{code:t,reason:s}}get closingInf