prebundle 1.0.4 → 1.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/compiled/fast-glob/index.js +7270 -8
- package/compiled/fs-extra/index.d.ts +1 -996
- package/compiled/fs-extra/index.js +2818 -1
- package/compiled/fs-extra/package.json +1 -1
- package/compiled/rslog/index.d.ts +66 -0
- package/compiled/rslog/index.js +410 -0
- package/compiled/rslog/license +21 -0
- package/compiled/rslog/package.json +1 -0
- package/dist/helper.js +5 -4
- package/dist/prebundle.js +63 -27
- package/dist/types.d.ts +3 -0
- package/package.json +4 -2
- package/compiled/fs-extra/jsonfile/index.d.ts +0 -71
|
@@ -1 +1,2818 @@
|
|
|
1
|
-
(()=>{var e={524:(e,t,r)=>{"use strict";const n=r(804);const i=r(17);const o=r(516).mkdirsSync;const c=r(227).utimesMillisSync;const s=r(826);function copySync(e,t,r){if(typeof r==="function"){r={filter:r}}r=r||{};r.clobber="clobber"in r?!!r.clobber:true;r.overwrite="overwrite"in r?!!r.overwrite:r.clobber;if(r.preserveTimestamps&&process.arch==="ia32"){process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n"+"\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0002")}const{srcStat:c,destStat:a}=s.checkPathsSync(e,t,"copy",r);s.checkParentPathsSync(e,c,t,"copy");if(r.filter&&!r.filter(e,t))return;const u=i.dirname(t);if(!n.existsSync(u))o(u);return getStats(a,e,t,r)}function getStats(e,t,r,i){const o=i.dereference?n.statSync:n.lstatSync;const c=o(t);if(c.isDirectory())return onDir(c,e,t,r,i);else if(c.isFile()||c.isCharacterDevice()||c.isBlockDevice())return onFile(c,e,t,r,i);else if(c.isSymbolicLink())return onLink(e,t,r,i);else if(c.isSocket())throw new Error(`Cannot copy a socket file: ${t}`);else if(c.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${t}`);throw new Error(`Unknown file: ${t}`)}function onFile(e,t,r,n,i){if(!t)return copyFile(e,r,n,i);return mayCopyFile(e,r,n,i)}function mayCopyFile(e,t,r,i){if(i.overwrite){n.unlinkSync(r);return copyFile(e,t,r,i)}else if(i.errorOnExist){throw new Error(`'${r}' already exists`)}}function copyFile(e,t,r,i){n.copyFileSync(t,r);if(i.preserveTimestamps)handleTimestamps(e.mode,t,r);return setDestMode(r,e.mode)}function handleTimestamps(e,t,r){if(fileIsNotWritable(e))makeFileWritable(r,e);return setDestTimestamps(t,r)}function fileIsNotWritable(e){return(e&128)===0}function makeFileWritable(e,t){return setDestMode(e,t|128)}function setDestMode(e,t){return n.chmodSync(e,t)}function setDestTimestamps(e,t){const r=n.statSync(e);return c(t,r.atime,r.mtime)}function onDir(e,t,r,n,i){if(!t)return mkDirAndCopy(e.mode,r,n,i);return copyDir(r,n,i)}function mkDirAndCopy(e,t,r,i){n.mkdirSync(r);copyDir(t,r,i);return setDestMode(r,e)}function copyDir(e,t,r){n.readdirSync(e).forEach((n=>copyDirItem(n,e,t,r)))}function copyDirItem(e,t,r,n){const o=i.join(t,e);const c=i.join(r,e);if(n.filter&&!n.filter(o,c))return;const{destStat:a}=s.checkPathsSync(o,c,"copy",n);return getStats(a,o,c,n)}function onLink(e,t,r,o){let c=n.readlinkSync(t);if(o.dereference){c=i.resolve(process.cwd(),c)}if(!e){return n.symlinkSync(c,r)}else{let e;try{e=n.readlinkSync(r)}catch(e){if(e.code==="EINVAL"||e.code==="UNKNOWN")return n.symlinkSync(c,r);throw e}if(o.dereference){e=i.resolve(process.cwd(),e)}if(s.isSrcSubdir(c,e)){throw new Error(`Cannot copy '${c}' to a subdirectory of itself, '${e}'.`)}if(s.isSrcSubdir(e,c)){throw new Error(`Cannot overwrite '${e}' with '${c}'.`)}return copyLink(c,r)}}function copyLink(e,t){n.unlinkSync(t);return n.symlinkSync(e,t)}e.exports=copySync},770:(e,t,r)=>{"use strict";const n=r(845);const i=r(17);const{mkdirs:o}=r(516);const{pathExists:c}=r(667);const{utimesMillis:s}=r(227);const a=r(826);async function copy(e,t,r={}){if(typeof r==="function"){r={filter:r}}r.clobber="clobber"in r?!!r.clobber:true;r.overwrite="overwrite"in r?!!r.overwrite:r.clobber;if(r.preserveTimestamps&&process.arch==="ia32"){process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n"+"\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0001")}const{srcStat:n,destStat:s}=await a.checkPaths(e,t,"copy",r);await a.checkParentPaths(e,n,t,"copy");const u=await runFilter(e,t,r);if(!u)return;const f=i.dirname(t);const l=await c(f);if(!l){await o(f)}await getStatsAndPerformCopy(s,e,t,r)}async function runFilter(e,t,r){if(!r.filter)return true;return r.filter(e,t)}async function getStatsAndPerformCopy(e,t,r,i){const o=i.dereference?n.stat:n.lstat;const c=await o(t);if(c.isDirectory())return onDir(c,e,t,r,i);if(c.isFile()||c.isCharacterDevice()||c.isBlockDevice())return onFile(c,e,t,r,i);if(c.isSymbolicLink())return onLink(e,t,r,i);if(c.isSocket())throw new Error(`Cannot copy a socket file: ${t}`);if(c.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${t}`);throw new Error(`Unknown file: ${t}`)}async function onFile(e,t,r,i,o){if(!t)return copyFile(e,r,i,o);if(o.overwrite){await n.unlink(i);return copyFile(e,r,i,o)}if(o.errorOnExist){throw new Error(`'${i}' already exists`)}}async function copyFile(e,t,r,i){await n.copyFile(t,r);if(i.preserveTimestamps){if(fileIsNotWritable(e.mode)){await makeFileWritable(r,e.mode)}const i=await n.stat(t);await s(r,i.atime,i.mtime)}return n.chmod(r,e.mode)}function fileIsNotWritable(e){return(e&128)===0}function makeFileWritable(e,t){return n.chmod(e,t|128)}async function onDir(e,t,r,o,c){if(!t){await n.mkdir(o)}const s=await n.readdir(r);await Promise.all(s.map((async e=>{const t=i.join(r,e);const n=i.join(o,e);const s=await runFilter(t,n,c);if(!s)return;const{destStat:u}=await a.checkPaths(t,n,"copy",c);return getStatsAndPerformCopy(u,t,n,c)})));if(!t){await n.chmod(o,e.mode)}}async function onLink(e,t,r,o){let c=await n.readlink(t);if(o.dereference){c=i.resolve(process.cwd(),c)}if(!e){return n.symlink(c,r)}let s=null;try{s=await n.readlink(r)}catch(e){if(e.code==="EINVAL"||e.code==="UNKNOWN")return n.symlink(c,r);throw e}if(o.dereference){s=i.resolve(process.cwd(),s)}if(a.isSrcSubdir(c,s)){throw new Error(`Cannot copy '${c}' to a subdirectory of itself, '${s}'.`)}if(a.isSrcSubdir(s,c)){throw new Error(`Cannot overwrite '${s}' with '${c}'.`)}await n.unlink(r);return n.symlink(c,r)}e.exports=copy},852:(e,t,r)=>{"use strict";const n=r(59).fromPromise;e.exports={copy:n(r(770)),copySync:r(524)}},783:(e,t,r)=>{"use strict";const n=r(59).fromPromise;const i=r(845);const o=r(17);const c=r(516);const s=r(58);const a=n((async function emptyDir(e){let t;try{t=await i.readdir(e)}catch{return c.mkdirs(e)}return Promise.all(t.map((t=>s.remove(o.join(e,t)))))}));function emptyDirSync(e){let t;try{t=i.readdirSync(e)}catch{return c.mkdirsSync(e)}t.forEach((t=>{t=o.join(e,t);s.removeSync(t)}))}e.exports={emptyDirSync:emptyDirSync,emptydirSync:emptyDirSync,emptyDir:a,emptydir:a}},530:(e,t,r)=>{"use strict";const n=r(59).fromPromise;const i=r(17);const o=r(845);const c=r(516);async function createFile(e){let t;try{t=await o.stat(e)}catch{}if(t&&t.isFile())return;const r=i.dirname(e);let n=null;try{n=await o.stat(r)}catch(t){if(t.code==="ENOENT"){await c.mkdirs(r);await o.writeFile(e,"");return}else{throw t}}if(n.isDirectory()){await o.writeFile(e,"")}else{await o.readdir(r)}}function createFileSync(e){let t;try{t=o.statSync(e)}catch{}if(t&&t.isFile())return;const r=i.dirname(e);try{if(!o.statSync(r).isDirectory()){o.readdirSync(r)}}catch(e){if(e&&e.code==="ENOENT")c.mkdirsSync(r);else throw e}o.writeFileSync(e,"")}e.exports={createFile:n(createFile),createFileSync:createFileSync}},960:(e,t,r)=>{"use strict";const{createFile:n,createFileSync:i}=r(530);const{createLink:o,createLinkSync:c}=r(404);const{createSymlink:s,createSymlinkSync:a}=r(425);e.exports={createFile:n,createFileSync:i,ensureFile:n,ensureFileSync:i,createLink:o,createLinkSync:c,ensureLink:o,ensureLinkSync:c,createSymlink:s,createSymlinkSync:a,ensureSymlink:s,ensureSymlinkSync:a}},404:(e,t,r)=>{"use strict";const n=r(59).fromPromise;const i=r(17);const o=r(845);const c=r(516);const{pathExists:s}=r(667);const{areIdentical:a}=r(826);async function createLink(e,t){let r;try{r=await o.lstat(t)}catch{}let n;try{n=await o.lstat(e)}catch(e){e.message=e.message.replace("lstat","ensureLink");throw e}if(r&&a(n,r))return;const u=i.dirname(t);const f=await s(u);if(!f){await c.mkdirs(u)}await o.link(e,t)}function createLinkSync(e,t){let r;try{r=o.lstatSync(t)}catch{}try{const t=o.lstatSync(e);if(r&&a(t,r))return}catch(e){e.message=e.message.replace("lstat","ensureLink");throw e}const n=i.dirname(t);const s=o.existsSync(n);if(s)return o.linkSync(e,t);c.mkdirsSync(n);return o.linkSync(e,t)}e.exports={createLink:n(createLink),createLinkSync:createLinkSync}},687:(e,t,r)=>{"use strict";const n=r(17);const i=r(845);const{pathExists:o}=r(667);const c=r(59).fromPromise;async function symlinkPaths(e,t){if(n.isAbsolute(e)){try{await i.lstat(e)}catch(e){e.message=e.message.replace("lstat","ensureSymlink");throw e}return{toCwd:e,toDst:e}}const r=n.dirname(t);const c=n.join(r,e);const s=await o(c);if(s){return{toCwd:c,toDst:e}}try{await i.lstat(e)}catch(e){e.message=e.message.replace("lstat","ensureSymlink");throw e}return{toCwd:e,toDst:n.relative(r,e)}}function symlinkPathsSync(e,t){if(n.isAbsolute(e)){const t=i.existsSync(e);if(!t)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}const r=n.dirname(t);const o=n.join(r,e);const c=i.existsSync(o);if(c){return{toCwd:o,toDst:e}}const s=i.existsSync(e);if(!s)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:n.relative(r,e)}}e.exports={symlinkPaths:c(symlinkPaths),symlinkPathsSync:symlinkPathsSync}},725:(e,t,r)=>{"use strict";const n=r(845);const i=r(59).fromPromise;async function symlinkType(e,t){if(t)return t;let r;try{r=await n.lstat(e)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}function symlinkTypeSync(e,t){if(t)return t;let r;try{r=n.lstatSync(e)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}e.exports={symlinkType:i(symlinkType),symlinkTypeSync:symlinkTypeSync}},425:(e,t,r)=>{"use strict";const n=r(59).fromPromise;const i=r(17);const o=r(845);const{mkdirs:c,mkdirsSync:s}=r(516);const{symlinkPaths:a,symlinkPathsSync:u}=r(687);const{symlinkType:f,symlinkTypeSync:l}=r(725);const{pathExists:y}=r(667);const{areIdentical:p}=r(826);async function createSymlink(e,t,r){let n;try{n=await o.lstat(t)}catch{}if(n&&n.isSymbolicLink()){const[r,n]=await Promise.all([o.stat(e),o.stat(t)]);if(p(r,n))return}const s=await a(e,t);e=s.toDst;const u=await f(s.toCwd,r);const l=i.dirname(t);if(!await y(l)){await c(l)}return o.symlink(e,t,u)}function createSymlinkSync(e,t,r){let n;try{n=o.lstatSync(t)}catch{}if(n&&n.isSymbolicLink()){const r=o.statSync(e);const n=o.statSync(t);if(p(r,n))return}const c=u(e,t);e=c.toDst;r=l(c.toCwd,r);const a=i.dirname(t);const f=o.existsSync(a);if(f)return o.symlinkSync(e,t,r);s(a);return o.symlinkSync(e,t,r)}e.exports={createSymlink:n(createSymlink),createSymlinkSync:createSymlinkSync}},845:(e,t,r)=>{"use strict";const n=r(59).fromCallback;const i=r(804);const 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((e=>typeof i[e]==="function"));Object.assign(t,i);o.forEach((e=>{t[e]=n(i[e])}));t.exists=function(e,t){if(typeof t==="function"){return i.exists(e,t)}return new Promise((t=>i.exists(e,t)))};t.read=function(e,t,r,n,o,c){if(typeof c==="function"){return i.read(e,t,r,n,o,c)}return new Promise(((c,s)=>{i.read(e,t,r,n,o,((e,t,r)=>{if(e)return s(e);c({bytesRead:t,buffer:r})}))}))};t.write=function(e,t,...r){if(typeof r[r.length-1]==="function"){return i.write(e,t,...r)}return new Promise(((n,o)=>{i.write(e,t,...r,((e,t,r)=>{if(e)return o(e);n({bytesWritten:t,buffer:r})}))}))};t.readv=function(e,t,...r){if(typeof r[r.length-1]==="function"){return i.readv(e,t,...r)}return new Promise(((n,o)=>{i.readv(e,t,...r,((e,t,r)=>{if(e)return o(e);n({bytesRead:t,buffers:r})}))}))};t.writev=function(e,t,...r){if(typeof r[r.length-1]==="function"){return i.writev(e,t,...r)}return new Promise(((n,o)=>{i.writev(e,t,...r,((e,t,r)=>{if(e)return o(e);n({bytesWritten:t,buffers:r})}))}))};if(typeof i.realpath.native==="function"){t.realpath.native=n(i.realpath.native)}else{process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")}},175:(e,t,r)=>{"use strict";e.exports={...r(845),...r(852),...r(783),...r(960),...r(540),...r(516),...r(135),...r(987),...r(667),...r(58)}},540:(e,t,r)=>{"use strict";const n=r(59).fromPromise;const i=r(869);i.outputJson=n(r(201));i.outputJsonSync=r(709);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},869:(e,t,r)=>{"use strict";const n=r(449);e.exports={readJson:n.readFile,readJsonSync:n.readFileSync,writeJson:n.writeFile,writeJsonSync:n.writeFileSync}},709:(e,t,r)=>{"use strict";const{stringify:n}=r(213);const{outputFileSync:i}=r(987);function outputJsonSync(e,t,r){const o=n(t,r);i(e,o,r)}e.exports=outputJsonSync},201:(e,t,r)=>{"use strict";const{stringify:n}=r(213);const{outputFile:i}=r(987);async function outputJson(e,t,r={}){const o=n(t,r);await i(e,o,r)}e.exports=outputJson},516:(e,t,r)=>{"use strict";const n=r(59).fromPromise;const{makeDir:i,makeDirSync:o}=r(368);const c=n(i);e.exports={mkdirs:c,mkdirsSync:o,mkdirp:c,mkdirpSync:o,ensureDir:c,ensureDirSync:o}},368:(e,t,r)=>{"use strict";const n=r(845);const{checkPath:i}=r(676);const getMode=e=>{const t={mode:511};if(typeof e==="number")return e;return{...t,...e}.mode};e.exports.makeDir=async(e,t)=>{i(e);return n.mkdir(e,{mode:getMode(t),recursive:true})};e.exports.makeDirSync=(e,t)=>{i(e);return n.mkdirSync(e,{mode:getMode(t),recursive:true})}},676:(e,t,r)=>{"use strict";const n=r(17);e.exports.checkPath=function checkPath(e){if(process.platform==="win32"){const t=/[<>:"|?*]/.test(e.replace(n.parse(e).root,""));if(t){const t=new Error(`Path contains invalid characters: ${e}`);t.code="EINVAL";throw t}}}},135:(e,t,r)=>{"use strict";const n=r(59).fromPromise;e.exports={move:n(r(497)),moveSync:r(801)}},801:(e,t,r)=>{"use strict";const n=r(804);const i=r(17);const o=r(852).copySync;const c=r(58).removeSync;const s=r(516).mkdirpSync;const a=r(826);function moveSync(e,t,r){r=r||{};const n=r.overwrite||r.clobber||false;const{srcStat:o,isChangingCase:c=false}=a.checkPathsSync(e,t,"move",r);a.checkParentPathsSync(e,o,t,"move");if(!isParentRoot(t))s(i.dirname(t));return doRename(e,t,n,c)}function isParentRoot(e){const t=i.dirname(e);const r=i.parse(t);return r.root===t}function doRename(e,t,r,i){if(i)return rename(e,t,r);if(r){c(t);return rename(e,t,r)}if(n.existsSync(t))throw new Error("dest already exists.");return rename(e,t,r)}function rename(e,t,r){try{n.renameSync(e,t)}catch(n){if(n.code!=="EXDEV")throw n;return moveAcrossDevice(e,t,r)}}function moveAcrossDevice(e,t,r){const n={overwrite:r,errorOnExist:true,preserveTimestamps:true};o(e,t,n);return c(e)}e.exports=moveSync},497:(e,t,r)=>{"use strict";const n=r(845);const i=r(17);const{copy:o}=r(852);const{remove:c}=r(58);const{mkdirp:s}=r(516);const{pathExists:a}=r(667);const u=r(826);async function move(e,t,r={}){const n=r.overwrite||r.clobber||false;const{srcStat:o,isChangingCase:c=false}=await u.checkPaths(e,t,"move",r);await u.checkParentPaths(e,o,t,"move");const a=i.dirname(t);const f=i.parse(a);if(f.root!==a){await s(a)}return doRename(e,t,n,c)}async function doRename(e,t,r,i){if(!i){if(r){await c(t)}else if(await a(t)){throw new Error("dest already exists.")}}try{await n.rename(e,t)}catch(n){if(n.code!=="EXDEV"){throw n}await moveAcrossDevice(e,t,r)}}async function moveAcrossDevice(e,t,r){const n={overwrite:r,errorOnExist:true,preserveTimestamps:true};await o(e,t,n);return c(e)}e.exports=move},987:(e,t,r)=>{"use strict";const n=r(59).fromPromise;const i=r(845);const o=r(17);const c=r(516);const s=r(667).pathExists;async function outputFile(e,t,r="utf-8"){const n=o.dirname(e);if(!await s(n)){await c.mkdirs(n)}return i.writeFile(e,t,r)}function outputFileSync(e,...t){const r=o.dirname(e);if(!i.existsSync(r)){c.mkdirsSync(r)}i.writeFileSync(e,...t)}e.exports={outputFile:n(outputFile),outputFileSync:outputFileSync}},667:(e,t,r)=>{"use strict";const n=r(59).fromPromise;const i=r(845);function pathExists(e){return i.access(e).then((()=>true)).catch((()=>false))}e.exports={pathExists:n(pathExists),pathExistsSync:i.existsSync}},58:(e,t,r)=>{"use strict";const n=r(804);const i=r(59).fromCallback;function remove(e,t){n.rm(e,{recursive:true,force:true},t)}function removeSync(e){n.rmSync(e,{recursive:true,force:true})}e.exports={remove:i(remove),removeSync:removeSync}},826:(e,t,r)=>{"use strict";const n=r(845);const i=r(17);const o=r(59).fromPromise;function getStats(e,t,r){const i=r.dereference?e=>n.stat(e,{bigint:true}):e=>n.lstat(e,{bigint:true});return Promise.all([i(e),i(t).catch((e=>{if(e.code==="ENOENT")return null;throw e}))]).then((([e,t])=>({srcStat:e,destStat:t})))}function getStatsSync(e,t,r){let i;const o=r.dereference?e=>n.statSync(e,{bigint:true}):e=>n.lstatSync(e,{bigint:true});const c=o(e);try{i=o(t)}catch(e){if(e.code==="ENOENT")return{srcStat:c,destStat:null};throw e}return{srcStat:c,destStat:i}}async function checkPaths(e,t,r,n){const{srcStat:o,destStat:c}=await getStats(e,t,n);if(c){if(areIdentical(o,c)){const n=i.basename(e);const s=i.basename(t);if(r==="move"&&n!==s&&n.toLowerCase()===s.toLowerCase()){return{srcStat:o,destStat:c,isChangingCase:true}}throw new Error("Source and destination must not be the same.")}if(o.isDirectory()&&!c.isDirectory()){throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`)}if(!o.isDirectory()&&c.isDirectory()){throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}}if(o.isDirectory()&&isSrcSubdir(e,t)){throw new Error(errMsg(e,t,r))}return{srcStat:o,destStat:c}}function checkPathsSync(e,t,r,n){const{srcStat:o,destStat:c}=getStatsSync(e,t,n);if(c){if(areIdentical(o,c)){const n=i.basename(e);const s=i.basename(t);if(r==="move"&&n!==s&&n.toLowerCase()===s.toLowerCase()){return{srcStat:o,destStat:c,isChangingCase:true}}throw new Error("Source and destination must not be the same.")}if(o.isDirectory()&&!c.isDirectory()){throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`)}if(!o.isDirectory()&&c.isDirectory()){throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}}if(o.isDirectory()&&isSrcSubdir(e,t)){throw new Error(errMsg(e,t,r))}return{srcStat:o,destStat:c}}async function checkParentPaths(e,t,r,o){const c=i.resolve(i.dirname(e));const s=i.resolve(i.dirname(r));if(s===c||s===i.parse(s).root)return;let a;try{a=await n.stat(s,{bigint:true})}catch(e){if(e.code==="ENOENT")return;throw e}if(areIdentical(t,a)){throw new Error(errMsg(e,r,o))}return checkParentPaths(e,t,s,o)}function checkParentPathsSync(e,t,r,o){const c=i.resolve(i.dirname(e));const s=i.resolve(i.dirname(r));if(s===c||s===i.parse(s).root)return;let a;try{a=n.statSync(s,{bigint:true})}catch(e){if(e.code==="ENOENT")return;throw e}if(areIdentical(t,a)){throw new Error(errMsg(e,r,o))}return checkParentPathsSync(e,t,s,o)}function areIdentical(e,t){return t.ino&&t.dev&&t.ino===e.ino&&t.dev===e.dev}function isSrcSubdir(e,t){const r=i.resolve(e).split(i.sep).filter((e=>e));const n=i.resolve(t).split(i.sep).filter((e=>e));return r.every(((e,t)=>n[t]===e))}function errMsg(e,t,r){return`Cannot ${r} '${e}' to a subdirectory of itself, '${t}'.`}e.exports={checkPaths:o(checkPaths),checkPathsSync:checkPathsSync,checkParentPaths:o(checkParentPaths),checkParentPathsSync:checkParentPathsSync,isSrcSubdir:isSrcSubdir,areIdentical:areIdentical}},227:(e,t,r)=>{"use strict";const n=r(845);const i=r(59).fromPromise;async function utimesMillis(e,t,r){const i=await n.open(e,"r+");let o=null;try{await n.futimes(i,t,r)}finally{try{await n.close(i)}catch(e){o=e}}if(o){throw o}}function utimesMillisSync(e,t,r){const i=n.openSync(e,"r+");n.futimesSync(i,t,r);return n.closeSync(i)}e.exports={utimesMillis:i(utimesMillis),utimesMillisSync:utimesMillisSync}},691:e=>{"use strict";e.exports=clone;var t=Object.getPrototypeOf||function(e){return e.__proto__};function clone(e){if(e===null||typeof e!=="object")return e;if(e instanceof Object)var r={__proto__:t(e)};else var r=Object.create(null);Object.getOwnPropertyNames(e).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}));return r}},804:(e,t,r)=>{var n=r(147);var i=r(567);var o=r(915);var c=r(691);var s=r(837);var a;var u;if(typeof Symbol==="function"&&typeof Symbol.for==="function"){a=Symbol.for("graceful-fs.queue");u=Symbol.for("graceful-fs.previous")}else{a="___graceful-fs.queue";u="___graceful-fs.previous"}function noop(){}function publishQueue(e,t){Object.defineProperty(e,a,{get:function(){return t}})}var f=noop;if(s.debuglog)f=s.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))f=function(){var e=s.format.apply(s,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: ");console.error(e)};if(!n[a]){var l=global[a]||[];publishQueue(n,l);n.close=function(e){function close(t,r){return e.call(n,t,(function(e){if(!e){resetQueue()}if(typeof r==="function")r.apply(this,arguments)}))}Object.defineProperty(close,u,{value:e});return close}(n.close);n.closeSync=function(e){function closeSync(t){e.apply(n,arguments);resetQueue()}Object.defineProperty(closeSync,u,{value:e});return closeSync}(n.closeSync);if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")){process.on("exit",(function(){f(n[a]);r(491).equal(n[a].length,0)}))}}if(!global[a]){publishQueue(global,n[a])}e.exports=patch(c(n));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!n.__patched){e.exports=patch(n);n.__patched=true}function patch(e){i(e);e.gracefulify=patch;e.createReadStream=createReadStream;e.createWriteStream=createWriteStream;var t=e.readFile;e.readFile=readFile;function readFile(e,r,n){if(typeof r==="function")n=r,r=null;return go$readFile(e,r,n);function go$readFile(e,r,n,i){return t(e,r,(function(t){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))enqueue([go$readFile,[e,r,n],t,i||Date.now(),Date.now()]);else{if(typeof n==="function")n.apply(this,arguments)}}))}}var r=e.writeFile;e.writeFile=writeFile;function writeFile(e,t,n,i){if(typeof n==="function")i=n,n=null;return go$writeFile(e,t,n,i);function go$writeFile(e,t,n,i,o){return r(e,t,n,(function(r){if(r&&(r.code==="EMFILE"||r.code==="ENFILE"))enqueue([go$writeFile,[e,t,n,i],r,o||Date.now(),Date.now()]);else{if(typeof i==="function")i.apply(this,arguments)}}))}}var n=e.appendFile;if(n)e.appendFile=appendFile;function appendFile(e,t,r,i){if(typeof r==="function")i=r,r=null;return go$appendFile(e,t,r,i);function go$appendFile(e,t,r,i,o){return n(e,t,r,(function(n){if(n&&(n.code==="EMFILE"||n.code==="ENFILE"))enqueue([go$appendFile,[e,t,r,i],n,o||Date.now(),Date.now()]);else{if(typeof i==="function")i.apply(this,arguments)}}))}}var c=e.copyFile;if(c)e.copyFile=copyFile;function copyFile(e,t,r,n){if(typeof r==="function"){n=r;r=0}return go$copyFile(e,t,r,n);function go$copyFile(e,t,r,n,i){return c(e,t,r,(function(o){if(o&&(o.code==="EMFILE"||o.code==="ENFILE"))enqueue([go$copyFile,[e,t,r,n],o,i||Date.now(),Date.now()]);else{if(typeof n==="function")n.apply(this,arguments)}}))}}var s=e.readdir;e.readdir=readdir;var a=/^v[0-5]\./;function readdir(e,t,r){if(typeof t==="function")r=t,t=null;var n=a.test(process.version)?function go$readdir(e,t,r,n){return s(e,fs$readdirCallback(e,t,r,n))}:function go$readdir(e,t,r,n){return s(e,t,fs$readdirCallback(e,t,r,n))};return n(e,t,r);function fs$readdirCallback(e,t,r,i){return function(o,c){if(o&&(o.code==="EMFILE"||o.code==="ENFILE"))enqueue([n,[e,t,r],o,i||Date.now(),Date.now()]);else{if(c&&c.sort)c.sort();if(typeof r==="function")r.call(this,o,c)}}}}if(process.version.substr(0,4)==="v0.8"){var u=o(e);ReadStream=u.ReadStream;WriteStream=u.WriteStream}var f=e.ReadStream;if(f){ReadStream.prototype=Object.create(f.prototype);ReadStream.prototype.open=ReadStream$open}var l=e.WriteStream;if(l){WriteStream.prototype=Object.create(l.prototype);WriteStream.prototype.open=WriteStream$open}Object.defineProperty(e,"ReadStream",{get:function(){return ReadStream},set:function(e){ReadStream=e},enumerable:true,configurable:true});Object.defineProperty(e,"WriteStream",{get:function(){return WriteStream},set:function(e){WriteStream=e},enumerable:true,configurable:true});var y=ReadStream;Object.defineProperty(e,"FileReadStream",{get:function(){return y},set:function(e){y=e},enumerable:true,configurable:true});var p=WriteStream;Object.defineProperty(e,"FileWriteStream",{get:function(){return p},set:function(e){p=e},enumerable:true,configurable:true});function ReadStream(e,t){if(this instanceof ReadStream)return f.apply(this,arguments),this;else return ReadStream.apply(Object.create(ReadStream.prototype),arguments)}function ReadStream$open(){var e=this;open(e.path,e.flags,e.mode,(function(t,r){if(t){if(e.autoClose)e.destroy();e.emit("error",t)}else{e.fd=r;e.emit("open",r);e.read()}}))}function WriteStream(e,t){if(this instanceof WriteStream)return l.apply(this,arguments),this;else return WriteStream.apply(Object.create(WriteStream.prototype),arguments)}function WriteStream$open(){var e=this;open(e.path,e.flags,e.mode,(function(t,r){if(t){e.destroy();e.emit("error",t)}else{e.fd=r;e.emit("open",r)}}))}function createReadStream(t,r){return new e.ReadStream(t,r)}function createWriteStream(t,r){return new e.WriteStream(t,r)}var m=e.open;e.open=open;function open(e,t,r,n){if(typeof r==="function")n=r,r=null;return go$open(e,t,r,n);function go$open(e,t,r,n,i){return m(e,t,r,(function(o,c){if(o&&(o.code==="EMFILE"||o.code==="ENFILE"))enqueue([go$open,[e,t,r,n],o,i||Date.now(),Date.now()]);else{if(typeof n==="function")n.apply(this,arguments)}}))}}return e}function enqueue(e){f("ENQUEUE",e[0].name,e[1]);n[a].push(e);retry()}var y;function resetQueue(){var e=Date.now();for(var t=0;t<n[a].length;++t){if(n[a][t].length>2){n[a][t][3]=e;n[a][t][4]=e}}retry()}function retry(){clearTimeout(y);y=undefined;if(n[a].length===0)return;var e=n[a].shift();var t=e[0];var r=e[1];var i=e[2];var o=e[3];var c=e[4];if(o===undefined){f("RETRY",t.name,r);t.apply(null,r)}else if(Date.now()-o>=6e4){f("TIMEOUT",t.name,r);var s=r.pop();if(typeof s==="function")s.call(null,i)}else{var u=Date.now()-c;var l=Math.max(c-o,1);var p=Math.min(l*1.2,100);if(u>=p){f("RETRY",t.name,r);t.apply(null,r.concat([o]))}else{n[a].push(e)}}if(y===undefined){y=setTimeout(retry,0)}}},915:(e,t,r)=>{var n=r(781).Stream;e.exports=legacy;function legacy(e){return{ReadStream:ReadStream,WriteStream:WriteStream};function ReadStream(t,r){if(!(this instanceof ReadStream))return new ReadStream(t,r);n.call(this);var i=this;this.path=t;this.fd=null;this.readable=true;this.paused=false;this.flags="r";this.mode=438;this.bufferSize=64*1024;r=r||{};var o=Object.keys(r);for(var c=0,s=o.length;c<s;c++){var a=o[c];this[a]=r[a]}if(this.encoding)this.setEncoding(this.encoding);if(this.start!==undefined){if("number"!==typeof this.start){throw TypeError("start must be a Number")}if(this.end===undefined){this.end=Infinity}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}if(this.fd!==null){process.nextTick((function(){i._read()}));return}e.open(this.path,this.flags,this.mode,(function(e,t){if(e){i.emit("error",e);i.readable=false;return}i.fd=t;i.emit("open",t);i._read()}))}function WriteStream(t,r){if(!(this instanceof WriteStream))return new WriteStream(t,r);n.call(this);this.path=t;this.fd=null;this.writable=true;this.flags="w";this.encoding="binary";this.mode=438;this.bytesWritten=0;r=r||{};var i=Object.keys(r);for(var o=0,c=i.length;o<c;o++){var s=i[o];this[s]=r[s]}if(this.start!==undefined){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=false;this._queue=[];if(this.fd===null){this._open=e.open;this._queue.push([this._open,this.path,this.flags,this.mode,undefined]);this.flush()}}}},567:(e,t,r)=>{var n=r(57);var i=process.cwd;var o=null;var c=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!o)o=i.call(process);return o};try{process.cwd()}catch(e){}if(typeof process.chdir==="function"){var s=process.chdir;process.chdir=function(e){o=null;s.call(process,e)};if(Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,s)}e.exports=patch;function patch(e){if(n.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)){patchLchmod(e)}if(!e.lutimes){patchLutimes(e)}e.chown=chownFix(e.chown);e.fchown=chownFix(e.fchown);e.lchown=chownFix(e.lchown);e.chmod=chmodFix(e.chmod);e.fchmod=chmodFix(e.fchmod);e.lchmod=chmodFix(e.lchmod);e.chownSync=chownFixSync(e.chownSync);e.fchownSync=chownFixSync(e.fchownSync);e.lchownSync=chownFixSync(e.lchownSync);e.chmodSync=chmodFixSync(e.chmodSync);e.fchmodSync=chmodFixSync(e.fchmodSync);e.lchmodSync=chmodFixSync(e.lchmodSync);e.stat=statFix(e.stat);e.fstat=statFix(e.fstat);e.lstat=statFix(e.lstat);e.statSync=statFixSync(e.statSync);e.fstatSync=statFixSync(e.fstatSync);e.lstatSync=statFixSync(e.lstatSync);if(e.chmod&&!e.lchmod){e.lchmod=function(e,t,r){if(r)process.nextTick(r)};e.lchmodSync=function(){}}if(e.chown&&!e.lchown){e.lchown=function(e,t,r,n){if(n)process.nextTick(n)};e.lchownSync=function(){}}if(c==="win32"){e.rename=typeof e.rename!=="function"?e.rename:function(t){function rename(r,n,i){var o=Date.now();var c=0;t(r,n,(function CB(s){if(s&&(s.code==="EACCES"||s.code==="EPERM"||s.code==="EBUSY")&&Date.now()-o<6e4){setTimeout((function(){e.stat(n,(function(e,o){if(e&&e.code==="ENOENT")t(r,n,CB);else i(s)}))}),c);if(c<100)c+=10;return}if(i)i(s)}))}if(Object.setPrototypeOf)Object.setPrototypeOf(rename,t);return rename}(e.rename)}e.read=typeof e.read!=="function"?e.read:function(t){function read(r,n,i,o,c,s){var a;if(s&&typeof s==="function"){var u=0;a=function(f,l,y){if(f&&f.code==="EAGAIN"&&u<10){u++;return t.call(e,r,n,i,o,c,a)}s.apply(this,arguments)}}return t.call(e,r,n,i,o,c,a)}if(Object.setPrototypeOf)Object.setPrototypeOf(read,t);return read}(e.read);e.readSync=typeof e.readSync!=="function"?e.readSync:function(t){return function(r,n,i,o,c){var s=0;while(true){try{return t.call(e,r,n,i,o,c)}catch(e){if(e.code==="EAGAIN"&&s<10){s++;continue}throw e}}}}(e.readSync);function patchLchmod(e){e.lchmod=function(t,r,i){e.open(t,n.O_WRONLY|n.O_SYMLINK,r,(function(t,n){if(t){if(i)i(t);return}e.fchmod(n,r,(function(t){e.close(n,(function(e){if(i)i(t||e)}))}))}))};e.lchmodSync=function(t,r){var i=e.openSync(t,n.O_WRONLY|n.O_SYMLINK,r);var o=true;var c;try{c=e.fchmodSync(i,r);o=false}finally{if(o){try{e.closeSync(i)}catch(e){}}else{e.closeSync(i)}}return c}}function patchLutimes(e){if(n.hasOwnProperty("O_SYMLINK")&&e.futimes){e.lutimes=function(t,r,i,o){e.open(t,n.O_SYMLINK,(function(t,n){if(t){if(o)o(t);return}e.futimes(n,r,i,(function(t){e.close(n,(function(e){if(o)o(t||e)}))}))}))};e.lutimesSync=function(t,r,i){var o=e.openSync(t,n.O_SYMLINK);var c;var s=true;try{c=e.futimesSync(o,r,i);s=false}finally{if(s){try{e.closeSync(o)}catch(e){}}else{e.closeSync(o)}}return c}}else if(e.futimes){e.lutimes=function(e,t,r,n){if(n)process.nextTick(n)};e.lutimesSync=function(){}}}function chmodFix(t){if(!t)return t;return function(r,n,i){return t.call(e,r,n,(function(e){if(chownErOk(e))e=null;if(i)i.apply(this,arguments)}))}}function chmodFixSync(t){if(!t)return t;return function(r,n){try{return t.call(e,r,n)}catch(e){if(!chownErOk(e))throw e}}}function chownFix(t){if(!t)return t;return function(r,n,i,o){return t.call(e,r,n,i,(function(e){if(chownErOk(e))e=null;if(o)o.apply(this,arguments)}))}}function chownFixSync(t){if(!t)return t;return function(r,n,i){try{return t.call(e,r,n,i)}catch(e){if(!chownErOk(e))throw e}}}function statFix(t){if(!t)return t;return function(r,n,i){if(typeof n==="function"){i=n;n=null}function callback(e,t){if(t){if(t.uid<0)t.uid+=4294967296;if(t.gid<0)t.gid+=4294967296}if(i)i.apply(this,arguments)}return n?t.call(e,r,n,callback):t.call(e,r,callback)}}function statFixSync(t){if(!t)return t;return function(r,n){var i=n?t.call(e,r,n):t.call(e,r);if(i){if(i.uid<0)i.uid+=4294967296;if(i.gid<0)i.gid+=4294967296}return i}}function chownErOk(e){if(!e)return true;if(e.code==="ENOSYS")return true;var t=!process.getuid||process.getuid()!==0;if(t){if(e.code==="EINVAL"||e.code==="EPERM")return true}return false}}},449:(e,t,r)=>{let n;try{n=r(804)}catch(e){n=r(147)}const i=r(59);const{stringify:o,stripBom:c}=r(213);async function _readFile(e,t={}){if(typeof t==="string"){t={encoding:t}}const r=t.fs||n;const o="throws"in t?t.throws:true;let s=await i.fromCallback(r.readFile)(e,t);s=c(s);let a;try{a=JSON.parse(s,t?t.reviver:null)}catch(t){if(o){t.message=`${e}: ${t.message}`;throw t}else{return null}}return a}const s=i.fromPromise(_readFile);function readFileSync(e,t={}){if(typeof t==="string"){t={encoding:t}}const r=t.fs||n;const i="throws"in t?t.throws:true;try{let n=r.readFileSync(e,t);n=c(n);return JSON.parse(n,t.reviver)}catch(t){if(i){t.message=`${e}: ${t.message}`;throw t}else{return null}}}async function _writeFile(e,t,r={}){const c=r.fs||n;const s=o(t,r);await i.fromCallback(c.writeFile)(e,s,r)}const a=i.fromPromise(_writeFile);function writeFileSync(e,t,r={}){const i=r.fs||n;const c=o(t,r);return i.writeFileSync(e,c,r)}const u={readFile:s,readFileSync:readFileSync,writeFile:a,writeFileSync:writeFileSync};e.exports=u},213:e=>{function stringify(e,{EOL:t="\n",finalEOL:r=true,replacer:n=null,spaces:i}={}){const o=r?t:"";const c=JSON.stringify(e,n,i);return c.replace(/\n/g,t)+o}function stripBom(e){if(Buffer.isBuffer(e))e=e.toString("utf8");return e.replace(/^\uFEFF/,"")}e.exports={stringify:stringify,stripBom:stripBom}},59:(e,t)=>{"use strict";t.fromCallback=function(e){return Object.defineProperty((function(...t){if(typeof t[t.length-1]==="function")e.apply(this,t);else{return new Promise(((r,n)=>{t.push(((e,t)=>e!=null?n(e):r(t)));e.apply(this,t)}))}}),"name",{value:e.name})};t.fromPromise=function(e){return Object.defineProperty((function(...t){const r=t[t.length-1];if(typeof r!=="function")return e.apply(this,t);else{t.pop();e.apply(this,t).then((e=>r(null,e)),r)}}),"name",{value:e.name})}},491:e=>{"use strict";e.exports=require("assert")},57:e=>{"use strict";e.exports=require("constants")},147:e=>{"use strict";e.exports=require("fs")},17:e=>{"use strict";e.exports=require("path")},781:e=>{"use strict";e.exports=require("stream")},837:e=>{"use strict";e.exports=require("util")}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var i=t[r]={exports:{}};var o=true;try{e[r](i,i.exports,__nccwpck_require__);o=false}finally{if(o)delete t[r]}return i.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(175);module.exports=r})();
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
2
|
+
/******/ var __webpack_modules__ = ({
|
|
3
|
+
|
|
4
|
+
/***/ 524:
|
|
5
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const fs = __nccwpck_require__(804)
|
|
11
|
+
const path = __nccwpck_require__(17)
|
|
12
|
+
const mkdirsSync = (__nccwpck_require__(516).mkdirsSync)
|
|
13
|
+
const utimesMillisSync = (__nccwpck_require__(227).utimesMillisSync)
|
|
14
|
+
const stat = __nccwpck_require__(826)
|
|
15
|
+
|
|
16
|
+
function copySync (src, dest, opts) {
|
|
17
|
+
if (typeof opts === 'function') {
|
|
18
|
+
opts = { filter: opts }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
opts = opts || {}
|
|
22
|
+
opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now
|
|
23
|
+
opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber
|
|
24
|
+
|
|
25
|
+
// Warn about using preserveTimestamps on 32-bit node
|
|
26
|
+
if (opts.preserveTimestamps && process.arch === 'ia32') {
|
|
27
|
+
process.emitWarning(
|
|
28
|
+
'Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' +
|
|
29
|
+
'\tsee https://github.com/jprichardson/node-fs-extra/issues/269',
|
|
30
|
+
'Warning', 'fs-extra-WARN0002'
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy', opts)
|
|
35
|
+
stat.checkParentPathsSync(src, srcStat, dest, 'copy')
|
|
36
|
+
if (opts.filter && !opts.filter(src, dest)) return
|
|
37
|
+
const destParent = path.dirname(dest)
|
|
38
|
+
if (!fs.existsSync(destParent)) mkdirsSync(destParent)
|
|
39
|
+
return getStats(destStat, src, dest, opts)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function getStats (destStat, src, dest, opts) {
|
|
43
|
+
const statSync = opts.dereference ? fs.statSync : fs.lstatSync
|
|
44
|
+
const srcStat = statSync(src)
|
|
45
|
+
|
|
46
|
+
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts)
|
|
47
|
+
else if (srcStat.isFile() ||
|
|
48
|
+
srcStat.isCharacterDevice() ||
|
|
49
|
+
srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts)
|
|
50
|
+
else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts)
|
|
51
|
+
else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`)
|
|
52
|
+
else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`)
|
|
53
|
+
throw new Error(`Unknown file: ${src}`)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function onFile (srcStat, destStat, src, dest, opts) {
|
|
57
|
+
if (!destStat) return copyFile(srcStat, src, dest, opts)
|
|
58
|
+
return mayCopyFile(srcStat, src, dest, opts)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function mayCopyFile (srcStat, src, dest, opts) {
|
|
62
|
+
if (opts.overwrite) {
|
|
63
|
+
fs.unlinkSync(dest)
|
|
64
|
+
return copyFile(srcStat, src, dest, opts)
|
|
65
|
+
} else if (opts.errorOnExist) {
|
|
66
|
+
throw new Error(`'${dest}' already exists`)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function copyFile (srcStat, src, dest, opts) {
|
|
71
|
+
fs.copyFileSync(src, dest)
|
|
72
|
+
if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest)
|
|
73
|
+
return setDestMode(dest, srcStat.mode)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function handleTimestamps (srcMode, src, dest) {
|
|
77
|
+
// Make sure the file is writable before setting the timestamp
|
|
78
|
+
// otherwise open fails with EPERM when invoked with 'r+'
|
|
79
|
+
// (through utimes call)
|
|
80
|
+
if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode)
|
|
81
|
+
return setDestTimestamps(src, dest)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function fileIsNotWritable (srcMode) {
|
|
85
|
+
return (srcMode & 0o200) === 0
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function makeFileWritable (dest, srcMode) {
|
|
89
|
+
return setDestMode(dest, srcMode | 0o200)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function setDestMode (dest, srcMode) {
|
|
93
|
+
return fs.chmodSync(dest, srcMode)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function setDestTimestamps (src, dest) {
|
|
97
|
+
// The initial srcStat.atime cannot be trusted
|
|
98
|
+
// because it is modified by the read(2) system call
|
|
99
|
+
// (See https://nodejs.org/api/fs.html#fs_stat_time_values)
|
|
100
|
+
const updatedSrcStat = fs.statSync(src)
|
|
101
|
+
return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function onDir (srcStat, destStat, src, dest, opts) {
|
|
105
|
+
if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts)
|
|
106
|
+
return copyDir(src, dest, opts)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function mkDirAndCopy (srcMode, src, dest, opts) {
|
|
110
|
+
fs.mkdirSync(dest)
|
|
111
|
+
copyDir(src, dest, opts)
|
|
112
|
+
return setDestMode(dest, srcMode)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function copyDir (src, dest, opts) {
|
|
116
|
+
fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts))
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function copyDirItem (item, src, dest, opts) {
|
|
120
|
+
const srcItem = path.join(src, item)
|
|
121
|
+
const destItem = path.join(dest, item)
|
|
122
|
+
if (opts.filter && !opts.filter(srcItem, destItem)) return
|
|
123
|
+
const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy', opts)
|
|
124
|
+
return getStats(destStat, srcItem, destItem, opts)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function onLink (destStat, src, dest, opts) {
|
|
128
|
+
let resolvedSrc = fs.readlinkSync(src)
|
|
129
|
+
if (opts.dereference) {
|
|
130
|
+
resolvedSrc = path.resolve(process.cwd(), resolvedSrc)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (!destStat) {
|
|
134
|
+
return fs.symlinkSync(resolvedSrc, dest)
|
|
135
|
+
} else {
|
|
136
|
+
let resolvedDest
|
|
137
|
+
try {
|
|
138
|
+
resolvedDest = fs.readlinkSync(dest)
|
|
139
|
+
} catch (err) {
|
|
140
|
+
// dest exists and is a regular file or directory,
|
|
141
|
+
// Windows may throw UNKNOWN error. If dest already exists,
|
|
142
|
+
// fs throws error anyway, so no need to guard against it here.
|
|
143
|
+
if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest)
|
|
144
|
+
throw err
|
|
145
|
+
}
|
|
146
|
+
if (opts.dereference) {
|
|
147
|
+
resolvedDest = path.resolve(process.cwd(), resolvedDest)
|
|
148
|
+
}
|
|
149
|
+
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
150
|
+
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// prevent copy if src is a subdir of dest since unlinking
|
|
154
|
+
// dest in this case would result in removing src contents
|
|
155
|
+
// and therefore a broken symlink would be created.
|
|
156
|
+
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
157
|
+
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)
|
|
158
|
+
}
|
|
159
|
+
return copyLink(resolvedSrc, dest)
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function copyLink (resolvedSrc, dest) {
|
|
164
|
+
fs.unlinkSync(dest)
|
|
165
|
+
return fs.symlinkSync(resolvedSrc, dest)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
module.exports = copySync
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
/***/ }),
|
|
172
|
+
|
|
173
|
+
/***/ 770:
|
|
174
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
175
|
+
|
|
176
|
+
"use strict";
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
const fs = __nccwpck_require__(845)
|
|
180
|
+
const path = __nccwpck_require__(17)
|
|
181
|
+
const { mkdirs } = __nccwpck_require__(516)
|
|
182
|
+
const { pathExists } = __nccwpck_require__(667)
|
|
183
|
+
const { utimesMillis } = __nccwpck_require__(227)
|
|
184
|
+
const stat = __nccwpck_require__(826)
|
|
185
|
+
|
|
186
|
+
async function copy (src, dest, opts = {}) {
|
|
187
|
+
if (typeof opts === 'function') {
|
|
188
|
+
opts = { filter: opts }
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now
|
|
192
|
+
opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber
|
|
193
|
+
|
|
194
|
+
// Warn about using preserveTimestamps on 32-bit node
|
|
195
|
+
if (opts.preserveTimestamps && process.arch === 'ia32') {
|
|
196
|
+
process.emitWarning(
|
|
197
|
+
'Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' +
|
|
198
|
+
'\tsee https://github.com/jprichardson/node-fs-extra/issues/269',
|
|
199
|
+
'Warning', 'fs-extra-WARN0001'
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const { srcStat, destStat } = await stat.checkPaths(src, dest, 'copy', opts)
|
|
204
|
+
|
|
205
|
+
await stat.checkParentPaths(src, srcStat, dest, 'copy')
|
|
206
|
+
|
|
207
|
+
const include = await runFilter(src, dest, opts)
|
|
208
|
+
|
|
209
|
+
if (!include) return
|
|
210
|
+
|
|
211
|
+
// check if the parent of dest exists, and create it if it doesn't exist
|
|
212
|
+
const destParent = path.dirname(dest)
|
|
213
|
+
const dirExists = await pathExists(destParent)
|
|
214
|
+
if (!dirExists) {
|
|
215
|
+
await mkdirs(destParent)
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
await getStatsAndPerformCopy(destStat, src, dest, opts)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
async function runFilter (src, dest, opts) {
|
|
222
|
+
if (!opts.filter) return true
|
|
223
|
+
return opts.filter(src, dest)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async function getStatsAndPerformCopy (destStat, src, dest, opts) {
|
|
227
|
+
const statFn = opts.dereference ? fs.stat : fs.lstat
|
|
228
|
+
const srcStat = await statFn(src)
|
|
229
|
+
|
|
230
|
+
if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts)
|
|
231
|
+
|
|
232
|
+
if (
|
|
233
|
+
srcStat.isFile() ||
|
|
234
|
+
srcStat.isCharacterDevice() ||
|
|
235
|
+
srcStat.isBlockDevice()
|
|
236
|
+
) return onFile(srcStat, destStat, src, dest, opts)
|
|
237
|
+
|
|
238
|
+
if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts)
|
|
239
|
+
if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`)
|
|
240
|
+
if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`)
|
|
241
|
+
throw new Error(`Unknown file: ${src}`)
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
async function onFile (srcStat, destStat, src, dest, opts) {
|
|
245
|
+
if (!destStat) return copyFile(srcStat, src, dest, opts)
|
|
246
|
+
|
|
247
|
+
if (opts.overwrite) {
|
|
248
|
+
await fs.unlink(dest)
|
|
249
|
+
return copyFile(srcStat, src, dest, opts)
|
|
250
|
+
}
|
|
251
|
+
if (opts.errorOnExist) {
|
|
252
|
+
throw new Error(`'${dest}' already exists`)
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
async function copyFile (srcStat, src, dest, opts) {
|
|
257
|
+
await fs.copyFile(src, dest)
|
|
258
|
+
if (opts.preserveTimestamps) {
|
|
259
|
+
// Make sure the file is writable before setting the timestamp
|
|
260
|
+
// otherwise open fails with EPERM when invoked with 'r+'
|
|
261
|
+
// (through utimes call)
|
|
262
|
+
if (fileIsNotWritable(srcStat.mode)) {
|
|
263
|
+
await makeFileWritable(dest, srcStat.mode)
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Set timestamps and mode correspondingly
|
|
267
|
+
|
|
268
|
+
// Note that The initial srcStat.atime cannot be trusted
|
|
269
|
+
// because it is modified by the read(2) system call
|
|
270
|
+
// (See https://nodejs.org/api/fs.html#fs_stat_time_values)
|
|
271
|
+
const updatedSrcStat = await fs.stat(src)
|
|
272
|
+
await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime)
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
return fs.chmod(dest, srcStat.mode)
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function fileIsNotWritable (srcMode) {
|
|
279
|
+
return (srcMode & 0o200) === 0
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function makeFileWritable (dest, srcMode) {
|
|
283
|
+
return fs.chmod(dest, srcMode | 0o200)
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
async function onDir (srcStat, destStat, src, dest, opts) {
|
|
287
|
+
// the dest directory might not exist, create it
|
|
288
|
+
if (!destStat) {
|
|
289
|
+
await fs.mkdir(dest)
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const items = await fs.readdir(src)
|
|
293
|
+
|
|
294
|
+
// loop through the files in the current directory to copy everything
|
|
295
|
+
await Promise.all(items.map(async item => {
|
|
296
|
+
const srcItem = path.join(src, item)
|
|
297
|
+
const destItem = path.join(dest, item)
|
|
298
|
+
|
|
299
|
+
// skip the item if it is matches by the filter function
|
|
300
|
+
const include = await runFilter(srcItem, destItem, opts)
|
|
301
|
+
if (!include) return
|
|
302
|
+
|
|
303
|
+
const { destStat } = await stat.checkPaths(srcItem, destItem, 'copy', opts)
|
|
304
|
+
|
|
305
|
+
// If the item is a copyable file, `getStatsAndPerformCopy` will copy it
|
|
306
|
+
// If the item is a directory, `getStatsAndPerformCopy` will call `onDir` recursively
|
|
307
|
+
return getStatsAndPerformCopy(destStat, srcItem, destItem, opts)
|
|
308
|
+
}))
|
|
309
|
+
|
|
310
|
+
if (!destStat) {
|
|
311
|
+
await fs.chmod(dest, srcStat.mode)
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
async function onLink (destStat, src, dest, opts) {
|
|
316
|
+
let resolvedSrc = await fs.readlink(src)
|
|
317
|
+
if (opts.dereference) {
|
|
318
|
+
resolvedSrc = path.resolve(process.cwd(), resolvedSrc)
|
|
319
|
+
}
|
|
320
|
+
if (!destStat) {
|
|
321
|
+
return fs.symlink(resolvedSrc, dest)
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
let resolvedDest = null
|
|
325
|
+
try {
|
|
326
|
+
resolvedDest = await fs.readlink(dest)
|
|
327
|
+
} catch (e) {
|
|
328
|
+
// dest exists and is a regular file or directory,
|
|
329
|
+
// Windows may throw UNKNOWN error. If dest already exists,
|
|
330
|
+
// fs throws error anyway, so no need to guard against it here.
|
|
331
|
+
if (e.code === 'EINVAL' || e.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest)
|
|
332
|
+
throw e
|
|
333
|
+
}
|
|
334
|
+
if (opts.dereference) {
|
|
335
|
+
resolvedDest = path.resolve(process.cwd(), resolvedDest)
|
|
336
|
+
}
|
|
337
|
+
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
|
|
338
|
+
throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// do not copy if src is a subdir of dest since unlinking
|
|
342
|
+
// dest in this case would result in removing src contents
|
|
343
|
+
// and therefore a broken symlink would be created.
|
|
344
|
+
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
|
|
345
|
+
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// copy the link
|
|
349
|
+
await fs.unlink(dest)
|
|
350
|
+
return fs.symlink(resolvedSrc, dest)
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
module.exports = copy
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
/***/ }),
|
|
357
|
+
|
|
358
|
+
/***/ 852:
|
|
359
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
360
|
+
|
|
361
|
+
"use strict";
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
const u = (__nccwpck_require__(59).fromPromise)
|
|
365
|
+
module.exports = {
|
|
366
|
+
copy: u(__nccwpck_require__(770)),
|
|
367
|
+
copySync: __nccwpck_require__(524)
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
/***/ }),
|
|
372
|
+
|
|
373
|
+
/***/ 783:
|
|
374
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
375
|
+
|
|
376
|
+
"use strict";
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
const u = (__nccwpck_require__(59).fromPromise)
|
|
380
|
+
const fs = __nccwpck_require__(845)
|
|
381
|
+
const path = __nccwpck_require__(17)
|
|
382
|
+
const mkdir = __nccwpck_require__(516)
|
|
383
|
+
const remove = __nccwpck_require__(58)
|
|
384
|
+
|
|
385
|
+
const emptyDir = u(async function emptyDir (dir) {
|
|
386
|
+
let items
|
|
387
|
+
try {
|
|
388
|
+
items = await fs.readdir(dir)
|
|
389
|
+
} catch {
|
|
390
|
+
return mkdir.mkdirs(dir)
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
return Promise.all(items.map(item => remove.remove(path.join(dir, item))))
|
|
394
|
+
})
|
|
395
|
+
|
|
396
|
+
function emptyDirSync (dir) {
|
|
397
|
+
let items
|
|
398
|
+
try {
|
|
399
|
+
items = fs.readdirSync(dir)
|
|
400
|
+
} catch {
|
|
401
|
+
return mkdir.mkdirsSync(dir)
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
items.forEach(item => {
|
|
405
|
+
item = path.join(dir, item)
|
|
406
|
+
remove.removeSync(item)
|
|
407
|
+
})
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
module.exports = {
|
|
411
|
+
emptyDirSync,
|
|
412
|
+
emptydirSync: emptyDirSync,
|
|
413
|
+
emptyDir,
|
|
414
|
+
emptydir: emptyDir
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
/***/ }),
|
|
419
|
+
|
|
420
|
+
/***/ 530:
|
|
421
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
422
|
+
|
|
423
|
+
"use strict";
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
const u = (__nccwpck_require__(59).fromPromise)
|
|
427
|
+
const path = __nccwpck_require__(17)
|
|
428
|
+
const fs = __nccwpck_require__(845)
|
|
429
|
+
const mkdir = __nccwpck_require__(516)
|
|
430
|
+
|
|
431
|
+
async function createFile (file) {
|
|
432
|
+
let stats
|
|
433
|
+
try {
|
|
434
|
+
stats = await fs.stat(file)
|
|
435
|
+
} catch { }
|
|
436
|
+
if (stats && stats.isFile()) return
|
|
437
|
+
|
|
438
|
+
const dir = path.dirname(file)
|
|
439
|
+
|
|
440
|
+
let dirStats = null
|
|
441
|
+
try {
|
|
442
|
+
dirStats = await fs.stat(dir)
|
|
443
|
+
} catch (err) {
|
|
444
|
+
// if the directory doesn't exist, make it
|
|
445
|
+
if (err.code === 'ENOENT') {
|
|
446
|
+
await mkdir.mkdirs(dir)
|
|
447
|
+
await fs.writeFile(file, '')
|
|
448
|
+
return
|
|
449
|
+
} else {
|
|
450
|
+
throw err
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
if (dirStats.isDirectory()) {
|
|
455
|
+
await fs.writeFile(file, '')
|
|
456
|
+
} else {
|
|
457
|
+
// parent is not a directory
|
|
458
|
+
// This is just to cause an internal ENOTDIR error to be thrown
|
|
459
|
+
await fs.readdir(dir)
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
function createFileSync (file) {
|
|
464
|
+
let stats
|
|
465
|
+
try {
|
|
466
|
+
stats = fs.statSync(file)
|
|
467
|
+
} catch { }
|
|
468
|
+
if (stats && stats.isFile()) return
|
|
469
|
+
|
|
470
|
+
const dir = path.dirname(file)
|
|
471
|
+
try {
|
|
472
|
+
if (!fs.statSync(dir).isDirectory()) {
|
|
473
|
+
// parent is not a directory
|
|
474
|
+
// This is just to cause an internal ENOTDIR error to be thrown
|
|
475
|
+
fs.readdirSync(dir)
|
|
476
|
+
}
|
|
477
|
+
} catch (err) {
|
|
478
|
+
// If the stat call above failed because the directory doesn't exist, create it
|
|
479
|
+
if (err && err.code === 'ENOENT') mkdir.mkdirsSync(dir)
|
|
480
|
+
else throw err
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
fs.writeFileSync(file, '')
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
module.exports = {
|
|
487
|
+
createFile: u(createFile),
|
|
488
|
+
createFileSync
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
/***/ }),
|
|
493
|
+
|
|
494
|
+
/***/ 960:
|
|
495
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
496
|
+
|
|
497
|
+
"use strict";
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
const { createFile, createFileSync } = __nccwpck_require__(530)
|
|
501
|
+
const { createLink, createLinkSync } = __nccwpck_require__(404)
|
|
502
|
+
const { createSymlink, createSymlinkSync } = __nccwpck_require__(425)
|
|
503
|
+
|
|
504
|
+
module.exports = {
|
|
505
|
+
// file
|
|
506
|
+
createFile,
|
|
507
|
+
createFileSync,
|
|
508
|
+
ensureFile: createFile,
|
|
509
|
+
ensureFileSync: createFileSync,
|
|
510
|
+
// link
|
|
511
|
+
createLink,
|
|
512
|
+
createLinkSync,
|
|
513
|
+
ensureLink: createLink,
|
|
514
|
+
ensureLinkSync: createLinkSync,
|
|
515
|
+
// symlink
|
|
516
|
+
createSymlink,
|
|
517
|
+
createSymlinkSync,
|
|
518
|
+
ensureSymlink: createSymlink,
|
|
519
|
+
ensureSymlinkSync: createSymlinkSync
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
/***/ }),
|
|
524
|
+
|
|
525
|
+
/***/ 404:
|
|
526
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
527
|
+
|
|
528
|
+
"use strict";
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
const u = (__nccwpck_require__(59).fromPromise)
|
|
532
|
+
const path = __nccwpck_require__(17)
|
|
533
|
+
const fs = __nccwpck_require__(845)
|
|
534
|
+
const mkdir = __nccwpck_require__(516)
|
|
535
|
+
const { pathExists } = __nccwpck_require__(667)
|
|
536
|
+
const { areIdentical } = __nccwpck_require__(826)
|
|
537
|
+
|
|
538
|
+
async function createLink (srcpath, dstpath) {
|
|
539
|
+
let dstStat
|
|
540
|
+
try {
|
|
541
|
+
dstStat = await fs.lstat(dstpath)
|
|
542
|
+
} catch {
|
|
543
|
+
// ignore error
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
let srcStat
|
|
547
|
+
try {
|
|
548
|
+
srcStat = await fs.lstat(srcpath)
|
|
549
|
+
} catch (err) {
|
|
550
|
+
err.message = err.message.replace('lstat', 'ensureLink')
|
|
551
|
+
throw err
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
if (dstStat && areIdentical(srcStat, dstStat)) return
|
|
555
|
+
|
|
556
|
+
const dir = path.dirname(dstpath)
|
|
557
|
+
|
|
558
|
+
const dirExists = await pathExists(dir)
|
|
559
|
+
|
|
560
|
+
if (!dirExists) {
|
|
561
|
+
await mkdir.mkdirs(dir)
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
await fs.link(srcpath, dstpath)
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
function createLinkSync (srcpath, dstpath) {
|
|
568
|
+
let dstStat
|
|
569
|
+
try {
|
|
570
|
+
dstStat = fs.lstatSync(dstpath)
|
|
571
|
+
} catch {}
|
|
572
|
+
|
|
573
|
+
try {
|
|
574
|
+
const srcStat = fs.lstatSync(srcpath)
|
|
575
|
+
if (dstStat && areIdentical(srcStat, dstStat)) return
|
|
576
|
+
} catch (err) {
|
|
577
|
+
err.message = err.message.replace('lstat', 'ensureLink')
|
|
578
|
+
throw err
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
const dir = path.dirname(dstpath)
|
|
582
|
+
const dirExists = fs.existsSync(dir)
|
|
583
|
+
if (dirExists) return fs.linkSync(srcpath, dstpath)
|
|
584
|
+
mkdir.mkdirsSync(dir)
|
|
585
|
+
|
|
586
|
+
return fs.linkSync(srcpath, dstpath)
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
module.exports = {
|
|
590
|
+
createLink: u(createLink),
|
|
591
|
+
createLinkSync
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
/***/ }),
|
|
596
|
+
|
|
597
|
+
/***/ 687:
|
|
598
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
599
|
+
|
|
600
|
+
"use strict";
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
const path = __nccwpck_require__(17)
|
|
604
|
+
const fs = __nccwpck_require__(845)
|
|
605
|
+
const { pathExists } = __nccwpck_require__(667)
|
|
606
|
+
|
|
607
|
+
const u = (__nccwpck_require__(59).fromPromise)
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Function that returns two types of paths, one relative to symlink, and one
|
|
611
|
+
* relative to the current working directory. Checks if path is absolute or
|
|
612
|
+
* relative. If the path is relative, this function checks if the path is
|
|
613
|
+
* relative to symlink or relative to current working directory. This is an
|
|
614
|
+
* initiative to find a smarter `srcpath` to supply when building symlinks.
|
|
615
|
+
* This allows you to determine which path to use out of one of three possible
|
|
616
|
+
* types of source paths. The first is an absolute path. This is detected by
|
|
617
|
+
* `path.isAbsolute()`. When an absolute path is provided, it is checked to
|
|
618
|
+
* see if it exists. If it does it's used, if not an error is returned
|
|
619
|
+
* (callback)/ thrown (sync). The other two options for `srcpath` are a
|
|
620
|
+
* relative url. By default Node's `fs.symlink` works by creating a symlink
|
|
621
|
+
* using `dstpath` and expects the `srcpath` to be relative to the newly
|
|
622
|
+
* created symlink. If you provide a `srcpath` that does not exist on the file
|
|
623
|
+
* system it results in a broken symlink. To minimize this, the function
|
|
624
|
+
* checks to see if the 'relative to symlink' source file exists, and if it
|
|
625
|
+
* does it will use it. If it does not, it checks if there's a file that
|
|
626
|
+
* exists that is relative to the current working directory, if does its used.
|
|
627
|
+
* This preserves the expectations of the original fs.symlink spec and adds
|
|
628
|
+
* the ability to pass in `relative to current working direcotry` paths.
|
|
629
|
+
*/
|
|
630
|
+
|
|
631
|
+
async function symlinkPaths (srcpath, dstpath) {
|
|
632
|
+
if (path.isAbsolute(srcpath)) {
|
|
633
|
+
try {
|
|
634
|
+
await fs.lstat(srcpath)
|
|
635
|
+
} catch (err) {
|
|
636
|
+
err.message = err.message.replace('lstat', 'ensureSymlink')
|
|
637
|
+
throw err
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
return {
|
|
641
|
+
toCwd: srcpath,
|
|
642
|
+
toDst: srcpath
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
const dstdir = path.dirname(dstpath)
|
|
647
|
+
const relativeToDst = path.join(dstdir, srcpath)
|
|
648
|
+
|
|
649
|
+
const exists = await pathExists(relativeToDst)
|
|
650
|
+
if (exists) {
|
|
651
|
+
return {
|
|
652
|
+
toCwd: relativeToDst,
|
|
653
|
+
toDst: srcpath
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
try {
|
|
658
|
+
await fs.lstat(srcpath)
|
|
659
|
+
} catch (err) {
|
|
660
|
+
err.message = err.message.replace('lstat', 'ensureSymlink')
|
|
661
|
+
throw err
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
return {
|
|
665
|
+
toCwd: srcpath,
|
|
666
|
+
toDst: path.relative(dstdir, srcpath)
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
function symlinkPathsSync (srcpath, dstpath) {
|
|
671
|
+
if (path.isAbsolute(srcpath)) {
|
|
672
|
+
const exists = fs.existsSync(srcpath)
|
|
673
|
+
if (!exists) throw new Error('absolute srcpath does not exist')
|
|
674
|
+
return {
|
|
675
|
+
toCwd: srcpath,
|
|
676
|
+
toDst: srcpath
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
const dstdir = path.dirname(dstpath)
|
|
681
|
+
const relativeToDst = path.join(dstdir, srcpath)
|
|
682
|
+
const exists = fs.existsSync(relativeToDst)
|
|
683
|
+
if (exists) {
|
|
684
|
+
return {
|
|
685
|
+
toCwd: relativeToDst,
|
|
686
|
+
toDst: srcpath
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
const srcExists = fs.existsSync(srcpath)
|
|
691
|
+
if (!srcExists) throw new Error('relative srcpath does not exist')
|
|
692
|
+
return {
|
|
693
|
+
toCwd: srcpath,
|
|
694
|
+
toDst: path.relative(dstdir, srcpath)
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
module.exports = {
|
|
699
|
+
symlinkPaths: u(symlinkPaths),
|
|
700
|
+
symlinkPathsSync
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
/***/ }),
|
|
705
|
+
|
|
706
|
+
/***/ 725:
|
|
707
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
708
|
+
|
|
709
|
+
"use strict";
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
const fs = __nccwpck_require__(845)
|
|
713
|
+
const u = (__nccwpck_require__(59).fromPromise)
|
|
714
|
+
|
|
715
|
+
async function symlinkType (srcpath, type) {
|
|
716
|
+
if (type) return type
|
|
717
|
+
|
|
718
|
+
let stats
|
|
719
|
+
try {
|
|
720
|
+
stats = await fs.lstat(srcpath)
|
|
721
|
+
} catch {
|
|
722
|
+
return 'file'
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
return (stats && stats.isDirectory()) ? 'dir' : 'file'
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
function symlinkTypeSync (srcpath, type) {
|
|
729
|
+
if (type) return type
|
|
730
|
+
|
|
731
|
+
let stats
|
|
732
|
+
try {
|
|
733
|
+
stats = fs.lstatSync(srcpath)
|
|
734
|
+
} catch {
|
|
735
|
+
return 'file'
|
|
736
|
+
}
|
|
737
|
+
return (stats && stats.isDirectory()) ? 'dir' : 'file'
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
module.exports = {
|
|
741
|
+
symlinkType: u(symlinkType),
|
|
742
|
+
symlinkTypeSync
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
/***/ }),
|
|
747
|
+
|
|
748
|
+
/***/ 425:
|
|
749
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
750
|
+
|
|
751
|
+
"use strict";
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
const u = (__nccwpck_require__(59).fromPromise)
|
|
755
|
+
const path = __nccwpck_require__(17)
|
|
756
|
+
const fs = __nccwpck_require__(845)
|
|
757
|
+
|
|
758
|
+
const { mkdirs, mkdirsSync } = __nccwpck_require__(516)
|
|
759
|
+
|
|
760
|
+
const { symlinkPaths, symlinkPathsSync } = __nccwpck_require__(687)
|
|
761
|
+
const { symlinkType, symlinkTypeSync } = __nccwpck_require__(725)
|
|
762
|
+
|
|
763
|
+
const { pathExists } = __nccwpck_require__(667)
|
|
764
|
+
|
|
765
|
+
const { areIdentical } = __nccwpck_require__(826)
|
|
766
|
+
|
|
767
|
+
async function createSymlink (srcpath, dstpath, type) {
|
|
768
|
+
let stats
|
|
769
|
+
try {
|
|
770
|
+
stats = await fs.lstat(dstpath)
|
|
771
|
+
} catch { }
|
|
772
|
+
|
|
773
|
+
if (stats && stats.isSymbolicLink()) {
|
|
774
|
+
const [srcStat, dstStat] = await Promise.all([
|
|
775
|
+
fs.stat(srcpath),
|
|
776
|
+
fs.stat(dstpath)
|
|
777
|
+
])
|
|
778
|
+
|
|
779
|
+
if (areIdentical(srcStat, dstStat)) return
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
const relative = await symlinkPaths(srcpath, dstpath)
|
|
783
|
+
srcpath = relative.toDst
|
|
784
|
+
const toType = await symlinkType(relative.toCwd, type)
|
|
785
|
+
const dir = path.dirname(dstpath)
|
|
786
|
+
|
|
787
|
+
if (!(await pathExists(dir))) {
|
|
788
|
+
await mkdirs(dir)
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
return fs.symlink(srcpath, dstpath, toType)
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
function createSymlinkSync (srcpath, dstpath, type) {
|
|
795
|
+
let stats
|
|
796
|
+
try {
|
|
797
|
+
stats = fs.lstatSync(dstpath)
|
|
798
|
+
} catch { }
|
|
799
|
+
if (stats && stats.isSymbolicLink()) {
|
|
800
|
+
const srcStat = fs.statSync(srcpath)
|
|
801
|
+
const dstStat = fs.statSync(dstpath)
|
|
802
|
+
if (areIdentical(srcStat, dstStat)) return
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
const relative = symlinkPathsSync(srcpath, dstpath)
|
|
806
|
+
srcpath = relative.toDst
|
|
807
|
+
type = symlinkTypeSync(relative.toCwd, type)
|
|
808
|
+
const dir = path.dirname(dstpath)
|
|
809
|
+
const exists = fs.existsSync(dir)
|
|
810
|
+
if (exists) return fs.symlinkSync(srcpath, dstpath, type)
|
|
811
|
+
mkdirsSync(dir)
|
|
812
|
+
return fs.symlinkSync(srcpath, dstpath, type)
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
module.exports = {
|
|
816
|
+
createSymlink: u(createSymlink),
|
|
817
|
+
createSymlinkSync
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
/***/ }),
|
|
822
|
+
|
|
823
|
+
/***/ 845:
|
|
824
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
825
|
+
|
|
826
|
+
"use strict";
|
|
827
|
+
|
|
828
|
+
// This is adapted from https://github.com/normalize/mz
|
|
829
|
+
// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors
|
|
830
|
+
const u = (__nccwpck_require__(59).fromCallback)
|
|
831
|
+
const fs = __nccwpck_require__(804)
|
|
832
|
+
|
|
833
|
+
const api = [
|
|
834
|
+
'access',
|
|
835
|
+
'appendFile',
|
|
836
|
+
'chmod',
|
|
837
|
+
'chown',
|
|
838
|
+
'close',
|
|
839
|
+
'copyFile',
|
|
840
|
+
'fchmod',
|
|
841
|
+
'fchown',
|
|
842
|
+
'fdatasync',
|
|
843
|
+
'fstat',
|
|
844
|
+
'fsync',
|
|
845
|
+
'ftruncate',
|
|
846
|
+
'futimes',
|
|
847
|
+
'lchmod',
|
|
848
|
+
'lchown',
|
|
849
|
+
'link',
|
|
850
|
+
'lstat',
|
|
851
|
+
'mkdir',
|
|
852
|
+
'mkdtemp',
|
|
853
|
+
'open',
|
|
854
|
+
'opendir',
|
|
855
|
+
'readdir',
|
|
856
|
+
'readFile',
|
|
857
|
+
'readlink',
|
|
858
|
+
'realpath',
|
|
859
|
+
'rename',
|
|
860
|
+
'rm',
|
|
861
|
+
'rmdir',
|
|
862
|
+
'stat',
|
|
863
|
+
'symlink',
|
|
864
|
+
'truncate',
|
|
865
|
+
'unlink',
|
|
866
|
+
'utimes',
|
|
867
|
+
'writeFile'
|
|
868
|
+
].filter(key => {
|
|
869
|
+
// Some commands are not available on some systems. Ex:
|
|
870
|
+
// fs.cp was added in Node.js v16.7.0
|
|
871
|
+
// fs.lchown is not available on at least some Linux
|
|
872
|
+
return typeof fs[key] === 'function'
|
|
873
|
+
})
|
|
874
|
+
|
|
875
|
+
// Export cloned fs:
|
|
876
|
+
Object.assign(exports, fs)
|
|
877
|
+
|
|
878
|
+
// Universalify async methods:
|
|
879
|
+
api.forEach(method => {
|
|
880
|
+
exports[method] = u(fs[method])
|
|
881
|
+
})
|
|
882
|
+
|
|
883
|
+
// We differ from mz/fs in that we still ship the old, broken, fs.exists()
|
|
884
|
+
// since we are a drop-in replacement for the native module
|
|
885
|
+
exports.exists = function (filename, callback) {
|
|
886
|
+
if (typeof callback === 'function') {
|
|
887
|
+
return fs.exists(filename, callback)
|
|
888
|
+
}
|
|
889
|
+
return new Promise(resolve => {
|
|
890
|
+
return fs.exists(filename, resolve)
|
|
891
|
+
})
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
// fs.read(), fs.write(), fs.readv(), & fs.writev() need special treatment due to multiple callback args
|
|
895
|
+
|
|
896
|
+
exports.read = function (fd, buffer, offset, length, position, callback) {
|
|
897
|
+
if (typeof callback === 'function') {
|
|
898
|
+
return fs.read(fd, buffer, offset, length, position, callback)
|
|
899
|
+
}
|
|
900
|
+
return new Promise((resolve, reject) => {
|
|
901
|
+
fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => {
|
|
902
|
+
if (err) return reject(err)
|
|
903
|
+
resolve({ bytesRead, buffer })
|
|
904
|
+
})
|
|
905
|
+
})
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
// Function signature can be
|
|
909
|
+
// fs.write(fd, buffer[, offset[, length[, position]]], callback)
|
|
910
|
+
// OR
|
|
911
|
+
// fs.write(fd, string[, position[, encoding]], callback)
|
|
912
|
+
// We need to handle both cases, so we use ...args
|
|
913
|
+
exports.write = function (fd, buffer, ...args) {
|
|
914
|
+
if (typeof args[args.length - 1] === 'function') {
|
|
915
|
+
return fs.write(fd, buffer, ...args)
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
return new Promise((resolve, reject) => {
|
|
919
|
+
fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => {
|
|
920
|
+
if (err) return reject(err)
|
|
921
|
+
resolve({ bytesWritten, buffer })
|
|
922
|
+
})
|
|
923
|
+
})
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
// Function signature is
|
|
927
|
+
// s.readv(fd, buffers[, position], callback)
|
|
928
|
+
// We need to handle the optional arg, so we use ...args
|
|
929
|
+
exports.readv = function (fd, buffers, ...args) {
|
|
930
|
+
if (typeof args[args.length - 1] === 'function') {
|
|
931
|
+
return fs.readv(fd, buffers, ...args)
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
return new Promise((resolve, reject) => {
|
|
935
|
+
fs.readv(fd, buffers, ...args, (err, bytesRead, buffers) => {
|
|
936
|
+
if (err) return reject(err)
|
|
937
|
+
resolve({ bytesRead, buffers })
|
|
938
|
+
})
|
|
939
|
+
})
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
// Function signature is
|
|
943
|
+
// s.writev(fd, buffers[, position], callback)
|
|
944
|
+
// We need to handle the optional arg, so we use ...args
|
|
945
|
+
exports.writev = function (fd, buffers, ...args) {
|
|
946
|
+
if (typeof args[args.length - 1] === 'function') {
|
|
947
|
+
return fs.writev(fd, buffers, ...args)
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
return new Promise((resolve, reject) => {
|
|
951
|
+
fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => {
|
|
952
|
+
if (err) return reject(err)
|
|
953
|
+
resolve({ bytesWritten, buffers })
|
|
954
|
+
})
|
|
955
|
+
})
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
// fs.realpath.native sometimes not available if fs is monkey-patched
|
|
959
|
+
if (typeof fs.realpath.native === 'function') {
|
|
960
|
+
exports.realpath.native = u(fs.realpath.native)
|
|
961
|
+
} else {
|
|
962
|
+
process.emitWarning(
|
|
963
|
+
'fs.realpath.native is not a function. Is fs being monkey-patched?',
|
|
964
|
+
'Warning', 'fs-extra-WARN0003'
|
|
965
|
+
)
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
/***/ }),
|
|
970
|
+
|
|
971
|
+
/***/ 175:
|
|
972
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
973
|
+
|
|
974
|
+
"use strict";
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
module.exports = {
|
|
978
|
+
// Export promiseified graceful-fs:
|
|
979
|
+
...__nccwpck_require__(845),
|
|
980
|
+
// Export extra methods:
|
|
981
|
+
...__nccwpck_require__(852),
|
|
982
|
+
...__nccwpck_require__(783),
|
|
983
|
+
...__nccwpck_require__(960),
|
|
984
|
+
...__nccwpck_require__(540),
|
|
985
|
+
...__nccwpck_require__(516),
|
|
986
|
+
...__nccwpck_require__(135),
|
|
987
|
+
...__nccwpck_require__(987),
|
|
988
|
+
...__nccwpck_require__(667),
|
|
989
|
+
...__nccwpck_require__(58)
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
|
|
993
|
+
/***/ }),
|
|
994
|
+
|
|
995
|
+
/***/ 540:
|
|
996
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
997
|
+
|
|
998
|
+
"use strict";
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
const u = (__nccwpck_require__(59).fromPromise)
|
|
1002
|
+
const jsonFile = __nccwpck_require__(869)
|
|
1003
|
+
|
|
1004
|
+
jsonFile.outputJson = u(__nccwpck_require__(201))
|
|
1005
|
+
jsonFile.outputJsonSync = __nccwpck_require__(709)
|
|
1006
|
+
// aliases
|
|
1007
|
+
jsonFile.outputJSON = jsonFile.outputJson
|
|
1008
|
+
jsonFile.outputJSONSync = jsonFile.outputJsonSync
|
|
1009
|
+
jsonFile.writeJSON = jsonFile.writeJson
|
|
1010
|
+
jsonFile.writeJSONSync = jsonFile.writeJsonSync
|
|
1011
|
+
jsonFile.readJSON = jsonFile.readJson
|
|
1012
|
+
jsonFile.readJSONSync = jsonFile.readJsonSync
|
|
1013
|
+
|
|
1014
|
+
module.exports = jsonFile
|
|
1015
|
+
|
|
1016
|
+
|
|
1017
|
+
/***/ }),
|
|
1018
|
+
|
|
1019
|
+
/***/ 869:
|
|
1020
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1021
|
+
|
|
1022
|
+
"use strict";
|
|
1023
|
+
|
|
1024
|
+
|
|
1025
|
+
const jsonFile = __nccwpck_require__(449)
|
|
1026
|
+
|
|
1027
|
+
module.exports = {
|
|
1028
|
+
// jsonfile exports
|
|
1029
|
+
readJson: jsonFile.readFile,
|
|
1030
|
+
readJsonSync: jsonFile.readFileSync,
|
|
1031
|
+
writeJson: jsonFile.writeFile,
|
|
1032
|
+
writeJsonSync: jsonFile.writeFileSync
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
|
|
1036
|
+
/***/ }),
|
|
1037
|
+
|
|
1038
|
+
/***/ 709:
|
|
1039
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1040
|
+
|
|
1041
|
+
"use strict";
|
|
1042
|
+
|
|
1043
|
+
|
|
1044
|
+
const { stringify } = __nccwpck_require__(213)
|
|
1045
|
+
const { outputFileSync } = __nccwpck_require__(987)
|
|
1046
|
+
|
|
1047
|
+
function outputJsonSync (file, data, options) {
|
|
1048
|
+
const str = stringify(data, options)
|
|
1049
|
+
|
|
1050
|
+
outputFileSync(file, str, options)
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
module.exports = outputJsonSync
|
|
1054
|
+
|
|
1055
|
+
|
|
1056
|
+
/***/ }),
|
|
1057
|
+
|
|
1058
|
+
/***/ 201:
|
|
1059
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1060
|
+
|
|
1061
|
+
"use strict";
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
const { stringify } = __nccwpck_require__(213)
|
|
1065
|
+
const { outputFile } = __nccwpck_require__(987)
|
|
1066
|
+
|
|
1067
|
+
async function outputJson (file, data, options = {}) {
|
|
1068
|
+
const str = stringify(data, options)
|
|
1069
|
+
|
|
1070
|
+
await outputFile(file, str, options)
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
module.exports = outputJson
|
|
1074
|
+
|
|
1075
|
+
|
|
1076
|
+
/***/ }),
|
|
1077
|
+
|
|
1078
|
+
/***/ 516:
|
|
1079
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1080
|
+
|
|
1081
|
+
"use strict";
|
|
1082
|
+
|
|
1083
|
+
const u = (__nccwpck_require__(59).fromPromise)
|
|
1084
|
+
const { makeDir: _makeDir, makeDirSync } = __nccwpck_require__(368)
|
|
1085
|
+
const makeDir = u(_makeDir)
|
|
1086
|
+
|
|
1087
|
+
module.exports = {
|
|
1088
|
+
mkdirs: makeDir,
|
|
1089
|
+
mkdirsSync: makeDirSync,
|
|
1090
|
+
// alias
|
|
1091
|
+
mkdirp: makeDir,
|
|
1092
|
+
mkdirpSync: makeDirSync,
|
|
1093
|
+
ensureDir: makeDir,
|
|
1094
|
+
ensureDirSync: makeDirSync
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
/***/ }),
|
|
1099
|
+
|
|
1100
|
+
/***/ 368:
|
|
1101
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1102
|
+
|
|
1103
|
+
"use strict";
|
|
1104
|
+
|
|
1105
|
+
const fs = __nccwpck_require__(845)
|
|
1106
|
+
const { checkPath } = __nccwpck_require__(676)
|
|
1107
|
+
|
|
1108
|
+
const getMode = options => {
|
|
1109
|
+
const defaults = { mode: 0o777 }
|
|
1110
|
+
if (typeof options === 'number') return options
|
|
1111
|
+
return ({ ...defaults, ...options }).mode
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
module.exports.makeDir = async (dir, options) => {
|
|
1115
|
+
checkPath(dir)
|
|
1116
|
+
|
|
1117
|
+
return fs.mkdir(dir, {
|
|
1118
|
+
mode: getMode(options),
|
|
1119
|
+
recursive: true
|
|
1120
|
+
})
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
module.exports.makeDirSync = (dir, options) => {
|
|
1124
|
+
checkPath(dir)
|
|
1125
|
+
|
|
1126
|
+
return fs.mkdirSync(dir, {
|
|
1127
|
+
mode: getMode(options),
|
|
1128
|
+
recursive: true
|
|
1129
|
+
})
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
|
|
1133
|
+
/***/ }),
|
|
1134
|
+
|
|
1135
|
+
/***/ 676:
|
|
1136
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1137
|
+
|
|
1138
|
+
"use strict";
|
|
1139
|
+
// Adapted from https://github.com/sindresorhus/make-dir
|
|
1140
|
+
// Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
1141
|
+
// 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:
|
|
1142
|
+
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
1143
|
+
// 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.
|
|
1144
|
+
|
|
1145
|
+
const path = __nccwpck_require__(17)
|
|
1146
|
+
|
|
1147
|
+
// https://github.com/nodejs/node/issues/8987
|
|
1148
|
+
// https://github.com/libuv/libuv/pull/1088
|
|
1149
|
+
module.exports.checkPath = function checkPath (pth) {
|
|
1150
|
+
if (process.platform === 'win32') {
|
|
1151
|
+
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ''))
|
|
1152
|
+
|
|
1153
|
+
if (pathHasInvalidWinCharacters) {
|
|
1154
|
+
const error = new Error(`Path contains invalid characters: ${pth}`)
|
|
1155
|
+
error.code = 'EINVAL'
|
|
1156
|
+
throw error
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
|
|
1162
|
+
/***/ }),
|
|
1163
|
+
|
|
1164
|
+
/***/ 135:
|
|
1165
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1166
|
+
|
|
1167
|
+
"use strict";
|
|
1168
|
+
|
|
1169
|
+
|
|
1170
|
+
const u = (__nccwpck_require__(59).fromPromise)
|
|
1171
|
+
module.exports = {
|
|
1172
|
+
move: u(__nccwpck_require__(497)),
|
|
1173
|
+
moveSync: __nccwpck_require__(801)
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
/***/ }),
|
|
1178
|
+
|
|
1179
|
+
/***/ 801:
|
|
1180
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1181
|
+
|
|
1182
|
+
"use strict";
|
|
1183
|
+
|
|
1184
|
+
|
|
1185
|
+
const fs = __nccwpck_require__(804)
|
|
1186
|
+
const path = __nccwpck_require__(17)
|
|
1187
|
+
const copySync = (__nccwpck_require__(852).copySync)
|
|
1188
|
+
const removeSync = (__nccwpck_require__(58).removeSync)
|
|
1189
|
+
const mkdirpSync = (__nccwpck_require__(516).mkdirpSync)
|
|
1190
|
+
const stat = __nccwpck_require__(826)
|
|
1191
|
+
|
|
1192
|
+
function moveSync (src, dest, opts) {
|
|
1193
|
+
opts = opts || {}
|
|
1194
|
+
const overwrite = opts.overwrite || opts.clobber || false
|
|
1195
|
+
|
|
1196
|
+
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, 'move', opts)
|
|
1197
|
+
stat.checkParentPathsSync(src, srcStat, dest, 'move')
|
|
1198
|
+
if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest))
|
|
1199
|
+
return doRename(src, dest, overwrite, isChangingCase)
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
function isParentRoot (dest) {
|
|
1203
|
+
const parent = path.dirname(dest)
|
|
1204
|
+
const parsedPath = path.parse(parent)
|
|
1205
|
+
return parsedPath.root === parent
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
function doRename (src, dest, overwrite, isChangingCase) {
|
|
1209
|
+
if (isChangingCase) return rename(src, dest, overwrite)
|
|
1210
|
+
if (overwrite) {
|
|
1211
|
+
removeSync(dest)
|
|
1212
|
+
return rename(src, dest, overwrite)
|
|
1213
|
+
}
|
|
1214
|
+
if (fs.existsSync(dest)) throw new Error('dest already exists.')
|
|
1215
|
+
return rename(src, dest, overwrite)
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
function rename (src, dest, overwrite) {
|
|
1219
|
+
try {
|
|
1220
|
+
fs.renameSync(src, dest)
|
|
1221
|
+
} catch (err) {
|
|
1222
|
+
if (err.code !== 'EXDEV') throw err
|
|
1223
|
+
return moveAcrossDevice(src, dest, overwrite)
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
function moveAcrossDevice (src, dest, overwrite) {
|
|
1228
|
+
const opts = {
|
|
1229
|
+
overwrite,
|
|
1230
|
+
errorOnExist: true,
|
|
1231
|
+
preserveTimestamps: true
|
|
1232
|
+
}
|
|
1233
|
+
copySync(src, dest, opts)
|
|
1234
|
+
return removeSync(src)
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
module.exports = moveSync
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
/***/ }),
|
|
1241
|
+
|
|
1242
|
+
/***/ 497:
|
|
1243
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1244
|
+
|
|
1245
|
+
"use strict";
|
|
1246
|
+
|
|
1247
|
+
|
|
1248
|
+
const fs = __nccwpck_require__(845)
|
|
1249
|
+
const path = __nccwpck_require__(17)
|
|
1250
|
+
const { copy } = __nccwpck_require__(852)
|
|
1251
|
+
const { remove } = __nccwpck_require__(58)
|
|
1252
|
+
const { mkdirp } = __nccwpck_require__(516)
|
|
1253
|
+
const { pathExists } = __nccwpck_require__(667)
|
|
1254
|
+
const stat = __nccwpck_require__(826)
|
|
1255
|
+
|
|
1256
|
+
async function move (src, dest, opts = {}) {
|
|
1257
|
+
const overwrite = opts.overwrite || opts.clobber || false
|
|
1258
|
+
|
|
1259
|
+
const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, 'move', opts)
|
|
1260
|
+
|
|
1261
|
+
await stat.checkParentPaths(src, srcStat, dest, 'move')
|
|
1262
|
+
|
|
1263
|
+
// If the parent of dest is not root, make sure it exists before proceeding
|
|
1264
|
+
const destParent = path.dirname(dest)
|
|
1265
|
+
const parsedParentPath = path.parse(destParent)
|
|
1266
|
+
if (parsedParentPath.root !== destParent) {
|
|
1267
|
+
await mkdirp(destParent)
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
return doRename(src, dest, overwrite, isChangingCase)
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
async function doRename (src, dest, overwrite, isChangingCase) {
|
|
1274
|
+
if (!isChangingCase) {
|
|
1275
|
+
if (overwrite) {
|
|
1276
|
+
await remove(dest)
|
|
1277
|
+
} else if (await pathExists(dest)) {
|
|
1278
|
+
throw new Error('dest already exists.')
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
try {
|
|
1283
|
+
// Try w/ rename first, and try copy + remove if EXDEV
|
|
1284
|
+
await fs.rename(src, dest)
|
|
1285
|
+
} catch (err) {
|
|
1286
|
+
if (err.code !== 'EXDEV') {
|
|
1287
|
+
throw err
|
|
1288
|
+
}
|
|
1289
|
+
await moveAcrossDevice(src, dest, overwrite)
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
async function moveAcrossDevice (src, dest, overwrite) {
|
|
1294
|
+
const opts = {
|
|
1295
|
+
overwrite,
|
|
1296
|
+
errorOnExist: true,
|
|
1297
|
+
preserveTimestamps: true
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
await copy(src, dest, opts)
|
|
1301
|
+
return remove(src)
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
module.exports = move
|
|
1305
|
+
|
|
1306
|
+
|
|
1307
|
+
/***/ }),
|
|
1308
|
+
|
|
1309
|
+
/***/ 987:
|
|
1310
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1311
|
+
|
|
1312
|
+
"use strict";
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
const u = (__nccwpck_require__(59).fromPromise)
|
|
1316
|
+
const fs = __nccwpck_require__(845)
|
|
1317
|
+
const path = __nccwpck_require__(17)
|
|
1318
|
+
const mkdir = __nccwpck_require__(516)
|
|
1319
|
+
const pathExists = (__nccwpck_require__(667).pathExists)
|
|
1320
|
+
|
|
1321
|
+
async function outputFile (file, data, encoding = 'utf-8') {
|
|
1322
|
+
const dir = path.dirname(file)
|
|
1323
|
+
|
|
1324
|
+
if (!(await pathExists(dir))) {
|
|
1325
|
+
await mkdir.mkdirs(dir)
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
return fs.writeFile(file, data, encoding)
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
function outputFileSync (file, ...args) {
|
|
1332
|
+
const dir = path.dirname(file)
|
|
1333
|
+
if (!fs.existsSync(dir)) {
|
|
1334
|
+
mkdir.mkdirsSync(dir)
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
fs.writeFileSync(file, ...args)
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
module.exports = {
|
|
1341
|
+
outputFile: u(outputFile),
|
|
1342
|
+
outputFileSync
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
|
|
1346
|
+
/***/ }),
|
|
1347
|
+
|
|
1348
|
+
/***/ 667:
|
|
1349
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1350
|
+
|
|
1351
|
+
"use strict";
|
|
1352
|
+
|
|
1353
|
+
const u = (__nccwpck_require__(59).fromPromise)
|
|
1354
|
+
const fs = __nccwpck_require__(845)
|
|
1355
|
+
|
|
1356
|
+
function pathExists (path) {
|
|
1357
|
+
return fs.access(path).then(() => true).catch(() => false)
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
module.exports = {
|
|
1361
|
+
pathExists: u(pathExists),
|
|
1362
|
+
pathExistsSync: fs.existsSync
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
/***/ }),
|
|
1367
|
+
|
|
1368
|
+
/***/ 58:
|
|
1369
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1370
|
+
|
|
1371
|
+
"use strict";
|
|
1372
|
+
|
|
1373
|
+
|
|
1374
|
+
const fs = __nccwpck_require__(804)
|
|
1375
|
+
const u = (__nccwpck_require__(59).fromCallback)
|
|
1376
|
+
|
|
1377
|
+
function remove (path, callback) {
|
|
1378
|
+
fs.rm(path, { recursive: true, force: true }, callback)
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
function removeSync (path) {
|
|
1382
|
+
fs.rmSync(path, { recursive: true, force: true })
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
module.exports = {
|
|
1386
|
+
remove: u(remove),
|
|
1387
|
+
removeSync
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
|
|
1391
|
+
/***/ }),
|
|
1392
|
+
|
|
1393
|
+
/***/ 826:
|
|
1394
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1395
|
+
|
|
1396
|
+
"use strict";
|
|
1397
|
+
|
|
1398
|
+
|
|
1399
|
+
const fs = __nccwpck_require__(845)
|
|
1400
|
+
const path = __nccwpck_require__(17)
|
|
1401
|
+
const u = (__nccwpck_require__(59).fromPromise)
|
|
1402
|
+
|
|
1403
|
+
function getStats (src, dest, opts) {
|
|
1404
|
+
const statFunc = opts.dereference
|
|
1405
|
+
? (file) => fs.stat(file, { bigint: true })
|
|
1406
|
+
: (file) => fs.lstat(file, { bigint: true })
|
|
1407
|
+
return Promise.all([
|
|
1408
|
+
statFunc(src),
|
|
1409
|
+
statFunc(dest).catch(err => {
|
|
1410
|
+
if (err.code === 'ENOENT') return null
|
|
1411
|
+
throw err
|
|
1412
|
+
})
|
|
1413
|
+
]).then(([srcStat, destStat]) => ({ srcStat, destStat }))
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
function getStatsSync (src, dest, opts) {
|
|
1417
|
+
let destStat
|
|
1418
|
+
const statFunc = opts.dereference
|
|
1419
|
+
? (file) => fs.statSync(file, { bigint: true })
|
|
1420
|
+
: (file) => fs.lstatSync(file, { bigint: true })
|
|
1421
|
+
const srcStat = statFunc(src)
|
|
1422
|
+
try {
|
|
1423
|
+
destStat = statFunc(dest)
|
|
1424
|
+
} catch (err) {
|
|
1425
|
+
if (err.code === 'ENOENT') return { srcStat, destStat: null }
|
|
1426
|
+
throw err
|
|
1427
|
+
}
|
|
1428
|
+
return { srcStat, destStat }
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
async function checkPaths (src, dest, funcName, opts) {
|
|
1432
|
+
const { srcStat, destStat } = await getStats(src, dest, opts)
|
|
1433
|
+
if (destStat) {
|
|
1434
|
+
if (areIdentical(srcStat, destStat)) {
|
|
1435
|
+
const srcBaseName = path.basename(src)
|
|
1436
|
+
const destBaseName = path.basename(dest)
|
|
1437
|
+
if (funcName === 'move' &&
|
|
1438
|
+
srcBaseName !== destBaseName &&
|
|
1439
|
+
srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
1440
|
+
return { srcStat, destStat, isChangingCase: true }
|
|
1441
|
+
}
|
|
1442
|
+
throw new Error('Source and destination must not be the same.')
|
|
1443
|
+
}
|
|
1444
|
+
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
1445
|
+
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)
|
|
1446
|
+
}
|
|
1447
|
+
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
1448
|
+
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
1453
|
+
throw new Error(errMsg(src, dest, funcName))
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
return { srcStat, destStat }
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
function checkPathsSync (src, dest, funcName, opts) {
|
|
1460
|
+
const { srcStat, destStat } = getStatsSync(src, dest, opts)
|
|
1461
|
+
|
|
1462
|
+
if (destStat) {
|
|
1463
|
+
if (areIdentical(srcStat, destStat)) {
|
|
1464
|
+
const srcBaseName = path.basename(src)
|
|
1465
|
+
const destBaseName = path.basename(dest)
|
|
1466
|
+
if (funcName === 'move' &&
|
|
1467
|
+
srcBaseName !== destBaseName &&
|
|
1468
|
+
srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
1469
|
+
return { srcStat, destStat, isChangingCase: true }
|
|
1470
|
+
}
|
|
1471
|
+
throw new Error('Source and destination must not be the same.')
|
|
1472
|
+
}
|
|
1473
|
+
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
1474
|
+
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)
|
|
1475
|
+
}
|
|
1476
|
+
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
1477
|
+
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
1482
|
+
throw new Error(errMsg(src, dest, funcName))
|
|
1483
|
+
}
|
|
1484
|
+
return { srcStat, destStat }
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
// recursively check if dest parent is a subdirectory of src.
|
|
1488
|
+
// It works for all file types including symlinks since it
|
|
1489
|
+
// checks the src and dest inodes. It starts from the deepest
|
|
1490
|
+
// parent and stops once it reaches the src parent or the root path.
|
|
1491
|
+
async function checkParentPaths (src, srcStat, dest, funcName) {
|
|
1492
|
+
const srcParent = path.resolve(path.dirname(src))
|
|
1493
|
+
const destParent = path.resolve(path.dirname(dest))
|
|
1494
|
+
if (destParent === srcParent || destParent === path.parse(destParent).root) return
|
|
1495
|
+
|
|
1496
|
+
let destStat
|
|
1497
|
+
try {
|
|
1498
|
+
destStat = await fs.stat(destParent, { bigint: true })
|
|
1499
|
+
} catch (err) {
|
|
1500
|
+
if (err.code === 'ENOENT') return
|
|
1501
|
+
throw err
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
if (areIdentical(srcStat, destStat)) {
|
|
1505
|
+
throw new Error(errMsg(src, dest, funcName))
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
return checkParentPaths(src, srcStat, destParent, funcName)
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
function checkParentPathsSync (src, srcStat, dest, funcName) {
|
|
1512
|
+
const srcParent = path.resolve(path.dirname(src))
|
|
1513
|
+
const destParent = path.resolve(path.dirname(dest))
|
|
1514
|
+
if (destParent === srcParent || destParent === path.parse(destParent).root) return
|
|
1515
|
+
let destStat
|
|
1516
|
+
try {
|
|
1517
|
+
destStat = fs.statSync(destParent, { bigint: true })
|
|
1518
|
+
} catch (err) {
|
|
1519
|
+
if (err.code === 'ENOENT') return
|
|
1520
|
+
throw err
|
|
1521
|
+
}
|
|
1522
|
+
if (areIdentical(srcStat, destStat)) {
|
|
1523
|
+
throw new Error(errMsg(src, dest, funcName))
|
|
1524
|
+
}
|
|
1525
|
+
return checkParentPathsSync(src, srcStat, destParent, funcName)
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
function areIdentical (srcStat, destStat) {
|
|
1529
|
+
return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
// return true if dest is a subdir of src, otherwise false.
|
|
1533
|
+
// It only checks the path strings.
|
|
1534
|
+
function isSrcSubdir (src, dest) {
|
|
1535
|
+
const srcArr = path.resolve(src).split(path.sep).filter(i => i)
|
|
1536
|
+
const destArr = path.resolve(dest).split(path.sep).filter(i => i)
|
|
1537
|
+
return srcArr.every((cur, i) => destArr[i] === cur)
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
function errMsg (src, dest, funcName) {
|
|
1541
|
+
return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
module.exports = {
|
|
1545
|
+
// checkPaths
|
|
1546
|
+
checkPaths: u(checkPaths),
|
|
1547
|
+
checkPathsSync,
|
|
1548
|
+
// checkParent
|
|
1549
|
+
checkParentPaths: u(checkParentPaths),
|
|
1550
|
+
checkParentPathsSync,
|
|
1551
|
+
// Misc
|
|
1552
|
+
isSrcSubdir,
|
|
1553
|
+
areIdentical
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
|
|
1557
|
+
/***/ }),
|
|
1558
|
+
|
|
1559
|
+
/***/ 227:
|
|
1560
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1561
|
+
|
|
1562
|
+
"use strict";
|
|
1563
|
+
|
|
1564
|
+
|
|
1565
|
+
const fs = __nccwpck_require__(845)
|
|
1566
|
+
const u = (__nccwpck_require__(59).fromPromise)
|
|
1567
|
+
|
|
1568
|
+
async function utimesMillis (path, atime, mtime) {
|
|
1569
|
+
// if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)
|
|
1570
|
+
const fd = await fs.open(path, 'r+')
|
|
1571
|
+
|
|
1572
|
+
let closeErr = null
|
|
1573
|
+
|
|
1574
|
+
try {
|
|
1575
|
+
await fs.futimes(fd, atime, mtime)
|
|
1576
|
+
} finally {
|
|
1577
|
+
try {
|
|
1578
|
+
await fs.close(fd)
|
|
1579
|
+
} catch (e) {
|
|
1580
|
+
closeErr = e
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
if (closeErr) {
|
|
1585
|
+
throw closeErr
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
function utimesMillisSync (path, atime, mtime) {
|
|
1590
|
+
const fd = fs.openSync(path, 'r+')
|
|
1591
|
+
fs.futimesSync(fd, atime, mtime)
|
|
1592
|
+
return fs.closeSync(fd)
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
module.exports = {
|
|
1596
|
+
utimesMillis: u(utimesMillis),
|
|
1597
|
+
utimesMillisSync
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
|
|
1601
|
+
/***/ }),
|
|
1602
|
+
|
|
1603
|
+
/***/ 691:
|
|
1604
|
+
/***/ ((module) => {
|
|
1605
|
+
|
|
1606
|
+
"use strict";
|
|
1607
|
+
|
|
1608
|
+
|
|
1609
|
+
module.exports = clone
|
|
1610
|
+
|
|
1611
|
+
var getPrototypeOf = Object.getPrototypeOf || function (obj) {
|
|
1612
|
+
return obj.__proto__
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
function clone (obj) {
|
|
1616
|
+
if (obj === null || typeof obj !== 'object')
|
|
1617
|
+
return obj
|
|
1618
|
+
|
|
1619
|
+
if (obj instanceof Object)
|
|
1620
|
+
var copy = { __proto__: getPrototypeOf(obj) }
|
|
1621
|
+
else
|
|
1622
|
+
var copy = Object.create(null)
|
|
1623
|
+
|
|
1624
|
+
Object.getOwnPropertyNames(obj).forEach(function (key) {
|
|
1625
|
+
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
|
|
1626
|
+
})
|
|
1627
|
+
|
|
1628
|
+
return copy
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
|
|
1632
|
+
/***/ }),
|
|
1633
|
+
|
|
1634
|
+
/***/ 804:
|
|
1635
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1636
|
+
|
|
1637
|
+
var fs = __nccwpck_require__(147)
|
|
1638
|
+
var polyfills = __nccwpck_require__(567)
|
|
1639
|
+
var legacy = __nccwpck_require__(915)
|
|
1640
|
+
var clone = __nccwpck_require__(691)
|
|
1641
|
+
|
|
1642
|
+
var util = __nccwpck_require__(837)
|
|
1643
|
+
|
|
1644
|
+
/* istanbul ignore next - node 0.x polyfill */
|
|
1645
|
+
var gracefulQueue
|
|
1646
|
+
var previousSymbol
|
|
1647
|
+
|
|
1648
|
+
/* istanbul ignore else - node 0.x polyfill */
|
|
1649
|
+
if (typeof Symbol === 'function' && typeof Symbol.for === 'function') {
|
|
1650
|
+
gracefulQueue = Symbol.for('graceful-fs.queue')
|
|
1651
|
+
// This is used in testing by future versions
|
|
1652
|
+
previousSymbol = Symbol.for('graceful-fs.previous')
|
|
1653
|
+
} else {
|
|
1654
|
+
gracefulQueue = '___graceful-fs.queue'
|
|
1655
|
+
previousSymbol = '___graceful-fs.previous'
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
function noop () {}
|
|
1659
|
+
|
|
1660
|
+
function publishQueue(context, queue) {
|
|
1661
|
+
Object.defineProperty(context, gracefulQueue, {
|
|
1662
|
+
get: function() {
|
|
1663
|
+
return queue
|
|
1664
|
+
}
|
|
1665
|
+
})
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
var debug = noop
|
|
1669
|
+
if (util.debuglog)
|
|
1670
|
+
debug = util.debuglog('gfs4')
|
|
1671
|
+
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
|
|
1672
|
+
debug = function() {
|
|
1673
|
+
var m = util.format.apply(util, arguments)
|
|
1674
|
+
m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ')
|
|
1675
|
+
console.error(m)
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
// Once time initialization
|
|
1679
|
+
if (!fs[gracefulQueue]) {
|
|
1680
|
+
// This queue can be shared by multiple loaded instances
|
|
1681
|
+
var queue = global[gracefulQueue] || []
|
|
1682
|
+
publishQueue(fs, queue)
|
|
1683
|
+
|
|
1684
|
+
// Patch fs.close/closeSync to shared queue version, because we need
|
|
1685
|
+
// to retry() whenever a close happens *anywhere* in the program.
|
|
1686
|
+
// This is essential when multiple graceful-fs instances are
|
|
1687
|
+
// in play at the same time.
|
|
1688
|
+
fs.close = (function (fs$close) {
|
|
1689
|
+
function close (fd, cb) {
|
|
1690
|
+
return fs$close.call(fs, fd, function (err) {
|
|
1691
|
+
// This function uses the graceful-fs shared queue
|
|
1692
|
+
if (!err) {
|
|
1693
|
+
resetQueue()
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
if (typeof cb === 'function')
|
|
1697
|
+
cb.apply(this, arguments)
|
|
1698
|
+
})
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
Object.defineProperty(close, previousSymbol, {
|
|
1702
|
+
value: fs$close
|
|
1703
|
+
})
|
|
1704
|
+
return close
|
|
1705
|
+
})(fs.close)
|
|
1706
|
+
|
|
1707
|
+
fs.closeSync = (function (fs$closeSync) {
|
|
1708
|
+
function closeSync (fd) {
|
|
1709
|
+
// This function uses the graceful-fs shared queue
|
|
1710
|
+
fs$closeSync.apply(fs, arguments)
|
|
1711
|
+
resetQueue()
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
Object.defineProperty(closeSync, previousSymbol, {
|
|
1715
|
+
value: fs$closeSync
|
|
1716
|
+
})
|
|
1717
|
+
return closeSync
|
|
1718
|
+
})(fs.closeSync)
|
|
1719
|
+
|
|
1720
|
+
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
|
|
1721
|
+
process.on('exit', function() {
|
|
1722
|
+
debug(fs[gracefulQueue])
|
|
1723
|
+
__nccwpck_require__(491).equal(fs[gracefulQueue].length, 0)
|
|
1724
|
+
})
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
if (!global[gracefulQueue]) {
|
|
1729
|
+
publishQueue(global, fs[gracefulQueue]);
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
module.exports = patch(clone(fs))
|
|
1733
|
+
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
|
|
1734
|
+
module.exports = patch(fs)
|
|
1735
|
+
fs.__patched = true;
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
function patch (fs) {
|
|
1739
|
+
// Everything that references the open() function needs to be in here
|
|
1740
|
+
polyfills(fs)
|
|
1741
|
+
fs.gracefulify = patch
|
|
1742
|
+
|
|
1743
|
+
fs.createReadStream = createReadStream
|
|
1744
|
+
fs.createWriteStream = createWriteStream
|
|
1745
|
+
var fs$readFile = fs.readFile
|
|
1746
|
+
fs.readFile = readFile
|
|
1747
|
+
function readFile (path, options, cb) {
|
|
1748
|
+
if (typeof options === 'function')
|
|
1749
|
+
cb = options, options = null
|
|
1750
|
+
|
|
1751
|
+
return go$readFile(path, options, cb)
|
|
1752
|
+
|
|
1753
|
+
function go$readFile (path, options, cb, startTime) {
|
|
1754
|
+
return fs$readFile(path, options, function (err) {
|
|
1755
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
1756
|
+
enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()])
|
|
1757
|
+
else {
|
|
1758
|
+
if (typeof cb === 'function')
|
|
1759
|
+
cb.apply(this, arguments)
|
|
1760
|
+
}
|
|
1761
|
+
})
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
var fs$writeFile = fs.writeFile
|
|
1766
|
+
fs.writeFile = writeFile
|
|
1767
|
+
function writeFile (path, data, options, cb) {
|
|
1768
|
+
if (typeof options === 'function')
|
|
1769
|
+
cb = options, options = null
|
|
1770
|
+
|
|
1771
|
+
return go$writeFile(path, data, options, cb)
|
|
1772
|
+
|
|
1773
|
+
function go$writeFile (path, data, options, cb, startTime) {
|
|
1774
|
+
return fs$writeFile(path, data, options, function (err) {
|
|
1775
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
1776
|
+
enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()])
|
|
1777
|
+
else {
|
|
1778
|
+
if (typeof cb === 'function')
|
|
1779
|
+
cb.apply(this, arguments)
|
|
1780
|
+
}
|
|
1781
|
+
})
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
var fs$appendFile = fs.appendFile
|
|
1786
|
+
if (fs$appendFile)
|
|
1787
|
+
fs.appendFile = appendFile
|
|
1788
|
+
function appendFile (path, data, options, cb) {
|
|
1789
|
+
if (typeof options === 'function')
|
|
1790
|
+
cb = options, options = null
|
|
1791
|
+
|
|
1792
|
+
return go$appendFile(path, data, options, cb)
|
|
1793
|
+
|
|
1794
|
+
function go$appendFile (path, data, options, cb, startTime) {
|
|
1795
|
+
return fs$appendFile(path, data, options, function (err) {
|
|
1796
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
1797
|
+
enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()])
|
|
1798
|
+
else {
|
|
1799
|
+
if (typeof cb === 'function')
|
|
1800
|
+
cb.apply(this, arguments)
|
|
1801
|
+
}
|
|
1802
|
+
})
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
var fs$copyFile = fs.copyFile
|
|
1807
|
+
if (fs$copyFile)
|
|
1808
|
+
fs.copyFile = copyFile
|
|
1809
|
+
function copyFile (src, dest, flags, cb) {
|
|
1810
|
+
if (typeof flags === 'function') {
|
|
1811
|
+
cb = flags
|
|
1812
|
+
flags = 0
|
|
1813
|
+
}
|
|
1814
|
+
return go$copyFile(src, dest, flags, cb)
|
|
1815
|
+
|
|
1816
|
+
function go$copyFile (src, dest, flags, cb, startTime) {
|
|
1817
|
+
return fs$copyFile(src, dest, flags, function (err) {
|
|
1818
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
1819
|
+
enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()])
|
|
1820
|
+
else {
|
|
1821
|
+
if (typeof cb === 'function')
|
|
1822
|
+
cb.apply(this, arguments)
|
|
1823
|
+
}
|
|
1824
|
+
})
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
var fs$readdir = fs.readdir
|
|
1829
|
+
fs.readdir = readdir
|
|
1830
|
+
var noReaddirOptionVersions = /^v[0-5]\./
|
|
1831
|
+
function readdir (path, options, cb) {
|
|
1832
|
+
if (typeof options === 'function')
|
|
1833
|
+
cb = options, options = null
|
|
1834
|
+
|
|
1835
|
+
var go$readdir = noReaddirOptionVersions.test(process.version)
|
|
1836
|
+
? function go$readdir (path, options, cb, startTime) {
|
|
1837
|
+
return fs$readdir(path, fs$readdirCallback(
|
|
1838
|
+
path, options, cb, startTime
|
|
1839
|
+
))
|
|
1840
|
+
}
|
|
1841
|
+
: function go$readdir (path, options, cb, startTime) {
|
|
1842
|
+
return fs$readdir(path, options, fs$readdirCallback(
|
|
1843
|
+
path, options, cb, startTime
|
|
1844
|
+
))
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
return go$readdir(path, options, cb)
|
|
1848
|
+
|
|
1849
|
+
function fs$readdirCallback (path, options, cb, startTime) {
|
|
1850
|
+
return function (err, files) {
|
|
1851
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
1852
|
+
enqueue([
|
|
1853
|
+
go$readdir,
|
|
1854
|
+
[path, options, cb],
|
|
1855
|
+
err,
|
|
1856
|
+
startTime || Date.now(),
|
|
1857
|
+
Date.now()
|
|
1858
|
+
])
|
|
1859
|
+
else {
|
|
1860
|
+
if (files && files.sort)
|
|
1861
|
+
files.sort()
|
|
1862
|
+
|
|
1863
|
+
if (typeof cb === 'function')
|
|
1864
|
+
cb.call(this, err, files)
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
if (process.version.substr(0, 4) === 'v0.8') {
|
|
1871
|
+
var legStreams = legacy(fs)
|
|
1872
|
+
ReadStream = legStreams.ReadStream
|
|
1873
|
+
WriteStream = legStreams.WriteStream
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
var fs$ReadStream = fs.ReadStream
|
|
1877
|
+
if (fs$ReadStream) {
|
|
1878
|
+
ReadStream.prototype = Object.create(fs$ReadStream.prototype)
|
|
1879
|
+
ReadStream.prototype.open = ReadStream$open
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
var fs$WriteStream = fs.WriteStream
|
|
1883
|
+
if (fs$WriteStream) {
|
|
1884
|
+
WriteStream.prototype = Object.create(fs$WriteStream.prototype)
|
|
1885
|
+
WriteStream.prototype.open = WriteStream$open
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
Object.defineProperty(fs, 'ReadStream', {
|
|
1889
|
+
get: function () {
|
|
1890
|
+
return ReadStream
|
|
1891
|
+
},
|
|
1892
|
+
set: function (val) {
|
|
1893
|
+
ReadStream = val
|
|
1894
|
+
},
|
|
1895
|
+
enumerable: true,
|
|
1896
|
+
configurable: true
|
|
1897
|
+
})
|
|
1898
|
+
Object.defineProperty(fs, 'WriteStream', {
|
|
1899
|
+
get: function () {
|
|
1900
|
+
return WriteStream
|
|
1901
|
+
},
|
|
1902
|
+
set: function (val) {
|
|
1903
|
+
WriteStream = val
|
|
1904
|
+
},
|
|
1905
|
+
enumerable: true,
|
|
1906
|
+
configurable: true
|
|
1907
|
+
})
|
|
1908
|
+
|
|
1909
|
+
// legacy names
|
|
1910
|
+
var FileReadStream = ReadStream
|
|
1911
|
+
Object.defineProperty(fs, 'FileReadStream', {
|
|
1912
|
+
get: function () {
|
|
1913
|
+
return FileReadStream
|
|
1914
|
+
},
|
|
1915
|
+
set: function (val) {
|
|
1916
|
+
FileReadStream = val
|
|
1917
|
+
},
|
|
1918
|
+
enumerable: true,
|
|
1919
|
+
configurable: true
|
|
1920
|
+
})
|
|
1921
|
+
var FileWriteStream = WriteStream
|
|
1922
|
+
Object.defineProperty(fs, 'FileWriteStream', {
|
|
1923
|
+
get: function () {
|
|
1924
|
+
return FileWriteStream
|
|
1925
|
+
},
|
|
1926
|
+
set: function (val) {
|
|
1927
|
+
FileWriteStream = val
|
|
1928
|
+
},
|
|
1929
|
+
enumerable: true,
|
|
1930
|
+
configurable: true
|
|
1931
|
+
})
|
|
1932
|
+
|
|
1933
|
+
function ReadStream (path, options) {
|
|
1934
|
+
if (this instanceof ReadStream)
|
|
1935
|
+
return fs$ReadStream.apply(this, arguments), this
|
|
1936
|
+
else
|
|
1937
|
+
return ReadStream.apply(Object.create(ReadStream.prototype), arguments)
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
function ReadStream$open () {
|
|
1941
|
+
var that = this
|
|
1942
|
+
open(that.path, that.flags, that.mode, function (err, fd) {
|
|
1943
|
+
if (err) {
|
|
1944
|
+
if (that.autoClose)
|
|
1945
|
+
that.destroy()
|
|
1946
|
+
|
|
1947
|
+
that.emit('error', err)
|
|
1948
|
+
} else {
|
|
1949
|
+
that.fd = fd
|
|
1950
|
+
that.emit('open', fd)
|
|
1951
|
+
that.read()
|
|
1952
|
+
}
|
|
1953
|
+
})
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
function WriteStream (path, options) {
|
|
1957
|
+
if (this instanceof WriteStream)
|
|
1958
|
+
return fs$WriteStream.apply(this, arguments), this
|
|
1959
|
+
else
|
|
1960
|
+
return WriteStream.apply(Object.create(WriteStream.prototype), arguments)
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
function WriteStream$open () {
|
|
1964
|
+
var that = this
|
|
1965
|
+
open(that.path, that.flags, that.mode, function (err, fd) {
|
|
1966
|
+
if (err) {
|
|
1967
|
+
that.destroy()
|
|
1968
|
+
that.emit('error', err)
|
|
1969
|
+
} else {
|
|
1970
|
+
that.fd = fd
|
|
1971
|
+
that.emit('open', fd)
|
|
1972
|
+
}
|
|
1973
|
+
})
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
function createReadStream (path, options) {
|
|
1977
|
+
return new fs.ReadStream(path, options)
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
function createWriteStream (path, options) {
|
|
1981
|
+
return new fs.WriteStream(path, options)
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
var fs$open = fs.open
|
|
1985
|
+
fs.open = open
|
|
1986
|
+
function open (path, flags, mode, cb) {
|
|
1987
|
+
if (typeof mode === 'function')
|
|
1988
|
+
cb = mode, mode = null
|
|
1989
|
+
|
|
1990
|
+
return go$open(path, flags, mode, cb)
|
|
1991
|
+
|
|
1992
|
+
function go$open (path, flags, mode, cb, startTime) {
|
|
1993
|
+
return fs$open(path, flags, mode, function (err, fd) {
|
|
1994
|
+
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
|
|
1995
|
+
enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()])
|
|
1996
|
+
else {
|
|
1997
|
+
if (typeof cb === 'function')
|
|
1998
|
+
cb.apply(this, arguments)
|
|
1999
|
+
}
|
|
2000
|
+
})
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
return fs
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
function enqueue (elem) {
|
|
2008
|
+
debug('ENQUEUE', elem[0].name, elem[1])
|
|
2009
|
+
fs[gracefulQueue].push(elem)
|
|
2010
|
+
retry()
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
// keep track of the timeout between retry() calls
|
|
2014
|
+
var retryTimer
|
|
2015
|
+
|
|
2016
|
+
// reset the startTime and lastTime to now
|
|
2017
|
+
// this resets the start of the 60 second overall timeout as well as the
|
|
2018
|
+
// delay between attempts so that we'll retry these jobs sooner
|
|
2019
|
+
function resetQueue () {
|
|
2020
|
+
var now = Date.now()
|
|
2021
|
+
for (var i = 0; i < fs[gracefulQueue].length; ++i) {
|
|
2022
|
+
// entries that are only a length of 2 are from an older version, don't
|
|
2023
|
+
// bother modifying those since they'll be retried anyway.
|
|
2024
|
+
if (fs[gracefulQueue][i].length > 2) {
|
|
2025
|
+
fs[gracefulQueue][i][3] = now // startTime
|
|
2026
|
+
fs[gracefulQueue][i][4] = now // lastTime
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
// call retry to make sure we're actively processing the queue
|
|
2030
|
+
retry()
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
function retry () {
|
|
2034
|
+
// clear the timer and remove it to help prevent unintended concurrency
|
|
2035
|
+
clearTimeout(retryTimer)
|
|
2036
|
+
retryTimer = undefined
|
|
2037
|
+
|
|
2038
|
+
if (fs[gracefulQueue].length === 0)
|
|
2039
|
+
return
|
|
2040
|
+
|
|
2041
|
+
var elem = fs[gracefulQueue].shift()
|
|
2042
|
+
var fn = elem[0]
|
|
2043
|
+
var args = elem[1]
|
|
2044
|
+
// these items may be unset if they were added by an older graceful-fs
|
|
2045
|
+
var err = elem[2]
|
|
2046
|
+
var startTime = elem[3]
|
|
2047
|
+
var lastTime = elem[4]
|
|
2048
|
+
|
|
2049
|
+
// if we don't have a startTime we have no way of knowing if we've waited
|
|
2050
|
+
// long enough, so go ahead and retry this item now
|
|
2051
|
+
if (startTime === undefined) {
|
|
2052
|
+
debug('RETRY', fn.name, args)
|
|
2053
|
+
fn.apply(null, args)
|
|
2054
|
+
} else if (Date.now() - startTime >= 60000) {
|
|
2055
|
+
// it's been more than 60 seconds total, bail now
|
|
2056
|
+
debug('TIMEOUT', fn.name, args)
|
|
2057
|
+
var cb = args.pop()
|
|
2058
|
+
if (typeof cb === 'function')
|
|
2059
|
+
cb.call(null, err)
|
|
2060
|
+
} else {
|
|
2061
|
+
// the amount of time between the last attempt and right now
|
|
2062
|
+
var sinceAttempt = Date.now() - lastTime
|
|
2063
|
+
// the amount of time between when we first tried, and when we last tried
|
|
2064
|
+
// rounded up to at least 1
|
|
2065
|
+
var sinceStart = Math.max(lastTime - startTime, 1)
|
|
2066
|
+
// backoff. wait longer than the total time we've been retrying, but only
|
|
2067
|
+
// up to a maximum of 100ms
|
|
2068
|
+
var desiredDelay = Math.min(sinceStart * 1.2, 100)
|
|
2069
|
+
// it's been long enough since the last retry, do it again
|
|
2070
|
+
if (sinceAttempt >= desiredDelay) {
|
|
2071
|
+
debug('RETRY', fn.name, args)
|
|
2072
|
+
fn.apply(null, args.concat([startTime]))
|
|
2073
|
+
} else {
|
|
2074
|
+
// if we can't do this job yet, push it to the end of the queue
|
|
2075
|
+
// and let the next iteration check again
|
|
2076
|
+
fs[gracefulQueue].push(elem)
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
// schedule our next run if one isn't already scheduled
|
|
2081
|
+
if (retryTimer === undefined) {
|
|
2082
|
+
retryTimer = setTimeout(retry, 0)
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
|
|
2087
|
+
/***/ }),
|
|
2088
|
+
|
|
2089
|
+
/***/ 915:
|
|
2090
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
2091
|
+
|
|
2092
|
+
var Stream = (__nccwpck_require__(781).Stream)
|
|
2093
|
+
|
|
2094
|
+
module.exports = legacy
|
|
2095
|
+
|
|
2096
|
+
function legacy (fs) {
|
|
2097
|
+
return {
|
|
2098
|
+
ReadStream: ReadStream,
|
|
2099
|
+
WriteStream: WriteStream
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
function ReadStream (path, options) {
|
|
2103
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path, options);
|
|
2104
|
+
|
|
2105
|
+
Stream.call(this);
|
|
2106
|
+
|
|
2107
|
+
var self = this;
|
|
2108
|
+
|
|
2109
|
+
this.path = path;
|
|
2110
|
+
this.fd = null;
|
|
2111
|
+
this.readable = true;
|
|
2112
|
+
this.paused = false;
|
|
2113
|
+
|
|
2114
|
+
this.flags = 'r';
|
|
2115
|
+
this.mode = 438; /*=0666*/
|
|
2116
|
+
this.bufferSize = 64 * 1024;
|
|
2117
|
+
|
|
2118
|
+
options = options || {};
|
|
2119
|
+
|
|
2120
|
+
// Mixin options into this
|
|
2121
|
+
var keys = Object.keys(options);
|
|
2122
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
2123
|
+
var key = keys[index];
|
|
2124
|
+
this[key] = options[key];
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
if (this.encoding) this.setEncoding(this.encoding);
|
|
2128
|
+
|
|
2129
|
+
if (this.start !== undefined) {
|
|
2130
|
+
if ('number' !== typeof this.start) {
|
|
2131
|
+
throw TypeError('start must be a Number');
|
|
2132
|
+
}
|
|
2133
|
+
if (this.end === undefined) {
|
|
2134
|
+
this.end = Infinity;
|
|
2135
|
+
} else if ('number' !== typeof this.end) {
|
|
2136
|
+
throw TypeError('end must be a Number');
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
if (this.start > this.end) {
|
|
2140
|
+
throw new Error('start must be <= end');
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
this.pos = this.start;
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
if (this.fd !== null) {
|
|
2147
|
+
process.nextTick(function() {
|
|
2148
|
+
self._read();
|
|
2149
|
+
});
|
|
2150
|
+
return;
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2153
|
+
fs.open(this.path, this.flags, this.mode, function (err, fd) {
|
|
2154
|
+
if (err) {
|
|
2155
|
+
self.emit('error', err);
|
|
2156
|
+
self.readable = false;
|
|
2157
|
+
return;
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
self.fd = fd;
|
|
2161
|
+
self.emit('open', fd);
|
|
2162
|
+
self._read();
|
|
2163
|
+
})
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
function WriteStream (path, options) {
|
|
2167
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path, options);
|
|
2168
|
+
|
|
2169
|
+
Stream.call(this);
|
|
2170
|
+
|
|
2171
|
+
this.path = path;
|
|
2172
|
+
this.fd = null;
|
|
2173
|
+
this.writable = true;
|
|
2174
|
+
|
|
2175
|
+
this.flags = 'w';
|
|
2176
|
+
this.encoding = 'binary';
|
|
2177
|
+
this.mode = 438; /*=0666*/
|
|
2178
|
+
this.bytesWritten = 0;
|
|
2179
|
+
|
|
2180
|
+
options = options || {};
|
|
2181
|
+
|
|
2182
|
+
// Mixin options into this
|
|
2183
|
+
var keys = Object.keys(options);
|
|
2184
|
+
for (var index = 0, length = keys.length; index < length; index++) {
|
|
2185
|
+
var key = keys[index];
|
|
2186
|
+
this[key] = options[key];
|
|
2187
|
+
}
|
|
2188
|
+
|
|
2189
|
+
if (this.start !== undefined) {
|
|
2190
|
+
if ('number' !== typeof this.start) {
|
|
2191
|
+
throw TypeError('start must be a Number');
|
|
2192
|
+
}
|
|
2193
|
+
if (this.start < 0) {
|
|
2194
|
+
throw new Error('start must be >= zero');
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
this.pos = this.start;
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
this.busy = false;
|
|
2201
|
+
this._queue = [];
|
|
2202
|
+
|
|
2203
|
+
if (this.fd === null) {
|
|
2204
|
+
this._open = fs.open;
|
|
2205
|
+
this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
|
|
2206
|
+
this.flush();
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
|
|
2211
|
+
|
|
2212
|
+
/***/ }),
|
|
2213
|
+
|
|
2214
|
+
/***/ 567:
|
|
2215
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
2216
|
+
|
|
2217
|
+
var constants = __nccwpck_require__(57)
|
|
2218
|
+
|
|
2219
|
+
var origCwd = process.cwd
|
|
2220
|
+
var cwd = null
|
|
2221
|
+
|
|
2222
|
+
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform
|
|
2223
|
+
|
|
2224
|
+
process.cwd = function() {
|
|
2225
|
+
if (!cwd)
|
|
2226
|
+
cwd = origCwd.call(process)
|
|
2227
|
+
return cwd
|
|
2228
|
+
}
|
|
2229
|
+
try {
|
|
2230
|
+
process.cwd()
|
|
2231
|
+
} catch (er) {}
|
|
2232
|
+
|
|
2233
|
+
// This check is needed until node.js 12 is required
|
|
2234
|
+
if (typeof process.chdir === 'function') {
|
|
2235
|
+
var chdir = process.chdir
|
|
2236
|
+
process.chdir = function (d) {
|
|
2237
|
+
cwd = null
|
|
2238
|
+
chdir.call(process, d)
|
|
2239
|
+
}
|
|
2240
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir)
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2243
|
+
module.exports = patch
|
|
2244
|
+
|
|
2245
|
+
function patch (fs) {
|
|
2246
|
+
// (re-)implement some things that are known busted or missing.
|
|
2247
|
+
|
|
2248
|
+
// lchmod, broken prior to 0.6.2
|
|
2249
|
+
// back-port the fix here.
|
|
2250
|
+
if (constants.hasOwnProperty('O_SYMLINK') &&
|
|
2251
|
+
process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
2252
|
+
patchLchmod(fs)
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
// lutimes implementation, or no-op
|
|
2256
|
+
if (!fs.lutimes) {
|
|
2257
|
+
patchLutimes(fs)
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
// https://github.com/isaacs/node-graceful-fs/issues/4
|
|
2261
|
+
// Chown should not fail on einval or eperm if non-root.
|
|
2262
|
+
// It should not fail on enosys ever, as this just indicates
|
|
2263
|
+
// that a fs doesn't support the intended operation.
|
|
2264
|
+
|
|
2265
|
+
fs.chown = chownFix(fs.chown)
|
|
2266
|
+
fs.fchown = chownFix(fs.fchown)
|
|
2267
|
+
fs.lchown = chownFix(fs.lchown)
|
|
2268
|
+
|
|
2269
|
+
fs.chmod = chmodFix(fs.chmod)
|
|
2270
|
+
fs.fchmod = chmodFix(fs.fchmod)
|
|
2271
|
+
fs.lchmod = chmodFix(fs.lchmod)
|
|
2272
|
+
|
|
2273
|
+
fs.chownSync = chownFixSync(fs.chownSync)
|
|
2274
|
+
fs.fchownSync = chownFixSync(fs.fchownSync)
|
|
2275
|
+
fs.lchownSync = chownFixSync(fs.lchownSync)
|
|
2276
|
+
|
|
2277
|
+
fs.chmodSync = chmodFixSync(fs.chmodSync)
|
|
2278
|
+
fs.fchmodSync = chmodFixSync(fs.fchmodSync)
|
|
2279
|
+
fs.lchmodSync = chmodFixSync(fs.lchmodSync)
|
|
2280
|
+
|
|
2281
|
+
fs.stat = statFix(fs.stat)
|
|
2282
|
+
fs.fstat = statFix(fs.fstat)
|
|
2283
|
+
fs.lstat = statFix(fs.lstat)
|
|
2284
|
+
|
|
2285
|
+
fs.statSync = statFixSync(fs.statSync)
|
|
2286
|
+
fs.fstatSync = statFixSync(fs.fstatSync)
|
|
2287
|
+
fs.lstatSync = statFixSync(fs.lstatSync)
|
|
2288
|
+
|
|
2289
|
+
// if lchmod/lchown do not exist, then make them no-ops
|
|
2290
|
+
if (fs.chmod && !fs.lchmod) {
|
|
2291
|
+
fs.lchmod = function (path, mode, cb) {
|
|
2292
|
+
if (cb) process.nextTick(cb)
|
|
2293
|
+
}
|
|
2294
|
+
fs.lchmodSync = function () {}
|
|
2295
|
+
}
|
|
2296
|
+
if (fs.chown && !fs.lchown) {
|
|
2297
|
+
fs.lchown = function (path, uid, gid, cb) {
|
|
2298
|
+
if (cb) process.nextTick(cb)
|
|
2299
|
+
}
|
|
2300
|
+
fs.lchownSync = function () {}
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
// on Windows, A/V software can lock the directory, causing this
|
|
2304
|
+
// to fail with an EACCES or EPERM if the directory contains newly
|
|
2305
|
+
// created files. Try again on failure, for up to 60 seconds.
|
|
2306
|
+
|
|
2307
|
+
// Set the timeout this long because some Windows Anti-Virus, such as Parity
|
|
2308
|
+
// bit9, may lock files for up to a minute, causing npm package install
|
|
2309
|
+
// failures. Also, take care to yield the scheduler. Windows scheduling gives
|
|
2310
|
+
// CPU to a busy looping process, which can cause the program causing the lock
|
|
2311
|
+
// contention to be starved of CPU by node, so the contention doesn't resolve.
|
|
2312
|
+
if (platform === "win32") {
|
|
2313
|
+
fs.rename = typeof fs.rename !== 'function' ? fs.rename
|
|
2314
|
+
: (function (fs$rename) {
|
|
2315
|
+
function rename (from, to, cb) {
|
|
2316
|
+
var start = Date.now()
|
|
2317
|
+
var backoff = 0;
|
|
2318
|
+
fs$rename(from, to, function CB (er) {
|
|
2319
|
+
if (er
|
|
2320
|
+
&& (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY")
|
|
2321
|
+
&& Date.now() - start < 60000) {
|
|
2322
|
+
setTimeout(function() {
|
|
2323
|
+
fs.stat(to, function (stater, st) {
|
|
2324
|
+
if (stater && stater.code === "ENOENT")
|
|
2325
|
+
fs$rename(from, to, CB);
|
|
2326
|
+
else
|
|
2327
|
+
cb(er)
|
|
2328
|
+
})
|
|
2329
|
+
}, backoff)
|
|
2330
|
+
if (backoff < 100)
|
|
2331
|
+
backoff += 10;
|
|
2332
|
+
return;
|
|
2333
|
+
}
|
|
2334
|
+
if (cb) cb(er)
|
|
2335
|
+
})
|
|
2336
|
+
}
|
|
2337
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename)
|
|
2338
|
+
return rename
|
|
2339
|
+
})(fs.rename)
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2342
|
+
// if read() returns EAGAIN, then just try it again.
|
|
2343
|
+
fs.read = typeof fs.read !== 'function' ? fs.read
|
|
2344
|
+
: (function (fs$read) {
|
|
2345
|
+
function read (fd, buffer, offset, length, position, callback_) {
|
|
2346
|
+
var callback
|
|
2347
|
+
if (callback_ && typeof callback_ === 'function') {
|
|
2348
|
+
var eagCounter = 0
|
|
2349
|
+
callback = function (er, _, __) {
|
|
2350
|
+
if (er && er.code === 'EAGAIN' && eagCounter < 10) {
|
|
2351
|
+
eagCounter ++
|
|
2352
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
|
|
2353
|
+
}
|
|
2354
|
+
callback_.apply(this, arguments)
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
// This ensures `util.promisify` works as it does for native `fs.read`.
|
|
2361
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read)
|
|
2362
|
+
return read
|
|
2363
|
+
})(fs.read)
|
|
2364
|
+
|
|
2365
|
+
fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync
|
|
2366
|
+
: (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
|
|
2367
|
+
var eagCounter = 0
|
|
2368
|
+
while (true) {
|
|
2369
|
+
try {
|
|
2370
|
+
return fs$readSync.call(fs, fd, buffer, offset, length, position)
|
|
2371
|
+
} catch (er) {
|
|
2372
|
+
if (er.code === 'EAGAIN' && eagCounter < 10) {
|
|
2373
|
+
eagCounter ++
|
|
2374
|
+
continue
|
|
2375
|
+
}
|
|
2376
|
+
throw er
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
}})(fs.readSync)
|
|
2380
|
+
|
|
2381
|
+
function patchLchmod (fs) {
|
|
2382
|
+
fs.lchmod = function (path, mode, callback) {
|
|
2383
|
+
fs.open( path
|
|
2384
|
+
, constants.O_WRONLY | constants.O_SYMLINK
|
|
2385
|
+
, mode
|
|
2386
|
+
, function (err, fd) {
|
|
2387
|
+
if (err) {
|
|
2388
|
+
if (callback) callback(err)
|
|
2389
|
+
return
|
|
2390
|
+
}
|
|
2391
|
+
// prefer to return the chmod error, if one occurs,
|
|
2392
|
+
// but still try to close, and report closing errors if they occur.
|
|
2393
|
+
fs.fchmod(fd, mode, function (err) {
|
|
2394
|
+
fs.close(fd, function(err2) {
|
|
2395
|
+
if (callback) callback(err || err2)
|
|
2396
|
+
})
|
|
2397
|
+
})
|
|
2398
|
+
})
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2401
|
+
fs.lchmodSync = function (path, mode) {
|
|
2402
|
+
var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
|
|
2403
|
+
|
|
2404
|
+
// prefer to return the chmod error, if one occurs,
|
|
2405
|
+
// but still try to close, and report closing errors if they occur.
|
|
2406
|
+
var threw = true
|
|
2407
|
+
var ret
|
|
2408
|
+
try {
|
|
2409
|
+
ret = fs.fchmodSync(fd, mode)
|
|
2410
|
+
threw = false
|
|
2411
|
+
} finally {
|
|
2412
|
+
if (threw) {
|
|
2413
|
+
try {
|
|
2414
|
+
fs.closeSync(fd)
|
|
2415
|
+
} catch (er) {}
|
|
2416
|
+
} else {
|
|
2417
|
+
fs.closeSync(fd)
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
return ret
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
function patchLutimes (fs) {
|
|
2425
|
+
if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
|
|
2426
|
+
fs.lutimes = function (path, at, mt, cb) {
|
|
2427
|
+
fs.open(path, constants.O_SYMLINK, function (er, fd) {
|
|
2428
|
+
if (er) {
|
|
2429
|
+
if (cb) cb(er)
|
|
2430
|
+
return
|
|
2431
|
+
}
|
|
2432
|
+
fs.futimes(fd, at, mt, function (er) {
|
|
2433
|
+
fs.close(fd, function (er2) {
|
|
2434
|
+
if (cb) cb(er || er2)
|
|
2435
|
+
})
|
|
2436
|
+
})
|
|
2437
|
+
})
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
fs.lutimesSync = function (path, at, mt) {
|
|
2441
|
+
var fd = fs.openSync(path, constants.O_SYMLINK)
|
|
2442
|
+
var ret
|
|
2443
|
+
var threw = true
|
|
2444
|
+
try {
|
|
2445
|
+
ret = fs.futimesSync(fd, at, mt)
|
|
2446
|
+
threw = false
|
|
2447
|
+
} finally {
|
|
2448
|
+
if (threw) {
|
|
2449
|
+
try {
|
|
2450
|
+
fs.closeSync(fd)
|
|
2451
|
+
} catch (er) {}
|
|
2452
|
+
} else {
|
|
2453
|
+
fs.closeSync(fd)
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
return ret
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
} else if (fs.futimes) {
|
|
2460
|
+
fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) }
|
|
2461
|
+
fs.lutimesSync = function () {}
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
|
|
2465
|
+
function chmodFix (orig) {
|
|
2466
|
+
if (!orig) return orig
|
|
2467
|
+
return function (target, mode, cb) {
|
|
2468
|
+
return orig.call(fs, target, mode, function (er) {
|
|
2469
|
+
if (chownErOk(er)) er = null
|
|
2470
|
+
if (cb) cb.apply(this, arguments)
|
|
2471
|
+
})
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
function chmodFixSync (orig) {
|
|
2476
|
+
if (!orig) return orig
|
|
2477
|
+
return function (target, mode) {
|
|
2478
|
+
try {
|
|
2479
|
+
return orig.call(fs, target, mode)
|
|
2480
|
+
} catch (er) {
|
|
2481
|
+
if (!chownErOk(er)) throw er
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2486
|
+
|
|
2487
|
+
function chownFix (orig) {
|
|
2488
|
+
if (!orig) return orig
|
|
2489
|
+
return function (target, uid, gid, cb) {
|
|
2490
|
+
return orig.call(fs, target, uid, gid, function (er) {
|
|
2491
|
+
if (chownErOk(er)) er = null
|
|
2492
|
+
if (cb) cb.apply(this, arguments)
|
|
2493
|
+
})
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
|
|
2497
|
+
function chownFixSync (orig) {
|
|
2498
|
+
if (!orig) return orig
|
|
2499
|
+
return function (target, uid, gid) {
|
|
2500
|
+
try {
|
|
2501
|
+
return orig.call(fs, target, uid, gid)
|
|
2502
|
+
} catch (er) {
|
|
2503
|
+
if (!chownErOk(er)) throw er
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
|
|
2508
|
+
function statFix (orig) {
|
|
2509
|
+
if (!orig) return orig
|
|
2510
|
+
// Older versions of Node erroneously returned signed integers for
|
|
2511
|
+
// uid + gid.
|
|
2512
|
+
return function (target, options, cb) {
|
|
2513
|
+
if (typeof options === 'function') {
|
|
2514
|
+
cb = options
|
|
2515
|
+
options = null
|
|
2516
|
+
}
|
|
2517
|
+
function callback (er, stats) {
|
|
2518
|
+
if (stats) {
|
|
2519
|
+
if (stats.uid < 0) stats.uid += 0x100000000
|
|
2520
|
+
if (stats.gid < 0) stats.gid += 0x100000000
|
|
2521
|
+
}
|
|
2522
|
+
if (cb) cb.apply(this, arguments)
|
|
2523
|
+
}
|
|
2524
|
+
return options ? orig.call(fs, target, options, callback)
|
|
2525
|
+
: orig.call(fs, target, callback)
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
|
|
2529
|
+
function statFixSync (orig) {
|
|
2530
|
+
if (!orig) return orig
|
|
2531
|
+
// Older versions of Node erroneously returned signed integers for
|
|
2532
|
+
// uid + gid.
|
|
2533
|
+
return function (target, options) {
|
|
2534
|
+
var stats = options ? orig.call(fs, target, options)
|
|
2535
|
+
: orig.call(fs, target)
|
|
2536
|
+
if (stats) {
|
|
2537
|
+
if (stats.uid < 0) stats.uid += 0x100000000
|
|
2538
|
+
if (stats.gid < 0) stats.gid += 0x100000000
|
|
2539
|
+
}
|
|
2540
|
+
return stats;
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
|
|
2544
|
+
// ENOSYS means that the fs doesn't support the op. Just ignore
|
|
2545
|
+
// that, because it doesn't matter.
|
|
2546
|
+
//
|
|
2547
|
+
// if there's no getuid, or if getuid() is something other
|
|
2548
|
+
// than 0, and the error is EINVAL or EPERM, then just ignore
|
|
2549
|
+
// it.
|
|
2550
|
+
//
|
|
2551
|
+
// This specific case is a silent failure in cp, install, tar,
|
|
2552
|
+
// and most other unix tools that manage permissions.
|
|
2553
|
+
//
|
|
2554
|
+
// When running as root, or if other types of errors are
|
|
2555
|
+
// encountered, then it's strict.
|
|
2556
|
+
function chownErOk (er) {
|
|
2557
|
+
if (!er)
|
|
2558
|
+
return true
|
|
2559
|
+
|
|
2560
|
+
if (er.code === "ENOSYS")
|
|
2561
|
+
return true
|
|
2562
|
+
|
|
2563
|
+
var nonroot = !process.getuid || process.getuid() !== 0
|
|
2564
|
+
if (nonroot) {
|
|
2565
|
+
if (er.code === "EINVAL" || er.code === "EPERM")
|
|
2566
|
+
return true
|
|
2567
|
+
}
|
|
2568
|
+
|
|
2569
|
+
return false
|
|
2570
|
+
}
|
|
2571
|
+
}
|
|
2572
|
+
|
|
2573
|
+
|
|
2574
|
+
/***/ }),
|
|
2575
|
+
|
|
2576
|
+
/***/ 449:
|
|
2577
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
2578
|
+
|
|
2579
|
+
let _fs
|
|
2580
|
+
try {
|
|
2581
|
+
_fs = __nccwpck_require__(804)
|
|
2582
|
+
} catch (_) {
|
|
2583
|
+
_fs = __nccwpck_require__(147)
|
|
2584
|
+
}
|
|
2585
|
+
const universalify = __nccwpck_require__(59)
|
|
2586
|
+
const { stringify, stripBom } = __nccwpck_require__(213)
|
|
2587
|
+
|
|
2588
|
+
async function _readFile (file, options = {}) {
|
|
2589
|
+
if (typeof options === 'string') {
|
|
2590
|
+
options = { encoding: options }
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
const fs = options.fs || _fs
|
|
2594
|
+
|
|
2595
|
+
const shouldThrow = 'throws' in options ? options.throws : true
|
|
2596
|
+
|
|
2597
|
+
let data = await universalify.fromCallback(fs.readFile)(file, options)
|
|
2598
|
+
|
|
2599
|
+
data = stripBom(data)
|
|
2600
|
+
|
|
2601
|
+
let obj
|
|
2602
|
+
try {
|
|
2603
|
+
obj = JSON.parse(data, options ? options.reviver : null)
|
|
2604
|
+
} catch (err) {
|
|
2605
|
+
if (shouldThrow) {
|
|
2606
|
+
err.message = `${file}: ${err.message}`
|
|
2607
|
+
throw err
|
|
2608
|
+
} else {
|
|
2609
|
+
return null
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2613
|
+
return obj
|
|
2614
|
+
}
|
|
2615
|
+
|
|
2616
|
+
const readFile = universalify.fromPromise(_readFile)
|
|
2617
|
+
|
|
2618
|
+
function readFileSync (file, options = {}) {
|
|
2619
|
+
if (typeof options === 'string') {
|
|
2620
|
+
options = { encoding: options }
|
|
2621
|
+
}
|
|
2622
|
+
|
|
2623
|
+
const fs = options.fs || _fs
|
|
2624
|
+
|
|
2625
|
+
const shouldThrow = 'throws' in options ? options.throws : true
|
|
2626
|
+
|
|
2627
|
+
try {
|
|
2628
|
+
let content = fs.readFileSync(file, options)
|
|
2629
|
+
content = stripBom(content)
|
|
2630
|
+
return JSON.parse(content, options.reviver)
|
|
2631
|
+
} catch (err) {
|
|
2632
|
+
if (shouldThrow) {
|
|
2633
|
+
err.message = `${file}: ${err.message}`
|
|
2634
|
+
throw err
|
|
2635
|
+
} else {
|
|
2636
|
+
return null
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
|
|
2641
|
+
async function _writeFile (file, obj, options = {}) {
|
|
2642
|
+
const fs = options.fs || _fs
|
|
2643
|
+
|
|
2644
|
+
const str = stringify(obj, options)
|
|
2645
|
+
|
|
2646
|
+
await universalify.fromCallback(fs.writeFile)(file, str, options)
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
const writeFile = universalify.fromPromise(_writeFile)
|
|
2650
|
+
|
|
2651
|
+
function writeFileSync (file, obj, options = {}) {
|
|
2652
|
+
const fs = options.fs || _fs
|
|
2653
|
+
|
|
2654
|
+
const str = stringify(obj, options)
|
|
2655
|
+
// not sure if fs.writeFileSync returns anything, but just in case
|
|
2656
|
+
return fs.writeFileSync(file, str, options)
|
|
2657
|
+
}
|
|
2658
|
+
|
|
2659
|
+
const jsonfile = {
|
|
2660
|
+
readFile,
|
|
2661
|
+
readFileSync,
|
|
2662
|
+
writeFile,
|
|
2663
|
+
writeFileSync
|
|
2664
|
+
}
|
|
2665
|
+
|
|
2666
|
+
module.exports = jsonfile
|
|
2667
|
+
|
|
2668
|
+
|
|
2669
|
+
/***/ }),
|
|
2670
|
+
|
|
2671
|
+
/***/ 213:
|
|
2672
|
+
/***/ ((module) => {
|
|
2673
|
+
|
|
2674
|
+
function stringify (obj, { EOL = '\n', finalEOL = true, replacer = null, spaces } = {}) {
|
|
2675
|
+
const EOF = finalEOL ? EOL : ''
|
|
2676
|
+
const str = JSON.stringify(obj, replacer, spaces)
|
|
2677
|
+
|
|
2678
|
+
return str.replace(/\n/g, EOL) + EOF
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
function stripBom (content) {
|
|
2682
|
+
// we do this because JSON.parse would convert it to a utf8 string if encoding wasn't specified
|
|
2683
|
+
if (Buffer.isBuffer(content)) content = content.toString('utf8')
|
|
2684
|
+
return content.replace(/^\uFEFF/, '')
|
|
2685
|
+
}
|
|
2686
|
+
|
|
2687
|
+
module.exports = { stringify, stripBom }
|
|
2688
|
+
|
|
2689
|
+
|
|
2690
|
+
/***/ }),
|
|
2691
|
+
|
|
2692
|
+
/***/ 59:
|
|
2693
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
2694
|
+
|
|
2695
|
+
"use strict";
|
|
2696
|
+
|
|
2697
|
+
|
|
2698
|
+
exports.fromCallback = function (fn) {
|
|
2699
|
+
return Object.defineProperty(function (...args) {
|
|
2700
|
+
if (typeof args[args.length - 1] === 'function') fn.apply(this, args)
|
|
2701
|
+
else {
|
|
2702
|
+
return new Promise((resolve, reject) => {
|
|
2703
|
+
args.push((err, res) => (err != null) ? reject(err) : resolve(res))
|
|
2704
|
+
fn.apply(this, args)
|
|
2705
|
+
})
|
|
2706
|
+
}
|
|
2707
|
+
}, 'name', { value: fn.name })
|
|
2708
|
+
}
|
|
2709
|
+
|
|
2710
|
+
exports.fromPromise = function (fn) {
|
|
2711
|
+
return Object.defineProperty(function (...args) {
|
|
2712
|
+
const cb = args[args.length - 1]
|
|
2713
|
+
if (typeof cb !== 'function') return fn.apply(this, args)
|
|
2714
|
+
else {
|
|
2715
|
+
args.pop()
|
|
2716
|
+
fn.apply(this, args).then(r => cb(null, r), cb)
|
|
2717
|
+
}
|
|
2718
|
+
}, 'name', { value: fn.name })
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2721
|
+
|
|
2722
|
+
/***/ }),
|
|
2723
|
+
|
|
2724
|
+
/***/ 491:
|
|
2725
|
+
/***/ ((module) => {
|
|
2726
|
+
|
|
2727
|
+
"use strict";
|
|
2728
|
+
module.exports = require("assert");
|
|
2729
|
+
|
|
2730
|
+
/***/ }),
|
|
2731
|
+
|
|
2732
|
+
/***/ 57:
|
|
2733
|
+
/***/ ((module) => {
|
|
2734
|
+
|
|
2735
|
+
"use strict";
|
|
2736
|
+
module.exports = require("constants");
|
|
2737
|
+
|
|
2738
|
+
/***/ }),
|
|
2739
|
+
|
|
2740
|
+
/***/ 147:
|
|
2741
|
+
/***/ ((module) => {
|
|
2742
|
+
|
|
2743
|
+
"use strict";
|
|
2744
|
+
module.exports = require("fs");
|
|
2745
|
+
|
|
2746
|
+
/***/ }),
|
|
2747
|
+
|
|
2748
|
+
/***/ 17:
|
|
2749
|
+
/***/ ((module) => {
|
|
2750
|
+
|
|
2751
|
+
"use strict";
|
|
2752
|
+
module.exports = require("path");
|
|
2753
|
+
|
|
2754
|
+
/***/ }),
|
|
2755
|
+
|
|
2756
|
+
/***/ 781:
|
|
2757
|
+
/***/ ((module) => {
|
|
2758
|
+
|
|
2759
|
+
"use strict";
|
|
2760
|
+
module.exports = require("stream");
|
|
2761
|
+
|
|
2762
|
+
/***/ }),
|
|
2763
|
+
|
|
2764
|
+
/***/ 837:
|
|
2765
|
+
/***/ ((module) => {
|
|
2766
|
+
|
|
2767
|
+
"use strict";
|
|
2768
|
+
module.exports = require("util");
|
|
2769
|
+
|
|
2770
|
+
/***/ })
|
|
2771
|
+
|
|
2772
|
+
/******/ });
|
|
2773
|
+
/************************************************************************/
|
|
2774
|
+
/******/ // The module cache
|
|
2775
|
+
/******/ var __webpack_module_cache__ = {};
|
|
2776
|
+
/******/
|
|
2777
|
+
/******/ // The require function
|
|
2778
|
+
/******/ function __nccwpck_require__(moduleId) {
|
|
2779
|
+
/******/ // Check if module is in cache
|
|
2780
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
2781
|
+
/******/ if (cachedModule !== undefined) {
|
|
2782
|
+
/******/ return cachedModule.exports;
|
|
2783
|
+
/******/ }
|
|
2784
|
+
/******/ // Create a new module (and put it into the cache)
|
|
2785
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
2786
|
+
/******/ // no module.id needed
|
|
2787
|
+
/******/ // no module.loaded needed
|
|
2788
|
+
/******/ exports: {}
|
|
2789
|
+
/******/ };
|
|
2790
|
+
/******/
|
|
2791
|
+
/******/ // Execute the module function
|
|
2792
|
+
/******/ var threw = true;
|
|
2793
|
+
/******/ try {
|
|
2794
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__);
|
|
2795
|
+
/******/ threw = false;
|
|
2796
|
+
/******/ } finally {
|
|
2797
|
+
/******/ if(threw) delete __webpack_module_cache__[moduleId];
|
|
2798
|
+
/******/ }
|
|
2799
|
+
/******/
|
|
2800
|
+
/******/ // Return the exports of the module
|
|
2801
|
+
/******/ return module.exports;
|
|
2802
|
+
/******/ }
|
|
2803
|
+
/******/
|
|
2804
|
+
/************************************************************************/
|
|
2805
|
+
/******/ /* webpack/runtime/compat */
|
|
2806
|
+
/******/
|
|
2807
|
+
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
|
|
2808
|
+
/******/
|
|
2809
|
+
/************************************************************************/
|
|
2810
|
+
/******/
|
|
2811
|
+
/******/ // startup
|
|
2812
|
+
/******/ // Load entry module and return exports
|
|
2813
|
+
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
2814
|
+
/******/ var __webpack_exports__ = __nccwpck_require__(175);
|
|
2815
|
+
/******/ module.exports = __webpack_exports__;
|
|
2816
|
+
/******/
|
|
2817
|
+
/******/ })()
|
|
2818
|
+
;
|