@vitus-labs/core 1.0.1-alpha.6 → 1.1.0
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/lib/analysis/index.js.html +2085 -1984
- package/lib/index.d.ts +3 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/types/compose.d.ts +1 -1
- package/lib/types/compose.d.ts.map +1 -1
- package/lib/types/config.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
<title>@vitus-labs/core - index.js</title>
|
|
9
9
|
<style>
|
|
10
10
|
:root {
|
|
11
|
-
--font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
|
|
12
|
-
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
|
|
11
|
+
--font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
|
|
12
|
+
"Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
|
|
13
|
+
"Noto Color Emoji";
|
|
13
14
|
--background-color: #2b2d42;
|
|
14
15
|
--text-color: #edf2f4;
|
|
15
16
|
}
|
|
@@ -66,7 +67,6 @@ main {
|
|
|
66
67
|
border: 2px solid;
|
|
67
68
|
border-radius: 5px;
|
|
68
69
|
padding: 5px;
|
|
69
|
-
white-space: nowrap;
|
|
70
70
|
font-size: 0.875rem;
|
|
71
71
|
background-color: var(--background-color);
|
|
72
72
|
color: var(--text-color);
|
|
@@ -136,6 +136,10 @@ main {
|
|
|
136
136
|
.module-filter + .module-filter {
|
|
137
137
|
margin-left: 0.5rem;
|
|
138
138
|
}
|
|
139
|
+
|
|
140
|
+
.node {
|
|
141
|
+
cursor: pointer;
|
|
142
|
+
}
|
|
139
143
|
</style>
|
|
140
144
|
</head>
|
|
141
145
|
<body>
|
|
@@ -145,9 +149,9 @@ main {
|
|
|
145
149
|
var drawChart = (function (exports) {
|
|
146
150
|
'use strict';
|
|
147
151
|
|
|
148
|
-
var n,l$1,u$1,t$1,o$2,r$1,f$1,e$1,c$2={},s$1=[],a$2=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v$1=Array.isArray;function h$1(n,l){for(var u in l)n[u]=l[u];return n}function p$1(n){var l=n.parentNode;l&&l.removeChild(n);}function y$2(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return d$1(l,f,t,o,null)}function d$1(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$1:r};return null==r&&null!=l$1.vnode&&l$1.vnode(f),f}function k$1(n){return n.children}function b$1(n,l){this.props=n,this.context=l;}function g$1(n,l){if(null==l)return n.__?g$1(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?g$1(n):null}function m$2(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return m$2(n)}}function w$1(n){(!n.__d&&(n.__d=!0)&&t$1.push(n)&&!x$2.__r++||o$2!==l$1.debounceRendering)&&((o$2=l$1.debounceRendering)||r$1)(x$2);}function x$2(){var n,l,u,i,o,r,e,c;for(t$1.sort(f$1);n=t$1.shift();)n.__d&&(l=t$1.length,i=void 0,o=void 0,e=(r=(u=n).__v).__e,(c=u.__P)&&(i=[],(o=h$1({},r)).__v=r.__v+1,L(c,r,o,u.__n,void 0!==c.ownerSVGElement,null!=r.__h?[e]:null,i,null==e?g$1(r):e,r.__h),M(i,r),r.__e!=e&&m$2(r)),t$1.length>l&&t$1.sort(f$1));x$2.__r=0;}function P(n,l,u,i,t,o,r,f,e,a){var h,p,y,_,b,m,w,x=i&&i.__k||s$1,P=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(_=u.__k[h]=null==(_=l[h])||"boolean"==typeof _||"function"==typeof _?null:"string"==typeof _||"number"==typeof _||"bigint"==typeof _?d$1(null,_,null,null,_):v$1(_)?d$1(k$1,{children:_},null,null,null):_.__b>0?d$1(_.type,_.props,_.key,_.ref?_.ref:null,_.__v):_)){if(_.__=u,_.__b=u.__b+1,null===(y=x[h])||y&&_.key==y.key&&_.type===y.type)x[h]=void 0;else for(p=0;p<P;p++){if((y=x[p])&&_.key==y.key&&_.type===y.type){x[p]=void 0;break}y=null;}L(n,_,y=y||c$2,t,o,r,f,e,a),b=_.__e,(p=_.ref)&&y.ref!=p&&(w||(w=[]),y.ref&&w.push(y.ref,null,_),w.push(p,_.__c||b,_)),null!=b?(null==m&&(m=b),"function"==typeof _.type&&_.__k===y.__k?_.__d=e=C(_,e,n):e=$(n,_,y,x,b,e),"function"==typeof u.type&&(u.__d=e)):e&&y.__e==e&&e.parentNode!=n&&(e=g$1(y));}for(u.__e=m,h=P;h--;)null!=x[h]&&("function"==typeof u.type&&null!=x[h].__e&&x[h].__e==u.__d&&(u.__d=A(i).nextSibling),q$1(x[h],x[h]));if(w)for(h=0;h<w.length;h++)O(w[h],w[++h],w[++h]);}function C(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?C(i,l,u):$(u,i,i,t,i.__e,l));return l}function $(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else {for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=1)if(f==t)break n;n.insertBefore(t,o),r=o;}return void 0!==r?r:t.nextSibling}function A(n){var l,u,i;if(null==n.type||"string"==typeof n.type)return n.__e;if(n.__k)for(l=n.__k.length-1;l>=0;l--)if((u=n.__k[l])&&(i=A(u)))return i;return null}function H(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||T$1(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||T$1(n,o,l[o],u[o],i);}function I(n,l,u){"-"===l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||a$2.test(l)?u:u+"px";}function T$1(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||I(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||I(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?z$1:j$1,o):n.removeEventListener(l,o?z$1:j$1,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==l&&"height"!==l&&"href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&"rowSpan"!==l&&"colSpan"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&"-"!==l[4]?n.removeAttribute(l):n.setAttribute(l,u));}}function j$1(n){return this.l[n.type+!1](l$1.event?l$1.event(n):n)}function z$1(n){return this.l[n.type+!0](l$1.event?l$1.event(n):n)}function L(n,u,i,t,o,r,f,e,c){var s,a,p,y,d,_,g,m,w,x,C,S,$,A,H,I=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(s=l$1.__b)&&s(u);try{n:if("function"==typeof I){if(m=u.props,w=(s=I.contextType)&&t[s.__c],x=s?w?w.props.value:s.__:t,i.__c?g=(a=u.__c=i.__c).__=a.__E:("prototype"in I&&I.prototype.render?u.__c=a=new I(m,x):(u.__c=a=new b$1(m,x),a.constructor=I,a.render=B$1),w&&w.sub(a),a.props=m,a.state||(a.state={}),a.context=x,a.__n=t,p=a.__d=!0,a.__h=[],a._sb=[]),null==a.__s&&(a.__s=a.state),null!=I.getDerivedStateFromProps&&(a.__s==a.state&&(a.__s=h$1({},a.__s)),h$1(a.__s,I.getDerivedStateFromProps(m,a.__s))),y=a.props,d=a.state,a.__v=u,p)null==I.getDerivedStateFromProps&&null!=a.componentWillMount&&a.componentWillMount(),null!=a.componentDidMount&&a.__h.push(a.componentDidMount);else {if(null==I.getDerivedStateFromProps&&m!==y&&null!=a.componentWillReceiveProps&&a.componentWillReceiveProps(m,x),!a.__e&&null!=a.shouldComponentUpdate&&!1===a.shouldComponentUpdate(m,a.__s,x)||u.__v===i.__v){for(u.__v!==i.__v&&(a.props=m,a.state=a.__s,a.__d=!1),a.__e=!1,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),C=0;C<a._sb.length;C++)a.__h.push(a._sb[C]);a._sb=[],a.__h.length&&f.push(a);break n}null!=a.componentWillUpdate&&a.componentWillUpdate(m,a.__s,x),null!=a.componentDidUpdate&&a.__h.push(function(){a.componentDidUpdate(y,d,_);});}if(a.context=x,a.props=m,a.__P=n,S=l$1.__r,$=0,"prototype"in I&&I.prototype.render){for(a.state=a.__s,a.__d=!1,S&&S(u),s=a.render(a.props,a.state,a.context),A=0;A<a._sb.length;A++)a.__h.push(a._sb[A]);a._sb=[];}else do{a.__d=!1,S&&S(u),s=a.render(a.props,a.state,a.context),a.state=a.__s;}while(a.__d&&++$<25);a.state=a.__s,null!=a.getChildContext&&(t=h$1(h$1({},t),a.getChildContext())),p||null==a.getSnapshotBeforeUpdate||(_=a.getSnapshotBeforeUpdate(y,d)),P(n,v$1(H=null!=s&&s.type===k$1&&null==s.key?s.props.children:s)?H:[H],u,i,t,o,r,f,e,c),a.base=u.__e,u.__h=null,a.__h.length&&f.push(a),g&&(a.__E=a.__=null),a.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=N(i.__e,u,i,t,o,r,f,c);(s=l$1.diffed)&&s(u);}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l$1.__e(n,u,i);}}function M(n,u){l$1.__c&&l$1.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$1.__e(n,u.__v);}});}function N(l,u,i,t,o,r,f,e){var s,a,h,y=i.props,d=u.props,_=u.type,k=0;if("svg"===_&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&"setAttribute"in s==!!_&&(_?s.localName===_:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===_)return document.createTextNode(d);l=o?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,d.is&&d),r=null,e=!1;}if(null===_)y===d||e&&l.data===d||(l.data=d);else {if(r=r&&n.call(l.childNodes),a=(y=i.props||c$2).dangerouslySetInnerHTML,h=d.dangerouslySetInnerHTML,!e){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(h||a)&&(h&&(a&&h.__html==a.__html||h.__html===l.innerHTML)||(l.innerHTML=h&&h.__html||""));}if(H(l,d,y,o,e),h)u.__k=[];else if(P(l,v$1(k=u.props.children)?k:[k],u,i,t,o&&"foreignObject"!==_,r,f,r?r[0]:i.__k&&g$1(i,0),e),null!=r)for(k=r.length;k--;)null!=r[k]&&p$1(r[k]);e||("value"in d&&void 0!==(k=d.value)&&(k!==l.value||"progress"===_&&!k||"option"===_&&k!==y.value)&&T$1(l,"value",k,y.value,!1),"checked"in d&&void 0!==(k=d.checked)&&k!==l.checked&&T$1(l,"checked",k,y.checked,!1));}return l}function O(n,u,i){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$1.__e(n,i);}}function q$1(n,u,i){var t,o;if(l$1.unmount&&l$1.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||O(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(n){l$1.__e(n,u);}t.base=t.__P=null,n.__c=void 0;}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&q$1(t[o],u,i||"function"!=typeof n.type);i||null==n.__e||p$1(n.__e),n.__=n.__e=n.__d=void 0;}function B$1(n,l,u){return this.constructor(n,u)}function D(u,i,t){var o,r,f;l$1.__&&l$1.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,f=[],L(i,u=(!o&&t||i).__k=y$2(k$1,null,[u]),r||c$2,c$2,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,f,!o&&t?t:r?r.__e:i.firstChild,o),M(f,u);}function G(n,l){var u={__c:l="__cC"+e$1++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,i;return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(function(n){n.__e=!0,w$1(n);});},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n);};}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=s$1.slice,l$1={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l;}throw n}},u$1=0,b$1.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=h$1({},this.state),"function"==typeof n&&(n=n(h$1({},u),this.props)),n&&h$1(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),w$1(this));},b$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),w$1(this));},b$1.prototype.render=k$1,t$1=[],r$1="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f$1=function(n,l){return n.__v.__b-l.__v.__b},x$2.__r=0,e$1=0;
|
|
152
|
+
var n,l$1,u$2,i$1,r$1,o$1,e$1,f$2,c$2,s$1,a$2,h$1,p$1={},v$1=[],y$3=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,d$1=Array.isArray;function w$1(n,l){for(var u in l)n[u]=l[u];return n}function _(n){n&&n.parentNode&&n.parentNode.removeChild(n);}function g(l,u,t){var i,r,o,e={};for(o in u)"key"==o?i=u[o]:"ref"==o?r=u[o]:e[o]=u[o];if(arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps)void 0===e[o]&&(e[o]=l.defaultProps[o]);return m$2(l,e,i,r,null)}function m$2(n,t,i,r,o){var e={type:n,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++u$2:o,__i:-1,__u:0};return null==o&&null!=l$1.vnode&&l$1.vnode(e),e}function k$1(n){return n.children}function x$3(n,l){this.props=n,this.context=l;}function C$1(n,l){if(null==l)return n.__?C$1(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?C$1(n):null}function S(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return S(n)}}function M(n){(!n.__d&&(n.__d=!0)&&i$1.push(n)&&!P.__r++||r$1!==l$1.debounceRendering)&&((r$1=l$1.debounceRendering)||o$1)(P);}function P(){var n,u,t,r,o,f,c,s;for(i$1.sort(e$1);n=i$1.shift();)n.__d&&(u=i$1.length,r=void 0,f=(o=(t=n).__v).__e,c=[],s=[],t.__P&&((r=w$1({},o)).__v=o.__v+1,l$1.vnode&&l$1.vnode(r),j$1(t.__P,r,o,t.__n,t.__P.namespaceURI,32&o.__u?[f]:null,c,null==f?C$1(o):f,!!(32&o.__u),s),r.__v=o.__v,r.__.__k[r.__i]=r,z$1(c,r,s),r.__e!=f&&S(r)),i$1.length>u&&i$1.sort(e$1));P.__r=0;}function $(n,l,u,t,i,r,o,e,f,c,s){var a,h,y,d,w,_,g=t&&t.__k||v$1,m=l.length;for(f=I(u,l,g,f,m),a=0;a<m;a++)null!=(y=u.__k[a])&&(h=-1===y.__i?p$1:g[y.__i]||p$1,y.__i=a,_=j$1(n,y,h,i,r,o,e,f,c,s),d=y.__e,y.ref&&h.ref!=y.ref&&(h.ref&&V(h.ref,null,y),s.push(y.ref,y.__c||d,y)),null==w&&null!=d&&(w=d),4&y.__u||h.__k===y.__k?f=A$1(y,f,n):"function"==typeof y.type&&void 0!==_?f=_:d&&(f=d.nextSibling),y.__u&=-7);return u.__e=w,f}function I(n,l,u,t,i){var r,o,e,f,c,s=u.length,a=s,h=0;for(n.__k=new Array(i),r=0;r<i;r++)null!=(o=l[r])&&"boolean"!=typeof o&&"function"!=typeof o?(f=r+h,(o=n.__k[r]="string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?m$2(null,o,null,null,null):d$1(o)?m$2(k$1,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?m$2(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=n,o.__b=n.__b+1,e=null,-1!==(c=o.__i=L(o,u,f,a))&&(a--,(e=u[c])&&(e.__u|=2)),null==e||null===e.__v?(-1==c&&h--,"function"!=typeof o.type&&(o.__u|=4)):c!=f&&(c==f-1?h--:c==f+1?h++:(c>f?h--:h++,o.__u|=4))):n.__k[r]=null;if(a)for(r=0;r<s;r++)null!=(e=u[r])&&0==(2&e.__u)&&(e.__e==t&&(t=C$1(e)),q$1(e,e));return t}function A$1(n,l,u){var t,i;if("function"==typeof n.type){for(t=n.__k,i=0;t&&i<t.length;i++)t[i]&&(t[i].__=n,l=A$1(t[i],l,u));return l}n.__e!=l&&(l&&n.type&&!u.contains(l)&&(l=C$1(n)),u.insertBefore(n.__e,l||null),l=n.__e);do{l=l&&l.nextSibling;}while(null!=l&&8==l.nodeType);return l}function L(n,l,u,t){var i,r,o=n.key,e=n.type,f=l[u];if(null===f||f&&o==f.key&&e===f.type&&0==(2&f.__u))return u;if(t>(null!=f&&0==(2&f.__u)?1:0))for(i=u-1,r=u+1;i>=0||r<l.length;){if(i>=0){if((f=l[i])&&0==(2&f.__u)&&o==f.key&&e===f.type)return i;i--;}if(r<l.length){if((f=l[r])&&0==(2&f.__u)&&o==f.key&&e===f.type)return r;r++;}}return -1}function T$1(n,l,u){"-"==l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||y$3.test(l)?u:u+"px";}function F(n,l,u,t,i){var r;n:if("style"==l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||T$1(n.style,l,"");if(u)for(l in u)t&&u[l]===t[l]||T$1(n.style,l,u[l]);}else if("o"==l[0]&&"n"==l[1])r=l!=(l=l.replace(f$2,"$1")),l=l.toLowerCase()in n||"onFocusOut"==l||"onFocusIn"==l?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=u,u?t?u.u=t.u:(u.u=c$2,n.addEventListener(l,r?a$2:s$1,r)):n.removeEventListener(l,r?a$2:s$1,r);else {if("http://www.w3.org/2000/svg"==i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=l&&"height"!=l&&"href"!=l&&"list"!=l&&"form"!=l&&"tabIndex"!=l&&"download"!=l&&"rowSpan"!=l&&"colSpan"!=l&&"role"!=l&&"popover"!=l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&"-"!=l[4]?n.removeAttribute(l):n.setAttribute(l,"popover"==l&&1==u?"":u));}}function O(n){return function(u){if(this.l){var t=this.l[u.type+n];if(null==u.t)u.t=c$2++;else if(u.t<t.u)return;return t(l$1.event?l$1.event(u):u)}}}function j$1(n,u,t,i,r,o,e,f,c,s){var a,h,p,v,y,g,m,b,C,S,M,P,I,A,H,L,T,F=u.type;if(void 0!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),o=[f=u.__e=t.__e]),(a=l$1.__b)&&a(u);n:if("function"==typeof F)try{if(b=u.props,C="prototype"in F&&F.prototype.render,S=(a=F.contextType)&&i[a.__c],M=a?S?S.props.value:a.__:i,t.__c?m=(h=u.__c=t.__c).__=h.__E:(C?u.__c=h=new F(b,M):(u.__c=h=new x$3(b,M),h.constructor=F,h.render=B$1),S&&S.sub(h),h.props=b,h.state||(h.state={}),h.context=M,h.__n=i,p=h.__d=!0,h.__h=[],h._sb=[]),C&&null==h.__s&&(h.__s=h.state),C&&null!=F.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=w$1({},h.__s)),w$1(h.__s,F.getDerivedStateFromProps(b,h.__s))),v=h.props,y=h.state,h.__v=u,p)C&&null==F.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),C&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(C&&null==F.getDerivedStateFromProps&&b!==v&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(b,M),!h.__e&&(null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(b,h.__s,M)||u.__v==t.__v)){for(u.__v!=t.__v&&(h.props=b,h.state=h.__s,h.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.some(function(n){n&&(n.__=u);}),P=0;P<h._sb.length;P++)h.__h.push(h._sb[P]);h._sb=[],h.__h.length&&e.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(b,h.__s,M),C&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(v,y,g);});}if(h.context=M,h.props=b,h.__P=n,h.__e=!1,I=l$1.__r,A=0,C){for(h.state=h.__s,h.__d=!1,I&&I(u),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[];}else do{h.__d=!1,I&&I(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++A<25);h.state=h.__s,null!=h.getChildContext&&(i=w$1(w$1({},i),h.getChildContext())),C&&!p&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(v,y)),f=$(n,d$1(L=null!=a&&a.type===k$1&&null==a.key?a.props.children:a)?L:[L],u,t,i,r,o,e,f,c,s),h.base=u.__e,u.__u&=-161,h.__h.length&&e.push(h),m&&(h.__E=h.__=null);}catch(n){if(u.__v=null,c||null!=o)if(n.then){for(u.__u|=c?160:128;f&&8==f.nodeType&&f.nextSibling;)f=f.nextSibling;o[o.indexOf(f)]=null,u.__e=f;}else for(T=o.length;T--;)_(o[T]);else u.__e=t.__e,u.__k=t.__k;l$1.__e(n,u,t);}else null==o&&u.__v==t.__v?(u.__k=t.__k,u.__e=t.__e):f=u.__e=N(t.__e,u,t,i,r,o,e,c,s);return (a=l$1.diffed)&&a(u),128&u.__u?void 0:f}function z$1(n,u,t){for(var i=0;i<t.length;i++)V(t[i],t[++i],t[++i]);l$1.__c&&l$1.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$1.__e(n,u.__v);}});}function N(u,t,i,r,o,e,f,c,s){var a,h,v,y,w,g,m,b=i.props,k=t.props,x=t.type;if("svg"==x?o="http://www.w3.org/2000/svg":"math"==x?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=e)for(a=0;a<e.length;a++)if((w=e[a])&&"setAttribute"in w==!!x&&(x?w.localName==x:3==w.nodeType)){u=w,e[a]=null;break}if(null==u){if(null==x)return document.createTextNode(k);u=document.createElementNS(o,x,k.is&&k),c&&(l$1.__m&&l$1.__m(t,e),c=!1),e=null;}if(null===x)b===k||c&&u.data===k||(u.data=k);else {if(e=e&&n.call(u.childNodes),b=i.props||p$1,!c&&null!=e)for(b={},a=0;a<u.attributes.length;a++)b[(w=u.attributes[a]).name]=w.value;for(a in b)if(w=b[a],"children"==a);else if("dangerouslySetInnerHTML"==a)v=w;else if(!(a in k)){if("value"==a&&"defaultValue"in k||"checked"==a&&"defaultChecked"in k)continue;F(u,a,null,w,o);}for(a in k)w=k[a],"children"==a?y=w:"dangerouslySetInnerHTML"==a?h=w:"value"==a?g=w:"checked"==a?m=w:c&&"function"!=typeof w||b[a]===w||F(u,a,w,b[a],o);if(h)c||v&&(h.__html===v.__html||h.__html===u.innerHTML)||(u.innerHTML=h.__html),t.__k=[];else if(v&&(u.innerHTML=""),$(u,d$1(y)?y:[y],t,i,r,"foreignObject"==x?"http://www.w3.org/1999/xhtml":o,e,f,e?e[0]:i.__k&&C$1(i,0),c,s),null!=e)for(a=e.length;a--;)_(e[a]);c||(a="value","progress"==x&&null==g?u.removeAttribute("value"):void 0!==g&&(g!==u[a]||"progress"==x&&!g||"option"==x&&g!==b[a])&&F(u,a,g,b[a],o),a="checked",void 0!==m&&m!==u[a]&&F(u,a,m,b[a],o));}return u}function V(n,u,t){try{if("function"==typeof n){var i="function"==typeof n.__u;i&&n.__u(),i&&null==u||(n.__u=n(u));}else n.current=u;}catch(n){l$1.__e(n,t);}}function q$1(n,u,t){var i,r;if(l$1.unmount&&l$1.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||V(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount();}catch(n){l$1.__e(n,u);}i.base=i.__P=null;}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&q$1(i[r],u,t||"function"!=typeof n.type);t||_(n.__e),n.__c=n.__=n.__e=void 0;}function B$1(n,l,u){return this.constructor(n,u)}function D$1(u,t,i){var r,o,e,f;t==document&&(t=document.documentElement),l$1.__&&l$1.__(u,t),o=(r="function"==typeof i)?null:t.__k,e=[],f=[],j$1(t,u=(t).__k=g(k$1,null,[u]),o||p$1,p$1,t.namespaceURI,o?null:t.firstChild?n.call(t.childNodes):null,e,o?o.__e:t.firstChild,r,f),z$1(e,u,f);}function J(n,l){var u={__c:l="__cC"+h$1++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,t;return this.getChildContext||(u=new Set,(t={})[l]=this,this.getChildContext=function(){return t},this.componentWillUnmount=function(){u=null;},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.forEach(function(n){n.__e=!0,M(n);});},this.sub=function(n){u.add(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u&&u.delete(n),l&&l.call(n);};}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=v$1.slice,l$1={__e:function(n,l,u,t){for(var i,r,o;l=l.__;)if((i=l.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(n)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),o=i.__d),o)return i.__E=i}catch(l){n=l;}throw n}},u$2=0,x$3.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=w$1({},this.state),"function"==typeof n&&(n=n(w$1({},u),this.props)),n&&w$1(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),M(this));},x$3.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),M(this));},x$3.prototype.render=k$1,i$1=[],o$1="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,e$1=function(n,l){return n.__v.__b-l.__v.__b},P.__r=0,f$2=/(PointerCapture)$|Capture$/i,c$2=0,s$1=O(!1),a$2=O(!0),h$1=0;
|
|
149
153
|
|
|
150
|
-
var
|
|
154
|
+
var f$1=0;function u$1(e,t,n,o,i,u){t||(t={});var a,c,p=t;if("ref"in p)for(c in p={},t)"ref"==c?a=t[c]:p[c]=t[c];var l={type:e,props:p,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--f$1,__i:-1,__u:0,__source:i,__self:u};if("function"==typeof e&&(a=e.defaultProps))for(c in a)void 0===p[c]&&(p[c]=a[c]);return l$1.vnode&&l$1.vnode(l),l}
|
|
151
155
|
|
|
152
156
|
const LABELS = {
|
|
153
157
|
renderedLength: "Rendered",
|
|
@@ -165,7 +169,7 @@ var drawChart = (function (exports) {
|
|
|
165
169
|
return availableSizeProperties;
|
|
166
170
|
};
|
|
167
171
|
|
|
168
|
-
var t,r,u,i,o=0,f=[],c$1=
|
|
172
|
+
var t,r,u,i,o=0,f=[],c$1=l$1,e=c$1.__b,a$1=c$1.__r,v=c$1.diffed,l=c$1.__c,m$1=c$1.unmount,s=c$1.__;function d(n,t){c$1.__h&&c$1.__h(r,n,o||t),o=0;var u=r.__H||(r.__H={__:[],__h:[]});return n>=u.__.length&&u.__.push({}),u.__[n]}function h(n){return o=1,p(D,n)}function p(n,u,i){var o=d(t++,2);if(o.t=n,!o.__c&&(o.__=[D(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=r,!r.u)){var f=function(n,t,r){if(!o.__c.__H)return !0;var u=o.__c.__H.__.filter(function(n){return !!n.__c});if(u.every(function(n){return !n.__N}))return !c||c.call(this,n,t,r);var i=o.__c.props!==n;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0);}}),c&&c.call(this,n,t,r)||i};r.u=!0;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u;}e&&e.call(this,n,t,r);},r.shouldComponentUpdate=f;}return o.__N||o.__}function y$2(n,u){var i=d(t++,3);!c$1.__s&&C(i.__H,u)&&(i.__=n,i.i=u,r.__H.__h.push(i));}function A(n){return o=5,T(function(){return {current:n}},[])}function T(n,r){var u=d(t++,7);return C(u.__H,r)&&(u.__=n(),u.__H=r,u.__h=n),u.__}function q(n,t){return o=8,T(function(){return n},t)}function x$2(n){var u=r.context[n.__c],i=d(t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r)),u.props.value):n.__}function j(){for(var n;n=f.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(z),n.__H.__h.forEach(B),n.__H.__h=[];}catch(t){n.__H.__h=[],c$1.__e(t,n.__v);}}c$1.__b=function(n){r=null,e&&e(n);},c$1.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),s&&s(n,t);},c$1.__r=function(n){a$1&&a$1(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.i=n.__N=void 0;})):(i.__h.forEach(z),i.__h.forEach(B),i.__h=[],t=0)),u=r;},c$1.diffed=function(n){v&&v(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(1!==f.push(t)&&i===c$1.requestAnimationFrame||((i=c$1.requestAnimationFrame)||w)(j)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.i=void 0;})),u=r=null;},c$1.__c=function(n,t){t.some(function(n){try{n.__h.forEach(z),n.__h=n.__h.filter(function(n){return !n.__||B(n)});}catch(r){t.some(function(n){n.__h&&(n.__h=[]);}),t=[],c$1.__e(r,n.__v);}}),l&&l(n,t);},c$1.unmount=function(n){m$1&&m$1(n);var t,r=n.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{z(n);}catch(n){t=n;}}),r.__H=void 0,t&&c$1.__e(t,r.__v));};var k="function"==typeof requestAnimationFrame;function w(n){var t,r=function(){clearTimeout(u),k&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);k&&(t=requestAnimationFrame(r));}function z(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t;}function B(n){var t=r;n.__c=n.__(),r=t;}function C(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function D(n,t){return "function"==typeof t?t(n):t}
|
|
169
173
|
|
|
170
174
|
function ascending(a, b) {
|
|
171
175
|
return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
|
@@ -240,7 +244,6 @@ var drawChart = (function (exports) {
|
|
|
240
244
|
const ascendingBisect = bisector(ascending);
|
|
241
245
|
const bisectRight = ascendingBisect.right;
|
|
242
246
|
bisector(number$1).center;
|
|
243
|
-
var bisect = bisectRight;
|
|
244
247
|
|
|
245
248
|
const e10 = Math.sqrt(50),
|
|
246
249
|
e5 = Math.sqrt(10),
|
|
@@ -947,7 +950,7 @@ var drawChart = (function (exports) {
|
|
|
947
950
|
};
|
|
948
951
|
}
|
|
949
952
|
|
|
950
|
-
function constants$
|
|
953
|
+
function constants$1(x) {
|
|
951
954
|
return function() {
|
|
952
955
|
return x;
|
|
953
956
|
};
|
|
@@ -966,7 +969,7 @@ var drawChart = (function (exports) {
|
|
|
966
969
|
function normalize(a, b) {
|
|
967
970
|
return (b -= (a = +a))
|
|
968
971
|
? function(x) { return (x - a) / b; }
|
|
969
|
-
: constants$
|
|
972
|
+
: constants$1(isNaN(b) ? NaN : 0.5);
|
|
970
973
|
}
|
|
971
974
|
|
|
972
975
|
function clamper(a, b) {
|
|
@@ -1002,7 +1005,7 @@ var drawChart = (function (exports) {
|
|
|
1002
1005
|
}
|
|
1003
1006
|
|
|
1004
1007
|
return function(x) {
|
|
1005
|
-
var i =
|
|
1008
|
+
var i = bisectRight(domain, x, 1, j) - 1;
|
|
1006
1009
|
return r[i](d[i](x));
|
|
1007
1010
|
};
|
|
1008
1011
|
}
|
|
@@ -2779,2048 +2782,2145 @@ var drawChart = (function (exports) {
|
|
|
2779
2782
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
2780
2783
|
}
|
|
2781
2784
|
|
|
2782
|
-
var utils
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
...POSIX_CHARS,
|
|
2833
|
-
|
|
2834
|
-
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
2835
|
-
QMARK: WIN_NO_SLASH,
|
|
2836
|
-
STAR: `${WIN_NO_SLASH}*?`,
|
|
2837
|
-
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
2838
|
-
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
2839
|
-
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
2840
|
-
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
2841
|
-
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
2842
|
-
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
2843
|
-
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
2844
|
-
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
|
|
2845
|
-
SEP: '\\'
|
|
2846
|
-
};
|
|
2847
|
-
|
|
2848
|
-
/**
|
|
2849
|
-
* POSIX Bracket Regex
|
|
2850
|
-
*/
|
|
2851
|
-
|
|
2852
|
-
const POSIX_REGEX_SOURCE$1 = {
|
|
2853
|
-
alnum: 'a-zA-Z0-9',
|
|
2854
|
-
alpha: 'a-zA-Z',
|
|
2855
|
-
ascii: '\\x00-\\x7F',
|
|
2856
|
-
blank: ' \\t',
|
|
2857
|
-
cntrl: '\\x00-\\x1F\\x7F',
|
|
2858
|
-
digit: '0-9',
|
|
2859
|
-
graph: '\\x21-\\x7E',
|
|
2860
|
-
lower: 'a-z',
|
|
2861
|
-
print: '\\x20-\\x7E ',
|
|
2862
|
-
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
|
|
2863
|
-
space: ' \\t\\r\\n\\v\\f',
|
|
2864
|
-
upper: 'A-Z',
|
|
2865
|
-
word: 'A-Za-z0-9_',
|
|
2866
|
-
xdigit: 'A-Fa-f0-9'
|
|
2867
|
-
};
|
|
2868
|
-
|
|
2869
|
-
var constants$2 = {
|
|
2870
|
-
MAX_LENGTH: 1024 * 64,
|
|
2871
|
-
POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
|
|
2872
|
-
|
|
2873
|
-
// regular expressions
|
|
2874
|
-
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
2875
|
-
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
2876
|
-
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
2877
|
-
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
2878
|
-
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
2879
|
-
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
2880
|
-
|
|
2881
|
-
// Replace globs with equivalent patterns to reduce parsing time.
|
|
2882
|
-
REPLACEMENTS: {
|
|
2883
|
-
'***': '*',
|
|
2884
|
-
'**/**': '**',
|
|
2885
|
-
'**/**/**': '**'
|
|
2886
|
-
},
|
|
2887
|
-
|
|
2888
|
-
// Digits
|
|
2889
|
-
CHAR_0: 48, /* 0 */
|
|
2890
|
-
CHAR_9: 57, /* 9 */
|
|
2891
|
-
|
|
2892
|
-
// Alphabet chars.
|
|
2893
|
-
CHAR_UPPERCASE_A: 65, /* A */
|
|
2894
|
-
CHAR_LOWERCASE_A: 97, /* a */
|
|
2895
|
-
CHAR_UPPERCASE_Z: 90, /* Z */
|
|
2896
|
-
CHAR_LOWERCASE_Z: 122, /* z */
|
|
2897
|
-
|
|
2898
|
-
CHAR_LEFT_PARENTHESES: 40, /* ( */
|
|
2899
|
-
CHAR_RIGHT_PARENTHESES: 41, /* ) */
|
|
2900
|
-
|
|
2901
|
-
CHAR_ASTERISK: 42, /* * */
|
|
2902
|
-
|
|
2903
|
-
// Non-alphabetic chars.
|
|
2904
|
-
CHAR_AMPERSAND: 38, /* & */
|
|
2905
|
-
CHAR_AT: 64, /* @ */
|
|
2906
|
-
CHAR_BACKWARD_SLASH: 92, /* \ */
|
|
2907
|
-
CHAR_CARRIAGE_RETURN: 13, /* \r */
|
|
2908
|
-
CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
|
|
2909
|
-
CHAR_COLON: 58, /* : */
|
|
2910
|
-
CHAR_COMMA: 44, /* , */
|
|
2911
|
-
CHAR_DOT: 46, /* . */
|
|
2912
|
-
CHAR_DOUBLE_QUOTE: 34, /* " */
|
|
2913
|
-
CHAR_EQUAL: 61, /* = */
|
|
2914
|
-
CHAR_EXCLAMATION_MARK: 33, /* ! */
|
|
2915
|
-
CHAR_FORM_FEED: 12, /* \f */
|
|
2916
|
-
CHAR_FORWARD_SLASH: 47, /* / */
|
|
2917
|
-
CHAR_GRAVE_ACCENT: 96, /* ` */
|
|
2918
|
-
CHAR_HASH: 35, /* # */
|
|
2919
|
-
CHAR_HYPHEN_MINUS: 45, /* - */
|
|
2920
|
-
CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
|
|
2921
|
-
CHAR_LEFT_CURLY_BRACE: 123, /* { */
|
|
2922
|
-
CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
|
|
2923
|
-
CHAR_LINE_FEED: 10, /* \n */
|
|
2924
|
-
CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
|
|
2925
|
-
CHAR_PERCENT: 37, /* % */
|
|
2926
|
-
CHAR_PLUS: 43, /* + */
|
|
2927
|
-
CHAR_QUESTION_MARK: 63, /* ? */
|
|
2928
|
-
CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
|
|
2929
|
-
CHAR_RIGHT_CURLY_BRACE: 125, /* } */
|
|
2930
|
-
CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
|
|
2931
|
-
CHAR_SEMICOLON: 59, /* ; */
|
|
2932
|
-
CHAR_SINGLE_QUOTE: 39, /* ' */
|
|
2933
|
-
CHAR_SPACE: 32, /* */
|
|
2934
|
-
CHAR_TAB: 9, /* \t */
|
|
2935
|
-
CHAR_UNDERSCORE: 95, /* _ */
|
|
2936
|
-
CHAR_VERTICAL_LINE: 124, /* | */
|
|
2937
|
-
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
|
|
2938
|
-
|
|
2939
|
-
/**
|
|
2940
|
-
* Create EXTGLOB_CHARS
|
|
2941
|
-
*/
|
|
2942
|
-
|
|
2943
|
-
extglobChars(chars) {
|
|
2944
|
-
return {
|
|
2945
|
-
'!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
|
|
2946
|
-
'?': { type: 'qmark', open: '(?:', close: ')?' },
|
|
2947
|
-
'+': { type: 'plus', open: '(?:', close: ')+' },
|
|
2948
|
-
'*': { type: 'star', open: '(?:', close: ')*' },
|
|
2949
|
-
'@': { type: 'at', open: '(?:', close: ')' }
|
|
2950
|
-
};
|
|
2951
|
-
},
|
|
2952
|
-
|
|
2953
|
-
/**
|
|
2954
|
-
* Create GLOB_CHARS
|
|
2955
|
-
*/
|
|
2956
|
-
|
|
2957
|
-
globChars(win32) {
|
|
2958
|
-
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
2959
|
-
}
|
|
2960
|
-
};
|
|
2961
|
-
|
|
2962
|
-
(function (exports) {
|
|
2963
|
-
|
|
2964
|
-
const {
|
|
2965
|
-
REGEX_BACKSLASH,
|
|
2966
|
-
REGEX_REMOVE_BACKSLASH,
|
|
2967
|
-
REGEX_SPECIAL_CHARS,
|
|
2968
|
-
REGEX_SPECIAL_CHARS_GLOBAL
|
|
2969
|
-
} = constants$2;
|
|
2970
|
-
|
|
2971
|
-
exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
|
2972
|
-
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
|
|
2973
|
-
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
|
|
2974
|
-
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
|
2975
|
-
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
|
|
2976
|
-
|
|
2977
|
-
exports.removeBackslashes = str => {
|
|
2978
|
-
return str.replace(REGEX_REMOVE_BACKSLASH, match => {
|
|
2979
|
-
return match === '\\' ? '' : match;
|
|
2980
|
-
});
|
|
2785
|
+
var utils = {};
|
|
2786
|
+
|
|
2787
|
+
var constants;
|
|
2788
|
+
var hasRequiredConstants;
|
|
2789
|
+
|
|
2790
|
+
function requireConstants () {
|
|
2791
|
+
if (hasRequiredConstants) return constants;
|
|
2792
|
+
hasRequiredConstants = 1;
|
|
2793
|
+
|
|
2794
|
+
const WIN_SLASH = '\\\\/';
|
|
2795
|
+
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
2796
|
+
|
|
2797
|
+
/**
|
|
2798
|
+
* Posix glob regex
|
|
2799
|
+
*/
|
|
2800
|
+
|
|
2801
|
+
const DOT_LITERAL = '\\.';
|
|
2802
|
+
const PLUS_LITERAL = '\\+';
|
|
2803
|
+
const QMARK_LITERAL = '\\?';
|
|
2804
|
+
const SLASH_LITERAL = '\\/';
|
|
2805
|
+
const ONE_CHAR = '(?=.)';
|
|
2806
|
+
const QMARK = '[^/]';
|
|
2807
|
+
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
2808
|
+
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
2809
|
+
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
2810
|
+
const NO_DOT = `(?!${DOT_LITERAL})`;
|
|
2811
|
+
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
2812
|
+
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
2813
|
+
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
2814
|
+
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
2815
|
+
const STAR = `${QMARK}*?`;
|
|
2816
|
+
const SEP = '/';
|
|
2817
|
+
|
|
2818
|
+
const POSIX_CHARS = {
|
|
2819
|
+
DOT_LITERAL,
|
|
2820
|
+
PLUS_LITERAL,
|
|
2821
|
+
QMARK_LITERAL,
|
|
2822
|
+
SLASH_LITERAL,
|
|
2823
|
+
ONE_CHAR,
|
|
2824
|
+
QMARK,
|
|
2825
|
+
END_ANCHOR,
|
|
2826
|
+
DOTS_SLASH,
|
|
2827
|
+
NO_DOT,
|
|
2828
|
+
NO_DOTS,
|
|
2829
|
+
NO_DOT_SLASH,
|
|
2830
|
+
NO_DOTS_SLASH,
|
|
2831
|
+
QMARK_NO_DOT,
|
|
2832
|
+
STAR,
|
|
2833
|
+
START_ANCHOR,
|
|
2834
|
+
SEP
|
|
2981
2835
|
};
|
|
2982
2836
|
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2837
|
+
/**
|
|
2838
|
+
* Windows glob regex
|
|
2839
|
+
*/
|
|
2840
|
+
|
|
2841
|
+
const WINDOWS_CHARS = {
|
|
2842
|
+
...POSIX_CHARS,
|
|
2843
|
+
|
|
2844
|
+
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
2845
|
+
QMARK: WIN_NO_SLASH,
|
|
2846
|
+
STAR: `${WIN_NO_SLASH}*?`,
|
|
2847
|
+
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
2848
|
+
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
2849
|
+
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
2850
|
+
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
2851
|
+
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
2852
|
+
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
2853
|
+
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
2854
|
+
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
|
|
2855
|
+
SEP: '\\'
|
|
2989
2856
|
};
|
|
2990
2857
|
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2858
|
+
/**
|
|
2859
|
+
* POSIX Bracket Regex
|
|
2860
|
+
*/
|
|
2861
|
+
|
|
2862
|
+
const POSIX_REGEX_SOURCE = {
|
|
2863
|
+
alnum: 'a-zA-Z0-9',
|
|
2864
|
+
alpha: 'a-zA-Z',
|
|
2865
|
+
ascii: '\\x00-\\x7F',
|
|
2866
|
+
blank: ' \\t',
|
|
2867
|
+
cntrl: '\\x00-\\x1F\\x7F',
|
|
2868
|
+
digit: '0-9',
|
|
2869
|
+
graph: '\\x21-\\x7E',
|
|
2870
|
+
lower: 'a-z',
|
|
2871
|
+
print: '\\x20-\\x7E ',
|
|
2872
|
+
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
|
|
2873
|
+
space: ' \\t\\r\\n\\v\\f',
|
|
2874
|
+
upper: 'A-Z',
|
|
2875
|
+
word: 'A-Za-z0-9_',
|
|
2876
|
+
xdigit: 'A-Fa-f0-9'
|
|
2996
2877
|
};
|
|
2997
2878
|
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
2879
|
+
constants = {
|
|
2880
|
+
MAX_LENGTH: 1024 * 64,
|
|
2881
|
+
POSIX_REGEX_SOURCE,
|
|
2882
|
+
|
|
2883
|
+
// regular expressions
|
|
2884
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
2885
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
2886
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
2887
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
2888
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
2889
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
2890
|
+
|
|
2891
|
+
// Replace globs with equivalent patterns to reduce parsing time.
|
|
2892
|
+
REPLACEMENTS: {
|
|
2893
|
+
'***': '*',
|
|
2894
|
+
'**/**': '**',
|
|
2895
|
+
'**/**/**': '**'
|
|
2896
|
+
},
|
|
2897
|
+
|
|
2898
|
+
// Digits
|
|
2899
|
+
CHAR_0: 48, /* 0 */
|
|
2900
|
+
CHAR_9: 57, /* 9 */
|
|
2901
|
+
|
|
2902
|
+
// Alphabet chars.
|
|
2903
|
+
CHAR_UPPERCASE_A: 65, /* A */
|
|
2904
|
+
CHAR_LOWERCASE_A: 97, /* a */
|
|
2905
|
+
CHAR_UPPERCASE_Z: 90, /* Z */
|
|
2906
|
+
CHAR_LOWERCASE_Z: 122, /* z */
|
|
2907
|
+
|
|
2908
|
+
CHAR_LEFT_PARENTHESES: 40, /* ( */
|
|
2909
|
+
CHAR_RIGHT_PARENTHESES: 41, /* ) */
|
|
2910
|
+
|
|
2911
|
+
CHAR_ASTERISK: 42, /* * */
|
|
2912
|
+
|
|
2913
|
+
// Non-alphabetic chars.
|
|
2914
|
+
CHAR_AMPERSAND: 38, /* & */
|
|
2915
|
+
CHAR_AT: 64, /* @ */
|
|
2916
|
+
CHAR_BACKWARD_SLASH: 92, /* \ */
|
|
2917
|
+
CHAR_CARRIAGE_RETURN: 13, /* \r */
|
|
2918
|
+
CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
|
|
2919
|
+
CHAR_COLON: 58, /* : */
|
|
2920
|
+
CHAR_COMMA: 44, /* , */
|
|
2921
|
+
CHAR_DOT: 46, /* . */
|
|
2922
|
+
CHAR_DOUBLE_QUOTE: 34, /* " */
|
|
2923
|
+
CHAR_EQUAL: 61, /* = */
|
|
2924
|
+
CHAR_EXCLAMATION_MARK: 33, /* ! */
|
|
2925
|
+
CHAR_FORM_FEED: 12, /* \f */
|
|
2926
|
+
CHAR_FORWARD_SLASH: 47, /* / */
|
|
2927
|
+
CHAR_GRAVE_ACCENT: 96, /* ` */
|
|
2928
|
+
CHAR_HASH: 35, /* # */
|
|
2929
|
+
CHAR_HYPHEN_MINUS: 45, /* - */
|
|
2930
|
+
CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
|
|
2931
|
+
CHAR_LEFT_CURLY_BRACE: 123, /* { */
|
|
2932
|
+
CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
|
|
2933
|
+
CHAR_LINE_FEED: 10, /* \n */
|
|
2934
|
+
CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
|
|
2935
|
+
CHAR_PERCENT: 37, /* % */
|
|
2936
|
+
CHAR_PLUS: 43, /* + */
|
|
2937
|
+
CHAR_QUESTION_MARK: 63, /* ? */
|
|
2938
|
+
CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
|
|
2939
|
+
CHAR_RIGHT_CURLY_BRACE: 125, /* } */
|
|
2940
|
+
CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
|
|
2941
|
+
CHAR_SEMICOLON: 59, /* ; */
|
|
2942
|
+
CHAR_SINGLE_QUOTE: 39, /* ' */
|
|
2943
|
+
CHAR_SPACE: 32, /* */
|
|
2944
|
+
CHAR_TAB: 9, /* \t */
|
|
2945
|
+
CHAR_UNDERSCORE: 95, /* _ */
|
|
2946
|
+
CHAR_VERTICAL_LINE: 124, /* | */
|
|
2947
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
|
|
2948
|
+
|
|
2949
|
+
/**
|
|
2950
|
+
* Create EXTGLOB_CHARS
|
|
2951
|
+
*/
|
|
2952
|
+
|
|
2953
|
+
extglobChars(chars) {
|
|
2954
|
+
return {
|
|
2955
|
+
'!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
|
|
2956
|
+
'?': { type: 'qmark', open: '(?:', close: ')?' },
|
|
2957
|
+
'+': { type: 'plus', open: '(?:', close: ')+' },
|
|
2958
|
+
'*': { type: 'star', open: '(?:', close: ')*' },
|
|
2959
|
+
'@': { type: 'at', open: '(?:', close: ')' }
|
|
2960
|
+
};
|
|
2961
|
+
},
|
|
2962
|
+
|
|
2963
|
+
/**
|
|
2964
|
+
* Create GLOB_CHARS
|
|
2965
|
+
*/
|
|
2966
|
+
|
|
2967
|
+
globChars(win32) {
|
|
2968
|
+
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
3003
2969
|
}
|
|
3004
|
-
|
|
2970
|
+
};
|
|
2971
|
+
return constants;
|
|
2972
|
+
}
|
|
2973
|
+
|
|
2974
|
+
/*global navigator*/
|
|
2975
|
+
|
|
2976
|
+
var hasRequiredUtils;
|
|
2977
|
+
|
|
2978
|
+
function requireUtils () {
|
|
2979
|
+
if (hasRequiredUtils) return utils;
|
|
2980
|
+
hasRequiredUtils = 1;
|
|
2981
|
+
(function (exports) {
|
|
2982
|
+
|
|
2983
|
+
const {
|
|
2984
|
+
REGEX_BACKSLASH,
|
|
2985
|
+
REGEX_REMOVE_BACKSLASH,
|
|
2986
|
+
REGEX_SPECIAL_CHARS,
|
|
2987
|
+
REGEX_SPECIAL_CHARS_GLOBAL
|
|
2988
|
+
} = /*@__PURE__*/ requireConstants();
|
|
2989
|
+
|
|
2990
|
+
exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
|
2991
|
+
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
|
|
2992
|
+
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
|
|
2993
|
+
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
|
2994
|
+
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
|
|
2995
|
+
|
|
2996
|
+
exports.isWindows = () => {
|
|
2997
|
+
if (typeof navigator !== 'undefined' && navigator.platform) {
|
|
2998
|
+
const platform = navigator.platform.toLowerCase();
|
|
2999
|
+
return platform === 'win32' || platform === 'windows';
|
|
3000
|
+
}
|
|
3001
|
+
|
|
3002
|
+
if (typeof process !== 'undefined' && process.platform) {
|
|
3003
|
+
return process.platform === 'win32';
|
|
3004
|
+
}
|
|
3005
|
+
|
|
3006
|
+
return false;
|
|
3007
|
+
};
|
|
3008
|
+
|
|
3009
|
+
exports.removeBackslashes = str => {
|
|
3010
|
+
return str.replace(REGEX_REMOVE_BACKSLASH, match => {
|
|
3011
|
+
return match === '\\' ? '' : match;
|
|
3012
|
+
});
|
|
3013
|
+
};
|
|
3014
|
+
|
|
3015
|
+
exports.escapeLast = (input, char, lastIdx) => {
|
|
3016
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
3017
|
+
if (idx === -1) return input;
|
|
3018
|
+
if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
|
|
3019
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
3020
|
+
};
|
|
3021
|
+
|
|
3022
|
+
exports.removePrefix = (input, state = {}) => {
|
|
3023
|
+
let output = input;
|
|
3024
|
+
if (output.startsWith('./')) {
|
|
3025
|
+
output = output.slice(2);
|
|
3026
|
+
state.prefix = './';
|
|
3027
|
+
}
|
|
3028
|
+
return output;
|
|
3029
|
+
};
|
|
3030
|
+
|
|
3031
|
+
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
3032
|
+
const prepend = options.contains ? '' : '^';
|
|
3033
|
+
const append = options.contains ? '' : '$';
|
|
3034
|
+
|
|
3035
|
+
let output = `${prepend}(?:${input})${append}`;
|
|
3036
|
+
if (state.negated === true) {
|
|
3037
|
+
output = `(?:^(?!${output}).*$)`;
|
|
3038
|
+
}
|
|
3039
|
+
return output;
|
|
3040
|
+
};
|
|
3041
|
+
|
|
3042
|
+
exports.basename = (path, { windows } = {}) => {
|
|
3043
|
+
const segs = path.split(windows ? /[\\/]/ : '/');
|
|
3044
|
+
const last = segs[segs.length - 1];
|
|
3045
|
+
|
|
3046
|
+
if (last === '') {
|
|
3047
|
+
return segs[segs.length - 2];
|
|
3048
|
+
}
|
|
3049
|
+
|
|
3050
|
+
return last;
|
|
3051
|
+
};
|
|
3052
|
+
} (utils));
|
|
3053
|
+
return utils;
|
|
3054
|
+
}
|
|
3055
|
+
|
|
3056
|
+
var scan_1;
|
|
3057
|
+
var hasRequiredScan;
|
|
3058
|
+
|
|
3059
|
+
function requireScan () {
|
|
3060
|
+
if (hasRequiredScan) return scan_1;
|
|
3061
|
+
hasRequiredScan = 1;
|
|
3062
|
+
|
|
3063
|
+
const utils = /*@__PURE__*/ requireUtils();
|
|
3064
|
+
const {
|
|
3065
|
+
CHAR_ASTERISK, /* * */
|
|
3066
|
+
CHAR_AT, /* @ */
|
|
3067
|
+
CHAR_BACKWARD_SLASH, /* \ */
|
|
3068
|
+
CHAR_COMMA, /* , */
|
|
3069
|
+
CHAR_DOT, /* . */
|
|
3070
|
+
CHAR_EXCLAMATION_MARK, /* ! */
|
|
3071
|
+
CHAR_FORWARD_SLASH, /* / */
|
|
3072
|
+
CHAR_LEFT_CURLY_BRACE, /* { */
|
|
3073
|
+
CHAR_LEFT_PARENTHESES, /* ( */
|
|
3074
|
+
CHAR_LEFT_SQUARE_BRACKET, /* [ */
|
|
3075
|
+
CHAR_PLUS, /* + */
|
|
3076
|
+
CHAR_QUESTION_MARK, /* ? */
|
|
3077
|
+
CHAR_RIGHT_CURLY_BRACE, /* } */
|
|
3078
|
+
CHAR_RIGHT_PARENTHESES, /* ) */
|
|
3079
|
+
CHAR_RIGHT_SQUARE_BRACKET /* ] */
|
|
3080
|
+
} = /*@__PURE__*/ requireConstants();
|
|
3081
|
+
|
|
3082
|
+
const isPathSeparator = code => {
|
|
3083
|
+
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
3005
3084
|
};
|
|
3006
3085
|
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
let output = `${prepend}(?:${input})${append}`;
|
|
3012
|
-
if (state.negated === true) {
|
|
3013
|
-
output = `(?:^(?!${output}).*$)`;
|
|
3086
|
+
const depth = token => {
|
|
3087
|
+
if (token.isPrefix !== true) {
|
|
3088
|
+
token.depth = token.isGlobstar ? Infinity : 1;
|
|
3014
3089
|
}
|
|
3015
|
-
return output;
|
|
3016
3090
|
};
|
|
3017
3091
|
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3092
|
+
/**
|
|
3093
|
+
* Quickly scans a glob pattern and returns an object with a handful of
|
|
3094
|
+
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
|
|
3095
|
+
* `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
|
|
3096
|
+
* with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
|
|
3097
|
+
*
|
|
3098
|
+
* ```js
|
|
3099
|
+
* const pm = require('picomatch');
|
|
3100
|
+
* console.log(pm.scan('foo/bar/*.js'));
|
|
3101
|
+
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
|
|
3102
|
+
* ```
|
|
3103
|
+
* @param {String} `str`
|
|
3104
|
+
* @param {Object} `options`
|
|
3105
|
+
* @return {Object} Returns an object with tokens and regex source string.
|
|
3106
|
+
* @api public
|
|
3107
|
+
*/
|
|
3108
|
+
|
|
3109
|
+
const scan = (input, options) => {
|
|
3110
|
+
const opts = options || {};
|
|
3111
|
+
|
|
3112
|
+
const length = input.length - 1;
|
|
3113
|
+
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
3114
|
+
const slashes = [];
|
|
3115
|
+
const tokens = [];
|
|
3116
|
+
const parts = [];
|
|
3117
|
+
|
|
3118
|
+
let str = input;
|
|
3119
|
+
let index = -1;
|
|
3120
|
+
let start = 0;
|
|
3121
|
+
let lastIndex = 0;
|
|
3122
|
+
let isBrace = false;
|
|
3123
|
+
let isBracket = false;
|
|
3124
|
+
let isGlob = false;
|
|
3125
|
+
let isExtglob = false;
|
|
3126
|
+
let isGlobstar = false;
|
|
3127
|
+
let braceEscaped = false;
|
|
3128
|
+
let backslashes = false;
|
|
3129
|
+
let negated = false;
|
|
3130
|
+
let negatedExtglob = false;
|
|
3131
|
+
let finished = false;
|
|
3132
|
+
let braces = 0;
|
|
3133
|
+
let prev;
|
|
3134
|
+
let code;
|
|
3135
|
+
let token = { value: '', depth: 0, isGlob: false };
|
|
3136
|
+
|
|
3137
|
+
const eos = () => index >= length;
|
|
3138
|
+
const peek = () => str.charCodeAt(index + 1);
|
|
3139
|
+
const advance = () => {
|
|
3140
|
+
prev = code;
|
|
3141
|
+
return str.charCodeAt(++index);
|
|
3142
|
+
};
|
|
3143
|
+
|
|
3144
|
+
while (index < length) {
|
|
3145
|
+
code = advance();
|
|
3146
|
+
let next;
|
|
3147
|
+
|
|
3148
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
3149
|
+
backslashes = token.backslashes = true;
|
|
3150
|
+
code = advance();
|
|
3151
|
+
|
|
3152
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
3153
|
+
braceEscaped = true;
|
|
3154
|
+
}
|
|
3155
|
+
continue;
|
|
3156
|
+
}
|
|
3157
|
+
|
|
3158
|
+
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
3159
|
+
braces++;
|
|
3160
|
+
|
|
3161
|
+
while (eos() !== true && (code = advance())) {
|
|
3162
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
3163
|
+
backslashes = token.backslashes = true;
|
|
3164
|
+
advance();
|
|
3165
|
+
continue;
|
|
3166
|
+
}
|
|
3167
|
+
|
|
3168
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
3169
|
+
braces++;
|
|
3170
|
+
continue;
|
|
3171
|
+
}
|
|
3172
|
+
|
|
3173
|
+
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
3174
|
+
isBrace = token.isBrace = true;
|
|
3175
|
+
isGlob = token.isGlob = true;
|
|
3176
|
+
finished = true;
|
|
3177
|
+
|
|
3178
|
+
if (scanToEnd === true) {
|
|
3179
|
+
continue;
|
|
3180
|
+
}
|
|
3181
|
+
|
|
3182
|
+
break;
|
|
3183
|
+
}
|
|
3184
|
+
|
|
3185
|
+
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
3186
|
+
isBrace = token.isBrace = true;
|
|
3187
|
+
isGlob = token.isGlob = true;
|
|
3188
|
+
finished = true;
|
|
3189
|
+
|
|
3190
|
+
if (scanToEnd === true) {
|
|
3191
|
+
continue;
|
|
3192
|
+
}
|
|
3193
|
+
|
|
3194
|
+
break;
|
|
3195
|
+
}
|
|
3196
|
+
|
|
3197
|
+
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
3198
|
+
braces--;
|
|
3199
|
+
|
|
3200
|
+
if (braces === 0) {
|
|
3201
|
+
braceEscaped = false;
|
|
3202
|
+
isBrace = token.isBrace = true;
|
|
3203
|
+
finished = true;
|
|
3204
|
+
break;
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
|
|
3209
|
+
if (scanToEnd === true) {
|
|
3210
|
+
continue;
|
|
3211
|
+
}
|
|
3212
|
+
|
|
3213
|
+
break;
|
|
3214
|
+
}
|
|
3215
|
+
|
|
3216
|
+
if (code === CHAR_FORWARD_SLASH) {
|
|
3217
|
+
slashes.push(index);
|
|
3218
|
+
tokens.push(token);
|
|
3219
|
+
token = { value: '', depth: 0, isGlob: false };
|
|
3220
|
+
|
|
3221
|
+
if (finished === true) continue;
|
|
3222
|
+
if (prev === CHAR_DOT && index === (start + 1)) {
|
|
3223
|
+
start += 2;
|
|
3224
|
+
continue;
|
|
3225
|
+
}
|
|
3226
|
+
|
|
3227
|
+
lastIndex = index + 1;
|
|
3228
|
+
continue;
|
|
3229
|
+
}
|
|
3230
|
+
|
|
3231
|
+
if (opts.noext !== true) {
|
|
3232
|
+
const isExtglobChar = code === CHAR_PLUS
|
|
3233
|
+
|| code === CHAR_AT
|
|
3234
|
+
|| code === CHAR_ASTERISK
|
|
3235
|
+
|| code === CHAR_QUESTION_MARK
|
|
3236
|
+
|| code === CHAR_EXCLAMATION_MARK;
|
|
3237
|
+
|
|
3238
|
+
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
3239
|
+
isGlob = token.isGlob = true;
|
|
3240
|
+
isExtglob = token.isExtglob = true;
|
|
3241
|
+
finished = true;
|
|
3242
|
+
if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
3243
|
+
negatedExtglob = true;
|
|
3244
|
+
}
|
|
3245
|
+
|
|
3246
|
+
if (scanToEnd === true) {
|
|
3247
|
+
while (eos() !== true && (code = advance())) {
|
|
3248
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
3249
|
+
backslashes = token.backslashes = true;
|
|
3250
|
+
code = advance();
|
|
3251
|
+
continue;
|
|
3252
|
+
}
|
|
3253
|
+
|
|
3254
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
3255
|
+
isGlob = token.isGlob = true;
|
|
3256
|
+
finished = true;
|
|
3257
|
+
break;
|
|
3258
|
+
}
|
|
3259
|
+
}
|
|
3260
|
+
continue;
|
|
3261
|
+
}
|
|
3262
|
+
break;
|
|
3263
|
+
}
|
|
3264
|
+
}
|
|
3265
|
+
|
|
3266
|
+
if (code === CHAR_ASTERISK) {
|
|
3267
|
+
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
3268
|
+
isGlob = token.isGlob = true;
|
|
3269
|
+
finished = true;
|
|
3270
|
+
|
|
3271
|
+
if (scanToEnd === true) {
|
|
3272
|
+
continue;
|
|
3273
|
+
}
|
|
3274
|
+
break;
|
|
3275
|
+
}
|
|
3276
|
+
|
|
3277
|
+
if (code === CHAR_QUESTION_MARK) {
|
|
3278
|
+
isGlob = token.isGlob = true;
|
|
3279
|
+
finished = true;
|
|
3280
|
+
|
|
3281
|
+
if (scanToEnd === true) {
|
|
3282
|
+
continue;
|
|
3283
|
+
}
|
|
3284
|
+
break;
|
|
3285
|
+
}
|
|
3286
|
+
|
|
3287
|
+
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
3288
|
+
while (eos() !== true && (next = advance())) {
|
|
3289
|
+
if (next === CHAR_BACKWARD_SLASH) {
|
|
3290
|
+
backslashes = token.backslashes = true;
|
|
3291
|
+
advance();
|
|
3292
|
+
continue;
|
|
3293
|
+
}
|
|
3294
|
+
|
|
3295
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
3296
|
+
isBracket = token.isBracket = true;
|
|
3297
|
+
isGlob = token.isGlob = true;
|
|
3298
|
+
finished = true;
|
|
3299
|
+
break;
|
|
3300
|
+
}
|
|
3301
|
+
}
|
|
3302
|
+
|
|
3303
|
+
if (scanToEnd === true) {
|
|
3304
|
+
continue;
|
|
3305
|
+
}
|
|
3306
|
+
|
|
3307
|
+
break;
|
|
3308
|
+
}
|
|
3309
|
+
|
|
3310
|
+
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
3311
|
+
negated = token.negated = true;
|
|
3312
|
+
start++;
|
|
3313
|
+
continue;
|
|
3314
|
+
}
|
|
3315
|
+
|
|
3316
|
+
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
3317
|
+
isGlob = token.isGlob = true;
|
|
3318
|
+
|
|
3319
|
+
if (scanToEnd === true) {
|
|
3320
|
+
while (eos() !== true && (code = advance())) {
|
|
3321
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
3322
|
+
backslashes = token.backslashes = true;
|
|
3323
|
+
code = advance();
|
|
3324
|
+
continue;
|
|
3325
|
+
}
|
|
3326
|
+
|
|
3327
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
3328
|
+
finished = true;
|
|
3329
|
+
break;
|
|
3330
|
+
}
|
|
3331
|
+
}
|
|
3332
|
+
continue;
|
|
3333
|
+
}
|
|
3334
|
+
break;
|
|
3335
|
+
}
|
|
3336
|
+
|
|
3337
|
+
if (isGlob === true) {
|
|
3338
|
+
finished = true;
|
|
3339
|
+
|
|
3340
|
+
if (scanToEnd === true) {
|
|
3341
|
+
continue;
|
|
3342
|
+
}
|
|
3343
|
+
|
|
3344
|
+
break;
|
|
3345
|
+
}
|
|
3023
3346
|
}
|
|
3024
|
-
};
|
|
3025
|
-
} (utils$3));
|
|
3026
|
-
|
|
3027
|
-
const utils$2 = utils$3;
|
|
3028
|
-
const {
|
|
3029
|
-
CHAR_ASTERISK, /* * */
|
|
3030
|
-
CHAR_AT, /* @ */
|
|
3031
|
-
CHAR_BACKWARD_SLASH, /* \ */
|
|
3032
|
-
CHAR_COMMA, /* , */
|
|
3033
|
-
CHAR_DOT, /* . */
|
|
3034
|
-
CHAR_EXCLAMATION_MARK, /* ! */
|
|
3035
|
-
CHAR_FORWARD_SLASH, /* / */
|
|
3036
|
-
CHAR_LEFT_CURLY_BRACE, /* { */
|
|
3037
|
-
CHAR_LEFT_PARENTHESES, /* ( */
|
|
3038
|
-
CHAR_LEFT_SQUARE_BRACKET, /* [ */
|
|
3039
|
-
CHAR_PLUS, /* + */
|
|
3040
|
-
CHAR_QUESTION_MARK, /* ? */
|
|
3041
|
-
CHAR_RIGHT_CURLY_BRACE, /* } */
|
|
3042
|
-
CHAR_RIGHT_PARENTHESES, /* ) */
|
|
3043
|
-
CHAR_RIGHT_SQUARE_BRACKET /* ] */
|
|
3044
|
-
} = constants$2;
|
|
3045
|
-
|
|
3046
|
-
const isPathSeparator = code => {
|
|
3047
|
-
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
3048
|
-
};
|
|
3049
|
-
|
|
3050
|
-
const depth = token => {
|
|
3051
|
-
if (token.isPrefix !== true) {
|
|
3052
|
-
token.depth = token.isGlobstar ? Infinity : 1;
|
|
3053
|
-
}
|
|
3054
|
-
};
|
|
3055
|
-
|
|
3056
|
-
/**
|
|
3057
|
-
* Quickly scans a glob pattern and returns an object with a handful of
|
|
3058
|
-
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
|
|
3059
|
-
* `glob` (the actual pattern), and `negated` (true if the path starts with `!`).
|
|
3060
|
-
*
|
|
3061
|
-
* ```js
|
|
3062
|
-
* const pm = require('picomatch');
|
|
3063
|
-
* console.log(pm.scan('foo/bar/*.js'));
|
|
3064
|
-
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
|
|
3065
|
-
* ```
|
|
3066
|
-
* @param {String} `str`
|
|
3067
|
-
* @param {Object} `options`
|
|
3068
|
-
* @return {Object} Returns an object with tokens and regex source string.
|
|
3069
|
-
* @api public
|
|
3070
|
-
*/
|
|
3071
|
-
|
|
3072
|
-
const scan$1 = (input, options) => {
|
|
3073
|
-
const opts = options || {};
|
|
3074
|
-
|
|
3075
|
-
const length = input.length - 1;
|
|
3076
|
-
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
3077
|
-
const slashes = [];
|
|
3078
|
-
const tokens = [];
|
|
3079
|
-
const parts = [];
|
|
3080
|
-
|
|
3081
|
-
let str = input;
|
|
3082
|
-
let index = -1;
|
|
3083
|
-
let start = 0;
|
|
3084
|
-
let lastIndex = 0;
|
|
3085
|
-
let isBrace = false;
|
|
3086
|
-
let isBracket = false;
|
|
3087
|
-
let isGlob = false;
|
|
3088
|
-
let isExtglob = false;
|
|
3089
|
-
let isGlobstar = false;
|
|
3090
|
-
let braceEscaped = false;
|
|
3091
|
-
let backslashes = false;
|
|
3092
|
-
let negated = false;
|
|
3093
|
-
let finished = false;
|
|
3094
|
-
let braces = 0;
|
|
3095
|
-
let prev;
|
|
3096
|
-
let code;
|
|
3097
|
-
let token = { value: '', depth: 0, isGlob: false };
|
|
3098
|
-
|
|
3099
|
-
const eos = () => index >= length;
|
|
3100
|
-
const peek = () => str.charCodeAt(index + 1);
|
|
3101
|
-
const advance = () => {
|
|
3102
|
-
prev = code;
|
|
3103
|
-
return str.charCodeAt(++index);
|
|
3104
|
-
};
|
|
3105
|
-
|
|
3106
|
-
while (index < length) {
|
|
3107
|
-
code = advance();
|
|
3108
|
-
let next;
|
|
3109
|
-
|
|
3110
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
3111
|
-
backslashes = token.backslashes = true;
|
|
3112
|
-
code = advance();
|
|
3113
|
-
|
|
3114
|
-
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
3115
|
-
braceEscaped = true;
|
|
3116
|
-
}
|
|
3117
|
-
continue;
|
|
3118
|
-
}
|
|
3119
|
-
|
|
3120
|
-
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
3121
|
-
braces++;
|
|
3122
|
-
|
|
3123
|
-
while (eos() !== true && (code = advance())) {
|
|
3124
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
3125
|
-
backslashes = token.backslashes = true;
|
|
3126
|
-
advance();
|
|
3127
|
-
continue;
|
|
3128
|
-
}
|
|
3129
|
-
|
|
3130
|
-
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
3131
|
-
braces++;
|
|
3132
|
-
continue;
|
|
3133
|
-
}
|
|
3134
|
-
|
|
3135
|
-
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
3136
|
-
isBrace = token.isBrace = true;
|
|
3137
|
-
isGlob = token.isGlob = true;
|
|
3138
|
-
finished = true;
|
|
3139
|
-
|
|
3140
|
-
if (scanToEnd === true) {
|
|
3141
|
-
continue;
|
|
3142
|
-
}
|
|
3143
|
-
|
|
3144
|
-
break;
|
|
3145
|
-
}
|
|
3146
|
-
|
|
3147
|
-
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
3148
|
-
isBrace = token.isBrace = true;
|
|
3149
|
-
isGlob = token.isGlob = true;
|
|
3150
|
-
finished = true;
|
|
3151
|
-
|
|
3152
|
-
if (scanToEnd === true) {
|
|
3153
|
-
continue;
|
|
3154
|
-
}
|
|
3155
|
-
|
|
3156
|
-
break;
|
|
3157
|
-
}
|
|
3158
|
-
|
|
3159
|
-
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
3160
|
-
braces--;
|
|
3161
|
-
|
|
3162
|
-
if (braces === 0) {
|
|
3163
|
-
braceEscaped = false;
|
|
3164
|
-
isBrace = token.isBrace = true;
|
|
3165
|
-
finished = true;
|
|
3166
|
-
break;
|
|
3167
|
-
}
|
|
3168
|
-
}
|
|
3169
|
-
}
|
|
3170
|
-
|
|
3171
|
-
if (scanToEnd === true) {
|
|
3172
|
-
continue;
|
|
3173
|
-
}
|
|
3174
|
-
|
|
3175
|
-
break;
|
|
3176
|
-
}
|
|
3177
|
-
|
|
3178
|
-
if (code === CHAR_FORWARD_SLASH) {
|
|
3179
|
-
slashes.push(index);
|
|
3180
|
-
tokens.push(token);
|
|
3181
|
-
token = { value: '', depth: 0, isGlob: false };
|
|
3182
3347
|
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
}
|
|
3188
|
-
|
|
3189
|
-
lastIndex = index + 1;
|
|
3190
|
-
continue;
|
|
3191
|
-
}
|
|
3192
|
-
|
|
3193
|
-
if (opts.noext !== true) {
|
|
3194
|
-
const isExtglobChar = code === CHAR_PLUS
|
|
3195
|
-
|| code === CHAR_AT
|
|
3196
|
-
|| code === CHAR_ASTERISK
|
|
3197
|
-
|| code === CHAR_QUESTION_MARK
|
|
3198
|
-
|| code === CHAR_EXCLAMATION_MARK;
|
|
3199
|
-
|
|
3200
|
-
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
3201
|
-
isGlob = token.isGlob = true;
|
|
3202
|
-
isExtglob = token.isExtglob = true;
|
|
3203
|
-
finished = true;
|
|
3204
|
-
|
|
3205
|
-
if (scanToEnd === true) {
|
|
3206
|
-
while (eos() !== true && (code = advance())) {
|
|
3207
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
3208
|
-
backslashes = token.backslashes = true;
|
|
3209
|
-
code = advance();
|
|
3210
|
-
continue;
|
|
3211
|
-
}
|
|
3212
|
-
|
|
3213
|
-
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
3214
|
-
isGlob = token.isGlob = true;
|
|
3215
|
-
finished = true;
|
|
3216
|
-
break;
|
|
3217
|
-
}
|
|
3218
|
-
}
|
|
3219
|
-
continue;
|
|
3220
|
-
}
|
|
3221
|
-
break;
|
|
3222
|
-
}
|
|
3223
|
-
}
|
|
3224
|
-
|
|
3225
|
-
if (code === CHAR_ASTERISK) {
|
|
3226
|
-
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
3227
|
-
isGlob = token.isGlob = true;
|
|
3228
|
-
finished = true;
|
|
3229
|
-
|
|
3230
|
-
if (scanToEnd === true) {
|
|
3231
|
-
continue;
|
|
3232
|
-
}
|
|
3233
|
-
break;
|
|
3234
|
-
}
|
|
3235
|
-
|
|
3236
|
-
if (code === CHAR_QUESTION_MARK) {
|
|
3237
|
-
isGlob = token.isGlob = true;
|
|
3238
|
-
finished = true;
|
|
3239
|
-
|
|
3240
|
-
if (scanToEnd === true) {
|
|
3241
|
-
continue;
|
|
3242
|
-
}
|
|
3243
|
-
break;
|
|
3244
|
-
}
|
|
3245
|
-
|
|
3246
|
-
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
3247
|
-
while (eos() !== true && (next = advance())) {
|
|
3248
|
-
if (next === CHAR_BACKWARD_SLASH) {
|
|
3249
|
-
backslashes = token.backslashes = true;
|
|
3250
|
-
advance();
|
|
3251
|
-
continue;
|
|
3252
|
-
}
|
|
3253
|
-
|
|
3254
|
-
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
3255
|
-
isBracket = token.isBracket = true;
|
|
3256
|
-
isGlob = token.isGlob = true;
|
|
3257
|
-
finished = true;
|
|
3258
|
-
|
|
3259
|
-
if (scanToEnd === true) {
|
|
3260
|
-
continue;
|
|
3261
|
-
}
|
|
3262
|
-
break;
|
|
3263
|
-
}
|
|
3264
|
-
}
|
|
3265
|
-
}
|
|
3266
|
-
|
|
3267
|
-
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
3268
|
-
negated = token.negated = true;
|
|
3269
|
-
start++;
|
|
3270
|
-
continue;
|
|
3271
|
-
}
|
|
3272
|
-
|
|
3273
|
-
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
3274
|
-
isGlob = token.isGlob = true;
|
|
3275
|
-
|
|
3276
|
-
if (scanToEnd === true) {
|
|
3277
|
-
while (eos() !== true && (code = advance())) {
|
|
3278
|
-
if (code === CHAR_LEFT_PARENTHESES) {
|
|
3279
|
-
backslashes = token.backslashes = true;
|
|
3280
|
-
code = advance();
|
|
3281
|
-
continue;
|
|
3282
|
-
}
|
|
3283
|
-
|
|
3284
|
-
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
3285
|
-
finished = true;
|
|
3286
|
-
break;
|
|
3287
|
-
}
|
|
3288
|
-
}
|
|
3289
|
-
continue;
|
|
3290
|
-
}
|
|
3291
|
-
break;
|
|
3292
|
-
}
|
|
3293
|
-
|
|
3294
|
-
if (isGlob === true) {
|
|
3295
|
-
finished = true;
|
|
3296
|
-
|
|
3297
|
-
if (scanToEnd === true) {
|
|
3298
|
-
continue;
|
|
3299
|
-
}
|
|
3348
|
+
if (opts.noext === true) {
|
|
3349
|
+
isExtglob = false;
|
|
3350
|
+
isGlob = false;
|
|
3351
|
+
}
|
|
3300
3352
|
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3353
|
+
let base = str;
|
|
3354
|
+
let prefix = '';
|
|
3355
|
+
let glob = '';
|
|
3304
3356
|
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3357
|
+
if (start > 0) {
|
|
3358
|
+
prefix = str.slice(0, start);
|
|
3359
|
+
str = str.slice(start);
|
|
3360
|
+
lastIndex -= start;
|
|
3361
|
+
}
|
|
3309
3362
|
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3363
|
+
if (base && isGlob === true && lastIndex > 0) {
|
|
3364
|
+
base = str.slice(0, lastIndex);
|
|
3365
|
+
glob = str.slice(lastIndex);
|
|
3366
|
+
} else if (isGlob === true) {
|
|
3367
|
+
base = '';
|
|
3368
|
+
glob = str;
|
|
3369
|
+
} else {
|
|
3370
|
+
base = str;
|
|
3371
|
+
}
|
|
3313
3372
|
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3373
|
+
if (base && base !== '' && base !== '/' && base !== str) {
|
|
3374
|
+
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
|
3375
|
+
base = base.slice(0, -1);
|
|
3376
|
+
}
|
|
3377
|
+
}
|
|
3319
3378
|
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
glob = str.slice(lastIndex);
|
|
3323
|
-
} else if (isGlob === true) {
|
|
3324
|
-
base = '';
|
|
3325
|
-
glob = str;
|
|
3326
|
-
} else {
|
|
3327
|
-
base = str;
|
|
3328
|
-
}
|
|
3379
|
+
if (opts.unescape === true) {
|
|
3380
|
+
if (glob) glob = utils.removeBackslashes(glob);
|
|
3329
3381
|
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
}
|
|
3382
|
+
if (base && backslashes === true) {
|
|
3383
|
+
base = utils.removeBackslashes(base);
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3335
3386
|
|
|
3336
|
-
|
|
3337
|
-
|
|
3387
|
+
const state = {
|
|
3388
|
+
prefix,
|
|
3389
|
+
input,
|
|
3390
|
+
start,
|
|
3391
|
+
base,
|
|
3392
|
+
glob,
|
|
3393
|
+
isBrace,
|
|
3394
|
+
isBracket,
|
|
3395
|
+
isGlob,
|
|
3396
|
+
isExtglob,
|
|
3397
|
+
isGlobstar,
|
|
3398
|
+
negated,
|
|
3399
|
+
negatedExtglob
|
|
3400
|
+
};
|
|
3401
|
+
|
|
3402
|
+
if (opts.tokens === true) {
|
|
3403
|
+
state.maxDepth = 0;
|
|
3404
|
+
if (!isPathSeparator(code)) {
|
|
3405
|
+
tokens.push(token);
|
|
3406
|
+
}
|
|
3407
|
+
state.tokens = tokens;
|
|
3408
|
+
}
|
|
3338
3409
|
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3410
|
+
if (opts.parts === true || opts.tokens === true) {
|
|
3411
|
+
let prevIndex;
|
|
3412
|
+
|
|
3413
|
+
for (let idx = 0; idx < slashes.length; idx++) {
|
|
3414
|
+
const n = prevIndex ? prevIndex + 1 : start;
|
|
3415
|
+
const i = slashes[idx];
|
|
3416
|
+
const value = input.slice(n, i);
|
|
3417
|
+
if (opts.tokens) {
|
|
3418
|
+
if (idx === 0 && start !== 0) {
|
|
3419
|
+
tokens[idx].isPrefix = true;
|
|
3420
|
+
tokens[idx].value = prefix;
|
|
3421
|
+
} else {
|
|
3422
|
+
tokens[idx].value = value;
|
|
3423
|
+
}
|
|
3424
|
+
depth(tokens[idx]);
|
|
3425
|
+
state.maxDepth += tokens[idx].depth;
|
|
3426
|
+
}
|
|
3427
|
+
if (idx !== 0 || value !== '') {
|
|
3428
|
+
parts.push(value);
|
|
3429
|
+
}
|
|
3430
|
+
prevIndex = i;
|
|
3431
|
+
}
|
|
3432
|
+
|
|
3433
|
+
if (prevIndex && prevIndex + 1 < input.length) {
|
|
3434
|
+
const value = input.slice(prevIndex + 1);
|
|
3435
|
+
parts.push(value);
|
|
3436
|
+
|
|
3437
|
+
if (opts.tokens) {
|
|
3438
|
+
tokens[tokens.length - 1].value = value;
|
|
3439
|
+
depth(tokens[tokens.length - 1]);
|
|
3440
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
3441
|
+
}
|
|
3442
|
+
}
|
|
3443
|
+
|
|
3444
|
+
state.slashes = slashes;
|
|
3445
|
+
state.parts = parts;
|
|
3446
|
+
}
|
|
3343
3447
|
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
input,
|
|
3347
|
-
start,
|
|
3348
|
-
base,
|
|
3349
|
-
glob,
|
|
3350
|
-
isBrace,
|
|
3351
|
-
isBracket,
|
|
3352
|
-
isGlob,
|
|
3353
|
-
isExtglob,
|
|
3354
|
-
isGlobstar,
|
|
3355
|
-
negated
|
|
3356
|
-
};
|
|
3448
|
+
return state;
|
|
3449
|
+
};
|
|
3357
3450
|
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
tokens.push(token);
|
|
3362
|
-
}
|
|
3363
|
-
state.tokens = tokens;
|
|
3364
|
-
}
|
|
3451
|
+
scan_1 = scan;
|
|
3452
|
+
return scan_1;
|
|
3453
|
+
}
|
|
3365
3454
|
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
for (let idx = 0; idx < slashes.length; idx++) {
|
|
3370
|
-
const n = prevIndex ? prevIndex + 1 : start;
|
|
3371
|
-
const i = slashes[idx];
|
|
3372
|
-
const value = input.slice(n, i);
|
|
3373
|
-
if (opts.tokens) {
|
|
3374
|
-
if (idx === 0 && start !== 0) {
|
|
3375
|
-
tokens[idx].isPrefix = true;
|
|
3376
|
-
tokens[idx].value = prefix;
|
|
3377
|
-
} else {
|
|
3378
|
-
tokens[idx].value = value;
|
|
3379
|
-
}
|
|
3380
|
-
depth(tokens[idx]);
|
|
3381
|
-
state.maxDepth += tokens[idx].depth;
|
|
3382
|
-
}
|
|
3383
|
-
if (idx !== 0 || value !== '') {
|
|
3384
|
-
parts.push(value);
|
|
3385
|
-
}
|
|
3386
|
-
prevIndex = i;
|
|
3387
|
-
}
|
|
3455
|
+
var parse_1;
|
|
3456
|
+
var hasRequiredParse;
|
|
3388
3457
|
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3458
|
+
function requireParse () {
|
|
3459
|
+
if (hasRequiredParse) return parse_1;
|
|
3460
|
+
hasRequiredParse = 1;
|
|
3392
3461
|
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
depth(tokens[tokens.length - 1]);
|
|
3396
|
-
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
3397
|
-
}
|
|
3398
|
-
}
|
|
3462
|
+
const constants = /*@__PURE__*/ requireConstants();
|
|
3463
|
+
const utils = /*@__PURE__*/ requireUtils();
|
|
3399
3464
|
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3465
|
+
/**
|
|
3466
|
+
* Constants
|
|
3467
|
+
*/
|
|
3403
3468
|
|
|
3404
|
-
|
|
3405
|
-
|
|
3469
|
+
const {
|
|
3470
|
+
MAX_LENGTH,
|
|
3471
|
+
POSIX_REGEX_SOURCE,
|
|
3472
|
+
REGEX_NON_SPECIAL_CHARS,
|
|
3473
|
+
REGEX_SPECIAL_CHARS_BACKREF,
|
|
3474
|
+
REPLACEMENTS
|
|
3475
|
+
} = constants;
|
|
3476
|
+
|
|
3477
|
+
/**
|
|
3478
|
+
* Helpers
|
|
3479
|
+
*/
|
|
3480
|
+
|
|
3481
|
+
const expandRange = (args, options) => {
|
|
3482
|
+
if (typeof options.expandRange === 'function') {
|
|
3483
|
+
return options.expandRange(...args, options);
|
|
3484
|
+
}
|
|
3406
3485
|
|
|
3407
|
-
|
|
3486
|
+
args.sort();
|
|
3487
|
+
const value = `[${args.join('-')}]`;
|
|
3408
3488
|
|
|
3409
|
-
|
|
3410
|
-
|
|
3489
|
+
try {
|
|
3490
|
+
/* eslint-disable-next-line no-new */
|
|
3491
|
+
new RegExp(value);
|
|
3492
|
+
} catch (ex) {
|
|
3493
|
+
return args.map(v => utils.escapeRegex(v)).join('..');
|
|
3494
|
+
}
|
|
3411
3495
|
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
*/
|
|
3496
|
+
return value;
|
|
3497
|
+
};
|
|
3415
3498
|
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
REGEX_NON_SPECIAL_CHARS,
|
|
3420
|
-
REGEX_SPECIAL_CHARS_BACKREF,
|
|
3421
|
-
REPLACEMENTS
|
|
3422
|
-
} = constants$1;
|
|
3499
|
+
/**
|
|
3500
|
+
* Create the message for a syntax error
|
|
3501
|
+
*/
|
|
3423
3502
|
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3503
|
+
const syntaxError = (type, char) => {
|
|
3504
|
+
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
3505
|
+
};
|
|
3427
3506
|
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3507
|
+
/**
|
|
3508
|
+
* Parse the given input string.
|
|
3509
|
+
* @param {String} input
|
|
3510
|
+
* @param {Object} options
|
|
3511
|
+
* @return {Object}
|
|
3512
|
+
*/
|
|
3432
3513
|
|
|
3433
|
-
|
|
3434
|
-
|
|
3514
|
+
const parse = (input, options) => {
|
|
3515
|
+
if (typeof input !== 'string') {
|
|
3516
|
+
throw new TypeError('Expected a string');
|
|
3517
|
+
}
|
|
3435
3518
|
|
|
3436
|
-
|
|
3437
|
-
/* eslint-disable-next-line no-new */
|
|
3438
|
-
new RegExp(value);
|
|
3439
|
-
} catch (ex) {
|
|
3440
|
-
return args.map(v => utils$1.escapeRegex(v)).join('..');
|
|
3441
|
-
}
|
|
3519
|
+
input = REPLACEMENTS[input] || input;
|
|
3442
3520
|
|
|
3443
|
-
|
|
3444
|
-
|
|
3521
|
+
const opts = { ...options };
|
|
3522
|
+
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
3445
3523
|
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3524
|
+
let len = input.length;
|
|
3525
|
+
if (len > max) {
|
|
3526
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
3527
|
+
}
|
|
3449
3528
|
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3529
|
+
const bos = { type: 'bos', value: '', output: opts.prepend || '' };
|
|
3530
|
+
const tokens = [bos];
|
|
3531
|
+
|
|
3532
|
+
const capture = opts.capture ? '' : '?:';
|
|
3533
|
+
|
|
3534
|
+
// create constants based on platform, for windows or posix
|
|
3535
|
+
const PLATFORM_CHARS = constants.globChars(opts.windows);
|
|
3536
|
+
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
|
|
3537
|
+
|
|
3538
|
+
const {
|
|
3539
|
+
DOT_LITERAL,
|
|
3540
|
+
PLUS_LITERAL,
|
|
3541
|
+
SLASH_LITERAL,
|
|
3542
|
+
ONE_CHAR,
|
|
3543
|
+
DOTS_SLASH,
|
|
3544
|
+
NO_DOT,
|
|
3545
|
+
NO_DOT_SLASH,
|
|
3546
|
+
NO_DOTS_SLASH,
|
|
3547
|
+
QMARK,
|
|
3548
|
+
QMARK_NO_DOT,
|
|
3549
|
+
STAR,
|
|
3550
|
+
START_ANCHOR
|
|
3551
|
+
} = PLATFORM_CHARS;
|
|
3552
|
+
|
|
3553
|
+
const globstar = opts => {
|
|
3554
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
3555
|
+
};
|
|
3556
|
+
|
|
3557
|
+
const nodot = opts.dot ? '' : NO_DOT;
|
|
3558
|
+
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
3559
|
+
let star = opts.bash === true ? globstar(opts) : STAR;
|
|
3560
|
+
|
|
3561
|
+
if (opts.capture) {
|
|
3562
|
+
star = `(${star})`;
|
|
3563
|
+
}
|
|
3453
3564
|
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
* @return {Object}
|
|
3459
|
-
*/
|
|
3565
|
+
// minimatch options support
|
|
3566
|
+
if (typeof opts.noext === 'boolean') {
|
|
3567
|
+
opts.noextglob = opts.noext;
|
|
3568
|
+
}
|
|
3460
3569
|
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3570
|
+
const state = {
|
|
3571
|
+
input,
|
|
3572
|
+
index: -1,
|
|
3573
|
+
start: 0,
|
|
3574
|
+
dot: opts.dot === true,
|
|
3575
|
+
consumed: '',
|
|
3576
|
+
output: '',
|
|
3577
|
+
prefix: '',
|
|
3578
|
+
backtrack: false,
|
|
3579
|
+
negated: false,
|
|
3580
|
+
brackets: 0,
|
|
3581
|
+
braces: 0,
|
|
3582
|
+
parens: 0,
|
|
3583
|
+
quotes: 0,
|
|
3584
|
+
globstar: false,
|
|
3585
|
+
tokens
|
|
3586
|
+
};
|
|
3587
|
+
|
|
3588
|
+
input = utils.removePrefix(input, state);
|
|
3589
|
+
len = input.length;
|
|
3590
|
+
|
|
3591
|
+
const extglobs = [];
|
|
3592
|
+
const braces = [];
|
|
3593
|
+
const stack = [];
|
|
3594
|
+
let prev = bos;
|
|
3595
|
+
let value;
|
|
3596
|
+
|
|
3597
|
+
/**
|
|
3598
|
+
* Tokenizing helpers
|
|
3599
|
+
*/
|
|
3600
|
+
|
|
3601
|
+
const eos = () => state.index === len - 1;
|
|
3602
|
+
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
3603
|
+
const advance = state.advance = () => input[++state.index] || '';
|
|
3604
|
+
const remaining = () => input.slice(state.index + 1);
|
|
3605
|
+
const consume = (value = '', num = 0) => {
|
|
3606
|
+
state.consumed += value;
|
|
3607
|
+
state.index += num;
|
|
3608
|
+
};
|
|
3609
|
+
|
|
3610
|
+
const append = token => {
|
|
3611
|
+
state.output += token.output != null ? token.output : token.value;
|
|
3612
|
+
consume(token.value);
|
|
3613
|
+
};
|
|
3614
|
+
|
|
3615
|
+
const negate = () => {
|
|
3616
|
+
let count = 1;
|
|
3617
|
+
|
|
3618
|
+
while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
|
|
3619
|
+
advance();
|
|
3620
|
+
state.start++;
|
|
3621
|
+
count++;
|
|
3622
|
+
}
|
|
3623
|
+
|
|
3624
|
+
if (count % 2 === 0) {
|
|
3625
|
+
return false;
|
|
3626
|
+
}
|
|
3627
|
+
|
|
3628
|
+
state.negated = true;
|
|
3629
|
+
state.start++;
|
|
3630
|
+
return true;
|
|
3631
|
+
};
|
|
3632
|
+
|
|
3633
|
+
const increment = type => {
|
|
3634
|
+
state[type]++;
|
|
3635
|
+
stack.push(type);
|
|
3636
|
+
};
|
|
3637
|
+
|
|
3638
|
+
const decrement = type => {
|
|
3639
|
+
state[type]--;
|
|
3640
|
+
stack.pop();
|
|
3641
|
+
};
|
|
3642
|
+
|
|
3643
|
+
/**
|
|
3644
|
+
* Push tokens onto the tokens array. This helper speeds up
|
|
3645
|
+
* tokenizing by 1) helping us avoid backtracking as much as possible,
|
|
3646
|
+
* and 2) helping us avoid creating extra tokens when consecutive
|
|
3647
|
+
* characters are plain text. This improves performance and simplifies
|
|
3648
|
+
* lookbehinds.
|
|
3649
|
+
*/
|
|
3650
|
+
|
|
3651
|
+
const push = tok => {
|
|
3652
|
+
if (prev.type === 'globstar') {
|
|
3653
|
+
const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
|
|
3654
|
+
const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
|
|
3655
|
+
|
|
3656
|
+
if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
|
|
3657
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
3658
|
+
prev.type = 'star';
|
|
3659
|
+
prev.value = '*';
|
|
3660
|
+
prev.output = star;
|
|
3661
|
+
state.output += prev.output;
|
|
3662
|
+
}
|
|
3663
|
+
}
|
|
3664
|
+
|
|
3665
|
+
if (extglobs.length && tok.type !== 'paren') {
|
|
3666
|
+
extglobs[extglobs.length - 1].inner += tok.value;
|
|
3667
|
+
}
|
|
3668
|
+
|
|
3669
|
+
if (tok.value || tok.output) append(tok);
|
|
3670
|
+
if (prev && prev.type === 'text' && tok.type === 'text') {
|
|
3671
|
+
prev.output = (prev.output || prev.value) + tok.value;
|
|
3672
|
+
prev.value += tok.value;
|
|
3673
|
+
return;
|
|
3674
|
+
}
|
|
3675
|
+
|
|
3676
|
+
tok.prev = prev;
|
|
3677
|
+
tokens.push(tok);
|
|
3678
|
+
prev = tok;
|
|
3679
|
+
};
|
|
3680
|
+
|
|
3681
|
+
const extglobOpen = (type, value) => {
|
|
3682
|
+
const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
|
|
3683
|
+
|
|
3684
|
+
token.prev = prev;
|
|
3685
|
+
token.parens = state.parens;
|
|
3686
|
+
token.output = state.output;
|
|
3687
|
+
const output = (opts.capture ? '(' : '') + token.open;
|
|
3688
|
+
|
|
3689
|
+
increment('parens');
|
|
3690
|
+
push({ type, value, output: state.output ? '' : ONE_CHAR });
|
|
3691
|
+
push({ type: 'paren', extglob: true, value: advance(), output });
|
|
3692
|
+
extglobs.push(token);
|
|
3693
|
+
};
|
|
3694
|
+
|
|
3695
|
+
const extglobClose = token => {
|
|
3696
|
+
let output = token.close + (opts.capture ? ')' : '');
|
|
3697
|
+
let rest;
|
|
3698
|
+
|
|
3699
|
+
if (token.type === 'negate') {
|
|
3700
|
+
let extglobStar = star;
|
|
3701
|
+
|
|
3702
|
+
if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
|
|
3703
|
+
extglobStar = globstar(opts);
|
|
3704
|
+
}
|
|
3705
|
+
|
|
3706
|
+
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
|
3707
|
+
output = token.close = `)$))${extglobStar}`;
|
|
3708
|
+
}
|
|
3709
|
+
|
|
3710
|
+
if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
3711
|
+
// Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
|
|
3712
|
+
// In this case, we need to parse the string and use it in the output of the original pattern.
|
|
3713
|
+
// Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
|
|
3714
|
+
//
|
|
3715
|
+
// Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
|
|
3716
|
+
const expression = parse(rest, { ...options, fastpaths: false }).output;
|
|
3717
|
+
|
|
3718
|
+
output = token.close = `)${expression})${extglobStar})`;
|
|
3719
|
+
}
|
|
3720
|
+
|
|
3721
|
+
if (token.prev.type === 'bos') {
|
|
3722
|
+
state.negatedExtglob = true;
|
|
3723
|
+
}
|
|
3724
|
+
}
|
|
3725
|
+
|
|
3726
|
+
push({ type: 'paren', extglob: true, value, output });
|
|
3727
|
+
decrement('parens');
|
|
3728
|
+
};
|
|
3729
|
+
|
|
3730
|
+
/**
|
|
3731
|
+
* Fast paths
|
|
3732
|
+
*/
|
|
3733
|
+
|
|
3734
|
+
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
3735
|
+
let backslashes = false;
|
|
3736
|
+
|
|
3737
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
|
3738
|
+
if (first === '\\') {
|
|
3739
|
+
backslashes = true;
|
|
3740
|
+
return m;
|
|
3741
|
+
}
|
|
3742
|
+
|
|
3743
|
+
if (first === '?') {
|
|
3744
|
+
if (esc) {
|
|
3745
|
+
return esc + first + (rest ? QMARK.repeat(rest.length) : '');
|
|
3746
|
+
}
|
|
3747
|
+
if (index === 0) {
|
|
3748
|
+
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
|
|
3749
|
+
}
|
|
3750
|
+
return QMARK.repeat(chars.length);
|
|
3751
|
+
}
|
|
3752
|
+
|
|
3753
|
+
if (first === '.') {
|
|
3754
|
+
return DOT_LITERAL.repeat(chars.length);
|
|
3755
|
+
}
|
|
3756
|
+
|
|
3757
|
+
if (first === '*') {
|
|
3758
|
+
if (esc) {
|
|
3759
|
+
return esc + first + (rest ? star : '');
|
|
3760
|
+
}
|
|
3761
|
+
return star;
|
|
3762
|
+
}
|
|
3763
|
+
return esc ? m : `\\${m}`;
|
|
3764
|
+
});
|
|
3765
|
+
|
|
3766
|
+
if (backslashes === true) {
|
|
3767
|
+
if (opts.unescape === true) {
|
|
3768
|
+
output = output.replace(/\\/g, '');
|
|
3769
|
+
} else {
|
|
3770
|
+
output = output.replace(/\\+/g, m => {
|
|
3771
|
+
return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
|
|
3772
|
+
});
|
|
3773
|
+
}
|
|
3774
|
+
}
|
|
3775
|
+
|
|
3776
|
+
if (output === input && opts.contains === true) {
|
|
3777
|
+
state.output = input;
|
|
3778
|
+
return state;
|
|
3779
|
+
}
|
|
3780
|
+
|
|
3781
|
+
state.output = utils.wrapOutput(output, state, options);
|
|
3782
|
+
return state;
|
|
3783
|
+
}
|
|
3465
3784
|
|
|
3466
|
-
|
|
3785
|
+
/**
|
|
3786
|
+
* Tokenize input until we reach end-of-string
|
|
3787
|
+
*/
|
|
3788
|
+
|
|
3789
|
+
while (!eos()) {
|
|
3790
|
+
value = advance();
|
|
3791
|
+
|
|
3792
|
+
if (value === '\u0000') {
|
|
3793
|
+
continue;
|
|
3794
|
+
}
|
|
3795
|
+
|
|
3796
|
+
/**
|
|
3797
|
+
* Escaped characters
|
|
3798
|
+
*/
|
|
3799
|
+
|
|
3800
|
+
if (value === '\\') {
|
|
3801
|
+
const next = peek();
|
|
3802
|
+
|
|
3803
|
+
if (next === '/' && opts.bash !== true) {
|
|
3804
|
+
continue;
|
|
3805
|
+
}
|
|
3806
|
+
|
|
3807
|
+
if (next === '.' || next === ';') {
|
|
3808
|
+
continue;
|
|
3809
|
+
}
|
|
3810
|
+
|
|
3811
|
+
if (!next) {
|
|
3812
|
+
value += '\\';
|
|
3813
|
+
push({ type: 'text', value });
|
|
3814
|
+
continue;
|
|
3815
|
+
}
|
|
3816
|
+
|
|
3817
|
+
// collapse slashes to reduce potential for exploits
|
|
3818
|
+
const match = /^\\+/.exec(remaining());
|
|
3819
|
+
let slashes = 0;
|
|
3820
|
+
|
|
3821
|
+
if (match && match[0].length > 2) {
|
|
3822
|
+
slashes = match[0].length;
|
|
3823
|
+
state.index += slashes;
|
|
3824
|
+
if (slashes % 2 !== 0) {
|
|
3825
|
+
value += '\\';
|
|
3826
|
+
}
|
|
3827
|
+
}
|
|
3828
|
+
|
|
3829
|
+
if (opts.unescape === true) {
|
|
3830
|
+
value = advance();
|
|
3831
|
+
} else {
|
|
3832
|
+
value += advance();
|
|
3833
|
+
}
|
|
3834
|
+
|
|
3835
|
+
if (state.brackets === 0) {
|
|
3836
|
+
push({ type: 'text', value });
|
|
3837
|
+
continue;
|
|
3838
|
+
}
|
|
3839
|
+
}
|
|
3840
|
+
|
|
3841
|
+
/**
|
|
3842
|
+
* If we're inside a regex character class, continue
|
|
3843
|
+
* until we reach the closing bracket.
|
|
3844
|
+
*/
|
|
3845
|
+
|
|
3846
|
+
if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
|
|
3847
|
+
if (opts.posix !== false && value === ':') {
|
|
3848
|
+
const inner = prev.value.slice(1);
|
|
3849
|
+
if (inner.includes('[')) {
|
|
3850
|
+
prev.posix = true;
|
|
3851
|
+
|
|
3852
|
+
if (inner.includes(':')) {
|
|
3853
|
+
const idx = prev.value.lastIndexOf('[');
|
|
3854
|
+
const pre = prev.value.slice(0, idx);
|
|
3855
|
+
const rest = prev.value.slice(idx + 2);
|
|
3856
|
+
const posix = POSIX_REGEX_SOURCE[rest];
|
|
3857
|
+
if (posix) {
|
|
3858
|
+
prev.value = pre + posix;
|
|
3859
|
+
state.backtrack = true;
|
|
3860
|
+
advance();
|
|
3861
|
+
|
|
3862
|
+
if (!bos.output && tokens.indexOf(prev) === 1) {
|
|
3863
|
+
bos.output = ONE_CHAR;
|
|
3864
|
+
}
|
|
3865
|
+
continue;
|
|
3866
|
+
}
|
|
3867
|
+
}
|
|
3868
|
+
}
|
|
3869
|
+
}
|
|
3870
|
+
|
|
3871
|
+
if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
|
|
3872
|
+
value = `\\${value}`;
|
|
3873
|
+
}
|
|
3874
|
+
|
|
3875
|
+
if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
|
|
3876
|
+
value = `\\${value}`;
|
|
3877
|
+
}
|
|
3878
|
+
|
|
3879
|
+
if (opts.posix === true && value === '!' && prev.value === '[') {
|
|
3880
|
+
value = '^';
|
|
3881
|
+
}
|
|
3882
|
+
|
|
3883
|
+
prev.value += value;
|
|
3884
|
+
append({ value });
|
|
3885
|
+
continue;
|
|
3886
|
+
}
|
|
3887
|
+
|
|
3888
|
+
/**
|
|
3889
|
+
* If we're inside a quoted string, continue
|
|
3890
|
+
* until we reach the closing double quote.
|
|
3891
|
+
*/
|
|
3892
|
+
|
|
3893
|
+
if (state.quotes === 1 && value !== '"') {
|
|
3894
|
+
value = utils.escapeRegex(value);
|
|
3895
|
+
prev.value += value;
|
|
3896
|
+
append({ value });
|
|
3897
|
+
continue;
|
|
3898
|
+
}
|
|
3899
|
+
|
|
3900
|
+
/**
|
|
3901
|
+
* Double quotes
|
|
3902
|
+
*/
|
|
3903
|
+
|
|
3904
|
+
if (value === '"') {
|
|
3905
|
+
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
3906
|
+
if (opts.keepQuotes === true) {
|
|
3907
|
+
push({ type: 'text', value });
|
|
3908
|
+
}
|
|
3909
|
+
continue;
|
|
3910
|
+
}
|
|
3911
|
+
|
|
3912
|
+
/**
|
|
3913
|
+
* Parentheses
|
|
3914
|
+
*/
|
|
3915
|
+
|
|
3916
|
+
if (value === '(') {
|
|
3917
|
+
increment('parens');
|
|
3918
|
+
push({ type: 'paren', value });
|
|
3919
|
+
continue;
|
|
3920
|
+
}
|
|
3921
|
+
|
|
3922
|
+
if (value === ')') {
|
|
3923
|
+
if (state.parens === 0 && opts.strictBrackets === true) {
|
|
3924
|
+
throw new SyntaxError(syntaxError('opening', '('));
|
|
3925
|
+
}
|
|
3926
|
+
|
|
3927
|
+
const extglob = extglobs[extglobs.length - 1];
|
|
3928
|
+
if (extglob && state.parens === extglob.parens + 1) {
|
|
3929
|
+
extglobClose(extglobs.pop());
|
|
3930
|
+
continue;
|
|
3931
|
+
}
|
|
3932
|
+
|
|
3933
|
+
push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
|
|
3934
|
+
decrement('parens');
|
|
3935
|
+
continue;
|
|
3936
|
+
}
|
|
3937
|
+
|
|
3938
|
+
/**
|
|
3939
|
+
* Square brackets
|
|
3940
|
+
*/
|
|
3941
|
+
|
|
3942
|
+
if (value === '[') {
|
|
3943
|
+
if (opts.nobracket === true || !remaining().includes(']')) {
|
|
3944
|
+
if (opts.nobracket !== true && opts.strictBrackets === true) {
|
|
3945
|
+
throw new SyntaxError(syntaxError('closing', ']'));
|
|
3946
|
+
}
|
|
3947
|
+
|
|
3948
|
+
value = `\\${value}`;
|
|
3949
|
+
} else {
|
|
3950
|
+
increment('brackets');
|
|
3951
|
+
}
|
|
3952
|
+
|
|
3953
|
+
push({ type: 'bracket', value });
|
|
3954
|
+
continue;
|
|
3955
|
+
}
|
|
3956
|
+
|
|
3957
|
+
if (value === ']') {
|
|
3958
|
+
if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
|
|
3959
|
+
push({ type: 'text', value, output: `\\${value}` });
|
|
3960
|
+
continue;
|
|
3961
|
+
}
|
|
3962
|
+
|
|
3963
|
+
if (state.brackets === 0) {
|
|
3964
|
+
if (opts.strictBrackets === true) {
|
|
3965
|
+
throw new SyntaxError(syntaxError('opening', '['));
|
|
3966
|
+
}
|
|
3967
|
+
|
|
3968
|
+
push({ type: 'text', value, output: `\\${value}` });
|
|
3969
|
+
continue;
|
|
3970
|
+
}
|
|
3971
|
+
|
|
3972
|
+
decrement('brackets');
|
|
3973
|
+
|
|
3974
|
+
const prevValue = prev.value.slice(1);
|
|
3975
|
+
if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
|
|
3976
|
+
value = `/${value}`;
|
|
3977
|
+
}
|
|
3978
|
+
|
|
3979
|
+
prev.value += value;
|
|
3980
|
+
append({ value });
|
|
3981
|
+
|
|
3982
|
+
// when literal brackets are explicitly disabled
|
|
3983
|
+
// assume we should match with a regex character class
|
|
3984
|
+
if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
|
|
3985
|
+
continue;
|
|
3986
|
+
}
|
|
3987
|
+
|
|
3988
|
+
const escaped = utils.escapeRegex(prev.value);
|
|
3989
|
+
state.output = state.output.slice(0, -prev.value.length);
|
|
3990
|
+
|
|
3991
|
+
// when literal brackets are explicitly enabled
|
|
3992
|
+
// assume we should escape the brackets to match literal characters
|
|
3993
|
+
if (opts.literalBrackets === true) {
|
|
3994
|
+
state.output += escaped;
|
|
3995
|
+
prev.value = escaped;
|
|
3996
|
+
continue;
|
|
3997
|
+
}
|
|
3998
|
+
|
|
3999
|
+
// when the user specifies nothing, try to match both
|
|
4000
|
+
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
4001
|
+
state.output += prev.value;
|
|
4002
|
+
continue;
|
|
4003
|
+
}
|
|
4004
|
+
|
|
4005
|
+
/**
|
|
4006
|
+
* Braces
|
|
4007
|
+
*/
|
|
4008
|
+
|
|
4009
|
+
if (value === '{' && opts.nobrace !== true) {
|
|
4010
|
+
increment('braces');
|
|
4011
|
+
|
|
4012
|
+
const open = {
|
|
4013
|
+
type: 'brace',
|
|
4014
|
+
value,
|
|
4015
|
+
output: '(',
|
|
4016
|
+
outputIndex: state.output.length,
|
|
4017
|
+
tokensIndex: state.tokens.length
|
|
4018
|
+
};
|
|
4019
|
+
|
|
4020
|
+
braces.push(open);
|
|
4021
|
+
push(open);
|
|
4022
|
+
continue;
|
|
4023
|
+
}
|
|
4024
|
+
|
|
4025
|
+
if (value === '}') {
|
|
4026
|
+
const brace = braces[braces.length - 1];
|
|
4027
|
+
|
|
4028
|
+
if (opts.nobrace === true || !brace) {
|
|
4029
|
+
push({ type: 'text', value, output: value });
|
|
4030
|
+
continue;
|
|
4031
|
+
}
|
|
4032
|
+
|
|
4033
|
+
let output = ')';
|
|
4034
|
+
|
|
4035
|
+
if (brace.dots === true) {
|
|
4036
|
+
const arr = tokens.slice();
|
|
4037
|
+
const range = [];
|
|
4038
|
+
|
|
4039
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
4040
|
+
tokens.pop();
|
|
4041
|
+
if (arr[i].type === 'brace') {
|
|
4042
|
+
break;
|
|
4043
|
+
}
|
|
4044
|
+
if (arr[i].type !== 'dots') {
|
|
4045
|
+
range.unshift(arr[i].value);
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4048
|
+
|
|
4049
|
+
output = expandRange(range, opts);
|
|
4050
|
+
state.backtrack = true;
|
|
4051
|
+
}
|
|
4052
|
+
|
|
4053
|
+
if (brace.comma !== true && brace.dots !== true) {
|
|
4054
|
+
const out = state.output.slice(0, brace.outputIndex);
|
|
4055
|
+
const toks = state.tokens.slice(brace.tokensIndex);
|
|
4056
|
+
brace.value = brace.output = '\\{';
|
|
4057
|
+
value = output = '\\}';
|
|
4058
|
+
state.output = out;
|
|
4059
|
+
for (const t of toks) {
|
|
4060
|
+
state.output += (t.output || t.value);
|
|
4061
|
+
}
|
|
4062
|
+
}
|
|
4063
|
+
|
|
4064
|
+
push({ type: 'brace', value, output });
|
|
4065
|
+
decrement('braces');
|
|
4066
|
+
braces.pop();
|
|
4067
|
+
continue;
|
|
4068
|
+
}
|
|
4069
|
+
|
|
4070
|
+
/**
|
|
4071
|
+
* Pipes
|
|
4072
|
+
*/
|
|
4073
|
+
|
|
4074
|
+
if (value === '|') {
|
|
4075
|
+
if (extglobs.length > 0) {
|
|
4076
|
+
extglobs[extglobs.length - 1].conditions++;
|
|
4077
|
+
}
|
|
4078
|
+
push({ type: 'text', value });
|
|
4079
|
+
continue;
|
|
4080
|
+
}
|
|
4081
|
+
|
|
4082
|
+
/**
|
|
4083
|
+
* Commas
|
|
4084
|
+
*/
|
|
4085
|
+
|
|
4086
|
+
if (value === ',') {
|
|
4087
|
+
let output = value;
|
|
4088
|
+
|
|
4089
|
+
const brace = braces[braces.length - 1];
|
|
4090
|
+
if (brace && stack[stack.length - 1] === 'braces') {
|
|
4091
|
+
brace.comma = true;
|
|
4092
|
+
output = '|';
|
|
4093
|
+
}
|
|
4094
|
+
|
|
4095
|
+
push({ type: 'comma', value, output });
|
|
4096
|
+
continue;
|
|
4097
|
+
}
|
|
4098
|
+
|
|
4099
|
+
/**
|
|
4100
|
+
* Slashes
|
|
4101
|
+
*/
|
|
4102
|
+
|
|
4103
|
+
if (value === '/') {
|
|
4104
|
+
// if the beginning of the glob is "./", advance the start
|
|
4105
|
+
// to the current index, and don't add the "./" characters
|
|
4106
|
+
// to the state. This greatly simplifies lookbehinds when
|
|
4107
|
+
// checking for BOS characters like "!" and "." (not "./")
|
|
4108
|
+
if (prev.type === 'dot' && state.index === state.start + 1) {
|
|
4109
|
+
state.start = state.index + 1;
|
|
4110
|
+
state.consumed = '';
|
|
4111
|
+
state.output = '';
|
|
4112
|
+
tokens.pop();
|
|
4113
|
+
prev = bos; // reset "prev" to the first token
|
|
4114
|
+
continue;
|
|
4115
|
+
}
|
|
4116
|
+
|
|
4117
|
+
push({ type: 'slash', value, output: SLASH_LITERAL });
|
|
4118
|
+
continue;
|
|
4119
|
+
}
|
|
4120
|
+
|
|
4121
|
+
/**
|
|
4122
|
+
* Dots
|
|
4123
|
+
*/
|
|
4124
|
+
|
|
4125
|
+
if (value === '.') {
|
|
4126
|
+
if (state.braces > 0 && prev.type === 'dot') {
|
|
4127
|
+
if (prev.value === '.') prev.output = DOT_LITERAL;
|
|
4128
|
+
const brace = braces[braces.length - 1];
|
|
4129
|
+
prev.type = 'dots';
|
|
4130
|
+
prev.output += value;
|
|
4131
|
+
prev.value += value;
|
|
4132
|
+
brace.dots = true;
|
|
4133
|
+
continue;
|
|
4134
|
+
}
|
|
4135
|
+
|
|
4136
|
+
if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
|
|
4137
|
+
push({ type: 'text', value, output: DOT_LITERAL });
|
|
4138
|
+
continue;
|
|
4139
|
+
}
|
|
4140
|
+
|
|
4141
|
+
push({ type: 'dot', value, output: DOT_LITERAL });
|
|
4142
|
+
continue;
|
|
4143
|
+
}
|
|
4144
|
+
|
|
4145
|
+
/**
|
|
4146
|
+
* Question marks
|
|
4147
|
+
*/
|
|
4148
|
+
|
|
4149
|
+
if (value === '?') {
|
|
4150
|
+
const isGroup = prev && prev.value === '(';
|
|
4151
|
+
if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
|
4152
|
+
extglobOpen('qmark', value);
|
|
4153
|
+
continue;
|
|
4154
|
+
}
|
|
4155
|
+
|
|
4156
|
+
if (prev && prev.type === 'paren') {
|
|
4157
|
+
const next = peek();
|
|
4158
|
+
let output = value;
|
|
4159
|
+
|
|
4160
|
+
if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
|
|
4161
|
+
output = `\\${value}`;
|
|
4162
|
+
}
|
|
4163
|
+
|
|
4164
|
+
push({ type: 'text', value, output });
|
|
4165
|
+
continue;
|
|
4166
|
+
}
|
|
4167
|
+
|
|
4168
|
+
if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
|
|
4169
|
+
push({ type: 'qmark', value, output: QMARK_NO_DOT });
|
|
4170
|
+
continue;
|
|
4171
|
+
}
|
|
4172
|
+
|
|
4173
|
+
push({ type: 'qmark', value, output: QMARK });
|
|
4174
|
+
continue;
|
|
4175
|
+
}
|
|
4176
|
+
|
|
4177
|
+
/**
|
|
4178
|
+
* Exclamation
|
|
4179
|
+
*/
|
|
4180
|
+
|
|
4181
|
+
if (value === '!') {
|
|
4182
|
+
if (opts.noextglob !== true && peek() === '(') {
|
|
4183
|
+
if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
|
|
4184
|
+
extglobOpen('negate', value);
|
|
4185
|
+
continue;
|
|
4186
|
+
}
|
|
4187
|
+
}
|
|
4188
|
+
|
|
4189
|
+
if (opts.nonegate !== true && state.index === 0) {
|
|
4190
|
+
negate();
|
|
4191
|
+
continue;
|
|
4192
|
+
}
|
|
4193
|
+
}
|
|
4194
|
+
|
|
4195
|
+
/**
|
|
4196
|
+
* Plus
|
|
4197
|
+
*/
|
|
4198
|
+
|
|
4199
|
+
if (value === '+') {
|
|
4200
|
+
if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
|
4201
|
+
extglobOpen('plus', value);
|
|
4202
|
+
continue;
|
|
4203
|
+
}
|
|
4204
|
+
|
|
4205
|
+
if ((prev && prev.value === '(') || opts.regex === false) {
|
|
4206
|
+
push({ type: 'plus', value, output: PLUS_LITERAL });
|
|
4207
|
+
continue;
|
|
4208
|
+
}
|
|
4209
|
+
|
|
4210
|
+
if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
|
|
4211
|
+
push({ type: 'plus', value });
|
|
4212
|
+
continue;
|
|
4213
|
+
}
|
|
4214
|
+
|
|
4215
|
+
push({ type: 'plus', value: PLUS_LITERAL });
|
|
4216
|
+
continue;
|
|
4217
|
+
}
|
|
4218
|
+
|
|
4219
|
+
/**
|
|
4220
|
+
* Plain text
|
|
4221
|
+
*/
|
|
4222
|
+
|
|
4223
|
+
if (value === '@') {
|
|
4224
|
+
if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
|
4225
|
+
push({ type: 'at', extglob: true, value, output: '' });
|
|
4226
|
+
continue;
|
|
4227
|
+
}
|
|
4228
|
+
|
|
4229
|
+
push({ type: 'text', value });
|
|
4230
|
+
continue;
|
|
4231
|
+
}
|
|
4232
|
+
|
|
4233
|
+
/**
|
|
4234
|
+
* Plain text
|
|
4235
|
+
*/
|
|
4236
|
+
|
|
4237
|
+
if (value !== '*') {
|
|
4238
|
+
if (value === '$' || value === '^') {
|
|
4239
|
+
value = `\\${value}`;
|
|
4240
|
+
}
|
|
4241
|
+
|
|
4242
|
+
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
4243
|
+
if (match) {
|
|
4244
|
+
value += match[0];
|
|
4245
|
+
state.index += match[0].length;
|
|
4246
|
+
}
|
|
4247
|
+
|
|
4248
|
+
push({ type: 'text', value });
|
|
4249
|
+
continue;
|
|
4250
|
+
}
|
|
4251
|
+
|
|
4252
|
+
/**
|
|
4253
|
+
* Stars
|
|
4254
|
+
*/
|
|
4255
|
+
|
|
4256
|
+
if (prev && (prev.type === 'globstar' || prev.star === true)) {
|
|
4257
|
+
prev.type = 'star';
|
|
4258
|
+
prev.star = true;
|
|
4259
|
+
prev.value += value;
|
|
4260
|
+
prev.output = star;
|
|
4261
|
+
state.backtrack = true;
|
|
4262
|
+
state.globstar = true;
|
|
4263
|
+
consume(value);
|
|
4264
|
+
continue;
|
|
4265
|
+
}
|
|
4266
|
+
|
|
4267
|
+
let rest = remaining();
|
|
4268
|
+
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
4269
|
+
extglobOpen('star', value);
|
|
4270
|
+
continue;
|
|
4271
|
+
}
|
|
4272
|
+
|
|
4273
|
+
if (prev.type === 'star') {
|
|
4274
|
+
if (opts.noglobstar === true) {
|
|
4275
|
+
consume(value);
|
|
4276
|
+
continue;
|
|
4277
|
+
}
|
|
4278
|
+
|
|
4279
|
+
const prior = prev.prev;
|
|
4280
|
+
const before = prior.prev;
|
|
4281
|
+
const isStart = prior.type === 'slash' || prior.type === 'bos';
|
|
4282
|
+
const afterStar = before && (before.type === 'star' || before.type === 'globstar');
|
|
4283
|
+
|
|
4284
|
+
if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
|
|
4285
|
+
push({ type: 'star', value, output: '' });
|
|
4286
|
+
continue;
|
|
4287
|
+
}
|
|
4288
|
+
|
|
4289
|
+
const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
|
|
4290
|
+
const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
|
|
4291
|
+
if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
|
|
4292
|
+
push({ type: 'star', value, output: '' });
|
|
4293
|
+
continue;
|
|
4294
|
+
}
|
|
4295
|
+
|
|
4296
|
+
// strip consecutive `/**/`
|
|
4297
|
+
while (rest.slice(0, 3) === '/**') {
|
|
4298
|
+
const after = input[state.index + 4];
|
|
4299
|
+
if (after && after !== '/') {
|
|
4300
|
+
break;
|
|
4301
|
+
}
|
|
4302
|
+
rest = rest.slice(3);
|
|
4303
|
+
consume('/**', 3);
|
|
4304
|
+
}
|
|
4305
|
+
|
|
4306
|
+
if (prior.type === 'bos' && eos()) {
|
|
4307
|
+
prev.type = 'globstar';
|
|
4308
|
+
prev.value += value;
|
|
4309
|
+
prev.output = globstar(opts);
|
|
4310
|
+
state.output = prev.output;
|
|
4311
|
+
state.globstar = true;
|
|
4312
|
+
consume(value);
|
|
4313
|
+
continue;
|
|
4314
|
+
}
|
|
4315
|
+
|
|
4316
|
+
if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
|
|
4317
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
4318
|
+
prior.output = `(?:${prior.output}`;
|
|
4319
|
+
|
|
4320
|
+
prev.type = 'globstar';
|
|
4321
|
+
prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
|
|
4322
|
+
prev.value += value;
|
|
4323
|
+
state.globstar = true;
|
|
4324
|
+
state.output += prior.output + prev.output;
|
|
4325
|
+
consume(value);
|
|
4326
|
+
continue;
|
|
4327
|
+
}
|
|
4328
|
+
|
|
4329
|
+
if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
|
|
4330
|
+
const end = rest[1] !== void 0 ? '|$' : '';
|
|
4331
|
+
|
|
4332
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
4333
|
+
prior.output = `(?:${prior.output}`;
|
|
4334
|
+
|
|
4335
|
+
prev.type = 'globstar';
|
|
4336
|
+
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
4337
|
+
prev.value += value;
|
|
4338
|
+
|
|
4339
|
+
state.output += prior.output + prev.output;
|
|
4340
|
+
state.globstar = true;
|
|
4341
|
+
|
|
4342
|
+
consume(value + advance());
|
|
4343
|
+
|
|
4344
|
+
push({ type: 'slash', value: '/', output: '' });
|
|
4345
|
+
continue;
|
|
4346
|
+
}
|
|
4347
|
+
|
|
4348
|
+
if (prior.type === 'bos' && rest[0] === '/') {
|
|
4349
|
+
prev.type = 'globstar';
|
|
4350
|
+
prev.value += value;
|
|
4351
|
+
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
4352
|
+
state.output = prev.output;
|
|
4353
|
+
state.globstar = true;
|
|
4354
|
+
consume(value + advance());
|
|
4355
|
+
push({ type: 'slash', value: '/', output: '' });
|
|
4356
|
+
continue;
|
|
4357
|
+
}
|
|
4358
|
+
|
|
4359
|
+
// remove single star from output
|
|
4360
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
4361
|
+
|
|
4362
|
+
// reset previous token to globstar
|
|
4363
|
+
prev.type = 'globstar';
|
|
4364
|
+
prev.output = globstar(opts);
|
|
4365
|
+
prev.value += value;
|
|
4366
|
+
|
|
4367
|
+
// reset output with globstar
|
|
4368
|
+
state.output += prev.output;
|
|
4369
|
+
state.globstar = true;
|
|
4370
|
+
consume(value);
|
|
4371
|
+
continue;
|
|
4372
|
+
}
|
|
4373
|
+
|
|
4374
|
+
const token = { type: 'star', value, output: star };
|
|
4375
|
+
|
|
4376
|
+
if (opts.bash === true) {
|
|
4377
|
+
token.output = '.*?';
|
|
4378
|
+
if (prev.type === 'bos' || prev.type === 'slash') {
|
|
4379
|
+
token.output = nodot + token.output;
|
|
4380
|
+
}
|
|
4381
|
+
push(token);
|
|
4382
|
+
continue;
|
|
4383
|
+
}
|
|
4384
|
+
|
|
4385
|
+
if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
|
|
4386
|
+
token.output = value;
|
|
4387
|
+
push(token);
|
|
4388
|
+
continue;
|
|
4389
|
+
}
|
|
4390
|
+
|
|
4391
|
+
if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
|
|
4392
|
+
if (prev.type === 'dot') {
|
|
4393
|
+
state.output += NO_DOT_SLASH;
|
|
4394
|
+
prev.output += NO_DOT_SLASH;
|
|
4395
|
+
|
|
4396
|
+
} else if (opts.dot === true) {
|
|
4397
|
+
state.output += NO_DOTS_SLASH;
|
|
4398
|
+
prev.output += NO_DOTS_SLASH;
|
|
4399
|
+
|
|
4400
|
+
} else {
|
|
4401
|
+
state.output += nodot;
|
|
4402
|
+
prev.output += nodot;
|
|
4403
|
+
}
|
|
4404
|
+
|
|
4405
|
+
if (peek() !== '*') {
|
|
4406
|
+
state.output += ONE_CHAR;
|
|
4407
|
+
prev.output += ONE_CHAR;
|
|
4408
|
+
}
|
|
4409
|
+
}
|
|
4410
|
+
|
|
4411
|
+
push(token);
|
|
4412
|
+
}
|
|
3467
4413
|
|
|
3468
|
-
|
|
3469
|
-
|
|
4414
|
+
while (state.brackets > 0) {
|
|
4415
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
|
|
4416
|
+
state.output = utils.escapeLast(state.output, '[');
|
|
4417
|
+
decrement('brackets');
|
|
4418
|
+
}
|
|
3470
4419
|
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
4420
|
+
while (state.parens > 0) {
|
|
4421
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
|
|
4422
|
+
state.output = utils.escapeLast(state.output, '(');
|
|
4423
|
+
decrement('parens');
|
|
4424
|
+
}
|
|
3475
4425
|
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
// create constants based on platform, for windows or posix
|
|
3482
|
-
const PLATFORM_CHARS = constants$1.globChars(opts.windows);
|
|
3483
|
-
const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS);
|
|
3484
|
-
|
|
3485
|
-
const {
|
|
3486
|
-
DOT_LITERAL,
|
|
3487
|
-
PLUS_LITERAL,
|
|
3488
|
-
SLASH_LITERAL,
|
|
3489
|
-
ONE_CHAR,
|
|
3490
|
-
DOTS_SLASH,
|
|
3491
|
-
NO_DOT,
|
|
3492
|
-
NO_DOT_SLASH,
|
|
3493
|
-
NO_DOTS_SLASH,
|
|
3494
|
-
QMARK,
|
|
3495
|
-
QMARK_NO_DOT,
|
|
3496
|
-
STAR,
|
|
3497
|
-
START_ANCHOR
|
|
3498
|
-
} = PLATFORM_CHARS;
|
|
3499
|
-
|
|
3500
|
-
const globstar = (opts) => {
|
|
3501
|
-
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
3502
|
-
};
|
|
4426
|
+
while (state.braces > 0) {
|
|
4427
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
|
|
4428
|
+
state.output = utils.escapeLast(state.output, '{');
|
|
4429
|
+
decrement('braces');
|
|
4430
|
+
}
|
|
3503
4431
|
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
4432
|
+
if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
|
|
4433
|
+
push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
|
|
4434
|
+
}
|
|
3507
4435
|
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
4436
|
+
// rebuild the output if we had to backtrack at any point
|
|
4437
|
+
if (state.backtrack === true) {
|
|
4438
|
+
state.output = '';
|
|
3511
4439
|
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
opts.noextglob = opts.noext;
|
|
3515
|
-
}
|
|
4440
|
+
for (const token of state.tokens) {
|
|
4441
|
+
state.output += token.output != null ? token.output : token.value;
|
|
3516
4442
|
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
consumed: '',
|
|
3523
|
-
output: '',
|
|
3524
|
-
prefix: '',
|
|
3525
|
-
backtrack: false,
|
|
3526
|
-
negated: false,
|
|
3527
|
-
brackets: 0,
|
|
3528
|
-
braces: 0,
|
|
3529
|
-
parens: 0,
|
|
3530
|
-
quotes: 0,
|
|
3531
|
-
globstar: false,
|
|
3532
|
-
tokens
|
|
3533
|
-
};
|
|
4443
|
+
if (token.suffix) {
|
|
4444
|
+
state.output += token.suffix;
|
|
4445
|
+
}
|
|
4446
|
+
}
|
|
4447
|
+
}
|
|
3534
4448
|
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
const extglobs = [];
|
|
3539
|
-
const braces = [];
|
|
3540
|
-
const stack = [];
|
|
3541
|
-
let prev = bos;
|
|
3542
|
-
let value;
|
|
3543
|
-
|
|
3544
|
-
/**
|
|
3545
|
-
* Tokenizing helpers
|
|
3546
|
-
*/
|
|
3547
|
-
|
|
3548
|
-
const eos = () => state.index === len - 1;
|
|
3549
|
-
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
3550
|
-
const advance = state.advance = () => input[++state.index];
|
|
3551
|
-
const remaining = () => input.slice(state.index + 1);
|
|
3552
|
-
const consume = (value = '', num = 0) => {
|
|
3553
|
-
state.consumed += value;
|
|
3554
|
-
state.index += num;
|
|
3555
|
-
};
|
|
3556
|
-
const append = token => {
|
|
3557
|
-
state.output += token.output != null ? token.output : token.value;
|
|
3558
|
-
consume(token.value);
|
|
3559
|
-
};
|
|
4449
|
+
return state;
|
|
4450
|
+
};
|
|
3560
4451
|
|
|
3561
|
-
|
|
3562
|
-
|
|
4452
|
+
/**
|
|
4453
|
+
* Fast paths for creating regular expressions for common glob patterns.
|
|
4454
|
+
* This can significantly speed up processing and has very little downside
|
|
4455
|
+
* impact when none of the fast paths match.
|
|
4456
|
+
*/
|
|
4457
|
+
|
|
4458
|
+
parse.fastpaths = (input, options) => {
|
|
4459
|
+
const opts = { ...options };
|
|
4460
|
+
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
4461
|
+
const len = input.length;
|
|
4462
|
+
if (len > max) {
|
|
4463
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
4464
|
+
}
|
|
3563
4465
|
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
4466
|
+
input = REPLACEMENTS[input] || input;
|
|
4467
|
+
|
|
4468
|
+
// create constants based on platform, for windows or posix
|
|
4469
|
+
const {
|
|
4470
|
+
DOT_LITERAL,
|
|
4471
|
+
SLASH_LITERAL,
|
|
4472
|
+
ONE_CHAR,
|
|
4473
|
+
DOTS_SLASH,
|
|
4474
|
+
NO_DOT,
|
|
4475
|
+
NO_DOTS,
|
|
4476
|
+
NO_DOTS_SLASH,
|
|
4477
|
+
STAR,
|
|
4478
|
+
START_ANCHOR
|
|
4479
|
+
} = constants.globChars(opts.windows);
|
|
4480
|
+
|
|
4481
|
+
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
4482
|
+
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
4483
|
+
const capture = opts.capture ? '' : '?:';
|
|
4484
|
+
const state = { negated: false, prefix: '' };
|
|
4485
|
+
let star = opts.bash === true ? '.*?' : STAR;
|
|
4486
|
+
|
|
4487
|
+
if (opts.capture) {
|
|
4488
|
+
star = `(${star})`;
|
|
4489
|
+
}
|
|
3569
4490
|
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
4491
|
+
const globstar = opts => {
|
|
4492
|
+
if (opts.noglobstar === true) return star;
|
|
4493
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
4494
|
+
};
|
|
3573
4495
|
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
4496
|
+
const create = str => {
|
|
4497
|
+
switch (str) {
|
|
4498
|
+
case '*':
|
|
4499
|
+
return `${nodot}${ONE_CHAR}${star}`;
|
|
3578
4500
|
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
stack.push(type);
|
|
3582
|
-
};
|
|
4501
|
+
case '.*':
|
|
4502
|
+
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
3583
4503
|
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
stack.pop();
|
|
3587
|
-
};
|
|
4504
|
+
case '*.*':
|
|
4505
|
+
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
3588
4506
|
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
* tokenizing by 1) helping us avoid backtracking as much as possible,
|
|
3592
|
-
* and 2) helping us avoid creating extra tokens when consecutive
|
|
3593
|
-
* characters are plain text. This improves performance and simplifies
|
|
3594
|
-
* lookbehinds.
|
|
3595
|
-
*/
|
|
3596
|
-
|
|
3597
|
-
const push = tok => {
|
|
3598
|
-
if (prev.type === 'globstar') {
|
|
3599
|
-
const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
|
|
3600
|
-
const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
|
|
3601
|
-
|
|
3602
|
-
if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
|
|
3603
|
-
state.output = state.output.slice(0, -prev.output.length);
|
|
3604
|
-
prev.type = 'star';
|
|
3605
|
-
prev.value = '*';
|
|
3606
|
-
prev.output = star;
|
|
3607
|
-
state.output += prev.output;
|
|
3608
|
-
}
|
|
3609
|
-
}
|
|
4507
|
+
case '*/*':
|
|
4508
|
+
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
3610
4509
|
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
}
|
|
4510
|
+
case '**':
|
|
4511
|
+
return nodot + globstar(opts);
|
|
3614
4512
|
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
prev.value += tok.value;
|
|
3618
|
-
prev.output = (prev.output || '') + tok.value;
|
|
3619
|
-
return;
|
|
3620
|
-
}
|
|
4513
|
+
case '**/*':
|
|
4514
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
3621
4515
|
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
prev = tok;
|
|
3625
|
-
};
|
|
4516
|
+
case '**/*.*':
|
|
4517
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
3626
4518
|
|
|
3627
|
-
|
|
3628
|
-
|
|
4519
|
+
case '**/.*':
|
|
4520
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
3629
4521
|
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
const output = (opts.capture ? '(' : '') + token.open;
|
|
4522
|
+
default: {
|
|
4523
|
+
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
4524
|
+
if (!match) return;
|
|
3634
4525
|
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
push({ type: 'paren', extglob: true, value: advance(), output });
|
|
3638
|
-
extglobs.push(token);
|
|
3639
|
-
};
|
|
4526
|
+
const source = create(match[1]);
|
|
4527
|
+
if (!source) return;
|
|
3640
4528
|
|
|
3641
|
-
|
|
3642
|
-
|
|
4529
|
+
return source + DOT_LITERAL + match[2];
|
|
4530
|
+
}
|
|
4531
|
+
}
|
|
4532
|
+
};
|
|
3643
4533
|
|
|
3644
|
-
|
|
3645
|
-
|
|
4534
|
+
const output = utils.removePrefix(input, state);
|
|
4535
|
+
let source = create(output);
|
|
3646
4536
|
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
4537
|
+
if (source && opts.strictSlashes !== true) {
|
|
4538
|
+
source += `${SLASH_LITERAL}?`;
|
|
4539
|
+
}
|
|
3650
4540
|
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
}
|
|
4541
|
+
return source;
|
|
4542
|
+
};
|
|
3654
4543
|
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
4544
|
+
parse_1 = parse;
|
|
4545
|
+
return parse_1;
|
|
4546
|
+
}
|
|
4547
|
+
|
|
4548
|
+
var picomatch_1$1;
|
|
4549
|
+
var hasRequiredPicomatch$1;
|
|
4550
|
+
|
|
4551
|
+
function requirePicomatch$1 () {
|
|
4552
|
+
if (hasRequiredPicomatch$1) return picomatch_1$1;
|
|
4553
|
+
hasRequiredPicomatch$1 = 1;
|
|
4554
|
+
|
|
4555
|
+
const scan = /*@__PURE__*/ requireScan();
|
|
4556
|
+
const parse = /*@__PURE__*/ requireParse();
|
|
4557
|
+
const utils = /*@__PURE__*/ requireUtils();
|
|
4558
|
+
const constants = /*@__PURE__*/ requireConstants();
|
|
4559
|
+
const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
4560
|
+
|
|
4561
|
+
/**
|
|
4562
|
+
* Creates a matcher function from one or more glob patterns. The
|
|
4563
|
+
* returned function takes a string to match as its first argument,
|
|
4564
|
+
* and returns true if the string is a match. The returned matcher
|
|
4565
|
+
* function also takes a boolean as the second argument that, when true,
|
|
4566
|
+
* returns an object with additional information.
|
|
4567
|
+
*
|
|
4568
|
+
* ```js
|
|
4569
|
+
* const picomatch = require('picomatch');
|
|
4570
|
+
* // picomatch(glob[, options]);
|
|
4571
|
+
*
|
|
4572
|
+
* const isMatch = picomatch('*.!(*a)');
|
|
4573
|
+
* console.log(isMatch('a.a')); //=> false
|
|
4574
|
+
* console.log(isMatch('a.b')); //=> true
|
|
4575
|
+
* ```
|
|
4576
|
+
* @name picomatch
|
|
4577
|
+
* @param {String|Array} `globs` One or more glob patterns.
|
|
4578
|
+
* @param {Object=} `options`
|
|
4579
|
+
* @return {Function=} Returns a matcher function.
|
|
4580
|
+
* @api public
|
|
4581
|
+
*/
|
|
4582
|
+
|
|
4583
|
+
const picomatch = (glob, options, returnState = false) => {
|
|
4584
|
+
if (Array.isArray(glob)) {
|
|
4585
|
+
const fns = glob.map(input => picomatch(input, options, returnState));
|
|
4586
|
+
const arrayMatcher = str => {
|
|
4587
|
+
for (const isMatch of fns) {
|
|
4588
|
+
const state = isMatch(str);
|
|
4589
|
+
if (state) return state;
|
|
4590
|
+
}
|
|
4591
|
+
return false;
|
|
4592
|
+
};
|
|
4593
|
+
return arrayMatcher;
|
|
4594
|
+
}
|
|
3659
4595
|
|
|
3660
|
-
|
|
3661
|
-
decrement('parens');
|
|
3662
|
-
};
|
|
4596
|
+
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
3663
4597
|
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
4598
|
+
if (glob === '' || (typeof glob !== 'string' && !isState)) {
|
|
4599
|
+
throw new TypeError('Expected pattern to be a non-empty string');
|
|
4600
|
+
}
|
|
3667
4601
|
|
|
3668
|
-
|
|
3669
|
-
|
|
4602
|
+
const opts = options || {};
|
|
4603
|
+
const posix = opts.windows;
|
|
4604
|
+
const regex = isState
|
|
4605
|
+
? picomatch.compileRe(glob, options)
|
|
4606
|
+
: picomatch.makeRe(glob, options, false, true);
|
|
3670
4607
|
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
backslashes = true;
|
|
3674
|
-
return m;
|
|
3675
|
-
}
|
|
4608
|
+
const state = regex.state;
|
|
4609
|
+
delete regex.state;
|
|
3676
4610
|
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
|
|
3683
|
-
}
|
|
3684
|
-
return QMARK.repeat(chars.length);
|
|
3685
|
-
}
|
|
4611
|
+
let isIgnored = () => false;
|
|
4612
|
+
if (opts.ignore) {
|
|
4613
|
+
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
4614
|
+
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
4615
|
+
}
|
|
3686
4616
|
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
4617
|
+
const matcher = (input, returnObject = false) => {
|
|
4618
|
+
const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
|
|
4619
|
+
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
|
4620
|
+
|
|
4621
|
+
if (typeof opts.onResult === 'function') {
|
|
4622
|
+
opts.onResult(result);
|
|
4623
|
+
}
|
|
4624
|
+
|
|
4625
|
+
if (isMatch === false) {
|
|
4626
|
+
result.isMatch = false;
|
|
4627
|
+
return returnObject ? result : false;
|
|
4628
|
+
}
|
|
4629
|
+
|
|
4630
|
+
if (isIgnored(input)) {
|
|
4631
|
+
if (typeof opts.onIgnore === 'function') {
|
|
4632
|
+
opts.onIgnore(result);
|
|
4633
|
+
}
|
|
4634
|
+
result.isMatch = false;
|
|
4635
|
+
return returnObject ? result : false;
|
|
4636
|
+
}
|
|
4637
|
+
|
|
4638
|
+
if (typeof opts.onMatch === 'function') {
|
|
4639
|
+
opts.onMatch(result);
|
|
4640
|
+
}
|
|
4641
|
+
return returnObject ? result : true;
|
|
4642
|
+
};
|
|
4643
|
+
|
|
4644
|
+
if (returnState) {
|
|
4645
|
+
matcher.state = state;
|
|
4646
|
+
}
|
|
3690
4647
|
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
return esc + first + (rest ? star : '');
|
|
3694
|
-
}
|
|
3695
|
-
return star;
|
|
3696
|
-
}
|
|
3697
|
-
return esc ? m : `\\${m}`;
|
|
3698
|
-
});
|
|
4648
|
+
return matcher;
|
|
4649
|
+
};
|
|
3699
4650
|
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
4651
|
+
/**
|
|
4652
|
+
* Test `input` with the given `regex`. This is used by the main
|
|
4653
|
+
* `picomatch()` function to test the input string.
|
|
4654
|
+
*
|
|
4655
|
+
* ```js
|
|
4656
|
+
* const picomatch = require('picomatch');
|
|
4657
|
+
* // picomatch.test(input, regex[, options]);
|
|
4658
|
+
*
|
|
4659
|
+
* console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
|
4660
|
+
* // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
|
4661
|
+
* ```
|
|
4662
|
+
* @param {String} `input` String to test.
|
|
4663
|
+
* @param {RegExp} `regex`
|
|
4664
|
+
* @return {Object} Returns an object with matching info.
|
|
4665
|
+
* @api public
|
|
4666
|
+
*/
|
|
4667
|
+
|
|
4668
|
+
picomatch.test = (input, regex, options, { glob, posix } = {}) => {
|
|
4669
|
+
if (typeof input !== 'string') {
|
|
4670
|
+
throw new TypeError('Expected input to be a string');
|
|
4671
|
+
}
|
|
3709
4672
|
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
}
|
|
4673
|
+
if (input === '') {
|
|
4674
|
+
return { isMatch: false, output: '' };
|
|
4675
|
+
}
|
|
3714
4676
|
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
4677
|
+
const opts = options || {};
|
|
4678
|
+
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
4679
|
+
let match = input === glob;
|
|
4680
|
+
let output = (match && format) ? format(input) : input;
|
|
3718
4681
|
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
4682
|
+
if (match === false) {
|
|
4683
|
+
output = format ? format(input) : input;
|
|
4684
|
+
match = output === glob;
|
|
4685
|
+
}
|
|
3722
4686
|
|
|
3723
|
-
|
|
3724
|
-
|
|
4687
|
+
if (match === false || opts.capture === true) {
|
|
4688
|
+
if (opts.matchBase === true || opts.basename === true) {
|
|
4689
|
+
match = picomatch.matchBase(input, regex, options, posix);
|
|
4690
|
+
} else {
|
|
4691
|
+
match = regex.exec(output);
|
|
4692
|
+
}
|
|
4693
|
+
}
|
|
3725
4694
|
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
}
|
|
4695
|
+
return { isMatch: Boolean(match), match, output };
|
|
4696
|
+
};
|
|
3729
4697
|
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
4698
|
+
/**
|
|
4699
|
+
* Match the basename of a filepath.
|
|
4700
|
+
*
|
|
4701
|
+
* ```js
|
|
4702
|
+
* const picomatch = require('picomatch');
|
|
4703
|
+
* // picomatch.matchBase(input, glob[, options]);
|
|
4704
|
+
* console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
|
4705
|
+
* ```
|
|
4706
|
+
* @param {String} `input` String to test.
|
|
4707
|
+
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
|
|
4708
|
+
* @return {Boolean}
|
|
4709
|
+
* @api public
|
|
4710
|
+
*/
|
|
4711
|
+
|
|
4712
|
+
picomatch.matchBase = (input, glob, options) => {
|
|
4713
|
+
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
4714
|
+
return regex.test(utils.basename(input));
|
|
4715
|
+
};
|
|
3733
4716
|
|
|
3734
|
-
|
|
3735
|
-
|
|
4717
|
+
/**
|
|
4718
|
+
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
|
4719
|
+
*
|
|
4720
|
+
* ```js
|
|
4721
|
+
* const picomatch = require('picomatch');
|
|
4722
|
+
* // picomatch.isMatch(string, patterns[, options]);
|
|
4723
|
+
*
|
|
4724
|
+
* console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
|
4725
|
+
* console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
|
4726
|
+
* ```
|
|
4727
|
+
* @param {String|Array} str The string to test.
|
|
4728
|
+
* @param {String|Array} patterns One or more glob patterns to use for matching.
|
|
4729
|
+
* @param {Object} [options] See available [options](#options).
|
|
4730
|
+
* @return {Boolean} Returns true if any patterns match `str`
|
|
4731
|
+
* @api public
|
|
4732
|
+
*/
|
|
4733
|
+
|
|
4734
|
+
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
4735
|
+
|
|
4736
|
+
/**
|
|
4737
|
+
* Parse a glob pattern to create the source string for a regular
|
|
4738
|
+
* expression.
|
|
4739
|
+
*
|
|
4740
|
+
* ```js
|
|
4741
|
+
* const picomatch = require('picomatch');
|
|
4742
|
+
* const result = picomatch.parse(pattern[, options]);
|
|
4743
|
+
* ```
|
|
4744
|
+
* @param {String} `pattern`
|
|
4745
|
+
* @param {Object} `options`
|
|
4746
|
+
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
|
|
4747
|
+
* @api public
|
|
4748
|
+
*/
|
|
4749
|
+
|
|
4750
|
+
picomatch.parse = (pattern, options) => {
|
|
4751
|
+
if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));
|
|
4752
|
+
return parse(pattern, { ...options, fastpaths: false });
|
|
4753
|
+
};
|
|
3736
4754
|
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
4755
|
+
/**
|
|
4756
|
+
* Scan a glob pattern to separate the pattern into segments.
|
|
4757
|
+
*
|
|
4758
|
+
* ```js
|
|
4759
|
+
* const picomatch = require('picomatch');
|
|
4760
|
+
* // picomatch.scan(input[, options]);
|
|
4761
|
+
*
|
|
4762
|
+
* const result = picomatch.scan('!./foo/*.js');
|
|
4763
|
+
* console.log(result);
|
|
4764
|
+
* { prefix: '!./',
|
|
4765
|
+
* input: '!./foo/*.js',
|
|
4766
|
+
* start: 3,
|
|
4767
|
+
* base: 'foo',
|
|
4768
|
+
* glob: '*.js',
|
|
4769
|
+
* isBrace: false,
|
|
4770
|
+
* isBracket: false,
|
|
4771
|
+
* isGlob: true,
|
|
4772
|
+
* isExtglob: false,
|
|
4773
|
+
* isGlobstar: false,
|
|
4774
|
+
* negated: true }
|
|
4775
|
+
* ```
|
|
4776
|
+
* @param {String} `input` Glob pattern to scan.
|
|
4777
|
+
* @param {Object} `options`
|
|
4778
|
+
* @return {Object} Returns an object with
|
|
4779
|
+
* @api public
|
|
4780
|
+
*/
|
|
4781
|
+
|
|
4782
|
+
picomatch.scan = (input, options) => scan(input, options);
|
|
4783
|
+
|
|
4784
|
+
/**
|
|
4785
|
+
* Compile a regular expression from the `state` object returned by the
|
|
4786
|
+
* [parse()](#parse) method.
|
|
4787
|
+
*
|
|
4788
|
+
* @param {Object} `state`
|
|
4789
|
+
* @param {Object} `options`
|
|
4790
|
+
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
4791
|
+
* @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
|
|
4792
|
+
* @return {RegExp}
|
|
4793
|
+
* @api public
|
|
4794
|
+
*/
|
|
4795
|
+
|
|
4796
|
+
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
4797
|
+
if (returnOutput === true) {
|
|
4798
|
+
return state.output;
|
|
4799
|
+
}
|
|
3740
4800
|
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
4801
|
+
const opts = options || {};
|
|
4802
|
+
const prepend = opts.contains ? '' : '^';
|
|
4803
|
+
const append = opts.contains ? '' : '$';
|
|
3744
4804
|
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
}
|
|
4805
|
+
let source = `${prepend}(?:${state.output})${append}`;
|
|
4806
|
+
if (state && state.negated === true) {
|
|
4807
|
+
source = `^(?!${source}).*$`;
|
|
4808
|
+
}
|
|
3750
4809
|
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
4810
|
+
const regex = picomatch.toRegex(source, options);
|
|
4811
|
+
if (returnState === true) {
|
|
4812
|
+
regex.state = state;
|
|
4813
|
+
}
|
|
3754
4814
|
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
state.index += slashes;
|
|
3758
|
-
if (slashes % 2 !== 0) {
|
|
3759
|
-
value += '\\';
|
|
3760
|
-
}
|
|
3761
|
-
}
|
|
4815
|
+
return regex;
|
|
4816
|
+
};
|
|
3762
4817
|
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
4818
|
+
/**
|
|
4819
|
+
* Create a regular expression from a parsed glob pattern.
|
|
4820
|
+
*
|
|
4821
|
+
* ```js
|
|
4822
|
+
* const picomatch = require('picomatch');
|
|
4823
|
+
* const state = picomatch.parse('*.js');
|
|
4824
|
+
* // picomatch.compileRe(state[, options]);
|
|
4825
|
+
*
|
|
4826
|
+
* console.log(picomatch.compileRe(state));
|
|
4827
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
4828
|
+
* ```
|
|
4829
|
+
* @param {String} `state` The object returned from the `.parse` method.
|
|
4830
|
+
* @param {Object} `options`
|
|
4831
|
+
* @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
|
|
4832
|
+
* @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
|
|
4833
|
+
* @return {RegExp} Returns a regex created from the given pattern.
|
|
4834
|
+
* @api public
|
|
4835
|
+
*/
|
|
4836
|
+
|
|
4837
|
+
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
4838
|
+
if (!input || typeof input !== 'string') {
|
|
4839
|
+
throw new TypeError('Expected a non-empty string');
|
|
4840
|
+
}
|
|
3768
4841
|
|
|
3769
|
-
|
|
3770
|
-
push({ type: 'text', value });
|
|
3771
|
-
continue;
|
|
3772
|
-
}
|
|
3773
|
-
}
|
|
4842
|
+
let parsed = { negated: false, fastpaths: true };
|
|
3774
4843
|
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
*/
|
|
3779
|
-
|
|
3780
|
-
if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
|
|
3781
|
-
if (opts.posix !== false && value === ':') {
|
|
3782
|
-
const inner = prev.value.slice(1);
|
|
3783
|
-
if (inner.includes('[')) {
|
|
3784
|
-
prev.posix = true;
|
|
3785
|
-
|
|
3786
|
-
if (inner.includes(':')) {
|
|
3787
|
-
const idx = prev.value.lastIndexOf('[');
|
|
3788
|
-
const pre = prev.value.slice(0, idx);
|
|
3789
|
-
const rest = prev.value.slice(idx + 2);
|
|
3790
|
-
const posix = POSIX_REGEX_SOURCE[rest];
|
|
3791
|
-
if (posix) {
|
|
3792
|
-
prev.value = pre + posix;
|
|
3793
|
-
state.backtrack = true;
|
|
3794
|
-
advance();
|
|
3795
|
-
|
|
3796
|
-
if (!bos.output && tokens.indexOf(prev) === 1) {
|
|
3797
|
-
bos.output = ONE_CHAR;
|
|
3798
|
-
}
|
|
3799
|
-
continue;
|
|
3800
|
-
}
|
|
3801
|
-
}
|
|
3802
|
-
}
|
|
3803
|
-
}
|
|
4844
|
+
if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
|
|
4845
|
+
parsed.output = parse.fastpaths(input, options);
|
|
4846
|
+
}
|
|
3804
4847
|
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
4848
|
+
if (!parsed.output) {
|
|
4849
|
+
parsed = parse(input, options);
|
|
4850
|
+
}
|
|
3808
4851
|
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
}
|
|
4852
|
+
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
4853
|
+
};
|
|
3812
4854
|
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
4855
|
+
/**
|
|
4856
|
+
* Create a regular expression from the given regex source string.
|
|
4857
|
+
*
|
|
4858
|
+
* ```js
|
|
4859
|
+
* const picomatch = require('picomatch');
|
|
4860
|
+
* // picomatch.toRegex(source[, options]);
|
|
4861
|
+
*
|
|
4862
|
+
* const { output } = picomatch.parse('*.js');
|
|
4863
|
+
* console.log(picomatch.toRegex(output));
|
|
4864
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
4865
|
+
* ```
|
|
4866
|
+
* @param {String} `source` Regular expression source string.
|
|
4867
|
+
* @param {Object} `options`
|
|
4868
|
+
* @return {RegExp}
|
|
4869
|
+
* @api public
|
|
4870
|
+
*/
|
|
4871
|
+
|
|
4872
|
+
picomatch.toRegex = (source, options) => {
|
|
4873
|
+
try {
|
|
4874
|
+
const opts = options || {};
|
|
4875
|
+
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
|
4876
|
+
} catch (err) {
|
|
4877
|
+
if (options && options.debug === true) throw err;
|
|
4878
|
+
return /$^/;
|
|
4879
|
+
}
|
|
4880
|
+
};
|
|
3816
4881
|
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
4882
|
+
/**
|
|
4883
|
+
* Picomatch constants.
|
|
4884
|
+
* @return {Object}
|
|
4885
|
+
*/
|
|
3821
4886
|
|
|
3822
|
-
|
|
3823
|
-
* If we're inside a quoted string, continue
|
|
3824
|
-
* until we reach the closing double quote.
|
|
3825
|
-
*/
|
|
4887
|
+
picomatch.constants = constants;
|
|
3826
4888
|
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
append({ value });
|
|
3831
|
-
continue;
|
|
3832
|
-
}
|
|
4889
|
+
/**
|
|
4890
|
+
* Expose "picomatch"
|
|
4891
|
+
*/
|
|
3833
4892
|
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
4893
|
+
picomatch_1$1 = picomatch;
|
|
4894
|
+
return picomatch_1$1;
|
|
4895
|
+
}
|
|
3837
4896
|
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
if (opts.keepQuotes === true) {
|
|
3841
|
-
push({ type: 'text', value });
|
|
3842
|
-
}
|
|
3843
|
-
continue;
|
|
3844
|
-
}
|
|
4897
|
+
var picomatch_1;
|
|
4898
|
+
var hasRequiredPicomatch;
|
|
3845
4899
|
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
4900
|
+
function requirePicomatch () {
|
|
4901
|
+
if (hasRequiredPicomatch) return picomatch_1;
|
|
4902
|
+
hasRequiredPicomatch = 1;
|
|
3849
4903
|
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
push({ type: 'paren', value });
|
|
3853
|
-
continue;
|
|
3854
|
-
}
|
|
4904
|
+
const pico = /*@__PURE__*/ requirePicomatch$1();
|
|
4905
|
+
const utils = /*@__PURE__*/ requireUtils();
|
|
3855
4906
|
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
4907
|
+
function picomatch(glob, options, returnState = false) {
|
|
4908
|
+
// default to os.platform()
|
|
4909
|
+
if (options && (options.windows === null || options.windows === undefined)) {
|
|
4910
|
+
// don't mutate the original options object
|
|
4911
|
+
options = { ...options, windows: utils.isWindows() };
|
|
4912
|
+
}
|
|
3860
4913
|
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
extglobClose(extglobs.pop());
|
|
3864
|
-
continue;
|
|
3865
|
-
}
|
|
4914
|
+
return pico(glob, options, returnState);
|
|
4915
|
+
}
|
|
3866
4916
|
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
/**
|
|
3873
|
-
* Square brackets
|
|
3874
|
-
*/
|
|
3875
|
-
|
|
3876
|
-
if (value === '[') {
|
|
3877
|
-
if (opts.nobracket === true || !remaining().includes(']')) {
|
|
3878
|
-
if (opts.nobracket !== true && opts.strictBrackets === true) {
|
|
3879
|
-
throw new SyntaxError(syntaxError('closing', ']'));
|
|
3880
|
-
}
|
|
3881
|
-
|
|
3882
|
-
value = `\\${value}`;
|
|
3883
|
-
} else {
|
|
3884
|
-
increment('brackets');
|
|
3885
|
-
}
|
|
3886
|
-
|
|
3887
|
-
push({ type: 'bracket', value });
|
|
3888
|
-
continue;
|
|
3889
|
-
}
|
|
3890
|
-
|
|
3891
|
-
if (value === ']') {
|
|
3892
|
-
if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
|
|
3893
|
-
push({ type: 'text', value, output: `\\${value}` });
|
|
3894
|
-
continue;
|
|
3895
|
-
}
|
|
3896
|
-
|
|
3897
|
-
if (state.brackets === 0) {
|
|
3898
|
-
if (opts.strictBrackets === true) {
|
|
3899
|
-
throw new SyntaxError(syntaxError('opening', '['));
|
|
3900
|
-
}
|
|
3901
|
-
|
|
3902
|
-
push({ type: 'text', value, output: `\\${value}` });
|
|
3903
|
-
continue;
|
|
3904
|
-
}
|
|
3905
|
-
|
|
3906
|
-
decrement('brackets');
|
|
3907
|
-
|
|
3908
|
-
const prevValue = prev.value.slice(1);
|
|
3909
|
-
if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
|
|
3910
|
-
value = `/${value}`;
|
|
3911
|
-
}
|
|
3912
|
-
|
|
3913
|
-
prev.value += value;
|
|
3914
|
-
append({ value });
|
|
3915
|
-
|
|
3916
|
-
// when literal brackets are explicitly disabled
|
|
3917
|
-
// assume we should match with a regex character class
|
|
3918
|
-
if (opts.literalBrackets === false || utils$1.hasRegexChars(prevValue)) {
|
|
3919
|
-
continue;
|
|
3920
|
-
}
|
|
3921
|
-
|
|
3922
|
-
const escaped = utils$1.escapeRegex(prev.value);
|
|
3923
|
-
state.output = state.output.slice(0, -prev.value.length);
|
|
3924
|
-
|
|
3925
|
-
// when literal brackets are explicitly enabled
|
|
3926
|
-
// assume we should escape the brackets to match literal characters
|
|
3927
|
-
if (opts.literalBrackets === true) {
|
|
3928
|
-
state.output += escaped;
|
|
3929
|
-
prev.value = escaped;
|
|
3930
|
-
continue;
|
|
3931
|
-
}
|
|
3932
|
-
|
|
3933
|
-
// when the user specifies nothing, try to match both
|
|
3934
|
-
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
3935
|
-
state.output += prev.value;
|
|
3936
|
-
continue;
|
|
3937
|
-
}
|
|
3938
|
-
|
|
3939
|
-
/**
|
|
3940
|
-
* Braces
|
|
3941
|
-
*/
|
|
3942
|
-
|
|
3943
|
-
if (value === '{' && opts.nobrace !== true) {
|
|
3944
|
-
increment('braces');
|
|
3945
|
-
|
|
3946
|
-
const open = {
|
|
3947
|
-
type: 'brace',
|
|
3948
|
-
value,
|
|
3949
|
-
output: '(',
|
|
3950
|
-
outputIndex: state.output.length,
|
|
3951
|
-
tokensIndex: state.tokens.length
|
|
3952
|
-
};
|
|
3953
|
-
|
|
3954
|
-
braces.push(open);
|
|
3955
|
-
push(open);
|
|
3956
|
-
continue;
|
|
3957
|
-
}
|
|
3958
|
-
|
|
3959
|
-
if (value === '}') {
|
|
3960
|
-
const brace = braces[braces.length - 1];
|
|
3961
|
-
|
|
3962
|
-
if (opts.nobrace === true || !brace) {
|
|
3963
|
-
push({ type: 'text', value, output: value });
|
|
3964
|
-
continue;
|
|
3965
|
-
}
|
|
3966
|
-
|
|
3967
|
-
let output = ')';
|
|
3968
|
-
|
|
3969
|
-
if (brace.dots === true) {
|
|
3970
|
-
const arr = tokens.slice();
|
|
3971
|
-
const range = [];
|
|
3972
|
-
|
|
3973
|
-
for (let i = arr.length - 1; i >= 0; i--) {
|
|
3974
|
-
tokens.pop();
|
|
3975
|
-
if (arr[i].type === 'brace') {
|
|
3976
|
-
break;
|
|
3977
|
-
}
|
|
3978
|
-
if (arr[i].type !== 'dots') {
|
|
3979
|
-
range.unshift(arr[i].value);
|
|
3980
|
-
}
|
|
3981
|
-
}
|
|
3982
|
-
|
|
3983
|
-
output = expandRange(range, opts);
|
|
3984
|
-
state.backtrack = true;
|
|
3985
|
-
}
|
|
3986
|
-
|
|
3987
|
-
if (brace.comma !== true && brace.dots !== true) {
|
|
3988
|
-
const out = state.output.slice(0, brace.outputIndex);
|
|
3989
|
-
const toks = state.tokens.slice(brace.tokensIndex);
|
|
3990
|
-
brace.value = brace.output = '\\{';
|
|
3991
|
-
value = output = '\\}';
|
|
3992
|
-
state.output = out;
|
|
3993
|
-
for (const t of toks) {
|
|
3994
|
-
state.output += (t.output || t.value);
|
|
3995
|
-
}
|
|
3996
|
-
}
|
|
3997
|
-
|
|
3998
|
-
push({ type: 'brace', value, output });
|
|
3999
|
-
decrement('braces');
|
|
4000
|
-
braces.pop();
|
|
4001
|
-
continue;
|
|
4002
|
-
}
|
|
4003
|
-
|
|
4004
|
-
/**
|
|
4005
|
-
* Pipes
|
|
4006
|
-
*/
|
|
4007
|
-
|
|
4008
|
-
if (value === '|') {
|
|
4009
|
-
if (extglobs.length > 0) {
|
|
4010
|
-
extglobs[extglobs.length - 1].conditions++;
|
|
4011
|
-
}
|
|
4012
|
-
push({ type: 'text', value });
|
|
4013
|
-
continue;
|
|
4014
|
-
}
|
|
4015
|
-
|
|
4016
|
-
/**
|
|
4017
|
-
* Commas
|
|
4018
|
-
*/
|
|
4019
|
-
|
|
4020
|
-
if (value === ',') {
|
|
4021
|
-
let output = value;
|
|
4022
|
-
|
|
4023
|
-
const brace = braces[braces.length - 1];
|
|
4024
|
-
if (brace && stack[stack.length - 1] === 'braces') {
|
|
4025
|
-
brace.comma = true;
|
|
4026
|
-
output = '|';
|
|
4027
|
-
}
|
|
4028
|
-
|
|
4029
|
-
push({ type: 'comma', value, output });
|
|
4030
|
-
continue;
|
|
4031
|
-
}
|
|
4032
|
-
|
|
4033
|
-
/**
|
|
4034
|
-
* Slashes
|
|
4035
|
-
*/
|
|
4036
|
-
|
|
4037
|
-
if (value === '/') {
|
|
4038
|
-
// if the beginning of the glob is "./", advance the start
|
|
4039
|
-
// to the current index, and don't add the "./" characters
|
|
4040
|
-
// to the state. This greatly simplifies lookbehinds when
|
|
4041
|
-
// checking for BOS characters like "!" and "." (not "./")
|
|
4042
|
-
if (prev.type === 'dot' && state.index === state.start + 1) {
|
|
4043
|
-
state.start = state.index + 1;
|
|
4044
|
-
state.consumed = '';
|
|
4045
|
-
state.output = '';
|
|
4046
|
-
tokens.pop();
|
|
4047
|
-
prev = bos; // reset "prev" to the first token
|
|
4048
|
-
continue;
|
|
4049
|
-
}
|
|
4050
|
-
|
|
4051
|
-
push({ type: 'slash', value, output: SLASH_LITERAL });
|
|
4052
|
-
continue;
|
|
4053
|
-
}
|
|
4054
|
-
|
|
4055
|
-
/**
|
|
4056
|
-
* Dots
|
|
4057
|
-
*/
|
|
4058
|
-
|
|
4059
|
-
if (value === '.') {
|
|
4060
|
-
if (state.braces > 0 && prev.type === 'dot') {
|
|
4061
|
-
if (prev.value === '.') prev.output = DOT_LITERAL;
|
|
4062
|
-
const brace = braces[braces.length - 1];
|
|
4063
|
-
prev.type = 'dots';
|
|
4064
|
-
prev.output += value;
|
|
4065
|
-
prev.value += value;
|
|
4066
|
-
brace.dots = true;
|
|
4067
|
-
continue;
|
|
4068
|
-
}
|
|
4069
|
-
|
|
4070
|
-
if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
|
|
4071
|
-
push({ type: 'text', value, output: DOT_LITERAL });
|
|
4072
|
-
continue;
|
|
4073
|
-
}
|
|
4074
|
-
|
|
4075
|
-
push({ type: 'dot', value, output: DOT_LITERAL });
|
|
4076
|
-
continue;
|
|
4077
|
-
}
|
|
4078
|
-
|
|
4079
|
-
/**
|
|
4080
|
-
* Question marks
|
|
4081
|
-
*/
|
|
4082
|
-
|
|
4083
|
-
if (value === '?') {
|
|
4084
|
-
const isGroup = prev && prev.value === '(';
|
|
4085
|
-
if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
|
4086
|
-
extglobOpen('qmark', value);
|
|
4087
|
-
continue;
|
|
4088
|
-
}
|
|
4089
|
-
|
|
4090
|
-
if (prev && prev.type === 'paren') {
|
|
4091
|
-
const next = peek();
|
|
4092
|
-
let output = value;
|
|
4093
|
-
|
|
4094
|
-
if (next === '<' && !utils$1.supportsLookbehinds()) {
|
|
4095
|
-
throw new Error('Node.js v10 or higher is required for regex lookbehinds');
|
|
4096
|
-
}
|
|
4097
|
-
|
|
4098
|
-
if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
|
|
4099
|
-
output = `\\${value}`;
|
|
4100
|
-
}
|
|
4101
|
-
|
|
4102
|
-
push({ type: 'text', value, output });
|
|
4103
|
-
continue;
|
|
4104
|
-
}
|
|
4105
|
-
|
|
4106
|
-
if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
|
|
4107
|
-
push({ type: 'qmark', value, output: QMARK_NO_DOT });
|
|
4108
|
-
continue;
|
|
4109
|
-
}
|
|
4110
|
-
|
|
4111
|
-
push({ type: 'qmark', value, output: QMARK });
|
|
4112
|
-
continue;
|
|
4113
|
-
}
|
|
4114
|
-
|
|
4115
|
-
/**
|
|
4116
|
-
* Exclamation
|
|
4117
|
-
*/
|
|
4118
|
-
|
|
4119
|
-
if (value === '!') {
|
|
4120
|
-
if (opts.noextglob !== true && peek() === '(') {
|
|
4121
|
-
if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
|
|
4122
|
-
extglobOpen('negate', value);
|
|
4123
|
-
continue;
|
|
4124
|
-
}
|
|
4125
|
-
}
|
|
4126
|
-
|
|
4127
|
-
if (opts.nonegate !== true && state.index === 0) {
|
|
4128
|
-
negate();
|
|
4129
|
-
continue;
|
|
4130
|
-
}
|
|
4131
|
-
}
|
|
4132
|
-
|
|
4133
|
-
/**
|
|
4134
|
-
* Plus
|
|
4135
|
-
*/
|
|
4136
|
-
|
|
4137
|
-
if (value === '+') {
|
|
4138
|
-
if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
|
4139
|
-
extglobOpen('plus', value);
|
|
4140
|
-
continue;
|
|
4141
|
-
}
|
|
4142
|
-
|
|
4143
|
-
if ((prev && prev.value === '(') || opts.regex === false) {
|
|
4144
|
-
push({ type: 'plus', value, output: PLUS_LITERAL });
|
|
4145
|
-
continue;
|
|
4146
|
-
}
|
|
4147
|
-
|
|
4148
|
-
if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
|
|
4149
|
-
push({ type: 'plus', value });
|
|
4150
|
-
continue;
|
|
4151
|
-
}
|
|
4152
|
-
|
|
4153
|
-
push({ type: 'plus', value: PLUS_LITERAL });
|
|
4154
|
-
continue;
|
|
4155
|
-
}
|
|
4156
|
-
|
|
4157
|
-
/**
|
|
4158
|
-
* Plain text
|
|
4159
|
-
*/
|
|
4160
|
-
|
|
4161
|
-
if (value === '@') {
|
|
4162
|
-
if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
|
4163
|
-
push({ type: 'at', extglob: true, value, output: '' });
|
|
4164
|
-
continue;
|
|
4165
|
-
}
|
|
4166
|
-
|
|
4167
|
-
push({ type: 'text', value });
|
|
4168
|
-
continue;
|
|
4169
|
-
}
|
|
4170
|
-
|
|
4171
|
-
/**
|
|
4172
|
-
* Plain text
|
|
4173
|
-
*/
|
|
4174
|
-
|
|
4175
|
-
if (value !== '*') {
|
|
4176
|
-
if (value === '$' || value === '^') {
|
|
4177
|
-
value = `\\${value}`;
|
|
4178
|
-
}
|
|
4179
|
-
|
|
4180
|
-
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
4181
|
-
if (match) {
|
|
4182
|
-
value += match[0];
|
|
4183
|
-
state.index += match[0].length;
|
|
4184
|
-
}
|
|
4185
|
-
|
|
4186
|
-
push({ type: 'text', value });
|
|
4187
|
-
continue;
|
|
4188
|
-
}
|
|
4189
|
-
|
|
4190
|
-
/**
|
|
4191
|
-
* Stars
|
|
4192
|
-
*/
|
|
4193
|
-
|
|
4194
|
-
if (prev && (prev.type === 'globstar' || prev.star === true)) {
|
|
4195
|
-
prev.type = 'star';
|
|
4196
|
-
prev.star = true;
|
|
4197
|
-
prev.value += value;
|
|
4198
|
-
prev.output = star;
|
|
4199
|
-
state.backtrack = true;
|
|
4200
|
-
state.globstar = true;
|
|
4201
|
-
consume(value);
|
|
4202
|
-
continue;
|
|
4203
|
-
}
|
|
4204
|
-
|
|
4205
|
-
let rest = remaining();
|
|
4206
|
-
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
4207
|
-
extglobOpen('star', value);
|
|
4208
|
-
continue;
|
|
4209
|
-
}
|
|
4210
|
-
|
|
4211
|
-
if (prev.type === 'star') {
|
|
4212
|
-
if (opts.noglobstar === true) {
|
|
4213
|
-
consume(value);
|
|
4214
|
-
continue;
|
|
4215
|
-
}
|
|
4216
|
-
|
|
4217
|
-
const prior = prev.prev;
|
|
4218
|
-
const before = prior.prev;
|
|
4219
|
-
const isStart = prior.type === 'slash' || prior.type === 'bos';
|
|
4220
|
-
const afterStar = before && (before.type === 'star' || before.type === 'globstar');
|
|
4221
|
-
|
|
4222
|
-
if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
|
|
4223
|
-
push({ type: 'star', value, output: '' });
|
|
4224
|
-
continue;
|
|
4225
|
-
}
|
|
4226
|
-
|
|
4227
|
-
const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
|
|
4228
|
-
const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
|
|
4229
|
-
if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
|
|
4230
|
-
push({ type: 'star', value, output: '' });
|
|
4231
|
-
continue;
|
|
4232
|
-
}
|
|
4233
|
-
|
|
4234
|
-
// strip consecutive `/**/`
|
|
4235
|
-
while (rest.slice(0, 3) === '/**') {
|
|
4236
|
-
const after = input[state.index + 4];
|
|
4237
|
-
if (after && after !== '/') {
|
|
4238
|
-
break;
|
|
4239
|
-
}
|
|
4240
|
-
rest = rest.slice(3);
|
|
4241
|
-
consume('/**', 3);
|
|
4242
|
-
}
|
|
4243
|
-
|
|
4244
|
-
if (prior.type === 'bos' && eos()) {
|
|
4245
|
-
prev.type = 'globstar';
|
|
4246
|
-
prev.value += value;
|
|
4247
|
-
prev.output = globstar(opts);
|
|
4248
|
-
state.output = prev.output;
|
|
4249
|
-
state.globstar = true;
|
|
4250
|
-
consume(value);
|
|
4251
|
-
continue;
|
|
4252
|
-
}
|
|
4253
|
-
|
|
4254
|
-
if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
|
|
4255
|
-
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
4256
|
-
prior.output = `(?:${prior.output}`;
|
|
4257
|
-
|
|
4258
|
-
prev.type = 'globstar';
|
|
4259
|
-
prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
|
|
4260
|
-
prev.value += value;
|
|
4261
|
-
state.globstar = true;
|
|
4262
|
-
state.output += prior.output + prev.output;
|
|
4263
|
-
consume(value);
|
|
4264
|
-
continue;
|
|
4265
|
-
}
|
|
4266
|
-
|
|
4267
|
-
if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
|
|
4268
|
-
const end = rest[1] !== void 0 ? '|$' : '';
|
|
4269
|
-
|
|
4270
|
-
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
4271
|
-
prior.output = `(?:${prior.output}`;
|
|
4272
|
-
|
|
4273
|
-
prev.type = 'globstar';
|
|
4274
|
-
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
4275
|
-
prev.value += value;
|
|
4276
|
-
|
|
4277
|
-
state.output += prior.output + prev.output;
|
|
4278
|
-
state.globstar = true;
|
|
4279
|
-
|
|
4280
|
-
consume(value + advance());
|
|
4281
|
-
|
|
4282
|
-
push({ type: 'slash', value: '/', output: '' });
|
|
4283
|
-
continue;
|
|
4284
|
-
}
|
|
4285
|
-
|
|
4286
|
-
if (prior.type === 'bos' && rest[0] === '/') {
|
|
4287
|
-
prev.type = 'globstar';
|
|
4288
|
-
prev.value += value;
|
|
4289
|
-
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
4290
|
-
state.output = prev.output;
|
|
4291
|
-
state.globstar = true;
|
|
4292
|
-
consume(value + advance());
|
|
4293
|
-
push({ type: 'slash', value: '/', output: '' });
|
|
4294
|
-
continue;
|
|
4295
|
-
}
|
|
4296
|
-
|
|
4297
|
-
// remove single star from output
|
|
4298
|
-
state.output = state.output.slice(0, -prev.output.length);
|
|
4299
|
-
|
|
4300
|
-
// reset previous token to globstar
|
|
4301
|
-
prev.type = 'globstar';
|
|
4302
|
-
prev.output = globstar(opts);
|
|
4303
|
-
prev.value += value;
|
|
4304
|
-
|
|
4305
|
-
// reset output with globstar
|
|
4306
|
-
state.output += prev.output;
|
|
4307
|
-
state.globstar = true;
|
|
4308
|
-
consume(value);
|
|
4309
|
-
continue;
|
|
4310
|
-
}
|
|
4311
|
-
|
|
4312
|
-
const token = { type: 'star', value, output: star };
|
|
4313
|
-
|
|
4314
|
-
if (opts.bash === true) {
|
|
4315
|
-
token.output = '.*?';
|
|
4316
|
-
if (prev.type === 'bos' || prev.type === 'slash') {
|
|
4317
|
-
token.output = nodot + token.output;
|
|
4318
|
-
}
|
|
4319
|
-
push(token);
|
|
4320
|
-
continue;
|
|
4321
|
-
}
|
|
4322
|
-
|
|
4323
|
-
if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
|
|
4324
|
-
token.output = value;
|
|
4325
|
-
push(token);
|
|
4326
|
-
continue;
|
|
4327
|
-
}
|
|
4328
|
-
|
|
4329
|
-
if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
|
|
4330
|
-
if (prev.type === 'dot') {
|
|
4331
|
-
state.output += NO_DOT_SLASH;
|
|
4332
|
-
prev.output += NO_DOT_SLASH;
|
|
4333
|
-
|
|
4334
|
-
} else if (opts.dot === true) {
|
|
4335
|
-
state.output += NO_DOTS_SLASH;
|
|
4336
|
-
prev.output += NO_DOTS_SLASH;
|
|
4337
|
-
|
|
4338
|
-
} else {
|
|
4339
|
-
state.output += nodot;
|
|
4340
|
-
prev.output += nodot;
|
|
4341
|
-
}
|
|
4342
|
-
|
|
4343
|
-
if (peek() !== '*') {
|
|
4344
|
-
state.output += ONE_CHAR;
|
|
4345
|
-
prev.output += ONE_CHAR;
|
|
4346
|
-
}
|
|
4347
|
-
}
|
|
4348
|
-
|
|
4349
|
-
push(token);
|
|
4350
|
-
}
|
|
4351
|
-
|
|
4352
|
-
while (state.brackets > 0) {
|
|
4353
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
|
|
4354
|
-
state.output = utils$1.escapeLast(state.output, '[');
|
|
4355
|
-
decrement('brackets');
|
|
4356
|
-
}
|
|
4357
|
-
|
|
4358
|
-
while (state.parens > 0) {
|
|
4359
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
|
|
4360
|
-
state.output = utils$1.escapeLast(state.output, '(');
|
|
4361
|
-
decrement('parens');
|
|
4362
|
-
}
|
|
4363
|
-
|
|
4364
|
-
while (state.braces > 0) {
|
|
4365
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
|
|
4366
|
-
state.output = utils$1.escapeLast(state.output, '{');
|
|
4367
|
-
decrement('braces');
|
|
4368
|
-
}
|
|
4369
|
-
|
|
4370
|
-
if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
|
|
4371
|
-
push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
|
|
4372
|
-
}
|
|
4373
|
-
|
|
4374
|
-
// rebuild the output if we had to backtrack at any point
|
|
4375
|
-
if (state.backtrack === true) {
|
|
4376
|
-
state.output = '';
|
|
4377
|
-
|
|
4378
|
-
for (const token of state.tokens) {
|
|
4379
|
-
state.output += token.output != null ? token.output : token.value;
|
|
4380
|
-
|
|
4381
|
-
if (token.suffix) {
|
|
4382
|
-
state.output += token.suffix;
|
|
4383
|
-
}
|
|
4384
|
-
}
|
|
4385
|
-
}
|
|
4386
|
-
|
|
4387
|
-
return state;
|
|
4388
|
-
};
|
|
4389
|
-
|
|
4390
|
-
/**
|
|
4391
|
-
* Fast paths for creating regular expressions for common glob patterns.
|
|
4392
|
-
* This can significantly speed up processing and has very little downside
|
|
4393
|
-
* impact when none of the fast paths match.
|
|
4394
|
-
*/
|
|
4395
|
-
|
|
4396
|
-
parse$1.fastpaths = (input, options) => {
|
|
4397
|
-
const opts = { ...options };
|
|
4398
|
-
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
4399
|
-
const len = input.length;
|
|
4400
|
-
if (len > max) {
|
|
4401
|
-
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
4402
|
-
}
|
|
4403
|
-
|
|
4404
|
-
input = REPLACEMENTS[input] || input;
|
|
4405
|
-
|
|
4406
|
-
// create constants based on platform, for windows or posix
|
|
4407
|
-
const {
|
|
4408
|
-
DOT_LITERAL,
|
|
4409
|
-
SLASH_LITERAL,
|
|
4410
|
-
ONE_CHAR,
|
|
4411
|
-
DOTS_SLASH,
|
|
4412
|
-
NO_DOT,
|
|
4413
|
-
NO_DOTS,
|
|
4414
|
-
NO_DOTS_SLASH,
|
|
4415
|
-
STAR,
|
|
4416
|
-
START_ANCHOR
|
|
4417
|
-
} = constants$1.globChars(opts.windows);
|
|
4418
|
-
|
|
4419
|
-
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
4420
|
-
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
4421
|
-
const capture = opts.capture ? '' : '?:';
|
|
4422
|
-
const state = { negated: false, prefix: '' };
|
|
4423
|
-
let star = opts.bash === true ? '.*?' : STAR;
|
|
4424
|
-
|
|
4425
|
-
if (opts.capture) {
|
|
4426
|
-
star = `(${star})`;
|
|
4427
|
-
}
|
|
4428
|
-
|
|
4429
|
-
const globstar = (opts) => {
|
|
4430
|
-
if (opts.noglobstar === true) return star;
|
|
4431
|
-
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
4432
|
-
};
|
|
4433
|
-
|
|
4434
|
-
const create = str => {
|
|
4435
|
-
switch (str) {
|
|
4436
|
-
case '*':
|
|
4437
|
-
return `${nodot}${ONE_CHAR}${star}`;
|
|
4438
|
-
|
|
4439
|
-
case '.*':
|
|
4440
|
-
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
4441
|
-
|
|
4442
|
-
case '*.*':
|
|
4443
|
-
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
4444
|
-
|
|
4445
|
-
case '*/*':
|
|
4446
|
-
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
4447
|
-
|
|
4448
|
-
case '**':
|
|
4449
|
-
return nodot + globstar(opts);
|
|
4450
|
-
|
|
4451
|
-
case '**/*':
|
|
4452
|
-
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
4453
|
-
|
|
4454
|
-
case '**/*.*':
|
|
4455
|
-
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
4456
|
-
|
|
4457
|
-
case '**/.*':
|
|
4458
|
-
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
4459
|
-
|
|
4460
|
-
default: {
|
|
4461
|
-
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
4462
|
-
if (!match) return;
|
|
4463
|
-
|
|
4464
|
-
const source = create(match[1]);
|
|
4465
|
-
if (!source) return;
|
|
4466
|
-
|
|
4467
|
-
return source + DOT_LITERAL + match[2];
|
|
4468
|
-
}
|
|
4469
|
-
}
|
|
4470
|
-
};
|
|
4471
|
-
|
|
4472
|
-
const output = utils$1.removePrefix(input, state);
|
|
4473
|
-
let source = create(output);
|
|
4474
|
-
|
|
4475
|
-
if (source && opts.strictSlashes !== true) {
|
|
4476
|
-
source += `${SLASH_LITERAL}?`;
|
|
4477
|
-
}
|
|
4478
|
-
|
|
4479
|
-
return source;
|
|
4480
|
-
};
|
|
4481
|
-
|
|
4482
|
-
var parse_1 = parse$1;
|
|
4483
|
-
|
|
4484
|
-
const scan = scan_1;
|
|
4485
|
-
const parse = parse_1;
|
|
4486
|
-
const utils = utils$3;
|
|
4487
|
-
const constants = constants$2;
|
|
4488
|
-
const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
4489
|
-
|
|
4490
|
-
/**
|
|
4491
|
-
* Creates a matcher function from one or more glob patterns. The
|
|
4492
|
-
* returned function takes a string to match as its first argument,
|
|
4493
|
-
* and returns true if the string is a match. The returned matcher
|
|
4494
|
-
* function also takes a boolean as the second argument that, when true,
|
|
4495
|
-
* returns an object with additional information.
|
|
4496
|
-
*
|
|
4497
|
-
* ```js
|
|
4498
|
-
* const picomatch = require('picomatch');
|
|
4499
|
-
* // picomatch(glob[, options]);
|
|
4500
|
-
*
|
|
4501
|
-
* const isMatch = picomatch('*.!(*a)');
|
|
4502
|
-
* console.log(isMatch('a.a')); //=> false
|
|
4503
|
-
* console.log(isMatch('a.b')); //=> true
|
|
4504
|
-
* ```
|
|
4505
|
-
* @name picomatch
|
|
4506
|
-
* @param {String|Array} `globs` One or more glob patterns.
|
|
4507
|
-
* @param {Object=} `options`
|
|
4508
|
-
* @return {Function=} Returns a matcher function.
|
|
4509
|
-
* @api public
|
|
4510
|
-
*/
|
|
4511
|
-
|
|
4512
|
-
const picomatch = (glob, options, returnState = false) => {
|
|
4513
|
-
if (Array.isArray(glob)) {
|
|
4514
|
-
const fns = glob.map(input => picomatch(input, options, returnState));
|
|
4515
|
-
const arrayMatcher = str => {
|
|
4516
|
-
for (const isMatch of fns) {
|
|
4517
|
-
const state = isMatch(str);
|
|
4518
|
-
if (state) return state;
|
|
4519
|
-
}
|
|
4520
|
-
return false;
|
|
4521
|
-
};
|
|
4522
|
-
return arrayMatcher;
|
|
4523
|
-
}
|
|
4524
|
-
|
|
4525
|
-
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
4526
|
-
|
|
4527
|
-
if (glob === '' || (typeof glob !== 'string' && !isState)) {
|
|
4528
|
-
throw new TypeError('Expected pattern to be a non-empty string');
|
|
4529
|
-
}
|
|
4530
|
-
|
|
4531
|
-
const opts = options || {};
|
|
4532
|
-
const posix = opts.windows;
|
|
4533
|
-
const regex = isState
|
|
4534
|
-
? picomatch.compileRe(glob, options)
|
|
4535
|
-
: picomatch.makeRe(glob, options, false, true);
|
|
4536
|
-
|
|
4537
|
-
const state = regex.state;
|
|
4538
|
-
delete regex.state;
|
|
4539
|
-
|
|
4540
|
-
let isIgnored = () => false;
|
|
4541
|
-
if (opts.ignore) {
|
|
4542
|
-
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
4543
|
-
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
4544
|
-
}
|
|
4545
|
-
|
|
4546
|
-
const matcher = (input, returnObject = false) => {
|
|
4547
|
-
const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
|
|
4548
|
-
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
|
4549
|
-
|
|
4550
|
-
if (typeof opts.onResult === 'function') {
|
|
4551
|
-
opts.onResult(result);
|
|
4552
|
-
}
|
|
4553
|
-
|
|
4554
|
-
if (isMatch === false) {
|
|
4555
|
-
result.isMatch = false;
|
|
4556
|
-
return returnObject ? result : false;
|
|
4557
|
-
}
|
|
4558
|
-
|
|
4559
|
-
if (isIgnored(input)) {
|
|
4560
|
-
if (typeof opts.onIgnore === 'function') {
|
|
4561
|
-
opts.onIgnore(result);
|
|
4562
|
-
}
|
|
4563
|
-
result.isMatch = false;
|
|
4564
|
-
return returnObject ? result : false;
|
|
4565
|
-
}
|
|
4566
|
-
|
|
4567
|
-
if (typeof opts.onMatch === 'function') {
|
|
4568
|
-
opts.onMatch(result);
|
|
4569
|
-
}
|
|
4570
|
-
return returnObject ? result : true;
|
|
4571
|
-
};
|
|
4572
|
-
|
|
4573
|
-
if (returnState) {
|
|
4574
|
-
matcher.state = state;
|
|
4575
|
-
}
|
|
4576
|
-
|
|
4577
|
-
return matcher;
|
|
4578
|
-
};
|
|
4579
|
-
|
|
4580
|
-
/**
|
|
4581
|
-
* Test `input` with the given `regex`. This is used by the main
|
|
4582
|
-
* `picomatch()` function to test the input string.
|
|
4583
|
-
*
|
|
4584
|
-
* ```js
|
|
4585
|
-
* const picomatch = require('picomatch');
|
|
4586
|
-
* // picomatch.test(input, regex[, options]);
|
|
4587
|
-
*
|
|
4588
|
-
* console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
|
4589
|
-
* // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
|
4590
|
-
* ```
|
|
4591
|
-
* @param {String} `input` String to test.
|
|
4592
|
-
* @param {RegExp} `regex`
|
|
4593
|
-
* @return {Object} Returns an object with matching info.
|
|
4594
|
-
* @api public
|
|
4595
|
-
*/
|
|
4596
|
-
|
|
4597
|
-
picomatch.test = (input, regex, options, { glob, posix } = {}) => {
|
|
4598
|
-
if (typeof input !== 'string') {
|
|
4599
|
-
throw new TypeError('Expected input to be a string');
|
|
4600
|
-
}
|
|
4601
|
-
|
|
4602
|
-
if (input === '') {
|
|
4603
|
-
return { isMatch: false, output: '' };
|
|
4604
|
-
}
|
|
4605
|
-
|
|
4606
|
-
const opts = options || {};
|
|
4607
|
-
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
4608
|
-
let match = input === glob;
|
|
4609
|
-
let output = (match && format) ? format(input) : input;
|
|
4610
|
-
|
|
4611
|
-
if (match === false) {
|
|
4612
|
-
output = format ? format(input) : input;
|
|
4613
|
-
match = output === glob;
|
|
4614
|
-
}
|
|
4615
|
-
|
|
4616
|
-
if (match === false || opts.capture === true) {
|
|
4617
|
-
if (opts.matchBase === true || opts.basename === true) {
|
|
4618
|
-
match = picomatch.matchBase(input, regex, options, posix);
|
|
4619
|
-
} else {
|
|
4620
|
-
match = regex.exec(output);
|
|
4621
|
-
}
|
|
4622
|
-
}
|
|
4623
|
-
|
|
4624
|
-
return { isMatch: Boolean(match), match, output };
|
|
4625
|
-
};
|
|
4626
|
-
|
|
4627
|
-
/**
|
|
4628
|
-
* Match the basename of a filepath.
|
|
4629
|
-
*
|
|
4630
|
-
* ```js
|
|
4631
|
-
* const picomatch = require('picomatch');
|
|
4632
|
-
* // picomatch.matchBase(input, glob[, options]);
|
|
4633
|
-
* console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
|
4634
|
-
* ```
|
|
4635
|
-
* @param {String} `input` String to test.
|
|
4636
|
-
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
|
|
4637
|
-
* @return {Boolean}
|
|
4638
|
-
* @api public
|
|
4639
|
-
*/
|
|
4640
|
-
|
|
4641
|
-
picomatch.matchBase = (input, glob, options) => {
|
|
4642
|
-
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
4643
|
-
return regex.test(utils.basename(input));
|
|
4644
|
-
};
|
|
4645
|
-
|
|
4646
|
-
/**
|
|
4647
|
-
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
|
4648
|
-
*
|
|
4649
|
-
* ```js
|
|
4650
|
-
* const picomatch = require('picomatch');
|
|
4651
|
-
* // picomatch.isMatch(string, patterns[, options]);
|
|
4652
|
-
*
|
|
4653
|
-
* console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
|
4654
|
-
* console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
|
4655
|
-
* ```
|
|
4656
|
-
* @param {String|Array} str The string to test.
|
|
4657
|
-
* @param {String|Array} patterns One or more glob patterns to use for matching.
|
|
4658
|
-
* @param {Object} [options] See available [options](#options).
|
|
4659
|
-
* @return {Boolean} Returns true if any patterns match `str`
|
|
4660
|
-
* @api public
|
|
4661
|
-
*/
|
|
4662
|
-
|
|
4663
|
-
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
4664
|
-
|
|
4665
|
-
/**
|
|
4666
|
-
* Parse a glob pattern to create the source string for a regular
|
|
4667
|
-
* expression.
|
|
4668
|
-
*
|
|
4669
|
-
* ```js
|
|
4670
|
-
* const picomatch = require('picomatch');
|
|
4671
|
-
* const result = picomatch.parse(pattern[, options]);
|
|
4672
|
-
* ```
|
|
4673
|
-
* @param {String} `pattern`
|
|
4674
|
-
* @param {Object} `options`
|
|
4675
|
-
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
|
|
4676
|
-
* @api public
|
|
4677
|
-
*/
|
|
4678
|
-
|
|
4679
|
-
picomatch.parse = (pattern, options) => {
|
|
4680
|
-
if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));
|
|
4681
|
-
return parse(pattern, { ...options, fastpaths: false });
|
|
4682
|
-
};
|
|
4683
|
-
|
|
4684
|
-
/**
|
|
4685
|
-
* Scan a glob pattern to separate the pattern into segments.
|
|
4686
|
-
*
|
|
4687
|
-
* ```js
|
|
4688
|
-
* const picomatch = require('picomatch');
|
|
4689
|
-
* // picomatch.scan(input[, options]);
|
|
4690
|
-
*
|
|
4691
|
-
* const result = picomatch.scan('!./foo/*.js');
|
|
4692
|
-
* console.log(result);
|
|
4693
|
-
* { prefix: '!./',
|
|
4694
|
-
* input: '!./foo/*.js',
|
|
4695
|
-
* start: 3,
|
|
4696
|
-
* base: 'foo',
|
|
4697
|
-
* glob: '*.js',
|
|
4698
|
-
* isBrace: false,
|
|
4699
|
-
* isBracket: false,
|
|
4700
|
-
* isGlob: true,
|
|
4701
|
-
* isExtglob: false,
|
|
4702
|
-
* isGlobstar: false,
|
|
4703
|
-
* negated: true }
|
|
4704
|
-
* ```
|
|
4705
|
-
* @param {String} `input` Glob pattern to scan.
|
|
4706
|
-
* @param {Object} `options`
|
|
4707
|
-
* @return {Object} Returns an object with
|
|
4708
|
-
* @api public
|
|
4709
|
-
*/
|
|
4710
|
-
|
|
4711
|
-
picomatch.scan = (input, options) => scan(input, options);
|
|
4712
|
-
|
|
4713
|
-
/**
|
|
4714
|
-
* Create a regular expression from a parsed glob pattern.
|
|
4715
|
-
*
|
|
4716
|
-
* ```js
|
|
4717
|
-
* const picomatch = require('picomatch');
|
|
4718
|
-
* const state = picomatch.parse('*.js');
|
|
4719
|
-
* // picomatch.compileRe(state[, options]);
|
|
4720
|
-
*
|
|
4721
|
-
* console.log(picomatch.compileRe(state));
|
|
4722
|
-
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
4723
|
-
* ```
|
|
4724
|
-
* @param {String} `state` The object returned from the `.parse` method.
|
|
4725
|
-
* @param {Object} `options`
|
|
4726
|
-
* @return {RegExp} Returns a regex created from the given pattern.
|
|
4727
|
-
* @api public
|
|
4728
|
-
*/
|
|
4729
|
-
|
|
4730
|
-
picomatch.compileRe = (parsed, options, returnOutput = false, returnState = false) => {
|
|
4731
|
-
if (returnOutput === true) {
|
|
4732
|
-
return parsed.output;
|
|
4733
|
-
}
|
|
4734
|
-
|
|
4735
|
-
const opts = options || {};
|
|
4736
|
-
const prepend = opts.contains ? '' : '^';
|
|
4737
|
-
const append = opts.contains ? '' : '$';
|
|
4738
|
-
|
|
4739
|
-
let source = `${prepend}(?:${parsed.output})${append}`;
|
|
4740
|
-
if (parsed && parsed.negated === true) {
|
|
4741
|
-
source = `^(?!${source}).*$`;
|
|
4742
|
-
}
|
|
4743
|
-
|
|
4744
|
-
const regex = picomatch.toRegex(source, options);
|
|
4745
|
-
if (returnState === true) {
|
|
4746
|
-
regex.state = parsed;
|
|
4747
|
-
}
|
|
4748
|
-
|
|
4749
|
-
return regex;
|
|
4750
|
-
};
|
|
4751
|
-
|
|
4752
|
-
picomatch.makeRe = (input, options, returnOutput = false, returnState = false) => {
|
|
4753
|
-
if (!input || typeof input !== 'string') {
|
|
4754
|
-
throw new TypeError('Expected a non-empty string');
|
|
4755
|
-
}
|
|
4756
|
-
|
|
4757
|
-
const opts = options || {};
|
|
4758
|
-
let parsed = { negated: false, fastpaths: true };
|
|
4759
|
-
let prefix = '';
|
|
4760
|
-
let output;
|
|
4761
|
-
|
|
4762
|
-
if (input.startsWith('./')) {
|
|
4763
|
-
input = input.slice(2);
|
|
4764
|
-
prefix = parsed.prefix = './';
|
|
4765
|
-
}
|
|
4766
|
-
|
|
4767
|
-
if (opts.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
|
|
4768
|
-
output = parse.fastpaths(input, options);
|
|
4769
|
-
}
|
|
4770
|
-
|
|
4771
|
-
if (output === undefined) {
|
|
4772
|
-
parsed = parse(input, options);
|
|
4773
|
-
parsed.prefix = prefix + (parsed.prefix || '');
|
|
4774
|
-
} else {
|
|
4775
|
-
parsed.output = output;
|
|
4776
|
-
}
|
|
4777
|
-
|
|
4778
|
-
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
4779
|
-
};
|
|
4780
|
-
|
|
4781
|
-
/**
|
|
4782
|
-
* Create a regular expression from the given regex source string.
|
|
4783
|
-
*
|
|
4784
|
-
* ```js
|
|
4785
|
-
* const picomatch = require('picomatch');
|
|
4786
|
-
* // picomatch.toRegex(source[, options]);
|
|
4787
|
-
*
|
|
4788
|
-
* const { output } = picomatch.parse('*.js');
|
|
4789
|
-
* console.log(picomatch.toRegex(output));
|
|
4790
|
-
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
4791
|
-
* ```
|
|
4792
|
-
* @param {String} `source` Regular expression source string.
|
|
4793
|
-
* @param {Object} `options`
|
|
4794
|
-
* @return {RegExp}
|
|
4795
|
-
* @api public
|
|
4796
|
-
*/
|
|
4797
|
-
|
|
4798
|
-
picomatch.toRegex = (source, options) => {
|
|
4799
|
-
try {
|
|
4800
|
-
const opts = options || {};
|
|
4801
|
-
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
|
4802
|
-
} catch (err) {
|
|
4803
|
-
if (options && options.debug === true) throw err;
|
|
4804
|
-
return /$^/;
|
|
4805
|
-
}
|
|
4806
|
-
};
|
|
4807
|
-
|
|
4808
|
-
/**
|
|
4809
|
-
* Picomatch constants.
|
|
4810
|
-
* @return {Object}
|
|
4811
|
-
*/
|
|
4812
|
-
|
|
4813
|
-
picomatch.constants = constants;
|
|
4814
|
-
|
|
4815
|
-
/**
|
|
4816
|
-
* Expose "picomatch"
|
|
4817
|
-
*/
|
|
4818
|
-
|
|
4819
|
-
var picomatch_1 = picomatch;
|
|
4820
|
-
|
|
4821
|
-
var picomatchBrowser = picomatch_1;
|
|
4917
|
+
Object.assign(picomatch, pico);
|
|
4918
|
+
picomatch_1 = picomatch;
|
|
4919
|
+
return picomatch_1;
|
|
4920
|
+
}
|
|
4822
4921
|
|
|
4823
|
-
var
|
|
4922
|
+
var picomatchExports = /*@__PURE__*/ requirePicomatch();
|
|
4923
|
+
var pm = /*@__PURE__*/getDefaultExportFromCjs(picomatchExports);
|
|
4824
4924
|
|
|
4825
4925
|
function isArray(arg) {
|
|
4826
4926
|
return Array.isArray(arg);
|
|
@@ -4913,10 +5013,10 @@ var drawChart = (function (exports) {
|
|
|
4913
5013
|
const useFilter = () => {
|
|
4914
5014
|
const [includeFilter, setIncludeFilter] = h("");
|
|
4915
5015
|
const [excludeFilter, setExcludeFilter] = h("");
|
|
4916
|
-
const setIncludeFilterTrottled =
|
|
4917
|
-
const setExcludeFilterTrottled =
|
|
4918
|
-
const isIncluded =
|
|
4919
|
-
const getModuleFilterMultiplier =
|
|
5016
|
+
const setIncludeFilterTrottled = T(() => throttleFilter(setIncludeFilter, 200), []);
|
|
5017
|
+
const setExcludeFilterTrottled = T(() => throttleFilter(setExcludeFilter, 200), []);
|
|
5018
|
+
const isIncluded = T(() => createFilter(prepareFilter(includeFilter), prepareFilter(excludeFilter)), [includeFilter, excludeFilter]);
|
|
5019
|
+
const getModuleFilterMultiplier = q((bundleId, data) => {
|
|
4920
5020
|
return isIncluded(bundleId, data.id) ? 1 : 0;
|
|
4921
5021
|
}, [isIncluded]);
|
|
4922
5022
|
return {
|
|
@@ -4928,7 +5028,7 @@ var drawChart = (function (exports) {
|
|
|
4928
5028
|
};
|
|
4929
5029
|
};
|
|
4930
5030
|
|
|
4931
|
-
const PLACEHOLDER = "
|
|
5031
|
+
const PLACEHOLDER = "*/**/file.js";
|
|
4932
5032
|
const SideBar = ({ availableSizeProperties, sizeProperty, setSizeProperty, onExcludeChange, onIncludeChange, }) => {
|
|
4933
5033
|
const [includeValue, setIncludeValue] = h("");
|
|
4934
5034
|
const [excludeValue, setExcludeValue] = h("");
|
|
@@ -4947,25 +5047,25 @@ var drawChart = (function (exports) {
|
|
|
4947
5047
|
setExcludeValue(value);
|
|
4948
5048
|
onExcludeChange(value);
|
|
4949
5049
|
};
|
|
4950
|
-
return (
|
|
5050
|
+
return (u$1("aside", { className: "sidebar", children: [u$1("div", { className: "size-selectors", children: availableSizeProperties.length > 1 &&
|
|
4951
5051
|
availableSizeProperties.map((sizeProp) => {
|
|
4952
5052
|
const id = `selector-${sizeProp}`;
|
|
4953
|
-
return (
|
|
4954
|
-
}) }),
|
|
5053
|
+
return (u$1("div", { className: "size-selector", children: [u$1("input", { type: "radio", id: id, checked: sizeProp === sizeProperty, onChange: handleSizePropertyChange(sizeProp) }), u$1("label", { htmlFor: id, children: LABELS[sizeProp] })] }, sizeProp));
|
|
5054
|
+
}) }), u$1("div", { className: "module-filters", children: [u$1("div", { className: "module-filter", children: [u$1("label", { htmlFor: "module-filter-exclude", children: "Exclude" }), u$1("input", { type: "text", id: "module-filter-exclude", value: excludeValue, onInput: handleExcludeChange, placeholder: PLACEHOLDER })] }), u$1("div", { className: "module-filter", children: [u$1("label", { htmlFor: "module-filter-include", children: "Include" }), u$1("input", { type: "text", id: "module-filter-include", value: includeValue, onInput: handleIncludeChange, placeholder: PLACEHOLDER })] })] })] }));
|
|
4955
5055
|
};
|
|
4956
5056
|
|
|
4957
5057
|
const Tooltip_marginX = 10;
|
|
4958
5058
|
const Tooltip_marginY = 30;
|
|
4959
5059
|
const Tooltip = ({ node, visible }) => {
|
|
4960
|
-
const { data } =
|
|
4961
|
-
const ref =
|
|
5060
|
+
const { data } = x$2(StaticContext);
|
|
5061
|
+
const ref = A(null);
|
|
4962
5062
|
const [style, setStyle] = h({});
|
|
4963
|
-
const content =
|
|
5063
|
+
const content = T(() => {
|
|
4964
5064
|
if (!node)
|
|
4965
5065
|
return null;
|
|
4966
|
-
return (
|
|
5066
|
+
return (u$1(k$1, { children: [u$1("div", { children: node.id }), node.uid && (u$1("div", { children: [u$1("div", { children: [u$1("b", { children: "Imported By" }), ":"] }), data.nodeMetas[node.uid].importedBy.map(({ uid }) => {
|
|
4967
5067
|
const { id } = data.nodeMetas[uid];
|
|
4968
|
-
return
|
|
5068
|
+
return u$1("div", { children: id }, id);
|
|
4969
5069
|
})] }))] }));
|
|
4970
5070
|
}, [data, node]);
|
|
4971
5071
|
const updatePosition = (mouseCoords) => {
|
|
@@ -4978,15 +5078,15 @@ var drawChart = (function (exports) {
|
|
|
4978
5078
|
const boundingRect = ref.current.getBoundingClientRect();
|
|
4979
5079
|
if (pos.left + boundingRect.width > window.innerWidth) {
|
|
4980
5080
|
// Shifting horizontally
|
|
4981
|
-
pos.left = window.innerWidth - boundingRect.width;
|
|
5081
|
+
pos.left = Math.max(0, window.innerWidth - boundingRect.width);
|
|
4982
5082
|
}
|
|
4983
5083
|
if (pos.top + boundingRect.height > window.innerHeight) {
|
|
4984
5084
|
// Flipping vertically
|
|
4985
|
-
pos.top = mouseCoords.y - Tooltip_marginY - boundingRect.height;
|
|
5085
|
+
pos.top = Math.max(0, mouseCoords.y - Tooltip_marginY - boundingRect.height);
|
|
4986
5086
|
}
|
|
4987
5087
|
setStyle(pos);
|
|
4988
5088
|
};
|
|
4989
|
-
|
|
5089
|
+
y$2(() => {
|
|
4990
5090
|
const handleMouseMove = (event) => {
|
|
4991
5091
|
updatePosition({
|
|
4992
5092
|
x: event.pageX,
|
|
@@ -4998,7 +5098,7 @@ var drawChart = (function (exports) {
|
|
|
4998
5098
|
document.removeEventListener("mousemove", handleMouseMove, true);
|
|
4999
5099
|
};
|
|
5000
5100
|
}, []);
|
|
5001
|
-
return (
|
|
5101
|
+
return (u$1("div", { className: `tooltip ${visible ? "" : "tooltip-hidden"}`, ref: ref, style: style, children: content }));
|
|
5002
5102
|
};
|
|
5003
5103
|
|
|
5004
5104
|
class Transform {
|
|
@@ -5033,9 +5133,9 @@ var drawChart = (function (exports) {
|
|
|
5033
5133
|
return x === transform.x && y === transform.y ? transform : new Transform(transform.k, x, y);
|
|
5034
5134
|
};
|
|
5035
5135
|
const Network = ({ links, nodes, onNodeHover, onNodeDblClick, getColor, onCanvasClick, onNodeClick, }) => {
|
|
5036
|
-
const { width, height } =
|
|
5136
|
+
const { width, height } = x$2(StaticContext);
|
|
5037
5137
|
const [transform, setTransform] = h(identityTransform);
|
|
5038
|
-
const startPosRef =
|
|
5138
|
+
const startPosRef = A();
|
|
5039
5139
|
const [dragging, setDragging] = h(false);
|
|
5040
5140
|
const handleMouseDown = (event) => {
|
|
5041
5141
|
if (event.ctrlKey || event.button) {
|
|
@@ -5058,10 +5158,10 @@ var drawChart = (function (exports) {
|
|
|
5058
5158
|
return;
|
|
5059
5159
|
setDragging(false);
|
|
5060
5160
|
};
|
|
5061
|
-
return (
|
|
5062
|
-
return (
|
|
5063
|
-
}) }),
|
|
5064
|
-
return (
|
|
5161
|
+
return (u$1("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: `${-width / 2} ${-height / 2} ${width} ${height}`, onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, onClick: onCanvasClick, children: u$1("g", { transform: transform.toString(), children: [u$1("g", { stroke: "#fff", "stroke-opacity": "0.9", children: links.map((link) => {
|
|
5162
|
+
return (u$1("line", { "stroke-width": "1", x1: link.source.x, y1: link.source.y, x2: link.target.x, y2: link.target.y }, `${link.source.uid} - ${link.target.uid}`));
|
|
5163
|
+
}) }), u$1("g", { stroke: "#fff", "stroke-width": "1.5", children: nodes.map((node) => {
|
|
5164
|
+
return (u$1("circle", { className: "node", r: node.radius, fill: getColor(node), cx: node.x, cy: node.y, onMouseOver: (evt) => {
|
|
5065
5165
|
noEvent(evt);
|
|
5066
5166
|
onNodeHover(node);
|
|
5067
5167
|
}, onClick: (evt) => {
|
|
@@ -5077,7 +5177,7 @@ var drawChart = (function (exports) {
|
|
|
5077
5177
|
const Chart = ({ links, nodes, onNodeExclude, getColor, onNodeSelect, }) => {
|
|
5078
5178
|
const [showTooltip, setShowTooltip] = h(false);
|
|
5079
5179
|
const [tooltipNode, setTooltipNode] = h(undefined);
|
|
5080
|
-
|
|
5180
|
+
y$2(() => {
|
|
5081
5181
|
const handleMouseOut = () => {
|
|
5082
5182
|
setShowTooltip(false);
|
|
5083
5183
|
};
|
|
@@ -5086,12 +5186,12 @@ var drawChart = (function (exports) {
|
|
|
5086
5186
|
document.removeEventListener("mouseover", handleMouseOut);
|
|
5087
5187
|
};
|
|
5088
5188
|
}, []);
|
|
5089
|
-
return (
|
|
5189
|
+
return (u$1(k$1, { children: [u$1(Network, { links: links, nodes: nodes, onNodeHover: (node) => {
|
|
5090
5190
|
setTooltipNode(node);
|
|
5091
5191
|
setShowTooltip(true);
|
|
5092
5192
|
}, onNodeDblClick: onNodeExclude, onNodeClick: (node) => onNodeSelect(node.uid), onCanvasClick: () => {
|
|
5093
5193
|
onNodeSelect(undefined);
|
|
5094
|
-
}, getColor: getColor }),
|
|
5194
|
+
}, getColor: getColor }), u$1(Tooltip, { visible: showTooltip, node: tooltipNode })] }));
|
|
5095
5195
|
};
|
|
5096
5196
|
|
|
5097
5197
|
const createRainbowColor = (groups) => {
|
|
@@ -5114,13 +5214,13 @@ var drawChart = (function (exports) {
|
|
|
5114
5214
|
};
|
|
5115
5215
|
|
|
5116
5216
|
const Main = () => {
|
|
5117
|
-
const { nodes, data, width, height, nodeGroups, groupLayers, groups } =
|
|
5118
|
-
const sizeScale =
|
|
5217
|
+
const { nodes, data, width, height, nodeGroups, groupLayers, groups } = x$2(StaticContext);
|
|
5218
|
+
const sizeScale = T(() => {
|
|
5119
5219
|
const maxLines = max(nodes, (d) => d.renderedLength);
|
|
5120
5220
|
const size = sqrt().domain([1, maxLines]).range([5, 30]);
|
|
5121
5221
|
return size;
|
|
5122
5222
|
}, [nodes]);
|
|
5123
|
-
const getModuleColor =
|
|
5223
|
+
const getModuleColor = T(() => {
|
|
5124
5224
|
return createRainbowColor(groups);
|
|
5125
5225
|
}, [groups]);
|
|
5126
5226
|
const [excludedNodes, setExcludedNodes] = h([]);
|
|
@@ -5138,14 +5238,15 @@ var drawChart = (function (exports) {
|
|
|
5138
5238
|
return getModuleColor(node);
|
|
5139
5239
|
}
|
|
5140
5240
|
};
|
|
5141
|
-
const processedNodes =
|
|
5241
|
+
const processedNodes = T(() => {
|
|
5142
5242
|
var _a;
|
|
5143
5243
|
const newNodes = [];
|
|
5144
5244
|
for (const node of nodes) {
|
|
5145
5245
|
//if (node.renderedLength === 0) continue;
|
|
5146
5246
|
if (excludedNodes.includes(node.uid))
|
|
5147
5247
|
continue;
|
|
5148
|
-
|
|
5248
|
+
/* eslint-disable typescript/no-non-null-asserted-optional-chain typescript/no-extra-non-null-assertion */
|
|
5249
|
+
const bundleId = (_a = Object.entries(node.moduleParts).find(([, uid]) => uid == node.uid)) === null || _a === void 0 ? void 0 : _a[0];
|
|
5149
5250
|
const filterMultiplier = getModuleFilterMultiplier(bundleId, node);
|
|
5150
5251
|
if (filterMultiplier === 0)
|
|
5151
5252
|
continue;
|
|
@@ -5157,7 +5258,7 @@ var drawChart = (function (exports) {
|
|
|
5157
5258
|
}
|
|
5158
5259
|
return newNodes;
|
|
5159
5260
|
}, [excludedNodes, getModuleFilterMultiplier, groupLayers, nodeGroups, nodes, sizeScale]);
|
|
5160
|
-
const links =
|
|
5261
|
+
const links = T(() => {
|
|
5161
5262
|
const nodesCache = Object.fromEntries(processedNodes.map((d) => [d.uid, d]));
|
|
5162
5263
|
return Object.entries(data.nodeMetas)
|
|
5163
5264
|
.flatMap(([sourceUid, { imported }]) => {
|
|
@@ -5174,7 +5275,7 @@ var drawChart = (function (exports) {
|
|
|
5174
5275
|
});
|
|
5175
5276
|
}, [data.nodeMetas, processedNodes]);
|
|
5176
5277
|
const [animatedNodes, setAnimatedNodes] = h([]);
|
|
5177
|
-
|
|
5278
|
+
y$2(() => {
|
|
5178
5279
|
const simulation = forceSimulation()
|
|
5179
5280
|
.force("collision", forceCollide().radius((node) => node.radius))
|
|
5180
5281
|
.force("charge", forceManyBody().strength(-30))
|
|
@@ -5198,12 +5299,12 @@ var drawChart = (function (exports) {
|
|
|
5198
5299
|
simulation.alphaMin(0.03).restart();
|
|
5199
5300
|
return () => simulation.stop();
|
|
5200
5301
|
}, [nodeGroups, height, links, processedNodes, width]);
|
|
5201
|
-
return (
|
|
5302
|
+
return (u$1(k$1, { children: [u$1(SideBar, { sizeProperty: "renderedLength", availableSizeProperties: ["renderedLength"], setSizeProperty: () => { }, onExcludeChange: setExcludeFilter, onIncludeChange: setIncludeFilter }), u$1(Chart, { nodes: animatedNodes, onNodeExclude: (node) => setExcludedNodes([...excludedNodes, node.uid]), links: links, getColor: getColor, onNodeSelect: (uid) => setSelectedNode(uid === selectedNode ? undefined : uid) })] }));
|
|
5202
5303
|
};
|
|
5203
5304
|
|
|
5204
5305
|
const NODE_MODULES = /.*(?:\/|\\\\)?node_modules(?:\/|\\\\)([^/\\]+)(?:\/|\\\\).+/;
|
|
5205
5306
|
|
|
5206
|
-
const StaticContext =
|
|
5307
|
+
const StaticContext = J({});
|
|
5207
5308
|
const createNodeInfo = (data, availableSizeProperties, uid) => {
|
|
5208
5309
|
var _a, _b;
|
|
5209
5310
|
const meta = data.nodeMetas[uid];
|
|
@@ -5261,7 +5362,7 @@ var drawChart = (function (exports) {
|
|
|
5261
5362
|
}
|
|
5262
5363
|
groupLayers.push([...newLayer]);
|
|
5263
5364
|
}
|
|
5264
|
-
D(
|
|
5365
|
+
D$1(u$1(StaticContext.Provider, { value: {
|
|
5265
5366
|
data,
|
|
5266
5367
|
width,
|
|
5267
5368
|
height,
|
|
@@ -5269,7 +5370,7 @@ var drawChart = (function (exports) {
|
|
|
5269
5370
|
nodeGroups,
|
|
5270
5371
|
groups,
|
|
5271
5372
|
groupLayers,
|
|
5272
|
-
}, children:
|
|
5373
|
+
}, children: u$1(Main, {}) }), parentNode);
|
|
5273
5374
|
};
|
|
5274
5375
|
|
|
5275
5376
|
exports.StaticContext = StaticContext;
|
|
@@ -5285,7 +5386,7 @@ var drawChart = (function (exports) {
|
|
|
5285
5386
|
</script>
|
|
5286
5387
|
<script>
|
|
5287
5388
|
/*<!--*/
|
|
5288
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src","children":[{"uid":"
|
|
5389
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src","children":[{"uid":"71d25d03-1","name":"config.ts"},{"uid":"71d25d03-3","name":"isEmpty.ts"},{"uid":"71d25d03-5","name":"context.tsx"},{"uid":"71d25d03-7","name":"compose.ts"},{"uid":"71d25d03-9","name":"render.ts"},{"name":"html/htmlTags.ts","uid":"71d25d03-11"},{"uid":"71d25d03-13","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"71d25d03-1":{"renderedLength":1010,"gzipLength":312,"brotliLength":0,"metaUid":"71d25d03-0"},"71d25d03-3":{"renderedLength":426,"gzipLength":228,"brotliLength":0,"metaUid":"71d25d03-2"},"71d25d03-5":{"renderedLength":717,"gzipLength":320,"brotliLength":0,"metaUid":"71d25d03-4"},"71d25d03-7":{"renderedLength":178,"gzipLength":142,"brotliLength":0,"metaUid":"71d25d03-6"},"71d25d03-9":{"renderedLength":835,"gzipLength":328,"brotliLength":0,"metaUid":"71d25d03-8"},"71d25d03-11":{"renderedLength":2052,"gzipLength":565,"brotliLength":0,"metaUid":"71d25d03-10"},"71d25d03-13":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"71d25d03-12"}},"nodeMetas":{"71d25d03-0":{"id":"/src/config.ts","moduleParts":{"index.js":"71d25d03-1"},"imported":[{"uid":"71d25d03-17"}],"importedBy":[{"uid":"71d25d03-12"},{"uid":"71d25d03-4"}]},"71d25d03-2":{"id":"/src/isEmpty.ts","moduleParts":{"index.js":"71d25d03-3"},"imported":[],"importedBy":[{"uid":"71d25d03-12"},{"uid":"71d25d03-4"},{"uid":"71d25d03-8"}]},"71d25d03-4":{"id":"/src/context.tsx","moduleParts":{"index.js":"71d25d03-5"},"imported":[{"uid":"71d25d03-18"},{"uid":"71d25d03-0"},{"uid":"71d25d03-2"}],"importedBy":[{"uid":"71d25d03-12"}]},"71d25d03-6":{"id":"/src/compose.ts","moduleParts":{"index.js":"71d25d03-7"},"imported":[],"importedBy":[{"uid":"71d25d03-12"}]},"71d25d03-8":{"id":"/src/render.ts","moduleParts":{"index.js":"71d25d03-9"},"imported":[{"uid":"71d25d03-18"},{"uid":"71d25d03-19"},{"uid":"71d25d03-2"}],"importedBy":[{"uid":"71d25d03-12"}]},"71d25d03-10":{"id":"/src/html/htmlTags.ts","moduleParts":{"index.js":"71d25d03-11"},"imported":[],"importedBy":[{"uid":"71d25d03-16"}]},"71d25d03-12":{"id":"/src/index.ts","moduleParts":{"index.js":"71d25d03-13"},"imported":[{"uid":"71d25d03-14"},{"uid":"71d25d03-15"},{"uid":"71d25d03-0"},{"uid":"71d25d03-4"},{"uid":"71d25d03-6"},{"uid":"71d25d03-2"},{"uid":"71d25d03-8"},{"uid":"71d25d03-16"}],"importedBy":[],"isEntry":true},"71d25d03-14":{"id":"lodash-es","moduleParts":{},"imported":[],"importedBy":[{"uid":"71d25d03-12"}],"isExternal":true},"71d25d03-15":{"id":"moize","moduleParts":{},"imported":[],"importedBy":[{"uid":"71d25d03-12"}],"isExternal":true},"71d25d03-16":{"id":"/src/html/index.ts","moduleParts":{},"imported":[{"uid":"71d25d03-10"}],"importedBy":[{"uid":"71d25d03-12"}]},"71d25d03-17":{"id":"styled-components","moduleParts":{},"imported":[],"importedBy":[{"uid":"71d25d03-0"}],"isExternal":true},"71d25d03-18":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"71d25d03-4"},{"uid":"71d25d03-8"}],"isExternal":true},"71d25d03-19":{"id":"react-is","moduleParts":{},"imported":[],"importedBy":[{"uid":"71d25d03-8"}],"isExternal":true}},"env":{"rollup":"4.34.9"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
5289
5390
|
|
|
5290
5391
|
const run = () => {
|
|
5291
5392
|
const width = window.innerWidth;
|