yann-fs
Version:
Enhanced fs-extra with better error handling
3 lines (2 loc) • 41.1 kB
JavaScript
import*as t from"fs";import n from"fs";import e from"constants";import r from"stream";import i from"util";import o from"assert";import c from"path";function u(t,n,e,r){return new(e||(e=Promise))((function(i,o){function c(t){try{s(r.next(t))}catch(t){o(t)}}function u(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var n;t.done?i(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(c,u)}s((r=r.apply(t,n||[])).next())}))}function s(t,n){var e,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return c.next=u(0),c.throw=u(1),c.return=u(2),"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function u(u){return function(s){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;c&&(c=0,u[0]&&(o=0)),o;)try{if(e=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=n.call(t,o)}catch(t){u=[6,t],r=0}finally{e=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}function f(t,n){return t.then((function(t){return[null,t]})).catch((function(t){return[t,void 0]}))}"function"==typeof SuppressedError&&SuppressedError;var a,l,d,y,h,p,m,S,v,w,E="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},b={},k={};function g(){return a||(a=1,k.fromCallback=function(t){return Object.defineProperty((function(...n){if("function"!=typeof n[n.length-1])return new Promise(((e,r)=>{n.push(((t,n)=>null!=t?r(t):e(n))),t.apply(this,n)}));t.apply(this,n)}),"name",{value:t.name})},k.fromPromise=function(t){return Object.defineProperty((function(...n){const e=n[n.length-1];if("function"!=typeof e)return t.apply(this,n);n.pop(),t.apply(this,n).then((t=>e(null,t)),e)}),"name",{value:t.name})}),k}function O(){if(d)return l;d=1;var t=e,n=process.cwd,r=null,i=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return r||(r=n.call(process)),r};try{process.cwd()}catch(t){}if("function"==typeof process.chdir){var o=process.chdir;process.chdir=function(t){r=null,o.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,o)}return l=function(n){t.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(n){n.lchmod=function(e,r,i){n.open(e,t.O_WRONLY|t.O_SYMLINK,r,(function(t,e){t?i&&i(t):n.fchmod(e,r,(function(t){n.close(e,(function(n){i&&i(t||n)}))}))}))},n.lchmodSync=function(e,r){var i,o=n.openSync(e,t.O_WRONLY|t.O_SYMLINK,r),c=!0;try{i=n.fchmodSync(o,r),c=!1}finally{if(c)try{n.closeSync(o)}catch(t){}else n.closeSync(o)}return i}}(n);n.lutimes||function(n){t.hasOwnProperty("O_SYMLINK")&&n.futimes?(n.lutimes=function(e,r,i,o){n.open(e,t.O_SYMLINK,(function(t,e){t?o&&o(t):n.futimes(e,r,i,(function(t){n.close(e,(function(n){o&&o(t||n)}))}))}))},n.lutimesSync=function(e,r,i){var o,c=n.openSync(e,t.O_SYMLINK),u=!0;try{o=n.futimesSync(c,r,i),u=!1}finally{if(u)try{n.closeSync(c)}catch(t){}else n.closeSync(c)}return o}):n.futimes&&(n.lutimes=function(t,n,e,r){r&&process.nextTick(r)},n.lutimesSync=function(){})}(n);n.chown=o(n.chown),n.fchown=o(n.fchown),n.lchown=o(n.lchown),n.chmod=e(n.chmod),n.fchmod=e(n.fchmod),n.lchmod=e(n.lchmod),n.chownSync=c(n.chownSync),n.fchownSync=c(n.fchownSync),n.lchownSync=c(n.lchownSync),n.chmodSync=r(n.chmodSync),n.fchmodSync=r(n.fchmodSync),n.lchmodSync=r(n.lchmodSync),n.stat=u(n.stat),n.fstat=u(n.fstat),n.lstat=u(n.lstat),n.statSync=s(n.statSync),n.fstatSync=s(n.fstatSync),n.lstatSync=s(n.lstatSync),n.chmod&&!n.lchmod&&(n.lchmod=function(t,n,e){e&&process.nextTick(e)},n.lchmodSync=function(){});n.chown&&!n.lchown&&(n.lchown=function(t,n,e,r){r&&process.nextTick(r)},n.lchownSync=function(){});"win32"===i&&(n.rename="function"!=typeof n.rename?n.rename:function(t){function e(e,r,i){var o=Date.now(),c=0;t(e,r,(function u(s){if(s&&("EACCES"===s.code||"EPERM"===s.code||"EBUSY"===s.code)&&Date.now()-o<6e4)return setTimeout((function(){n.stat(r,(function(n,o){n&&"ENOENT"===n.code?t(e,r,u):i(s)}))}),c),void(c<100&&(c+=10));i&&i(s)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(e,t),e}(n.rename));function e(t){return t?function(e,r,i){return t.call(n,e,r,(function(t){f(t)&&(t=null),i&&i.apply(this,arguments)}))}:t}function r(t){return t?function(e,r){try{return t.call(n,e,r)}catch(t){if(!f(t))throw t}}:t}function o(t){return t?function(e,r,i,o){return t.call(n,e,r,i,(function(t){f(t)&&(t=null),o&&o.apply(this,arguments)}))}:t}function c(t){return t?function(e,r,i){try{return t.call(n,e,r,i)}catch(t){if(!f(t))throw t}}:t}function u(t){return t?function(e,r,i){function o(t,n){n&&(n.uid<0&&(n.uid+=4294967296),n.gid<0&&(n.gid+=4294967296)),i&&i.apply(this,arguments)}return"function"==typeof r&&(i=r,r=null),r?t.call(n,e,r,o):t.call(n,e,o)}:t}function s(t){return t?function(e,r){var i=r?t.call(n,e,r):t.call(n,e);return i&&(i.uid<0&&(i.uid+=4294967296),i.gid<0&&(i.gid+=4294967296)),i}:t}function f(t){return!t||("ENOSYS"===t.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==t.code&&"EPERM"!==t.code))}n.read="function"!=typeof n.read?n.read:function(t){function e(e,r,i,o,c,u){var s;if(u&&"function"==typeof u){var f=0;s=function(a,l,d){if(a&&"EAGAIN"===a.code&&f<10)return f++,t.call(n,e,r,i,o,c,s);u.apply(this,arguments)}}return t.call(n,e,r,i,o,c,s)}return Object.setPrototypeOf&&Object.setPrototypeOf(e,t),e}(n.read),n.readSync="function"!=typeof n.readSync?n.readSync:(a=n.readSync,function(t,e,r,i,o){for(var c=0;;)try{return a.call(n,t,e,r,i,o)}catch(t){if("EAGAIN"===t.code&&c<10){c++;continue}throw t}});var a},l}function P(){if(v)return S;v=1;var t,e,c=n,u=O(),s=function(){if(h)return y;h=1;var t=r.Stream;return y=function(n){return{ReadStream:function e(r,i){if(!(this instanceof e))return new e(r,i);t.call(this);var o=this;this.path=r,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,i=i||{};for(var c=Object.keys(i),u=0,s=c.length;u<s;u++){var f=c[u];this[f]=i[f]}if(this.encoding&&this.setEncoding(this.encoding),void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(void 0===this.end)this.end=1/0;else if("number"!=typeof this.end)throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}null===this.fd?n.open(this.path,this.flags,this.mode,(function(t,n){if(t)return o.emit("error",t),void(o.readable=!1);o.fd=n,o.emit("open",n),o._read()})):process.nextTick((function(){o._read()}))},WriteStream:function e(r,i){if(!(this instanceof e))return new e(r,i);t.call(this),this.path=r,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),c=0,u=o.length;c<u;c++){var s=o[c];this[s]=i[s]}if(void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=n.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}},y}(),f=function(){if(m)return p;m=1,p=function(n){if(null===n||"object"!=typeof n)return n;if(n instanceof Object)var e={__proto__:t(n)};else e=Object.create(null);return Object.getOwnPropertyNames(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})),e};var t=Object.getPrototypeOf||function(t){return t.__proto__};return p}(),a=i;function l(n,e){Object.defineProperty(n,t,{get:function(){return e}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(t=Symbol.for("graceful-fs.queue"),e=Symbol.for("graceful-fs.previous")):(t="___graceful-fs.queue",e="___graceful-fs.previous");var d,w=function(){};if(a.debuglog?w=a.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(w=function(){var t=a.format.apply(a,arguments);t="GFS4: "+t.split(/\n/).join("\nGFS4: "),console.error(t)}),!c[t]){var b=E[t]||[];l(c,b),c.close=function(t){function n(n,e){return t.call(c,n,(function(t){t||P(),"function"==typeof e&&e.apply(this,arguments)}))}return Object.defineProperty(n,e,{value:t}),n}(c.close),c.closeSync=function(t){function n(n){t.apply(c,arguments),P()}return Object.defineProperty(n,e,{value:t}),n}(c.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){w(c[t]),o.equal(c[t].length,0)}))}function k(t){u(t),t.gracefulify=k,t.createReadStream=function(n,e){return new t.ReadStream(n,e)},t.createWriteStream=function(n,e){return new t.WriteStream(n,e)};var n=t.readFile;t.readFile=function(t,e,r){"function"==typeof e&&(r=e,e=null);return function t(e,r,i,o){return n(e,r,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof i&&i.apply(this,arguments):g([t,[e,r,i],n,o||Date.now(),Date.now()])}))}(t,e,r)};var e=t.writeFile;t.writeFile=function(t,n,r,i){"function"==typeof r&&(i=r,r=null);return function t(n,r,i,o,c){return e(n,r,i,(function(e){!e||"EMFILE"!==e.code&&"ENFILE"!==e.code?"function"==typeof o&&o.apply(this,arguments):g([t,[n,r,i,o],e,c||Date.now(),Date.now()])}))}(t,n,r,i)};var r=t.appendFile;r&&(t.appendFile=function(t,n,e,i){"function"==typeof e&&(i=e,e=null);return function t(n,e,i,o,c){return r(n,e,i,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):g([t,[n,e,i,o],r,c||Date.now(),Date.now()])}))}(t,n,e,i)});var i=t.copyFile;i&&(t.copyFile=function(t,n,e,r){"function"==typeof e&&(r=e,e=0);return function t(n,e,r,o,c){return i(n,e,r,(function(i){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof o&&o.apply(this,arguments):g([t,[n,e,r,o],i,c||Date.now(),Date.now()])}))}(t,n,e,r)});var o=t.readdir;t.readdir=function(t,n,e){"function"==typeof n&&(e=n,n=null);var r=c.test(process.version)?function(t,n,e,r){return o(t,i(t,n,e,r))}:function(t,n,e,r){return o(t,n,i(t,n,e,r))};return r(t,n,e);function i(t,n,e,i){return function(o,c){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(c&&c.sort&&c.sort(),"function"==typeof e&&e.call(this,o,c)):g([r,[t,n,e],o,i||Date.now(),Date.now()])}}};var c=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var f=s(t);h=f.ReadStream,p=f.WriteStream}var a=t.ReadStream;a&&(h.prototype=Object.create(a.prototype),h.prototype.open=function(){var t=this;S(t.path,t.flags,t.mode,(function(n,e){n?(t.autoClose&&t.destroy(),t.emit("error",n)):(t.fd=e,t.emit("open",e),t.read())}))});var l=t.WriteStream;l&&(p.prototype=Object.create(l.prototype),p.prototype.open=function(){var t=this;S(t.path,t.flags,t.mode,(function(n,e){n?(t.destroy(),t.emit("error",n)):(t.fd=e,t.emit("open",e))}))}),Object.defineProperty(t,"ReadStream",{get:function(){return h},set:function(t){h=t},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return p},set:function(t){p=t},enumerable:!0,configurable:!0});var d=h;Object.defineProperty(t,"FileReadStream",{get:function(){return d},set:function(t){d=t},enumerable:!0,configurable:!0});var y=p;function h(t,n){return this instanceof h?(a.apply(this,arguments),this):h.apply(Object.create(h.prototype),arguments)}function p(t,n){return this instanceof p?(l.apply(this,arguments),this):p.apply(Object.create(p.prototype),arguments)}Object.defineProperty(t,"FileWriteStream",{get:function(){return y},set:function(t){y=t},enumerable:!0,configurable:!0});var m=t.open;function S(t,n,e,r){return"function"==typeof e&&(r=e,e=null),function t(n,e,r,i,o){return m(n,e,r,(function(c,u){!c||"EMFILE"!==c.code&&"ENFILE"!==c.code?"function"==typeof i&&i.apply(this,arguments):g([t,[n,e,r,i],c,o||Date.now(),Date.now()])}))}(t,n,e,r)}return t.open=S,t}function g(n){w("ENQUEUE",n[0].name,n[1]),c[t].push(n),F()}function P(){for(var n=Date.now(),e=0;e<c[t].length;++e)c[t][e].length>2&&(c[t][e][3]=n,c[t][e][4]=n);F()}function F(){if(clearTimeout(d),d=void 0,0!==c[t].length){var n=c[t].shift(),e=n[0],r=n[1],i=n[2],o=n[3],u=n[4];if(void 0===o)w("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-o>=6e4){w("TIMEOUT",e.name,r);var s=r.pop();"function"==typeof s&&s.call(null,i)}else{var f=Date.now()-u,a=Math.max(u-o,1);f>=Math.min(1.2*a,100)?(w("RETRY",e.name,r),e.apply(null,r.concat([o]))):c[t].push(n)}void 0===d&&(d=setTimeout(F,0))}}return E[t]||l(E,c[t]),S=k(f(c)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!c.__patched&&(S=k(c),c.__patched=!0),S}function F(){return w||(w=1,function(t){const n=g().fromCallback,e=P(),r=["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 e[t]));Object.assign(t,e),r.forEach((r=>{t[r]=n(e[r])})),t.exists=function(t,n){return"function"==typeof n?e.exists(t,n):new Promise((n=>e.exists(t,n)))},t.read=function(t,n,r,i,o,c){return"function"==typeof c?e.read(t,n,r,i,o,c):new Promise(((c,u)=>{e.read(t,n,r,i,o,((t,n,e)=>{if(t)return u(t);c({bytesRead:n,buffer:e})}))}))},t.write=function(t,n,...r){return"function"==typeof r[r.length-1]?e.write(t,n,...r):new Promise(((i,o)=>{e.write(t,n,...r,((t,n,e)=>{if(t)return o(t);i({bytesWritten:n,buffer:e})}))}))},"function"==typeof e.writev&&(t.writev=function(t,n,...r){return"function"==typeof r[r.length-1]?e.writev(t,n,...r):new Promise(((i,o)=>{e.writev(t,n,...r,((t,n,e)=>{if(t)return o(t);i({bytesWritten:n,buffers:e})}))}))}),"function"==typeof e.realpath.native?t.realpath.native=n(e.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")}(b)),b}var N,D,T,x,C,L,j,I,_,R,M,$,J,W,A,Y,U,B,q,G,K,V,H,X,z,Q,Z,tt,nt,et,rt,it,ot,ct,ut,st,ft,at,lt,dt,yt,ht,pt,mt,St,vt,wt,Et,bt,kt,gt,Ot,Pt,Ft,Nt,Dt,Tt={},xt={};function Ct(){if(N)return xt;N=1;const t=c;return xt.checkPath=function(n){if("win32"===process.platform){if(/[<>:"|?*]/.test(n.replace(t.parse(n).root,""))){const t=new Error(`Path contains invalid characters: ${n}`);throw t.code="EINVAL",t}}},xt}function Lt(){if(D)return Tt;D=1;const t=F(),{checkPath:n}=Ct(),e=t=>"number"==typeof t?t:{mode:511,...t}.mode;return Tt.makeDir=async(r,i)=>(n(r),t.mkdir(r,{mode:e(i),recursive:!0})),Tt.makeDirSync=(r,i)=>(n(r),t.mkdirSync(r,{mode:e(i),recursive:!0})),Tt}function jt(){if(x)return T;x=1;const t=g().fromPromise,{makeDir:n,makeDirSync:e}=Lt(),r=t(n);return T={mkdirs:r,mkdirsSync:e,mkdirp:r,mkdirpSync:e,ensureDir:r,ensureDirSync:e}}function It(){if(L)return C;L=1;const t=g().fromPromise,n=F();return C={pathExists:t((function(t){return n.access(t).then((()=>!0)).catch((()=>!1))})),pathExistsSync:n.existsSync}}function _t(){if(I)return j;I=1;const t=P();return j={utimesMillis:function(n,e,r,i){t.open(n,"r+",((n,o)=>{if(n)return i(n);t.futimes(o,e,r,(n=>{t.close(o,(t=>{i&&i(n||t)}))}))}))},utimesMillisSync:function(n,e,r){const i=t.openSync(n,"r+");return t.futimesSync(i,e,r),t.closeSync(i)}}}function Rt(){if(R)return _;R=1;const t=F(),n=c,e=i;function r(n,e,r){const i=r.dereference?n=>t.stat(n,{bigint:!0}):n=>t.lstat(n,{bigint:!0});return Promise.all([i(n),i(e).catch((t=>{if("ENOENT"===t.code)return null;throw t}))]).then((([t,n])=>({srcStat:t,destStat:n})))}function o(t,n){return n.ino&&n.dev&&n.ino===t.ino&&n.dev===t.dev}function u(t,e){const r=n.resolve(t).split(n.sep).filter((t=>t)),i=n.resolve(e).split(n.sep).filter((t=>t));return r.reduce(((t,n,e)=>t&&i[e]===n),!0)}function s(t,n,e){return`Cannot ${e} '${t}' to a subdirectory of itself, '${n}'.`}return _={checkPaths:function(t,i,c,f,a){e.callbackify(r)(t,i,f,((e,r)=>{if(e)return a(e);const{srcStat:f,destStat:l}=r;if(l){if(o(f,l)){const e=n.basename(t),r=n.basename(i);return"move"===c&&e!==r&&e.toLowerCase()===r.toLowerCase()?a(null,{srcStat:f,destStat:l,isChangingCase:!0}):a(new Error("Source and destination must not be the same."))}if(f.isDirectory()&&!l.isDirectory())return a(new Error(`Cannot overwrite non-directory '${i}' with directory '${t}'.`));if(!f.isDirectory()&&l.isDirectory())return a(new Error(`Cannot overwrite directory '${i}' with non-directory '${t}'.`))}return f.isDirectory()&&u(t,i)?a(new Error(s(t,i,c))):a(null,{srcStat:f,destStat:l})}))},checkPathsSync:function(e,r,i,c){const{srcStat:f,destStat:a}=function(n,e,r){let i;const o=r.dereference?n=>t.statSync(n,{bigint:!0}):n=>t.lstatSync(n,{bigint:!0}),c=o(n);try{i=o(e)}catch(t){if("ENOENT"===t.code)return{srcStat:c,destStat:null};throw t}return{srcStat:c,destStat:i}}(e,r,c);if(a){if(o(f,a)){const t=n.basename(e),o=n.basename(r);if("move"===i&&t!==o&&t.toLowerCase()===o.toLowerCase())return{srcStat:f,destStat:a,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(f.isDirectory()&&!a.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${e}'.`);if(!f.isDirectory()&&a.isDirectory())throw new Error(`Cannot overwrite directory '${r}' with non-directory '${e}'.`)}if(f.isDirectory()&&u(e,r))throw new Error(s(e,r,i));return{srcStat:f,destStat:a}},checkParentPaths:function e(r,i,c,u,f){const a=n.resolve(n.dirname(r)),l=n.resolve(n.dirname(c));if(l===a||l===n.parse(l).root)return f();t.stat(l,{bigint:!0},((t,n)=>t?"ENOENT"===t.code?f():f(t):o(i,n)?f(new Error(s(r,c,u))):e(r,i,l,u,f)))},checkParentPathsSync:function e(r,i,c,u){const f=n.resolve(n.dirname(r)),a=n.resolve(n.dirname(c));if(a===f||a===n.parse(a).root)return;let l;try{l=t.statSync(a,{bigint:!0})}catch(t){if("ENOENT"===t.code)return;throw t}if(o(i,l))throw new Error(s(r,c,u));return e(r,i,a,u)},isSrcSubdir:u,areIdentical:o},_}function Mt(){if($)return M;$=1;const t=P(),n=c,e=jt().mkdirs,r=It().pathExists,i=_t().utimesMillis,o=Rt();function u(t,i,o,c,u){const s=n.dirname(o);r(s,((n,r)=>n?u(n):r?f(t,i,o,c,u):void e(s,(n=>n?u(n):f(t,i,o,c,u)))))}function s(t,n,e,r,i,o){Promise.resolve(i.filter(e,r)).then((c=>c?t(n,e,r,i,o):o()),(t=>o(t)))}function f(n,e,r,i,o){(i.dereference?t.stat:t.lstat)(e,((c,u)=>c?o(c):u.isDirectory()?function(n,e,r,i,o,c){return e?y(r,i,o,c):function(n,e,r,i,o){t.mkdir(r,(t=>{if(t)return o(t);y(e,r,i,(t=>t?o(t):d(r,n,o)))}))}(n.mode,r,i,o,c)}(u,n,e,r,i,o):u.isFile()||u.isCharacterDevice()||u.isBlockDevice()?function(n,e,r,i,o,c){return e?function(n,e,r,i,o){if(!i.overwrite)return i.errorOnExist?o(new Error(`'${r}' already exists`)):o();t.unlink(r,(t=>t?o(t):a(n,e,r,i,o)))}(n,r,i,o,c):a(n,r,i,o,c)}(u,n,e,r,i,o):u.isSymbolicLink()?p(n,e,r,i,o):u.isSocket()?o(new Error(`Cannot copy a socket file: ${e}`)):u.isFIFO()?o(new Error(`Cannot copy a FIFO pipe: ${e}`)):o(new Error(`Unknown file: ${e}`))))}function a(n,e,r,i,o){t.copyFile(e,r,(t=>t?o(t):i.preserveTimestamps?function(t,n,e,r){if(function(t){return!(128&t)}(t))return function(t,n,e){return d(t,128|n,e)}(e,t,(i=>i?r(i):l(t,n,e,r)));return l(t,n,e,r)}(n.mode,e,r,o):d(r,n.mode,o)))}function l(n,e,r,o){!function(n,e,r){t.stat(n,((t,n)=>t?r(t):i(e,n.atime,n.mtime,r)))}(e,r,(t=>t?o(t):d(r,n,o)))}function d(n,e,r){return t.chmod(n,e,r)}function y(n,e,r,i){t.readdir(n,((t,o)=>t?i(t):h(o,n,e,r,i)))}function h(t,e,r,i,c){const u=t.pop();return u?function(t,e,r,i,c,u){const a=n.join(r,e),l=n.join(i,e);o.checkPaths(a,l,"copy",c,((n,e)=>{if(n)return u(n);const{destStat:o}=e;!function(t,n,e,r,i){r.filter?s(f,t,n,e,r,i):f(t,n,e,r,i)}(o,a,l,c,(n=>n?u(n):h(t,r,i,c,u)))}))}(t,u,e,r,i,c):c()}function p(e,r,i,c,u){t.readlink(r,((r,s)=>r?u(r):(c.dereference&&(s=n.resolve(process.cwd(),s)),e?void t.readlink(i,((r,f)=>r?"EINVAL"===r.code||"UNKNOWN"===r.code?t.symlink(s,i,u):u(r):(c.dereference&&(f=n.resolve(process.cwd(),f)),o.isSrcSubdir(s,f)?u(new Error(`Cannot copy '${s}' to a subdirectory of itself, '${f}'.`)):e.isDirectory()&&o.isSrcSubdir(f,s)?u(new Error(`Cannot overwrite '${f}' with '${s}'.`)):function(n,e,r){t.unlink(e,(i=>i?r(i):t.symlink(n,e,r)))}(s,i,u)))):t.symlink(s,i,u))))}return M=function(t,n,e,r){"function"!=typeof e||r?"function"==typeof e&&(e={filter:e}):(r=e,e={}),r=r||function(){},(e=e||{}).clobber=!("clobber"in e)||!!e.clobber,e.overwrite="overwrite"in e?!!e.overwrite:e.clobber,e.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"),o.checkPaths(t,n,"copy",e,((i,c)=>{if(i)return r(i);const{srcStat:f,destStat:a}=c;o.checkParentPaths(t,f,n,"copy",(i=>i?r(i):e.filter?s(u,a,t,n,e,r):u(a,t,n,e,r)))}))}}function $t(){if(W)return J;W=1;const t=P(),n=c,e=jt().mkdirsSync,r=_t().utimesMillisSync,i=Rt();function o(e,r,o,c){const a=(c.dereference?t.statSync:t.lstatSync)(r);if(a.isDirectory())return function(n,e,r,i,o){return e?f(r,i,o):function(n,e,r,i){return t.mkdirSync(r),f(e,r,i),s(r,n)}(n.mode,r,i,o)}(a,e,r,o,c);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return function(n,e,r,i,o){return e?function(n,e,r,i){if(i.overwrite)return t.unlinkSync(r),u(n,e,r,i);if(i.errorOnExist)throw new Error(`'${r}' already exists`)}(n,r,i,o):u(n,r,i,o)}(a,e,r,o,c);if(a.isSymbolicLink())return function(e,r,o,c){let u=t.readlinkSync(r);c.dereference&&(u=n.resolve(process.cwd(),u));if(e){let e;try{e=t.readlinkSync(o)}catch(n){if("EINVAL"===n.code||"UNKNOWN"===n.code)return t.symlinkSync(u,o);throw n}if(c.dereference&&(e=n.resolve(process.cwd(),e)),i.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(t.statSync(o).isDirectory()&&i.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(n,e){return t.unlinkSync(e),t.symlinkSync(n,e)}(u,o)}return t.symlinkSync(u,o)}(e,r,o,c);if(a.isSocket())throw new Error(`Cannot copy a socket file: ${r}`);if(a.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${r}`);throw new Error(`Unknown file: ${r}`)}function u(n,e,i,o){return t.copyFileSync(e,i),o.preserveTimestamps&&function(n,e,i){(function(t){return!(128&t)})(n)&&function(t,n){s(t,128|n)}(i,n);(function(n,e){const i=t.statSync(n);r(e,i.atime,i.mtime)})(e,i)}(n.mode,e,i),s(i,n.mode)}function s(n,e){return t.chmodSync(n,e)}function f(e,r,c){t.readdirSync(e).forEach((t=>function(t,e,r,c){const u=n.join(e,t),s=n.join(r,t),{destStat:f}=i.checkPathsSync(u,s,"copy",c);return function(t,n,e,r){if(!r.filter||r.filter(n,e))return o(t,n,e,r)}(f,u,s,c)}(t,e,r,c)))}return J=function(r,c,u){"function"==typeof u&&(u={filter:u}),(u=u||{}).clobber=!("clobber"in u)||!!u.clobber,u.overwrite="overwrite"in u?!!u.overwrite:u.clobber,u.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:f}=i.checkPathsSync(r,c,"copy",u);return i.checkParentPathsSync(r,s,c,"copy"),function(r,i,c,u){if(u.filter&&!u.filter(i,c))return;const s=n.dirname(c);t.existsSync(s)||e(s);return o(r,i,c,u)}(f,r,c,u)}}function Jt(){if(Y)return A;Y=1;const t=g().fromCallback;return A={copy:t(Mt()),copySync:$t()}}function Wt(){if(B)return U;B=1;const t=P(),n=c,e=o,r="win32"===process.platform;function i(n){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((e=>{n[e]=n[e]||t[e],n[e+="Sync"]=n[e]||t[e]})),n.maxBusyTries=n.maxBusyTries||3}function u(t,n,r){let o=0;"function"==typeof n&&(r=n,n={}),e(t,"rimraf: missing path"),e.strictEqual(typeof t,"string","rimraf: path should be a string"),e.strictEqual(typeof r,"function","rimraf: callback function required"),e(n,"rimraf: invalid options argument provided"),e.strictEqual(typeof n,"object","rimraf: options should be object"),i(n),s(t,n,(function e(i){if(i){if(("EBUSY"===i.code||"ENOTEMPTY"===i.code||"EPERM"===i.code)&&o<n.maxBusyTries){o++;return setTimeout((()=>s(t,n,e)),100*o)}"ENOENT"===i.code&&(i=null)}r(i)}))}function s(t,n,i){e(t),e(n),e("function"==typeof i),n.lstat(t,((e,o)=>e&&"ENOENT"===e.code?i(null):e&&"EPERM"===e.code&&r?f(t,n,e,i):o&&o.isDirectory()?l(t,n,e,i):void n.unlink(t,(e=>{if(e){if("ENOENT"===e.code)return i(null);if("EPERM"===e.code)return r?f(t,n,e,i):l(t,n,e,i);if("EISDIR"===e.code)return l(t,n,e,i)}return i(e)}))))}function f(t,n,r,i){e(t),e(n),e("function"==typeof i),n.chmod(t,438,(e=>{e?i("ENOENT"===e.code?null:r):n.stat(t,((e,o)=>{e?i("ENOENT"===e.code?null:r):o.isDirectory()?l(t,n,r,i):n.unlink(t,i)}))}))}function a(t,n,r){let i;e(t),e(n);try{n.chmodSync(t,438)}catch(t){if("ENOENT"===t.code)return;throw r}try{i=n.statSync(t)}catch(t){if("ENOENT"===t.code)return;throw r}i.isDirectory()?y(t,n,r):n.unlinkSync(t)}function l(t,r,i,o){e(t),e(r),e("function"==typeof o),r.rmdir(t,(c=>{!c||"ENOTEMPTY"!==c.code&&"EEXIST"!==c.code&&"EPERM"!==c.code?c&&"ENOTDIR"===c.code?o(i):o(c):function(t,r,i){e(t),e(r),e("function"==typeof i),r.readdir(t,((e,o)=>{if(e)return i(e);let c,s=o.length;if(0===s)return r.rmdir(t,i);o.forEach((e=>{u(n.join(t,e),r,(n=>{if(!c)return n?i(c=n):void(0==--s&&r.rmdir(t,i))}))}))}))}(t,r,o)}))}function d(t,n){let o;i(n=n||{}),e(t,"rimraf: missing path"),e.strictEqual(typeof t,"string","rimraf: path should be a string"),e(n,"rimraf: missing options"),e.strictEqual(typeof n,"object","rimraf: options should be object");try{o=n.lstatSync(t)}catch(e){if("ENOENT"===e.code)return;"EPERM"===e.code&&r&&a(t,n,e)}try{o&&o.isDirectory()?y(t,n,null):n.unlinkSync(t)}catch(e){if("ENOENT"===e.code)return;if("EPERM"===e.code)return r?a(t,n,e):y(t,n,e);if("EISDIR"!==e.code)throw e;y(t,n,e)}}function y(t,i,o){e(t),e(i);try{i.rmdirSync(t)}catch(c){if("ENOTDIR"===c.code)throw o;if("ENOTEMPTY"===c.code||"EEXIST"===c.code||"EPERM"===c.code)!function(t,i){if(e(t),e(i),i.readdirSync(t).forEach((e=>d(n.join(t,e),i))),!r){return i.rmdirSync(t,i)}{const n=Date.now();do{try{return i.rmdirSync(t,i)}catch{}}while(Date.now()-n<500)}}(t,i);else if("ENOENT"!==c.code)throw c}}return U=u,u.sync=d,U}function At(){if(G)return q;G=1;const t=P(),n=g().fromCallback,e=Wt();return q={remove:n((function(n,r){if(t.rm)return t.rm(n,{recursive:!0,force:!0},r);e(n,r)})),removeSync:function(n){if(t.rmSync)return t.rmSync(n,{recursive:!0,force:!0});e.sync(n)}}}function Yt(){if(V)return K;V=1;const t=g().fromPromise,n=F(),e=c,r=jt(),i=At(),o=t((async function(t){let o;try{o=await n.readdir(t)}catch{return r.mkdirs(t)}return Promise.all(o.map((n=>i.remove(e.join(t,n)))))}));function u(t){let o;try{o=n.readdirSync(t)}catch{return r.mkdirsSync(t)}o.forEach((n=>{n=e.join(t,n),i.removeSync(n)}))}return K={emptyDirSync:u,emptydirSync:u,emptyDir:o,emptydir:o}}function Ut(){if(X)return H;X=1;const t=g().fromCallback,n=c,e=P(),r=jt();return H={createFile:t((function(t,i){function o(){e.writeFile(t,"",(t=>{if(t)return i(t);i()}))}e.stat(t,((c,u)=>{if(!c&&u.isFile())return i();const s=n.dirname(t);e.stat(s,((t,n)=>{if(t)return"ENOENT"===t.code?r.mkdirs(s,(t=>{if(t)return i(t);o()})):i(t);n.isDirectory()?o():e.readdir(s,(t=>{if(t)return i(t)}))}))}))})),createFileSync:function(t){let i;try{i=e.statSync(t)}catch{}if(i&&i.isFile())return;const o=n.dirname(t);try{e.statSync(o).isDirectory()||e.readdirSync(o)}catch(t){if(!t||"ENOENT"!==t.code)throw t;r.mkdirsSync(o)}e.writeFileSync(t,"")}}}function Bt(){if(Q)return z;Q=1;const t=g().fromCallback,n=c,e=P(),r=jt(),i=It().pathExists,{areIdentical:o}=Rt();return z={createLink:t((function(t,c,u){function s(t,n){e.link(t,n,(t=>{if(t)return u(t);u(null)}))}e.lstat(c,((f,a)=>{e.lstat(t,((e,f)=>{if(e)return e.message=e.message.replace("lstat","ensureLink"),u(e);if(a&&o(f,a))return u(null);const l=n.dirname(c);i(l,((n,e)=>n?u(n):e?s(t,c):void r.mkdirs(l,(n=>{if(n)return u(n);s(t,c)}))))}))}))})),createLinkSync:function(t,i){let c;try{c=e.lstatSync(i)}catch{}try{const n=e.lstatSync(t);if(c&&o(n,c))return}catch(t){throw t.message=t.message.replace("lstat","ensureLink"),t}const u=n.dirname(i);return e.existsSync(u)||r.mkdirsSync(u),e.linkSync(t,i)}}}function qt(){if(tt)return Z;tt=1;const t=c,n=P(),e=It().pathExists;return Z={symlinkPaths:function(r,i,o){if(t.isAbsolute(r))return n.lstat(r,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),o(t)):o(null,{toCwd:r,toDst:r})));{const c=t.dirname(i),u=t.join(c,r);return e(u,((e,i)=>e?o(e):i?o(null,{toCwd:u,toDst:r}):n.lstat(r,(n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),o(n)):o(null,{toCwd:r,toDst:t.relative(c,r)})))))}},symlinkPathsSync:function(e,r){let i;if(t.isAbsolute(e)){if(i=n.existsSync(e),!i)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const o=t.dirname(r),c=t.join(o,e);if(i=n.existsSync(c),i)return{toCwd:c,toDst:e};if(i=n.existsSync(e),!i)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:t.relative(o,e)}}}},Z}function Gt(){if(et)return nt;et=1;const t=P();return nt={symlinkType:function(n,e,r){if(r="function"==typeof e?e:r,e="function"!=typeof e&&e)return r(null,e);t.lstat(n,((t,n)=>{if(t)return r(null,"file");e=n&&n.isDirectory()?"dir":"file",r(null,e)}))},symlinkTypeSync:function(n,e){let r;if(e)return e;try{r=t.lstatSync(n)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}}}function Kt(){if(it)return rt;it=1;const t=g().fromCallback,n=c,e=F(),r=jt(),i=r.mkdirs,o=r.mkdirsSync,u=qt(),s=u.symlinkPaths,f=u.symlinkPathsSync,a=Gt(),l=a.symlinkType,d=a.symlinkTypeSync,y=It().pathExists,{areIdentical:h}=Rt();function p(t,r,o,c){s(t,r,((u,s)=>{if(u)return c(u);t=s.toDst,l(s.toCwd,o,((o,u)=>{if(o)return c(o);const s=n.dirname(r);y(s,((n,o)=>n?c(n):o?e.symlink(t,r,u,c):void i(s,(n=>{if(n)return c(n);e.symlink(t,r,u,c)}))))}))}))}return rt={createSymlink:t((function(t,n,r,i){i="function"==typeof r?r:i,r="function"!=typeof r&&r,e.lstat(n,((o,c)=>{!o&&c.isSymbolicLink()?Promise.all([e.stat(t),e.stat(n)]).then((([e,o])=>{if(h(e,o))return i(null);p(t,n,r,i)})):p(t,n,r,i)}))})),createSymlinkSync:function(t,r,i){let c;try{c=e.lstatSync(r)}catch{}if(c&&c.isSymbolicLink()){const n=e.statSync(t),i=e.statSync(r);if(h(n,i))return}const u=f(t,r);t=u.toDst,i=d(u.toCwd,i);const s=n.dirname(r);return e.existsSync(s)||o(s),e.symlinkSync(t,r,i)}}}function Vt(){if(ct)return ot;ct=1;const{createFile:t,createFileSync:n}=Ut(),{createLink:e,createLinkSync:r}=Bt(),{createSymlink:i,createSymlinkSync:o}=Kt();return ot={createFile:t,createFileSync:n,ensureFile:t,ensureFileSync:n,createLink:e,createLinkSync:r,ensureLink:e,ensureLinkSync:r,createSymlink:i,createSymlinkSync:o,ensureSymlink:i,ensureSymlinkSync:o}}function Ht(){if(st)return ut;return st=1,ut={stringify:function(t,{EOL:n="\n",finalEOL:e=!0,replacer:r=null,spaces:i}={}){const o=e?n:"";return JSON.stringify(t,r,i).replace(/\n/g,n)+o},stripBom:function(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}}}function Xt(){if(dt)return lt;dt=1;const t=function(){if(at)return ft;let t;at=1;try{t=P()}catch(e){t=n}const e=g(),{stringify:r,stripBom:i}=Ht(),o=e.fromPromise((async function(n,r={}){"string"==typeof r&&(r={encoding:r});const o=r.fs||t,c=!("throws"in r)||r.throws;let u,s=await e.fromCallback(o.readFile)(n,r);s=i(s);try{u=JSON.parse(s,r?r.reviver:null)}catch(t){if(c)throw t.message=`${n}: ${t.message}`,t;return null}return u})),c=e.fromPromise((async function(n,i,o={}){const c=o.fs||t,u=r(i,o);await e.fromCallback(c.writeFile)(n,u,o)})),u={readFile:o,readFileSync:function(n,e={}){"string"==typeof e&&(e={encoding:e});const r=e.fs||t,o=!("throws"in e)||e.throws;try{let t=r.readFileSync(n,e);return t=i(t),JSON.parse(t,e.reviver)}catch(t){if(o)throw t.message=`${n}: ${t.message}`,t;return null}},writeFile:c,writeFileSync:function(n,e,i={}){const o=i.fs||t,c=r(e,i);return o.writeFileSync(n,c,i)}};return ft=u}();return lt={readJson:t.readFile,readJsonSync:t.readFileSync,writeJson:t.writeFile,writeJsonSync:t.writeFileSync}}function zt(){if(ht)return yt;ht=1;const t=g().fromCallback,n=P(),e=c,r=jt(),i=It().pathExists;return yt={outputFile:t((function(t,o,c,u){"function"==typeof c&&(u=c,c="utf8");const s=e.dirname(t);i(s,((e,i)=>e?u(e):i?n.writeFile(t,o,c,u):void r.mkdirs(s,(e=>{if(e)return u(e);n.writeFile(t,o,c,u)}))))})),outputFileSync:function(t,...i){const o=e.dirname(t);if(n.existsSync(o))return n.writeFileSync(t,...i);r.mkdirsSync(o),n.writeFileSync(t,...i)}},yt}function Qt(){if(mt)return pt;mt=1;const{stringify:t}=Ht(),{outputFile:n}=zt();return pt=async function(e,r,i={}){const o=t(r,i);await n(e,o,i)},pt}function Zt(){if(vt)return St;vt=1;const{stringify:t}=Ht(),{outputFileSync:n}=zt();return St=function(e,r,i){const o=t(r,i);n(e,o,i)},St}function tn(){if(Et)return wt;Et=1;const t=g().fromPromise,n=Xt();return n.outputJson=t(Qt()),n.outputJsonSync=Zt(),n.outputJSON=n.outputJson,n.outputJSONSync=n.outputJsonSync,n.writeJSON=n.writeJson,n.writeJSONSync=n.writeJsonSync,n.readJSON=n.readJson,n.readJSONSync=n.readJsonSync,wt=n}function nn(){if(kt)return bt;kt=1;const t=P(),n=c,e=Jt().copy,r=At().remove,i=jt().mkdirp,o=It().pathExists,u=Rt();function s(t,n,e,i,c){return i?f(t,n,e,c):e?r(n,(r=>r?c(r):f(t,n,e,c))):void o(n,((r,i)=>r?c(r):i?c(new Error("dest already exists.")):f(t,n,e,c)))}function f(n,i,o,c){t.rename(n,i,(t=>t?"EXDEV"!==t.code?c(t):function(t,n,i,o){const c={overwrite:i,errorOnExist:!0};e(t,n,c,(n=>n?o(n):r(t,o)))}(n,i,o,c):c()))}return bt=function(t,e,r,o){"function"==typeof r&&(o=r,r={});const c=(r=r||{}).overwrite||r.clobber||!1;u.checkPaths(t,e,"move",r,((r,f)=>{if(r)return o(r);const{srcStat:a,isChangingCase:l=!1}=f;u.checkParentPaths(t,a,e,"move",(r=>r?o(r):function(t){const e=n.dirname(t);return n.parse(e).root===e}(e)?s(t,e,c,l,o):void i(n.dirname(e),(n=>n?o(n):s(t,e,c,l,o)))))}))}}function en(){if(Ot)return gt;Ot=1;const t=P(),n=c,e=Jt().copySync,r=At().removeSync,i=jt().mkdirpSync,o=Rt();function u(n,i,o){try{t.renameSync(n,i)}catch(t){if("EXDEV"!==t.code)throw t;return function(t,n,i){const o={overwrite:i,errorOnExist:!0};return e(t,n,o),r(t)}(n,i,o)}}return gt=function(e,c,s){const f=(s=s||{}).overwrite||s.clobber||!1,{srcStat:a,isChangingCase:l=!1}=o.checkPathsSync(e,c,"move",s);return o.checkParentPathsSync(e,a,c,"move"),function(t){const e=n.dirname(t);return n.parse(e).root===e}(c)||i(n.dirname(c)),function(n,e,i,o){if(o)return u(n,e,i);if(i)return r(e),u(n,e,i);if(t.existsSync(e))throw new Error("dest already exists.");return u(n,e,i)}(e,c,f,l)}}function rn(){if(Ft)return Pt;Ft=1;const t=g().fromCallback;return Pt={move:t(nn()),moveSync:en()}}function on(){return Dt?Nt:(Dt=1,Nt={...F(),...Jt(),...Yt(),...Vt(),...tn(),...jt(),...rn(),...zt(),...It(),...At()})}var cn=on(),un={errHandler:function(t){return console.error(t)}};function sn(t,n){return u(this,void 0,void 0,(function(){var e,r,i;return s(this,(function(o){switch(o.label){case 0:return[4,t];case 1:return e=o.sent(),r=e[0],i=e[1],r?(n?n(r):un.errHandler&&un.errHandler(r),[2,void 0]):[2,i]}}))}))}function fn(t,n,e){return u(this,void 0,void 0,(function(){return s(this,(function(r){return[2,f(cn.copy(t,n,e))]}))}))}function an(t,n,e){return u(this,void 0,void 0,(function(){return s(this,(function(r){return[2,f(cn.move(t,n,e))]}))}))}function ln(t){return u(this,void 0,void 0,(function(){return s(this,(function(n){return[2,f(cn.remove(t))]}))}))}function dn(t){return u(this,void 0,void 0,(function(){return s(this,(function(n){return[2,f(cn.emptyDir(t))]}))}))}function yn(t,n){return u(this,void 0,void 0,(function(){return s(this,(function(e){return[2,f(cn.ensureDir(t,n))]}))}))}function hn(t){return u(this,void 0,void 0,(function(){return s(this,(function(n){return[2,f(cn.ensureFile(t))]}))}))}function pn(t){return u(this,void 0,void 0,(function(){return s(this,(function(n){return[2,f(cn.pathExists(t))]}))}))}function mn(t,n){return u(this,void 0,void 0,(function(){return s(this,(function(e){return[2,f(new Promise((function(e,r){cn.readFile(t,n,(function(t,n){t?r(t):e(n)}))})))]}))}))}function Sn(t,n,e){return u(this,void 0,void 0,(function(){return s(this,(function(r){return[2,f(new Promise((function(r,i){cn.writeFile(t,n,e,(function(t){t?i(t):r(!0)}))})))]}))}))}function vn(t,n,e){return u(this,void 0,void 0,(function(){return s(this,(function(r){return[2,f(new Promise((function(r,i){cn.appendFile(t,n,e,(function(t){t?i(t):r(!0)}))})))]}))}))}function wn(t,n){return u(this,void 0,void 0,(function(){return s(this,(function(e){return[2,f(cn.readJson(t,n))]}))}))}function En(t,n,e){return u(this,void 0,void 0,(function(){return s(this,(function(r){return[2,f(cn.writeJson(t,n,e))]}))}))}function bn(t,n,e){return u(this,void 0,void 0,(function(){return s(this,(function(r){return[2,f(cn.outputJson(t,n,e))]}))}))}function kn(t,n){return u(this,void 0,void 0,(function(){return s(this,(function(e){return[2,f(cn.ensureLink(t,n))]}))}))}function gn(t,n){return u(this,void 0,void 0,(function(){return s(this,(function(e){return[2,f(cn.ensureSymlink(t,n))]}))}))}function On(n){return u(this,void 0,void 0,(function(){return s(this,(function(e){return[2,f(new Promise((function(e,r){t.stat(n,(function(t,n){t?r(t):e(n)}))})))]}))}))}function Pn(t,n){return u(this,void 0,void 0,(function(){var e,r,i;return s(this,(function(o){switch(o.label){case 0:return[4,On(t)];case 1:return e=o.sent(),r=e[0],i=e[1],r?(n&&n(r),[2,void 0]):[2,null==i?void 0:i.isDirectory()]}}))}))}function Fn(t,n){return u(this,void 0,void 0,(function(){return s(this,(function(e){return[2,f(new Promise((function(e,r){cn.chmod(t,n,(function(t){t?r(t):e(!0)}))})))]}))}))}function Nn(t,n,e){return u(this,void 0,void 0,(function(){return s(this,(function(r){return[2,f(new Promise((function(r,i){cn.chown(t,n,e,(function(t){t?i(t):r(!0)}))})))]}))}))}function Dn(t){return u(this,void 0,void 0,(function(){return s(this,(function(n){return[2,f(cn.createFile(t))]}))}))}function Tn(t,n){return u(this,void 0,void 0,(function(){return s(this,(function(e){return[2,f(cn.createLink(t,n))]}))}))}function xn(t,n,e){return u(this,void 0,void 0,(function(){return s(this,(function(r){return[2,f(cn.createSymlink(t,n,e))]}))}))}function Cn(t,n){return u(this,void 0,void 0,(function(){return s(this,(function(e){return[2,f(new Promise((function(e,r){cn.mkdir(t,n,(function(t){t?r(t):e(!0)}))})))]}))}))}function Ln(t){return u(this,void 0,void 0,(function(){return s(this,(function(n){return[2,f(cn.mkdirs(t))]}))}))}function jn(t){return u(this,void 0,void 0,(function(){return s(this,(function(n){return[2,f(cn.mkdtemp(t))]}))}))}function In(t,n){return u(this,void 0,void 0,(function(){return s(this,(function(e){return[2,f(new Promise((function(e,r){cn.readdir(t,n,(function(t){t?r(t):e(!0)}))})))]}))}))}function _n(t){return u(this,void 0,void 0,(function(){return s(this,(function(n){return[2,f(cn.lstat(t))]}))}))}function Rn(t){return u(this,void 0,void 0,(function(){return s(this,(function(n){return[2,f(cn.pathExists(t))]}))}))}function Mn(t,n){return u(this,void 0,void 0,(function(){return s(this,(function(e){return[2,f(new Promise((function(e,r){cn.truncate(t,n,(function(t){t?r(t):e(!0)}))})))]}))}))}function $n(t){return u(this,void 0,void 0,(function(){return s(this,(function(n){return[2,f(new Promise((function(n,e){cn.unlink(t,(function(t){t?e(t):n(!0)}))})))]}))}))}function Jn(t){return u(this,void 0,void 0,(function(){return s(this,(function(n){return[2,f(cn.rmdir(t))]}))}))}function Wn(t,n){return u(this,void 0,void 0,(function(){return s(this,(function(e){return[2,f(new Promise((function(e,r){cn.access(t,n,(function(t){t?r(t):e(!0)}))})))]}))}))}function An(t,n,e){return u(this,void 0,void 0,(function(){return s(this,(function(r){return[2,f(new Promise((function(r,i){cn.utimes(t,n instanceof Date?n:new Date(n),e instanceof Date?e:new Date(e),(function(t){t?i(t):r(!0)}))})))]}))}))}var Yn=cn.watch,Un={fsConfig:un,fsTo:sn,copy:fn,move:an,remove:ln,emptyDir:dn,ensureDir:yn,ensureFile:hn,pathExists:pn,readFile:mn,writeFile:Sn,appendFile:vn,readJson:wn,writeJson:En,outputJson:bn,ensureLink:kn,ensureSymlink:gn,stat:On,isDir:Pn,chmod:Fn,chown:Nn,createFile:Dn,createLink:Tn,createSymlink:xn,mkdir:Cn,mkdirs:Ln,mkdtemp:jn,readdir:In,lstat:_n,exists:Rn,truncate:Mn,unlink:$n,rmdir:Jn,access:Wn,utimes:An,watch:Yn};export{Wn as access,vn as appendFile,Fn as chmod,Nn as chown,fn as copy,Dn as createFile,Tn as createLink,xn as createSymlink,Un as default,dn as emptyDir,yn as ensureDir,hn as ensureFile,kn as ensureLink,gn as ensureSymlink,Rn as exists,un as fsConfig,sn as fsTo,Pn as isDir,_n as lstat,Cn as mkdir,Ln as mkdirs,jn as mkdtemp,an as move,bn as outputJson,pn as pathExists,mn as readFile,wn as readJson,In as readdir,ln as remove,Jn as rmdir,On as stat,Mn as truncate,$n as unlink,An as utimes,Yn as watch,Sn as writeFile,En as writeJson};
//# sourceMappingURL=index.js.map