diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6114e8b..f4f1a51 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,7 +73,7 @@ jobs: if: matrix.arch == 'x64' || matrix.arch == 'ia32' env: DISPLAY: ':99.0' - run: out/Release/yode test.js + run: out/Release/yode test/main.js - name: Upload Binary Files uses: actions/upload-artifact@v3 diff --git a/deps/asar.js b/deps/asar.js new file mode 100644 index 0000000..817d285 --- /dev/null +++ b/deps/asar.js @@ -0,0 +1,24 @@ +// @electron/asar@3.2.3 +// +// Copyright (c) 2014 GitHub Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).asar=t()}}((function(){return function t(e,r,n){function i(o,a){if(!r[o]){if(!e[o]){var c="function"==typeof require&&require;if(!a&&c)return c(o,!0);if(s)return s(o,!0);var h=new Error("Cannot find module '"+o+"'");throw h.code="MODULE_NOT_FOUND",h}var u=r[o]={exports:{}};e[o][0].call(u.exports,(function(t){return i(e[o][1][t]||t)}),u,u.exports,t,e,r,n)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;ot.startsWith(e)))}e.exports.createPackage=async function(t,r){return e.exports.createPackageWithOptions(t,r,{})},e.exports.createPackageWithOptions=async function(t,r,n){const i=n.globOptions?n.globOptions:{};i.dot=void 0===n.dot||n.dot;const s=t+(n.pattern?n.pattern:"/**/*"),[o,a]=await c(s,i);return e.exports.createPackageFromFiles(t,r,o,a,n)},e.exports.createPackageFromFiles=async function(t,e,r,u,f){null==u&&(u={}),null==f&&(f={}),t=i.normalize(t),e=i.normalize(e),r=r.map((function(t){return i.normalize(t)}));const l=new o(t),p=[],d=[];let y=[];if(f.ordering){const e=(await n.readFile(f.ordering)).toString().split("\n").map((t=>(t.includes(":")&&(t=t.split(":").pop()),(t=t.trim()).startsWith("/")&&(t=t.slice(1)),t))),s=[];for(const r of e){const e=r.split(i.sep);let n=t;for(const t of e)n=i.join(n,t),s.push(n)}let o=0;const a=r.length;for(const t of s)!y.includes(t)&&r.includes(t)&&y.push(t);for(const t of r)y.includes(t)||(y.push(t),o+=1);console.log(`Ordering file has ${(a-o)/a*100}% coverage.`)}else y=r;const m=y.slice(),g=async function(r){return r?(await async function(e){u[e]||(u[e]=await c.determineFileType(e));const r=u[e];let n;switch(r.type){case"directory":n=!!f.unpackDir&&h(i.relative(t,e),f.unpackDir,d),l.insertDirectory(e,n);break;case"file":return n=!1,f.unpack&&(n=s(e,f.unpack,{matchBase:!0})),!n&&f.unpackDir&&(n=h(i.relative(t,i.dirname(e)),f.unpackDir,d)),p.push({filename:e,unpack:n}),l.insertFile(e,n,r,f);case"link":l.insertLink(e)}return Promise.resolve()}(r),g(m.shift())):async function(){return await n.mkdirp(i.dirname(e)),a.writeFilesystem(e,l,p,u)}()};return g(m.shift())},e.exports.statFile=function(t,e,r){return a.readFilesystemSync(t).getFile(e,r)},e.exports.getRawHeader=function(t){return a.readArchiveHeaderSync(t)},e.exports.listPackage=function(t,e){return a.readFilesystemSync(t).listFiles(e)},e.exports.extractFile=function(t,e){const r=a.readFilesystemSync(t);return a.readFileSync(r,e,r.getFile(e))},e.exports.extractAll=function(t,e){const r=a.readFilesystemSync(t),s=r.listFiles(),o="win32"===process.platform;n.mkdirpSync(e);for(const t of s){const s=t.substr(1),c=i.join(e,s),h=r.getFile(s,o);if(h.files)n.mkdirpSync(c);else if(h.link){const t=i.dirname(i.join(e,h.link)),r=i.dirname(c),s=i.relative(r,t);try{n.unlinkSync(c)}catch{}const o=i.join(s,i.basename(h.link));n.symlinkSync(o,c)}else{const t=a.readFileSync(r,s,h);n.writeFileSync(c,t),h.executable&&n.chmodSync(c,"755")}}},e.exports.uncache=function(t){return a.uncacheFilesystem(t)},e.exports.uncacheAll=function(){a.uncacheAll()}},{"./crawlfs":2,"./disk":3,"./filesystem":4,"./wrapped-fs":6,minimatch:20,path:void 0}],2:[function(t,e,r){"use strict";const{promisify:n}=t("util"),i=t("./wrapped-fs"),s=n(t("glob"));async function o(t){const e=await i.lstat(t);return e.isFile()?{type:"file",stat:e}:e.isDirectory()?{type:"directory",stat:e}:e.isSymbolicLink()?{type:"link",stat:e}:void 0}e.exports=async function(t,e){const r={},n=await s(t,e),i=await Promise.all(n.map((async t=>[t,await o(t)]))),a=[];return[i.map((([t,e])=>(e&&(r[t]=e,"link"===e.type&&a.push(t)),t))).filter((t=>{const e=a.findIndex((e=>t===e));return a.every(((r,n)=>n===e||!t.startsWith(r)))})),r]},e.exports.determineFileType=o},{"./wrapped-fs":6,glob:15,util:void 0}],3:[function(t,e,r){"use strict";const n=t("./wrapped-fs"),i=t("path"),s=t("chromium-pickle-js"),o=t("./filesystem");let a={};async function c(t,e,r){const s=i.join(e,r),o=i.join(t,r),[a,c]=await Promise.all([n.readFile(s),n.stat(s),n.mkdirp(i.dirname(o))]);return n.writeFile(o,a,{mode:c.mode})}async function h(t,e,r){return new Promise(((i,s)=>{const o=n.createReadStream(r?r.path:t);o.pipe(e,{end:!1}),o.on("error",s),o.on("end",(()=>i()))}))}e.exports.writeFilesystem=async function(t,e,r,o){const a=s.createEmpty();a.writeString(JSON.stringify(e.header));const u=a.toBuffer(),f=s.createEmpty();f.writeUInt32(u.length);const l=f.toBuffer(),p=n.createWriteStream(t);return await new Promise(((t,e)=>(p.on("error",e),p.write(l),p.write(u,(()=>t()))))),async function(t,e,r,n,s){for(const o of n)if(o.unpack){const r=i.relative(e.src,o.filename);await c(`${t}.unpacked`,e.src,r)}else await h(o.filename,r,s[o.filename].transformed);return r.end()}(t,e,p,r,o)},e.exports.readArchiveHeaderSync=function(t){const e=n.openSync(t,"r");let r,i;try{const t=Buffer.alloc(8);if(8!==n.readSync(e,t,0,8,null))throw new Error("Unable to read header size");if(r=s.createFromBuffer(t).createIterator().readUInt32(),i=Buffer.alloc(r),n.readSync(e,i,0,r,null)!==r)throw new Error("Unable to read header")}finally{n.closeSync(e)}const o=s.createFromBuffer(i).createIterator().readString();return{headerString:o,header:JSON.parse(o),headerSize:r}},e.exports.readFilesystemSync=function(t){if(!a[t]){const e=this.readArchiveHeaderSync(t),r=new o(t);r.header=e.header,r.headerSize=e.headerSize,a[t]=r}return a[t]},e.exports.uncacheFilesystem=function(t){return!!a[t]&&(a[t]=void 0,!0)},e.exports.uncacheAll=function(){a={}},e.exports.readFileSync=function(t,e,r){let s=Buffer.alloc(r.size);if(r.size<=0)return s;if(r.unpacked)s=n.readFileSync(i.join(`${t.src}.unpacked`,e));else{const e=n.openSync(t.src,"r");try{const i=8+t.headerSize+parseInt(r.offset);n.readSync(e,s,0,r.size,i)}finally{n.closeSync(e)}}return s}},{"./filesystem":4,"./wrapped-fs":6,"chromium-pickle-js":9,path:void 0}],4:[function(t,e,r){"use strict";const n=t("./wrapped-fs"),i=t("os"),s=t("path"),{promisify:o}=t("util"),a=t("stream"),c=t("./integrity"),h=o(a.pipeline);e.exports=class{constructor(t){this.src=s.resolve(t),this.header={files:{}},this.offset=BigInt(0)}searchNodeFromDirectory(t){let e=this.header;const r=t.split(s.sep);for(const t of r)"."!==t&&(e.files[t]||(e.files[t]={files:{}}),e=e.files[t]);return e}searchNodeFromPath(t){if(!(t=s.relative(this.src,t)))return this.header;const e=s.basename(t),r=this.searchNodeFromDirectory(s.dirname(t));return null==r.files&&(r.files={}),null==r.files[e]&&(r.files[e]={}),r.files[e]}insertDirectory(t,e){const r=this.searchNodeFromPath(t);return e&&(r.unpacked=e),r.files={},r.files}async insertFile(t,e,r,o){const a=this.searchNodeFromPath(s.dirname(t)),u=this.searchNodeFromPath(t);if(e||a.unpacked)return u.size=r.stat.size,u.unpacked=!0,u.integrity=await c(t),Promise.resolve();let f;const l=o.transform&&o.transform(t);if(l){const e=await n.mkdtemp(s.join(i.tmpdir(),"asar-")),o=s.join(e,s.basename(t)),a=n.createWriteStream(o),c=n.createReadStream(t);await h(c,l,a),r.transformed={path:o,stat:await n.lstat(o)},f=r.transformed.stat.size}else f=r.stat.size;if(f>4294967295)throw new Error(`${t}: file size can not be larger than 4.2GB`);u.size=f,u.offset=this.offset.toString(),u.integrity=await c(t),"win32"!==process.platform&&64&r.stat.mode&&(u.executable=!0),this.offset+=BigInt(f)}insertLink(t){const e=s.relative(n.realpathSync(this.src),n.realpathSync(t));if(".."===e.substr(0,2))throw new Error(`${t}: file "${e}" links out of the package`);return this.searchNodeFromPath(t).link=e,e}listFiles(t){const e=[],r=function(n,i){if(i.files)for(const[o,a]of Object.entries(i.files)){const i=s.join(n,o),c=a.unpacked?"unpack":"pack ";e.push(t&&t.isPack?`${c} : ${i}`:i),r(i,a)}};return r("/",this.header),e}getNode(t){const e=this.searchNodeFromDirectory(s.dirname(t)),r=s.basename(t);return r?e.files[r]:e}getFile(t,e){e=void 0===e||e;const r=this.getNode(t);return r.link&&e?this.getFile(r.link):r}}},{"./integrity":5,"./wrapped-fs":6,os:void 0,path:void 0,stream:void 0,util:void 0}],5:[function(t,e,r){const n=t("crypto"),i=t("fs"),s=t("stream"),{promisify:o}=t("util"),a="SHA256",c=4194304,h=o(s.pipeline);function u(t){return n.createHash(a).update(t).digest("hex")}e.exports=async function(t){const e=n.createHash(a),r=[];let o=0,f=[];return await h(i.createReadStream(t),new s.PassThrough({decodeStrings:!1,transform(t,n,i){e.update(t),function t(e){const n=Math.min(c-o,e.byteLength);o+=n,f.push(e.slice(0,n)),o===c&&(r.push(u(Buffer.concat(f))),f=[],o=0),nn.promises.mkdir(t,{recursive:!0}),s.mkdirpSync=t=>n.mkdirSync(t,{recursive:!0}),e.exports=s},{fs:void 0,"original-fs":void 0}],7:[function(t,e,r){"use strict";function n(t,e,r){t instanceof RegExp&&(t=i(t,r)),e instanceof RegExp&&(e=i(e,r));var n=s(t,e,r);return n&&{start:n[0],end:n[1],pre:r.slice(0,n[0]),body:r.slice(n[0]+t.length,n[1]),post:r.slice(n[1]+e.length)}}function i(t,e){var r=e.match(t);return r?r[0]:null}function s(t,e,r){var n,i,s,o,a,c=r.indexOf(t),h=r.indexOf(e,c+1),u=c;if(c>=0&&h>0){if(t===e)return[c,h];for(n=[],s=r.length;u>=0&&!a;)u==c?(n.push(u),c=r.indexOf(t,u+1)):1==n.length?a=[n.pop(),h]:((i=n.pop())=0?c:h;n.length&&(a=[s,o])}return a}e.exports=n,n.range=s},{}],8:[function(t,e,r){var n=t("concat-map"),i=t("balanced-match");e.exports=function(t){if(!t)return[];"{}"===t.substr(0,2)&&(t="\\{\\}"+t.substr(2));return g(function(t){return t.split("\\\\").join(s).split("\\{").join(o).split("\\}").join(a).split("\\,").join(c).split("\\.").join(h)}(t),!0).map(f)};var s="\0SLASH"+Math.random()+"\0",o="\0OPEN"+Math.random()+"\0",a="\0CLOSE"+Math.random()+"\0",c="\0COMMA"+Math.random()+"\0",h="\0PERIOD"+Math.random()+"\0";function u(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function f(t){return t.split(s).join("\\").split(o).join("{").split(a).join("}").split(c).join(",").split(h).join(".")}function l(t){if(!t)return[""];var e=[],r=i("{","}",t);if(!r)return t.split(",");var n=r.pre,s=r.body,o=r.post,a=n.split(",");a[a.length-1]+="{"+s+"}";var c=l(o);return o.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),e.push.apply(e,a),e}function p(t){return"{"+t+"}"}function d(t){return/^-?0\d/.test(t)}function y(t,e){return t<=e}function m(t,e){return t>=e}function g(t,e){var r=[],s=i("{","}",t);if(!s||/\$$/.test(s.pre))return[t];var o,c=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),h=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),f=c||h,v=s.body.indexOf(",")>=0;if(!f&&!v)return s.post.match(/,.*\}/)?g(t=s.pre+"{"+s.body+a+s.post):[t];if(f)o=s.body.split(/\.\./);else if(1===(o=l(s.body)).length&&1===(o=g(o[0],!1).map(p)).length)return(k=s.post.length?g(s.post,!1):[""]).map((function(t){return s.pre+o[0]+t}));var b,w=s.pre,k=s.post.length?g(s.post,!1):[""];if(f){var S=u(o[0]),_=u(o[1]),E=Math.max(o[0].length,o[1].length),x=3==o.length?Math.abs(u(o[2])):1,O=y;_0){var B=new Array(F+1).join("0");I=j<0?"-"+B+I.slice(1):B+I}}b.push(I)}}else b=n(o,(function(t){return g(t,!1)}));for(var L=0;Lthis.endIndex-this.readIndex)throw this.readIndex=this.endIndex,new Error("Failed to read data with length of "+t);var e=this.payloadOffset+this.readIndex;return this.advance(t),e},t.prototype.advance=function(t){var e=n(t,4);this.endIndex-this.readIndext.length&&(this.headerSize=0),this.headerSize!==n(this.headerSize,4)&&(this.headerSize=0),0===this.headerSize&&(this.header=new Buffer(0))},t.prototype.createIterator=function(){return new i(this)},t.prototype.toBuffer=function(){return this.header.slice(0,this.headerSize+this.getPayloadSize())},t.prototype.writeBool=function(t){return this.writeInt(t?1:0)},t.prototype.writeInt=function(t){return this.writeBytes(t,4,Buffer.prototype.writeInt32LE)},t.prototype.writeUInt32=function(t){return this.writeBytes(t,4,Buffer.prototype.writeUInt32LE)},t.prototype.writeInt64=function(t){return this.writeBytes(t,8,Buffer.prototype.writeInt64LE)},t.prototype.writeUInt64=function(t){return this.writeBytes(t,8,Buffer.prototype.writeUInt64LE)},t.prototype.writeFloat=function(t){return this.writeBytes(t,4,Buffer.prototype.writeFloatLE)},t.prototype.writeDouble=function(t){return this.writeBytes(t,8,Buffer.prototype.writeDoubleLE)},t.prototype.writeString=function(t){var e=Buffer.byteLength(t,"utf8");return!!this.writeInt(e)&&this.writeBytes(t,e)},t.prototype.setPayloadSize=function(t){return this.header.writeUInt32LE(t,0)},t.prototype.getPayloadSize=function(){return this.header.readUInt32LE(0)},t.prototype.writeBytes=function(t,e,r){var i=n(e,4),s=this.writeOffset+i;s>this.capacityAfterHeader&&this.resize(Math.max(2*this.capacityAfterHeader,s)),null!=r?r.call(this.header,t,this.headerSize+this.writeOffset):this.header.write(t,this.headerSize+this.writeOffset,e);var o=this.headerSize+this.writeOffset+e;return this.header.fill(0,o,o+i-e),this.setPayloadSize(s),this.writeOffset=s,!0},t.prototype.resize=function(t){t=n(t,64),this.header=Buffer.concat([this.header,new Buffer(t)]),this.capacityAfterHeader=t},t}();e.exports=s},{}],11:[function(t,e,r){e.exports=function(t,e){for(var r=[],i=0;i=t.length)return e&&(e[p]=t),r(null,t);c.lastIndex=o;var n=c.exec(t);return l=u,u+=n[0],f=l+n[1],o=c.lastIndex,y[f]||e&&e[f]===f?process.nextTick(g):e&&Object.prototype.hasOwnProperty.call(e,f)?w(e[f]):s.lstat(f,v)}function v(t,n){if(t)return r(t);if(!n.isSymbolicLink())return y[f]=!0,e&&(e[f]=f),process.nextTick(g);if(!i){var o=n.dev.toString(32)+":"+n.ino.toString(32);if(d.hasOwnProperty(o))return b(null,d[o],f)}s.stat(f,(function(t){if(t)return r(t);s.readlink(f,(function(t,e){i||(d[o]=e),b(t,e)}))}))}function b(t,i,s){if(t)return r(t);var o=n.resolve(l,i);e&&(e[s]=o),w(o)}function w(e){t=n.resolve(e,t.slice(o)),m()}m()}},{fs:void 0,path:void 0}],14:[function(t,e,r){function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}r.setopts=function(t,e,r){r||(r={});if(r.matchBase&&-1===e.indexOf("/")){if(r.noglobstar)throw new Error("base matching requires globstar");e="**/"+e}t.silent=!!r.silent,t.pattern=e,t.strict=!1!==r.strict,t.realpath=!!r.realpath,t.realpathCache=r.realpathCache||Object.create(null),t.follow=!!r.follow,t.dot=!!r.dot,t.mark=!!r.mark,t.nodir=!!r.nodir,t.nodir&&(t.mark=!0);t.sync=!!r.sync,t.nounique=!!r.nounique,t.nonull=!!r.nonull,t.nosort=!!r.nosort,t.nocase=!!r.nocase,t.stat=!!r.stat,t.noprocess=!!r.noprocess,t.absolute=!!r.absolute,t.fs=r.fs||i,t.maxLength=r.maxLength||1/0,t.cache=r.cache||Object.create(null),t.statCache=r.statCache||Object.create(null),t.symlinks=r.symlinks||Object.create(null),function(t,e){t.ignore=e.ignore||[],Array.isArray(t.ignore)||(t.ignore=[t.ignore]);t.ignore.length&&(t.ignore=t.ignore.map(u))}(t,r),t.changedCwd=!1;var o=process.cwd();n(r,"cwd")?(t.cwd=s.resolve(r.cwd),t.changedCwd=t.cwd!==o):t.cwd=o;t.root=r.root||s.resolve(t.cwd,"/"),t.root=s.resolve(t.root),"win32"===process.platform&&(t.root=t.root.replace(/\\/g,"/"));t.cwdAbs=a(t.cwd)?t.cwd:f(t,t.cwd),"win32"===process.platform&&(t.cwdAbs=t.cwdAbs.replace(/\\/g,"/"));t.nomount=!!r.nomount,r.nonegate=!0,r.nocomment=!0,r.allowWindowsEscape=!1,t.minimatch=new c(e,r),t.options=t.minimatch.options},r.ownProp=n,r.makeAbs=f,r.finish=function(t){for(var e=t.nounique,r=e?[]:Object.create(null),n=0,i=t.matches.length;n1)return!0;for(var i=0;ithis.maxLength)return e();if(!this.stat&&p(this.cache,r)){var i=this.cache[r];if(Array.isArray(i)&&(i="DIR"),!n||"DIR"===i)return e(null,i);if(n&&"FILE"===i)return e()}var s=this.statCache[r];if(void 0!==s){if(!1===s)return e(null,s);var o=s.isDirectory()?"DIR":"FILE";return n&&"FILE"===o?e():e(null,o,s)}var a=this,c=d("stat\0"+r,(function(n,i){if(i&&i.isSymbolicLink())return a.fs.stat(r,(function(n,s){n?a._stat2(t,r,null,i,e):a._stat2(t,r,n,s,e)}));a._stat2(t,r,n,i,e)}));c&&a.fs.lstat(r,c)},w.prototype._stat2=function(t,e,r,n,i){if(r&&("ENOENT"===r.code||"ENOTDIR"===r.code))return this.statCache[e]=!1,i();var s="/"===t.slice(-1);if(this.statCache[e]=n,"/"===e.slice(-1)&&n&&!n.isDirectory())return i(null,!1,n);var o=!0;return n&&(o=n.isDirectory()?"DIR":"FILE"),this.cache[e]=this.cache[e]||o,s&&"FILE"===o?i():i(null,o,n)}},{"./common.js":14,"./sync.js":16,assert:void 0,events:void 0,"fs.realpath":12,inflight:17,inherits:18,minimatch:20,once:21,path:void 0,"path-is-absolute":22,util:void 0}],16:[function(t,e,r){e.exports=p,p.GlobSync=d;var n=t("fs.realpath"),i=t("minimatch"),s=(i.Minimatch,t("./glob.js").Glob,t("util"),t("path")),o=t("assert"),a=t("path-is-absolute"),c=t("./common.js"),h=c.setopts,u=c.ownProp,f=c.childrenIgnored,l=c.isIgnored;function p(t,e){if("function"==typeof e||3===arguments.length)throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");return new d(t,e).found}function d(t,e){if(!t)throw new Error("must provide pattern");if("function"==typeof e||3===arguments.length)throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");if(!(this instanceof d))return new d(t,e);if(h(this,t,e),this.noprocess)return this;var r=this.minimatch.set.length;this.matches=new Array(r);for(var n=0;nthis.maxLength)return!1;if(!this.stat&&u(this.cache,e)){var n=this.cache[e];if(Array.isArray(n)&&(n="DIR"),!r||"DIR"===n)return n;if(r&&"FILE"===n)return!1}var i=this.statCache[e];if(!i){var s;try{s=this.fs.lstatSync(e)}catch(t){if(t&&("ENOENT"===t.code||"ENOTDIR"===t.code))return this.statCache[e]=!1,!1}if(s&&s.isSymbolicLink())try{i=this.fs.statSync(e)}catch(t){i=s}else i=s}this.statCache[e]=i;n=!0;return i&&(n=i.isDirectory()?"DIR":"FILE"),this.cache[e]=this.cache[e]||n,(!r||"FILE"!==n)&&n},d.prototype._mark=function(t){return c.mark(this,t)},d.prototype._makeAbs=function(t){return c.makeAbs(this,t)}},{"./common.js":14,"./glob.js":15,assert:void 0,"fs.realpath":12,minimatch:20,path:void 0,"path-is-absolute":22,util:void 0}],17:[function(t,e,r){var n=t("wrappy"),i=Object.create(null),s=t("once");function o(t){for(var e=t.length,r=[],n=0;nn?(r.splice(0,n),process.nextTick((function(){e.apply(null,s)}))):delete i[t]}}))}(t))}))},{once:21,wrappy:23}],18:[function(t,e,r){try{var n=t("util");if("function"!=typeof n.inherits)throw"";e.exports=n.inherits}catch(r){e.exports=t("./inherits_browser.js")}},{"./inherits_browser.js":19,util:void 0}],19:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},{}],20:[function(t,e,r){e.exports=l,l.Minimatch=p;var n=function(){try{return t("path")}catch(t){}}()||{sep:"/"};l.sep=n.sep;var i=l.GLOBSTAR=p.GLOBSTAR={},s=t("brace-expansion"),o={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},a="[^/]",c="[^/]*?",h="().*{}+?[]^$\\!".split("").reduce((function(t,e){return t[e]=!0,t}),{});var u=/\/+/;function f(t,e){e=e||{};var r={};return Object.keys(t).forEach((function(e){r[e]=t[e]})),Object.keys(e).forEach((function(t){r[t]=e[t]})),r}function l(t,e,r){return y(e),r||(r={}),!(!r.nocomment&&"#"===e.charAt(0))&&new p(e,r).match(t)}function p(t,e){if(!(this instanceof p))return new p(t,e);y(t),e||(e={}),t=t.trim(),e.allowWindowsEscape||"/"===n.sep||(t=t.split(n.sep).join("/")),this.options=e,this.set=[],this.pattern=t,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.make()}function d(t,e){return e||(e=this instanceof p?this.options:{}),t=void 0===t?this.pattern:t,y(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:s(t)}l.filter=function(t,e){return e=e||{},function(r,n,i){return l(r,t,e)}},l.defaults=function(t){if(!t||"object"!=typeof t||!Object.keys(t).length)return l;var e=l,r=function(r,n,i){return e(r,n,f(t,i))};return(r.Minimatch=function(r,n){return new e.Minimatch(r,f(t,n))}).defaults=function(r){return e.defaults(f(t,r)).Minimatch},r.filter=function(r,n){return e.filter(r,f(t,n))},r.defaults=function(r){return e.defaults(f(t,r))},r.makeRe=function(r,n){return e.makeRe(r,f(t,n))},r.braceExpand=function(r,n){return e.braceExpand(r,f(t,n))},r.match=function(r,n,i){return e.match(r,n,f(t,i))},r},p.defaults=function(t){return l.defaults(t).Minimatch},p.prototype.debug=function(){},p.prototype.make=function(){var t=this.pattern,e=this.options;if(!e.nocomment&&"#"===t.charAt(0))return void(this.comment=!0);if(!t)return void(this.empty=!0);this.parseNegate();var r=this.globSet=this.braceExpand();e.debug&&(this.debug=function(){console.error.apply(console,arguments)});this.debug(this.pattern,r),r=this.globParts=r.map((function(t){return t.split(u)})),this.debug(this.pattern,r),r=r.map((function(t,e,r){return t.map(this.parse,this)}),this),this.debug(this.pattern,r),r=r.filter((function(t){return-1===t.indexOf(!1)})),this.debug(this.pattern,r),this.set=r},p.prototype.parseNegate=function(){var t=this.pattern,e=!1,r=this.options,n=0;if(r.nonegate)return;for(var i=0,s=t.length;i65536)throw new TypeError("pattern is too long")};p.prototype.parse=function(t,e){y(t);var r=this.options;if("**"===t){if(!r.noglobstar)return i;t="*"}if(""===t)return"";var n,s="",u=!!r.nocase,f=!1,l=[],p=[],d=!1,g=-1,v=-1,b="."===t.charAt(0)?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",w=this;function k(){if(n){switch(n){case"*":s+=c,u=!0;break;case"?":s+=a,u=!0;break;default:s+="\\"+n}w.debug("clearStateChar %j %j",n,s),n=!1}}for(var S,_=0,E=t.length;_-1;B--){var L=p[B],N=s.slice(0,L.reStart),P=s.slice(L.reStart,L.reEnd-8),R=s.slice(L.reEnd-8,L.reEnd),z=s.slice(L.reEnd);R+=z;var D=N.split("(").length-1,T=z;for(_=0;_=0&&!(i=t[s]);s--);for(s=0;s>> no match, partial?",t,l,e,p),l!==a))}if("string"==typeof u?(h=f===u,this.debug("string match",u,f,h)):(h=f.match(u),this.debug("pattern match",u,f,h)),!h)return!1}if(s===a&&o===c)return!0;if(s===a)return r;if(o===c)return s===a-1&&""===t[s];throw new Error("wtf?")}},{"brace-expansion":8,path:void 0}],21:[function(t,e,r){var n=t("wrappy");function i(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function s(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},r=t.name||"Function wrapped with `once`";return e.onceError=r+" shouldn't be called more than once",e.called=!1,e}e.exports=n(i),e.exports.strict=n(s),i.proto=i((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return s(this)},configurable:!0})}))},{wrappy:23}],22:[function(t,e,r){"use strict";function n(t){return"/"===t.charAt(0)}function i(t){var e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),r=e[1]||"",n=Boolean(r&&":"!==r.charAt(1));return Boolean(e[2]||n)}e.exports="win32"===process.platform?i:n,e.exports.posix=n,e.exports.win32=i},{}],23:[function(t,e,r){e.exports=function t(e,r){if(e&&r)return t(e)(r);if("function"!=typeof e)throw new TypeError("need wrapper function");return Object.keys(e).forEach((function(t){n[t]=e[t]})),n;function n(){for(var t=new Array(arguments.length),r=0;rfunction(t,e,n,r){const o=i.join(e,t),s=i.join(n,t);if(r.filter&&!r.filter(o,s))return;const{destStat:a}=c.checkPathsSync(o,s,"copy",r);return u(a,o,s,r)}(r,t,e,n)))}e.exports=function(t,e,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&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:s,destStat:a}=c.checkPathsSync(t,e,"copy",n);if(c.checkParentPathsSync(t,s,e,"copy"),n.filter&&!n.filter(t,e))return;const f=i.dirname(e);return r.existsSync(f)||o(f),u(a,t,e,n)}},{"../mkdirs":17,"../util/stat":26,"../util/utimes":27,"graceful-fs":29,path:void 0}],2:[function(t,e,n){"use strict";const r=t("graceful-fs"),i=t("path"),o=t("../mkdirs").mkdirs,s=t("../path-exists").pathExists,c=t("../util/utimes").utimesMillis,u=t("../util/stat");function a(t,e,n,r){if(!n.filter)return r(null,!0);Promise.resolve(n.filter(t,e)).then((t=>r(null,t)),(t=>r(t)))}function f(t,e,n,i,o){(i.dereference?r.stat:r.lstat)(e,((s,c)=>s?o(s):c.isDirectory()?function(t,e,n,i,o,s){return e?d(n,i,o,s):function(t,e,n,i,o){r.mkdir(n,(r=>{if(r)return o(r);d(e,n,i,(e=>e?o(e):p(n,t,o)))}))}(t.mode,n,i,o,s)}(c,t,e,n,i,o):c.isFile()||c.isCharacterDevice()||c.isBlockDevice()?function(t,e,n,i,o,s){return e?function(t,e,n,i,o){if(!i.overwrite)return i.errorOnExist?o(new Error(`'${n}' already exists`)):o();r.unlink(n,(r=>r?o(r):l(t,e,n,i,o)))}(t,n,i,o,s):l(t,n,i,o,s)}(c,t,e,n,i,o):c.isSymbolicLink()?h(t,e,n,i,o):c.isSocket()?o(new Error(`Cannot copy a socket file: ${e}`)):c.isFIFO()?o(new Error(`Cannot copy a FIFO pipe: ${e}`)):o(new Error(`Unknown file: ${e}`))))}function l(t,e,n,i,o){r.copyFile(e,n,(r=>r?o(r):i.preserveTimestamps?function(t,e,n,r){if(function(t){return 0==(128&t)}(t))return function(t,e,n){return p(t,128|e,n)}(n,t,(i=>i?r(i):y(t,e,n,r)));return y(t,e,n,r)}(t.mode,e,n,o):p(n,t.mode,o)))}function y(t,e,n,i){!function(t,e,n){r.stat(t,((t,r)=>t?n(t):c(e,r.atime,r.mtime,n)))}(e,n,(e=>e?i(e):p(n,t,i)))}function p(t,e,n){return r.chmod(t,e,n)}function d(t,e,n,i){r.readdir(t,((r,o)=>r?i(r):m(o,t,e,n,i)))}function m(t,e,n,r,o){const s=t.pop();return s?function(t,e,n,r,o,s){const c=i.join(n,e),l=i.join(r,e);a(c,l,o,((e,i)=>e?s(e):i?void u.checkPaths(c,l,"copy",o,((e,i)=>{if(e)return s(e);const{destStat:u}=i;f(u,c,l,o,(e=>e?s(e):m(t,n,r,o,s)))})):m(t,n,r,o,s)))}(t,s,e,n,r,o):o()}function h(t,e,n,o,s){r.readlink(e,((e,c)=>e?s(e):(o.dereference&&(c=i.resolve(process.cwd(),c)),t?void r.readlink(n,((t,e)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?r.symlink(c,n,s):s(t):(o.dereference&&(e=i.resolve(process.cwd(),e)),u.isSrcSubdir(c,e)?s(new Error(`Cannot copy '${c}' to a subdirectory of itself, '${e}'.`)):u.isSrcSubdir(e,c)?s(new Error(`Cannot overwrite '${e}' with '${c}'.`)):function(t,e,n){r.unlink(e,(i=>i?n(i):r.symlink(t,e,n)))}(c,n,s)))):r.symlink(c,n,s))))}e.exports=function(t,e,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&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"),u.checkPaths(t,e,"copy",n,((c,l)=>{if(c)return r(c);const{srcStat:y,destStat:p}=l;u.checkParentPaths(t,y,e,"copy",(c=>{if(c)return r(c);a(t,e,n,((c,u)=>c?r(c):u?void function(t,e,n,r,c){const u=i.dirname(n);s(u,((i,s)=>i?c(i):s?f(t,e,n,r,c):void o(u,(i=>i?c(i):f(t,e,n,r,c)))))}(p,t,e,n,r):r()))}))}))}},{"../mkdirs":17,"../path-exists":24,"../util/stat":26,"../util/utimes":27,"graceful-fs":29,path:void 0}],3:[function(t,e,n){"use strict";const r=t("universalify").fromCallback;e.exports={copy:r(t("./copy")),copySync:t("./copy-sync")}},{"./copy":2,"./copy-sync":1,universalify:34}],4:[function(t,e,n){"use strict";const r=t("universalify").fromPromise,i=t("../fs"),o=t("path"),s=t("../mkdirs"),c=t("../remove"),u=r((async function(t){let e;try{e=await i.readdir(t)}catch{return s.mkdirs(t)}return Promise.all(e.map((e=>c.remove(o.join(t,e)))))}));function a(t){let e;try{e=i.readdirSync(t)}catch{return s.mkdirsSync(t)}e.forEach((e=>{e=o.join(t,e),c.removeSync(e)}))}e.exports={emptyDirSync:a,emptydirSync:a,emptyDir:u,emptydir:u}},{"../fs":11,"../mkdirs":17,"../remove":25,path:void 0,universalify:34}],5:[function(t,e,n){"use strict";const r=t("universalify").fromCallback,i=t("path"),o=t("graceful-fs"),s=t("../mkdirs");e.exports={createFile:r((function(t,e){function n(){o.writeFile(t,"",(t=>{if(t)return e(t);e()}))}o.stat(t,((r,c)=>{if(!r&&c.isFile())return e();const u=i.dirname(t);o.stat(u,((t,r)=>{if(t)return"ENOENT"===t.code?s.mkdirs(u,(t=>{if(t)return e(t);n()})):e(t);r.isDirectory()?n():o.readdir(u,(t=>{if(t)return e(t)}))}))}))})),createFileSync:function(t){let e;try{e=o.statSync(t)}catch{}if(e&&e.isFile())return;const n=i.dirname(t);try{o.statSync(n).isDirectory()||o.readdirSync(n)}catch(t){if(!t||"ENOENT"!==t.code)throw t;s.mkdirsSync(n)}o.writeFileSync(t,"")}}},{"../mkdirs":17,"graceful-fs":29,path:void 0,universalify:34}],6:[function(t,e,n){"use strict";const{createFile:r,createFileSync:i}=t("./file"),{createLink:o,createLinkSync:s}=t("./link"),{createSymlink:c,createSymlinkSync:u}=t("./symlink");e.exports={createFile:r,createFileSync:i,ensureFile:r,ensureFileSync:i,createLink:o,createLinkSync:s,ensureLink:o,ensureLinkSync:s,createSymlink:c,createSymlinkSync:u,ensureSymlink:c,ensureSymlinkSync:u}},{"./file":5,"./link":7,"./symlink":10}],7:[function(t,e,n){"use strict";const r=t("universalify").fromCallback,i=t("path"),o=t("graceful-fs"),s=t("../mkdirs"),c=t("../path-exists").pathExists,{areIdentical:u}=t("../util/stat");e.exports={createLink:r((function(t,e,n){function r(t,e){o.link(t,e,(t=>{if(t)return n(t);n(null)}))}o.lstat(e,((a,f)=>{o.lstat(t,((o,a)=>{if(o)return o.message=o.message.replace("lstat","ensureLink"),n(o);if(f&&u(a,f))return n(null);const l=i.dirname(e);c(l,((i,o)=>i?n(i):o?r(t,e):void s.mkdirs(l,(i=>{if(i)return n(i);r(t,e)}))))}))}))})),createLinkSync:function(t,e){let n;try{n=o.lstatSync(e)}catch{}try{const e=o.lstatSync(t);if(n&&u(e,n))return}catch(t){throw t.message=t.message.replace("lstat","ensureLink"),t}const r=i.dirname(e);return o.existsSync(r)||s.mkdirsSync(r),o.linkSync(t,e)}}},{"../mkdirs":17,"../path-exists":24,"../util/stat":26,"graceful-fs":29,path:void 0,universalify:34}],8:[function(t,e,n){"use strict";const r=t("path"),i=t("graceful-fs"),o=t("../path-exists").pathExists;e.exports={symlinkPaths:function(t,e,n){if(r.isAbsolute(t))return i.lstat(t,(e=>e?(e.message=e.message.replace("lstat","ensureSymlink"),n(e)):n(null,{toCwd:t,toDst:t})));{const s=r.dirname(e),c=r.join(s,t);return o(c,((e,o)=>e?n(e):o?n(null,{toCwd:c,toDst:t}):i.lstat(t,(e=>e?(e.message=e.message.replace("lstat","ensureSymlink"),n(e)):n(null,{toCwd:t,toDst:r.relative(s,t)})))))}},symlinkPathsSync:function(t,e){let n;if(r.isAbsolute(t)){if(n=i.existsSync(t),!n)throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}{const o=r.dirname(e),s=r.join(o,t);if(n=i.existsSync(s),n)return{toCwd:s,toDst:t};if(n=i.existsSync(t),!n)throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:r.relative(o,t)}}}}},{"../path-exists":24,"graceful-fs":29,path:void 0}],9:[function(t,e,n){"use strict";const r=t("graceful-fs");e.exports={symlinkType:function(t,e,n){if(n="function"==typeof e?e:n,e="function"!=typeof e&&e)return n(null,e);r.lstat(t,((t,r)=>{if(t)return n(null,"file");e=r&&r.isDirectory()?"dir":"file",n(null,e)}))},symlinkTypeSync:function(t,e){let n;if(e)return e;try{n=r.lstatSync(t)}catch{return"file"}return n&&n.isDirectory()?"dir":"file"}}},{"graceful-fs":29}],10:[function(t,e,n){"use strict";const r=t("universalify").fromCallback,i=t("path"),o=t("../fs"),s=t("../mkdirs"),c=s.mkdirs,u=s.mkdirsSync,a=t("./symlink-paths"),f=a.symlinkPaths,l=a.symlinkPathsSync,y=t("./symlink-type"),p=y.symlinkType,d=y.symlinkTypeSync,m=t("../path-exists").pathExists,{areIdentical:h}=t("../util/stat");function S(t,e,n,r){f(t,e,((s,u)=>{if(s)return r(s);t=u.toDst,p(u.toCwd,n,((n,s)=>{if(n)return r(n);const u=i.dirname(e);m(u,((n,i)=>n?r(n):i?o.symlink(t,e,s,r):void c(u,(n=>{if(n)return r(n);o.symlink(t,e,s,r)}))))}))}))}e.exports={createSymlink:r((function(t,e,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,o.lstat(e,((i,s)=>{!i&&s.isSymbolicLink()?Promise.all([o.stat(t),o.stat(e)]).then((([i,o])=>{if(h(i,o))return r(null);S(t,e,n,r)})):S(t,e,n,r)}))})),createSymlinkSync:function(t,e,n){let r;try{r=o.lstatSync(e)}catch{}if(r&&r.isSymbolicLink()){const n=o.statSync(t),r=o.statSync(e);if(h(n,r))return}const s=l(t,e);t=s.toDst,n=d(s.toCwd,n);const c=i.dirname(e);return o.existsSync(c)||u(c),o.symlinkSync(t,e,n)}}},{"../fs":11,"../mkdirs":17,"../path-exists":24,"../util/stat":26,"./symlink-paths":8,"./symlink-type":9,path:void 0,universalify:34}],11:[function(t,e,n){"use strict";const r=t("universalify").fromCallback,i=t("graceful-fs"),o=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((t=>"function"==typeof i[t]));Object.assign(n,i),o.forEach((t=>{n[t]=r(i[t])})),n.exists=function(t,e){return"function"==typeof e?i.exists(t,e):new Promise((e=>i.exists(t,e)))},n.read=function(t,e,n,r,o,s){return"function"==typeof s?i.read(t,e,n,r,o,s):new Promise(((s,c)=>{i.read(t,e,n,r,o,((t,e,n)=>{if(t)return c(t);s({bytesRead:e,buffer:n})}))}))},n.write=function(t,e,...n){return"function"==typeof n[n.length-1]?i.write(t,e,...n):new Promise(((r,o)=>{i.write(t,e,...n,((t,e,n)=>{if(t)return o(t);r({bytesWritten:e,buffer:n})}))}))},n.readv=function(t,e,...n){return"function"==typeof n[n.length-1]?i.readv(t,e,...n):new Promise(((r,o)=>{i.readv(t,e,...n,((t,e,n)=>{if(t)return o(t);r({bytesRead:e,buffers:n})}))}))},n.writev=function(t,e,...n){return"function"==typeof n[n.length-1]?i.writev(t,e,...n):new Promise(((r,o)=>{i.writev(t,e,...n,((t,e,n)=>{if(t)return o(t);r({bytesWritten:e,buffers:n})}))}))},"function"==typeof i.realpath.native?n.realpath.native=r(i.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")},{"graceful-fs":29,universalify:34}],12:[function(t,e,n){"use strict";e.exports={...t("./fs"),...t("./copy"),...t("./empty"),...t("./ensure"),...t("./json"),...t("./mkdirs"),...t("./move"),...t("./output-file"),...t("./path-exists"),...t("./remove")}},{"./copy":3,"./empty":4,"./ensure":6,"./fs":11,"./json":13,"./mkdirs":17,"./move":20,"./output-file":23,"./path-exists":24,"./remove":25}],13:[function(t,e,n){"use strict";const r=t("universalify").fromPromise,i=t("./jsonfile");i.outputJson=r(t("./output-json")),i.outputJsonSync=t("./output-json-sync"),i.outputJSON=i.outputJson,i.outputJSONSync=i.outputJsonSync,i.writeJSON=i.writeJson,i.writeJSONSync=i.writeJsonSync,i.readJSON=i.readJson,i.readJSONSync=i.readJsonSync,e.exports=i},{"./jsonfile":14,"./output-json":16,"./output-json-sync":15,universalify:34}],14:[function(t,e,n){"use strict";const r=t("jsonfile");e.exports={readJson:r.readFile,readJsonSync:r.readFileSync,writeJson:r.writeFile,writeJsonSync:r.writeFileSync}},{jsonfile:32}],15:[function(t,e,n){"use strict";const{stringify:r}=t("jsonfile/utils"),{outputFileSync:i}=t("../output-file");e.exports=function(t,e,n){const o=r(e,n);i(t,o,n)}},{"../output-file":23,"jsonfile/utils":33}],16:[function(t,e,n){"use strict";const{stringify:r}=t("jsonfile/utils"),{outputFile:i}=t("../output-file");e.exports=async function(t,e,n={}){const o=r(e,n);await i(t,o,n)}},{"../output-file":23,"jsonfile/utils":33}],17:[function(t,e,n){"use strict";const r=t("universalify").fromPromise,{makeDir:i,makeDirSync:o}=t("./make-dir"),s=r(i);e.exports={mkdirs:s,mkdirsSync:o,mkdirp:s,mkdirpSync:o,ensureDir:s,ensureDirSync:o}},{"./make-dir":18,universalify:34}],18:[function(t,e,n){"use strict";const r=t("../fs"),{checkPath:i}=t("./utils"),o=t=>"number"==typeof t?t:{mode:511,...t}.mode;e.exports.makeDir=async(t,e)=>(i(t),r.mkdir(t,{mode:o(e),recursive:!0})),e.exports.makeDirSync=(t,e)=>(i(t),r.mkdirSync(t,{mode:o(e),recursive:!0}))},{"../fs":11,"./utils":19}],19:[function(t,e,n){"use strict";const r=t("path");e.exports.checkPath=function(t){if("win32"===process.platform){if(/[<>:"|?*]/.test(t.replace(r.parse(t).root,""))){const e=new Error(`Path contains invalid characters: ${t}`);throw e.code="EINVAL",e}}}},{path:void 0}],20:[function(t,e,n){"use strict";const r=t("universalify").fromCallback;e.exports={move:r(t("./move")),moveSync:t("./move-sync")}},{"./move":22,"./move-sync":21,universalify:34}],21:[function(t,e,n){"use strict";const r=t("graceful-fs"),i=t("path"),o=t("../copy").copySync,s=t("../remove").removeSync,c=t("../mkdirs").mkdirpSync,u=t("../util/stat");function a(t,e,n){try{r.renameSync(t,e)}catch(r){if("EXDEV"!==r.code)throw r;return function(t,e,n){return o(t,e,{overwrite:n,errorOnExist:true,preserveTimestamps:true}),s(t)}(t,e,n)}}e.exports=function(t,e,n){const o=(n=n||{}).overwrite||n.clobber||!1,{srcStat:f,isChangingCase:l=!1}=u.checkPathsSync(t,e,"move",n);return u.checkParentPathsSync(t,f,e,"move"),function(t){const e=i.dirname(t);return i.parse(e).root===e}(e)||c(i.dirname(e)),function(t,e,n,i){if(i)return a(t,e,n);if(n)return s(e),a(t,e,n);if(r.existsSync(e))throw new Error("dest already exists.");return a(t,e,n)}(t,e,o,l)}},{"../copy":3,"../mkdirs":17,"../remove":25,"../util/stat":26,"graceful-fs":29,path:void 0}],22:[function(t,e,n){"use strict";const r=t("graceful-fs"),i=t("path"),o=t("../copy").copy,s=t("../remove").remove,c=t("../mkdirs").mkdirp,u=t("../path-exists").pathExists,a=t("../util/stat");function f(t,e,n,r,i){return r?l(t,e,n,i):n?s(e,(r=>r?i(r):l(t,e,n,i))):void u(e,((r,o)=>r?i(r):o?i(new Error("dest already exists.")):l(t,e,n,i)))}function l(t,e,n,i){r.rename(t,e,(r=>r?"EXDEV"!==r.code?i(r):function(t,e,n,r){o(t,e,{overwrite:n,errorOnExist:!0,preserveTimestamps:!0},(e=>e?r(e):s(t,r)))}(t,e,n,i):i()))}e.exports=function(t,e,n,r){"function"==typeof n&&(r=n,n={});const o=(n=n||{}).overwrite||n.clobber||!1;a.checkPaths(t,e,"move",n,((n,s)=>{if(n)return r(n);const{srcStat:u,isChangingCase:l=!1}=s;a.checkParentPaths(t,u,e,"move",(n=>n?r(n):function(t){const e=i.dirname(t);return i.parse(e).root===e}(e)?f(t,e,o,l,r):void c(i.dirname(e),(n=>n?r(n):f(t,e,o,l,r)))))}))}},{"../copy":3,"../mkdirs":17,"../path-exists":24,"../remove":25,"../util/stat":26,"graceful-fs":29,path:void 0}],23:[function(t,e,n){"use strict";const r=t("universalify").fromCallback,i=t("graceful-fs"),o=t("path"),s=t("../mkdirs"),c=t("../path-exists").pathExists;e.exports={outputFile:r((function(t,e,n,r){"function"==typeof n&&(r=n,n="utf8");const u=o.dirname(t);c(u,((o,c)=>o?r(o):c?i.writeFile(t,e,n,r):void s.mkdirs(u,(o=>{if(o)return r(o);i.writeFile(t,e,n,r)}))))})),outputFileSync:function(t,...e){const n=o.dirname(t);if(i.existsSync(n))return i.writeFileSync(t,...e);s.mkdirsSync(n),i.writeFileSync(t,...e)}}},{"../mkdirs":17,"../path-exists":24,"graceful-fs":29,path:void 0,universalify:34}],24:[function(t,e,n){"use strict";const r=t("universalify").fromPromise,i=t("../fs");e.exports={pathExists:r((function(t){return i.access(t).then((()=>!0)).catch((()=>!1))})),pathExistsSync:i.existsSync}},{"../fs":11,universalify:34}],25:[function(t,e,n){"use strict";const r=t("graceful-fs"),i=t("universalify").fromCallback;e.exports={remove:i((function(t,e){r.rm(t,{recursive:!0,force:!0},e)})),removeSync:function(t){r.rmSync(t,{recursive:!0,force:!0})}}},{"graceful-fs":29,universalify:34}],26:[function(t,e,n){"use strict";const r=t("../fs"),i=t("path"),o=t("util");function s(t,e,n){const i=n.dereference?t=>r.stat(t,{bigint:!0}):t=>r.lstat(t,{bigint:!0});return Promise.all([i(t),i(e).catch((t=>{if("ENOENT"===t.code)return null;throw t}))]).then((([t,e])=>({srcStat:t,destStat:e})))}function c(t,e){return e.ino&&e.dev&&e.ino===t.ino&&e.dev===t.dev}function u(t,e){const n=i.resolve(t).split(i.sep).filter((t=>t)),r=i.resolve(e).split(i.sep).filter((t=>t));return n.reduce(((t,e,n)=>t&&r[n]===e),!0)}function a(t,e,n){return`Cannot ${n} '${t}' to a subdirectory of itself, '${e}'.`}e.exports={checkPaths:function(t,e,n,r,f){o.callbackify(s)(t,e,r,((r,o)=>{if(r)return f(r);const{srcStat:s,destStat:l}=o;if(l){if(c(s,l)){const r=i.basename(t),o=i.basename(e);return"move"===n&&r!==o&&r.toLowerCase()===o.toLowerCase()?f(null,{srcStat:s,destStat:l,isChangingCase:!0}):f(new Error("Source and destination must not be the same."))}if(s.isDirectory()&&!l.isDirectory())return f(new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`));if(!s.isDirectory()&&l.isDirectory())return f(new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`))}return s.isDirectory()&&u(t,e)?f(new Error(a(t,e,n))):f(null,{srcStat:s,destStat:l})}))},checkPathsSync:function(t,e,n,o){const{srcStat:s,destStat:f}=function(t,e,n){let i;const o=n.dereference?t=>r.statSync(t,{bigint:!0}):t=>r.lstatSync(t,{bigint:!0}),s=o(t);try{i=o(e)}catch(t){if("ENOENT"===t.code)return{srcStat:s,destStat:null};throw t}return{srcStat:s,destStat:i}}(t,e,o);if(f){if(c(s,f)){const r=i.basename(t),o=i.basename(e);if("move"===n&&r!==o&&r.toLowerCase()===o.toLowerCase())return{srcStat:s,destStat:f,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(s.isDirectory()&&!f.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!s.isDirectory()&&f.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(s.isDirectory()&&u(t,e))throw new Error(a(t,e,n));return{srcStat:s,destStat:f}},checkParentPaths:function t(e,n,o,s,u){const f=i.resolve(i.dirname(e)),l=i.resolve(i.dirname(o));if(l===f||l===i.parse(l).root)return u();r.stat(l,{bigint:!0},((r,i)=>r?"ENOENT"===r.code?u():u(r):c(n,i)?u(new Error(a(e,o,s))):t(e,n,l,s,u)))},checkParentPathsSync:function t(e,n,o,s){const u=i.resolve(i.dirname(e)),f=i.resolve(i.dirname(o));if(f===u||f===i.parse(f).root)return;let l;try{l=r.statSync(f,{bigint:!0})}catch(t){if("ENOENT"===t.code)return;throw t}if(c(n,l))throw new Error(a(e,o,s));return t(e,n,f,s)},isSrcSubdir:u,areIdentical:c}},{"../fs":11,path:void 0,util:void 0}],27:[function(t,e,n){"use strict";const r=t("graceful-fs");e.exports={utimesMillis:function(t,e,n,i){r.open(t,"r+",((t,o)=>{if(t)return i(t);r.futimes(o,e,n,(t=>{r.close(o,(e=>{i&&i(t||e)}))}))}))},utimesMillisSync:function(t,e,n){const i=r.openSync(t,"r+");return r.futimesSync(i,e,n),r.closeSync(i)}}},{"graceful-fs":29}],28:[function(t,e,n){"use strict";e.exports=function(t){if(null===t||"object"!=typeof t)return t;if(t instanceof Object)var e={__proto__:r(t)};else e=Object.create(null);return Object.getOwnPropertyNames(t).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e};var r=Object.getPrototypeOf||function(t){return t.__proto__}},{}],29:[function(t,e,n){var r,i,o=t("fs"),s=t("./polyfills.js"),c=t("./legacy-streams.js"),u=t("./clone.js"),a=t("util");function f(t,e){Object.defineProperty(t,r,{get:function(){return e}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(r=Symbol.for("graceful-fs.queue"),i=Symbol.for("graceful-fs.previous")):(r="___graceful-fs.queue",i="___graceful-fs.previous");var l,y=function(){};if(a.debuglog?y=a.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(y=function(){var t=a.format.apply(a,arguments);t="GFS4: "+t.split(/\n/).join("\nGFS4: "),console.error(t)}),!o[r]){var p=global[r]||[];f(o,p),o.close=function(t){function e(e,n){return t.call(o,e,(function(t){t||h(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(e,i,{value:t}),e}(o.close),o.closeSync=function(t){function e(e){t.apply(o,arguments),h()}return Object.defineProperty(e,i,{value:t}),e}(o.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){y(o[r]),t("assert").equal(o[r].length,0)}))}function d(t){s(t),t.gracefulify=d,t.createReadStream=function(e,n){return new t.ReadStream(e,n)},t.createWriteStream=function(e,n){return new t.WriteStream(e,n)};var e=t.readFile;t.readFile=function(t,n,r){"function"==typeof n&&(r=n,n=null);return function t(n,r,i,o){return e(n,r,(function(e){!e||"EMFILE"!==e.code&&"ENFILE"!==e.code?"function"==typeof i&&i.apply(this,arguments):m([t,[n,r,i],e,o||Date.now(),Date.now()])}))}(t,n,r)};var n=t.writeFile;t.writeFile=function(t,e,r,i){"function"==typeof r&&(i=r,r=null);return function t(e,r,i,o,s){return n(e,r,i,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):m([t,[e,r,i,o],n,s||Date.now(),Date.now()])}))}(t,e,r,i)};var r=t.appendFile;r&&(t.appendFile=function(t,e,n,i){"function"==typeof n&&(i=n,n=null);return function t(e,n,i,o,s){return r(e,n,i,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):m([t,[e,n,i,o],r,s||Date.now(),Date.now()])}))}(t,e,n,i)});var i=t.copyFile;i&&(t.copyFile=function(t,e,n,r){"function"==typeof n&&(r=n,n=0);return function t(e,n,r,o,s){return i(e,n,r,(function(i){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof o&&o.apply(this,arguments):m([t,[e,n,r,o],i,s||Date.now(),Date.now()])}))}(t,e,n,r)});var o=t.readdir;t.readdir=function(t,e,n){"function"==typeof e&&(n=e,e=null);var r=u.test(process.version)?function(t,e,n,r){return o(t,i(t,e,n,r))}:function(t,e,n,r){return o(t,e,i(t,e,n,r))};return r(t,e,n);function i(t,e,n,i){return function(o,s){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(s&&s.sort&&s.sort(),"function"==typeof n&&n.call(this,o,s)):m([r,[t,e,n],o,i||Date.now(),Date.now()])}}};var u=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var a=c(t);h=a.ReadStream,S=a.WriteStream}var f=t.ReadStream;f&&(h.prototype=Object.create(f.prototype),h.prototype.open=function(){var t=this;w(t.path,t.flags,t.mode,(function(e,n){e?(t.autoClose&&t.destroy(),t.emit("error",e)):(t.fd=n,t.emit("open",n),t.read())}))});var l=t.WriteStream;l&&(S.prototype=Object.create(l.prototype),S.prototype.open=function(){var t=this;w(t.path,t.flags,t.mode,(function(e,n){e?(t.destroy(),t.emit("error",e)):(t.fd=n,t.emit("open",n))}))}),Object.defineProperty(t,"ReadStream",{get:function(){return h},set:function(t){h=t},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return S},set:function(t){S=t},enumerable:!0,configurable:!0});var y=h;Object.defineProperty(t,"FileReadStream",{get:function(){return y},set:function(t){y=t},enumerable:!0,configurable:!0});var p=S;function h(t,e){return this instanceof h?(f.apply(this,arguments),this):h.apply(Object.create(h.prototype),arguments)}function S(t,e){return this instanceof S?(l.apply(this,arguments),this):S.apply(Object.create(S.prototype),arguments)}Object.defineProperty(t,"FileWriteStream",{get:function(){return p},set:function(t){p=t},enumerable:!0,configurable:!0});var v=t.open;function w(t,e,n,r){return"function"==typeof n&&(r=n,n=null),function t(e,n,r,i,o){return v(e,n,r,(function(s,c){!s||"EMFILE"!==s.code&&"ENFILE"!==s.code?"function"==typeof i&&i.apply(this,arguments):m([t,[e,n,r,i],s,o||Date.now(),Date.now()])}))}(t,e,n,r)}return t.open=w,t}function m(t){y("ENQUEUE",t[0].name,t[1]),o[r].push(t),S()}function h(){for(var t=Date.now(),e=0;e2&&(o[r][e][3]=t,o[r][e][4]=t);S()}function S(){if(clearTimeout(l),l=void 0,0!==o[r].length){var t=o[r].shift(),e=t[0],n=t[1],i=t[2],s=t[3],c=t[4];if(void 0===s)y("RETRY",e.name,n),e.apply(null,n);else if(Date.now()-s>=6e4){y("TIMEOUT",e.name,n);var u=n.pop();"function"==typeof u&&u.call(null,i)}else{var a=Date.now()-c,f=Math.max(c-s,1);a>=Math.min(1.2*f,100)?(y("RETRY",e.name,n),e.apply(null,n.concat([s]))):o[r].push(t)}void 0===l&&(l=setTimeout(S,0))}}global[r]||f(global,o[r]),e.exports=d(u(o)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!o.__patched&&(e.exports=d(o),o.__patched=!0)},{"./clone.js":28,"./legacy-streams.js":30,"./polyfills.js":31,assert:void 0,fs:void 0,util:void 0}],30:[function(t,e,n){var r=t("stream").Stream;e.exports=function(t){return{ReadStream:function e(n,i){if(!(this instanceof e))return new e(n,i);r.call(this);var o=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,i=i||{};for(var s=Object.keys(i),c=0,u=s.length;cthis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){o._read()}));t.open(this.path,this.flags,this.mode,(function(t,e){if(t)return o.emit("error",t),void(o.readable=!1);o.fd=e,o.emit("open",e),o._read()}))},WriteStream:function e(n,i){if(!(this instanceof e))return new e(n,i);r.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),s=0,c=o.length;s= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}}},{stream:void 0}],31:[function(t,e,n){var r=t("constants"),i=process.cwd,o=null,s=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return o||(o=i.call(process)),o};try{process.cwd()}catch(t){}if("function"==typeof process.chdir){var c=process.chdir;process.chdir=function(t){o=null,c.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,c)}e.exports=function(t){r.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(t){t.lchmod=function(e,n,i){t.open(e,r.O_WRONLY|r.O_SYMLINK,n,(function(e,r){e?i&&i(e):t.fchmod(r,n,(function(e){t.close(r,(function(t){i&&i(e||t)}))}))}))},t.lchmodSync=function(e,n){var i,o=t.openSync(e,r.O_WRONLY|r.O_SYMLINK,n),s=!0;try{i=t.fchmodSync(o,n),s=!1}finally{if(s)try{t.closeSync(o)}catch(t){}else t.closeSync(o)}return i}}(t);t.lutimes||function(t){r.hasOwnProperty("O_SYMLINK")&&t.futimes?(t.lutimes=function(e,n,i,o){t.open(e,r.O_SYMLINK,(function(e,r){e?o&&o(e):t.futimes(r,n,i,(function(e){t.close(r,(function(t){o&&o(e||t)}))}))}))},t.lutimesSync=function(e,n,i){var o,s=t.openSync(e,r.O_SYMLINK),c=!0;try{o=t.futimesSync(s,n,i),c=!1}finally{if(c)try{t.closeSync(s)}catch(t){}else t.closeSync(s)}return o}):t.futimes&&(t.lutimes=function(t,e,n,r){r&&process.nextTick(r)},t.lutimesSync=function(){})}(t);t.chown=i(t.chown),t.fchown=i(t.fchown),t.lchown=i(t.lchown),t.chmod=e(t.chmod),t.fchmod=e(t.fchmod),t.lchmod=e(t.lchmod),t.chownSync=o(t.chownSync),t.fchownSync=o(t.fchownSync),t.lchownSync=o(t.lchownSync),t.chmodSync=n(t.chmodSync),t.fchmodSync=n(t.fchmodSync),t.lchmodSync=n(t.lchmodSync),t.stat=c(t.stat),t.fstat=c(t.fstat),t.lstat=c(t.lstat),t.statSync=u(t.statSync),t.fstatSync=u(t.fstatSync),t.lstatSync=u(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(t,e,n){n&&process.nextTick(n)},t.lchmodSync=function(){});t.chown&&!t.lchown&&(t.lchown=function(t,e,n,r){r&&process.nextTick(r)},t.lchownSync=function(){});"win32"===s&&(t.rename="function"!=typeof t.rename?t.rename:function(e){function n(n,r,i){var o=Date.now(),s=0;e(n,r,(function c(u){if(u&&("EACCES"===u.code||"EPERM"===u.code||"EBUSY"===u.code)&&Date.now()-o<6e4)return setTimeout((function(){t.stat(r,(function(t,o){t&&"ENOENT"===t.code?e(n,r,c):i(u)}))}),s),void(s<100&&(s+=10));i&&i(u)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,e),n}(t.rename));function e(e){return e?function(n,r,i){return e.call(t,n,r,(function(t){a(t)&&(t=null),i&&i.apply(this,arguments)}))}:e}function n(e){return e?function(n,r){try{return e.call(t,n,r)}catch(t){if(!a(t))throw t}}:e}function i(e){return e?function(n,r,i,o){return e.call(t,n,r,i,(function(t){a(t)&&(t=null),o&&o.apply(this,arguments)}))}:e}function o(e){return e?function(n,r,i){try{return e.call(t,n,r,i)}catch(t){if(!a(t))throw t}}:e}function c(e){return e?function(n,r,i){function o(t,e){e&&(e.uid<0&&(e.uid+=4294967296),e.gid<0&&(e.gid+=4294967296)),i&&i.apply(this,arguments)}return"function"==typeof r&&(i=r,r=null),r?e.call(t,n,r,o):e.call(t,n,o)}:e}function u(e){return e?function(n,r){var i=r?e.call(t,n,r):e.call(t,n);return i&&(i.uid<0&&(i.uid+=4294967296),i.gid<0&&(i.gid+=4294967296)),i}:e}function a(t){return!t||("ENOSYS"===t.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==t.code&&"EPERM"!==t.code))}t.read="function"!=typeof t.read?t.read:function(e){function n(n,r,i,o,s,c){var u;if(c&&"function"==typeof c){var a=0;u=function(f,l,y){if(f&&"EAGAIN"===f.code&&a<10)return a++,e.call(t,n,r,i,o,s,u);c.apply(this,arguments)}}return e.call(t,n,r,i,o,s,u)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,e),n}(t.read),t.readSync="function"!=typeof t.readSync?t.readSync:(f=t.readSync,function(e,n,r,i,o){for(var s=0;;)try{return f.call(t,e,n,r,i,o)}catch(t){if("EAGAIN"===t.code&&s<10){s++;continue}throw t}});var f}},{constants:void 0}],32:[function(t,e,n){let r;try{r=t("graceful-fs")}catch(e){r=t("fs")}const i=t("universalify"),{stringify:o,stripBom:s}=t("./utils");const c={readFile:i.fromPromise((async function(t,e={}){"string"==typeof e&&(e={encoding:e});const n=e.fs||r,o=!("throws"in e)||e.throws;let c,u=await i.fromCallback(n.readFile)(t,e);u=s(u);try{c=JSON.parse(u,e?e.reviver:null)}catch(e){if(o)throw e.message=`${t}: ${e.message}`,e;return null}return c})),readFileSync:function(t,e={}){"string"==typeof e&&(e={encoding:e});const n=e.fs||r,i=!("throws"in e)||e.throws;try{let r=n.readFileSync(t,e);return r=s(r),JSON.parse(r,e.reviver)}catch(e){if(i)throw e.message=`${t}: ${e.message}`,e;return null}},writeFile:i.fromPromise((async function(t,e,n={}){const s=n.fs||r,c=o(e,n);await i.fromCallback(s.writeFile)(t,c,n)})),writeFileSync:function(t,e,n={}){const i=n.fs||r,s=o(e,n);return i.writeFileSync(t,s,n)}};e.exports=c},{"./utils":33,fs:void 0,"graceful-fs":29,universalify:34}],33:[function(t,e,n){e.exports={stringify:function(t,{EOL:e="\n",finalEOL:n=!0,replacer:r=null,spaces:i}={}){const o=n?e:"";return JSON.stringify(t,r,i).replace(/\n/g,e)+o},stripBom:function(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}}},{}],34:[function(t,e,n){"use strict";n.fromCallback=function(t){return Object.defineProperty((function(...e){if("function"!=typeof e[e.length-1])return new Promise(((n,r)=>{t.call(this,...e,((t,e)=>null!=t?r(t):n(e)))}));t.apply(this,e)}),"name",{value:t.name})},n.fromPromise=function(t){return Object.defineProperty((function(...e){const n=e[e.length-1];if("function"!=typeof n)return t.apply(this,e);t.apply(this,e.slice(0,-1)).then((t=>n(null,t)),n)}),"name",{value:t.name})}},{}]},{},[12])(12)})); \ No newline at end of file diff --git a/fixtures/exit_123.asar b/fixtures/exit_123.asar deleted file mode 100644 index f10e2f4..0000000 Binary files a/fixtures/exit_123.asar and /dev/null differ diff --git a/fixtures/print_filename.asar b/fixtures/print_filename.asar deleted file mode 100644 index 17a6e75..0000000 Binary files a/fixtures/print_filename.asar and /dev/null differ diff --git a/src/asar_monkey_patch.js b/src/asar_monkey_patch.js index 62c7aa2..1b848df 100644 --- a/src/asar_monkey_patch.js +++ b/src/asar_monkey_patch.js @@ -1,5 +1,6 @@ const childProcess = require('child_process') const path = require('path') +const util = require('util') // The root dir of asar archive. const rootDir = path._makeLong(path.join(execPath, 'asar')) @@ -171,6 +172,8 @@ exports.wrapFsWithAsar = function(fs) { }) } + fs.promises.lstat = util.promisify(fs.lstat) + const {statSync} = fs fs.statSync = function(p) { const [isAsar] = splitPath(p) @@ -191,57 +194,76 @@ exports.wrapFsWithAsar = function(fs) { }) } - const {realpathSync} = fs - fs.realpathSync = function(p) { - const [isAsar, filePath] = splitPath(p) - if (!isAsar) - return realpathSync.apply(this, arguments) - const info = process.asarArchive.getFileInfo(filePath) - if (!info) - return notFoundError(filePath) - const real = process.asarArchive.realpath(info) - if (info.unpacked) - return real - else - return path.join(realpathSync(execPath), 'asar', real) - } + fs.promises.stat = util.promisify(fs.lstat) - const {realpath} = fs - fs.realpath = function(p, cache, callback) { - const [isAsar, filePath] = splitPath(p) - if (!isAsar) - return realpath.apply(this, arguments) - if (typeof cache === 'function') { - callback = cache - cache = undefined + const wrapRealpathSync = function(func) { + return function(p) { + const [isAsar, filePath] = splitPath(p) + if (!isAsar) + return func.apply(this, arguments) + const info = process.asarArchive.getFileInfo(filePath) + if (!info) + return notFoundError(filePath) + const real = process.asarArchive.realpath(info) + if (info.unpacked) + return real + else + return path.join(func(execPath), 'asar', real) } - const info = process.asarArchive.getFileInfo(filePath) - if (!info) - return notFoundError(filePath, callback) - const real = process.asarArchive.realpath(info) - if (info.unpacked) { - callback(null, real) - } else { - realpath(execPath, function(err, p) { - if (err) - return callback(err) - return callback(null, path.join(p, 'asar', real)) - }) + } + + const {realpathSync} = fs + fs.realpathSync = wrapRealpathSync(realpathSync) + fs.realpathSync.native = wrapRealpathSync(realpathSync.native); + + const wrapRealpath = function(func) { + return function(p, cache, callback) { + const [isAsar, filePath] = splitPath(p) + if (!isAsar) + return func.apply(this, arguments) + if (typeof cache === 'function') { + callback = cache + cache = undefined + } + const info = process.asarArchive.getFileInfo(filePath) + if (!info) + return notFoundError(filePath, callback) + const real = process.asarArchive.realpath(info) + if (info.unpacked) { + callback(null, real) + } else { + func(execPath, function(err, p) { + if (err) + return callback(err) + return callback(null, path.join(p, 'asar', real)) + }) + } } } + const {realpath} = fs + fs.realpath = wrapRealpath(realpath) + fs.realpath.native = wrapRealpath(realpath.native) + + fs.promises.realpath = util.promisify(fs.realpath.native) + const {exists} = fs fs.exists = function(p, callback) { const [isAsar, filePath] = splitPath(p) if (!isAsar) return exists(p, callback) process.nextTick(function() { - // Disabled due to false positive in StandardJS - // eslint-disable-next-line standard/no-callback-literal callback(process.asarArchive.stat(filePath) !== false) }) } + fs.exists[util.promisify.custom] = function(p) { + const [isAsar, filePath] = splitPath(p) + if (!isAsar) + return exists[util.promisify.custom](p) + return Promise.resolve(process.asarArchive.stat(filePath) !== false) + } + const {existsSync} = fs fs.existsSync = function(p) { const [isAsar, filePath] = splitPath(p) @@ -276,6 +298,8 @@ exports.wrapFsWithAsar = function(fs) { }) } + fs.promises.access = util.promisify(fs.access) + const {accessSync} = fs fs.accessSync = function(p, mode) { const [isAsar, filePath] = splitPath(p) @@ -345,6 +369,15 @@ exports.wrapFsWithAsar = function(fs) { }) } + const {readFilePromise} = fs.promises + fs.promises.readFile = function(p, options) { + const [isAsar, filePath] = splitPath(p) + if (!isAsar) + return readFilePromise.apply(this, arguments) + + return util.promisify(fs.readFile)(p,options) + } + const {readFileSync} = fs fs.readFileSync = function(p, options) { const [isAsar, filePath] = splitPath(p) @@ -398,6 +431,8 @@ exports.wrapFsWithAsar = function(fs) { }) } + fs.promises.readdir = util.promisify(fs.readdir) + const {readdirSync} = fs fs.readdirSync = function(p) { const [isAsar, filePath] = splitPath(p) diff --git a/test/asar_exit_123/index.js b/test/asar_exit_123/index.js new file mode 100644 index 0000000..9788266 --- /dev/null +++ b/test/asar_exit_123/index.js @@ -0,0 +1 @@ +process.exit(123) diff --git a/fixtures/print_self.asar b/test/asar_fs_async/index.js similarity index 67% rename from fixtures/print_self.asar rename to test/asar_fs_async/index.js index 1c44fef..d831a9b 100644 Binary files a/fixtures/print_self.asar and b/test/asar_fs_async/index.js differ diff --git a/test/asar_fs_promise/index.js b/test/asar_fs_promise/index.js new file mode 100644 index 0000000..a5e2465 --- /dev/null +++ b/test/asar_fs_promise/index.js @@ -0,0 +1,6 @@ +const fs = require('node:fs/promises'); + +(async function() { + process.stdout.write((await fs.readFile(__filename)).toString()); + process.exit(0) +})() diff --git a/test/asar_print_filename/index.js b/test/asar_print_filename/index.js new file mode 100644 index 0000000..097d370 --- /dev/null +++ b/test/asar_print_filename/index.js @@ -0,0 +1,2 @@ +console.log(__filename) +process.exit(0) diff --git a/test.js b/test/main.js similarity index 72% rename from test.js rename to test/main.js index 3780084..21ad1bb 100755 --- a/test.js +++ b/test/main.js @@ -2,12 +2,12 @@ // Run the tests defined in this file. if (require.main == module) { - const Mocha = require('./deps/mocha') + const Mocha = require('../deps/mocha') const mocha = new Mocha mocha.ui('bdd').reporter('tap') for (let member in require.cache) // make require('test.js') work delete require.cache[member] - mocha.addFile('test.js') + mocha.addFile('test/main.js') mocha.run((failures) => process.exit(failures)) return } @@ -15,6 +15,7 @@ if (require.main == module) { const assert = require('assert') const path = require('path') const fs = require('fs') +const asar = require('../deps/asar') describe('property', function() { describe('process.versions.yode', function() { @@ -58,6 +59,11 @@ describe('node', function() { }) }) + it('fetch should work', async () => { + const res = await fetch('https://google.com') + assert.equal(res.status, 200) + }) + it('fork should work', function(done) { const p = path.join(require('os').tmpdir(), 'yode-fork.js') fs.writeFileSync(p, "process.send('ok')") @@ -92,26 +98,32 @@ describe('node', function() { }) }) - it('start with asar', function() { - const result = packageAndRun('exit_123') + it('start with asar', async () => { + const result = await packageAndRun('exit_123') assert.equal(result.status, 123) }) - it('start with asar with output', function() { - const result = packageAndRun('print_filename') + it('start with asar with output', async () => { + const result = await packageAndRun('print_filename') assert.equal(result.status, 0) - const p = path.join(__dirname, `print_filename_${path.basename(process.execPath)}`, 'asar', 'index.js') + const p = path.join(__dirname, '..', `print_filename_${path.basename(process.execPath)}`, 'asar', 'index.js') assert.equal(result.stdout.toString().trim(), p) }) - it('start with asar with fs', function() { - const result = packageAndRun('print_self') + it('start with asar with async fs', async () => { + const result = await packageAndRun('fs_async') + assert.equal(result.status, 0) + assert.ok(result.stdout.toString().includes('fs.readFile(__filename')) + }) + + it('start with asar with promise fs', async () => { + const result = await packageAndRun('fs_promise') assert.equal(result.status, 0) assert.ok(result.stdout.toString().includes('fs.readFile(__filename')) }) - it('start with asar with offset', function() { - const result = packageAndRun('print_self', changeOffset) + it('start with asar with offset', async () => { + const result = await packageAndRun('fs_async', changeOffset) assert.equal(result.status, 0) assert.ok(result.stdout.toString().includes('fs.readFile(__filename')) }) @@ -121,9 +133,10 @@ describe('node', function() { }) }) -function packageAndRun(asar, modifyBinary = null) { - const a = path.join(__dirname, 'fixtures', asar + '.asar') - const p = path.join(__dirname, `${path.basename(asar, '.asar')}_${path.basename(process.execPath)}`) +async function packageAndRun(filename, modifyBinary = null) { + const a = path.join(__dirname, '..', filename + '.asar') + await asar.createPackage(path.join(__dirname, 'asar_' + filename), a) + const p = path.join(__dirname, '..', `${filename}_${path.basename(process.execPath)}`) fs.writeFileSync(p, fs.readFileSync(process.execPath)) if (modifyBinary) modifyBinary(p) @@ -131,8 +144,11 @@ function packageAndRun(asar, modifyBinary = null) { appendMeta(p, a) fs.chmodSync(p, 0o755) const result = require('child_process').spawnSync(p) - if (result.status !== null) - fs.unlinkSync(p) // will be left for debugging if failed to run + if (result.status !== null) { + // Will be left for debugging if failed to run. + fs.unlinkSync(a) + fs.unlinkSync(p) + } return result }