action-setup/dist/index.js

10 lines
689 KiB
JavaScript
Raw Permalink Normal View History

(()=>{var e={276:function(e,t,A){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const r=A(9093);const n=s(A(1784));const i=s(A(2960));const o=s(A(7650));const a=s(A(9462));const c=s(A(8307));async function main(){const e=(0,n.default)();const t=(0,r.getState)("is_post");if(t==="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,t,A){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.getInputs=void 0;const r=A(9093);const n=s(A(1791));const i=A(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")});t.getInputs=getInputs;t["default"]=t.getInputs},7090:function(e,t,A){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,A,s){if(s===undefined)s=A;var r=Object.getOwnPropertyDescriptor(t,A);if(!r||("get"in r?!t.__esModule:r.writable||r.configurable)){r={enumerable:true,get:function(){return t[A]}}}Object.defineProperty(e,s,r)}:function(e,t,A,s){if(s===undefined)s=A;e[s]=t[A]});var r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var A in e)if(A!=="default"&&Object.prototype.hasOwnProperty.call(e,A))s(t,e,A);r(t,e);return t};Object.defineProperty(t,"__esModule",{value:true});t.parseRunInstall=void 0;const i=A(9093);const o=n(A(2825));const a=A(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 t=(0,i.getInput)(e,{required:true});const A=o.parse(t);try{const e=l.parse(A);if(!e)return[];if(e===true)return[{recursive:true}];if(Array.isArray(e))return e;return[e]}catch(A){(0,i.error)(`Error for input "${e}" = ${t}`);if(A instanceof a.ZodError){(0,i.error)(`Errors: ${A.errors}`)}else{(0,i.error)(`Exception: ${A}`)}process.exit(1)}}t.parseRunInstall=parseRunInstall},2960:function(e,t,A){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.install=t.runSelfInstaller=void 0;const r=A(9093);const n=s(A(9530));t.runSelfInstaller=n.default;async function install(e){(0,r.startGroup)("Running self-installer...");const t=await(0,n.default)(e);(0,r.endGroup)();if(t){return(0,r.setFailed)(`Something went wrong, self-installer exits with code ${t}`)}}t.install=install;t["default"]=install},9530:function(e,t,A){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.runSelfInstaller=void 0;const r=A(9093);const n=A(2081);const i=A(3175);const o=s(A(1017));const a=A(7282);async function runSelfInstaller(e){const{version:t,dest:A,packageJsonFile:s,standalone:c}=e;await(0,i.remove)(A);const l=o.default.join(A,"package.json");await(0,i.ensureFile)(l);await(0,i.writeFile)(l,JSON.stringify({private:true}));const u=await readTarget({version:t,packageJsonFile:s,standalone:c});const g=(0,n.spawn)(a.execPath,[o.default.join(__dirname,"pnpm.cjs"),"install",u,"--no-lockfile"],{cwd:A,stdio:["pipe","inherit","inherit"]});const h=await new Promise(((e,t)=>{g.on("error",t);g.on("close",e)}));if(h===0){const e=o.default.join(A,"node_modules/.bin");(0,r.addPath)(e);(0,r.exportVariable)("PNPM_HOME",e)}return h}t.runSelfInstaller=runSelfInstaller;asyn
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=A(9171);var r=A(1017);e.exports=function expandTilde(e){var t=s();if(e.charCodeAt(0)===126){if(e.charCodeAt(1)===43){return r.join(process.cwd(),e.slice(2))}return t?r.join(t,e.slice(1)):e}return e}},5524:(e,t,A)=>{"use strict";const s=A(7804);const r=A(1017);const n=A(8516).mkdirsSync;const i=A(7227).utimesMillisSync;const o=A(8826);function copySync(e,t,A){if(typeof A==="function"){A={filter:A}}A=A||{};A.clobber="clobber"in A?!!A.clobber:true;A.overwrite="overwrite"in A?!!A.overwrite:A.clobber;if(A.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,t,"copy",A);o.checkParentPathsSync(e,i,t,"copy");if(A.filter&&!A.filter(e,t))return;const c=r.dirname(t);if(!s.existsSync(c))n(c);return getStats(a,e,t,A)}function getStats(e,t,A,r){const n=r.dereference?s.statSync:s.lstatSync;const i=n(t);if(i.isDirectory())return onDir(i,e,t,A,r);else if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return onFile(i,e,t,A,r);else if(i.isSymbolicLink())return onLink(e,t,A,r);else if(i.isSocket())throw new Error(`Cannot copy a socket file: ${t}`);else if(i.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${t}`);throw new Error(`Unknown file: ${t}`)}function onFile(e,t,A,s,r){if(!t)return copyFile(e,A,s,r);return mayCopyFile(e,A,s,r)}function mayCopyFile(e,t,A,r){if(r.overwrite){s.unlinkSync(A);return copyFile(e,t,A,r)}else if(r.errorOnExist){throw new Error(`'${A}' already exists`)}}function copyFile(e,t,A,r){s.copyFileSync(t,A);if(r.preserveTimestamps)handleTimestamps(e.mode,t,A);return setDestMode(A,e.mode)}function handleTimestamps(e,t,A){if(fileIsNotWritable(e))makeFileWritable(A,e);return setDestTimestamps(t,A)}function fileIsNotWritable(e){return(e&128)===0}function makeFileWritable(e,t){return setDestMode(e,t|128)}function setDestMode(e,t){return s.chmodSync(e,t)}function setDestTimestamps(e,t){const A=s.statSync(e);return i(t,A.atime,A.mtime)}function onDir(e,t,A,s,r){if(!t)return mkDirAndCopy(e.mode,A,s,r);return copyDir(A,s,r)}function mkDirAndCopy(e,t,A,r){s.mkdirSync(A);copyDir(t,A,r);return setDestMode(A,e)}function copyDir(e,t,A){s.readdirSync(e).forEach((s=>copyDirItem(s,e,t,A)))}function copyDirItem(e,t,A,s){const n=r.join(t,e);const i=r.join(A,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,t,A,n){let i=s.readlinkSync(t);if(n.dereference){i=r.resolve(process.cwd(),i)}if(!e){return s.symlinkSync(i,A)}else{let e;try{e=s.readlinkSync(A)}catch(e){if(e.code==="EINVAL"||e.code==="UNKNOWN")return s.symlinkSync(i,A);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,A)}}function copyLink(e,t){s.unlinkSync(t);return s.symlinkSync(e,t)}e.exports=copySync},5770:(e,t,A)=>{"use strict";const s=A(5845);const r=A(1017);const{mkdirs:n}=A(8516);const{pathExists:i}=A(9667);const{utimesMillis:o}=A(7227);const a=A(8826);async function copy(e,t,A={}){if(typeof A==="function"){A={filter:A}}A.clobber="clobber"in A?!!A.clobber:true;A.overwrite="overwrite"in A?!!A.overwrite:A.clobber;if(A.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,t,"copy",A);await a.checkParentPaths(e,s,t,"copy");const c=await runFilter(e,t,A);if(!c)return;const l=r.dirname(t);const u=await i(l);if(!u){await n(l)}await getStatsAndPerformCopy(o,e,t,A)}async function runFilter(e,t,A){if(!A.filter)return true;return A.filter(e,t)}async function getStatsAndPerformCopy(e,t,A,r){const n=r.dereference?s.stat:s.lstat;const i=await n(t
/*! 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]);u=0;let n=false;for(const[t,i]of e){if(typeof i==="string"){const e=R.encode(A+`; name="${escape(normalizeLinefeeds(t))}"`+`\r\n\r\n${normalizeLinefeeds(i)}\r\n`);s.push(e);u+=e.byteLength}else{const e=R.encode(`${A}; name="${escape(normalizeLinefeeds(t))}"`+(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"){u+=e.byteLength+i.size+r.byteLength}else{n=true}}}const i=R.encode(`--${t}--`);s.push(i);u+=i.byteLength;if(n){u=null}l=e;c=async function*(){for(const e of s){if(e.stream){yield*e.stream()}else{yield e}}};g="multipart/form-data; boundary="+t}else if(i(e)){l=e;u=e.size;if(e.type){g=e.type}}else if(typeof e[Symbol.asyncIterator]==="function"){if(t){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 b?e:n(e)}if(typeof l==="string"||r.isBuffer(l)){u=Buffer.byteLength(l)}if(c!=null){let t;s=new b({async start(){t=c(e)[Symbol.asyncIterator]()},async pull(e){const{value:A,done:r}=await t.next();if(r){queueMicrotask((()=>{e.close()}))}else{if(!B(s)){e.enqueue(new Uint8Array(A))}}return e.desiredSize>0},async cancel(e){await t.return()},type:undefined})}const h={stream:s,source:l,length:u};return[h,g]}function safelyExtractBody(e,t=false){if(!b){b=A(5356).ReadableStream}if(e instanceof b){I(!r.isDisturbed(e),"The body has already been consumed.");I(!e.locked,"The stream is locked.")}return extractBody(e,t)}function cloneBody(e){const[t,A]=e.stream.tee();const s=E(A,{transfer:[A]});const[,r]=s.tee();e.stream=t;return{stream:r,length:e.length,source:e.source}}async function*consumeBody(e){if(e){if(p(e)){yield e}else{const t=e.stream;if(r.isDisturbed(t)){throw new TypeError("The body has already been consumed.")}if(t.locked){throw new TypeError("The stream is locked.")}t[Q]=true;yield*t}}}function throwIfAborted(e){if(e.aborted){throw new d("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=k(t)}return new f([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(){h.brandCheck(this,e);throwIfAborted(this[g]);const t=this.headers.get("Content-Type");if(/multipart\/form-data/.test(t)){const e={};for(const[t,A]of this.headers)e[t.toLowerCase()]=A;const t=new u;let A;try{A=new s({headers:e,preservePath:true})}catch(e){throw new d(`${e}`,"AbortError")}A.on("field",((e,A)=>{t.append(e,A)}));A.on("file",((e,A,s,r,n)=>{const i=[];if(r==="base64"||r.toLowerCase()==="base64"){let r="";A.on("data",(e=>{r+=e.toString().replace(/[\r\n]/gm,"");const t=r.length-r.length%4;i.push(Buffer.from(r.slice(0,t),"base64"));r=r.slice(t)}));A.on("end",(()=>{i.push(Buffer.from(r,"base64"));t.append(e,new D(i,s,{type:n}))}))}else{A.on("data",(e=>{i.push(e)}));A.on("end",(()=>{t.append(e,new D(i,s,{type:n}))}))}}));const r=new Promise(((e,t)=>{A.on("finish",e);A.on("error",(e=>t(new TypeError(e))))}));if(this.body!==null)for await(const e of consumeBody(this[g].body))A.write(e);A.end();await r;return t}else if(/application\/x-www-form-urlencoded/.test(t)){let e;try{let t="";const A=new TextDecoder("utf-8",{ignoreBOM:true});for await(const e of consumeBody(this[g].body)){if(!p(e)){throw new TypeError("Expected Uint8Array chunk")}t+=A.decode(e,{stream:true})}t+=A.decode();e=new URLSearchParams(t)}catch(e){throw Object.assign(new TypeError,{cause:e})}const t=new u;for(const[A,s]of e){t.append(A,s)}return t}else{await Promise.resolve();throwIfAborted(this[g]);throw h.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]=A;if(A===126){n.writeUInt16BE(t,2)}else if(A===127){n[2]=n[3]=0;n.writeUIntBE(t,4,6)}n[1]|=128;for(let e=0;e<t;e++){n[r+e]=this.frameData[e]^this.maskKey[e%4]}return n}}e.exports={WebsocketFrameSend:WebsocketFrameSend}},8634:(e,t,A)=>{"use strict";const{Writable:s}=A(2781);const r=A(7643);const{parserStates:n,opcodes:i,states:o,emptyBuffer:a}=A(1937);const{kReadyState:c,kSentClose:l,kResponse:u,kReceivedClose:g}=A(2319);const{isValidStatusCode:h,failWebsocketConnection:d,websocketMessageReceived:E}=A(865);const{WebsocketFrameSend:f}=A(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,t,A){this.#i.push(e);this.#o+=e.length;this.run(A)}run(e){while(true){if(this.#a===n.INFO){if(this.#o<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!==i.CONTINUATION;if(this.#c.fragmented&&this.#c.opcode!==i.BINARY&&this.#c.opcode!==i.TEXT){d(this.ws,"Invalid frame type was fragmented.");return}const A=t[1]&127;if(A<=125){this.#c.payloadLength=A;this.#a=n.READ_DATA}else if(A===126){this.#a=n.PAYLOADLENGTH_16}else if(A===127){this.#a=n.PAYLOADLENGTH_64}if(this.#c.fragmented&&A>125){d(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)&&A>125){d(this.ws,"Payload length for control frame exceeded 125 bytes.");return}else if(this.#c.opcode===i.CLOSE){if(A===1){d(this.ws,"Received close frame with a 1-byte body.");return}const e=this.consume(A);this.#c.closeInfo=this.parseCloseBody(false,e);if(!this.ws[l]){const e=Buffer.allocUnsafe(2);e.writeUInt16BE(this.#c.closeInfo.code,0);const t=new f(e);this.ws[u].socket.write(t.createFrame(i.CLOSE),(e=>{if(!e){this.ws[l]=true}}))}this.ws[c]=o.CLOSING;this.ws[g]=true;this.end();return}else if(this.#c.opcode===i.PING){const t=this.consume(A);if(!this.ws[g]){const e=new f(t);this.ws[u].socket.write(e.createFrame(i.PONG));if(C.ping.hasSubscribers){C.ping.publish({payload:t})}}this.#a=n.INFO;if(this.#o>0){continue}else{e();return}}else if(this.#c.opcode===i.PONG){const t=this.consume(A);if(C.pong.hasSubscribers){C.pong.publish({payload:t})}if(this.#o>0){continue}else{e();return}}}else if(this.#a===n.PAYLOADLENGTH_16){if(this.#o<2){return e()}const t=this.consume(2);this.#c.payloadLength=t.readUInt16BE(0);this.#a=n.READ_DATA}else if(this.#a===n.PAYLOADLENGTH_64){if(this.#o<8){return e()}const t=this.consume(8);const A=t.readUInt32BE(0);if(A>2**31-1){d(this.ws,"Received payload length > 2^31 bytes.");return}const s=t.readUInt32BE(4);this.#c.payloadLength=(A<<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);E(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 t=Buffer.allocUnsafe(e);let A=0;while(A!==e){const s=this.#i[0];const{length:r}=s;if(r+A===e){t.set(this.#i.shift(),A);break}else if(r+A>e){t.set(s.subarray(0,e-A),A);this.#i[0]=s.subarray(e-A);break}else{t.set(this.#i.shift(),A);A+=s.length}}this.#o-=e;return t}parseCloseBody(e,t){let A;if(t.length>=2){A=t.readUInt16BE(0)}if(e){if(!h(A)){return null}return{code:A}}let s=t.subarray(2);if(s[0]===239&&s[1]===187&&s[2]===191){s=s.subarray(3)}if(A!==undefined&&!h(A)){return null}try{s=new TextDecoder("utf-8",{fatal:true}).decode(s)}catch{return null}return{code:A,reason:s}}get closingInf