index.js 6.52 KB
module.exports=(()=>{var t={930:(t,e,r)=>{var n=r(622);t.exports=function(t,e){if(e){var r=e.map(function(e){return n.resolve(t,e)})}else{var r=t}var s=r.slice(1).reduce(function(t,e){if(!e.match(/^([A-Za-z]:)?\/|\\/)){throw new Error("relative path without a basedir")}var r=e.split(/\/+|\\+/);for(var n=0;t[n]===r[n]&&n<Math.min(t.length,r.length);n++);return t.slice(0,n)},r[0].split(/\/+|\\+/));return s.length>1?s.join("/"):"/"}},281:(t,e,r)=>{"use strict";const n=r(622);const s=r(747);const c=r(930);const o=r(98);const i=r(886);const{env:a,cwd:u}=process;const f=t=>{try{s.accessSync(t,s.constants.W_OK);return true}catch(t){return false}};function useDirectory(t,e){if(e.create){i.sync(t)}if(e.thunk){return(...e)=>n.join(t,...e)}return t}function getNodeModuleDirectory(t){const e=n.join(t,"node_modules");if(!f(e)&&(s.existsSync(e)||!f(n.join(t)))){return}return e}t.exports=((t={})=>{if(a.CACHE_DIR&&!["true","false","1","0"].includes(a.CACHE_DIR)){return useDirectory(n.join(a.CACHE_DIR,"find-cache-dir"),t)}let{cwd:e=u()}=t;if(t.files){e=c(e,t.files)}e=o.sync(e);if(!e){return}const r=getNodeModuleDirectory(e);if(!r){return undefined}return useDirectory(n.join(e,"node_modules",".cache",t.name),t)})},886:(t,e,r)=>{"use strict";const n=r(747);const s=r(622);const{promisify:c}=r(669);const o=r(78);const i=o.satisfies(process.version,">=10.12.0");const a=t=>{if(process.platform==="win32"){const e=/[<>:"|?*]/.test(t.replace(s.parse(t).root,""));if(e){const e=new Error(`Path contains invalid characters: ${t}`);e.code="EINVAL";throw e}}};const u=t=>{const e={mode:511,fs:n};return{...e,...t}};const f=t=>{const e=new Error(`operation not permitted, mkdir '${t}'`);e.code="EPERM";e.errno=-4048;e.path=t;e.syscall="mkdir";return e};const d=async(t,e)=>{a(t);e=u(e);const r=c(e.fs.mkdir);const o=c(e.fs.stat);if(i&&e.fs.mkdir===n.mkdir){const n=s.resolve(t);await r(n,{mode:e.mode,recursive:true});return n}const d=async t=>{try{await r(t,e.mode);return t}catch(e){if(e.code==="EPERM"){throw e}if(e.code==="ENOENT"){if(s.dirname(t)===t){throw f(t)}if(e.message.includes("null bytes")){throw e}await d(s.dirname(t));return d(t)}try{const r=await o(t);if(!r.isDirectory()){throw new Error("The path is not a directory")}}catch(t){throw e}return t}};return d(s.resolve(t))};t.exports=d;t.exports.sync=((t,e)=>{a(t);e=u(e);if(i&&e.fs.mkdirSync===n.mkdirSync){const r=s.resolve(t);n.mkdirSync(r,{mode:e.mode,recursive:true});return r}const r=t=>{try{e.fs.mkdirSync(t,e.mode)}catch(n){if(n.code==="EPERM"){throw n}if(n.code==="ENOENT"){if(s.dirname(t)===t){throw f(t)}if(n.message.includes("null bytes")){throw n}r(s.dirname(t));return r(t)}try{if(!e.fs.statSync(t).isDirectory()){throw new Error("The path is not a directory")}}catch(t){throw n}}return t};return r(s.resolve(t))})},486:(t,e,r)=>{"use strict";const n=r(622);const s=r(447);const c=r(594);const o=Symbol("findUp.stop");t.exports=(async(t,e={})=>{let r=n.resolve(e.cwd||"");const{root:c}=n.parse(r);const i=[].concat(t);const a=async e=>{if(typeof t!=="function"){return s(i,e)}const r=await t(e.cwd);if(typeof r==="string"){return s([r],e)}return r};while(true){const t=await a({...e,cwd:r});if(t===o){return}if(t){return n.resolve(r,t)}if(r===c){return}r=n.dirname(r)}});t.exports.sync=((t,e={})=>{let r=n.resolve(e.cwd||"");const{root:c}=n.parse(r);const i=[].concat(t);const a=e=>{if(typeof t!=="function"){return s.sync(i,e)}const r=t(e.cwd);if(typeof r==="string"){return s.sync([r],e)}return r};while(true){const t=a({...e,cwd:r});if(t===o){return}if(t){return n.resolve(r,t)}if(r===c){return}r=n.dirname(r)}});t.exports.exists=c;t.exports.sync.exists=c.sync;t.exports.stop=o},594:(t,e,r)=>{"use strict";const n=r(747);const{promisify:s}=r(669);const c=s(n.access);t.exports=(async t=>{try{await c(t);return true}catch(t){return false}});t.exports.sync=(t=>{try{n.accessSync(t);return true}catch(t){return false}})},447:(t,e,r)=>{"use strict";const n=r(622);const s=r(747);const{promisify:c}=r(669);const o=r(104);const i=c(s.stat);const a=c(s.lstat);const u={directory:"isDirectory",file:"isFile"};function checkType({type:t}){if(t in u){return}throw new Error(`Invalid type specified: ${t}`)}const f=(t,e)=>t===undefined||e[u[t]]();t.exports=(async(t,e)=>{e={cwd:process.cwd(),type:"file",allowSymlinks:true,...e};checkType(e);const r=e.allowSymlinks?i:a;return o(t,async t=>{try{const s=await r(n.resolve(e.cwd,t));return f(e.type,s)}catch(t){return false}},e)});t.exports.sync=((t,e)=>{e={cwd:process.cwd(),allowSymlinks:true,type:"file",...e};checkType(e);const r=e.allowSymlinks?s.statSync:s.lstatSync;for(const s of t){try{const t=r(n.resolve(e.cwd,s));if(f(e.type,t)){return s}}catch(t){}}})},684:(t,e,r)=>{"use strict";const n=r(746);const s=t=>{if(!((Number.isInteger(t)||t===Infinity)&&t>0)){return Promise.reject(new TypeError("Expected `concurrency` to be a number from 1 and up"))}const e=[];let r=0;const s=()=>{r--;if(e.length>0){e.shift()()}};const c=(t,e,...c)=>{r++;const o=n(t,...c);e(o);o.then(s,s)};const o=(n,s,...o)=>{if(r<t){c(n,s,...o)}else{e.push(c.bind(null,n,s,...o))}};const i=(t,...e)=>new Promise(r=>o(t,r,...e));Object.defineProperties(i,{activeCount:{get:()=>r},pendingCount:{get:()=>e.length},clearQueue:{value:()=>{e.length=0}}});return i};t.exports=s;t.exports.default=s},104:(t,e,r)=>{"use strict";const n=r(684);class EndError extends Error{constructor(t){super();this.value=t}}const s=async(t,e)=>e(await t);const c=async t=>{const e=await Promise.all(t);if(e[1]===true){throw new EndError(e[0])}return false};const o=async(t,e,r)=>{r={concurrency:Infinity,preserveOrder:true,...r};const o=n(r.concurrency);const i=[...t].map(t=>[t,o(s,t,e)]);const a=n(r.preserveOrder?1:Infinity);try{await Promise.all(i.map(t=>a(c,t)))}catch(t){if(t instanceof EndError){return t.value}throw t}};t.exports=o;t.exports.default=o},746:t=>{"use strict";const e=(t,...e)=>new Promise(r=>{r(t(...e))});t.exports=e;t.exports.default=e},98:(t,e,r)=>{"use strict";const n=r(622);const s=r(486);const c=async t=>{const e=await s("package.json",{cwd:t});return e&&n.dirname(e)};t.exports=c;t.exports.default=c;t.exports.sync=(t=>{const e=s.sync("package.json",{cwd:t});return e&&n.dirname(e)})},78:t=>{"use strict";t.exports=require("@umijs/deps/compiled/semver")},747:t=>{"use strict";t.exports=require("fs")},622:t=>{"use strict";t.exports=require("path")},669:t=>{"use strict";t.exports=require("util")}};var e={};function __nccwpck_require__(r){if(e[r]){return e[r].exports}var n=e[r]={exports:{}};var s=true;try{t[r](n,n.exports,__nccwpck_require__);s=false}finally{if(s)delete e[r]}return n.exports}__nccwpck_require__.ab=__dirname+"/";return __nccwpck_require__(281)})();