@qubit-ltd/rollup-builder 1.8.4 → 1.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/README.zh_CN.md +6 -6
- package/dist/rollup-builder.cjs.map +1 -1
- package/dist/rollup-builder.min.cjs.map +1 -1
- package/dist/rollup-builder.min.mjs.map +1 -1
- package/dist/rollup-builder.mjs.map +1 -1
- package/doc/api/global.html +2 -2
- package/doc/api/index.html +8 -8
- package/doc/rollup-builder.min.visualization.html +2230 -2123
- package/doc/rollup-builder.visualization.html +2230 -2123
- package/package.json +22 -22
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
<title>Rollup Visualizer</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);
|
|
@@ -149,9 +149,9 @@ main {
|
|
|
149
149
|
var drawChart = (function (exports) {
|
|
150
150
|
'use strict';
|
|
151
151
|
|
|
152
|
-
var n,l$1,u$2,i$1,o$1,r$1,f$2,e$1,c$1={},s$1=[],a$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,h$1=Array.isArray;function v$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$1(l,u,t){var i,o,r,f={};for(r in u)"key"==r?i=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),"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,i,o,null)}function d$1(n,t,i,o,r){var f={type:n,props:t,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++u$2:r,__i:-1,__u:0};return null==r&&null!=l$1.vnode&&l$1.vnode(f),f}function g$1(n){return n.children}function b$1(n,l){this.props=n,this.context=l;}function m$1(n,l){if(null==l)return n.__?m$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?m$1(n):null}function k$1(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 k$1(n)}}function w$1(n){(!n.__d&&(n.__d=!0)&&i$1.push(n)&&!x.__r++||o$1!==l$1.debounceRendering)&&((o$1=l$1.debounceRendering)||r$1)(x);}function x(){var n,u,t,o,r,e,c,s,a;for(i$1.sort(f$2);n=i$1.shift();)n.__d&&(u=i$1.length,o=void 0,e=(r=(t=n).__v).__e,s=[],a=[],(c=t.__P)&&((o=v$1({},r)).__v=r.__v+1,l$1.vnode&&l$1.vnode(o),L(c,o,r,t.__n,void 0!==c.ownerSVGElement,32&r.__u?[e]:null,s,null==e?m$1(r):e,!!(32&r.__u),a),o.__.__k[o.__i]=o,M(s,o,a),o.__e!=e&&k$1(o)),i$1.length>u&&i$1.sort(f$2));x.__r=0;}function C(n,l,u,t,i,o,r,f,e,a,h){var v,p,y,d,_,g=t&&t.__k||s$1,b=l.length;for(u.__d=e,P(u,l,g),e=u.__d,v=0;v<b;v++)null!=(y=u.__k[v])&&"boolean"!=typeof y&&"function"!=typeof y&&(p=-1===y.__i?c$1:g[y.__i]||c$1,y.__i=v,L(n,y,p,i,o,r,f,e,a,h),d=y.__e,y.ref&&p.ref!=y.ref&&(p.ref&&z$1(p.ref,null,y),h.push(y.ref,y.__c||d,y)),null==_&&null!=d&&(_=d),65536&y.__u||p.__k===y.__k?e=S(y,e,n):"function"==typeof y.type&&void 0!==y.__d?e=y.__d:d&&(e=d.nextSibling),y.__d=void 0,y.__u&=-196609);u.__d=e,u.__e=_;}function P(n,l,u){var t,i,o,r,f,e=l.length,c=u.length,s=c,a=0;for(n.__k=[],t=0;t<e;t++)null!=(i=n.__k[t]=null==(i=l[t])||"boolean"==typeof i||"function"==typeof i?null:"string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?d$1(null,i,null,null,i):h$1(i)?d$1(g$1,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?d$1(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=n,i.__b=n.__b+1,f=H(i,u,r=t+a,s),i.__i=f,o=null,-1!==f&&(s--,(o=u[f])&&(o.__u|=131072)),null==o||null===o.__v?(-1==f&&a--,"function"!=typeof i.type&&(i.__u|=65536)):f!==r&&(f===r+1?a++:f>r?s>e-r?a+=f-r:a--:a=f<r&&f==r-1?f-r:0,f!==t+a&&(i.__u|=65536))):(o=u[t])&&null==o.key&&o.__e&&(o.__e==n.__d&&(n.__d=m$1(o)),N(o,o,!1),u[t]=null,s--);if(s)for(t=0;t<c;t++)null!=(o=u[t])&&0==(131072&o.__u)&&(o.__e==n.__d&&(n.__d=m$1(o)),N(o,o));}function S(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=S(t[i],l,u));return l}return n.__e!=l&&(u.insertBefore(n.__e,l||null),l=n.__e),l&&l.nextSibling}function H(n,l,u,t){var i=n.key,o=n.type,r=u-1,f=u+1,e=l[u];if(null===e||e&&i==e.key&&o===e.type)return u;if(t>(null!=e&&0==(131072&e.__u)?1:0))for(;r>=0||f<l.length;){if(r>=0){if((e=l[r])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return r;r--;}if(f<l.length){if((e=l[f])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return f;f++;}}return -1}function I(n,l,u){"-"===l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||a$1.test(l)?u:u+"px";}function T$1(n,l,u,t,i){var o;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||I(n.style,l,"");if(u)for(l in u)t&&u[l]===t[l]||I(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/(PointerCapture)$|Capture$/,"$1")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?t?u.u=t.u:(u.u=Date.now(),n.addEventListener(l,o?D:A,o)):n.removeEventListener(l,o?D:A,o);else {if(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&&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 A(n){var u=this.l[n.type+!1];if(n.t){if(n.t<=u.u)return}else n.t=Date.now();return u(l$1.event?l$1.event(n):n)}function D(n){return this.l[n.type+!0](l$1.event?l$1.event(n):n)}function L(n,u,t,i,o,r,f,e,c,s){var a,p,y,d,_,m,k,w,x,P,S,$,H,I,T,A=u.type;if(void 0!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),r=[e=u.__e=t.__e]),(a=l$1.__b)&&a(u);n:if("function"==typeof A)try{if(w=u.props,x=(a=A.contextType)&&i[a.__c],P=a?x?x.props.value:a.__:i,t.__c?k=(p=u.__c=t.__c).__=p.__E:("prototype"in A&&A.prototype.render?u.__c=p=new A(w,P):(u.__c=p=new b$1(w,P),p.constructor=A,p.render=O),x&&x.sub(p),p.props=w,p.state||(p.state={}),p.context=P,p.__n=i,y=p.__d=!0,p.__h=[],p._sb=[]),null==p.__s&&(p.__s=p.state),null!=A.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=v$1({},p.__s)),v$1(p.__s,A.getDerivedStateFromProps(w,p.__s))),d=p.props,_=p.state,p.__v=u,y)null==A.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else {if(null==A.getDerivedStateFromProps&&w!==d&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(w,P),!p.__e&&(null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(w,p.__s,P)||u.__v===t.__v)){for(u.__v!==t.__v&&(p.props=w,p.state=p.__s,p.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.forEach(function(n){n&&(n.__=u);}),S=0;S<p._sb.length;S++)p.__h.push(p._sb[S]);p._sb=[],p.__h.length&&f.push(p);break n}null!=p.componentWillUpdate&&p.componentWillUpdate(w,p.__s,P),null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(d,_,m);});}if(p.context=P,p.props=w,p.__P=n,p.__e=!1,$=l$1.__r,H=0,"prototype"in A&&A.prototype.render){for(p.state=p.__s,p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),I=0;I<p._sb.length;I++)p.__h.push(p._sb[I]);p._sb=[];}else do{p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),p.state=p.__s;}while(p.__d&&++H<25);p.state=p.__s,null!=p.getChildContext&&(i=v$1(v$1({},i),p.getChildContext())),y||null==p.getSnapshotBeforeUpdate||(m=p.getSnapshotBeforeUpdate(d,_)),C(n,h$1(T=null!=a&&a.type===g$1&&null==a.key?a.props.children:a)?T:[T],u,t,i,o,r,f,e,c,s),p.base=u.__e,u.__u&=-161,p.__h.length&&f.push(p),k&&(p.__E=p.__=null);}catch(n){u.__v=null,c||null!=r?(u.__e=e,u.__u|=c?160:32,r[r.indexOf(e)]=null):(u.__e=t.__e,u.__k=t.__k),l$1.__e(n,u,t);}else null==r&&u.__v===t.__v?(u.__k=t.__k,u.__e=t.__e):u.__e=j$1(t.__e,u,t,i,o,r,f,c,s);(a=l$1.diffed)&&a(u);}function M(n,u,t){u.__d=void 0;for(var i=0;i<t.length;i++)z$1(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 j$1(l,u,t,i,o,r,f,e,s){var a,v,y,d,_,g,b,k=t.props,w=u.props,x=u.type;if("svg"===x&&(o=!0),null!=r)for(a=0;a<r.length;a++)if((_=r[a])&&"setAttribute"in _==!!x&&(x?_.localName===x:3===_.nodeType)){l=_,r[a]=null;break}if(null==l){if(null===x)return document.createTextNode(w);l=o?document.createElementNS("http://www.w3.org/2000/svg",x):document.createElement(x,w.is&&w),r=null,e=!1;}if(null===x)k===w||e&&l.data===w||(l.data=w);else {if(r=r&&n.call(l.childNodes),k=t.props||c$1,!e&&null!=r)for(k={},a=0;a<l.attributes.length;a++)k[(_=l.attributes[a]).name]=_.value;for(a in k)_=k[a],"children"==a||("dangerouslySetInnerHTML"==a?y=_:"key"===a||a in w||T$1(l,a,null,_,o));for(a in w)_=w[a],"children"==a?d=_:"dangerouslySetInnerHTML"==a?v=_:"value"==a?g=_:"checked"==a?b=_:"key"===a||e&&"function"!=typeof _||k[a]===_||T$1(l,a,_,k[a],o);if(v)e||y&&(v.__html===y.__html||v.__html===l.innerHTML)||(l.innerHTML=v.__html),u.__k=[];else if(y&&(l.innerHTML=""),C(l,h$1(d)?d:[d],u,t,i,o&&"foreignObject"!==x,r,f,r?r[0]:t.__k&&m$1(t,0),e,s),null!=r)for(a=r.length;a--;)null!=r[a]&&p$1(r[a]);e||(a="value",void 0!==g&&(g!==l[a]||"progress"===x&&!g||"option"===x&&g!==k[a])&&T$1(l,a,g,k[a],!1),a="checked",void 0!==b&&b!==l[a]&&T$1(l,a,b,k[a],!1));}return l}function z$1(n,u,t){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$1.__e(n,t);}}function N(n,u,t){var i,o;if(l$1.unmount&&l$1.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||z$1(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,n.__c=void 0;}if(i=n.__k)for(o=0;o<i.length;o++)i[o]&&N(i[o],u,t||"function"!=typeof n.type);t||null==n.__e||p$1(n.__e),n.__=n.__e=n.__d=void 0;}function O(n,l,u){return this.constructor(n,u)}function q$1(u,t,i){var o,r,f,e;l$1.__&&l$1.__(u,t),r=(o="function"==typeof i)?null:i&&i.__k||t.__k,f=[],e=[],L(t,u=(!o&&i||t).__k=y$1(g$1,null,[u]),r||c$1,c$1,void 0!==t.ownerSVGElement,!o&&i?[i]:r?null:t.firstChild?n.call(t.childNodes):null,f,!o&&i?i:r?r.__e:t.firstChild,o,e),M(f,u,e);}function F$1(n,l){var u={__c:l="__cC"+e$1++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,t;return this.getChildContext||(u=[],(t={})[l]=this,this.getChildContext=function(){return t},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,t){for(var i,o,r;l=l.__;)if((i=l.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(n)),r=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),r=i.__d),r)return i.__E=i}catch(l){n=l;}throw n}},u$2=0,b$1.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=v$1({},this.state),"function"==typeof n&&(n=n(v$1({},u),this.props)),n&&v$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=g$1,i$1=[],r$1="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f$2=function(n,l){return n.__v.__b-l.__v.__b},x.__r=0,e$1=0;
|
|
152
|
+
var n,l$1,u$2,i$1,r$1,o$1,e$1,f$2,c$1,s$1,a$1,h$1,p$1={},v$1=[],y$1=/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 _$1(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$1(l,e,i,r,null)}function m$1(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$1(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$1(null,o,null,null,null):d$1(o)?m$1(k$1,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?m$1(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$1.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$1,n.addEventListener(l,r?a$1:s$1,r)):n.removeEventListener(l,r?a$1: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$1++;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$1(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--;)_$1(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--;)_$1(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||_$1(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$1.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$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),M(this));},x$1.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$1=0,s$1=O(!1),a$1=O(!0),h$1=0;
|
|
153
153
|
|
|
154
|
-
var f$1=0;function u$1(e,t,n,o,i,u){var a,c,p=
|
|
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}
|
|
155
155
|
|
|
156
156
|
function count$1(node) {
|
|
157
157
|
var sum = 0,
|
|
@@ -663,7 +663,7 @@ var drawChart = (function (exports) {
|
|
|
663
663
|
return availableSizeProperties;
|
|
664
664
|
};
|
|
665
665
|
|
|
666
|
-
var t,r,u,i,o=0,f=[],c=
|
|
666
|
+
var t,r,u,i,o=0,f=[],c=l$1,e=c.__b,a=c.__r,v=c.diffed,l=c.__c,m=c.unmount,s=c.__;function d(n,t){c.__h&&c.__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(n,u){var i=d(t++,3);!c.__s&&C(i.__H,u)&&(i.__=n,i.i=u,r.__H.__h.push(i));}function _(n,u){var i=d(t++,4);!c.__s&&C(i.__H,u)&&(i.__=n,i.i=u,r.__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(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.__e(t,n.__v);}}c.__b=function(n){r=null,e&&e(n);},c.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),s&&s(n,t);},c.__r=function(n){a&&a(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.diffed=function(n){v&&v(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(1!==f.push(t)&&i===c.requestAnimationFrame||((i=c.requestAnimationFrame)||w)(j)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.i=void 0;})),u=r=null;},c.__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.__e(r,n.__v);}}),l&&l(n,t);},c.unmount=function(n){m&&m(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.__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}
|
|
667
667
|
|
|
668
668
|
const PLACEHOLDER = "*/**/file.js";
|
|
669
669
|
const SideBar = ({ availableSizeProperties, sizeProperty, setSizeProperty, onExcludeChange, onIncludeChange, }) => {
|
|
@@ -695,2048 +695,2145 @@ var drawChart = (function (exports) {
|
|
|
695
695
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
696
696
|
}
|
|
697
697
|
|
|
698
|
-
var utils
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
751
|
-
QMARK: WIN_NO_SLASH,
|
|
752
|
-
STAR: `${WIN_NO_SLASH}*?`,
|
|
753
|
-
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
754
|
-
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
755
|
-
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
756
|
-
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
757
|
-
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
758
|
-
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
759
|
-
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
760
|
-
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
|
|
761
|
-
SEP: '\\'
|
|
762
|
-
};
|
|
763
|
-
|
|
764
|
-
/**
|
|
765
|
-
* POSIX Bracket Regex
|
|
766
|
-
*/
|
|
767
|
-
|
|
768
|
-
const POSIX_REGEX_SOURCE$1 = {
|
|
769
|
-
alnum: 'a-zA-Z0-9',
|
|
770
|
-
alpha: 'a-zA-Z',
|
|
771
|
-
ascii: '\\x00-\\x7F',
|
|
772
|
-
blank: ' \\t',
|
|
773
|
-
cntrl: '\\x00-\\x1F\\x7F',
|
|
774
|
-
digit: '0-9',
|
|
775
|
-
graph: '\\x21-\\x7E',
|
|
776
|
-
lower: 'a-z',
|
|
777
|
-
print: '\\x20-\\x7E ',
|
|
778
|
-
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
|
|
779
|
-
space: ' \\t\\r\\n\\v\\f',
|
|
780
|
-
upper: 'A-Z',
|
|
781
|
-
word: 'A-Za-z0-9_',
|
|
782
|
-
xdigit: 'A-Fa-f0-9'
|
|
783
|
-
};
|
|
784
|
-
|
|
785
|
-
var constants$3 = {
|
|
786
|
-
MAX_LENGTH: 1024 * 64,
|
|
787
|
-
POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
|
|
788
|
-
|
|
789
|
-
// regular expressions
|
|
790
|
-
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
791
|
-
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
792
|
-
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
793
|
-
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
794
|
-
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
795
|
-
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
796
|
-
|
|
797
|
-
// Replace globs with equivalent patterns to reduce parsing time.
|
|
798
|
-
REPLACEMENTS: {
|
|
799
|
-
'***': '*',
|
|
800
|
-
'**/**': '**',
|
|
801
|
-
'**/**/**': '**'
|
|
802
|
-
},
|
|
803
|
-
|
|
804
|
-
// Digits
|
|
805
|
-
CHAR_0: 48, /* 0 */
|
|
806
|
-
CHAR_9: 57, /* 9 */
|
|
807
|
-
|
|
808
|
-
// Alphabet chars.
|
|
809
|
-
CHAR_UPPERCASE_A: 65, /* A */
|
|
810
|
-
CHAR_LOWERCASE_A: 97, /* a */
|
|
811
|
-
CHAR_UPPERCASE_Z: 90, /* Z */
|
|
812
|
-
CHAR_LOWERCASE_Z: 122, /* z */
|
|
813
|
-
|
|
814
|
-
CHAR_LEFT_PARENTHESES: 40, /* ( */
|
|
815
|
-
CHAR_RIGHT_PARENTHESES: 41, /* ) */
|
|
816
|
-
|
|
817
|
-
CHAR_ASTERISK: 42, /* * */
|
|
818
|
-
|
|
819
|
-
// Non-alphabetic chars.
|
|
820
|
-
CHAR_AMPERSAND: 38, /* & */
|
|
821
|
-
CHAR_AT: 64, /* @ */
|
|
822
|
-
CHAR_BACKWARD_SLASH: 92, /* \ */
|
|
823
|
-
CHAR_CARRIAGE_RETURN: 13, /* \r */
|
|
824
|
-
CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
|
|
825
|
-
CHAR_COLON: 58, /* : */
|
|
826
|
-
CHAR_COMMA: 44, /* , */
|
|
827
|
-
CHAR_DOT: 46, /* . */
|
|
828
|
-
CHAR_DOUBLE_QUOTE: 34, /* " */
|
|
829
|
-
CHAR_EQUAL: 61, /* = */
|
|
830
|
-
CHAR_EXCLAMATION_MARK: 33, /* ! */
|
|
831
|
-
CHAR_FORM_FEED: 12, /* \f */
|
|
832
|
-
CHAR_FORWARD_SLASH: 47, /* / */
|
|
833
|
-
CHAR_GRAVE_ACCENT: 96, /* ` */
|
|
834
|
-
CHAR_HASH: 35, /* # */
|
|
835
|
-
CHAR_HYPHEN_MINUS: 45, /* - */
|
|
836
|
-
CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
|
|
837
|
-
CHAR_LEFT_CURLY_BRACE: 123, /* { */
|
|
838
|
-
CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
|
|
839
|
-
CHAR_LINE_FEED: 10, /* \n */
|
|
840
|
-
CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
|
|
841
|
-
CHAR_PERCENT: 37, /* % */
|
|
842
|
-
CHAR_PLUS: 43, /* + */
|
|
843
|
-
CHAR_QUESTION_MARK: 63, /* ? */
|
|
844
|
-
CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
|
|
845
|
-
CHAR_RIGHT_CURLY_BRACE: 125, /* } */
|
|
846
|
-
CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
|
|
847
|
-
CHAR_SEMICOLON: 59, /* ; */
|
|
848
|
-
CHAR_SINGLE_QUOTE: 39, /* ' */
|
|
849
|
-
CHAR_SPACE: 32, /* */
|
|
850
|
-
CHAR_TAB: 9, /* \t */
|
|
851
|
-
CHAR_UNDERSCORE: 95, /* _ */
|
|
852
|
-
CHAR_VERTICAL_LINE: 124, /* | */
|
|
853
|
-
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
|
|
854
|
-
|
|
855
|
-
/**
|
|
856
|
-
* Create EXTGLOB_CHARS
|
|
857
|
-
*/
|
|
858
|
-
|
|
859
|
-
extglobChars(chars) {
|
|
860
|
-
return {
|
|
861
|
-
'!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
|
|
862
|
-
'?': { type: 'qmark', open: '(?:', close: ')?' },
|
|
863
|
-
'+': { type: 'plus', open: '(?:', close: ')+' },
|
|
864
|
-
'*': { type: 'star', open: '(?:', close: ')*' },
|
|
865
|
-
'@': { type: 'at', open: '(?:', close: ')' }
|
|
866
|
-
};
|
|
867
|
-
},
|
|
868
|
-
|
|
869
|
-
/**
|
|
870
|
-
* Create GLOB_CHARS
|
|
871
|
-
*/
|
|
872
|
-
|
|
873
|
-
globChars(win32) {
|
|
874
|
-
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
875
|
-
}
|
|
876
|
-
};
|
|
877
|
-
|
|
878
|
-
(function (exports) {
|
|
879
|
-
|
|
880
|
-
const {
|
|
881
|
-
REGEX_BACKSLASH,
|
|
882
|
-
REGEX_REMOVE_BACKSLASH,
|
|
883
|
-
REGEX_SPECIAL_CHARS,
|
|
884
|
-
REGEX_SPECIAL_CHARS_GLOBAL
|
|
885
|
-
} = constants$3;
|
|
886
|
-
|
|
887
|
-
exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
|
888
|
-
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
|
|
889
|
-
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
|
|
890
|
-
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
|
891
|
-
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
|
|
892
|
-
|
|
893
|
-
exports.removeBackslashes = str => {
|
|
894
|
-
return str.replace(REGEX_REMOVE_BACKSLASH, match => {
|
|
895
|
-
return match === '\\' ? '' : match;
|
|
896
|
-
});
|
|
897
|
-
};
|
|
898
|
-
|
|
899
|
-
exports.supportsLookbehinds = () => {
|
|
900
|
-
const segs = process.version.slice(1).split('.').map(Number);
|
|
901
|
-
if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
|
|
902
|
-
return true;
|
|
903
|
-
}
|
|
904
|
-
return false;
|
|
905
|
-
};
|
|
906
|
-
|
|
907
|
-
exports.escapeLast = (input, char, lastIdx) => {
|
|
908
|
-
const idx = input.lastIndexOf(char, lastIdx);
|
|
909
|
-
if (idx === -1) return input;
|
|
910
|
-
if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
|
|
911
|
-
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
912
|
-
};
|
|
913
|
-
|
|
914
|
-
exports.removePrefix = (input, state = {}) => {
|
|
915
|
-
let output = input;
|
|
916
|
-
if (output.startsWith('./')) {
|
|
917
|
-
output = output.slice(2);
|
|
918
|
-
state.prefix = './';
|
|
919
|
-
}
|
|
920
|
-
return output;
|
|
921
|
-
};
|
|
922
|
-
|
|
923
|
-
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
924
|
-
const prepend = options.contains ? '' : '^';
|
|
925
|
-
const append = options.contains ? '' : '$';
|
|
926
|
-
|
|
927
|
-
let output = `${prepend}(?:${input})${append}`;
|
|
928
|
-
if (state.negated === true) {
|
|
929
|
-
output = `(?:^(?!${output}).*$)`;
|
|
930
|
-
}
|
|
931
|
-
return output;
|
|
932
|
-
};
|
|
933
|
-
|
|
934
|
-
exports.basename = (path, { windows } = {}) => {
|
|
935
|
-
if (windows) {
|
|
936
|
-
return path.replace(/[\\/]$/, '').replace(/.*[\\/]/, '');
|
|
937
|
-
} else {
|
|
938
|
-
return path.replace(/\/$/, '').replace(/.*\//, '');
|
|
939
|
-
}
|
|
940
|
-
};
|
|
941
|
-
} (utils$3));
|
|
942
|
-
|
|
943
|
-
const utils$2 = utils$3;
|
|
944
|
-
const {
|
|
945
|
-
CHAR_ASTERISK, /* * */
|
|
946
|
-
CHAR_AT, /* @ */
|
|
947
|
-
CHAR_BACKWARD_SLASH, /* \ */
|
|
948
|
-
CHAR_COMMA, /* , */
|
|
949
|
-
CHAR_DOT, /* . */
|
|
950
|
-
CHAR_EXCLAMATION_MARK, /* ! */
|
|
951
|
-
CHAR_FORWARD_SLASH, /* / */
|
|
952
|
-
CHAR_LEFT_CURLY_BRACE, /* { */
|
|
953
|
-
CHAR_LEFT_PARENTHESES, /* ( */
|
|
954
|
-
CHAR_LEFT_SQUARE_BRACKET, /* [ */
|
|
955
|
-
CHAR_PLUS, /* + */
|
|
956
|
-
CHAR_QUESTION_MARK, /* ? */
|
|
957
|
-
CHAR_RIGHT_CURLY_BRACE, /* } */
|
|
958
|
-
CHAR_RIGHT_PARENTHESES, /* ) */
|
|
959
|
-
CHAR_RIGHT_SQUARE_BRACKET /* ] */
|
|
960
|
-
} = constants$3;
|
|
961
|
-
|
|
962
|
-
const isPathSeparator = code => {
|
|
963
|
-
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
964
|
-
};
|
|
965
|
-
|
|
966
|
-
const depth = token => {
|
|
967
|
-
if (token.isPrefix !== true) {
|
|
968
|
-
token.depth = token.isGlobstar ? Infinity : 1;
|
|
969
|
-
}
|
|
970
|
-
};
|
|
971
|
-
|
|
972
|
-
/**
|
|
973
|
-
* Quickly scans a glob pattern and returns an object with a handful of
|
|
974
|
-
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
|
|
975
|
-
* `glob` (the actual pattern), and `negated` (true if the path starts with `!`).
|
|
976
|
-
*
|
|
977
|
-
* ```js
|
|
978
|
-
* const pm = require('picomatch');
|
|
979
|
-
* console.log(pm.scan('foo/bar/*.js'));
|
|
980
|
-
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
|
|
981
|
-
* ```
|
|
982
|
-
* @param {String} `str`
|
|
983
|
-
* @param {Object} `options`
|
|
984
|
-
* @return {Object} Returns an object with tokens and regex source string.
|
|
985
|
-
* @api public
|
|
986
|
-
*/
|
|
987
|
-
|
|
988
|
-
const scan$1 = (input, options) => {
|
|
989
|
-
const opts = options || {};
|
|
990
|
-
|
|
991
|
-
const length = input.length - 1;
|
|
992
|
-
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
993
|
-
const slashes = [];
|
|
994
|
-
const tokens = [];
|
|
995
|
-
const parts = [];
|
|
996
|
-
|
|
997
|
-
let str = input;
|
|
998
|
-
let index = -1;
|
|
999
|
-
let start = 0;
|
|
1000
|
-
let lastIndex = 0;
|
|
1001
|
-
let isBrace = false;
|
|
1002
|
-
let isBracket = false;
|
|
1003
|
-
let isGlob = false;
|
|
1004
|
-
let isExtglob = false;
|
|
1005
|
-
let isGlobstar = false;
|
|
1006
|
-
let braceEscaped = false;
|
|
1007
|
-
let backslashes = false;
|
|
1008
|
-
let negated = false;
|
|
1009
|
-
let finished = false;
|
|
1010
|
-
let braces = 0;
|
|
1011
|
-
let prev;
|
|
1012
|
-
let code;
|
|
1013
|
-
let token = { value: '', depth: 0, isGlob: false };
|
|
1014
|
-
|
|
1015
|
-
const eos = () => index >= length;
|
|
1016
|
-
const peek = () => str.charCodeAt(index + 1);
|
|
1017
|
-
const advance = () => {
|
|
1018
|
-
prev = code;
|
|
1019
|
-
return str.charCodeAt(++index);
|
|
1020
|
-
};
|
|
1021
|
-
|
|
1022
|
-
while (index < length) {
|
|
1023
|
-
code = advance();
|
|
1024
|
-
let next;
|
|
1025
|
-
|
|
1026
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
1027
|
-
backslashes = token.backslashes = true;
|
|
1028
|
-
code = advance();
|
|
1029
|
-
|
|
1030
|
-
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
1031
|
-
braceEscaped = true;
|
|
1032
|
-
}
|
|
1033
|
-
continue;
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
1037
|
-
braces++;
|
|
1038
|
-
|
|
1039
|
-
while (eos() !== true && (code = advance())) {
|
|
1040
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
1041
|
-
backslashes = token.backslashes = true;
|
|
1042
|
-
advance();
|
|
1043
|
-
continue;
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
1047
|
-
braces++;
|
|
1048
|
-
continue;
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
1052
|
-
isBrace = token.isBrace = true;
|
|
1053
|
-
isGlob = token.isGlob = true;
|
|
1054
|
-
finished = true;
|
|
1055
|
-
|
|
1056
|
-
if (scanToEnd === true) {
|
|
1057
|
-
continue;
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
break;
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
1064
|
-
isBrace = token.isBrace = true;
|
|
1065
|
-
isGlob = token.isGlob = true;
|
|
1066
|
-
finished = true;
|
|
1067
|
-
|
|
1068
|
-
if (scanToEnd === true) {
|
|
1069
|
-
continue;
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
|
-
break;
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
1076
|
-
braces--;
|
|
1077
|
-
|
|
1078
|
-
if (braces === 0) {
|
|
1079
|
-
braceEscaped = false;
|
|
1080
|
-
isBrace = token.isBrace = true;
|
|
1081
|
-
finished = true;
|
|
1082
|
-
break;
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
if (scanToEnd === true) {
|
|
1088
|
-
continue;
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
break;
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
if (code === CHAR_FORWARD_SLASH) {
|
|
1095
|
-
slashes.push(index);
|
|
1096
|
-
tokens.push(token);
|
|
1097
|
-
token = { value: '', depth: 0, isGlob: false };
|
|
1098
|
-
|
|
1099
|
-
if (finished === true) continue;
|
|
1100
|
-
if (prev === CHAR_DOT && index === (start + 1)) {
|
|
1101
|
-
start += 2;
|
|
1102
|
-
continue;
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
lastIndex = index + 1;
|
|
1106
|
-
continue;
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
if (opts.noext !== true) {
|
|
1110
|
-
const isExtglobChar = code === CHAR_PLUS
|
|
1111
|
-
|| code === CHAR_AT
|
|
1112
|
-
|| code === CHAR_ASTERISK
|
|
1113
|
-
|| code === CHAR_QUESTION_MARK
|
|
1114
|
-
|| code === CHAR_EXCLAMATION_MARK;
|
|
1115
|
-
|
|
1116
|
-
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
1117
|
-
isGlob = token.isGlob = true;
|
|
1118
|
-
isExtglob = token.isExtglob = true;
|
|
1119
|
-
finished = true;
|
|
1120
|
-
|
|
1121
|
-
if (scanToEnd === true) {
|
|
1122
|
-
while (eos() !== true && (code = advance())) {
|
|
1123
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
1124
|
-
backslashes = token.backslashes = true;
|
|
1125
|
-
code = advance();
|
|
1126
|
-
continue;
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
1130
|
-
isGlob = token.isGlob = true;
|
|
1131
|
-
finished = true;
|
|
1132
|
-
break;
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
continue;
|
|
1136
|
-
}
|
|
1137
|
-
break;
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
if (code === CHAR_ASTERISK) {
|
|
1142
|
-
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
1143
|
-
isGlob = token.isGlob = true;
|
|
1144
|
-
finished = true;
|
|
1145
|
-
|
|
1146
|
-
if (scanToEnd === true) {
|
|
1147
|
-
continue;
|
|
1148
|
-
}
|
|
1149
|
-
break;
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
if (code === CHAR_QUESTION_MARK) {
|
|
1153
|
-
isGlob = token.isGlob = true;
|
|
1154
|
-
finished = true;
|
|
1155
|
-
|
|
1156
|
-
if (scanToEnd === true) {
|
|
1157
|
-
continue;
|
|
1158
|
-
}
|
|
1159
|
-
break;
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
1163
|
-
while (eos() !== true && (next = advance())) {
|
|
1164
|
-
if (next === CHAR_BACKWARD_SLASH) {
|
|
1165
|
-
backslashes = token.backslashes = true;
|
|
1166
|
-
advance();
|
|
1167
|
-
continue;
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
1171
|
-
isBracket = token.isBracket = true;
|
|
1172
|
-
isGlob = token.isGlob = true;
|
|
1173
|
-
finished = true;
|
|
1174
|
-
|
|
1175
|
-
if (scanToEnd === true) {
|
|
1176
|
-
continue;
|
|
1177
|
-
}
|
|
1178
|
-
break;
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
1184
|
-
negated = token.negated = true;
|
|
1185
|
-
start++;
|
|
1186
|
-
continue;
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
1190
|
-
isGlob = token.isGlob = true;
|
|
1191
|
-
|
|
1192
|
-
if (scanToEnd === true) {
|
|
1193
|
-
while (eos() !== true && (code = advance())) {
|
|
1194
|
-
if (code === CHAR_LEFT_PARENTHESES) {
|
|
1195
|
-
backslashes = token.backslashes = true;
|
|
1196
|
-
code = advance();
|
|
1197
|
-
continue;
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
1201
|
-
finished = true;
|
|
1202
|
-
break;
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
continue;
|
|
1206
|
-
}
|
|
1207
|
-
break;
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
if (isGlob === true) {
|
|
1211
|
-
finished = true;
|
|
1212
|
-
|
|
1213
|
-
if (scanToEnd === true) {
|
|
1214
|
-
continue;
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
break;
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
if (opts.noext === true) {
|
|
1222
|
-
isExtglob = false;
|
|
1223
|
-
isGlob = false;
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
let base = str;
|
|
1227
|
-
let prefix = '';
|
|
1228
|
-
let glob = '';
|
|
1229
|
-
|
|
1230
|
-
if (start > 0) {
|
|
1231
|
-
prefix = str.slice(0, start);
|
|
1232
|
-
str = str.slice(start);
|
|
1233
|
-
lastIndex -= start;
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
if (base && isGlob === true && lastIndex > 0) {
|
|
1237
|
-
base = str.slice(0, lastIndex);
|
|
1238
|
-
glob = str.slice(lastIndex);
|
|
1239
|
-
} else if (isGlob === true) {
|
|
1240
|
-
base = '';
|
|
1241
|
-
glob = str;
|
|
1242
|
-
} else {
|
|
1243
|
-
base = str;
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
if (base && base !== '' && base !== '/' && base !== str) {
|
|
1247
|
-
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
|
1248
|
-
base = base.slice(0, -1);
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
if (opts.unescape === true) {
|
|
1253
|
-
if (glob) glob = utils$2.removeBackslashes(glob);
|
|
1254
|
-
|
|
1255
|
-
if (base && backslashes === true) {
|
|
1256
|
-
base = utils$2.removeBackslashes(base);
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
const state = {
|
|
1261
|
-
prefix,
|
|
1262
|
-
input,
|
|
1263
|
-
start,
|
|
1264
|
-
base,
|
|
1265
|
-
glob,
|
|
1266
|
-
isBrace,
|
|
1267
|
-
isBracket,
|
|
1268
|
-
isGlob,
|
|
1269
|
-
isExtglob,
|
|
1270
|
-
isGlobstar,
|
|
1271
|
-
negated
|
|
1272
|
-
};
|
|
1273
|
-
|
|
1274
|
-
if (opts.tokens === true) {
|
|
1275
|
-
state.maxDepth = 0;
|
|
1276
|
-
if (!isPathSeparator(code)) {
|
|
1277
|
-
tokens.push(token);
|
|
1278
|
-
}
|
|
1279
|
-
state.tokens = tokens;
|
|
1280
|
-
}
|
|
1281
|
-
|
|
1282
|
-
if (opts.parts === true || opts.tokens === true) {
|
|
1283
|
-
let prevIndex;
|
|
1284
|
-
|
|
1285
|
-
for (let idx = 0; idx < slashes.length; idx++) {
|
|
1286
|
-
const n = prevIndex ? prevIndex + 1 : start;
|
|
1287
|
-
const i = slashes[idx];
|
|
1288
|
-
const value = input.slice(n, i);
|
|
1289
|
-
if (opts.tokens) {
|
|
1290
|
-
if (idx === 0 && start !== 0) {
|
|
1291
|
-
tokens[idx].isPrefix = true;
|
|
1292
|
-
tokens[idx].value = prefix;
|
|
1293
|
-
} else {
|
|
1294
|
-
tokens[idx].value = value;
|
|
1295
|
-
}
|
|
1296
|
-
depth(tokens[idx]);
|
|
1297
|
-
state.maxDepth += tokens[idx].depth;
|
|
1298
|
-
}
|
|
1299
|
-
if (idx !== 0 || value !== '') {
|
|
1300
|
-
parts.push(value);
|
|
1301
|
-
}
|
|
1302
|
-
prevIndex = i;
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
if (prevIndex && prevIndex + 1 < input.length) {
|
|
1306
|
-
const value = input.slice(prevIndex + 1);
|
|
1307
|
-
parts.push(value);
|
|
1308
|
-
|
|
1309
|
-
if (opts.tokens) {
|
|
1310
|
-
tokens[tokens.length - 1].value = value;
|
|
1311
|
-
depth(tokens[tokens.length - 1]);
|
|
1312
|
-
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
|
-
state.slashes = slashes;
|
|
1317
|
-
state.parts = parts;
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
return state;
|
|
1321
|
-
};
|
|
1322
|
-
|
|
1323
|
-
var scan_1 = scan$1;
|
|
1324
|
-
|
|
1325
|
-
const constants$2 = constants$3;
|
|
1326
|
-
const utils$1 = utils$3;
|
|
1327
|
-
|
|
1328
|
-
/**
|
|
1329
|
-
* Constants
|
|
1330
|
-
*/
|
|
1331
|
-
|
|
1332
|
-
const {
|
|
1333
|
-
MAX_LENGTH,
|
|
1334
|
-
POSIX_REGEX_SOURCE,
|
|
1335
|
-
REGEX_NON_SPECIAL_CHARS,
|
|
1336
|
-
REGEX_SPECIAL_CHARS_BACKREF,
|
|
1337
|
-
REPLACEMENTS
|
|
1338
|
-
} = constants$2;
|
|
1339
|
-
|
|
1340
|
-
/**
|
|
1341
|
-
* Helpers
|
|
1342
|
-
*/
|
|
1343
|
-
|
|
1344
|
-
const expandRange = (args, options) => {
|
|
1345
|
-
if (typeof options.expandRange === 'function') {
|
|
1346
|
-
return options.expandRange(...args, options);
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
|
-
args.sort();
|
|
1350
|
-
const value = `[${args.join('-')}]`;
|
|
1351
|
-
|
|
1352
|
-
try {
|
|
1353
|
-
/* eslint-disable-next-line no-new */
|
|
1354
|
-
new RegExp(value);
|
|
1355
|
-
} catch (ex) {
|
|
1356
|
-
return args.map(v => utils$1.escapeRegex(v)).join('..');
|
|
1357
|
-
}
|
|
1358
|
-
|
|
1359
|
-
return value;
|
|
1360
|
-
};
|
|
1361
|
-
|
|
1362
|
-
/**
|
|
1363
|
-
* Create the message for a syntax error
|
|
1364
|
-
*/
|
|
1365
|
-
|
|
1366
|
-
const syntaxError = (type, char) => {
|
|
1367
|
-
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
1368
|
-
};
|
|
1369
|
-
|
|
1370
|
-
/**
|
|
1371
|
-
* Parse the given input string.
|
|
1372
|
-
* @param {String} input
|
|
1373
|
-
* @param {Object} options
|
|
1374
|
-
* @return {Object}
|
|
1375
|
-
*/
|
|
1376
|
-
|
|
1377
|
-
const parse$2 = (input, options) => {
|
|
1378
|
-
if (typeof input !== 'string') {
|
|
1379
|
-
throw new TypeError('Expected a string');
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
|
-
input = REPLACEMENTS[input] || input;
|
|
1383
|
-
|
|
1384
|
-
const opts = { ...options };
|
|
1385
|
-
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
1386
|
-
|
|
1387
|
-
let len = input.length;
|
|
1388
|
-
if (len > max) {
|
|
1389
|
-
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
const bos = { type: 'bos', value: '', output: opts.prepend || '' };
|
|
1393
|
-
const tokens = [bos];
|
|
1394
|
-
|
|
1395
|
-
const capture = opts.capture ? '' : '?:';
|
|
1396
|
-
|
|
1397
|
-
// create constants based on platform, for windows or posix
|
|
1398
|
-
const PLATFORM_CHARS = constants$2.globChars(opts.windows);
|
|
1399
|
-
const EXTGLOB_CHARS = constants$2.extglobChars(PLATFORM_CHARS);
|
|
1400
|
-
|
|
1401
|
-
const {
|
|
1402
|
-
DOT_LITERAL,
|
|
1403
|
-
PLUS_LITERAL,
|
|
1404
|
-
SLASH_LITERAL,
|
|
1405
|
-
ONE_CHAR,
|
|
1406
|
-
DOTS_SLASH,
|
|
1407
|
-
NO_DOT,
|
|
1408
|
-
NO_DOT_SLASH,
|
|
1409
|
-
NO_DOTS_SLASH,
|
|
1410
|
-
QMARK,
|
|
1411
|
-
QMARK_NO_DOT,
|
|
1412
|
-
STAR,
|
|
1413
|
-
START_ANCHOR
|
|
1414
|
-
} = PLATFORM_CHARS;
|
|
1415
|
-
|
|
1416
|
-
const globstar = (opts) => {
|
|
1417
|
-
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
1418
|
-
};
|
|
1419
|
-
|
|
1420
|
-
const nodot = opts.dot ? '' : NO_DOT;
|
|
1421
|
-
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
1422
|
-
let star = opts.bash === true ? globstar(opts) : STAR;
|
|
1423
|
-
|
|
1424
|
-
if (opts.capture) {
|
|
1425
|
-
star = `(${star})`;
|
|
1426
|
-
}
|
|
1427
|
-
|
|
1428
|
-
// minimatch options support
|
|
1429
|
-
if (typeof opts.noext === 'boolean') {
|
|
1430
|
-
opts.noextglob = opts.noext;
|
|
1431
|
-
}
|
|
1432
|
-
|
|
1433
|
-
const state = {
|
|
1434
|
-
input,
|
|
1435
|
-
index: -1,
|
|
1436
|
-
start: 0,
|
|
1437
|
-
dot: opts.dot === true,
|
|
1438
|
-
consumed: '',
|
|
1439
|
-
output: '',
|
|
1440
|
-
prefix: '',
|
|
1441
|
-
backtrack: false,
|
|
1442
|
-
negated: false,
|
|
1443
|
-
brackets: 0,
|
|
1444
|
-
braces: 0,
|
|
1445
|
-
parens: 0,
|
|
1446
|
-
quotes: 0,
|
|
1447
|
-
globstar: false,
|
|
1448
|
-
tokens
|
|
1449
|
-
};
|
|
1450
|
-
|
|
1451
|
-
input = utils$1.removePrefix(input, state);
|
|
1452
|
-
len = input.length;
|
|
1453
|
-
|
|
1454
|
-
const extglobs = [];
|
|
1455
|
-
const braces = [];
|
|
1456
|
-
const stack = [];
|
|
1457
|
-
let prev = bos;
|
|
1458
|
-
let value;
|
|
1459
|
-
|
|
1460
|
-
/**
|
|
1461
|
-
* Tokenizing helpers
|
|
1462
|
-
*/
|
|
1463
|
-
|
|
1464
|
-
const eos = () => state.index === len - 1;
|
|
1465
|
-
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
1466
|
-
const advance = state.advance = () => input[++state.index];
|
|
1467
|
-
const remaining = () => input.slice(state.index + 1);
|
|
1468
|
-
const consume = (value = '', num = 0) => {
|
|
1469
|
-
state.consumed += value;
|
|
1470
|
-
state.index += num;
|
|
1471
|
-
};
|
|
1472
|
-
const append = token => {
|
|
1473
|
-
state.output += token.output != null ? token.output : token.value;
|
|
1474
|
-
consume(token.value);
|
|
1475
|
-
};
|
|
1476
|
-
|
|
1477
|
-
const negate = () => {
|
|
1478
|
-
let count = 1;
|
|
1479
|
-
|
|
1480
|
-
while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
|
|
1481
|
-
advance();
|
|
1482
|
-
state.start++;
|
|
1483
|
-
count++;
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
|
-
if (count % 2 === 0) {
|
|
1487
|
-
return false;
|
|
1488
|
-
}
|
|
1489
|
-
|
|
1490
|
-
state.negated = true;
|
|
1491
|
-
state.start++;
|
|
1492
|
-
return true;
|
|
1493
|
-
};
|
|
1494
|
-
|
|
1495
|
-
const increment = type => {
|
|
1496
|
-
state[type]++;
|
|
1497
|
-
stack.push(type);
|
|
1498
|
-
};
|
|
1499
|
-
|
|
1500
|
-
const decrement = type => {
|
|
1501
|
-
state[type]--;
|
|
1502
|
-
stack.pop();
|
|
1503
|
-
};
|
|
1504
|
-
|
|
1505
|
-
/**
|
|
1506
|
-
* Push tokens onto the tokens array. This helper speeds up
|
|
1507
|
-
* tokenizing by 1) helping us avoid backtracking as much as possible,
|
|
1508
|
-
* and 2) helping us avoid creating extra tokens when consecutive
|
|
1509
|
-
* characters are plain text. This improves performance and simplifies
|
|
1510
|
-
* lookbehinds.
|
|
1511
|
-
*/
|
|
1512
|
-
|
|
1513
|
-
const push = tok => {
|
|
1514
|
-
if (prev.type === 'globstar') {
|
|
1515
|
-
const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
|
|
1516
|
-
const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
|
|
1517
|
-
|
|
1518
|
-
if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
|
|
1519
|
-
state.output = state.output.slice(0, -prev.output.length);
|
|
1520
|
-
prev.type = 'star';
|
|
1521
|
-
prev.value = '*';
|
|
1522
|
-
prev.output = star;
|
|
1523
|
-
state.output += prev.output;
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
if (extglobs.length && tok.type !== 'paren' && !EXTGLOB_CHARS[tok.value]) {
|
|
1528
|
-
extglobs[extglobs.length - 1].inner += tok.value;
|
|
1529
|
-
}
|
|
1530
|
-
|
|
1531
|
-
if (tok.value || tok.output) append(tok);
|
|
1532
|
-
if (prev && prev.type === 'text' && tok.type === 'text') {
|
|
1533
|
-
prev.value += tok.value;
|
|
1534
|
-
prev.output = (prev.output || '') + tok.value;
|
|
1535
|
-
return;
|
|
1536
|
-
}
|
|
1537
|
-
|
|
1538
|
-
tok.prev = prev;
|
|
1539
|
-
tokens.push(tok);
|
|
1540
|
-
prev = tok;
|
|
1541
|
-
};
|
|
1542
|
-
|
|
1543
|
-
const extglobOpen = (type, value) => {
|
|
1544
|
-
const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
|
|
1545
|
-
|
|
1546
|
-
token.prev = prev;
|
|
1547
|
-
token.parens = state.parens;
|
|
1548
|
-
token.output = state.output;
|
|
1549
|
-
const output = (opts.capture ? '(' : '') + token.open;
|
|
1550
|
-
|
|
1551
|
-
increment('parens');
|
|
1552
|
-
push({ type, value, output: state.output ? '' : ONE_CHAR });
|
|
1553
|
-
push({ type: 'paren', extglob: true, value: advance(), output });
|
|
1554
|
-
extglobs.push(token);
|
|
1555
|
-
};
|
|
1556
|
-
|
|
1557
|
-
const extglobClose = token => {
|
|
1558
|
-
let output = token.close + (opts.capture ? ')' : '');
|
|
1559
|
-
|
|
1560
|
-
if (token.type === 'negate') {
|
|
1561
|
-
let extglobStar = star;
|
|
1562
|
-
|
|
1563
|
-
if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
|
|
1564
|
-
extglobStar = globstar(opts);
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
|
-
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
|
1568
|
-
output = token.close = `)$))${extglobStar}`;
|
|
1569
|
-
}
|
|
1570
|
-
|
|
1571
|
-
if (token.prev.type === 'bos' && eos()) {
|
|
1572
|
-
state.negatedExtglob = true;
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
|
|
1576
|
-
push({ type: 'paren', extglob: true, value, output });
|
|
1577
|
-
decrement('parens');
|
|
1578
|
-
};
|
|
1579
|
-
|
|
1580
|
-
/**
|
|
1581
|
-
* Fast paths
|
|
1582
|
-
*/
|
|
1583
|
-
|
|
1584
|
-
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
1585
|
-
let backslashes = false;
|
|
1586
|
-
|
|
1587
|
-
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
|
1588
|
-
if (first === '\\') {
|
|
1589
|
-
backslashes = true;
|
|
1590
|
-
return m;
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
|
-
if (first === '?') {
|
|
1594
|
-
if (esc) {
|
|
1595
|
-
return esc + first + (rest ? QMARK.repeat(rest.length) : '');
|
|
1596
|
-
}
|
|
1597
|
-
if (index === 0) {
|
|
1598
|
-
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
|
|
1599
|
-
}
|
|
1600
|
-
return QMARK.repeat(chars.length);
|
|
1601
|
-
}
|
|
1602
|
-
|
|
1603
|
-
if (first === '.') {
|
|
1604
|
-
return DOT_LITERAL.repeat(chars.length);
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
|
-
if (first === '*') {
|
|
1608
|
-
if (esc) {
|
|
1609
|
-
return esc + first + (rest ? star : '');
|
|
1610
|
-
}
|
|
1611
|
-
return star;
|
|
1612
|
-
}
|
|
1613
|
-
return esc ? m : `\\${m}`;
|
|
1614
|
-
});
|
|
1615
|
-
|
|
1616
|
-
if (backslashes === true) {
|
|
1617
|
-
if (opts.unescape === true) {
|
|
1618
|
-
output = output.replace(/\\/g, '');
|
|
1619
|
-
} else {
|
|
1620
|
-
output = output.replace(/\\+/g, m => {
|
|
1621
|
-
return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
|
|
1622
|
-
});
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
if (output === input && opts.contains === true) {
|
|
1627
|
-
state.output = input;
|
|
1628
|
-
return state;
|
|
1629
|
-
}
|
|
1630
|
-
|
|
1631
|
-
state.output = utils$1.wrapOutput(output, state, options);
|
|
1632
|
-
return state;
|
|
1633
|
-
}
|
|
1634
|
-
|
|
1635
|
-
/**
|
|
1636
|
-
* Tokenize input until we reach end-of-string
|
|
1637
|
-
*/
|
|
1638
|
-
|
|
1639
|
-
while (!eos()) {
|
|
1640
|
-
value = advance();
|
|
1641
|
-
|
|
1642
|
-
if (value === '\u0000') {
|
|
1643
|
-
continue;
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
/**
|
|
1647
|
-
* Escaped characters
|
|
1648
|
-
*/
|
|
1649
|
-
|
|
1650
|
-
if (value === '\\') {
|
|
1651
|
-
const next = peek();
|
|
1652
|
-
|
|
1653
|
-
if (next === '/' && opts.bash !== true) {
|
|
1654
|
-
continue;
|
|
1655
|
-
}
|
|
1656
|
-
|
|
1657
|
-
if (next === '.' || next === ';') {
|
|
1658
|
-
continue;
|
|
1659
|
-
}
|
|
1660
|
-
|
|
1661
|
-
if (!next) {
|
|
1662
|
-
value += '\\';
|
|
1663
|
-
push({ type: 'text', value });
|
|
1664
|
-
continue;
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
|
-
// collapse slashes to reduce potential for exploits
|
|
1668
|
-
const match = /^\\+/.exec(remaining());
|
|
1669
|
-
let slashes = 0;
|
|
1670
|
-
|
|
1671
|
-
if (match && match[0].length > 2) {
|
|
1672
|
-
slashes = match[0].length;
|
|
1673
|
-
state.index += slashes;
|
|
1674
|
-
if (slashes % 2 !== 0) {
|
|
1675
|
-
value += '\\';
|
|
1676
|
-
}
|
|
1677
|
-
}
|
|
1678
|
-
|
|
1679
|
-
if (opts.unescape === true) {
|
|
1680
|
-
value = advance() || '';
|
|
1681
|
-
} else {
|
|
1682
|
-
value += advance() || '';
|
|
1683
|
-
}
|
|
1684
|
-
|
|
1685
|
-
if (state.brackets === 0) {
|
|
1686
|
-
push({ type: 'text', value });
|
|
1687
|
-
continue;
|
|
1688
|
-
}
|
|
1689
|
-
}
|
|
1690
|
-
|
|
1691
|
-
/**
|
|
1692
|
-
* If we're inside a regex character class, continue
|
|
1693
|
-
* until we reach the closing bracket.
|
|
1694
|
-
*/
|
|
1695
|
-
|
|
1696
|
-
if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
|
|
1697
|
-
if (opts.posix !== false && value === ':') {
|
|
1698
|
-
const inner = prev.value.slice(1);
|
|
1699
|
-
if (inner.includes('[')) {
|
|
1700
|
-
prev.posix = true;
|
|
1701
|
-
|
|
1702
|
-
if (inner.includes(':')) {
|
|
1703
|
-
const idx = prev.value.lastIndexOf('[');
|
|
1704
|
-
const pre = prev.value.slice(0, idx);
|
|
1705
|
-
const rest = prev.value.slice(idx + 2);
|
|
1706
|
-
const posix = POSIX_REGEX_SOURCE[rest];
|
|
1707
|
-
if (posix) {
|
|
1708
|
-
prev.value = pre + posix;
|
|
1709
|
-
state.backtrack = true;
|
|
1710
|
-
advance();
|
|
1711
|
-
|
|
1712
|
-
if (!bos.output && tokens.indexOf(prev) === 1) {
|
|
1713
|
-
bos.output = ONE_CHAR;
|
|
1714
|
-
}
|
|
1715
|
-
continue;
|
|
1716
|
-
}
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1720
|
-
|
|
1721
|
-
if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
|
|
1722
|
-
value = `\\${value}`;
|
|
1723
|
-
}
|
|
1724
|
-
|
|
1725
|
-
if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
|
|
1726
|
-
value = `\\${value}`;
|
|
1727
|
-
}
|
|
1728
|
-
|
|
1729
|
-
if (opts.posix === true && value === '!' && prev.value === '[') {
|
|
1730
|
-
value = '^';
|
|
1731
|
-
}
|
|
1732
|
-
|
|
1733
|
-
prev.value += value;
|
|
1734
|
-
append({ value });
|
|
1735
|
-
continue;
|
|
1736
|
-
}
|
|
1737
|
-
|
|
1738
|
-
/**
|
|
1739
|
-
* If we're inside a quoted string, continue
|
|
1740
|
-
* until we reach the closing double quote.
|
|
1741
|
-
*/
|
|
1742
|
-
|
|
1743
|
-
if (state.quotes === 1 && value !== '"') {
|
|
1744
|
-
value = utils$1.escapeRegex(value);
|
|
1745
|
-
prev.value += value;
|
|
1746
|
-
append({ value });
|
|
1747
|
-
continue;
|
|
1748
|
-
}
|
|
1749
|
-
|
|
1750
|
-
/**
|
|
1751
|
-
* Double quotes
|
|
1752
|
-
*/
|
|
1753
|
-
|
|
1754
|
-
if (value === '"') {
|
|
1755
|
-
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
1756
|
-
if (opts.keepQuotes === true) {
|
|
1757
|
-
push({ type: 'text', value });
|
|
1758
|
-
}
|
|
1759
|
-
continue;
|
|
1760
|
-
}
|
|
1761
|
-
|
|
1762
|
-
/**
|
|
1763
|
-
* Parentheses
|
|
1764
|
-
*/
|
|
1765
|
-
|
|
1766
|
-
if (value === '(') {
|
|
1767
|
-
increment('parens');
|
|
1768
|
-
push({ type: 'paren', value });
|
|
1769
|
-
continue;
|
|
1770
|
-
}
|
|
1771
|
-
|
|
1772
|
-
if (value === ')') {
|
|
1773
|
-
if (state.parens === 0 && opts.strictBrackets === true) {
|
|
1774
|
-
throw new SyntaxError(syntaxError('opening', '('));
|
|
1775
|
-
}
|
|
1776
|
-
|
|
1777
|
-
const extglob = extglobs[extglobs.length - 1];
|
|
1778
|
-
if (extglob && state.parens === extglob.parens + 1) {
|
|
1779
|
-
extglobClose(extglobs.pop());
|
|
1780
|
-
continue;
|
|
1781
|
-
}
|
|
1782
|
-
|
|
1783
|
-
push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
|
|
1784
|
-
decrement('parens');
|
|
1785
|
-
continue;
|
|
1786
|
-
}
|
|
1787
|
-
|
|
1788
|
-
/**
|
|
1789
|
-
* Square brackets
|
|
1790
|
-
*/
|
|
1791
|
-
|
|
1792
|
-
if (value === '[') {
|
|
1793
|
-
if (opts.nobracket === true || !remaining().includes(']')) {
|
|
1794
|
-
if (opts.nobracket !== true && opts.strictBrackets === true) {
|
|
1795
|
-
throw new SyntaxError(syntaxError('closing', ']'));
|
|
1796
|
-
}
|
|
1797
|
-
|
|
1798
|
-
value = `\\${value}`;
|
|
1799
|
-
} else {
|
|
1800
|
-
increment('brackets');
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
push({ type: 'bracket', value });
|
|
1804
|
-
continue;
|
|
1805
|
-
}
|
|
1806
|
-
|
|
1807
|
-
if (value === ']') {
|
|
1808
|
-
if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
|
|
1809
|
-
push({ type: 'text', value, output: `\\${value}` });
|
|
1810
|
-
continue;
|
|
1811
|
-
}
|
|
1812
|
-
|
|
1813
|
-
if (state.brackets === 0) {
|
|
1814
|
-
if (opts.strictBrackets === true) {
|
|
1815
|
-
throw new SyntaxError(syntaxError('opening', '['));
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
|
-
push({ type: 'text', value, output: `\\${value}` });
|
|
1819
|
-
continue;
|
|
1820
|
-
}
|
|
1821
|
-
|
|
1822
|
-
decrement('brackets');
|
|
1823
|
-
|
|
1824
|
-
const prevValue = prev.value.slice(1);
|
|
1825
|
-
if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
|
|
1826
|
-
value = `/${value}`;
|
|
1827
|
-
}
|
|
1828
|
-
|
|
1829
|
-
prev.value += value;
|
|
1830
|
-
append({ value });
|
|
1831
|
-
|
|
1832
|
-
// when literal brackets are explicitly disabled
|
|
1833
|
-
// assume we should match with a regex character class
|
|
1834
|
-
if (opts.literalBrackets === false || utils$1.hasRegexChars(prevValue)) {
|
|
1835
|
-
continue;
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
|
-
const escaped = utils$1.escapeRegex(prev.value);
|
|
1839
|
-
state.output = state.output.slice(0, -prev.value.length);
|
|
1840
|
-
|
|
1841
|
-
// when literal brackets are explicitly enabled
|
|
1842
|
-
// assume we should escape the brackets to match literal characters
|
|
1843
|
-
if (opts.literalBrackets === true) {
|
|
1844
|
-
state.output += escaped;
|
|
1845
|
-
prev.value = escaped;
|
|
1846
|
-
continue;
|
|
1847
|
-
}
|
|
1848
|
-
|
|
1849
|
-
// when the user specifies nothing, try to match both
|
|
1850
|
-
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
1851
|
-
state.output += prev.value;
|
|
1852
|
-
continue;
|
|
1853
|
-
}
|
|
1854
|
-
|
|
1855
|
-
/**
|
|
1856
|
-
* Braces
|
|
1857
|
-
*/
|
|
1858
|
-
|
|
1859
|
-
if (value === '{' && opts.nobrace !== true) {
|
|
1860
|
-
increment('braces');
|
|
1861
|
-
|
|
1862
|
-
const open = {
|
|
1863
|
-
type: 'brace',
|
|
1864
|
-
value,
|
|
1865
|
-
output: '(',
|
|
1866
|
-
outputIndex: state.output.length,
|
|
1867
|
-
tokensIndex: state.tokens.length
|
|
1868
|
-
};
|
|
1869
|
-
|
|
1870
|
-
braces.push(open);
|
|
1871
|
-
push(open);
|
|
1872
|
-
continue;
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1875
|
-
if (value === '}') {
|
|
1876
|
-
const brace = braces[braces.length - 1];
|
|
1877
|
-
|
|
1878
|
-
if (opts.nobrace === true || !brace) {
|
|
1879
|
-
push({ type: 'text', value, output: value });
|
|
1880
|
-
continue;
|
|
1881
|
-
}
|
|
1882
|
-
|
|
1883
|
-
let output = ')';
|
|
1884
|
-
|
|
1885
|
-
if (brace.dots === true) {
|
|
1886
|
-
const arr = tokens.slice();
|
|
1887
|
-
const range = [];
|
|
1888
|
-
|
|
1889
|
-
for (let i = arr.length - 1; i >= 0; i--) {
|
|
1890
|
-
tokens.pop();
|
|
1891
|
-
if (arr[i].type === 'brace') {
|
|
1892
|
-
break;
|
|
1893
|
-
}
|
|
1894
|
-
if (arr[i].type !== 'dots') {
|
|
1895
|
-
range.unshift(arr[i].value);
|
|
1896
|
-
}
|
|
1897
|
-
}
|
|
1898
|
-
|
|
1899
|
-
output = expandRange(range, opts);
|
|
1900
|
-
state.backtrack = true;
|
|
1901
|
-
}
|
|
1902
|
-
|
|
1903
|
-
if (brace.comma !== true && brace.dots !== true) {
|
|
1904
|
-
const out = state.output.slice(0, brace.outputIndex);
|
|
1905
|
-
const toks = state.tokens.slice(brace.tokensIndex);
|
|
1906
|
-
brace.value = brace.output = '\\{';
|
|
1907
|
-
value = output = '\\}';
|
|
1908
|
-
state.output = out;
|
|
1909
|
-
for (const t of toks) {
|
|
1910
|
-
state.output += (t.output || t.value);
|
|
1911
|
-
}
|
|
1912
|
-
}
|
|
1913
|
-
|
|
1914
|
-
push({ type: 'brace', value, output });
|
|
1915
|
-
decrement('braces');
|
|
1916
|
-
braces.pop();
|
|
1917
|
-
continue;
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1920
|
-
/**
|
|
1921
|
-
* Pipes
|
|
1922
|
-
*/
|
|
1923
|
-
|
|
1924
|
-
if (value === '|') {
|
|
1925
|
-
if (extglobs.length > 0) {
|
|
1926
|
-
extglobs[extglobs.length - 1].conditions++;
|
|
1927
|
-
}
|
|
1928
|
-
push({ type: 'text', value });
|
|
1929
|
-
continue;
|
|
1930
|
-
}
|
|
1931
|
-
|
|
1932
|
-
/**
|
|
1933
|
-
* Commas
|
|
1934
|
-
*/
|
|
1935
|
-
|
|
1936
|
-
if (value === ',') {
|
|
1937
|
-
let output = value;
|
|
1938
|
-
|
|
1939
|
-
const brace = braces[braces.length - 1];
|
|
1940
|
-
if (brace && stack[stack.length - 1] === 'braces') {
|
|
1941
|
-
brace.comma = true;
|
|
1942
|
-
output = '|';
|
|
1943
|
-
}
|
|
1944
|
-
|
|
1945
|
-
push({ type: 'comma', value, output });
|
|
1946
|
-
continue;
|
|
1947
|
-
}
|
|
1948
|
-
|
|
1949
|
-
/**
|
|
1950
|
-
* Slashes
|
|
1951
|
-
*/
|
|
1952
|
-
|
|
1953
|
-
if (value === '/') {
|
|
1954
|
-
// if the beginning of the glob is "./", advance the start
|
|
1955
|
-
// to the current index, and don't add the "./" characters
|
|
1956
|
-
// to the state. This greatly simplifies lookbehinds when
|
|
1957
|
-
// checking for BOS characters like "!" and "." (not "./")
|
|
1958
|
-
if (prev.type === 'dot' && state.index === state.start + 1) {
|
|
1959
|
-
state.start = state.index + 1;
|
|
1960
|
-
state.consumed = '';
|
|
1961
|
-
state.output = '';
|
|
1962
|
-
tokens.pop();
|
|
1963
|
-
prev = bos; // reset "prev" to the first token
|
|
1964
|
-
continue;
|
|
1965
|
-
}
|
|
1966
|
-
|
|
1967
|
-
push({ type: 'slash', value, output: SLASH_LITERAL });
|
|
1968
|
-
continue;
|
|
1969
|
-
}
|
|
1970
|
-
|
|
1971
|
-
/**
|
|
1972
|
-
* Dots
|
|
1973
|
-
*/
|
|
1974
|
-
|
|
1975
|
-
if (value === '.') {
|
|
1976
|
-
if (state.braces > 0 && prev.type === 'dot') {
|
|
1977
|
-
if (prev.value === '.') prev.output = DOT_LITERAL;
|
|
1978
|
-
const brace = braces[braces.length - 1];
|
|
1979
|
-
prev.type = 'dots';
|
|
1980
|
-
prev.output += value;
|
|
1981
|
-
prev.value += value;
|
|
1982
|
-
brace.dots = true;
|
|
1983
|
-
continue;
|
|
1984
|
-
}
|
|
1985
|
-
|
|
1986
|
-
if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
|
|
1987
|
-
push({ type: 'text', value, output: DOT_LITERAL });
|
|
1988
|
-
continue;
|
|
1989
|
-
}
|
|
1990
|
-
|
|
1991
|
-
push({ type: 'dot', value, output: DOT_LITERAL });
|
|
1992
|
-
continue;
|
|
1993
|
-
}
|
|
1994
|
-
|
|
1995
|
-
/**
|
|
1996
|
-
* Question marks
|
|
1997
|
-
*/
|
|
1998
|
-
|
|
1999
|
-
if (value === '?') {
|
|
2000
|
-
const isGroup = prev && prev.value === '(';
|
|
2001
|
-
if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
|
2002
|
-
extglobOpen('qmark', value);
|
|
2003
|
-
continue;
|
|
2004
|
-
}
|
|
2005
|
-
|
|
2006
|
-
if (prev && prev.type === 'paren') {
|
|
2007
|
-
const next = peek();
|
|
2008
|
-
let output = value;
|
|
2009
|
-
|
|
2010
|
-
if (next === '<' && !utils$1.supportsLookbehinds()) {
|
|
2011
|
-
throw new Error('Node.js v10 or higher is required for regex lookbehinds');
|
|
2012
|
-
}
|
|
2013
|
-
|
|
2014
|
-
if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
|
|
2015
|
-
output = `\\${value}`;
|
|
2016
|
-
}
|
|
2017
|
-
|
|
2018
|
-
push({ type: 'text', value, output });
|
|
2019
|
-
continue;
|
|
2020
|
-
}
|
|
2021
|
-
|
|
2022
|
-
if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
|
|
2023
|
-
push({ type: 'qmark', value, output: QMARK_NO_DOT });
|
|
2024
|
-
continue;
|
|
2025
|
-
}
|
|
2026
|
-
|
|
2027
|
-
push({ type: 'qmark', value, output: QMARK });
|
|
2028
|
-
continue;
|
|
2029
|
-
}
|
|
2030
|
-
|
|
2031
|
-
/**
|
|
2032
|
-
* Exclamation
|
|
2033
|
-
*/
|
|
2034
|
-
|
|
2035
|
-
if (value === '!') {
|
|
2036
|
-
if (opts.noextglob !== true && peek() === '(') {
|
|
2037
|
-
if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
|
|
2038
|
-
extglobOpen('negate', value);
|
|
2039
|
-
continue;
|
|
2040
|
-
}
|
|
2041
|
-
}
|
|
2042
|
-
|
|
2043
|
-
if (opts.nonegate !== true && state.index === 0) {
|
|
2044
|
-
negate();
|
|
2045
|
-
continue;
|
|
2046
|
-
}
|
|
2047
|
-
}
|
|
2048
|
-
|
|
2049
|
-
/**
|
|
2050
|
-
* Plus
|
|
2051
|
-
*/
|
|
2052
|
-
|
|
2053
|
-
if (value === '+') {
|
|
2054
|
-
if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
|
2055
|
-
extglobOpen('plus', value);
|
|
2056
|
-
continue;
|
|
2057
|
-
}
|
|
2058
|
-
|
|
2059
|
-
if ((prev && prev.value === '(') || opts.regex === false) {
|
|
2060
|
-
push({ type: 'plus', value, output: PLUS_LITERAL });
|
|
2061
|
-
continue;
|
|
2062
|
-
}
|
|
2063
|
-
|
|
2064
|
-
if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
|
|
2065
|
-
push({ type: 'plus', value });
|
|
2066
|
-
continue;
|
|
2067
|
-
}
|
|
2068
|
-
|
|
2069
|
-
push({ type: 'plus', value: PLUS_LITERAL });
|
|
2070
|
-
continue;
|
|
2071
|
-
}
|
|
2072
|
-
|
|
2073
|
-
/**
|
|
2074
|
-
* Plain text
|
|
2075
|
-
*/
|
|
2076
|
-
|
|
2077
|
-
if (value === '@') {
|
|
2078
|
-
if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
|
2079
|
-
push({ type: 'at', extglob: true, value, output: '' });
|
|
2080
|
-
continue;
|
|
2081
|
-
}
|
|
2082
|
-
|
|
2083
|
-
push({ type: 'text', value });
|
|
2084
|
-
continue;
|
|
2085
|
-
}
|
|
2086
|
-
|
|
2087
|
-
/**
|
|
2088
|
-
* Plain text
|
|
2089
|
-
*/
|
|
2090
|
-
|
|
2091
|
-
if (value !== '*') {
|
|
2092
|
-
if (value === '$' || value === '^') {
|
|
2093
|
-
value = `\\${value}`;
|
|
2094
|
-
}
|
|
2095
|
-
|
|
2096
|
-
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
2097
|
-
if (match) {
|
|
2098
|
-
value += match[0];
|
|
2099
|
-
state.index += match[0].length;
|
|
2100
|
-
}
|
|
2101
|
-
|
|
2102
|
-
push({ type: 'text', value });
|
|
2103
|
-
continue;
|
|
2104
|
-
}
|
|
2105
|
-
|
|
2106
|
-
/**
|
|
2107
|
-
* Stars
|
|
2108
|
-
*/
|
|
2109
|
-
|
|
2110
|
-
if (prev && (prev.type === 'globstar' || prev.star === true)) {
|
|
2111
|
-
prev.type = 'star';
|
|
2112
|
-
prev.star = true;
|
|
2113
|
-
prev.value += value;
|
|
2114
|
-
prev.output = star;
|
|
2115
|
-
state.backtrack = true;
|
|
2116
|
-
state.globstar = true;
|
|
2117
|
-
consume(value);
|
|
2118
|
-
continue;
|
|
2119
|
-
}
|
|
2120
|
-
|
|
2121
|
-
let rest = remaining();
|
|
2122
|
-
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
2123
|
-
extglobOpen('star', value);
|
|
2124
|
-
continue;
|
|
2125
|
-
}
|
|
698
|
+
var utils = {};
|
|
699
|
+
|
|
700
|
+
var constants$1;
|
|
701
|
+
var hasRequiredConstants;
|
|
702
|
+
|
|
703
|
+
function requireConstants () {
|
|
704
|
+
if (hasRequiredConstants) return constants$1;
|
|
705
|
+
hasRequiredConstants = 1;
|
|
706
|
+
|
|
707
|
+
const WIN_SLASH = '\\\\/';
|
|
708
|
+
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Posix glob regex
|
|
712
|
+
*/
|
|
713
|
+
|
|
714
|
+
const DOT_LITERAL = '\\.';
|
|
715
|
+
const PLUS_LITERAL = '\\+';
|
|
716
|
+
const QMARK_LITERAL = '\\?';
|
|
717
|
+
const SLASH_LITERAL = '\\/';
|
|
718
|
+
const ONE_CHAR = '(?=.)';
|
|
719
|
+
const QMARK = '[^/]';
|
|
720
|
+
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
721
|
+
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
722
|
+
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
723
|
+
const NO_DOT = `(?!${DOT_LITERAL})`;
|
|
724
|
+
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
725
|
+
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
726
|
+
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
727
|
+
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
728
|
+
const STAR = `${QMARK}*?`;
|
|
729
|
+
const SEP = '/';
|
|
730
|
+
|
|
731
|
+
const POSIX_CHARS = {
|
|
732
|
+
DOT_LITERAL,
|
|
733
|
+
PLUS_LITERAL,
|
|
734
|
+
QMARK_LITERAL,
|
|
735
|
+
SLASH_LITERAL,
|
|
736
|
+
ONE_CHAR,
|
|
737
|
+
QMARK,
|
|
738
|
+
END_ANCHOR,
|
|
739
|
+
DOTS_SLASH,
|
|
740
|
+
NO_DOT,
|
|
741
|
+
NO_DOTS,
|
|
742
|
+
NO_DOT_SLASH,
|
|
743
|
+
NO_DOTS_SLASH,
|
|
744
|
+
QMARK_NO_DOT,
|
|
745
|
+
STAR,
|
|
746
|
+
START_ANCHOR,
|
|
747
|
+
SEP
|
|
748
|
+
};
|
|
2126
749
|
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
750
|
+
/**
|
|
751
|
+
* Windows glob regex
|
|
752
|
+
*/
|
|
753
|
+
|
|
754
|
+
const WINDOWS_CHARS = {
|
|
755
|
+
...POSIX_CHARS,
|
|
756
|
+
|
|
757
|
+
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
758
|
+
QMARK: WIN_NO_SLASH,
|
|
759
|
+
STAR: `${WIN_NO_SLASH}*?`,
|
|
760
|
+
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
761
|
+
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
762
|
+
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
763
|
+
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
764
|
+
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
765
|
+
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
766
|
+
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
767
|
+
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
|
|
768
|
+
SEP: '\\'
|
|
769
|
+
};
|
|
2132
770
|
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
771
|
+
/**
|
|
772
|
+
* POSIX Bracket Regex
|
|
773
|
+
*/
|
|
774
|
+
|
|
775
|
+
const POSIX_REGEX_SOURCE = {
|
|
776
|
+
alnum: 'a-zA-Z0-9',
|
|
777
|
+
alpha: 'a-zA-Z',
|
|
778
|
+
ascii: '\\x00-\\x7F',
|
|
779
|
+
blank: ' \\t',
|
|
780
|
+
cntrl: '\\x00-\\x1F\\x7F',
|
|
781
|
+
digit: '0-9',
|
|
782
|
+
graph: '\\x21-\\x7E',
|
|
783
|
+
lower: 'a-z',
|
|
784
|
+
print: '\\x20-\\x7E ',
|
|
785
|
+
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
|
|
786
|
+
space: ' \\t\\r\\n\\v\\f',
|
|
787
|
+
upper: 'A-Z',
|
|
788
|
+
word: 'A-Za-z0-9_',
|
|
789
|
+
xdigit: 'A-Fa-f0-9'
|
|
790
|
+
};
|
|
2137
791
|
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
792
|
+
constants$1 = {
|
|
793
|
+
MAX_LENGTH: 1024 * 64,
|
|
794
|
+
POSIX_REGEX_SOURCE,
|
|
795
|
+
|
|
796
|
+
// regular expressions
|
|
797
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
798
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
799
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
800
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
801
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
802
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
803
|
+
|
|
804
|
+
// Replace globs with equivalent patterns to reduce parsing time.
|
|
805
|
+
REPLACEMENTS: {
|
|
806
|
+
'***': '*',
|
|
807
|
+
'**/**': '**',
|
|
808
|
+
'**/**/**': '**'
|
|
809
|
+
},
|
|
810
|
+
|
|
811
|
+
// Digits
|
|
812
|
+
CHAR_0: 48, /* 0 */
|
|
813
|
+
CHAR_9: 57, /* 9 */
|
|
814
|
+
|
|
815
|
+
// Alphabet chars.
|
|
816
|
+
CHAR_UPPERCASE_A: 65, /* A */
|
|
817
|
+
CHAR_LOWERCASE_A: 97, /* a */
|
|
818
|
+
CHAR_UPPERCASE_Z: 90, /* Z */
|
|
819
|
+
CHAR_LOWERCASE_Z: 122, /* z */
|
|
820
|
+
|
|
821
|
+
CHAR_LEFT_PARENTHESES: 40, /* ( */
|
|
822
|
+
CHAR_RIGHT_PARENTHESES: 41, /* ) */
|
|
823
|
+
|
|
824
|
+
CHAR_ASTERISK: 42, /* * */
|
|
825
|
+
|
|
826
|
+
// Non-alphabetic chars.
|
|
827
|
+
CHAR_AMPERSAND: 38, /* & */
|
|
828
|
+
CHAR_AT: 64, /* @ */
|
|
829
|
+
CHAR_BACKWARD_SLASH: 92, /* \ */
|
|
830
|
+
CHAR_CARRIAGE_RETURN: 13, /* \r */
|
|
831
|
+
CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
|
|
832
|
+
CHAR_COLON: 58, /* : */
|
|
833
|
+
CHAR_COMMA: 44, /* , */
|
|
834
|
+
CHAR_DOT: 46, /* . */
|
|
835
|
+
CHAR_DOUBLE_QUOTE: 34, /* " */
|
|
836
|
+
CHAR_EQUAL: 61, /* = */
|
|
837
|
+
CHAR_EXCLAMATION_MARK: 33, /* ! */
|
|
838
|
+
CHAR_FORM_FEED: 12, /* \f */
|
|
839
|
+
CHAR_FORWARD_SLASH: 47, /* / */
|
|
840
|
+
CHAR_GRAVE_ACCENT: 96, /* ` */
|
|
841
|
+
CHAR_HASH: 35, /* # */
|
|
842
|
+
CHAR_HYPHEN_MINUS: 45, /* - */
|
|
843
|
+
CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
|
|
844
|
+
CHAR_LEFT_CURLY_BRACE: 123, /* { */
|
|
845
|
+
CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
|
|
846
|
+
CHAR_LINE_FEED: 10, /* \n */
|
|
847
|
+
CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
|
|
848
|
+
CHAR_PERCENT: 37, /* % */
|
|
849
|
+
CHAR_PLUS: 43, /* + */
|
|
850
|
+
CHAR_QUESTION_MARK: 63, /* ? */
|
|
851
|
+
CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
|
|
852
|
+
CHAR_RIGHT_CURLY_BRACE: 125, /* } */
|
|
853
|
+
CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
|
|
854
|
+
CHAR_SEMICOLON: 59, /* ; */
|
|
855
|
+
CHAR_SINGLE_QUOTE: 39, /* ' */
|
|
856
|
+
CHAR_SPACE: 32, /* */
|
|
857
|
+
CHAR_TAB: 9, /* \t */
|
|
858
|
+
CHAR_UNDERSCORE: 95, /* _ */
|
|
859
|
+
CHAR_VERTICAL_LINE: 124, /* | */
|
|
860
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* Create EXTGLOB_CHARS
|
|
864
|
+
*/
|
|
865
|
+
|
|
866
|
+
extglobChars(chars) {
|
|
867
|
+
return {
|
|
868
|
+
'!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
|
|
869
|
+
'?': { type: 'qmark', open: '(?:', close: ')?' },
|
|
870
|
+
'+': { type: 'plus', open: '(?:', close: ')+' },
|
|
871
|
+
'*': { type: 'star', open: '(?:', close: ')*' },
|
|
872
|
+
'@': { type: 'at', open: '(?:', close: ')' }
|
|
873
|
+
};
|
|
874
|
+
},
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* Create GLOB_CHARS
|
|
878
|
+
*/
|
|
879
|
+
|
|
880
|
+
globChars(win32) {
|
|
881
|
+
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
return constants$1;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
/*global navigator*/
|
|
888
|
+
|
|
889
|
+
var hasRequiredUtils;
|
|
890
|
+
|
|
891
|
+
function requireUtils () {
|
|
892
|
+
if (hasRequiredUtils) return utils;
|
|
893
|
+
hasRequiredUtils = 1;
|
|
894
|
+
(function (exports) {
|
|
895
|
+
|
|
896
|
+
const {
|
|
897
|
+
REGEX_BACKSLASH,
|
|
898
|
+
REGEX_REMOVE_BACKSLASH,
|
|
899
|
+
REGEX_SPECIAL_CHARS,
|
|
900
|
+
REGEX_SPECIAL_CHARS_GLOBAL
|
|
901
|
+
} = /*@__PURE__*/ requireConstants();
|
|
902
|
+
|
|
903
|
+
exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
|
904
|
+
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
|
|
905
|
+
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
|
|
906
|
+
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
|
907
|
+
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
|
|
908
|
+
|
|
909
|
+
exports.isWindows = () => {
|
|
910
|
+
if (typeof navigator !== 'undefined' && navigator.platform) {
|
|
911
|
+
const platform = navigator.platform.toLowerCase();
|
|
912
|
+
return platform === 'win32' || platform === 'windows';
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
if (typeof process !== 'undefined' && process.platform) {
|
|
916
|
+
return process.platform === 'win32';
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
return false;
|
|
920
|
+
};
|
|
921
|
+
|
|
922
|
+
exports.removeBackslashes = str => {
|
|
923
|
+
return str.replace(REGEX_REMOVE_BACKSLASH, match => {
|
|
924
|
+
return match === '\\' ? '' : match;
|
|
925
|
+
});
|
|
926
|
+
};
|
|
927
|
+
|
|
928
|
+
exports.escapeLast = (input, char, lastIdx) => {
|
|
929
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
930
|
+
if (idx === -1) return input;
|
|
931
|
+
if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
|
|
932
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
933
|
+
};
|
|
934
|
+
|
|
935
|
+
exports.removePrefix = (input, state = {}) => {
|
|
936
|
+
let output = input;
|
|
937
|
+
if (output.startsWith('./')) {
|
|
938
|
+
output = output.slice(2);
|
|
939
|
+
state.prefix = './';
|
|
940
|
+
}
|
|
941
|
+
return output;
|
|
942
|
+
};
|
|
943
|
+
|
|
944
|
+
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
945
|
+
const prepend = options.contains ? '' : '^';
|
|
946
|
+
const append = options.contains ? '' : '$';
|
|
947
|
+
|
|
948
|
+
let output = `${prepend}(?:${input})${append}`;
|
|
949
|
+
if (state.negated === true) {
|
|
950
|
+
output = `(?:^(?!${output}).*$)`;
|
|
951
|
+
}
|
|
952
|
+
return output;
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
exports.basename = (path, { windows } = {}) => {
|
|
956
|
+
const segs = path.split(windows ? /[\\/]/ : '/');
|
|
957
|
+
const last = segs[segs.length - 1];
|
|
958
|
+
|
|
959
|
+
if (last === '') {
|
|
960
|
+
return segs[segs.length - 2];
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
return last;
|
|
964
|
+
};
|
|
965
|
+
} (utils));
|
|
966
|
+
return utils;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
var scan_1;
|
|
970
|
+
var hasRequiredScan;
|
|
971
|
+
|
|
972
|
+
function requireScan () {
|
|
973
|
+
if (hasRequiredScan) return scan_1;
|
|
974
|
+
hasRequiredScan = 1;
|
|
975
|
+
|
|
976
|
+
const utils = /*@__PURE__*/ requireUtils();
|
|
977
|
+
const {
|
|
978
|
+
CHAR_ASTERISK, /* * */
|
|
979
|
+
CHAR_AT, /* @ */
|
|
980
|
+
CHAR_BACKWARD_SLASH, /* \ */
|
|
981
|
+
CHAR_COMMA, /* , */
|
|
982
|
+
CHAR_DOT, /* . */
|
|
983
|
+
CHAR_EXCLAMATION_MARK, /* ! */
|
|
984
|
+
CHAR_FORWARD_SLASH, /* / */
|
|
985
|
+
CHAR_LEFT_CURLY_BRACE, /* { */
|
|
986
|
+
CHAR_LEFT_PARENTHESES, /* ( */
|
|
987
|
+
CHAR_LEFT_SQUARE_BRACKET, /* [ */
|
|
988
|
+
CHAR_PLUS, /* + */
|
|
989
|
+
CHAR_QUESTION_MARK, /* ? */
|
|
990
|
+
CHAR_RIGHT_CURLY_BRACE, /* } */
|
|
991
|
+
CHAR_RIGHT_PARENTHESES, /* ) */
|
|
992
|
+
CHAR_RIGHT_SQUARE_BRACKET /* ] */
|
|
993
|
+
} = /*@__PURE__*/ requireConstants();
|
|
994
|
+
|
|
995
|
+
const isPathSeparator = code => {
|
|
996
|
+
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
997
|
+
};
|
|
2142
998
|
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
}
|
|
999
|
+
const depth = token => {
|
|
1000
|
+
if (token.isPrefix !== true) {
|
|
1001
|
+
token.depth = token.isGlobstar ? Infinity : 1;
|
|
1002
|
+
}
|
|
1003
|
+
};
|
|
2149
1004
|
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
1005
|
+
/**
|
|
1006
|
+
* Quickly scans a glob pattern and returns an object with a handful of
|
|
1007
|
+
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
|
|
1008
|
+
* `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
|
|
1009
|
+
* with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
|
|
1010
|
+
*
|
|
1011
|
+
* ```js
|
|
1012
|
+
* const pm = require('picomatch');
|
|
1013
|
+
* console.log(pm.scan('foo/bar/*.js'));
|
|
1014
|
+
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
|
|
1015
|
+
* ```
|
|
1016
|
+
* @param {String} `str`
|
|
1017
|
+
* @param {Object} `options`
|
|
1018
|
+
* @return {Object} Returns an object with tokens and regex source string.
|
|
1019
|
+
* @api public
|
|
1020
|
+
*/
|
|
1021
|
+
|
|
1022
|
+
const scan = (input, options) => {
|
|
1023
|
+
const opts = options || {};
|
|
1024
|
+
|
|
1025
|
+
const length = input.length - 1;
|
|
1026
|
+
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
1027
|
+
const slashes = [];
|
|
1028
|
+
const tokens = [];
|
|
1029
|
+
const parts = [];
|
|
1030
|
+
|
|
1031
|
+
let str = input;
|
|
1032
|
+
let index = -1;
|
|
1033
|
+
let start = 0;
|
|
1034
|
+
let lastIndex = 0;
|
|
1035
|
+
let isBrace = false;
|
|
1036
|
+
let isBracket = false;
|
|
1037
|
+
let isGlob = false;
|
|
1038
|
+
let isExtglob = false;
|
|
1039
|
+
let isGlobstar = false;
|
|
1040
|
+
let braceEscaped = false;
|
|
1041
|
+
let backslashes = false;
|
|
1042
|
+
let negated = false;
|
|
1043
|
+
let negatedExtglob = false;
|
|
1044
|
+
let finished = false;
|
|
1045
|
+
let braces = 0;
|
|
1046
|
+
let prev;
|
|
1047
|
+
let code;
|
|
1048
|
+
let token = { value: '', depth: 0, isGlob: false };
|
|
1049
|
+
|
|
1050
|
+
const eos = () => index >= length;
|
|
1051
|
+
const peek = () => str.charCodeAt(index + 1);
|
|
1052
|
+
const advance = () => {
|
|
1053
|
+
prev = code;
|
|
1054
|
+
return str.charCodeAt(++index);
|
|
1055
|
+
};
|
|
1056
|
+
|
|
1057
|
+
while (index < length) {
|
|
1058
|
+
code = advance();
|
|
1059
|
+
let next;
|
|
1060
|
+
|
|
1061
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1062
|
+
backslashes = token.backslashes = true;
|
|
1063
|
+
code = advance();
|
|
1064
|
+
|
|
1065
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
1066
|
+
braceEscaped = true;
|
|
1067
|
+
}
|
|
1068
|
+
continue;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
1072
|
+
braces++;
|
|
1073
|
+
|
|
1074
|
+
while (eos() !== true && (code = advance())) {
|
|
1075
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1076
|
+
backslashes = token.backslashes = true;
|
|
1077
|
+
advance();
|
|
1078
|
+
continue;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
1082
|
+
braces++;
|
|
1083
|
+
continue;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
1087
|
+
isBrace = token.isBrace = true;
|
|
1088
|
+
isGlob = token.isGlob = true;
|
|
1089
|
+
finished = true;
|
|
1090
|
+
|
|
1091
|
+
if (scanToEnd === true) {
|
|
1092
|
+
continue;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
break;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
1099
|
+
isBrace = token.isBrace = true;
|
|
1100
|
+
isGlob = token.isGlob = true;
|
|
1101
|
+
finished = true;
|
|
1102
|
+
|
|
1103
|
+
if (scanToEnd === true) {
|
|
1104
|
+
continue;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
break;
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
1111
|
+
braces--;
|
|
1112
|
+
|
|
1113
|
+
if (braces === 0) {
|
|
1114
|
+
braceEscaped = false;
|
|
1115
|
+
isBrace = token.isBrace = true;
|
|
1116
|
+
finished = true;
|
|
1117
|
+
break;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
if (scanToEnd === true) {
|
|
1123
|
+
continue;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
break;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
if (code === CHAR_FORWARD_SLASH) {
|
|
1130
|
+
slashes.push(index);
|
|
1131
|
+
tokens.push(token);
|
|
1132
|
+
token = { value: '', depth: 0, isGlob: false };
|
|
1133
|
+
|
|
1134
|
+
if (finished === true) continue;
|
|
1135
|
+
if (prev === CHAR_DOT && index === (start + 1)) {
|
|
1136
|
+
start += 2;
|
|
1137
|
+
continue;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
lastIndex = index + 1;
|
|
1141
|
+
continue;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
if (opts.noext !== true) {
|
|
1145
|
+
const isExtglobChar = code === CHAR_PLUS
|
|
1146
|
+
|| code === CHAR_AT
|
|
1147
|
+
|| code === CHAR_ASTERISK
|
|
1148
|
+
|| code === CHAR_QUESTION_MARK
|
|
1149
|
+
|| code === CHAR_EXCLAMATION_MARK;
|
|
1150
|
+
|
|
1151
|
+
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
1152
|
+
isGlob = token.isGlob = true;
|
|
1153
|
+
isExtglob = token.isExtglob = true;
|
|
1154
|
+
finished = true;
|
|
1155
|
+
if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
1156
|
+
negatedExtglob = true;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
if (scanToEnd === true) {
|
|
1160
|
+
while (eos() !== true && (code = advance())) {
|
|
1161
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1162
|
+
backslashes = token.backslashes = true;
|
|
1163
|
+
code = advance();
|
|
1164
|
+
continue;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
1168
|
+
isGlob = token.isGlob = true;
|
|
1169
|
+
finished = true;
|
|
1170
|
+
break;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
continue;
|
|
1174
|
+
}
|
|
1175
|
+
break;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
if (code === CHAR_ASTERISK) {
|
|
1180
|
+
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
1181
|
+
isGlob = token.isGlob = true;
|
|
1182
|
+
finished = true;
|
|
1183
|
+
|
|
1184
|
+
if (scanToEnd === true) {
|
|
1185
|
+
continue;
|
|
1186
|
+
}
|
|
1187
|
+
break;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
if (code === CHAR_QUESTION_MARK) {
|
|
1191
|
+
isGlob = token.isGlob = true;
|
|
1192
|
+
finished = true;
|
|
1193
|
+
|
|
1194
|
+
if (scanToEnd === true) {
|
|
1195
|
+
continue;
|
|
1196
|
+
}
|
|
1197
|
+
break;
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
1201
|
+
while (eos() !== true && (next = advance())) {
|
|
1202
|
+
if (next === CHAR_BACKWARD_SLASH) {
|
|
1203
|
+
backslashes = token.backslashes = true;
|
|
1204
|
+
advance();
|
|
1205
|
+
continue;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
1209
|
+
isBracket = token.isBracket = true;
|
|
1210
|
+
isGlob = token.isGlob = true;
|
|
1211
|
+
finished = true;
|
|
1212
|
+
break;
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
if (scanToEnd === true) {
|
|
1217
|
+
continue;
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
break;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
1224
|
+
negated = token.negated = true;
|
|
1225
|
+
start++;
|
|
1226
|
+
continue;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
1230
|
+
isGlob = token.isGlob = true;
|
|
1231
|
+
|
|
1232
|
+
if (scanToEnd === true) {
|
|
1233
|
+
while (eos() !== true && (code = advance())) {
|
|
1234
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
1235
|
+
backslashes = token.backslashes = true;
|
|
1236
|
+
code = advance();
|
|
1237
|
+
continue;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
1241
|
+
finished = true;
|
|
1242
|
+
break;
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
continue;
|
|
1246
|
+
}
|
|
1247
|
+
break;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
if (isGlob === true) {
|
|
1251
|
+
finished = true;
|
|
1252
|
+
|
|
1253
|
+
if (scanToEnd === true) {
|
|
1254
|
+
continue;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
break;
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
2159
1260
|
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
state.output = prev.output;
|
|
2165
|
-
state.globstar = true;
|
|
2166
|
-
consume(value);
|
|
2167
|
-
continue;
|
|
2168
|
-
}
|
|
1261
|
+
if (opts.noext === true) {
|
|
1262
|
+
isExtglob = false;
|
|
1263
|
+
isGlob = false;
|
|
1264
|
+
}
|
|
2169
1265
|
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
prev.type = 'globstar';
|
|
2175
|
-
prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
|
|
2176
|
-
prev.value += value;
|
|
2177
|
-
state.globstar = true;
|
|
2178
|
-
state.output += prior.output + prev.output;
|
|
2179
|
-
consume(value);
|
|
2180
|
-
continue;
|
|
2181
|
-
}
|
|
1266
|
+
let base = str;
|
|
1267
|
+
let prefix = '';
|
|
1268
|
+
let glob = '';
|
|
2182
1269
|
|
|
2183
|
-
|
|
2184
|
-
|
|
1270
|
+
if (start > 0) {
|
|
1271
|
+
prefix = str.slice(0, start);
|
|
1272
|
+
str = str.slice(start);
|
|
1273
|
+
lastIndex -= start;
|
|
1274
|
+
}
|
|
2185
1275
|
|
|
2186
|
-
|
|
2187
|
-
|
|
1276
|
+
if (base && isGlob === true && lastIndex > 0) {
|
|
1277
|
+
base = str.slice(0, lastIndex);
|
|
1278
|
+
glob = str.slice(lastIndex);
|
|
1279
|
+
} else if (isGlob === true) {
|
|
1280
|
+
base = '';
|
|
1281
|
+
glob = str;
|
|
1282
|
+
} else {
|
|
1283
|
+
base = str;
|
|
1284
|
+
}
|
|
2188
1285
|
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
1286
|
+
if (base && base !== '' && base !== '/' && base !== str) {
|
|
1287
|
+
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
|
1288
|
+
base = base.slice(0, -1);
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
2192
1291
|
|
|
2193
|
-
|
|
2194
|
-
|
|
1292
|
+
if (opts.unescape === true) {
|
|
1293
|
+
if (glob) glob = utils.removeBackslashes(glob);
|
|
2195
1294
|
|
|
2196
|
-
|
|
1295
|
+
if (base && backslashes === true) {
|
|
1296
|
+
base = utils.removeBackslashes(base);
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
2197
1299
|
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
1300
|
+
const state = {
|
|
1301
|
+
prefix,
|
|
1302
|
+
input,
|
|
1303
|
+
start,
|
|
1304
|
+
base,
|
|
1305
|
+
glob,
|
|
1306
|
+
isBrace,
|
|
1307
|
+
isBracket,
|
|
1308
|
+
isGlob,
|
|
1309
|
+
isExtglob,
|
|
1310
|
+
isGlobstar,
|
|
1311
|
+
negated,
|
|
1312
|
+
negatedExtglob
|
|
1313
|
+
};
|
|
1314
|
+
|
|
1315
|
+
if (opts.tokens === true) {
|
|
1316
|
+
state.maxDepth = 0;
|
|
1317
|
+
if (!isPathSeparator(code)) {
|
|
1318
|
+
tokens.push(token);
|
|
1319
|
+
}
|
|
1320
|
+
state.tokens = tokens;
|
|
1321
|
+
}
|
|
2201
1322
|
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
1323
|
+
if (opts.parts === true || opts.tokens === true) {
|
|
1324
|
+
let prevIndex;
|
|
1325
|
+
|
|
1326
|
+
for (let idx = 0; idx < slashes.length; idx++) {
|
|
1327
|
+
const n = prevIndex ? prevIndex + 1 : start;
|
|
1328
|
+
const i = slashes[idx];
|
|
1329
|
+
const value = input.slice(n, i);
|
|
1330
|
+
if (opts.tokens) {
|
|
1331
|
+
if (idx === 0 && start !== 0) {
|
|
1332
|
+
tokens[idx].isPrefix = true;
|
|
1333
|
+
tokens[idx].value = prefix;
|
|
1334
|
+
} else {
|
|
1335
|
+
tokens[idx].value = value;
|
|
1336
|
+
}
|
|
1337
|
+
depth(tokens[idx]);
|
|
1338
|
+
state.maxDepth += tokens[idx].depth;
|
|
1339
|
+
}
|
|
1340
|
+
if (idx !== 0 || value !== '') {
|
|
1341
|
+
parts.push(value);
|
|
1342
|
+
}
|
|
1343
|
+
prevIndex = i;
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
if (prevIndex && prevIndex + 1 < input.length) {
|
|
1347
|
+
const value = input.slice(prevIndex + 1);
|
|
1348
|
+
parts.push(value);
|
|
1349
|
+
|
|
1350
|
+
if (opts.tokens) {
|
|
1351
|
+
tokens[tokens.length - 1].value = value;
|
|
1352
|
+
depth(tokens[tokens.length - 1]);
|
|
1353
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
state.slashes = slashes;
|
|
1358
|
+
state.parts = parts;
|
|
1359
|
+
}
|
|
2212
1360
|
|
|
2213
|
-
|
|
2214
|
-
|
|
1361
|
+
return state;
|
|
1362
|
+
};
|
|
2215
1363
|
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
prev.value += value;
|
|
1364
|
+
scan_1 = scan;
|
|
1365
|
+
return scan_1;
|
|
1366
|
+
}
|
|
2220
1367
|
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
state.globstar = true;
|
|
2224
|
-
consume(value);
|
|
2225
|
-
continue;
|
|
2226
|
-
}
|
|
1368
|
+
var parse_1;
|
|
1369
|
+
var hasRequiredParse;
|
|
2227
1370
|
|
|
2228
|
-
|
|
1371
|
+
function requireParse () {
|
|
1372
|
+
if (hasRequiredParse) return parse_1;
|
|
1373
|
+
hasRequiredParse = 1;
|
|
2229
1374
|
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
if (prev.type === 'bos' || prev.type === 'slash') {
|
|
2233
|
-
token.output = nodot + token.output;
|
|
2234
|
-
}
|
|
2235
|
-
push(token);
|
|
2236
|
-
continue;
|
|
2237
|
-
}
|
|
1375
|
+
const constants = /*@__PURE__*/ requireConstants();
|
|
1376
|
+
const utils = /*@__PURE__*/ requireUtils();
|
|
2238
1377
|
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
continue;
|
|
2243
|
-
}
|
|
1378
|
+
/**
|
|
1379
|
+
* Constants
|
|
1380
|
+
*/
|
|
2244
1381
|
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
1382
|
+
const {
|
|
1383
|
+
MAX_LENGTH,
|
|
1384
|
+
POSIX_REGEX_SOURCE,
|
|
1385
|
+
REGEX_NON_SPECIAL_CHARS,
|
|
1386
|
+
REGEX_SPECIAL_CHARS_BACKREF,
|
|
1387
|
+
REPLACEMENTS
|
|
1388
|
+
} = constants;
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* Helpers
|
|
1392
|
+
*/
|
|
1393
|
+
|
|
1394
|
+
const expandRange = (args, options) => {
|
|
1395
|
+
if (typeof options.expandRange === 'function') {
|
|
1396
|
+
return options.expandRange(...args, options);
|
|
1397
|
+
}
|
|
2249
1398
|
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
prev.output += NO_DOTS_SLASH;
|
|
1399
|
+
args.sort();
|
|
1400
|
+
const value = `[${args.join('-')}]`;
|
|
2253
1401
|
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
1402
|
+
try {
|
|
1403
|
+
/* eslint-disable-next-line no-new */
|
|
1404
|
+
new RegExp(value);
|
|
1405
|
+
} catch (ex) {
|
|
1406
|
+
return args.map(v => utils.escapeRegex(v)).join('..');
|
|
1407
|
+
}
|
|
2258
1408
|
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
prev.output += ONE_CHAR;
|
|
2262
|
-
}
|
|
2263
|
-
}
|
|
1409
|
+
return value;
|
|
1410
|
+
};
|
|
2264
1411
|
|
|
2265
|
-
|
|
2266
|
-
|
|
1412
|
+
/**
|
|
1413
|
+
* Create the message for a syntax error
|
|
1414
|
+
*/
|
|
2267
1415
|
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
decrement('brackets');
|
|
2272
|
-
}
|
|
1416
|
+
const syntaxError = (type, char) => {
|
|
1417
|
+
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
1418
|
+
};
|
|
2273
1419
|
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
1420
|
+
/**
|
|
1421
|
+
* Parse the given input string.
|
|
1422
|
+
* @param {String} input
|
|
1423
|
+
* @param {Object} options
|
|
1424
|
+
* @return {Object}
|
|
1425
|
+
*/
|
|
2279
1426
|
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
}
|
|
1427
|
+
const parse = (input, options) => {
|
|
1428
|
+
if (typeof input !== 'string') {
|
|
1429
|
+
throw new TypeError('Expected a string');
|
|
1430
|
+
}
|
|
2285
1431
|
|
|
2286
|
-
|
|
2287
|
-
push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
|
|
2288
|
-
}
|
|
1432
|
+
input = REPLACEMENTS[input] || input;
|
|
2289
1433
|
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
state.output = '';
|
|
1434
|
+
const opts = { ...options };
|
|
1435
|
+
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
2293
1436
|
|
|
2294
|
-
|
|
2295
|
-
|
|
1437
|
+
let len = input.length;
|
|
1438
|
+
if (len > max) {
|
|
1439
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
1440
|
+
}
|
|
2296
1441
|
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
1442
|
+
const bos = { type: 'bos', value: '', output: opts.prepend || '' };
|
|
1443
|
+
const tokens = [bos];
|
|
1444
|
+
|
|
1445
|
+
const capture = opts.capture ? '' : '?:';
|
|
1446
|
+
|
|
1447
|
+
// create constants based on platform, for windows or posix
|
|
1448
|
+
const PLATFORM_CHARS = constants.globChars(opts.windows);
|
|
1449
|
+
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
|
|
1450
|
+
|
|
1451
|
+
const {
|
|
1452
|
+
DOT_LITERAL,
|
|
1453
|
+
PLUS_LITERAL,
|
|
1454
|
+
SLASH_LITERAL,
|
|
1455
|
+
ONE_CHAR,
|
|
1456
|
+
DOTS_SLASH,
|
|
1457
|
+
NO_DOT,
|
|
1458
|
+
NO_DOT_SLASH,
|
|
1459
|
+
NO_DOTS_SLASH,
|
|
1460
|
+
QMARK,
|
|
1461
|
+
QMARK_NO_DOT,
|
|
1462
|
+
STAR,
|
|
1463
|
+
START_ANCHOR
|
|
1464
|
+
} = PLATFORM_CHARS;
|
|
1465
|
+
|
|
1466
|
+
const globstar = opts => {
|
|
1467
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
1468
|
+
};
|
|
1469
|
+
|
|
1470
|
+
const nodot = opts.dot ? '' : NO_DOT;
|
|
1471
|
+
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
1472
|
+
let star = opts.bash === true ? globstar(opts) : STAR;
|
|
1473
|
+
|
|
1474
|
+
if (opts.capture) {
|
|
1475
|
+
star = `(${star})`;
|
|
1476
|
+
}
|
|
2302
1477
|
|
|
2303
|
-
|
|
2304
|
-
|
|
1478
|
+
// minimatch options support
|
|
1479
|
+
if (typeof opts.noext === 'boolean') {
|
|
1480
|
+
opts.noextglob = opts.noext;
|
|
1481
|
+
}
|
|
2305
1482
|
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
1483
|
+
const state = {
|
|
1484
|
+
input,
|
|
1485
|
+
index: -1,
|
|
1486
|
+
start: 0,
|
|
1487
|
+
dot: opts.dot === true,
|
|
1488
|
+
consumed: '',
|
|
1489
|
+
output: '',
|
|
1490
|
+
prefix: '',
|
|
1491
|
+
backtrack: false,
|
|
1492
|
+
negated: false,
|
|
1493
|
+
brackets: 0,
|
|
1494
|
+
braces: 0,
|
|
1495
|
+
parens: 0,
|
|
1496
|
+
quotes: 0,
|
|
1497
|
+
globstar: false,
|
|
1498
|
+
tokens
|
|
1499
|
+
};
|
|
1500
|
+
|
|
1501
|
+
input = utils.removePrefix(input, state);
|
|
1502
|
+
len = input.length;
|
|
1503
|
+
|
|
1504
|
+
const extglobs = [];
|
|
1505
|
+
const braces = [];
|
|
1506
|
+
const stack = [];
|
|
1507
|
+
let prev = bos;
|
|
1508
|
+
let value;
|
|
1509
|
+
|
|
1510
|
+
/**
|
|
1511
|
+
* Tokenizing helpers
|
|
1512
|
+
*/
|
|
1513
|
+
|
|
1514
|
+
const eos = () => state.index === len - 1;
|
|
1515
|
+
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
1516
|
+
const advance = state.advance = () => input[++state.index] || '';
|
|
1517
|
+
const remaining = () => input.slice(state.index + 1);
|
|
1518
|
+
const consume = (value = '', num = 0) => {
|
|
1519
|
+
state.consumed += value;
|
|
1520
|
+
state.index += num;
|
|
1521
|
+
};
|
|
1522
|
+
|
|
1523
|
+
const append = token => {
|
|
1524
|
+
state.output += token.output != null ? token.output : token.value;
|
|
1525
|
+
consume(token.value);
|
|
1526
|
+
};
|
|
1527
|
+
|
|
1528
|
+
const negate = () => {
|
|
1529
|
+
let count = 1;
|
|
1530
|
+
|
|
1531
|
+
while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
|
|
1532
|
+
advance();
|
|
1533
|
+
state.start++;
|
|
1534
|
+
count++;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
if (count % 2 === 0) {
|
|
1538
|
+
return false;
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
state.negated = true;
|
|
1542
|
+
state.start++;
|
|
1543
|
+
return true;
|
|
1544
|
+
};
|
|
1545
|
+
|
|
1546
|
+
const increment = type => {
|
|
1547
|
+
state[type]++;
|
|
1548
|
+
stack.push(type);
|
|
1549
|
+
};
|
|
1550
|
+
|
|
1551
|
+
const decrement = type => {
|
|
1552
|
+
state[type]--;
|
|
1553
|
+
stack.pop();
|
|
1554
|
+
};
|
|
1555
|
+
|
|
1556
|
+
/**
|
|
1557
|
+
* Push tokens onto the tokens array. This helper speeds up
|
|
1558
|
+
* tokenizing by 1) helping us avoid backtracking as much as possible,
|
|
1559
|
+
* and 2) helping us avoid creating extra tokens when consecutive
|
|
1560
|
+
* characters are plain text. This improves performance and simplifies
|
|
1561
|
+
* lookbehinds.
|
|
1562
|
+
*/
|
|
1563
|
+
|
|
1564
|
+
const push = tok => {
|
|
1565
|
+
if (prev.type === 'globstar') {
|
|
1566
|
+
const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
|
|
1567
|
+
const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
|
|
1568
|
+
|
|
1569
|
+
if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
|
|
1570
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
1571
|
+
prev.type = 'star';
|
|
1572
|
+
prev.value = '*';
|
|
1573
|
+
prev.output = star;
|
|
1574
|
+
state.output += prev.output;
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
if (extglobs.length && tok.type !== 'paren') {
|
|
1579
|
+
extglobs[extglobs.length - 1].inner += tok.value;
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
if (tok.value || tok.output) append(tok);
|
|
1583
|
+
if (prev && prev.type === 'text' && tok.type === 'text') {
|
|
1584
|
+
prev.output = (prev.output || prev.value) + tok.value;
|
|
1585
|
+
prev.value += tok.value;
|
|
1586
|
+
return;
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
tok.prev = prev;
|
|
1590
|
+
tokens.push(tok);
|
|
1591
|
+
prev = tok;
|
|
1592
|
+
};
|
|
1593
|
+
|
|
1594
|
+
const extglobOpen = (type, value) => {
|
|
1595
|
+
const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
|
|
1596
|
+
|
|
1597
|
+
token.prev = prev;
|
|
1598
|
+
token.parens = state.parens;
|
|
1599
|
+
token.output = state.output;
|
|
1600
|
+
const output = (opts.capture ? '(' : '') + token.open;
|
|
1601
|
+
|
|
1602
|
+
increment('parens');
|
|
1603
|
+
push({ type, value, output: state.output ? '' : ONE_CHAR });
|
|
1604
|
+
push({ type: 'paren', extglob: true, value: advance(), output });
|
|
1605
|
+
extglobs.push(token);
|
|
1606
|
+
};
|
|
1607
|
+
|
|
1608
|
+
const extglobClose = token => {
|
|
1609
|
+
let output = token.close + (opts.capture ? ')' : '');
|
|
1610
|
+
let rest;
|
|
1611
|
+
|
|
1612
|
+
if (token.type === 'negate') {
|
|
1613
|
+
let extglobStar = star;
|
|
1614
|
+
|
|
1615
|
+
if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
|
|
1616
|
+
extglobStar = globstar(opts);
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
|
1620
|
+
output = token.close = `)$))${extglobStar}`;
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
1624
|
+
// Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
|
|
1625
|
+
// In this case, we need to parse the string and use it in the output of the original pattern.
|
|
1626
|
+
// Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
|
|
1627
|
+
//
|
|
1628
|
+
// Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
|
|
1629
|
+
const expression = parse(rest, { ...options, fastpaths: false }).output;
|
|
1630
|
+
|
|
1631
|
+
output = token.close = `)${expression})${extglobStar})`;
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
if (token.prev.type === 'bos') {
|
|
1635
|
+
state.negatedExtglob = true;
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
push({ type: 'paren', extglob: true, value, output });
|
|
1640
|
+
decrement('parens');
|
|
1641
|
+
};
|
|
1642
|
+
|
|
1643
|
+
/**
|
|
1644
|
+
* Fast paths
|
|
1645
|
+
*/
|
|
1646
|
+
|
|
1647
|
+
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
1648
|
+
let backslashes = false;
|
|
1649
|
+
|
|
1650
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
|
1651
|
+
if (first === '\\') {
|
|
1652
|
+
backslashes = true;
|
|
1653
|
+
return m;
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
if (first === '?') {
|
|
1657
|
+
if (esc) {
|
|
1658
|
+
return esc + first + (rest ? QMARK.repeat(rest.length) : '');
|
|
1659
|
+
}
|
|
1660
|
+
if (index === 0) {
|
|
1661
|
+
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
|
|
1662
|
+
}
|
|
1663
|
+
return QMARK.repeat(chars.length);
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
if (first === '.') {
|
|
1667
|
+
return DOT_LITERAL.repeat(chars.length);
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
if (first === '*') {
|
|
1671
|
+
if (esc) {
|
|
1672
|
+
return esc + first + (rest ? star : '');
|
|
1673
|
+
}
|
|
1674
|
+
return star;
|
|
1675
|
+
}
|
|
1676
|
+
return esc ? m : `\\${m}`;
|
|
1677
|
+
});
|
|
1678
|
+
|
|
1679
|
+
if (backslashes === true) {
|
|
1680
|
+
if (opts.unescape === true) {
|
|
1681
|
+
output = output.replace(/\\/g, '');
|
|
1682
|
+
} else {
|
|
1683
|
+
output = output.replace(/\\+/g, m => {
|
|
1684
|
+
return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
|
|
1685
|
+
});
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
if (output === input && opts.contains === true) {
|
|
1690
|
+
state.output = input;
|
|
1691
|
+
return state;
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
state.output = utils.wrapOutput(output, state, options);
|
|
1695
|
+
return state;
|
|
1696
|
+
}
|
|
2311
1697
|
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
1698
|
+
/**
|
|
1699
|
+
* Tokenize input until we reach end-of-string
|
|
1700
|
+
*/
|
|
1701
|
+
|
|
1702
|
+
while (!eos()) {
|
|
1703
|
+
value = advance();
|
|
1704
|
+
|
|
1705
|
+
if (value === '\u0000') {
|
|
1706
|
+
continue;
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
/**
|
|
1710
|
+
* Escaped characters
|
|
1711
|
+
*/
|
|
1712
|
+
|
|
1713
|
+
if (value === '\\') {
|
|
1714
|
+
const next = peek();
|
|
1715
|
+
|
|
1716
|
+
if (next === '/' && opts.bash !== true) {
|
|
1717
|
+
continue;
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
if (next === '.' || next === ';') {
|
|
1721
|
+
continue;
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
if (!next) {
|
|
1725
|
+
value += '\\';
|
|
1726
|
+
push({ type: 'text', value });
|
|
1727
|
+
continue;
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
// collapse slashes to reduce potential for exploits
|
|
1731
|
+
const match = /^\\+/.exec(remaining());
|
|
1732
|
+
let slashes = 0;
|
|
1733
|
+
|
|
1734
|
+
if (match && match[0].length > 2) {
|
|
1735
|
+
slashes = match[0].length;
|
|
1736
|
+
state.index += slashes;
|
|
1737
|
+
if (slashes % 2 !== 0) {
|
|
1738
|
+
value += '\\';
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
if (opts.unescape === true) {
|
|
1743
|
+
value = advance();
|
|
1744
|
+
} else {
|
|
1745
|
+
value += advance();
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
if (state.brackets === 0) {
|
|
1749
|
+
push({ type: 'text', value });
|
|
1750
|
+
continue;
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
/**
|
|
1755
|
+
* If we're inside a regex character class, continue
|
|
1756
|
+
* until we reach the closing bracket.
|
|
1757
|
+
*/
|
|
1758
|
+
|
|
1759
|
+
if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
|
|
1760
|
+
if (opts.posix !== false && value === ':') {
|
|
1761
|
+
const inner = prev.value.slice(1);
|
|
1762
|
+
if (inner.includes('[')) {
|
|
1763
|
+
prev.posix = true;
|
|
1764
|
+
|
|
1765
|
+
if (inner.includes(':')) {
|
|
1766
|
+
const idx = prev.value.lastIndexOf('[');
|
|
1767
|
+
const pre = prev.value.slice(0, idx);
|
|
1768
|
+
const rest = prev.value.slice(idx + 2);
|
|
1769
|
+
const posix = POSIX_REGEX_SOURCE[rest];
|
|
1770
|
+
if (posix) {
|
|
1771
|
+
prev.value = pre + posix;
|
|
1772
|
+
state.backtrack = true;
|
|
1773
|
+
advance();
|
|
1774
|
+
|
|
1775
|
+
if (!bos.output && tokens.indexOf(prev) === 1) {
|
|
1776
|
+
bos.output = ONE_CHAR;
|
|
1777
|
+
}
|
|
1778
|
+
continue;
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
|
|
1785
|
+
value = `\\${value}`;
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
|
|
1789
|
+
value = `\\${value}`;
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
if (opts.posix === true && value === '!' && prev.value === '[') {
|
|
1793
|
+
value = '^';
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
prev.value += value;
|
|
1797
|
+
append({ value });
|
|
1798
|
+
continue;
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
/**
|
|
1802
|
+
* If we're inside a quoted string, continue
|
|
1803
|
+
* until we reach the closing double quote.
|
|
1804
|
+
*/
|
|
1805
|
+
|
|
1806
|
+
if (state.quotes === 1 && value !== '"') {
|
|
1807
|
+
value = utils.escapeRegex(value);
|
|
1808
|
+
prev.value += value;
|
|
1809
|
+
append({ value });
|
|
1810
|
+
continue;
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
/**
|
|
1814
|
+
* Double quotes
|
|
1815
|
+
*/
|
|
1816
|
+
|
|
1817
|
+
if (value === '"') {
|
|
1818
|
+
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
1819
|
+
if (opts.keepQuotes === true) {
|
|
1820
|
+
push({ type: 'text', value });
|
|
1821
|
+
}
|
|
1822
|
+
continue;
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
/**
|
|
1826
|
+
* Parentheses
|
|
1827
|
+
*/
|
|
1828
|
+
|
|
1829
|
+
if (value === '(') {
|
|
1830
|
+
increment('parens');
|
|
1831
|
+
push({ type: 'paren', value });
|
|
1832
|
+
continue;
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
if (value === ')') {
|
|
1836
|
+
if (state.parens === 0 && opts.strictBrackets === true) {
|
|
1837
|
+
throw new SyntaxError(syntaxError('opening', '('));
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
const extglob = extglobs[extglobs.length - 1];
|
|
1841
|
+
if (extglob && state.parens === extglob.parens + 1) {
|
|
1842
|
+
extglobClose(extglobs.pop());
|
|
1843
|
+
continue;
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1846
|
+
push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
|
|
1847
|
+
decrement('parens');
|
|
1848
|
+
continue;
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
/**
|
|
1852
|
+
* Square brackets
|
|
1853
|
+
*/
|
|
1854
|
+
|
|
1855
|
+
if (value === '[') {
|
|
1856
|
+
if (opts.nobracket === true || !remaining().includes(']')) {
|
|
1857
|
+
if (opts.nobracket !== true && opts.strictBrackets === true) {
|
|
1858
|
+
throw new SyntaxError(syntaxError('closing', ']'));
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
value = `\\${value}`;
|
|
1862
|
+
} else {
|
|
1863
|
+
increment('brackets');
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
push({ type: 'bracket', value });
|
|
1867
|
+
continue;
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
if (value === ']') {
|
|
1871
|
+
if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
|
|
1872
|
+
push({ type: 'text', value, output: `\\${value}` });
|
|
1873
|
+
continue;
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
if (state.brackets === 0) {
|
|
1877
|
+
if (opts.strictBrackets === true) {
|
|
1878
|
+
throw new SyntaxError(syntaxError('opening', '['));
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
push({ type: 'text', value, output: `\\${value}` });
|
|
1882
|
+
continue;
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1885
|
+
decrement('brackets');
|
|
1886
|
+
|
|
1887
|
+
const prevValue = prev.value.slice(1);
|
|
1888
|
+
if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
|
|
1889
|
+
value = `/${value}`;
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
prev.value += value;
|
|
1893
|
+
append({ value });
|
|
1894
|
+
|
|
1895
|
+
// when literal brackets are explicitly disabled
|
|
1896
|
+
// assume we should match with a regex character class
|
|
1897
|
+
if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
|
|
1898
|
+
continue;
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
const escaped = utils.escapeRegex(prev.value);
|
|
1902
|
+
state.output = state.output.slice(0, -prev.value.length);
|
|
1903
|
+
|
|
1904
|
+
// when literal brackets are explicitly enabled
|
|
1905
|
+
// assume we should escape the brackets to match literal characters
|
|
1906
|
+
if (opts.literalBrackets === true) {
|
|
1907
|
+
state.output += escaped;
|
|
1908
|
+
prev.value = escaped;
|
|
1909
|
+
continue;
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
// when the user specifies nothing, try to match both
|
|
1913
|
+
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
1914
|
+
state.output += prev.value;
|
|
1915
|
+
continue;
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
/**
|
|
1919
|
+
* Braces
|
|
1920
|
+
*/
|
|
1921
|
+
|
|
1922
|
+
if (value === '{' && opts.nobrace !== true) {
|
|
1923
|
+
increment('braces');
|
|
1924
|
+
|
|
1925
|
+
const open = {
|
|
1926
|
+
type: 'brace',
|
|
1927
|
+
value,
|
|
1928
|
+
output: '(',
|
|
1929
|
+
outputIndex: state.output.length,
|
|
1930
|
+
tokensIndex: state.tokens.length
|
|
1931
|
+
};
|
|
1932
|
+
|
|
1933
|
+
braces.push(open);
|
|
1934
|
+
push(open);
|
|
1935
|
+
continue;
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
if (value === '}') {
|
|
1939
|
+
const brace = braces[braces.length - 1];
|
|
1940
|
+
|
|
1941
|
+
if (opts.nobrace === true || !brace) {
|
|
1942
|
+
push({ type: 'text', value, output: value });
|
|
1943
|
+
continue;
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
let output = ')';
|
|
1947
|
+
|
|
1948
|
+
if (brace.dots === true) {
|
|
1949
|
+
const arr = tokens.slice();
|
|
1950
|
+
const range = [];
|
|
1951
|
+
|
|
1952
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
1953
|
+
tokens.pop();
|
|
1954
|
+
if (arr[i].type === 'brace') {
|
|
1955
|
+
break;
|
|
1956
|
+
}
|
|
1957
|
+
if (arr[i].type !== 'dots') {
|
|
1958
|
+
range.unshift(arr[i].value);
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
output = expandRange(range, opts);
|
|
1963
|
+
state.backtrack = true;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
if (brace.comma !== true && brace.dots !== true) {
|
|
1967
|
+
const out = state.output.slice(0, brace.outputIndex);
|
|
1968
|
+
const toks = state.tokens.slice(brace.tokensIndex);
|
|
1969
|
+
brace.value = brace.output = '\\{';
|
|
1970
|
+
value = output = '\\}';
|
|
1971
|
+
state.output = out;
|
|
1972
|
+
for (const t of toks) {
|
|
1973
|
+
state.output += (t.output || t.value);
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
push({ type: 'brace', value, output });
|
|
1978
|
+
decrement('braces');
|
|
1979
|
+
braces.pop();
|
|
1980
|
+
continue;
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
/**
|
|
1984
|
+
* Pipes
|
|
1985
|
+
*/
|
|
1986
|
+
|
|
1987
|
+
if (value === '|') {
|
|
1988
|
+
if (extglobs.length > 0) {
|
|
1989
|
+
extglobs[extglobs.length - 1].conditions++;
|
|
1990
|
+
}
|
|
1991
|
+
push({ type: 'text', value });
|
|
1992
|
+
continue;
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
/**
|
|
1996
|
+
* Commas
|
|
1997
|
+
*/
|
|
1998
|
+
|
|
1999
|
+
if (value === ',') {
|
|
2000
|
+
let output = value;
|
|
2001
|
+
|
|
2002
|
+
const brace = braces[braces.length - 1];
|
|
2003
|
+
if (brace && stack[stack.length - 1] === 'braces') {
|
|
2004
|
+
brace.comma = true;
|
|
2005
|
+
output = '|';
|
|
2006
|
+
}
|
|
2007
|
+
|
|
2008
|
+
push({ type: 'comma', value, output });
|
|
2009
|
+
continue;
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2012
|
+
/**
|
|
2013
|
+
* Slashes
|
|
2014
|
+
*/
|
|
2015
|
+
|
|
2016
|
+
if (value === '/') {
|
|
2017
|
+
// if the beginning of the glob is "./", advance the start
|
|
2018
|
+
// to the current index, and don't add the "./" characters
|
|
2019
|
+
// to the state. This greatly simplifies lookbehinds when
|
|
2020
|
+
// checking for BOS characters like "!" and "." (not "./")
|
|
2021
|
+
if (prev.type === 'dot' && state.index === state.start + 1) {
|
|
2022
|
+
state.start = state.index + 1;
|
|
2023
|
+
state.consumed = '';
|
|
2024
|
+
state.output = '';
|
|
2025
|
+
tokens.pop();
|
|
2026
|
+
prev = bos; // reset "prev" to the first token
|
|
2027
|
+
continue;
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
push({ type: 'slash', value, output: SLASH_LITERAL });
|
|
2031
|
+
continue;
|
|
2032
|
+
}
|
|
2033
|
+
|
|
2034
|
+
/**
|
|
2035
|
+
* Dots
|
|
2036
|
+
*/
|
|
2037
|
+
|
|
2038
|
+
if (value === '.') {
|
|
2039
|
+
if (state.braces > 0 && prev.type === 'dot') {
|
|
2040
|
+
if (prev.value === '.') prev.output = DOT_LITERAL;
|
|
2041
|
+
const brace = braces[braces.length - 1];
|
|
2042
|
+
prev.type = 'dots';
|
|
2043
|
+
prev.output += value;
|
|
2044
|
+
prev.value += value;
|
|
2045
|
+
brace.dots = true;
|
|
2046
|
+
continue;
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
|
|
2050
|
+
push({ type: 'text', value, output: DOT_LITERAL });
|
|
2051
|
+
continue;
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
push({ type: 'dot', value, output: DOT_LITERAL });
|
|
2055
|
+
continue;
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2058
|
+
/**
|
|
2059
|
+
* Question marks
|
|
2060
|
+
*/
|
|
2061
|
+
|
|
2062
|
+
if (value === '?') {
|
|
2063
|
+
const isGroup = prev && prev.value === '(';
|
|
2064
|
+
if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
|
2065
|
+
extglobOpen('qmark', value);
|
|
2066
|
+
continue;
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
if (prev && prev.type === 'paren') {
|
|
2070
|
+
const next = peek();
|
|
2071
|
+
let output = value;
|
|
2072
|
+
|
|
2073
|
+
if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
|
|
2074
|
+
output = `\\${value}`;
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
push({ type: 'text', value, output });
|
|
2078
|
+
continue;
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
|
|
2082
|
+
push({ type: 'qmark', value, output: QMARK_NO_DOT });
|
|
2083
|
+
continue;
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
push({ type: 'qmark', value, output: QMARK });
|
|
2087
|
+
continue;
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
/**
|
|
2091
|
+
* Exclamation
|
|
2092
|
+
*/
|
|
2093
|
+
|
|
2094
|
+
if (value === '!') {
|
|
2095
|
+
if (opts.noextglob !== true && peek() === '(') {
|
|
2096
|
+
if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
|
|
2097
|
+
extglobOpen('negate', value);
|
|
2098
|
+
continue;
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
if (opts.nonegate !== true && state.index === 0) {
|
|
2103
|
+
negate();
|
|
2104
|
+
continue;
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
/**
|
|
2109
|
+
* Plus
|
|
2110
|
+
*/
|
|
2111
|
+
|
|
2112
|
+
if (value === '+') {
|
|
2113
|
+
if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
|
2114
|
+
extglobOpen('plus', value);
|
|
2115
|
+
continue;
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
if ((prev && prev.value === '(') || opts.regex === false) {
|
|
2119
|
+
push({ type: 'plus', value, output: PLUS_LITERAL });
|
|
2120
|
+
continue;
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
|
|
2124
|
+
push({ type: 'plus', value });
|
|
2125
|
+
continue;
|
|
2126
|
+
}
|
|
2127
|
+
|
|
2128
|
+
push({ type: 'plus', value: PLUS_LITERAL });
|
|
2129
|
+
continue;
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
/**
|
|
2133
|
+
* Plain text
|
|
2134
|
+
*/
|
|
2135
|
+
|
|
2136
|
+
if (value === '@') {
|
|
2137
|
+
if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
|
2138
|
+
push({ type: 'at', extglob: true, value, output: '' });
|
|
2139
|
+
continue;
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
push({ type: 'text', value });
|
|
2143
|
+
continue;
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
/**
|
|
2147
|
+
* Plain text
|
|
2148
|
+
*/
|
|
2149
|
+
|
|
2150
|
+
if (value !== '*') {
|
|
2151
|
+
if (value === '$' || value === '^') {
|
|
2152
|
+
value = `\\${value}`;
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
2156
|
+
if (match) {
|
|
2157
|
+
value += match[0];
|
|
2158
|
+
state.index += match[0].length;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
push({ type: 'text', value });
|
|
2162
|
+
continue;
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
/**
|
|
2166
|
+
* Stars
|
|
2167
|
+
*/
|
|
2168
|
+
|
|
2169
|
+
if (prev && (prev.type === 'globstar' || prev.star === true)) {
|
|
2170
|
+
prev.type = 'star';
|
|
2171
|
+
prev.star = true;
|
|
2172
|
+
prev.value += value;
|
|
2173
|
+
prev.output = star;
|
|
2174
|
+
state.backtrack = true;
|
|
2175
|
+
state.globstar = true;
|
|
2176
|
+
consume(value);
|
|
2177
|
+
continue;
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
let rest = remaining();
|
|
2181
|
+
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
2182
|
+
extglobOpen('star', value);
|
|
2183
|
+
continue;
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
if (prev.type === 'star') {
|
|
2187
|
+
if (opts.noglobstar === true) {
|
|
2188
|
+
consume(value);
|
|
2189
|
+
continue;
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
const prior = prev.prev;
|
|
2193
|
+
const before = prior.prev;
|
|
2194
|
+
const isStart = prior.type === 'slash' || prior.type === 'bos';
|
|
2195
|
+
const afterStar = before && (before.type === 'star' || before.type === 'globstar');
|
|
2196
|
+
|
|
2197
|
+
if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
|
|
2198
|
+
push({ type: 'star', value, output: '' });
|
|
2199
|
+
continue;
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2202
|
+
const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
|
|
2203
|
+
const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
|
|
2204
|
+
if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
|
|
2205
|
+
push({ type: 'star', value, output: '' });
|
|
2206
|
+
continue;
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2209
|
+
// strip consecutive `/**/`
|
|
2210
|
+
while (rest.slice(0, 3) === '/**') {
|
|
2211
|
+
const after = input[state.index + 4];
|
|
2212
|
+
if (after && after !== '/') {
|
|
2213
|
+
break;
|
|
2214
|
+
}
|
|
2215
|
+
rest = rest.slice(3);
|
|
2216
|
+
consume('/**', 3);
|
|
2217
|
+
}
|
|
2218
|
+
|
|
2219
|
+
if (prior.type === 'bos' && eos()) {
|
|
2220
|
+
prev.type = 'globstar';
|
|
2221
|
+
prev.value += value;
|
|
2222
|
+
prev.output = globstar(opts);
|
|
2223
|
+
state.output = prev.output;
|
|
2224
|
+
state.globstar = true;
|
|
2225
|
+
consume(value);
|
|
2226
|
+
continue;
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
|
|
2230
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
2231
|
+
prior.output = `(?:${prior.output}`;
|
|
2232
|
+
|
|
2233
|
+
prev.type = 'globstar';
|
|
2234
|
+
prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
|
|
2235
|
+
prev.value += value;
|
|
2236
|
+
state.globstar = true;
|
|
2237
|
+
state.output += prior.output + prev.output;
|
|
2238
|
+
consume(value);
|
|
2239
|
+
continue;
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
|
|
2243
|
+
const end = rest[1] !== void 0 ? '|$' : '';
|
|
2244
|
+
|
|
2245
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
2246
|
+
prior.output = `(?:${prior.output}`;
|
|
2247
|
+
|
|
2248
|
+
prev.type = 'globstar';
|
|
2249
|
+
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
2250
|
+
prev.value += value;
|
|
2251
|
+
|
|
2252
|
+
state.output += prior.output + prev.output;
|
|
2253
|
+
state.globstar = true;
|
|
2254
|
+
|
|
2255
|
+
consume(value + advance());
|
|
2256
|
+
|
|
2257
|
+
push({ type: 'slash', value: '/', output: '' });
|
|
2258
|
+
continue;
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
if (prior.type === 'bos' && rest[0] === '/') {
|
|
2262
|
+
prev.type = 'globstar';
|
|
2263
|
+
prev.value += value;
|
|
2264
|
+
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
2265
|
+
state.output = prev.output;
|
|
2266
|
+
state.globstar = true;
|
|
2267
|
+
consume(value + advance());
|
|
2268
|
+
push({ type: 'slash', value: '/', output: '' });
|
|
2269
|
+
continue;
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
// remove single star from output
|
|
2273
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
2274
|
+
|
|
2275
|
+
// reset previous token to globstar
|
|
2276
|
+
prev.type = 'globstar';
|
|
2277
|
+
prev.output = globstar(opts);
|
|
2278
|
+
prev.value += value;
|
|
2279
|
+
|
|
2280
|
+
// reset output with globstar
|
|
2281
|
+
state.output += prev.output;
|
|
2282
|
+
state.globstar = true;
|
|
2283
|
+
consume(value);
|
|
2284
|
+
continue;
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2287
|
+
const token = { type: 'star', value, output: star };
|
|
2288
|
+
|
|
2289
|
+
if (opts.bash === true) {
|
|
2290
|
+
token.output = '.*?';
|
|
2291
|
+
if (prev.type === 'bos' || prev.type === 'slash') {
|
|
2292
|
+
token.output = nodot + token.output;
|
|
2293
|
+
}
|
|
2294
|
+
push(token);
|
|
2295
|
+
continue;
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
|
|
2299
|
+
token.output = value;
|
|
2300
|
+
push(token);
|
|
2301
|
+
continue;
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2304
|
+
if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
|
|
2305
|
+
if (prev.type === 'dot') {
|
|
2306
|
+
state.output += NO_DOT_SLASH;
|
|
2307
|
+
prev.output += NO_DOT_SLASH;
|
|
2308
|
+
|
|
2309
|
+
} else if (opts.dot === true) {
|
|
2310
|
+
state.output += NO_DOTS_SLASH;
|
|
2311
|
+
prev.output += NO_DOTS_SLASH;
|
|
2312
|
+
|
|
2313
|
+
} else {
|
|
2314
|
+
state.output += nodot;
|
|
2315
|
+
prev.output += nodot;
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
if (peek() !== '*') {
|
|
2319
|
+
state.output += ONE_CHAR;
|
|
2320
|
+
prev.output += ONE_CHAR;
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2324
|
+
push(token);
|
|
2325
|
+
}
|
|
2319
2326
|
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
SLASH_LITERAL,
|
|
2326
|
-
ONE_CHAR,
|
|
2327
|
-
DOTS_SLASH,
|
|
2328
|
-
NO_DOT,
|
|
2329
|
-
NO_DOTS,
|
|
2330
|
-
NO_DOTS_SLASH,
|
|
2331
|
-
STAR,
|
|
2332
|
-
START_ANCHOR
|
|
2333
|
-
} = constants$2.globChars(opts.windows);
|
|
2334
|
-
|
|
2335
|
-
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
2336
|
-
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
2337
|
-
const capture = opts.capture ? '' : '?:';
|
|
2338
|
-
const state = { negated: false, prefix: '' };
|
|
2339
|
-
let star = opts.bash === true ? '.*?' : STAR;
|
|
2340
|
-
|
|
2341
|
-
if (opts.capture) {
|
|
2342
|
-
star = `(${star})`;
|
|
2343
|
-
}
|
|
2327
|
+
while (state.brackets > 0) {
|
|
2328
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
|
|
2329
|
+
state.output = utils.escapeLast(state.output, '[');
|
|
2330
|
+
decrement('brackets');
|
|
2331
|
+
}
|
|
2344
2332
|
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2333
|
+
while (state.parens > 0) {
|
|
2334
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
|
|
2335
|
+
state.output = utils.escapeLast(state.output, '(');
|
|
2336
|
+
decrement('parens');
|
|
2337
|
+
}
|
|
2349
2338
|
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2339
|
+
while (state.braces > 0) {
|
|
2340
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
|
|
2341
|
+
state.output = utils.escapeLast(state.output, '{');
|
|
2342
|
+
decrement('braces');
|
|
2343
|
+
}
|
|
2354
2344
|
|
|
2355
|
-
|
|
2356
|
-
|
|
2345
|
+
if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
|
|
2346
|
+
push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
|
|
2347
|
+
}
|
|
2357
2348
|
|
|
2358
|
-
|
|
2359
|
-
|
|
2349
|
+
// rebuild the output if we had to backtrack at any point
|
|
2350
|
+
if (state.backtrack === true) {
|
|
2351
|
+
state.output = '';
|
|
2360
2352
|
|
|
2361
|
-
|
|
2362
|
-
|
|
2353
|
+
for (const token of state.tokens) {
|
|
2354
|
+
state.output += token.output != null ? token.output : token.value;
|
|
2363
2355
|
|
|
2364
|
-
|
|
2365
|
-
|
|
2356
|
+
if (token.suffix) {
|
|
2357
|
+
state.output += token.suffix;
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2366
2361
|
|
|
2367
|
-
|
|
2368
|
-
|
|
2362
|
+
return state;
|
|
2363
|
+
};
|
|
2369
2364
|
|
|
2370
|
-
|
|
2371
|
-
|
|
2365
|
+
/**
|
|
2366
|
+
* Fast paths for creating regular expressions for common glob patterns.
|
|
2367
|
+
* This can significantly speed up processing and has very little downside
|
|
2368
|
+
* impact when none of the fast paths match.
|
|
2369
|
+
*/
|
|
2370
|
+
|
|
2371
|
+
parse.fastpaths = (input, options) => {
|
|
2372
|
+
const opts = { ...options };
|
|
2373
|
+
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
2374
|
+
const len = input.length;
|
|
2375
|
+
if (len > max) {
|
|
2376
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
2377
|
+
}
|
|
2372
2378
|
|
|
2373
|
-
|
|
2374
|
-
|
|
2379
|
+
input = REPLACEMENTS[input] || input;
|
|
2380
|
+
|
|
2381
|
+
// create constants based on platform, for windows or posix
|
|
2382
|
+
const {
|
|
2383
|
+
DOT_LITERAL,
|
|
2384
|
+
SLASH_LITERAL,
|
|
2385
|
+
ONE_CHAR,
|
|
2386
|
+
DOTS_SLASH,
|
|
2387
|
+
NO_DOT,
|
|
2388
|
+
NO_DOTS,
|
|
2389
|
+
NO_DOTS_SLASH,
|
|
2390
|
+
STAR,
|
|
2391
|
+
START_ANCHOR
|
|
2392
|
+
} = constants.globChars(opts.windows);
|
|
2393
|
+
|
|
2394
|
+
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
2395
|
+
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
2396
|
+
const capture = opts.capture ? '' : '?:';
|
|
2397
|
+
const state = { negated: false, prefix: '' };
|
|
2398
|
+
let star = opts.bash === true ? '.*?' : STAR;
|
|
2399
|
+
|
|
2400
|
+
if (opts.capture) {
|
|
2401
|
+
star = `(${star})`;
|
|
2402
|
+
}
|
|
2375
2403
|
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2404
|
+
const globstar = opts => {
|
|
2405
|
+
if (opts.noglobstar === true) return star;
|
|
2406
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
2407
|
+
};
|
|
2379
2408
|
|
|
2380
|
-
|
|
2381
|
-
|
|
2409
|
+
const create = str => {
|
|
2410
|
+
switch (str) {
|
|
2411
|
+
case '*':
|
|
2412
|
+
return `${nodot}${ONE_CHAR}${star}`;
|
|
2382
2413
|
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
}
|
|
2386
|
-
};
|
|
2414
|
+
case '.*':
|
|
2415
|
+
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
2387
2416
|
|
|
2388
|
-
|
|
2389
|
-
|
|
2417
|
+
case '*.*':
|
|
2418
|
+
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
2390
2419
|
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
}
|
|
2420
|
+
case '*/*':
|
|
2421
|
+
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
2394
2422
|
|
|
2395
|
-
|
|
2396
|
-
|
|
2423
|
+
case '**':
|
|
2424
|
+
return nodot + globstar(opts);
|
|
2397
2425
|
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
const scan = scan_1;
|
|
2401
|
-
const parse$1 = parse_1;
|
|
2402
|
-
const utils = utils$3;
|
|
2403
|
-
const constants$1 = constants$3;
|
|
2404
|
-
const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
2405
|
-
|
|
2406
|
-
/**
|
|
2407
|
-
* Creates a matcher function from one or more glob patterns. The
|
|
2408
|
-
* returned function takes a string to match as its first argument,
|
|
2409
|
-
* and returns true if the string is a match. The returned matcher
|
|
2410
|
-
* function also takes a boolean as the second argument that, when true,
|
|
2411
|
-
* returns an object with additional information.
|
|
2412
|
-
*
|
|
2413
|
-
* ```js
|
|
2414
|
-
* const picomatch = require('picomatch');
|
|
2415
|
-
* // picomatch(glob[, options]);
|
|
2416
|
-
*
|
|
2417
|
-
* const isMatch = picomatch('*.!(*a)');
|
|
2418
|
-
* console.log(isMatch('a.a')); //=> false
|
|
2419
|
-
* console.log(isMatch('a.b')); //=> true
|
|
2420
|
-
* ```
|
|
2421
|
-
* @name picomatch
|
|
2422
|
-
* @param {String|Array} `globs` One or more glob patterns.
|
|
2423
|
-
* @param {Object=} `options`
|
|
2424
|
-
* @return {Function=} Returns a matcher function.
|
|
2425
|
-
* @api public
|
|
2426
|
-
*/
|
|
2426
|
+
case '**/*':
|
|
2427
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
2427
2428
|
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
const fns = glob.map(input => picomatch(input, options, returnState));
|
|
2431
|
-
const arrayMatcher = str => {
|
|
2432
|
-
for (const isMatch of fns) {
|
|
2433
|
-
const state = isMatch(str);
|
|
2434
|
-
if (state) return state;
|
|
2435
|
-
}
|
|
2436
|
-
return false;
|
|
2437
|
-
};
|
|
2438
|
-
return arrayMatcher;
|
|
2439
|
-
}
|
|
2429
|
+
case '**/*.*':
|
|
2430
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
2440
2431
|
|
|
2441
|
-
|
|
2432
|
+
case '**/.*':
|
|
2433
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
2442
2434
|
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2435
|
+
default: {
|
|
2436
|
+
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
2437
|
+
if (!match) return;
|
|
2446
2438
|
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
const regex = isState
|
|
2450
|
-
? picomatch.compileRe(glob, options)
|
|
2451
|
-
: picomatch.makeRe(glob, options, false, true);
|
|
2439
|
+
const source = create(match[1]);
|
|
2440
|
+
if (!source) return;
|
|
2452
2441
|
|
|
2453
|
-
|
|
2454
|
-
|
|
2442
|
+
return source + DOT_LITERAL + match[2];
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
};
|
|
2455
2446
|
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
2459
|
-
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
2460
|
-
}
|
|
2447
|
+
const output = utils.removePrefix(input, state);
|
|
2448
|
+
let source = create(output);
|
|
2461
2449
|
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2450
|
+
if (source && opts.strictSlashes !== true) {
|
|
2451
|
+
source += `${SLASH_LITERAL}?`;
|
|
2452
|
+
}
|
|
2465
2453
|
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
}
|
|
2454
|
+
return source;
|
|
2455
|
+
};
|
|
2469
2456
|
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2457
|
+
parse_1 = parse;
|
|
2458
|
+
return parse_1;
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2461
|
+
var picomatch_1$1;
|
|
2462
|
+
var hasRequiredPicomatch$1;
|
|
2463
|
+
|
|
2464
|
+
function requirePicomatch$1 () {
|
|
2465
|
+
if (hasRequiredPicomatch$1) return picomatch_1$1;
|
|
2466
|
+
hasRequiredPicomatch$1 = 1;
|
|
2467
|
+
|
|
2468
|
+
const scan = /*@__PURE__*/ requireScan();
|
|
2469
|
+
const parse = /*@__PURE__*/ requireParse();
|
|
2470
|
+
const utils = /*@__PURE__*/ requireUtils();
|
|
2471
|
+
const constants = /*@__PURE__*/ requireConstants();
|
|
2472
|
+
const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
2473
|
+
|
|
2474
|
+
/**
|
|
2475
|
+
* Creates a matcher function from one or more glob patterns. The
|
|
2476
|
+
* returned function takes a string to match as its first argument,
|
|
2477
|
+
* and returns true if the string is a match. The returned matcher
|
|
2478
|
+
* function also takes a boolean as the second argument that, when true,
|
|
2479
|
+
* returns an object with additional information.
|
|
2480
|
+
*
|
|
2481
|
+
* ```js
|
|
2482
|
+
* const picomatch = require('picomatch');
|
|
2483
|
+
* // picomatch(glob[, options]);
|
|
2484
|
+
*
|
|
2485
|
+
* const isMatch = picomatch('*.!(*a)');
|
|
2486
|
+
* console.log(isMatch('a.a')); //=> false
|
|
2487
|
+
* console.log(isMatch('a.b')); //=> true
|
|
2488
|
+
* ```
|
|
2489
|
+
* @name picomatch
|
|
2490
|
+
* @param {String|Array} `globs` One or more glob patterns.
|
|
2491
|
+
* @param {Object=} `options`
|
|
2492
|
+
* @return {Function=} Returns a matcher function.
|
|
2493
|
+
* @api public
|
|
2494
|
+
*/
|
|
2495
|
+
|
|
2496
|
+
const picomatch = (glob, options, returnState = false) => {
|
|
2497
|
+
if (Array.isArray(glob)) {
|
|
2498
|
+
const fns = glob.map(input => picomatch(input, options, returnState));
|
|
2499
|
+
const arrayMatcher = str => {
|
|
2500
|
+
for (const isMatch of fns) {
|
|
2501
|
+
const state = isMatch(str);
|
|
2502
|
+
if (state) return state;
|
|
2503
|
+
}
|
|
2504
|
+
return false;
|
|
2505
|
+
};
|
|
2506
|
+
return arrayMatcher;
|
|
2507
|
+
}
|
|
2474
2508
|
|
|
2475
|
-
|
|
2476
|
-
if (typeof opts.onIgnore === 'function') {
|
|
2477
|
-
opts.onIgnore(result);
|
|
2478
|
-
}
|
|
2479
|
-
result.isMatch = false;
|
|
2480
|
-
return returnObject ? result : false;
|
|
2481
|
-
}
|
|
2509
|
+
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
2482
2510
|
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
return returnObject ? result : true;
|
|
2487
|
-
};
|
|
2511
|
+
if (glob === '' || (typeof glob !== 'string' && !isState)) {
|
|
2512
|
+
throw new TypeError('Expected pattern to be a non-empty string');
|
|
2513
|
+
}
|
|
2488
2514
|
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2515
|
+
const opts = options || {};
|
|
2516
|
+
const posix = opts.windows;
|
|
2517
|
+
const regex = isState
|
|
2518
|
+
? picomatch.compileRe(glob, options)
|
|
2519
|
+
: picomatch.makeRe(glob, options, false, true);
|
|
2492
2520
|
|
|
2493
|
-
|
|
2494
|
-
|
|
2521
|
+
const state = regex.state;
|
|
2522
|
+
delete regex.state;
|
|
2495
2523
|
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
* const picomatch = require('picomatch');
|
|
2502
|
-
* // picomatch.test(input, regex[, options]);
|
|
2503
|
-
*
|
|
2504
|
-
* console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
|
2505
|
-
* // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
|
2506
|
-
* ```
|
|
2507
|
-
* @param {String} `input` String to test.
|
|
2508
|
-
* @param {RegExp} `regex`
|
|
2509
|
-
* @return {Object} Returns an object with matching info.
|
|
2510
|
-
* @api public
|
|
2511
|
-
*/
|
|
2524
|
+
let isIgnored = () => false;
|
|
2525
|
+
if (opts.ignore) {
|
|
2526
|
+
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
2527
|
+
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
2528
|
+
}
|
|
2512
2529
|
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2530
|
+
const matcher = (input, returnObject = false) => {
|
|
2531
|
+
const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
|
|
2532
|
+
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
|
2533
|
+
|
|
2534
|
+
if (typeof opts.onResult === 'function') {
|
|
2535
|
+
opts.onResult(result);
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2538
|
+
if (isMatch === false) {
|
|
2539
|
+
result.isMatch = false;
|
|
2540
|
+
return returnObject ? result : false;
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2543
|
+
if (isIgnored(input)) {
|
|
2544
|
+
if (typeof opts.onIgnore === 'function') {
|
|
2545
|
+
opts.onIgnore(result);
|
|
2546
|
+
}
|
|
2547
|
+
result.isMatch = false;
|
|
2548
|
+
return returnObject ? result : false;
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
if (typeof opts.onMatch === 'function') {
|
|
2552
|
+
opts.onMatch(result);
|
|
2553
|
+
}
|
|
2554
|
+
return returnObject ? result : true;
|
|
2555
|
+
};
|
|
2556
|
+
|
|
2557
|
+
if (returnState) {
|
|
2558
|
+
matcher.state = state;
|
|
2559
|
+
}
|
|
2517
2560
|
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
}
|
|
2561
|
+
return matcher;
|
|
2562
|
+
};
|
|
2521
2563
|
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2564
|
+
/**
|
|
2565
|
+
* Test `input` with the given `regex`. This is used by the main
|
|
2566
|
+
* `picomatch()` function to test the input string.
|
|
2567
|
+
*
|
|
2568
|
+
* ```js
|
|
2569
|
+
* const picomatch = require('picomatch');
|
|
2570
|
+
* // picomatch.test(input, regex[, options]);
|
|
2571
|
+
*
|
|
2572
|
+
* console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
|
2573
|
+
* // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
|
2574
|
+
* ```
|
|
2575
|
+
* @param {String} `input` String to test.
|
|
2576
|
+
* @param {RegExp} `regex`
|
|
2577
|
+
* @return {Object} Returns an object with matching info.
|
|
2578
|
+
* @api public
|
|
2579
|
+
*/
|
|
2580
|
+
|
|
2581
|
+
picomatch.test = (input, regex, options, { glob, posix } = {}) => {
|
|
2582
|
+
if (typeof input !== 'string') {
|
|
2583
|
+
throw new TypeError('Expected input to be a string');
|
|
2584
|
+
}
|
|
2526
2585
|
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
}
|
|
2586
|
+
if (input === '') {
|
|
2587
|
+
return { isMatch: false, output: '' };
|
|
2588
|
+
}
|
|
2531
2589
|
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
match = regex.exec(output);
|
|
2537
|
-
}
|
|
2538
|
-
}
|
|
2590
|
+
const opts = options || {};
|
|
2591
|
+
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
2592
|
+
let match = input === glob;
|
|
2593
|
+
let output = (match && format) ? format(input) : input;
|
|
2539
2594
|
|
|
2540
|
-
|
|
2541
|
-
|
|
2595
|
+
if (match === false) {
|
|
2596
|
+
output = format ? format(input) : input;
|
|
2597
|
+
match = output === glob;
|
|
2598
|
+
}
|
|
2542
2599
|
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
* ```
|
|
2551
|
-
* @param {String} `input` String to test.
|
|
2552
|
-
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
|
|
2553
|
-
* @return {Boolean}
|
|
2554
|
-
* @api public
|
|
2555
|
-
*/
|
|
2600
|
+
if (match === false || opts.capture === true) {
|
|
2601
|
+
if (opts.matchBase === true || opts.basename === true) {
|
|
2602
|
+
match = picomatch.matchBase(input, regex, options, posix);
|
|
2603
|
+
} else {
|
|
2604
|
+
match = regex.exec(output);
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2556
2607
|
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
return regex.test(utils.basename(input));
|
|
2560
|
-
};
|
|
2608
|
+
return { isMatch: Boolean(match), match, output };
|
|
2609
|
+
};
|
|
2561
2610
|
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2611
|
+
/**
|
|
2612
|
+
* Match the basename of a filepath.
|
|
2613
|
+
*
|
|
2614
|
+
* ```js
|
|
2615
|
+
* const picomatch = require('picomatch');
|
|
2616
|
+
* // picomatch.matchBase(input, glob[, options]);
|
|
2617
|
+
* console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
|
2618
|
+
* ```
|
|
2619
|
+
* @param {String} `input` String to test.
|
|
2620
|
+
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
|
|
2621
|
+
* @return {Boolean}
|
|
2622
|
+
* @api public
|
|
2623
|
+
*/
|
|
2624
|
+
|
|
2625
|
+
picomatch.matchBase = (input, glob, options) => {
|
|
2626
|
+
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
2627
|
+
return regex.test(utils.basename(input));
|
|
2628
|
+
};
|
|
2578
2629
|
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2630
|
+
/**
|
|
2631
|
+
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
|
2632
|
+
*
|
|
2633
|
+
* ```js
|
|
2634
|
+
* const picomatch = require('picomatch');
|
|
2635
|
+
* // picomatch.isMatch(string, patterns[, options]);
|
|
2636
|
+
*
|
|
2637
|
+
* console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
|
2638
|
+
* console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
|
2639
|
+
* ```
|
|
2640
|
+
* @param {String|Array} str The string to test.
|
|
2641
|
+
* @param {String|Array} patterns One or more glob patterns to use for matching.
|
|
2642
|
+
* @param {Object} [options] See available [options](#options).
|
|
2643
|
+
* @return {Boolean} Returns true if any patterns match `str`
|
|
2644
|
+
* @api public
|
|
2645
|
+
*/
|
|
2646
|
+
|
|
2647
|
+
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
2648
|
+
|
|
2649
|
+
/**
|
|
2650
|
+
* Parse a glob pattern to create the source string for a regular
|
|
2651
|
+
* expression.
|
|
2652
|
+
*
|
|
2653
|
+
* ```js
|
|
2654
|
+
* const picomatch = require('picomatch');
|
|
2655
|
+
* const result = picomatch.parse(pattern[, options]);
|
|
2656
|
+
* ```
|
|
2657
|
+
* @param {String} `pattern`
|
|
2658
|
+
* @param {Object} `options`
|
|
2659
|
+
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
|
|
2660
|
+
* @api public
|
|
2661
|
+
*/
|
|
2662
|
+
|
|
2663
|
+
picomatch.parse = (pattern, options) => {
|
|
2664
|
+
if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));
|
|
2665
|
+
return parse(pattern, { ...options, fastpaths: false });
|
|
2666
|
+
};
|
|
2594
2667
|
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2668
|
+
/**
|
|
2669
|
+
* Scan a glob pattern to separate the pattern into segments.
|
|
2670
|
+
*
|
|
2671
|
+
* ```js
|
|
2672
|
+
* const picomatch = require('picomatch');
|
|
2673
|
+
* // picomatch.scan(input[, options]);
|
|
2674
|
+
*
|
|
2675
|
+
* const result = picomatch.scan('!./foo/*.js');
|
|
2676
|
+
* console.log(result);
|
|
2677
|
+
* { prefix: '!./',
|
|
2678
|
+
* input: '!./foo/*.js',
|
|
2679
|
+
* start: 3,
|
|
2680
|
+
* base: 'foo',
|
|
2681
|
+
* glob: '*.js',
|
|
2682
|
+
* isBrace: false,
|
|
2683
|
+
* isBracket: false,
|
|
2684
|
+
* isGlob: true,
|
|
2685
|
+
* isExtglob: false,
|
|
2686
|
+
* isGlobstar: false,
|
|
2687
|
+
* negated: true }
|
|
2688
|
+
* ```
|
|
2689
|
+
* @param {String} `input` Glob pattern to scan.
|
|
2690
|
+
* @param {Object} `options`
|
|
2691
|
+
* @return {Object} Returns an object with
|
|
2692
|
+
* @api public
|
|
2693
|
+
*/
|
|
2694
|
+
|
|
2695
|
+
picomatch.scan = (input, options) => scan(input, options);
|
|
2696
|
+
|
|
2697
|
+
/**
|
|
2698
|
+
* Compile a regular expression from the `state` object returned by the
|
|
2699
|
+
* [parse()](#parse) method.
|
|
2700
|
+
*
|
|
2701
|
+
* @param {Object} `state`
|
|
2702
|
+
* @param {Object} `options`
|
|
2703
|
+
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
2704
|
+
* @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
|
|
2705
|
+
* @return {RegExp}
|
|
2706
|
+
* @api public
|
|
2707
|
+
*/
|
|
2708
|
+
|
|
2709
|
+
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
2710
|
+
if (returnOutput === true) {
|
|
2711
|
+
return state.output;
|
|
2712
|
+
}
|
|
2599
2713
|
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
* ```js
|
|
2604
|
-
* const picomatch = require('picomatch');
|
|
2605
|
-
* // picomatch.scan(input[, options]);
|
|
2606
|
-
*
|
|
2607
|
-
* const result = picomatch.scan('!./foo/*.js');
|
|
2608
|
-
* console.log(result);
|
|
2609
|
-
* { prefix: '!./',
|
|
2610
|
-
* input: '!./foo/*.js',
|
|
2611
|
-
* start: 3,
|
|
2612
|
-
* base: 'foo',
|
|
2613
|
-
* glob: '*.js',
|
|
2614
|
-
* isBrace: false,
|
|
2615
|
-
* isBracket: false,
|
|
2616
|
-
* isGlob: true,
|
|
2617
|
-
* isExtglob: false,
|
|
2618
|
-
* isGlobstar: false,
|
|
2619
|
-
* negated: true }
|
|
2620
|
-
* ```
|
|
2621
|
-
* @param {String} `input` Glob pattern to scan.
|
|
2622
|
-
* @param {Object} `options`
|
|
2623
|
-
* @return {Object} Returns an object with
|
|
2624
|
-
* @api public
|
|
2625
|
-
*/
|
|
2714
|
+
const opts = options || {};
|
|
2715
|
+
const prepend = opts.contains ? '' : '^';
|
|
2716
|
+
const append = opts.contains ? '' : '$';
|
|
2626
2717
|
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
*
|
|
2632
|
-
* ```js
|
|
2633
|
-
* const picomatch = require('picomatch');
|
|
2634
|
-
* const state = picomatch.parse('*.js');
|
|
2635
|
-
* // picomatch.compileRe(state[, options]);
|
|
2636
|
-
*
|
|
2637
|
-
* console.log(picomatch.compileRe(state));
|
|
2638
|
-
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
2639
|
-
* ```
|
|
2640
|
-
* @param {String} `state` The object returned from the `.parse` method.
|
|
2641
|
-
* @param {Object} `options`
|
|
2642
|
-
* @return {RegExp} Returns a regex created from the given pattern.
|
|
2643
|
-
* @api public
|
|
2644
|
-
*/
|
|
2718
|
+
let source = `${prepend}(?:${state.output})${append}`;
|
|
2719
|
+
if (state && state.negated === true) {
|
|
2720
|
+
source = `^(?!${source}).*$`;
|
|
2721
|
+
}
|
|
2645
2722
|
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2723
|
+
const regex = picomatch.toRegex(source, options);
|
|
2724
|
+
if (returnState === true) {
|
|
2725
|
+
regex.state = state;
|
|
2726
|
+
}
|
|
2650
2727
|
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
const append = opts.contains ? '' : '$';
|
|
2728
|
+
return regex;
|
|
2729
|
+
};
|
|
2654
2730
|
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2731
|
+
/**
|
|
2732
|
+
* Create a regular expression from a parsed glob pattern.
|
|
2733
|
+
*
|
|
2734
|
+
* ```js
|
|
2735
|
+
* const picomatch = require('picomatch');
|
|
2736
|
+
* const state = picomatch.parse('*.js');
|
|
2737
|
+
* // picomatch.compileRe(state[, options]);
|
|
2738
|
+
*
|
|
2739
|
+
* console.log(picomatch.compileRe(state));
|
|
2740
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
2741
|
+
* ```
|
|
2742
|
+
* @param {String} `state` The object returned from the `.parse` method.
|
|
2743
|
+
* @param {Object} `options`
|
|
2744
|
+
* @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.
|
|
2745
|
+
* @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
|
|
2746
|
+
* @return {RegExp} Returns a regex created from the given pattern.
|
|
2747
|
+
* @api public
|
|
2748
|
+
*/
|
|
2749
|
+
|
|
2750
|
+
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
2751
|
+
if (!input || typeof input !== 'string') {
|
|
2752
|
+
throw new TypeError('Expected a non-empty string');
|
|
2753
|
+
}
|
|
2659
2754
|
|
|
2660
|
-
|
|
2661
|
-
if (returnState === true) {
|
|
2662
|
-
regex.state = parsed;
|
|
2663
|
-
}
|
|
2755
|
+
let parsed = { negated: false, fastpaths: true };
|
|
2664
2756
|
|
|
2665
|
-
|
|
2666
|
-
|
|
2757
|
+
if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
|
|
2758
|
+
parsed.output = parse.fastpaths(input, options);
|
|
2759
|
+
}
|
|
2667
2760
|
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
}
|
|
2761
|
+
if (!parsed.output) {
|
|
2762
|
+
parsed = parse(input, options);
|
|
2763
|
+
}
|
|
2672
2764
|
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
let prefix = '';
|
|
2676
|
-
let output;
|
|
2765
|
+
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
2766
|
+
};
|
|
2677
2767
|
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2768
|
+
/**
|
|
2769
|
+
* Create a regular expression from the given regex source string.
|
|
2770
|
+
*
|
|
2771
|
+
* ```js
|
|
2772
|
+
* const picomatch = require('picomatch');
|
|
2773
|
+
* // picomatch.toRegex(source[, options]);
|
|
2774
|
+
*
|
|
2775
|
+
* const { output } = picomatch.parse('*.js');
|
|
2776
|
+
* console.log(picomatch.toRegex(output));
|
|
2777
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
2778
|
+
* ```
|
|
2779
|
+
* @param {String} `source` Regular expression source string.
|
|
2780
|
+
* @param {Object} `options`
|
|
2781
|
+
* @return {RegExp}
|
|
2782
|
+
* @api public
|
|
2783
|
+
*/
|
|
2784
|
+
|
|
2785
|
+
picomatch.toRegex = (source, options) => {
|
|
2786
|
+
try {
|
|
2787
|
+
const opts = options || {};
|
|
2788
|
+
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
|
2789
|
+
} catch (err) {
|
|
2790
|
+
if (options && options.debug === true) throw err;
|
|
2791
|
+
return /$^/;
|
|
2792
|
+
}
|
|
2793
|
+
};
|
|
2682
2794
|
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2795
|
+
/**
|
|
2796
|
+
* Picomatch constants.
|
|
2797
|
+
* @return {Object}
|
|
2798
|
+
*/
|
|
2686
2799
|
|
|
2687
|
-
|
|
2688
|
-
parsed = parse$1(input, options);
|
|
2689
|
-
parsed.prefix = prefix + (parsed.prefix || '');
|
|
2690
|
-
} else {
|
|
2691
|
-
parsed.output = output;
|
|
2692
|
-
}
|
|
2800
|
+
picomatch.constants = constants;
|
|
2693
2801
|
|
|
2694
|
-
|
|
2695
|
-
|
|
2802
|
+
/**
|
|
2803
|
+
* Expose "picomatch"
|
|
2804
|
+
*/
|
|
2696
2805
|
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
* ```js
|
|
2701
|
-
* const picomatch = require('picomatch');
|
|
2702
|
-
* // picomatch.toRegex(source[, options]);
|
|
2703
|
-
*
|
|
2704
|
-
* const { output } = picomatch.parse('*.js');
|
|
2705
|
-
* console.log(picomatch.toRegex(output));
|
|
2706
|
-
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
2707
|
-
* ```
|
|
2708
|
-
* @param {String} `source` Regular expression source string.
|
|
2709
|
-
* @param {Object} `options`
|
|
2710
|
-
* @return {RegExp}
|
|
2711
|
-
* @api public
|
|
2712
|
-
*/
|
|
2806
|
+
picomatch_1$1 = picomatch;
|
|
2807
|
+
return picomatch_1$1;
|
|
2808
|
+
}
|
|
2713
2809
|
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
const opts = options || {};
|
|
2717
|
-
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
|
2718
|
-
} catch (err) {
|
|
2719
|
-
if (options && options.debug === true) throw err;
|
|
2720
|
-
return /$^/;
|
|
2721
|
-
}
|
|
2722
|
-
};
|
|
2810
|
+
var picomatch_1;
|
|
2811
|
+
var hasRequiredPicomatch;
|
|
2723
2812
|
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
*/
|
|
2813
|
+
function requirePicomatch () {
|
|
2814
|
+
if (hasRequiredPicomatch) return picomatch_1;
|
|
2815
|
+
hasRequiredPicomatch = 1;
|
|
2728
2816
|
|
|
2729
|
-
|
|
2817
|
+
const pico = /*@__PURE__*/ requirePicomatch$1();
|
|
2818
|
+
const utils = /*@__PURE__*/ requireUtils();
|
|
2730
2819
|
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2820
|
+
function picomatch(glob, options, returnState = false) {
|
|
2821
|
+
// default to os.platform()
|
|
2822
|
+
if (options && (options.windows === null || options.windows === undefined)) {
|
|
2823
|
+
// don't mutate the original options object
|
|
2824
|
+
options = { ...options, windows: utils.isWindows() };
|
|
2825
|
+
}
|
|
2734
2826
|
|
|
2735
|
-
|
|
2827
|
+
return pico(glob, options, returnState);
|
|
2828
|
+
}
|
|
2736
2829
|
|
|
2737
|
-
|
|
2830
|
+
Object.assign(picomatch, pico);
|
|
2831
|
+
picomatch_1 = picomatch;
|
|
2832
|
+
return picomatch_1;
|
|
2833
|
+
}
|
|
2738
2834
|
|
|
2739
|
-
var
|
|
2835
|
+
var picomatchExports = /*@__PURE__*/ requirePicomatch();
|
|
2836
|
+
var pm = /*@__PURE__*/getDefaultExportFromCjs(picomatchExports);
|
|
2740
2837
|
|
|
2741
2838
|
function isArray(arg) {
|
|
2742
2839
|
return Array.isArray(arg);
|
|
@@ -2829,10 +2926,10 @@ var drawChart = (function (exports) {
|
|
|
2829
2926
|
const useFilter = () => {
|
|
2830
2927
|
const [includeFilter, setIncludeFilter] = h("");
|
|
2831
2928
|
const [excludeFilter, setExcludeFilter] = h("");
|
|
2832
|
-
const setIncludeFilterTrottled =
|
|
2833
|
-
const setExcludeFilterTrottled =
|
|
2834
|
-
const isIncluded =
|
|
2835
|
-
const getModuleFilterMultiplier =
|
|
2929
|
+
const setIncludeFilterTrottled = T(() => throttleFilter(setIncludeFilter, 200), []);
|
|
2930
|
+
const setExcludeFilterTrottled = T(() => throttleFilter(setExcludeFilter, 200), []);
|
|
2931
|
+
const isIncluded = T(() => createFilter(prepareFilter(includeFilter), prepareFilter(excludeFilter)), [includeFilter, excludeFilter]);
|
|
2932
|
+
const getModuleFilterMultiplier = q((bundleId, data) => {
|
|
2836
2933
|
return isIncluded(bundleId, data.id) ? 1 : 0;
|
|
2837
2934
|
}, [isIncluded]);
|
|
2838
2935
|
return {
|
|
@@ -2917,7 +3014,6 @@ var drawChart = (function (exports) {
|
|
|
2917
3014
|
const ascendingBisect = bisector(ascending);
|
|
2918
3015
|
const bisectRight = ascendingBisect.right;
|
|
2919
3016
|
bisector(number$1).center;
|
|
2920
|
-
var bisect = bisectRight;
|
|
2921
3017
|
|
|
2922
3018
|
class InternMap extends Map {
|
|
2923
3019
|
constructor(entries, key = keyof) {
|
|
@@ -3051,11 +3147,11 @@ var drawChart = (function (exports) {
|
|
|
3051
3147
|
const PADDING = 2;
|
|
3052
3148
|
|
|
3053
3149
|
const Node = ({ node, onMouseOver, onClick, selected }) => {
|
|
3054
|
-
const { getModuleColor } =
|
|
3150
|
+
const { getModuleColor } = x(StaticContext);
|
|
3055
3151
|
const { backgroundColor, fontColor } = getModuleColor(node);
|
|
3056
3152
|
const { x0, x1, y1, y0, data, children = null } = node;
|
|
3057
|
-
const textRef =
|
|
3058
|
-
const textRectRef =
|
|
3153
|
+
const textRef = A(null);
|
|
3154
|
+
const textRectRef = A();
|
|
3059
3155
|
const width = x1 - x0;
|
|
3060
3156
|
const height = y1 - y0;
|
|
3061
3157
|
const textProps = {
|
|
@@ -3070,7 +3166,7 @@ var drawChart = (function (exports) {
|
|
|
3070
3166
|
else {
|
|
3071
3167
|
textProps.y = height / 2;
|
|
3072
3168
|
}
|
|
3073
|
-
|
|
3169
|
+
_(() => {
|
|
3074
3170
|
if (width == 0 || height == 0 || !textRef.current) {
|
|
3075
3171
|
return;
|
|
3076
3172
|
}
|
|
@@ -3110,10 +3206,10 @@ var drawChart = (function (exports) {
|
|
|
3110
3206
|
};
|
|
3111
3207
|
|
|
3112
3208
|
const TreeMap = ({ root, onNodeHover, selectedNode, onNodeClick, }) => {
|
|
3113
|
-
const { width, height, getModuleIds } =
|
|
3209
|
+
const { width, height, getModuleIds } = x(StaticContext);
|
|
3114
3210
|
console.time("layering");
|
|
3115
3211
|
// this will make groups by height
|
|
3116
|
-
const nestedData =
|
|
3212
|
+
const nestedData = T(() => {
|
|
3117
3213
|
const nestedDataMap = group(root.descendants(), (d) => d.height);
|
|
3118
3214
|
const nestedData = Array.from(nestedDataMap, ([key, values]) => ({
|
|
3119
3215
|
key,
|
|
@@ -3130,7 +3226,7 @@ var drawChart = (function (exports) {
|
|
|
3130
3226
|
}) }));
|
|
3131
3227
|
};
|
|
3132
3228
|
|
|
3133
|
-
var bytes
|
|
3229
|
+
var bytes = {exports: {}};
|
|
3134
3230
|
|
|
3135
3231
|
/*!
|
|
3136
3232
|
* bytes
|
|
@@ -3139,178 +3235,188 @@ var drawChart = (function (exports) {
|
|
|
3139
3235
|
* MIT Licensed
|
|
3140
3236
|
*/
|
|
3141
3237
|
|
|
3142
|
-
|
|
3143
|
-
* Module exports.
|
|
3144
|
-
* @public
|
|
3145
|
-
*/
|
|
3146
|
-
|
|
3147
|
-
bytes$1.exports = bytes;
|
|
3148
|
-
var format_1 = bytes$1.exports.format = format$1;
|
|
3149
|
-
bytes$1.exports.parse = parse;
|
|
3150
|
-
|
|
3151
|
-
/**
|
|
3152
|
-
* Module variables.
|
|
3153
|
-
* @private
|
|
3154
|
-
*/
|
|
3238
|
+
var hasRequiredBytes;
|
|
3155
3239
|
|
|
3156
|
-
|
|
3240
|
+
function requireBytes () {
|
|
3241
|
+
if (hasRequiredBytes) return bytes.exports;
|
|
3242
|
+
hasRequiredBytes = 1;
|
|
3157
3243
|
|
|
3158
|
-
|
|
3244
|
+
/**
|
|
3245
|
+
* Module exports.
|
|
3246
|
+
* @public
|
|
3247
|
+
*/
|
|
3159
3248
|
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
mb: 1 << 20,
|
|
3164
|
-
gb: 1 << 30,
|
|
3165
|
-
tb: Math.pow(1024, 4),
|
|
3166
|
-
pb: Math.pow(1024, 5),
|
|
3167
|
-
};
|
|
3249
|
+
bytes.exports = bytes$1;
|
|
3250
|
+
bytes.exports.format = format;
|
|
3251
|
+
bytes.exports.parse = parse;
|
|
3168
3252
|
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
*
|
|
3174
|
-
* @param {string|number} value
|
|
3175
|
-
* @param {{
|
|
3176
|
-
* case: [string],
|
|
3177
|
-
* decimalPlaces: [number]
|
|
3178
|
-
* fixedDecimals: [boolean]
|
|
3179
|
-
* thousandsSeparator: [string]
|
|
3180
|
-
* unitSeparator: [string]
|
|
3181
|
-
* }} [options] bytes options.
|
|
3182
|
-
*
|
|
3183
|
-
* @returns {string|number|null}
|
|
3184
|
-
*/
|
|
3253
|
+
/**
|
|
3254
|
+
* Module variables.
|
|
3255
|
+
* @private
|
|
3256
|
+
*/
|
|
3185
3257
|
|
|
3186
|
-
|
|
3187
|
-
if (typeof value === 'string') {
|
|
3188
|
-
return parse(value);
|
|
3189
|
-
}
|
|
3258
|
+
var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
|
|
3190
3259
|
|
|
3191
|
-
|
|
3192
|
-
return format$1(value, options);
|
|
3193
|
-
}
|
|
3260
|
+
var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
|
|
3194
3261
|
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
*
|
|
3204
|
-
* @param {number} value
|
|
3205
|
-
* @param {object} [options]
|
|
3206
|
-
* @param {number} [options.decimalPlaces=2]
|
|
3207
|
-
* @param {number} [options.fixedDecimals=false]
|
|
3208
|
-
* @param {string} [options.thousandsSeparator=]
|
|
3209
|
-
* @param {string} [options.unit=]
|
|
3210
|
-
* @param {string} [options.unitSeparator=]
|
|
3211
|
-
*
|
|
3212
|
-
* @returns {string|null}
|
|
3213
|
-
* @public
|
|
3214
|
-
*/
|
|
3262
|
+
var map = {
|
|
3263
|
+
b: 1,
|
|
3264
|
+
kb: 1 << 10,
|
|
3265
|
+
mb: 1 << 20,
|
|
3266
|
+
gb: 1 << 30,
|
|
3267
|
+
tb: Math.pow(1024, 4),
|
|
3268
|
+
pb: Math.pow(1024, 5),
|
|
3269
|
+
};
|
|
3215
3270
|
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3271
|
+
var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
|
|
3272
|
+
|
|
3273
|
+
/**
|
|
3274
|
+
* Convert the given value in bytes into a string or parse to string to an integer in bytes.
|
|
3275
|
+
*
|
|
3276
|
+
* @param {string|number} value
|
|
3277
|
+
* @param {{
|
|
3278
|
+
* case: [string],
|
|
3279
|
+
* decimalPlaces: [number]
|
|
3280
|
+
* fixedDecimals: [boolean]
|
|
3281
|
+
* thousandsSeparator: [string]
|
|
3282
|
+
* unitSeparator: [string]
|
|
3283
|
+
* }} [options] bytes options.
|
|
3284
|
+
*
|
|
3285
|
+
* @returns {string|number|null}
|
|
3286
|
+
*/
|
|
3287
|
+
|
|
3288
|
+
function bytes$1(value, options) {
|
|
3289
|
+
if (typeof value === 'string') {
|
|
3290
|
+
return parse(value);
|
|
3291
|
+
}
|
|
3220
3292
|
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2;
|
|
3225
|
-
var fixedDecimals = Boolean(options && options.fixedDecimals);
|
|
3226
|
-
var unit = (options && options.unit) || '';
|
|
3227
|
-
|
|
3228
|
-
if (!unit || !map$1[unit.toLowerCase()]) {
|
|
3229
|
-
if (mag >= map$1.pb) {
|
|
3230
|
-
unit = 'PB';
|
|
3231
|
-
} else if (mag >= map$1.tb) {
|
|
3232
|
-
unit = 'TB';
|
|
3233
|
-
} else if (mag >= map$1.gb) {
|
|
3234
|
-
unit = 'GB';
|
|
3235
|
-
} else if (mag >= map$1.mb) {
|
|
3236
|
-
unit = 'MB';
|
|
3237
|
-
} else if (mag >= map$1.kb) {
|
|
3238
|
-
unit = 'KB';
|
|
3239
|
-
} else {
|
|
3240
|
-
unit = 'B';
|
|
3241
|
-
}
|
|
3242
|
-
}
|
|
3293
|
+
if (typeof value === 'number') {
|
|
3294
|
+
return format(value, options);
|
|
3295
|
+
}
|
|
3243
3296
|
|
|
3244
|
-
|
|
3245
|
-
|
|
3297
|
+
return null;
|
|
3298
|
+
}
|
|
3299
|
+
|
|
3300
|
+
/**
|
|
3301
|
+
* Format the given value in bytes into a string.
|
|
3302
|
+
*
|
|
3303
|
+
* If the value is negative, it is kept as such. If it is a float,
|
|
3304
|
+
* it is rounded.
|
|
3305
|
+
*
|
|
3306
|
+
* @param {number} value
|
|
3307
|
+
* @param {object} [options]
|
|
3308
|
+
* @param {number} [options.decimalPlaces=2]
|
|
3309
|
+
* @param {number} [options.fixedDecimals=false]
|
|
3310
|
+
* @param {string} [options.thousandsSeparator=]
|
|
3311
|
+
* @param {string} [options.unit=]
|
|
3312
|
+
* @param {string} [options.unitSeparator=]
|
|
3313
|
+
*
|
|
3314
|
+
* @returns {string|null}
|
|
3315
|
+
* @public
|
|
3316
|
+
*/
|
|
3317
|
+
|
|
3318
|
+
function format(value, options) {
|
|
3319
|
+
if (!Number.isFinite(value)) {
|
|
3320
|
+
return null;
|
|
3321
|
+
}
|
|
3246
3322
|
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3323
|
+
var mag = Math.abs(value);
|
|
3324
|
+
var thousandsSeparator = (options && options.thousandsSeparator) || '';
|
|
3325
|
+
var unitSeparator = (options && options.unitSeparator) || '';
|
|
3326
|
+
var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2;
|
|
3327
|
+
var fixedDecimals = Boolean(options && options.fixedDecimals);
|
|
3328
|
+
var unit = (options && options.unit) || '';
|
|
3329
|
+
|
|
3330
|
+
if (!unit || !map[unit.toLowerCase()]) {
|
|
3331
|
+
if (mag >= map.pb) {
|
|
3332
|
+
unit = 'PB';
|
|
3333
|
+
} else if (mag >= map.tb) {
|
|
3334
|
+
unit = 'TB';
|
|
3335
|
+
} else if (mag >= map.gb) {
|
|
3336
|
+
unit = 'GB';
|
|
3337
|
+
} else if (mag >= map.mb) {
|
|
3338
|
+
unit = 'MB';
|
|
3339
|
+
} else if (mag >= map.kb) {
|
|
3340
|
+
unit = 'KB';
|
|
3341
|
+
} else {
|
|
3342
|
+
unit = 'B';
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3250
3345
|
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
return i === 0
|
|
3254
|
-
? s.replace(formatThousandsRegExp, thousandsSeparator)
|
|
3255
|
-
: s
|
|
3256
|
-
}).join('.');
|
|
3257
|
-
}
|
|
3346
|
+
var val = value / map[unit.toLowerCase()];
|
|
3347
|
+
var str = val.toFixed(decimalPlaces);
|
|
3258
3348
|
|
|
3259
|
-
|
|
3260
|
-
|
|
3349
|
+
if (!fixedDecimals) {
|
|
3350
|
+
str = str.replace(formatDecimalsRegExp, '$1');
|
|
3351
|
+
}
|
|
3261
3352
|
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
* @returns {number|null}
|
|
3270
|
-
* @public
|
|
3271
|
-
*/
|
|
3353
|
+
if (thousandsSeparator) {
|
|
3354
|
+
str = str.split('.').map(function (s, i) {
|
|
3355
|
+
return i === 0
|
|
3356
|
+
? s.replace(formatThousandsRegExp, thousandsSeparator)
|
|
3357
|
+
: s
|
|
3358
|
+
}).join('.');
|
|
3359
|
+
}
|
|
3272
3360
|
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3361
|
+
return str + unitSeparator + unit;
|
|
3362
|
+
}
|
|
3363
|
+
|
|
3364
|
+
/**
|
|
3365
|
+
* Parse the string value into an integer in bytes.
|
|
3366
|
+
*
|
|
3367
|
+
* If no unit is given, it is assumed the value is in bytes.
|
|
3368
|
+
*
|
|
3369
|
+
* @param {number|string} val
|
|
3370
|
+
*
|
|
3371
|
+
* @returns {number|null}
|
|
3372
|
+
* @public
|
|
3373
|
+
*/
|
|
3374
|
+
|
|
3375
|
+
function parse(val) {
|
|
3376
|
+
if (typeof val === 'number' && !isNaN(val)) {
|
|
3377
|
+
return val;
|
|
3378
|
+
}
|
|
3277
3379
|
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3380
|
+
if (typeof val !== 'string') {
|
|
3381
|
+
return null;
|
|
3382
|
+
}
|
|
3281
3383
|
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3384
|
+
// Test if the string passed is valid
|
|
3385
|
+
var results = parseRegExp.exec(val);
|
|
3386
|
+
var floatValue;
|
|
3387
|
+
var unit = 'b';
|
|
3286
3388
|
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3389
|
+
if (!results) {
|
|
3390
|
+
// Nothing could be extracted from the given string
|
|
3391
|
+
floatValue = parseInt(val, 10);
|
|
3392
|
+
unit = 'b';
|
|
3393
|
+
} else {
|
|
3394
|
+
// Retrieve the value and the unit
|
|
3395
|
+
floatValue = parseFloat(results[1]);
|
|
3396
|
+
unit = results[4].toLowerCase();
|
|
3397
|
+
}
|
|
3296
3398
|
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3399
|
+
if (isNaN(floatValue)) {
|
|
3400
|
+
return null;
|
|
3401
|
+
}
|
|
3300
3402
|
|
|
3301
|
-
|
|
3403
|
+
return Math.floor(map[unit] * floatValue);
|
|
3404
|
+
}
|
|
3405
|
+
return bytes.exports;
|
|
3302
3406
|
}
|
|
3303
3407
|
|
|
3408
|
+
var bytesExports = requireBytes();
|
|
3409
|
+
|
|
3304
3410
|
const Tooltip_marginX = 10;
|
|
3305
3411
|
const Tooltip_marginY = 30;
|
|
3306
3412
|
const SOURCEMAP_RENDERED = (u$1("span", { children: [" ", u$1("b", { children: LABELS.renderedLength }), " is a number of characters in the file after individual and ", u$1("br", {}), " ", "whole bundle transformations according to sourcemap."] }));
|
|
3307
3413
|
const RENDRED = (u$1("span", { children: [u$1("b", { children: LABELS.renderedLength }), " is a byte size of individual file after transformations and treeshake."] }));
|
|
3308
3414
|
const COMPRESSED = (u$1("span", { children: [u$1("b", { children: LABELS.gzipLength }), " and ", u$1("b", { children: LABELS.brotliLength }), " is a byte size of individual file after individual transformations,", u$1("br", {}), " treeshake and compression."] }));
|
|
3309
3415
|
const Tooltip = ({ node, visible, root, sizeProperty, }) => {
|
|
3310
|
-
const { availableSizeProperties, getModuleSize, data } =
|
|
3311
|
-
const ref =
|
|
3416
|
+
const { availableSizeProperties, getModuleSize, data } = x(StaticContext);
|
|
3417
|
+
const ref = A(null);
|
|
3312
3418
|
const [style, setStyle] = h({});
|
|
3313
|
-
const content =
|
|
3419
|
+
const content = T(() => {
|
|
3314
3420
|
if (!node)
|
|
3315
3421
|
return null;
|
|
3316
3422
|
const mainSize = getModuleSize(node.data, sizeProperty);
|
|
@@ -3327,17 +3433,17 @@ var drawChart = (function (exports) {
|
|
|
3327
3433
|
const mainUid = data.nodeParts[node.data.uid].metaUid;
|
|
3328
3434
|
dataNode = data.nodeMetas[mainUid];
|
|
3329
3435
|
}
|
|
3330
|
-
return (u$1(
|
|
3436
|
+
return (u$1(k$1, { children: [u$1("div", { children: path }), availableSizeProperties.map((sizeProp) => {
|
|
3331
3437
|
if (sizeProp === sizeProperty) {
|
|
3332
|
-
return (u$1("div", { children: [u$1("b", { children: [LABELS[sizeProp], ": ",
|
|
3438
|
+
return (u$1("div", { children: [u$1("b", { children: [LABELS[sizeProp], ": ", bytesExports.format(mainSize)] }), " ", "(", percentageString, ")"] }, sizeProp));
|
|
3333
3439
|
}
|
|
3334
3440
|
else {
|
|
3335
|
-
return (u$1("div", { children: [LABELS[sizeProp], ": ",
|
|
3441
|
+
return (u$1("div", { children: [LABELS[sizeProp], ": ", bytesExports.format(getModuleSize(node.data, sizeProp))] }, sizeProp));
|
|
3336
3442
|
}
|
|
3337
3443
|
}), u$1("br", {}), dataNode && dataNode.importedBy.length > 0 && (u$1("div", { children: [u$1("div", { children: [u$1("b", { children: "Imported By" }), ":"] }), dataNode.importedBy.map(({ uid }) => {
|
|
3338
3444
|
const id = data.nodeMetas[uid].id;
|
|
3339
3445
|
return u$1("div", { children: id }, id);
|
|
3340
|
-
})] })), u$1("br", {}), u$1("small", { children: data.options.sourcemap ? SOURCEMAP_RENDERED : RENDRED }), (data.options.gzip || data.options.brotli) && (u$1(
|
|
3446
|
+
})] })), u$1("br", {}), u$1("small", { children: data.options.sourcemap ? SOURCEMAP_RENDERED : RENDRED }), (data.options.gzip || data.options.brotli) && (u$1(k$1, { children: [u$1("br", {}), u$1("small", { children: COMPRESSED })] }))] }));
|
|
3341
3447
|
}, [availableSizeProperties, data, getModuleSize, node, root.data, sizeProperty]);
|
|
3342
3448
|
const updatePosition = (mouseCoords) => {
|
|
3343
3449
|
if (!ref.current)
|
|
@@ -3349,15 +3455,15 @@ var drawChart = (function (exports) {
|
|
|
3349
3455
|
const boundingRect = ref.current.getBoundingClientRect();
|
|
3350
3456
|
if (pos.left + boundingRect.width > window.innerWidth) {
|
|
3351
3457
|
// Shifting horizontally
|
|
3352
|
-
pos.left = window.innerWidth - boundingRect.width;
|
|
3458
|
+
pos.left = Math.max(0, window.innerWidth - boundingRect.width);
|
|
3353
3459
|
}
|
|
3354
3460
|
if (pos.top + boundingRect.height > window.innerHeight) {
|
|
3355
3461
|
// Flipping vertically
|
|
3356
|
-
pos.top = mouseCoords.y - Tooltip_marginY - boundingRect.height;
|
|
3462
|
+
pos.top = Math.max(0, mouseCoords.y - Tooltip_marginY - boundingRect.height);
|
|
3357
3463
|
}
|
|
3358
3464
|
setStyle(pos);
|
|
3359
3465
|
};
|
|
3360
|
-
|
|
3466
|
+
y(() => {
|
|
3361
3467
|
const handleMouseMove = (event) => {
|
|
3362
3468
|
updatePosition({
|
|
3363
3469
|
x: event.pageX,
|
|
@@ -3375,7 +3481,7 @@ var drawChart = (function (exports) {
|
|
|
3375
3481
|
const Chart = ({ root, sizeProperty, selectedNode, setSelectedNode, }) => {
|
|
3376
3482
|
const [showTooltip, setShowTooltip] = h(false);
|
|
3377
3483
|
const [tooltipNode, setTooltipNode] = h(undefined);
|
|
3378
|
-
|
|
3484
|
+
y(() => {
|
|
3379
3485
|
const handleMouseOut = () => {
|
|
3380
3486
|
setShowTooltip(false);
|
|
3381
3487
|
};
|
|
@@ -3384,7 +3490,7 @@ var drawChart = (function (exports) {
|
|
|
3384
3490
|
document.removeEventListener("mouseover", handleMouseOut);
|
|
3385
3491
|
};
|
|
3386
3492
|
}, []);
|
|
3387
|
-
return (u$1(
|
|
3493
|
+
return (u$1(k$1, { children: [u$1(TreeMap, { root: root, onNodeHover: (node) => {
|
|
3388
3494
|
setTooltipNode(node);
|
|
3389
3495
|
setShowTooltip(true);
|
|
3390
3496
|
}, selectedNode: selectedNode, onNodeClick: (node) => {
|
|
@@ -3393,12 +3499,12 @@ var drawChart = (function (exports) {
|
|
|
3393
3499
|
};
|
|
3394
3500
|
|
|
3395
3501
|
const Main = () => {
|
|
3396
|
-
const { availableSizeProperties, rawHierarchy, getModuleSize, layout, data } =
|
|
3502
|
+
const { availableSizeProperties, rawHierarchy, getModuleSize, layout, data } = x(StaticContext);
|
|
3397
3503
|
const [sizeProperty, setSizeProperty] = h(availableSizeProperties[0]);
|
|
3398
3504
|
const [selectedNode, setSelectedNode] = h(undefined);
|
|
3399
3505
|
const { getModuleFilterMultiplier, setExcludeFilter, setIncludeFilter } = useFilter();
|
|
3400
3506
|
console.time("getNodeSizeMultiplier");
|
|
3401
|
-
const getNodeSizeMultiplier =
|
|
3507
|
+
const getNodeSizeMultiplier = T(() => {
|
|
3402
3508
|
const selectedMultiplier = 1; // selectedSize < rootSize * increaseFactor ? (rootSize * increaseFactor) / selectedSize : rootSize / selectedSize;
|
|
3403
3509
|
const nonSelectedMultiplier = 0; // 1 / selectedMultiplier
|
|
3404
3510
|
if (selectedNode === undefined) {
|
|
@@ -3425,14 +3531,15 @@ var drawChart = (function (exports) {
|
|
|
3425
3531
|
console.timeEnd("getNodeSizeMultiplier");
|
|
3426
3532
|
console.time("root hierarchy compute");
|
|
3427
3533
|
// root here always be the same as rawHierarchy even after layouting
|
|
3428
|
-
const root =
|
|
3534
|
+
const root = T(() => {
|
|
3429
3535
|
const rootWithSizesAndSorted = rawHierarchy
|
|
3430
3536
|
.sum((node) => {
|
|
3431
3537
|
var _a;
|
|
3432
3538
|
if (isModuleTree(node))
|
|
3433
3539
|
return 0;
|
|
3434
3540
|
const meta = data.nodeMetas[data.nodeParts[node.uid].metaUid];
|
|
3435
|
-
|
|
3541
|
+
/* eslint-disable typescript/no-non-null-asserted-optional-chain typescript/no-extra-non-null-assertion */
|
|
3542
|
+
const bundleId = (_a = Object.entries(meta.moduleParts).find(([, uid]) => uid == node.uid)) === null || _a === void 0 ? void 0 : _a[0];
|
|
3436
3543
|
const ownSize = getModuleSize(node, sizeProperty);
|
|
3437
3544
|
const zoomMultiplier = getNodeSizeMultiplier(node);
|
|
3438
3545
|
const filterMultiplier = getModuleFilterMultiplier(bundleId, meta);
|
|
@@ -3450,7 +3557,7 @@ var drawChart = (function (exports) {
|
|
|
3450
3557
|
sizeProperty,
|
|
3451
3558
|
]);
|
|
3452
3559
|
console.timeEnd("root hierarchy compute");
|
|
3453
|
-
return (u$1(
|
|
3560
|
+
return (u$1(k$1, { children: [u$1(SideBar, { sizeProperty: sizeProperty, availableSizeProperties: availableSizeProperties, setSizeProperty: setSizeProperty, onExcludeChange: setExcludeFilter, onIncludeChange: setIncludeFilter }), u$1(Chart, { root: root, sizeProperty: sizeProperty, selectedNode: selectedNode, setSelectedNode: setSelectedNode })] }));
|
|
3454
3561
|
};
|
|
3455
3562
|
|
|
3456
3563
|
function initRange(domain, range) {
|
|
@@ -4136,7 +4243,7 @@ var drawChart = (function (exports) {
|
|
|
4136
4243
|
}
|
|
4137
4244
|
|
|
4138
4245
|
return function(x) {
|
|
4139
|
-
var i =
|
|
4246
|
+
var i = bisectRight(domain, x, 1, j) - 1;
|
|
4140
4247
|
return r[i](d[i](x));
|
|
4141
4248
|
};
|
|
4142
4249
|
}
|
|
@@ -4752,7 +4859,7 @@ var drawChart = (function (exports) {
|
|
|
4752
4859
|
};
|
|
4753
4860
|
};
|
|
4754
4861
|
|
|
4755
|
-
const StaticContext =
|
|
4862
|
+
const StaticContext = J({});
|
|
4756
4863
|
const drawChart = (parentNode, data, width, height) => {
|
|
4757
4864
|
const availableSizeProperties = getAvailableSizeOptions(data.options);
|
|
4758
4865
|
console.time("layout create");
|
|
@@ -4796,7 +4903,7 @@ var drawChart = (function (exports) {
|
|
|
4796
4903
|
console.time("color");
|
|
4797
4904
|
const getModuleColor = createRainbowColor(rawHierarchy);
|
|
4798
4905
|
console.timeEnd("color");
|
|
4799
|
-
|
|
4906
|
+
D$1(u$1(StaticContext.Provider, { value: {
|
|
4800
4907
|
data,
|
|
4801
4908
|
availableSizeProperties,
|
|
4802
4909
|
width,
|
|
@@ -4822,7 +4929,7 @@ var drawChart = (function (exports) {
|
|
|
4822
4929
|
</script>
|
|
4823
4930
|
<script>
|
|
4824
4931
|
/*<!--*/
|
|
4825
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"rollup-builder.min.mjs","children":[{"name":"src","children":[{"uid":"
|
|
4932
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"rollup-builder.min.mjs","children":[{"name":"src","children":[{"uid":"1fea21cd-1","name":"get-rollup-external.mjs"},{"uid":"1fea21cd-3","name":"get-rollup-output.mjs"},{"name":"plugins","children":[{"uid":"1fea21cd-5","name":"config-alias-plugin.mjs"},{"uid":"1fea21cd-7","name":"config-node-resolve-plugin.mjs"},{"uid":"1fea21cd-9","name":"config-common-js-plugin.mjs"},{"uid":"1fea21cd-11","name":"config-babel-plugin.mjs"},{"uid":"1fea21cd-13","name":"config-terser-plugin.mjs"},{"uid":"1fea21cd-15","name":"config-analyzer-plugin.mjs"},{"uid":"1fea21cd-17","name":"config-visualizer-plugin.mjs"}]},{"uid":"1fea21cd-19","name":"get-rollup-plugins.mjs"},{"uid":"1fea21cd-21","name":"get-rollup-on-warn.mjs"},{"uid":"1fea21cd-23","name":"rollup-builder.mjs"},{"uid":"1fea21cd-25","name":"index.mjs"}]}]}],"isRoot":true},"nodeParts":{"1fea21cd-1":{"renderedLength":3339,"gzipLength":1387,"brotliLength":1204,"metaUid":"1fea21cd-0"},"1fea21cd-3":{"renderedLength":5356,"gzipLength":1683,"brotliLength":1438,"metaUid":"1fea21cd-2"},"1fea21cd-5":{"renderedLength":1660,"gzipLength":651,"brotliLength":564,"metaUid":"1fea21cd-4"},"1fea21cd-7":{"renderedLength":1590,"gzipLength":598,"brotliLength":480,"metaUid":"1fea21cd-6"},"1fea21cd-9":{"renderedLength":1919,"gzipLength":750,"brotliLength":627,"metaUid":"1fea21cd-8"},"1fea21cd-11":{"renderedLength":1788,"gzipLength":718,"brotliLength":630,"metaUid":"1fea21cd-10"},"1fea21cd-13":{"renderedLength":1882,"gzipLength":723,"brotliLength":615,"metaUid":"1fea21cd-12"},"1fea21cd-15":{"renderedLength":1642,"gzipLength":650,"brotliLength":521,"metaUid":"1fea21cd-14"},"1fea21cd-17":{"renderedLength":1852,"gzipLength":690,"brotliLength":594,"metaUid":"1fea21cd-16"},"1fea21cd-19":{"renderedLength":1088,"gzipLength":403,"brotliLength":326,"metaUid":"1fea21cd-18"},"1fea21cd-21":{"renderedLength":691,"gzipLength":317,"brotliLength":264,"metaUid":"1fea21cd-20"},"1fea21cd-23":{"renderedLength":9693,"gzipLength":3020,"brotliLength":2591,"metaUid":"1fea21cd-22"},"1fea21cd-25":{"renderedLength":264,"gzipLength":101,"brotliLength":98,"metaUid":"1fea21cd-24"}},"nodeMetas":{"1fea21cd-0":{"id":"/src/get-rollup-external.mjs","moduleParts":{"rollup-builder.min.mjs":"1fea21cd-1"},"imported":[{"uid":"1fea21cd-27"},{"uid":"1fea21cd-28"}],"importedBy":[{"uid":"1fea21cd-22"}]},"1fea21cd-2":{"id":"/src/get-rollup-output.mjs","moduleParts":{"rollup-builder.min.mjs":"1fea21cd-3"},"imported":[],"importedBy":[{"uid":"1fea21cd-22"}]},"1fea21cd-4":{"id":"/src/plugins/config-alias-plugin.mjs","moduleParts":{"rollup-builder.min.mjs":"1fea21cd-5"},"imported":[{"uid":"1fea21cd-30"},{"uid":"1fea21cd-31"}],"importedBy":[{"uid":"1fea21cd-18"}]},"1fea21cd-6":{"id":"/src/plugins/config-node-resolve-plugin.mjs","moduleParts":{"rollup-builder.min.mjs":"1fea21cd-7"},"imported":[{"uid":"1fea21cd-32"}],"importedBy":[{"uid":"1fea21cd-18"}]},"1fea21cd-8":{"id":"/src/plugins/config-common-js-plugin.mjs","moduleParts":{"rollup-builder.min.mjs":"1fea21cd-9"},"imported":[{"uid":"1fea21cd-33"}],"importedBy":[{"uid":"1fea21cd-18"}]},"1fea21cd-10":{"id":"/src/plugins/config-babel-plugin.mjs","moduleParts":{"rollup-builder.min.mjs":"1fea21cd-11"},"imported":[{"uid":"1fea21cd-34"}],"importedBy":[{"uid":"1fea21cd-18"}]},"1fea21cd-12":{"id":"/src/plugins/config-terser-plugin.mjs","moduleParts":{"rollup-builder.min.mjs":"1fea21cd-13"},"imported":[{"uid":"1fea21cd-35"}],"importedBy":[{"uid":"1fea21cd-18"}]},"1fea21cd-14":{"id":"/src/plugins/config-analyzer-plugin.mjs","moduleParts":{"rollup-builder.min.mjs":"1fea21cd-15"},"imported":[{"uid":"1fea21cd-36"}],"importedBy":[{"uid":"1fea21cd-18"}]},"1fea21cd-16":{"id":"/src/plugins/config-visualizer-plugin.mjs","moduleParts":{"rollup-builder.min.mjs":"1fea21cd-17"},"imported":[{"uid":"1fea21cd-37"}],"importedBy":[{"uid":"1fea21cd-18"}]},"1fea21cd-18":{"id":"/src/get-rollup-plugins.mjs","moduleParts":{"rollup-builder.min.mjs":"1fea21cd-19"},"imported":[{"uid":"1fea21cd-27"},{"uid":"1fea21cd-29"},{"uid":"1fea21cd-4"},{"uid":"1fea21cd-6"},{"uid":"1fea21cd-8"},{"uid":"1fea21cd-10"},{"uid":"1fea21cd-12"},{"uid":"1fea21cd-14"},{"uid":"1fea21cd-16"}],"importedBy":[{"uid":"1fea21cd-22"}]},"1fea21cd-20":{"id":"/src/get-rollup-on-warn.mjs","moduleParts":{"rollup-builder.min.mjs":"1fea21cd-21"},"imported":[],"importedBy":[{"uid":"1fea21cd-22"}]},"1fea21cd-22":{"id":"/src/rollup-builder.mjs","moduleParts":{"rollup-builder.min.mjs":"1fea21cd-23"},"imported":[{"uid":"1fea21cd-26"},{"uid":"1fea21cd-0"},{"uid":"1fea21cd-2"},{"uid":"1fea21cd-18"},{"uid":"1fea21cd-20"}],"importedBy":[{"uid":"1fea21cd-24"}]},"1fea21cd-24":{"id":"/src/index.mjs","moduleParts":{"rollup-builder.min.mjs":"1fea21cd-25"},"imported":[{"uid":"1fea21cd-22"}],"importedBy":[],"isEntry":true},"1fea21cd-26":{"id":"@babel/runtime/helpers/defineProperty","moduleParts":{},"imported":[],"importedBy":[{"uid":"1fea21cd-22"}],"isExternal":true},"1fea21cd-27":{"id":"@babel/runtime/helpers/toConsumableArray","moduleParts":{},"imported":[],"importedBy":[{"uid":"1fea21cd-0"},{"uid":"1fea21cd-18"}],"isExternal":true},"1fea21cd-28":{"id":"node:module","moduleParts":{},"imported":[],"importedBy":[{"uid":"1fea21cd-0"}],"isExternal":true},"1fea21cd-29":{"id":"@rollup/plugin-json","moduleParts":{},"imported":[],"importedBy":[{"uid":"1fea21cd-18"}],"isExternal":true},"1fea21cd-30":{"id":"node:url","moduleParts":{},"imported":[],"importedBy":[{"uid":"1fea21cd-4"}],"isExternal":true},"1fea21cd-31":{"id":"@rollup/plugin-alias","moduleParts":{},"imported":[],"importedBy":[{"uid":"1fea21cd-4"}],"isExternal":true},"1fea21cd-32":{"id":"@rollup/plugin-node-resolve","moduleParts":{},"imported":[],"importedBy":[{"uid":"1fea21cd-6"}],"isExternal":true},"1fea21cd-33":{"id":"@rollup/plugin-commonjs","moduleParts":{},"imported":[],"importedBy":[{"uid":"1fea21cd-8"}],"isExternal":true},"1fea21cd-34":{"id":"@rollup/plugin-babel","moduleParts":{},"imported":[],"importedBy":[{"uid":"1fea21cd-10"}],"isExternal":true},"1fea21cd-35":{"id":"@rollup/plugin-terser","moduleParts":{},"imported":[],"importedBy":[{"uid":"1fea21cd-12"}],"isExternal":true},"1fea21cd-36":{"id":"rollup-plugin-analyzer","moduleParts":{},"imported":[],"importedBy":[{"uid":"1fea21cd-14"}],"isExternal":true},"1fea21cd-37":{"id":"rollup-plugin-visualizer","moduleParts":{},"imported":[],"importedBy":[{"uid":"1fea21cd-16"}],"isExternal":true}},"env":{"rollup":"4.29.1"},"options":{"gzip":true,"brotli":true,"sourcemap":false}};
|
|
4826
4933
|
|
|
4827
4934
|
const run = () => {
|
|
4828
4935
|
const width = window.innerWidth;
|