rsnext/packages/next/compiled/find-up/index.js
2020-05-10 20:48:57 -04:00

1 line
No EOL
3.6 KiB
JavaScript

module.exports=function(t,e){"use strict";var r={};function __webpack_require__(e){if(r[e]){return r[e].exports}var n=r[e]={i:e,l:false,exports:{}};t[e].call(n.exports,n,n.exports,__webpack_require__);n.l=true;return n.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(1)}return startup()}({1:function(t,e,r){"use strict";const n=r(622);const s=r(914);const c=r(848);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 u=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 u({...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 u=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=u({...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},429:function(t){"use strict";const e=(t,...e)=>new Promise(r=>{r(t(...e))});t.exports=e;t.exports.default=e},462:function(t,e,r){"use strict";const n=r(495);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 u=n(r.preserveOrder?1:Infinity);try{await Promise.all(i.map(t=>u(c,t)))}catch(t){if(t instanceof EndError){return t.value}throw t}};t.exports=o;t.exports.default=o},495:function(t,e,r){"use strict";const n=r(429);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},622:function(t){t.exports=require("path")},669:function(t){t.exports=require("util")},747:function(t){t.exports=require("fs")},848:function(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}})},914:function(t,e,r){"use strict";const n=r(622);const s=r(747);const{promisify:c}=r(669);const o=r(462);const i=c(s.stat);const u=c(s.lstat);const a={directory:"isDirectory",file:"isFile"};function checkType({type:t}){if(t in a){return}throw new Error(`Invalid type specified: ${t}`)}const p=(t,e)=>t===undefined||e[a[t]]();t.exports=(async(t,e)=>{e={cwd:process.cwd(),type:"file",allowSymlinks:true,...e};checkType(e);const r=e.allowSymlinks?i:u;return o(t,async t=>{try{const s=await r(n.resolve(e.cwd,t));return p(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(p(e.type,t)){return s}}catch(t){}}})}});