UNPKG

ruru

Version:

Grafast-flavoured GraphiQL distribution

2 lines 6.01 kB
export const __webpack_esm_id__=6611;export const __webpack_esm_ids__=[6611];export const __webpack_esm_modules__={16611(e,n,t){t.r(n),t.d(n,{GLOBSTAR:()=>o,GLOB_SPLIT:()=>c,isRelativePattern:()=>S,match:()=>W,parse:()=>L,splitGlobAware:()=>m});var s=t(30325),r=t(80041),a=t(27735),l=t(60942),u=t(69958),i=t(60891);const o="**",c="/",f="[/\\\\]",h="[^/\\\\]",p=/\//g;function g(e,n){switch(e){case 0:return"";case 1:return`${h}*?`;default:return`(?:${f}|${h}+${f}${n?`|${f}${h}+`:""})*?`}}function m(e,n){if(!e)return[];const t=[];let s=!1,r=!1,a="";for(const l of e){switch(l){case n:if(!s&&!r){t.push(a),a="";continue}break;case"{":s=!0;break;case"}":s=!1;break;case"[":r=!0;break;case"]":r=!1}a+=l}return a&&t.push(a),t}function b(e){if(!e)return"";let n="";const t=m(e,c);if(t.every(e=>e===o))n=".*";else{let e=!1;t.forEach((s,r)=>{if(s===o){if(e)return;n+=g(2,r===t.length-1)}else{let e=!1,a="",l=!1,u="";for(const t of s)if("}"!==t&&e)a+=t;else{if(l&&("]"!==t||!u)){let e;e="-"===t?t:"^"!==t&&"!"!==t||u?t===c?"":(0,i.escapeRegExpCharacters)(t):"^",u+=e;continue}switch(t){case"{":e=!0;continue;case"[":l=!0;continue;case"}":{const t=`(?:${m(a,",").map(e=>b(e)).join("|")})`;n+=t,e=!1,a="";break}case"]":n+="["+u+"]",l=!1,u="";break;case"?":n+=h;continue;case"*":n+=g(1);continue;default:n+=(0,i.escapeRegExpCharacters)(t)}}r<t.length-1&&(t[r+1]!==o||r+2<t.length)&&(n+=f)}e=s===o})}return n}const d=/^\*\*\/\*\.[\w\.-]+$/,y=/^\*\*\/([\w\.-]+)\/?$/,w=/^{\*\*\/\*?[\w\.-]+\/?(,\*\*\/\*?[\w\.-]+\/?)*}$/,$=/^{\*\*\/\*?[\w\.-]+(\/(\*\*)?)?(,\*\*\/\*?[\w\.-]+(\/(\*\*)?)?)*}$/,_=/^\*\*((\/[\w\.-]+)+)\/?$/,P=/^([\w\.-]+(\/[\w\.-]+)*)\/?$/,x=new a.LRUCache(1e4),B=function(){return!1},k=function(){return null};function E(e,n){if(!e)return k;let t;t="string"!=typeof e?e.pattern:e,t=t.trim();const s=`${t}_${!!n.trimForExclusions}`;let a,o=x.get(s);return o||(o=d.test(t)?function(e,n){return function(t,s){return"string"==typeof t&&t.endsWith(e)?n:null}}(t.substr(4),t):(a=y.exec(O(t,n)))?function(e,n){const t=`/${e}`,s=`\\${e}`,r=function(r,a){return"string"!=typeof r?null:a?a===e?n:null:r===e||r.endsWith(t)||r.endsWith(s)?n:null},a=[e];return r.basenames=a,r.patterns=[n],r.allBasenames=a,r}(a[1],t):(n.trimForExclusions?$:w).test(t)?function(e,n){const t=T(e.slice(1,-1).split(",").map(e=>E(e,n)).filter(e=>e!==k),e),s=t.length;if(!s)return k;if(1===s)return t[0];const r=function(n,s){for(let r=0,a=t.length;r<a;r++)if(t[r](n,s))return e;return null},a=t.find(e=>!!e.allBasenames);a&&(r.allBasenames=a.allBasenames);const l=t.reduce((e,n)=>n.allPaths?e.concat(n.allPaths):e,[]);return l.length&&(r.allPaths=l),r}(t,n):(a=_.exec(O(t,n)))?R(a[1].substr(1),t,!0):(a=P.exec(O(t,n)))?R(a[1],t,!1):function(e){try{const n=new RegExp(`^${b(e)}$`);return function(t){return n.lastIndex=0,"string"==typeof t&&n.test(t)?e:null}}catch(e){return k}}(t),x.set(s,o)),function(e,n){if("string"==typeof n)return e;const t=function(t,s){return(0,r.isEqualOrParent)(t,n.base,!u.isLinux)?e((0,i.ltrim)(t.substr(n.base.length),l.sep),s):null};return t.allBasenames=e.allBasenames,t.allPaths=e.allPaths,t.basenames=e.basenames,t.patterns=e.patterns,t}(o,e)}function O(e,n){return n.trimForExclusions&&e.endsWith("/**")?e.substr(0,e.length-2):e}function R(e,n,t){const s=l.sep===l.posix.sep,r=s?e:e.replace(p,l.sep),a=l.sep+r,u=l.posix.sep+e;let i;return i=t?function(t,l){return"string"!=typeof t||t!==r&&!t.endsWith(a)&&(s||t!==e&&!t.endsWith(u))?null:n}:function(t,a){return"string"!=typeof t||t!==r&&(s||t!==e)?null:n},i.allPaths=[(t?"*/":"./")+e],i}function W(e,n,t){return!(!e||"string"!=typeof n)&&L(e)(n,void 0,t)}function L(e,n={}){if(!e)return B;if("string"==typeof e||S(e)){const t=E(e,n);if(t===k)return B;const s=function(e,n){return!!t(e,n)};return t.allBasenames&&(s.allBasenames=t.allBasenames),t.allPaths&&(s.allPaths=t.allPaths),s}return function(e,n){const t=T(Object.getOwnPropertyNames(e).map(t=>function(e,n,t){if(!1===n)return k;const r=E(e,t);if(r===k)return k;if("boolean"==typeof n)return r;if(n){const t=n.when;if("string"==typeof t){const n=(n,a,l,u)=>{if(!u||!r(n,a))return null;const i=u(t.replace("$(basename)",()=>l));return(0,s.isThenable)(i)?i.then(n=>n?e:null):i?e:null};return n.requiresSiblings=!0,n}}return r}(t,e[t],n)).filter(e=>e!==k)),r=t.length;if(!r)return k;if(!t.some(e=>!!e.requiresSiblings)){if(1===r)return t[0];const e=function(e,n){let r;for(let a=0,l=t.length;a<l;a++){const l=t[a](e,n);if("string"==typeof l)return l;(0,s.isThenable)(l)&&(r||(r=[]),r.push(l))}return r?(async()=>{for(const e of r){const n=await e;if("string"==typeof n)return n}return null})():null},n=t.find(e=>!!e.allBasenames);n&&(e.allBasenames=n.allBasenames);const a=t.reduce((e,n)=>n.allPaths?e.concat(n.allPaths):e,[]);return a.length&&(e.allPaths=a),e}const a=function(e,n,r){let a,u;for(let i=0,o=t.length;i<o;i++){const o=t[i];o.requiresSiblings&&r&&(n||(n=(0,l.basename)(e)),a||(a=n.substr(0,n.length-(0,l.extname)(e).length)));const c=o(e,n,a,r);if("string"==typeof c)return c;(0,s.isThenable)(c)&&(u||(u=[]),u.push(c))}return u?(async()=>{for(const e of u){const n=await e;if("string"==typeof n)return n}return null})():null},u=t.find(e=>!!e.allBasenames);u&&(a.allBasenames=u.allBasenames);const i=t.reduce((e,n)=>n.allPaths?e.concat(n.allPaths):e,[]);return i.length&&(a.allPaths=i),a}(e,n)}function S(e){const n=e;return!!n&&"string"==typeof n.base&&"string"==typeof n.pattern}function T(e,n){const t=e.filter(e=>!!e.basenames);if(t.length<2)return e;const s=t.reduce((e,n)=>{const t=n.basenames;return t?e.concat(t):e},[]);let r;if(n){r=[];for(let e=0,t=s.length;e<t;e++)r.push(n)}else r=t.reduce((e,n)=>{const t=n.patterns;return t?e.concat(t):e},[]);const a=function(e,n){if("string"!=typeof e)return null;if(!n){let t;for(t=e.length;t>0;t--){const n=e.charCodeAt(t-1);if(47===n||92===n)break}n=e.substr(t)}const t=s.indexOf(n);return-1!==t?r[t]:null};a.basenames=s,a.patterns=r,a.allBasenames=s;const l=e.filter(e=>!e.basenames);return l.push(a),l}}}; //# sourceMappingURL=6611.js.map