@modern-js/utils
Version:
A Progressive React Framework for modern web development.
1,256 lines • 78.8 kB
JavaScript
(()=>{
var t = {
155: (t)=>{
"use strict";
t.exports = balanced;
function balanced(t, e, r) {
if (t instanceof RegExp) t = maybeMatch(t, r);
if (e instanceof RegExp) e = maybeMatch(e, r);
var i = range(t, e, r);
return i && {
start: i[0],
end: i[1],
pre: r.slice(0, i[0]),
body: r.slice(i[0] + t.length, i[1]),
post: r.slice(i[1] + e.length)
};
}
function maybeMatch(t, e) {
var r = e.match(t);
return r ? r[0] : null;
}
balanced.range = range;
function range(t, e, r) {
var i, a, n, s, o;
var c = r.indexOf(t);
var h = r.indexOf(e, c + 1);
var l = c;
if (c >= 0 && h > 0) {
if (t === e) return [
c,
h
];
i = [];
n = r.length;
while(l >= 0 && !o){
if (l == c) {
i.push(l);
c = r.indexOf(t, l + 1);
} else if (1 == i.length) o = [
i.pop(),
h
];
else {
a = i.pop();
if (a < n) {
n = a;
s = h;
}
h = r.indexOf(e, l + 1);
}
l = c < h && c >= 0 ? c : h;
}
if (i.length) o = [
n,
s
];
}
return o;
}
},
847: (t, e, r)=>{
var i = r(62);
var a = r(155);
t.exports = expandTop;
var n = "\0SLASH" + Math.random() + "\0";
var s = "\0OPEN" + Math.random() + "\0";
var o = "\0CLOSE" + Math.random() + "\0";
var c = "\0COMMA" + Math.random() + "\0";
var h = "\0PERIOD" + Math.random() + "\0";
function numeric(t) {
return parseInt(t, 10) == t ? parseInt(t, 10) : t.charCodeAt(0);
}
function escapeBraces(t) {
return t.split("\\\\").join(n).split("\\{").join(s).split("\\}").join(o).split("\\,").join(c).split("\\.").join(h);
}
function unescapeBraces(t) {
return t.split(n).join("\\").split(s).join("{").split(o).join("}").split(c).join(",").split(h).join(".");
}
function parseCommaParts(t) {
if (!t) return [
""
];
var e = [];
var r = a("{", "}", t);
if (!r) return t.split(",");
var i = r.pre;
var n = r.body;
var s = r.post;
var o = i.split(",");
o[o.length - 1] += "{" + n + "}";
var c = parseCommaParts(s);
if (s.length) {
o[o.length - 1] += c.shift();
o.push.apply(o, c);
}
e.push.apply(e, o);
return e;
}
function expandTop(t) {
if (!t) return [];
if ("{}" === t.substr(0, 2)) t = "\\{\\}" + t.substr(2);
return expand(escapeBraces(t), true).map(unescapeBraces);
}
function embrace(t) {
return "{" + t + "}";
}
function isPadded(t) {
return /^-?0\d/.test(t);
}
function lte(t, e) {
return t <= e;
}
function gte(t, e) {
return t >= e;
}
function expand(t, e) {
var r = [];
var n = a("{", "}", t);
if (!n || /\$$/.test(n.pre)) return [
t
];
var s = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body);
var c = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body);
var h = s || c;
var l = n.body.indexOf(",") >= 0;
if (!h && !l) {
if (n.post.match(/,.*\}/)) {
t = n.pre + "{" + n.body + o + n.post;
return expand(t);
}
return [
t
];
}
var u;
if (h) u = n.body.split(/\.\./);
else {
u = parseCommaParts(n.body);
if (1 === u.length) {
u = expand(u[0], false).map(embrace);
if (1 === u.length) {
var p = n.post.length ? expand(n.post, false) : [
""
];
return p.map(function(t) {
return n.pre + u[0] + t;
});
}
}
}
var v = n.pre;
var p = n.post.length ? expand(n.post, false) : [
""
];
var d;
if (h) {
var m = numeric(u[0]);
var b = numeric(u[1]);
var g = Math.max(u[0].length, u[1].length);
var y = 3 == u.length ? Math.abs(numeric(u[2])) : 1;
var _ = lte;
var w = b < m;
if (w) {
y *= -1;
_ = gte;
}
var k = u.some(isPadded);
d = [];
for(var S = m; _(S, b); S += y){
var E;
if (c) {
E = String.fromCharCode(S);
if ("\\" === E) E = "";
} else {
E = String(S);
if (k) {
var x = g - E.length;
if (x > 0) {
var O = new Array(x + 1).join("0");
E = S < 0 ? "-" + O + E.slice(1) : O + E;
}
}
}
d.push(E);
}
} else d = i(u, function(t) {
return expand(t, false);
});
for(var A = 0; A < d.length; A++)for(var G = 0; G < p.length; G++){
var j = v + d[A] + p[G];
if (!e || h || j) r.push(j);
}
return r;
}
},
62: (t)=>{
t.exports = function(t, r) {
var i = [];
for(var a = 0; a < t.length; a++){
var n = r(t[a], a);
if (e(n)) i.push.apply(i, n);
else i.push(n);
}
return i;
};
var e = Array.isArray || function(t) {
return "[object Array]" === Object.prototype.toString.call(t);
};
},
737: (t, e, r)=>{
t.exports = realpath;
realpath.realpath = realpath;
realpath.sync = realpathSync;
realpath.realpathSync = realpathSync;
realpath.monkeypatch = monkeypatch;
realpath.unmonkeypatch = unmonkeypatch;
var i = r(147);
var a = i.realpath;
var n = i.realpathSync;
var s = process.version;
var o = /^v[0-5]\./.test(s);
var c = r(613);
function newError(t) {
return t && "realpath" === t.syscall && ("ELOOP" === t.code || "ENOMEM" === t.code || "ENAMETOOLONG" === t.code);
}
function realpath(t, e, r) {
if (o) return a(t, e, r);
if ("function" == typeof e) {
r = e;
e = null;
}
a(t, e, function(i, a) {
if (newError(i)) c.realpath(t, e, r);
else r(i, a);
});
}
function realpathSync(t, e) {
if (o) return n(t, e);
try {
return n(t, e);
} catch (r) {
if (newError(r)) return c.realpathSync(t, e);
throw r;
}
}
function monkeypatch() {
i.realpath = realpath;
i.realpathSync = realpathSync;
}
function unmonkeypatch() {
i.realpath = a;
i.realpathSync = n;
}
},
613: (t, e, r)=>{
var i = r(17);
var a = "win32" === process.platform;
var n = r(147);
var s = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
function rethrow() {
var t;
if (s) {
var e = new Error;
t = debugCallback;
} else t = missingCallback;
return t;
function debugCallback(t) {
if (t) {
e.message = t.message;
t = e;
missingCallback(t);
}
}
function missingCallback(t) {
if (t) {
if (process.throwDeprecation) throw t;
else if (!process.noDeprecation) {
var e = "fs: missing callback " + (t.stack || t.message);
if (process.traceDeprecation) console.trace(e);
else console.error(e);
}
}
}
}
function maybeCallback(t) {
return "function" == typeof t ? t : rethrow();
}
i.normalize;
if (a) var c = /(.*?)(?:[\/\\]+|$)/g;
else var c = /(.*?)(?:[\/]+|$)/g;
if (a) var h = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
else var h = /^[\/]*/;
e.realpathSync = function(t, e) {
t = i.resolve(t);
if (e && Object.prototype.hasOwnProperty.call(e, t)) return e[t];
var r = t, s = {}, o = {};
var l;
var u;
var p;
var v;
start();
function start() {
var e = h.exec(t);
l = e[0].length;
u = e[0];
p = e[0];
v = "";
if (a && !o[p]) {
n.lstatSync(p);
o[p] = true;
}
}
while(l < t.length){
c.lastIndex = l;
var d = c.exec(t);
v = u;
u += d[0];
p = v + d[1];
l = c.lastIndex;
if (o[p] || e && e[p] === p) continue;
var m;
if (e && Object.prototype.hasOwnProperty.call(e, p)) m = e[p];
else {
var b = n.lstatSync(p);
if (!b.isSymbolicLink()) {
o[p] = true;
if (e) e[p] = p;
continue;
}
var g = null;
if (!a) {
var y = b.dev.toString(32) + ":" + b.ino.toString(32);
if (s.hasOwnProperty(y)) g = s[y];
}
if (null === g) {
n.statSync(p);
g = n.readlinkSync(p);
}
m = i.resolve(v, g);
if (e) e[p] = m;
if (!a) s[y] = g;
}
t = i.resolve(m, t.slice(l));
start();
}
if (e) e[r] = t;
return t;
};
e.realpath = function(t, e, r) {
if ("function" != typeof r) {
r = maybeCallback(e);
e = null;
}
t = i.resolve(t);
if (e && Object.prototype.hasOwnProperty.call(e, t)) return process.nextTick(r.bind(null, null, e[t]));
var s = t, o = {}, l = {};
var u;
var p;
var v;
var d;
start();
function start() {
var e = h.exec(t);
u = e[0].length;
p = e[0];
v = e[0];
d = "";
if (a && !l[v]) n.lstat(v, function(t) {
if (t) return r(t);
l[v] = true;
LOOP();
});
else process.nextTick(LOOP);
}
function LOOP() {
if (u >= t.length) {
if (e) e[s] = t;
return r(null, t);
}
c.lastIndex = u;
var i = c.exec(t);
d = p;
p += i[0];
v = d + i[1];
u = c.lastIndex;
if (l[v] || e && e[v] === v) return process.nextTick(LOOP);
if (e && Object.prototype.hasOwnProperty.call(e, v)) return gotResolvedLink(e[v]);
return n.lstat(v, gotStat);
}
function gotStat(t, i) {
if (t) return r(t);
if (!i.isSymbolicLink()) {
l[v] = true;
if (e) e[v] = v;
return process.nextTick(LOOP);
}
if (!a) {
var s = i.dev.toString(32) + ":" + i.ino.toString(32);
if (o.hasOwnProperty(s)) return gotTarget(null, o[s], v);
}
n.stat(v, function(t) {
if (t) return r(t);
n.readlink(v, function(t, e) {
if (!a) o[s] = e;
gotTarget(t, e);
});
});
}
function gotTarget(t, a, n) {
if (t) return r(t);
var s = i.resolve(d, a);
if (e) e[n] = s;
gotResolvedLink(s);
}
function gotResolvedLink(e) {
t = i.resolve(e, t.slice(u));
start();
}
};
},
875: (t, e, r)=>{
e.setopts = setopts;
e.ownProp = ownProp;
e.makeAbs = makeAbs;
e.finish = finish;
e.mark = mark;
e.isIgnored = isIgnored;
e.childrenIgnored = childrenIgnored;
function ownProp(t, e) {
return Object.prototype.hasOwnProperty.call(t, e);
}
var i = r(147);
var a = r(17);
var n = r(235);
var s = r(249);
var o = n.Minimatch;
function alphasort(t, e) {
return t.localeCompare(e, "en");
}
function setupIgnores(t, e) {
t.ignore = e.ignore || [];
if (!Array.isArray(t.ignore)) t.ignore = [
t.ignore
];
if (t.ignore.length) t.ignore = t.ignore.map(ignoreMap);
}
function ignoreMap(t) {
var e = null;
if ("/**" === t.slice(-3)) {
var r = t.replace(/(\/\*\*)+$/, "");
e = new o(r, {
dot: true
});
}
return {
matcher: new o(t, {
dot: true
}),
gmatcher: e
};
}
function setopts(t, e, r) {
if (!r) r = {};
if (r.matchBase && -1 === e.indexOf("/")) {
if (r.noglobstar) throw new Error("base matching requires globstar");
e = "**/" + e;
}
t.silent = !!r.silent;
t.pattern = e;
t.strict = false !== r.strict;
t.realpath = !!r.realpath;
t.realpathCache = r.realpathCache || Object.create(null);
t.follow = !!r.follow;
t.dot = !!r.dot;
t.mark = !!r.mark;
t.nodir = !!r.nodir;
if (t.nodir) t.mark = true;
t.sync = !!r.sync;
t.nounique = !!r.nounique;
t.nonull = !!r.nonull;
t.nosort = !!r.nosort;
t.nocase = !!r.nocase;
t.stat = !!r.stat;
t.noprocess = !!r.noprocess;
t.absolute = !!r.absolute;
t.fs = r.fs || i;
t.maxLength = r.maxLength || 1 / 0;
t.cache = r.cache || Object.create(null);
t.statCache = r.statCache || Object.create(null);
t.symlinks = r.symlinks || Object.create(null);
setupIgnores(t, r);
t.changedCwd = false;
var n = process.cwd();
if (ownProp(r, "cwd")) {
t.cwd = a.resolve(r.cwd);
t.changedCwd = t.cwd !== n;
} else t.cwd = n;
t.root = r.root || a.resolve(t.cwd, "/");
t.root = a.resolve(t.root);
if ("win32" === process.platform) t.root = t.root.replace(/\\/g, "/");
t.cwdAbs = s(t.cwd) ? t.cwd : makeAbs(t, t.cwd);
if ("win32" === process.platform) t.cwdAbs = t.cwdAbs.replace(/\\/g, "/");
t.nomount = !!r.nomount;
r.nonegate = true;
r.nocomment = true;
t.minimatch = new o(e, r);
t.options = t.minimatch.options;
}
function finish(t) {
var e = t.nounique;
var r = e ? [] : Object.create(null);
for(var i = 0, a = t.matches.length; i < a; i++){
var n = t.matches[i];
if (n && 0 !== Object.keys(n).length) {
var o = Object.keys(n);
if (e) r.push.apply(r, o);
else o.forEach(function(t) {
r[t] = true;
});
} else if (t.nonull) {
var s = t.minimatch.globSet[i];
if (e) r.push(s);
else r[s] = true;
}
}
if (!e) r = Object.keys(r);
if (!t.nosort) r = r.sort(alphasort);
if (t.mark) {
for(var i = 0; i < r.length; i++)r[i] = t._mark(r[i]);
if (t.nodir) r = r.filter(function(e) {
var r = !/\/$/.test(e);
var i = t.cache[e] || t.cache[makeAbs(t, e)];
if (r && i) r = "DIR" !== i && !Array.isArray(i);
return r;
});
}
if (t.ignore.length) r = r.filter(function(e) {
return !isIgnored(t, e);
});
t.found = r;
}
function mark(t, e) {
var r = makeAbs(t, e);
var i = t.cache[r];
var a = e;
if (i) {
var n = "DIR" === i || Array.isArray(i);
var s = "/" === e.slice(-1);
if (n && !s) a += "/";
else if (!n && s) a = a.slice(0, -1);
if (a !== e) {
var o = makeAbs(t, a);
t.statCache[o] = t.statCache[r];
t.cache[o] = t.cache[r];
}
}
return a;
}
function makeAbs(t, e) {
var r = e;
r = "/" === e.charAt(0) ? a.join(t.root, e) : s(e) || "" === e ? e : t.changedCwd ? a.resolve(t.cwd, e) : a.resolve(e);
if ("win32" === process.platform) r = r.replace(/\\/g, "/");
return r;
}
function isIgnored(t, e) {
if (!t.ignore.length) return false;
return t.ignore.some(function(t) {
return t.matcher.match(e) || !!(t.gmatcher && t.gmatcher.match(e));
});
}
function childrenIgnored(t, e) {
if (!t.ignore.length) return false;
return t.ignore.some(function(t) {
return !!(t.gmatcher && t.gmatcher.match(e));
});
}
},
978: (t, e, r)=>{
t.exports = glob;
var i = r(737);
var a = r(235);
a.Minimatch;
var s = r(315);
var o = r(361).EventEmitter;
var c = r(17);
var h = r(491);
var l = r(249);
var u = r(19);
var p = r(875);
var v = p.setopts;
var d = p.ownProp;
var m = r(900);
r(837);
var g = p.childrenIgnored;
var y = p.isIgnored;
var _ = r(556);
function glob(t, e, r) {
if ("function" == typeof e) r = e, e = {};
if (!e) e = {};
if (e.sync) {
if (r) throw new TypeError("callback provided to sync glob");
return u(t, e);
}
return new Glob(t, e, r);
}
glob.sync = u;
var w = glob.GlobSync = u.GlobSync;
glob.glob = glob;
function extend(t, e) {
if (null === e || "object" != typeof e) return t;
var r = Object.keys(e);
var i = r.length;
while(i--)t[r[i]] = e[r[i]];
return t;
}
glob.hasMagic = function(t, e) {
var r = extend({}, e);
r.noprocess = true;
var i = new Glob(t, r);
var a = i.minimatch.set;
if (!t) return false;
if (a.length > 1) return true;
for(var n = 0; n < a[0].length; n++)if ("string" != typeof a[0][n]) return true;
return false;
};
glob.Glob = Glob;
s(Glob, o);
function Glob(t, e, r) {
if ("function" == typeof e) {
r = e;
e = null;
}
if (e && e.sync) {
if (r) throw new TypeError("callback provided to sync glob");
return new w(t, e);
}
if (!(this instanceof Glob)) return new Glob(t, e, r);
v(this, t, e);
this._didRealPath = false;
var i = this.minimatch.set.length;
this.matches = new Array(i);
if ("function" == typeof r) {
r = _(r);
this.on("error", r);
this.on("end", function(t) {
r(null, t);
});
}
var a = this;
this._processing = 0;
this._emitQueue = [];
this._processQueue = [];
this.paused = false;
if (this.noprocess) return this;
if (0 === i) return done();
var n = true;
for(var s = 0; s < i; s++)this._process(this.minimatch.set[s], s, false, done);
n = false;
function done() {
--a._processing;
if (a._processing <= 0) if (n) process.nextTick(function() {
a._finish();
});
else a._finish();
}
}
Glob.prototype._finish = function() {
h(this instanceof Glob);
if (this.aborted) return;
if (this.realpath && !this._didRealpath) return this._realpath();
p.finish(this);
this.emit("end", this.found);
};
Glob.prototype._realpath = function() {
if (this._didRealpath) return;
this._didRealpath = true;
var t = this.matches.length;
if (0 === t) return this._finish();
var e = this;
for(var r = 0; r < this.matches.length; r++)this._realpathSet(r, next);
function next() {
if (0 === --t) e._finish();
}
};
Glob.prototype._realpathSet = function(t, e) {
var r = this.matches[t];
if (!r) return e();
var a = Object.keys(r);
var n = this;
var s = a.length;
if (0 === s) return e();
var o = this.matches[t] = Object.create(null);
a.forEach(function(r, a) {
r = n._makeAbs(r);
i.realpath(r, n.realpathCache, function(i, a) {
if (i) if ("stat" === i.syscall) o[r] = true;
else n.emit("error", i);
else o[a] = true;
if (0 === --s) {
n.matches[t] = o;
e();
}
});
});
};
Glob.prototype._mark = function(t) {
return p.mark(this, t);
};
Glob.prototype._makeAbs = function(t) {
return p.makeAbs(this, t);
};
Glob.prototype.abort = function() {
this.aborted = true;
this.emit("abort");
};
Glob.prototype.pause = function() {
if (!this.paused) {
this.paused = true;
this.emit("pause");
}
};
Glob.prototype.resume = function() {
if (this.paused) {
this.emit("resume");
this.paused = false;
if (this._emitQueue.length) {
var t = this._emitQueue.slice(0);
this._emitQueue.length = 0;
for(var e = 0; e < t.length; e++){
var r = t[e];
this._emitMatch(r[0], r[1]);
}
}
if (this._processQueue.length) {
var i = this._processQueue.slice(0);
this._processQueue.length = 0;
for(var e = 0; e < i.length; e++){
var a = i[e];
this._processing--;
this._process(a[0], a[1], a[2], a[3]);
}
}
}
};
Glob.prototype._process = function(t, e, r, i) {
h(this instanceof Glob);
h("function" == typeof i);
if (this.aborted) return;
this._processing++;
if (this.paused) return void this._processQueue.push([
t,
e,
r,
i
]);
var n = 0;
while("string" == typeof t[n])n++;
var s;
switch(n){
case t.length:
this._processSimple(t.join("/"), e, i);
return;
case 0:
s = null;
break;
default:
s = t.slice(0, n).join("/");
break;
}
var o = t.slice(n);
var c;
if (null === s) c = ".";
else if (l(s) || l(t.join("/"))) {
if (!s || !l(s)) s = "/" + s;
c = s;
} else c = s;
var u = this._makeAbs(c);
if (g(this, c)) return i();
var p = o[0] === a.GLOBSTAR;
if (p) this._processGlobStar(s, c, u, o, e, r, i);
else this._processReaddir(s, c, u, o, e, r, i);
};
Glob.prototype._processReaddir = function(t, e, r, i, a, n, s) {
var o = this;
this._readdir(r, n, function(c, h) {
return o._processReaddir2(t, e, r, i, a, n, h, s);
});
};
Glob.prototype._processReaddir2 = function(t, e, r, i, a, n, s, o) {
if (!s) return o();
var h = i[0];
var l = !!this.minimatch.negate;
var u = h._glob;
var p = this.dot || "." === u.charAt(0);
var v = [];
for(var d = 0; d < s.length; d++){
var m = s[d];
if ("." !== m.charAt(0) || p) {
var b;
b = l && !t ? !m.match(h) : m.match(h);
if (b) v.push(m);
}
}
var g = v.length;
if (0 === g) return o();
if (1 === i.length && !this.mark && !this.stat) {
if (!this.matches[a]) this.matches[a] = Object.create(null);
for(var d = 0; d < g; d++){
var m = v[d];
if (t) m = "/" !== t ? t + "/" + m : t + m;
if ("/" === m.charAt(0) && !this.nomount) m = c.join(this.root, m);
this._emitMatch(a, m);
}
return o();
}
i.shift();
for(var d = 0; d < g; d++){
var m = v[d];
if (t) m = "/" !== t ? t + "/" + m : t + m;
this._process([
m
].concat(i), a, n, o);
}
o();
};
Glob.prototype._emitMatch = function(t, e) {
if (this.aborted) return;
if (y(this, e)) return;
if (this.paused) return void this._emitQueue.push([
t,
e
]);
var r = l(e) ? e : this._makeAbs(e);
if (this.mark) e = this._mark(e);
if (this.absolute) e = r;
if (this.matches[t][e]) return;
if (this.nodir) {
var i = this.cache[r];
if ("DIR" === i || Array.isArray(i)) return;
}
this.matches[t][e] = true;
var a = this.statCache[r];
if (a) this.emit("stat", e, a);
this.emit("match", e);
};
Glob.prototype._readdirInGlobStar = function(t, e) {
if (this.aborted) return;
if (this.follow) return this._readdir(t, false, e);
var r = "lstat\0" + t;
var i = this;
var a = m(r, lstatcb_);
if (a) i.fs.lstat(t, a);
function lstatcb_(r, a) {
if (r && "ENOENT" === r.code) return e();
var n = a && a.isSymbolicLink();
i.symlinks[t] = n;
if (n || !a || a.isDirectory()) i._readdir(t, false, e);
else {
i.cache[t] = "FILE";
e();
}
}
};
Glob.prototype._readdir = function(t, e, r) {
if (this.aborted) return;
r = m("readdir\0" + t + "\0" + e, r);
if (!r) return;
if (e && !d(this.symlinks, t)) return this._readdirInGlobStar(t, r);
if (d(this.cache, t)) {
var i = this.cache[t];
if (!i || "FILE" === i) return r();
if (Array.isArray(i)) return r(null, i);
}
var a = this;
a.fs.readdir(t, readdirCb(this, t, r));
};
function readdirCb(t, e, r) {
return function(i, a) {
if (i) t._readdirError(e, i, r);
else t._readdirEntries(e, a, r);
};
}
Glob.prototype._readdirEntries = function(t, e, r) {
if (this.aborted) return;
if (!this.mark && !this.stat) for(var i = 0; i < e.length; i++){
var a = e[i];
a = "/" === t ? t + a : t + "/" + a;
this.cache[a] = true;
}
this.cache[t] = e;
return r(null, e);
};
Glob.prototype._readdirError = function(t, e, r) {
if (this.aborted) return;
switch(e.code){
case "ENOTSUP":
case "ENOTDIR":
var i = this._makeAbs(t);
this.cache[i] = "FILE";
if (i === this.cwdAbs) {
var a = new Error(e.code + " invalid cwd " + this.cwd);
a.path = this.cwd;
a.code = e.code;
this.emit("error", a);
this.abort();
}
break;
case "ENOENT":
case "ELOOP":
case "ENAMETOOLONG":
case "UNKNOWN":
this.cache[this._makeAbs(t)] = false;
break;
default:
this.cache[this._makeAbs(t)] = false;
if (this.strict) {
this.emit("error", e);
this.abort();
}
if (!this.silent) console.error("glob error", e);
break;
}
return r();
};
Glob.prototype._processGlobStar = function(t, e, r, i, a, n, s) {
var o = this;
this._readdir(r, n, function(c, h) {
o._processGlobStar2(t, e, r, i, a, n, h, s);
});
};
Glob.prototype._processGlobStar2 = function(t, e, r, i, a, n, s, o) {
if (!s) return o();
var c = i.slice(1);
var h = t ? [
t
] : [];
var l = h.concat(c);
this._process(l, a, false, o);
var u = this.symlinks[r];
var p = s.length;
if (u && n) return o();
for(var v = 0; v < p; v++){
var d = s[v];
if ("." !== d.charAt(0) || this.dot) {
var m = h.concat(s[v], c);
this._process(m, a, true, o);
var b = h.concat(s[v], i);
this._process(b, a, true, o);
}
}
o();
};
Glob.prototype._processSimple = function(t, e, r) {
var i = this;
this._stat(t, function(a, n) {
i._processSimple2(t, e, a, n, r);
});
};
Glob.prototype._processSimple2 = function(t, e, r, i, a) {
if (!this.matches[e]) this.matches[e] = Object.create(null);
if (!i) return a();
if (t && l(t) && !this.nomount) {
var n = /[\/\\]$/.test(t);
if ("/" === t.charAt(0)) t = c.join(this.root, t);
else {
t = c.resolve(this.root, t);
if (n) t += "/";
}
}
if ("win32" === process.platform) t = t.replace(/\\/g, "/");
this._emitMatch(e, t);
a();
};
Glob.prototype._stat = function(t, e) {
var r = this._makeAbs(t);
var i = "/" === t.slice(-1);
if (t.length > this.maxLength) return e();
if (!this.stat && d(this.cache, r)) {
var a = this.cache[r];
if (Array.isArray(a)) a = "DIR";
if (!i || "DIR" === a) return e(null, a);
if (i && "FILE" === a) return e();
}
var s = this.statCache[r];
if (void 0 !== s) if (false === s) return e(null, s);
else {
var o = s.isDirectory() ? "DIR" : "FILE";
if (i && "FILE" === o) return e();
return e(null, o, s);
}
var c = this;
var h = m("stat\0" + r, lstatcb_);
if (h) c.fs.lstat(r, h);
function lstatcb_(i, a) {
if (a && a.isSymbolicLink()) return c.fs.stat(r, function(i, n) {
if (i) c._stat2(t, r, null, a, e);
else c._stat2(t, r, i, n, e);
});
c._stat2(t, r, i, a, e);
}
};
Glob.prototype._stat2 = function(t, e, r, i, a) {
if (r && ("ENOENT" === r.code || "ENOTDIR" === r.code)) {
this.statCache[e] = false;
return a();
}
var n = "/" === t.slice(-1);
this.statCache[e] = i;
if ("/" === e.slice(-1) && i && !i.isDirectory()) return a(null, false, i);
var s = true;
if (i) s = i.isDirectory() ? "DIR" : "FILE";
this.cache[e] = this.cache[e] || s;
if (n && "FILE" === s) return a();
return a(null, s, i);
};
},
19: (t, e, r)=>{
t.exports = globSync;
globSync.GlobSync = GlobSync;
var i = r(737);
var a = r(235);
a.Minimatch;
r(978).Glob;
r(837);
var c = r(17);
var h = r(491);
var l = r(249);
var u = r(875);
var p = u.setopts;
var v = u.ownProp;
var d = u.childrenIgnored;
var m = u.isIgnored;
function globSync(t, e) {
if ("function" == typeof e || 3 === arguments.length) throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
return new GlobSync(t, e).found;
}
function GlobSync(t, e) {
if (!t) throw new Error("must provide pattern");
if ("function" == typeof e || 3 === arguments.length) throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
if (!(this instanceof GlobSync)) return new GlobSync(t, e);
p(this, t, e);
if (this.noprocess) return this;
var r = this.minimatch.set.length;
this.matches = new Array(r);
for(var i = 0; i < r; i++)this._process(this.minimatch.set[i], i, false);
this._finish();
}
GlobSync.prototype._finish = function() {
h(this instanceof GlobSync);
if (this.realpath) {
var t = this;
this.matches.forEach(function(e, r) {
var a = t.matches[r] = Object.create(null);
for(var n in e)try {
n = t._makeAbs(n);
var s = i.realpathSync(n, t.realpathCache);
a[s] = true;
} catch (e) {
if ("stat" === e.syscall) a[t._makeAbs(n)] = true;
else throw e;
}
});
}
u.finish(this);
};
GlobSync.prototype._process = function(t, e, r) {
h(this instanceof GlobSync);
var i = 0;
while("string" == typeof t[i])i++;
var n;
switch(i){
case t.length:
this._processSimple(t.join("/"), e);
return;
case 0:
n = null;
break;
default:
n = t.slice(0, i).join("/");
break;
}
var s = t.slice(i);
var o;
if (null === n) o = ".";
else if (l(n) || l(t.join("/"))) {
if (!n || !l(n)) n = "/" + n;
o = n;
} else o = n;
var c = this._makeAbs(o);
if (d(this, o)) return;
var u = s[0] === a.GLOBSTAR;
if (u) this._processGlobStar(n, o, c, s, e, r);
else this._processReaddir(n, o, c, s, e, r);
};
GlobSync.prototype._processReaddir = function(t, e, r, i, a, n) {
var s = this._readdir(r, n);
if (!s) return;
var o = i[0];
var h = !!this.minimatch.negate;
var l = o._glob;
var u = this.dot || "." === l.charAt(0);
var p = [];
for(var v = 0; v < s.length; v++){
var d = s[v];
if ("." !== d.charAt(0) || u) {
var m;
m = h && !t ? !d.match(o) : d.match(o);
if (m) p.push(d);
}
}
var b = p.length;
if (0 === b) return;
if (1 === i.length && !this.mark && !this.stat) {
if (!this.matches[a]) this.matches[a] = Object.create(null);
for(var v = 0; v < b; v++){
var d = p[v];
if (t) d = "/" !== t.slice(-1) ? t + "/" + d : t + d;
if ("/" === d.charAt(0) && !this.nomount) d = c.join(this.root, d);
this._emitMatch(a, d);
}
return;
}
i.shift();
for(var v = 0; v < b; v++){
var d = p[v];
var g;
g = t ? [
t,
d
] : [
d
];
this._process(g.concat(i), a, n);
}
};
GlobSync.prototype._emitMatch = function(t, e) {
if (m(this, e)) return;
var r = this._makeAbs(e);
if (this.mark) e = this._mark(e);
if (this.absolute) e = r;
if (this.matches[t][e]) return;
if (this.nodir) {
var i = this.cache[r];
if ("DIR" === i || Array.isArray(i)) return;
}
this.matches[t][e] = true;
if (this.stat) this._stat(e);
};
GlobSync.prototype._readdirInGlobStar = function(t) {
if (this.follow) return this._readdir(t, false);
var e;
var r;
try {
r = this.fs.lstatSync(t);
} catch (t) {
if ("ENOENT" === t.code) return null;
}
var a = r && r.isSymbolicLink();
this.symlinks[t] = a;
if (a || !r || r.isDirectory()) e = this._readdir(t, false);
else this.cache[t] = "FILE";
return e;
};
GlobSync.prototype._readdir = function(t, e) {
if (e && !v(this.symlinks, t)) return this._readdirInGlobStar(t);
if (v(this.cache, t)) {
var i = this.cache[t];
if (!i || "FILE" === i) return null;
if (Array.isArray(i)) return i;
}
try {
return this._readdirEntries(t, this.fs.readdirSync(t));
} catch (e) {
this._readdirError(t, e);
return null;
}
};
GlobSync.prototype._readdirEntries = function(t, e) {
if (!this.mark && !this.stat) for(var r = 0; r < e.length; r++){
var i = e[r];
i = "/" === t ? t + i : t + "/" + i;
this.cache[i] = true;
}
this.cache[t] = e;
return e;
};
GlobSync.prototype._readdirError = function(t, e) {
switch(e.code){
case "ENOTSUP":
case "ENOTDIR":
var r = this._makeAbs(t);
this.cache[r] = "FILE";
if (r === this.cwdAbs) {
var i = new Error(e.code + " invalid cwd " + this.cwd);
i.path = this.cwd;
i.code = e.code;
throw i;
}
break;
case "ENOENT":
case "ELOOP":
case "ENAMETOOLONG":
case "UNKNOWN":
this.cache[this._makeAbs(t)] = false;
break;
default:
this.cache[this._makeAbs(t)] = false;
if (this.strict) throw e;
if (!this.silent) console.error("glob error", e);
break;
}
};
GlobSync.prototype._processGlobStar = function(t, e, r, i, a, n) {
var s = this._readdir(r, n);
if (!s) return;
var o = i.slice(1);
var c = t ? [
t
] : [];
var h = c.concat(o);
this._process(h, a, false);
var l = s.length;
var u = this.symlinks[r];
if (u && n) return;
for(var p = 0; p < l; p++){
var v = s[p];
if ("." !== v.charAt(0) || this.dot) {
var d = c.concat(s[p], o);
this._process(d, a, true);
var m = c.concat(s[p], i);
this._process(m, a, true);
}
}
};
GlobSync.prototype._processSimple = function(t, e) {
var r = this._stat(t);
if (!this.matches[e]) this.matches[e] = Object.create(null);
if (!r) return;
if (t && l(t) && !this.nomount) {
var i = /[\/\\]$/.test(t);
if ("/" === t.charAt(0)) t = c.join(this.root, t);
else {
t = c.resolve(this.root, t);
if (i) t += "/";
}
}
if ("win32" === process.platform) t = t.replace(/\\/g, "/");
this._emitMatch(e, t);
};
GlobSync.prototype._stat = function(t) {
var e = this._makeAbs(t);
var r = "/" === t.slice(-1);
if (t.length > this.maxLength) return false;
if (!this.stat && v(this.cache, e)) {
var i = this.cache[e];
if