rs-toolchain/dist/index.js

1 line
397 KiB
JavaScript
Raw Normal View History

module.exports=function(e,i){"use strict";var t={};function __webpack_require__(i){if(t[i]){return t[i].exports}var n=t[i]={i:i,l:false,exports:{}};e[i].call(n.exports,n,n.exports,__webpack_require__);n.l=true;return n.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(131)}return startup()}({1:function(e,i,t){"use strict";var n=this&&this.__awaiter||function(e,i,t,n){function adopt(e){return e instanceof t?e:new t(function(i){i(e)})}return new(t||(t=Promise))(function(t,r){function fulfilled(e){try{step(n.next(e))}catch(e){r(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){r(e)}}function step(e){e.done?t(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,i||[])).next())})};Object.defineProperty(i,"__esModule",{value:true});const r=t(129);const a=t(622);const o=t(669);const s=t(672);const c=o.promisify(r.exec);function cp(e,i,t={}){return n(this,void 0,void 0,function*(){const{force:n,recursive:r}=readCopyOptions(t);const o=(yield s.exists(i))?yield s.stat(i):null;if(o&&o.isFile()&&!n){return}const c=o&&o.isDirectory()?a.join(i,a.basename(e)):i;if(!(yield s.exists(e))){throw new Error(`no such file or directory: ${e}`)}const p=yield s.stat(e);if(p.isDirectory()){if(!r){throw new Error(`Failed to copy. ${e} is a directory, but tried to copy without recursive flag.`)}else{yield cpDirRecursive(e,c,0,n)}}else{if(a.relative(e,c)===""){throw new Error(`'${c}' and '${e}' are the same file`)}yield copyFile(e,c,n)}})}i.cp=cp;function mv(e,i,t={}){return n(this,void 0,void 0,function*(){if(yield s.exists(i)){let n=true;if(yield s.isDirectory(i)){i=a.join(i,a.basename(e));n=yield s.exists(i)}if(n){if(t.force==null||t.force){yield rmRF(i)}else{throw new Error("Destination already exists")}}}yield mkdirP(a.dirname(i));yield s.rename(e,i)})}i.mv=mv;function rmRF(e){return n(this,void 0,void 0,function*(){if(s.IS_WINDOWS){try{if(yield s.isDirectory(e,true)){yield c(`rd /s /q "${e}"`)}else{yield c(`del /f /a "${e}"`)}}catch(e){if(e.code!=="ENOENT")throw e}try{yield s.unlink(e)}catch(e){if(e.code!=="ENOENT")throw e}}else{let i=false;try{i=yield s.isDirectory(e)}catch(e){if(e.code!=="ENOENT")throw e;return}if(i){yield c(`rm -rf "${e}"`)}else{yield s.unlink(e)}}})}i.rmRF=rmRF;function mkdirP(e){return n(this,void 0,void 0,function*(){yield s.mkdirP(e)})}i.mkdirP=mkdirP;function which(e,i){return n(this,void 0,void 0,function*(){if(!e){throw new Error("parameter 'tool' is required")}if(i){const i=yield which(e,false);if(!i){if(s.IS_WINDOWS){throw new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`)}else{throw new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`)}}}try{const i=[];if(s.IS_WINDOWS&&process.env.PATHEXT){for(const e of process.env.PATHEXT.split(a.delimiter)){if(e){i.push(e)}}}if(s.isRooted(e)){const t=yield s.tryGetExecutablePath(e,i);if(t){return t}return""}if(e.includes("/")||s.IS_WINDOWS&&e.includes("\\")){return""}const t=[];if(process.env.PATH){for(const e of process.env.PATH.split(a.delimiter)){if(e){t.push(e)}}}for(const n of t){const t=yield s.tryGetExecutablePath(n+a.sep+e,i);if(t){return t}}return""}catch(e){throw new Error(`which failed with message ${e.message}`)}})}i.which=which;function readCopyOptions(e){const i=e.force==null?true:e.force;const t=Boolean(e.recursive);return{force:i,recursive:t}}function cpDirRecursive(e,i,t,r){return n(this,void 0,void 0,function*(){if(t>=255)return;t++;yield mkdirP(i);const n=yield s.readdir(e);for(const a of n){const n=`${e}/${a}`;const o=`${i}/${a}`;const c=yield s.lstat(n);if(c.isDirectory()){yield cpDirRecursive(n,o,t,r)}else{yield copyFile(n,o,r)}}yield s.chmod(i,(yield s.stat(e)).mode)})}function copyFile(e,i,t){return n(this,void