@squiz/render-runtime-lib 1.2.1-alpha.63 → 1.2.1-alpha.68

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.
@@ -23045,28 +23045,59 @@ var require_loadManifest = __commonJS({
23045
23045
  return mod && mod.__esModule ? mod : { "default": mod };
23046
23046
  };
23047
23047
  Object.defineProperty(exports, "__esModule", { value: true });
23048
- exports.loadManifest = void 0;
23048
+ exports.findComponentManifests = exports.loadManifest = exports.ManifestValidationError = void 0;
23049
23049
  var validateManifest_1 = require_validateManifest();
23050
23050
  var path_1 = __importDefault(require("path"));
23051
23051
  var promises_1 = __importDefault(require("fs/promises"));
23052
23052
  var fs_extra_1 = __importDefault(require_lib4());
23053
23053
  var error_1 = require_error();
23054
+ var ManifestValidationError = class extends Error {
23055
+ };
23056
+ exports.ManifestValidationError = ManifestValidationError;
23054
23057
  async function loadManifest(componentName, version, componentRoot) {
23055
23058
  const manifestPath = path_1.default.join(componentRoot, componentName, version, "manifest.json");
23056
23059
  if (await fs_extra_1.default.pathExists(manifestPath)) {
23057
- const manifest = JSON.parse(await promises_1.default.readFile(manifestPath, { encoding: "utf-8" }));
23058
- const manifestValidationResult = (0, validateManifest_1.validateManifest)(manifest);
23059
- if (manifestValidationResult.isValid) {
23060
- if (version !== manifest.version) {
23061
- throw new error_1.InternalServerError(`manifest version miss match, expected version ${version} does not equal loaded version ${manifest.version}`);
23062
- }
23060
+ const { manifest, validation } = await readManifest(manifestPath);
23061
+ if (!validation.isValid) {
23062
+ throw new ManifestValidationError(validation.message);
23063
+ } else if (version !== manifest.version) {
23064
+ throw new error_1.InternalServerError(`manifest version miss match, expected version ${version} does not equal loaded version ${manifest.version}`);
23065
+ } else {
23063
23066
  return manifest;
23064
23067
  }
23065
- throw new Error(manifestValidationResult.message);
23066
23068
  }
23067
23069
  throw new error_1.ResourceNotFoundError("manifest could not be found");
23068
23070
  }
23069
23071
  exports.loadManifest = loadManifest;
23072
+ async function readManifest(manifestPath) {
23073
+ const manifest = JSON.parse(await promises_1.default.readFile(manifestPath, { encoding: "utf-8" }));
23074
+ const manifestValidationResult = (0, validateManifest_1.validateManifest)(manifest);
23075
+ return { manifest, validation: manifestValidationResult };
23076
+ }
23077
+ async function findComponentManifests(directory, nesting = 3) {
23078
+ if (await isComponentDirectory(directory)) {
23079
+ return [await tryReadManifest(directory)];
23080
+ }
23081
+ if (nesting === 0) {
23082
+ return [];
23083
+ }
23084
+ const files = await promises_1.default.readdir(directory, { withFileTypes: true, encoding: "utf-8" });
23085
+ const nestedDirectories = files.filter((file) => file.isDirectory());
23086
+ const otherManifests = await Promise.all(nestedDirectories.map((d) => findComponentManifests(path_1.default.join(directory, d.name), nesting - 1)));
23087
+ return otherManifests.flat();
23088
+ }
23089
+ exports.findComponentManifests = findComponentManifests;
23090
+ async function isComponentDirectory(directory) {
23091
+ return fs_extra_1.default.pathExists(path_1.default.join(directory, "manifest.json"));
23092
+ }
23093
+ async function tryReadManifest(directory) {
23094
+ const { manifest, validation } = await readManifest(path_1.default.join(directory, "manifest.json"));
23095
+ if (validation.isValid) {
23096
+ return { directory, manifest, status: "valid" };
23097
+ } else {
23098
+ return { directory, validationError: new ManifestValidationError(validation.message), status: "invalid" };
23099
+ }
23100
+ }
23070
23101
  }
23071
23102
  });
23072
23103
 
@@ -23196,23 +23227,11 @@ var require_requestLogger = __commonJS({
23196
23227
  }
23197
23228
  });
23198
23229
 
23199
- // ../component-lib/node_modules/concat-map/index.js
23200
- var require_concat_map = __commonJS({
23201
- "../component-lib/node_modules/concat-map/index.js"(exports, module2) {
23202
- module2.exports = function(xs, fn) {
23203
- var res = [];
23204
- for (var i = 0; i < xs.length; i++) {
23205
- var x = fn(xs[i], i);
23206
- if (isArray(x))
23207
- res.push.apply(res, x);
23208
- else
23209
- res.push(x);
23210
- }
23211
- return res;
23212
- };
23213
- var isArray = Array.isArray || function(xs) {
23214
- return Object.prototype.toString.call(xs) === "[object Array]";
23215
- };
23230
+ // ../component-lib/node_modules/readdir-glob/node_modules/minimatch/lib/path.js
23231
+ var require_path = __commonJS({
23232
+ "../component-lib/node_modules/readdir-glob/node_modules/minimatch/lib/path.js"(exports, module2) {
23233
+ var isWindows = typeof process === "object" && process && process.platform === "win32";
23234
+ module2.exports = isWindows ? { sep: "\\" } : { sep: "/" };
23216
23235
  }
23217
23236
  });
23218
23237
 
@@ -23276,10 +23295,9 @@ var require_balanced_match = __commonJS({
23276
23295
  }
23277
23296
  });
23278
23297
 
23279
- // ../component-lib/node_modules/brace-expansion/index.js
23298
+ // ../component-lib/node_modules/readdir-glob/node_modules/brace-expansion/index.js
23280
23299
  var require_brace_expansion = __commonJS({
23281
- "../component-lib/node_modules/brace-expansion/index.js"(exports, module2) {
23282
- var concatMap = require_concat_map();
23300
+ "../component-lib/node_modules/readdir-glob/node_modules/brace-expansion/index.js"(exports, module2) {
23283
23301
  var balanced = require_balanced_match();
23284
23302
  module2.exports = expandTop;
23285
23303
  var escSlash = "\0SLASH" + Math.random() + "\0";
@@ -23339,81 +23357,88 @@ var require_brace_expansion = __commonJS({
23339
23357
  function expand(str, isTop) {
23340
23358
  var expansions = [];
23341
23359
  var m = balanced("{", "}", str);
23342
- if (!m || /\$$/.test(m.pre))
23360
+ if (!m)
23343
23361
  return [str];
23344
- var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
23345
- var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
23346
- var isSequence = isNumericSequence || isAlphaSequence;
23347
- var isOptions = m.body.indexOf(",") >= 0;
23348
- if (!isSequence && !isOptions) {
23349
- if (m.post.match(/,.*\}/)) {
23350
- str = m.pre + "{" + m.body + escClose + m.post;
23351
- return expand(str);
23362
+ var pre = m.pre;
23363
+ var post = m.post.length ? expand(m.post, false) : [""];
23364
+ if (/\$$/.test(m.pre)) {
23365
+ for (var k = 0; k < post.length; k++) {
23366
+ var expansion = pre + "{" + m.body + "}" + post[k];
23367
+ expansions.push(expansion);
23352
23368
  }
23353
- return [str];
23354
- }
23355
- var n;
23356
- if (isSequence) {
23357
- n = m.body.split(/\.\./);
23358
23369
  } else {
23359
- n = parseCommaParts(m.body);
23360
- if (n.length === 1) {
23361
- n = expand(n[0], false).map(embrace);
23370
+ var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
23371
+ var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
23372
+ var isSequence = isNumericSequence || isAlphaSequence;
23373
+ var isOptions = m.body.indexOf(",") >= 0;
23374
+ if (!isSequence && !isOptions) {
23375
+ if (m.post.match(/,.*\}/)) {
23376
+ str = m.pre + "{" + m.body + escClose + m.post;
23377
+ return expand(str);
23378
+ }
23379
+ return [str];
23380
+ }
23381
+ var n;
23382
+ if (isSequence) {
23383
+ n = m.body.split(/\.\./);
23384
+ } else {
23385
+ n = parseCommaParts(m.body);
23362
23386
  if (n.length === 1) {
23363
- var post = m.post.length ? expand(m.post, false) : [""];
23364
- return post.map(function(p) {
23365
- return m.pre + n[0] + p;
23366
- });
23387
+ n = expand(n[0], false).map(embrace);
23388
+ if (n.length === 1) {
23389
+ return post.map(function(p) {
23390
+ return m.pre + n[0] + p;
23391
+ });
23392
+ }
23367
23393
  }
23368
23394
  }
23369
- }
23370
- var pre = m.pre;
23371
- var post = m.post.length ? expand(m.post, false) : [""];
23372
- var N;
23373
- if (isSequence) {
23374
- var x = numeric(n[0]);
23375
- var y = numeric(n[1]);
23376
- var width = Math.max(n[0].length, n[1].length);
23377
- var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
23378
- var test = lte;
23379
- var reverse = y < x;
23380
- if (reverse) {
23381
- incr *= -1;
23382
- test = gte;
23383
- }
23384
- var pad = n.some(isPadded);
23385
- N = [];
23386
- for (var i = x; test(i, y); i += incr) {
23387
- var c;
23388
- if (isAlphaSequence) {
23389
- c = String.fromCharCode(i);
23390
- if (c === "\\")
23391
- c = "";
23392
- } else {
23393
- c = String(i);
23394
- if (pad) {
23395
- var need = width - c.length;
23396
- if (need > 0) {
23397
- var z = new Array(need + 1).join("0");
23398
- if (i < 0)
23399
- c = "-" + z + c.slice(1);
23400
- else
23401
- c = z + c;
23395
+ var N;
23396
+ if (isSequence) {
23397
+ var x = numeric(n[0]);
23398
+ var y = numeric(n[1]);
23399
+ var width = Math.max(n[0].length, n[1].length);
23400
+ var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
23401
+ var test = lte;
23402
+ var reverse = y < x;
23403
+ if (reverse) {
23404
+ incr *= -1;
23405
+ test = gte;
23406
+ }
23407
+ var pad = n.some(isPadded);
23408
+ N = [];
23409
+ for (var i = x; test(i, y); i += incr) {
23410
+ var c;
23411
+ if (isAlphaSequence) {
23412
+ c = String.fromCharCode(i);
23413
+ if (c === "\\")
23414
+ c = "";
23415
+ } else {
23416
+ c = String(i);
23417
+ if (pad) {
23418
+ var need = width - c.length;
23419
+ if (need > 0) {
23420
+ var z = new Array(need + 1).join("0");
23421
+ if (i < 0)
23422
+ c = "-" + z + c.slice(1);
23423
+ else
23424
+ c = z + c;
23425
+ }
23402
23426
  }
23403
23427
  }
23428
+ N.push(c);
23429
+ }
23430
+ } else {
23431
+ N = [];
23432
+ for (var j = 0; j < n.length; j++) {
23433
+ N.push.apply(N, expand(n[j], false));
23404
23434
  }
23405
- N.push(c);
23406
23435
  }
23407
- } else {
23408
- N = concatMap(n, function(el) {
23409
- return expand(el, false);
23410
- });
23411
- }
23412
- for (var j = 0; j < N.length; j++) {
23413
- for (var k = 0; k < post.length; k++) {
23414
- var expansion = pre + N[j] + post[k];
23415
- if (!isTop || isSequence || expansion)
23416
- expansions.push(expansion);
23436
+ for (var j = 0; j < N.length; j++) {
23437
+ for (var k = 0; k < post.length; k++) {
23438
+ var expansion = pre + N[j] + post[k];
23439
+ if (!isTop || isSequence || expansion)
23440
+ expansions.push(expansion);
23441
+ }
23417
23442
  }
23418
23443
  }
23419
23444
  return expansions;
@@ -23421,21 +23446,21 @@ var require_brace_expansion = __commonJS({
23421
23446
  }
23422
23447
  });
23423
23448
 
23424
- // ../component-lib/node_modules/minimatch/minimatch.js
23449
+ // ../component-lib/node_modules/readdir-glob/node_modules/minimatch/minimatch.js
23425
23450
  var require_minimatch = __commonJS({
23426
- "../component-lib/node_modules/minimatch/minimatch.js"(exports, module2) {
23427
- module2.exports = minimatch;
23428
- minimatch.Minimatch = Minimatch;
23429
- var path = function() {
23430
- try {
23431
- return require("path");
23432
- } catch (e) {
23451
+ "../component-lib/node_modules/readdir-glob/node_modules/minimatch/minimatch.js"(exports, module2) {
23452
+ var minimatch = module2.exports = (p, pattern, options = {}) => {
23453
+ assertValidPattern(pattern);
23454
+ if (!options.nocomment && pattern.charAt(0) === "#") {
23455
+ return false;
23433
23456
  }
23434
- }() || {
23435
- sep: "/"
23457
+ return new Minimatch(pattern, options).match(p);
23436
23458
  };
23459
+ module2.exports = minimatch;
23460
+ var path = require_path();
23437
23461
  minimatch.sep = path.sep;
23438
- var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
23462
+ var GLOBSTAR = Symbol("globstar **");
23463
+ minimatch.GLOBSTAR = GLOBSTAR;
23439
23464
  var expand = require_brace_expansion();
23440
23465
  var plTypes = {
23441
23466
  "!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
@@ -23448,563 +23473,513 @@ var require_minimatch = __commonJS({
23448
23473
  var star = qmark + "*?";
23449
23474
  var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
23450
23475
  var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
23476
+ var charSet = (s) => s.split("").reduce((set, c) => {
23477
+ set[c] = true;
23478
+ return set;
23479
+ }, {});
23451
23480
  var reSpecials = charSet("().*{}+?[]^$\\!");
23452
- function charSet(s) {
23453
- return s.split("").reduce(function(set, c) {
23454
- set[c] = true;
23455
- return set;
23456
- }, {});
23457
- }
23481
+ var addPatternStartSet = charSet("[.(");
23458
23482
  var slashSplit = /\/+/;
23459
- minimatch.filter = filter;
23460
- function filter(pattern, options) {
23461
- options = options || {};
23462
- return function(p, i, list) {
23463
- return minimatch(p, pattern, options);
23464
- };
23465
- }
23466
- function ext(a, b) {
23467
- b = b || {};
23468
- var t = {};
23469
- Object.keys(a).forEach(function(k) {
23470
- t[k] = a[k];
23471
- });
23472
- Object.keys(b).forEach(function(k) {
23473
- t[k] = b[k];
23474
- });
23483
+ minimatch.filter = (pattern, options = {}) => (p, i, list) => minimatch(p, pattern, options);
23484
+ var ext = (a, b = {}) => {
23485
+ const t = {};
23486
+ Object.keys(a).forEach((k) => t[k] = a[k]);
23487
+ Object.keys(b).forEach((k) => t[k] = b[k]);
23475
23488
  return t;
23476
- }
23477
- minimatch.defaults = function(def) {
23489
+ };
23490
+ minimatch.defaults = (def) => {
23478
23491
  if (!def || typeof def !== "object" || !Object.keys(def).length) {
23479
23492
  return minimatch;
23480
23493
  }
23481
- var orig = minimatch;
23482
- var m = function minimatch2(p, pattern, options) {
23483
- return orig(p, pattern, ext(def, options));
23484
- };
23485
- m.Minimatch = function Minimatch2(pattern, options) {
23486
- return new orig.Minimatch(pattern, ext(def, options));
23487
- };
23488
- m.Minimatch.defaults = function defaults(options) {
23489
- return orig.defaults(ext(def, options)).Minimatch;
23490
- };
23491
- m.filter = function filter2(pattern, options) {
23492
- return orig.filter(pattern, ext(def, options));
23493
- };
23494
- m.defaults = function defaults(options) {
23495
- return orig.defaults(ext(def, options));
23496
- };
23497
- m.makeRe = function makeRe2(pattern, options) {
23498
- return orig.makeRe(pattern, ext(def, options));
23499
- };
23500
- m.braceExpand = function braceExpand2(pattern, options) {
23501
- return orig.braceExpand(pattern, ext(def, options));
23502
- };
23503
- m.match = function(list, pattern, options) {
23504
- return orig.match(list, pattern, ext(def, options));
23494
+ const orig = minimatch;
23495
+ const m = (p, pattern, options) => orig(p, pattern, ext(def, options));
23496
+ m.Minimatch = class Minimatch extends orig.Minimatch {
23497
+ constructor(pattern, options) {
23498
+ super(pattern, ext(def, options));
23499
+ }
23505
23500
  };
23501
+ m.Minimatch.defaults = (options) => orig.defaults(ext(def, options)).Minimatch;
23502
+ m.filter = (pattern, options) => orig.filter(pattern, ext(def, options));
23503
+ m.defaults = (options) => orig.defaults(ext(def, options));
23504
+ m.makeRe = (pattern, options) => orig.makeRe(pattern, ext(def, options));
23505
+ m.braceExpand = (pattern, options) => orig.braceExpand(pattern, ext(def, options));
23506
+ m.match = (list, pattern, options) => orig.match(list, pattern, ext(def, options));
23506
23507
  return m;
23507
23508
  };
23508
- Minimatch.defaults = function(def) {
23509
- return minimatch.defaults(def).Minimatch;
23510
- };
23511
- function minimatch(p, pattern, options) {
23509
+ minimatch.braceExpand = (pattern, options) => braceExpand(pattern, options);
23510
+ var braceExpand = (pattern, options = {}) => {
23512
23511
  assertValidPattern(pattern);
23513
- if (!options)
23514
- options = {};
23515
- if (!options.nocomment && pattern.charAt(0) === "#") {
23516
- return false;
23512
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
23513
+ return [pattern];
23517
23514
  }
23518
- return new Minimatch(pattern, options).match(p);
23519
- }
23520
- function Minimatch(pattern, options) {
23521
- if (!(this instanceof Minimatch)) {
23522
- return new Minimatch(pattern, options);
23515
+ return expand(pattern);
23516
+ };
23517
+ var MAX_PATTERN_LENGTH = 1024 * 64;
23518
+ var assertValidPattern = (pattern) => {
23519
+ if (typeof pattern !== "string") {
23520
+ throw new TypeError("invalid pattern");
23523
23521
  }
23524
- assertValidPattern(pattern);
23525
- if (!options)
23526
- options = {};
23527
- pattern = pattern.trim();
23528
- if (!options.allowWindowsEscape && path.sep !== "/") {
23529
- pattern = pattern.split(path.sep).join("/");
23522
+ if (pattern.length > MAX_PATTERN_LENGTH) {
23523
+ throw new TypeError("pattern is too long");
23530
23524
  }
23531
- this.options = options;
23532
- this.set = [];
23533
- this.pattern = pattern;
23534
- this.regexp = null;
23535
- this.negate = false;
23536
- this.comment = false;
23537
- this.empty = false;
23538
- this.partial = !!options.partial;
23539
- this.make();
23540
- }
23541
- Minimatch.prototype.debug = function() {
23542
23525
  };
23543
- Minimatch.prototype.make = make;
23544
- function make() {
23545
- var pattern = this.pattern;
23546
- var options = this.options;
23547
- if (!options.nocomment && pattern.charAt(0) === "#") {
23548
- this.comment = true;
23549
- return;
23550
- }
23551
- if (!pattern) {
23552
- this.empty = true;
23553
- return;
23526
+ var SUBPARSE = Symbol("subparse");
23527
+ minimatch.makeRe = (pattern, options) => new Minimatch(pattern, options || {}).makeRe();
23528
+ minimatch.match = (list, pattern, options = {}) => {
23529
+ const mm = new Minimatch(pattern, options);
23530
+ list = list.filter((f) => mm.match(f));
23531
+ if (mm.options.nonull && !list.length) {
23532
+ list.push(pattern);
23554
23533
  }
23555
- this.parseNegate();
23556
- var set = this.globSet = this.braceExpand();
23557
- if (options.debug)
23558
- this.debug = function debug() {
23559
- console.error.apply(console, arguments);
23560
- };
23561
- this.debug(this.pattern, set);
23562
- set = this.globParts = set.map(function(s) {
23563
- return s.split(slashSplit);
23564
- });
23565
- this.debug(this.pattern, set);
23566
- set = set.map(function(s, si, set2) {
23567
- return s.map(this.parse, this);
23568
- }, this);
23569
- this.debug(this.pattern, set);
23570
- set = set.filter(function(s) {
23571
- return s.indexOf(false) === -1;
23572
- });
23573
- this.debug(this.pattern, set);
23574
- this.set = set;
23575
- }
23576
- Minimatch.prototype.parseNegate = parseNegate;
23577
- function parseNegate() {
23578
- var pattern = this.pattern;
23579
- var negate = false;
23580
- var options = this.options;
23581
- var negateOffset = 0;
23582
- if (options.nonegate)
23583
- return;
23584
- for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
23585
- negate = !negate;
23586
- negateOffset++;
23587
- }
23588
- if (negateOffset)
23589
- this.pattern = pattern.substr(negateOffset);
23590
- this.negate = negate;
23591
- }
23592
- minimatch.braceExpand = function(pattern, options) {
23593
- return braceExpand(pattern, options);
23534
+ return list;
23594
23535
  };
23595
- Minimatch.prototype.braceExpand = braceExpand;
23596
- function braceExpand(pattern, options) {
23597
- if (!options) {
23598
- if (this instanceof Minimatch) {
23599
- options = this.options;
23600
- } else {
23536
+ var globUnescape = (s) => s.replace(/\\(.)/g, "$1");
23537
+ var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
23538
+ var Minimatch = class {
23539
+ constructor(pattern, options) {
23540
+ assertValidPattern(pattern);
23541
+ if (!options)
23601
23542
  options = {};
23543
+ this.options = options;
23544
+ this.set = [];
23545
+ this.pattern = pattern;
23546
+ this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
23547
+ if (this.windowsPathsNoEscape) {
23548
+ this.pattern = this.pattern.replace(/\\/g, "/");
23549
+ }
23550
+ this.regexp = null;
23551
+ this.negate = false;
23552
+ this.comment = false;
23553
+ this.empty = false;
23554
+ this.partial = !!options.partial;
23555
+ this.make();
23556
+ }
23557
+ debug() {
23558
+ }
23559
+ make() {
23560
+ const pattern = this.pattern;
23561
+ const options = this.options;
23562
+ if (!options.nocomment && pattern.charAt(0) === "#") {
23563
+ this.comment = true;
23564
+ return;
23602
23565
  }
23603
- }
23604
- pattern = typeof pattern === "undefined" ? this.pattern : pattern;
23605
- assertValidPattern(pattern);
23606
- if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
23607
- return [pattern];
23608
- }
23609
- return expand(pattern);
23610
- }
23611
- var MAX_PATTERN_LENGTH = 1024 * 64;
23612
- var assertValidPattern = function(pattern) {
23613
- if (typeof pattern !== "string") {
23614
- throw new TypeError("invalid pattern");
23615
- }
23616
- if (pattern.length > MAX_PATTERN_LENGTH) {
23617
- throw new TypeError("pattern is too long");
23618
- }
23619
- };
23620
- Minimatch.prototype.parse = parse;
23621
- var SUBPARSE = {};
23622
- function parse(pattern, isSub) {
23623
- assertValidPattern(pattern);
23624
- var options = this.options;
23625
- if (pattern === "**") {
23626
- if (!options.noglobstar)
23627
- return GLOBSTAR;
23628
- else
23629
- pattern = "*";
23630
- }
23631
- if (pattern === "")
23632
- return "";
23633
- var re = "";
23634
- var hasMagic = !!options.nocase;
23635
- var escaping = false;
23636
- var patternListStack = [];
23637
- var negativeLists = [];
23638
- var stateChar;
23639
- var inClass = false;
23640
- var reClassStart = -1;
23641
- var classStart = -1;
23642
- var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
23643
- var self2 = this;
23644
- function clearStateChar() {
23645
- if (stateChar) {
23646
- switch (stateChar) {
23647
- case "*":
23648
- re += star;
23649
- hasMagic = true;
23650
- break;
23651
- case "?":
23652
- re += qmark;
23653
- hasMagic = true;
23654
- break;
23655
- default:
23656
- re += "\\" + stateChar;
23657
- break;
23566
+ if (!pattern) {
23567
+ this.empty = true;
23568
+ return;
23569
+ }
23570
+ this.parseNegate();
23571
+ let set = this.globSet = this.braceExpand();
23572
+ if (options.debug)
23573
+ this.debug = (...args) => console.error(...args);
23574
+ this.debug(this.pattern, set);
23575
+ set = this.globParts = set.map((s) => s.split(slashSplit));
23576
+ this.debug(this.pattern, set);
23577
+ set = set.map((s, si, set2) => s.map(this.parse, this));
23578
+ this.debug(this.pattern, set);
23579
+ set = set.filter((s) => s.indexOf(false) === -1);
23580
+ this.debug(this.pattern, set);
23581
+ this.set = set;
23582
+ }
23583
+ parseNegate() {
23584
+ if (this.options.nonegate)
23585
+ return;
23586
+ const pattern = this.pattern;
23587
+ let negate = false;
23588
+ let negateOffset = 0;
23589
+ for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
23590
+ negate = !negate;
23591
+ negateOffset++;
23592
+ }
23593
+ if (negateOffset)
23594
+ this.pattern = pattern.substr(negateOffset);
23595
+ this.negate = negate;
23596
+ }
23597
+ matchOne(file, pattern, partial) {
23598
+ var options = this.options;
23599
+ this.debug("matchOne", { "this": this, file, pattern });
23600
+ this.debug("matchOne", file.length, pattern.length);
23601
+ for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
23602
+ this.debug("matchOne loop");
23603
+ var p = pattern[pi];
23604
+ var f = file[fi];
23605
+ this.debug(pattern, p, f);
23606
+ if (p === false)
23607
+ return false;
23608
+ if (p === GLOBSTAR) {
23609
+ this.debug("GLOBSTAR", [pattern, p, f]);
23610
+ var fr = fi;
23611
+ var pr = pi + 1;
23612
+ if (pr === pl) {
23613
+ this.debug("** at the end");
23614
+ for (; fi < fl; fi++) {
23615
+ if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
23616
+ return false;
23617
+ }
23618
+ return true;
23619
+ }
23620
+ while (fr < fl) {
23621
+ var swallowee = file[fr];
23622
+ this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
23623
+ if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
23624
+ this.debug("globstar found match!", fr, fl, swallowee);
23625
+ return true;
23626
+ } else {
23627
+ if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
23628
+ this.debug("dot detected!", file, fr, pattern, pr);
23629
+ break;
23630
+ }
23631
+ this.debug("globstar swallow a segment, and continue");
23632
+ fr++;
23633
+ }
23634
+ }
23635
+ if (partial) {
23636
+ this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
23637
+ if (fr === fl)
23638
+ return true;
23639
+ }
23640
+ return false;
23658
23641
  }
23659
- self2.debug("clearStateChar %j %j", stateChar, re);
23660
- stateChar = false;
23642
+ var hit;
23643
+ if (typeof p === "string") {
23644
+ hit = f === p;
23645
+ this.debug("string match", p, f, hit);
23646
+ } else {
23647
+ hit = f.match(p);
23648
+ this.debug("pattern match", p, f, hit);
23649
+ }
23650
+ if (!hit)
23651
+ return false;
23661
23652
  }
23662
- }
23663
- for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
23664
- this.debug("%s %s %s %j", pattern, i, re, c);
23665
- if (escaping && reSpecials[c]) {
23666
- re += "\\" + c;
23667
- escaping = false;
23668
- continue;
23653
+ if (fi === fl && pi === pl) {
23654
+ return true;
23655
+ } else if (fi === fl) {
23656
+ return partial;
23657
+ } else if (pi === pl) {
23658
+ return fi === fl - 1 && file[fi] === "";
23659
+ }
23660
+ throw new Error("wtf?");
23661
+ }
23662
+ braceExpand() {
23663
+ return braceExpand(this.pattern, this.options);
23664
+ }
23665
+ parse(pattern, isSub) {
23666
+ assertValidPattern(pattern);
23667
+ const options = this.options;
23668
+ if (pattern === "**") {
23669
+ if (!options.noglobstar)
23670
+ return GLOBSTAR;
23671
+ else
23672
+ pattern = "*";
23669
23673
  }
23670
- switch (c) {
23671
- case "/": {
23672
- return false;
23674
+ if (pattern === "")
23675
+ return "";
23676
+ let re = "";
23677
+ let hasMagic = !!options.nocase;
23678
+ let escaping = false;
23679
+ const patternListStack = [];
23680
+ const negativeLists = [];
23681
+ let stateChar;
23682
+ let inClass = false;
23683
+ let reClassStart = -1;
23684
+ let classStart = -1;
23685
+ let cs;
23686
+ let pl;
23687
+ let sp;
23688
+ const patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
23689
+ const clearStateChar = () => {
23690
+ if (stateChar) {
23691
+ switch (stateChar) {
23692
+ case "*":
23693
+ re += star;
23694
+ hasMagic = true;
23695
+ break;
23696
+ case "?":
23697
+ re += qmark;
23698
+ hasMagic = true;
23699
+ break;
23700
+ default:
23701
+ re += "\\" + stateChar;
23702
+ break;
23703
+ }
23704
+ this.debug("clearStateChar %j %j", stateChar, re);
23705
+ stateChar = false;
23673
23706
  }
23674
- case "\\":
23675
- clearStateChar();
23676
- escaping = true;
23707
+ };
23708
+ for (let i = 0, c; i < pattern.length && (c = pattern.charAt(i)); i++) {
23709
+ this.debug("%s %s %s %j", pattern, i, re, c);
23710
+ if (escaping) {
23711
+ if (c === "/") {
23712
+ return false;
23713
+ }
23714
+ if (reSpecials[c]) {
23715
+ re += "\\";
23716
+ }
23717
+ re += c;
23718
+ escaping = false;
23677
23719
  continue;
23678
- case "?":
23679
- case "*":
23680
- case "+":
23681
- case "@":
23682
- case "!":
23683
- this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c);
23684
- if (inClass) {
23685
- this.debug(" in class");
23686
- if (c === "!" && i === classStart + 1)
23687
- c = "^";
23688
- re += c;
23689
- continue;
23720
+ }
23721
+ switch (c) {
23722
+ case "/": {
23723
+ return false;
23690
23724
  }
23691
- self2.debug("call clearStateChar %j", stateChar);
23692
- clearStateChar();
23693
- stateChar = c;
23694
- if (options.noext)
23725
+ case "\\":
23695
23726
  clearStateChar();
23696
- continue;
23697
- case "(":
23698
- if (inClass) {
23699
- re += "(";
23727
+ escaping = true;
23700
23728
  continue;
23701
- }
23702
- if (!stateChar) {
23703
- re += "\\(";
23729
+ case "?":
23730
+ case "*":
23731
+ case "+":
23732
+ case "@":
23733
+ case "!":
23734
+ this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c);
23735
+ if (inClass) {
23736
+ this.debug(" in class");
23737
+ if (c === "!" && i === classStart + 1)
23738
+ c = "^";
23739
+ re += c;
23740
+ continue;
23741
+ }
23742
+ this.debug("call clearStateChar %j", stateChar);
23743
+ clearStateChar();
23744
+ stateChar = c;
23745
+ if (options.noext)
23746
+ clearStateChar();
23704
23747
  continue;
23705
- }
23706
- patternListStack.push({
23707
- type: stateChar,
23708
- start: i - 1,
23709
- reStart: re.length,
23710
- open: plTypes[stateChar].open,
23711
- close: plTypes[stateChar].close
23712
- });
23713
- re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
23714
- this.debug("plType %j %j", stateChar, re);
23715
- stateChar = false;
23716
- continue;
23717
- case ")":
23718
- if (inClass || !patternListStack.length) {
23719
- re += "\\)";
23748
+ case "(":
23749
+ if (inClass) {
23750
+ re += "(";
23751
+ continue;
23752
+ }
23753
+ if (!stateChar) {
23754
+ re += "\\(";
23755
+ continue;
23756
+ }
23757
+ patternListStack.push({
23758
+ type: stateChar,
23759
+ start: i - 1,
23760
+ reStart: re.length,
23761
+ open: plTypes[stateChar].open,
23762
+ close: plTypes[stateChar].close
23763
+ });
23764
+ re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
23765
+ this.debug("plType %j %j", stateChar, re);
23766
+ stateChar = false;
23720
23767
  continue;
23721
- }
23722
- clearStateChar();
23723
- hasMagic = true;
23724
- var pl = patternListStack.pop();
23725
- re += pl.close;
23726
- if (pl.type === "!") {
23727
- negativeLists.push(pl);
23728
- }
23729
- pl.reEnd = re.length;
23730
- continue;
23731
- case "|":
23732
- if (inClass || !patternListStack.length || escaping) {
23733
- re += "\\|";
23734
- escaping = false;
23768
+ case ")":
23769
+ if (inClass || !patternListStack.length) {
23770
+ re += "\\)";
23771
+ continue;
23772
+ }
23773
+ clearStateChar();
23774
+ hasMagic = true;
23775
+ pl = patternListStack.pop();
23776
+ re += pl.close;
23777
+ if (pl.type === "!") {
23778
+ negativeLists.push(pl);
23779
+ }
23780
+ pl.reEnd = re.length;
23735
23781
  continue;
23736
- }
23737
- clearStateChar();
23738
- re += "|";
23739
- continue;
23740
- case "[":
23741
- clearStateChar();
23742
- if (inClass) {
23743
- re += "\\" + c;
23782
+ case "|":
23783
+ if (inClass || !patternListStack.length) {
23784
+ re += "\\|";
23785
+ continue;
23786
+ }
23787
+ clearStateChar();
23788
+ re += "|";
23744
23789
  continue;
23745
- }
23746
- inClass = true;
23747
- classStart = i;
23748
- reClassStart = re.length;
23749
- re += c;
23750
- continue;
23751
- case "]":
23752
- if (i === classStart + 1 || !inClass) {
23753
- re += "\\" + c;
23754
- escaping = false;
23790
+ case "[":
23791
+ clearStateChar();
23792
+ if (inClass) {
23793
+ re += "\\" + c;
23794
+ continue;
23795
+ }
23796
+ inClass = true;
23797
+ classStart = i;
23798
+ reClassStart = re.length;
23799
+ re += c;
23755
23800
  continue;
23756
- }
23757
- var cs = pattern.substring(classStart + 1, i);
23758
- try {
23759
- RegExp("[" + cs + "]");
23760
- } catch (er) {
23761
- var sp = this.parse(cs, SUBPARSE);
23762
- re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
23763
- hasMagic = hasMagic || sp[1];
23801
+ case "]":
23802
+ if (i === classStart + 1 || !inClass) {
23803
+ re += "\\" + c;
23804
+ continue;
23805
+ }
23806
+ cs = pattern.substring(classStart + 1, i);
23807
+ try {
23808
+ RegExp("[" + cs + "]");
23809
+ } catch (er) {
23810
+ sp = this.parse(cs, SUBPARSE);
23811
+ re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
23812
+ hasMagic = hasMagic || sp[1];
23813
+ inClass = false;
23814
+ continue;
23815
+ }
23816
+ hasMagic = true;
23764
23817
  inClass = false;
23818
+ re += c;
23765
23819
  continue;
23766
- }
23767
- hasMagic = true;
23768
- inClass = false;
23769
- re += c;
23770
- continue;
23771
- default:
23772
- clearStateChar();
23773
- if (escaping) {
23774
- escaping = false;
23775
- } else if (reSpecials[c] && !(c === "^" && inClass)) {
23776
- re += "\\";
23777
- }
23778
- re += c;
23820
+ default:
23821
+ clearStateChar();
23822
+ if (reSpecials[c] && !(c === "^" && inClass)) {
23823
+ re += "\\";
23824
+ }
23825
+ re += c;
23826
+ break;
23827
+ }
23779
23828
  }
23780
- }
23781
- if (inClass) {
23782
- cs = pattern.substr(classStart + 1);
23783
- sp = this.parse(cs, SUBPARSE);
23784
- re = re.substr(0, reClassStart) + "\\[" + sp[0];
23785
- hasMagic = hasMagic || sp[1];
23786
- }
23787
- for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
23788
- var tail = re.slice(pl.reStart + pl.open.length);
23789
- this.debug("setting tail", re, pl);
23790
- tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_2, $1, $2) {
23791
- if (!$2) {
23792
- $2 = "\\";
23793
- }
23794
- return $1 + $1 + $2 + "|";
23795
- });
23796
- this.debug("tail=%j\n %s", tail, tail, pl, re);
23797
- var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
23798
- hasMagic = true;
23799
- re = re.slice(0, pl.reStart) + t + "\\(" + tail;
23800
- }
23801
- clearStateChar();
23802
- if (escaping) {
23803
- re += "\\\\";
23804
- }
23805
- var addPatternStart = false;
23806
- switch (re.charAt(0)) {
23807
- case "[":
23808
- case ".":
23809
- case "(":
23810
- addPatternStart = true;
23811
- }
23812
- for (var n = negativeLists.length - 1; n > -1; n--) {
23813
- var nl = negativeLists[n];
23814
- var nlBefore = re.slice(0, nl.reStart);
23815
- var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
23816
- var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
23817
- var nlAfter = re.slice(nl.reEnd);
23818
- nlLast += nlAfter;
23819
- var openParensBefore = nlBefore.split("(").length - 1;
23820
- var cleanAfter = nlAfter;
23821
- for (i = 0; i < openParensBefore; i++) {
23822
- cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
23829
+ if (inClass) {
23830
+ cs = pattern.substr(classStart + 1);
23831
+ sp = this.parse(cs, SUBPARSE);
23832
+ re = re.substr(0, reClassStart) + "\\[" + sp[0];
23833
+ hasMagic = hasMagic || sp[1];
23823
23834
  }
23824
- nlAfter = cleanAfter;
23825
- var dollar = "";
23826
- if (nlAfter === "" && isSub !== SUBPARSE) {
23827
- dollar = "$";
23835
+ for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
23836
+ let tail;
23837
+ tail = re.slice(pl.reStart + pl.open.length);
23838
+ this.debug("setting tail", re, pl);
23839
+ tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_2, $1, $2) => {
23840
+ if (!$2) {
23841
+ $2 = "\\";
23842
+ }
23843
+ return $1 + $1 + $2 + "|";
23844
+ });
23845
+ this.debug("tail=%j\n %s", tail, tail, pl, re);
23846
+ const t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
23847
+ hasMagic = true;
23848
+ re = re.slice(0, pl.reStart) + t + "\\(" + tail;
23849
+ }
23850
+ clearStateChar();
23851
+ if (escaping) {
23852
+ re += "\\\\";
23853
+ }
23854
+ const addPatternStart = addPatternStartSet[re.charAt(0)];
23855
+ for (let n = negativeLists.length - 1; n > -1; n--) {
23856
+ const nl = negativeLists[n];
23857
+ const nlBefore = re.slice(0, nl.reStart);
23858
+ const nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
23859
+ let nlAfter = re.slice(nl.reEnd);
23860
+ const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter;
23861
+ const openParensBefore = nlBefore.split("(").length - 1;
23862
+ let cleanAfter = nlAfter;
23863
+ for (let i = 0; i < openParensBefore; i++) {
23864
+ cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
23865
+ }
23866
+ nlAfter = cleanAfter;
23867
+ const dollar = nlAfter === "" && isSub !== SUBPARSE ? "$" : "";
23868
+ re = nlBefore + nlFirst + nlAfter + dollar + nlLast;
23869
+ }
23870
+ if (re !== "" && hasMagic) {
23871
+ re = "(?=.)" + re;
23872
+ }
23873
+ if (addPatternStart) {
23874
+ re = patternStart + re;
23875
+ }
23876
+ if (isSub === SUBPARSE) {
23877
+ return [re, hasMagic];
23878
+ }
23879
+ if (!hasMagic) {
23880
+ return globUnescape(pattern);
23881
+ }
23882
+ const flags = options.nocase ? "i" : "";
23883
+ try {
23884
+ return Object.assign(new RegExp("^" + re + "$", flags), {
23885
+ _glob: pattern,
23886
+ _src: re
23887
+ });
23888
+ } catch (er) {
23889
+ return new RegExp("$.");
23890
+ }
23891
+ }
23892
+ makeRe() {
23893
+ if (this.regexp || this.regexp === false)
23894
+ return this.regexp;
23895
+ const set = this.set;
23896
+ if (!set.length) {
23897
+ this.regexp = false;
23898
+ return this.regexp;
23899
+ }
23900
+ const options = this.options;
23901
+ const twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
23902
+ const flags = options.nocase ? "i" : "";
23903
+ let re = set.map((pattern) => {
23904
+ pattern = pattern.map((p) => typeof p === "string" ? regExpEscape(p) : p === GLOBSTAR ? GLOBSTAR : p._src).reduce((set2, p) => {
23905
+ if (!(set2[set2.length - 1] === GLOBSTAR && p === GLOBSTAR)) {
23906
+ set2.push(p);
23907
+ }
23908
+ return set2;
23909
+ }, []);
23910
+ pattern.forEach((p, i) => {
23911
+ if (p !== GLOBSTAR || pattern[i - 1] === GLOBSTAR) {
23912
+ return;
23913
+ }
23914
+ if (i === 0) {
23915
+ if (pattern.length > 1) {
23916
+ pattern[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + pattern[i + 1];
23917
+ } else {
23918
+ pattern[i] = twoStar;
23919
+ }
23920
+ } else if (i === pattern.length - 1) {
23921
+ pattern[i - 1] += "(?:\\/|" + twoStar + ")?";
23922
+ } else {
23923
+ pattern[i - 1] += "(?:\\/|\\/" + twoStar + "\\/)" + pattern[i + 1];
23924
+ pattern[i + 1] = GLOBSTAR;
23925
+ }
23926
+ });
23927
+ return pattern.filter((p) => p !== GLOBSTAR).join("/");
23928
+ }).join("|");
23929
+ re = "^(?:" + re + ")$";
23930
+ if (this.negate)
23931
+ re = "^(?!" + re + ").*$";
23932
+ try {
23933
+ this.regexp = new RegExp(re, flags);
23934
+ } catch (ex) {
23935
+ this.regexp = false;
23828
23936
  }
23829
- var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
23830
- re = newRe;
23831
- }
23832
- if (re !== "" && hasMagic) {
23833
- re = "(?=.)" + re;
23834
- }
23835
- if (addPatternStart) {
23836
- re = patternStart + re;
23837
- }
23838
- if (isSub === SUBPARSE) {
23839
- return [re, hasMagic];
23840
- }
23841
- if (!hasMagic) {
23842
- return globUnescape(pattern);
23843
- }
23844
- var flags = options.nocase ? "i" : "";
23845
- try {
23846
- var regExp = new RegExp("^" + re + "$", flags);
23847
- } catch (er) {
23848
- return new RegExp("$.");
23849
- }
23850
- regExp._glob = pattern;
23851
- regExp._src = re;
23852
- return regExp;
23853
- }
23854
- minimatch.makeRe = function(pattern, options) {
23855
- return new Minimatch(pattern, options || {}).makeRe();
23856
- };
23857
- Minimatch.prototype.makeRe = makeRe;
23858
- function makeRe() {
23859
- if (this.regexp || this.regexp === false)
23860
23937
  return this.regexp;
23861
- var set = this.set;
23862
- if (!set.length) {
23863
- this.regexp = false;
23864
- return this.regexp;
23865
- }
23866
- var options = this.options;
23867
- var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
23868
- var flags = options.nocase ? "i" : "";
23869
- var re = set.map(function(pattern) {
23870
- return pattern.map(function(p) {
23871
- return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
23872
- }).join("\\/");
23873
- }).join("|");
23874
- re = "^(?:" + re + ")$";
23875
- if (this.negate)
23876
- re = "^(?!" + re + ").*$";
23877
- try {
23878
- this.regexp = new RegExp(re, flags);
23879
- } catch (ex) {
23880
- this.regexp = false;
23881
- }
23882
- return this.regexp;
23883
- }
23884
- minimatch.match = function(list, pattern, options) {
23885
- options = options || {};
23886
- var mm = new Minimatch(pattern, options);
23887
- list = list.filter(function(f) {
23888
- return mm.match(f);
23889
- });
23890
- if (mm.options.nonull && !list.length) {
23891
- list.push(pattern);
23892
- }
23893
- return list;
23894
- };
23895
- Minimatch.prototype.match = function match(f, partial) {
23896
- if (typeof partial === "undefined")
23897
- partial = this.partial;
23898
- this.debug("match", f, this.pattern);
23899
- if (this.comment)
23900
- return false;
23901
- if (this.empty)
23902
- return f === "";
23903
- if (f === "/" && partial)
23904
- return true;
23905
- var options = this.options;
23906
- if (path.sep !== "/") {
23907
- f = f.split(path.sep).join("/");
23908
- }
23909
- f = f.split(slashSplit);
23910
- this.debug(this.pattern, "split", f);
23911
- var set = this.set;
23912
- this.debug(this.pattern, "set", set);
23913
- var filename;
23914
- var i;
23915
- for (i = f.length - 1; i >= 0; i--) {
23916
- filename = f[i];
23917
- if (filename)
23918
- break;
23919
- }
23920
- for (i = 0; i < set.length; i++) {
23921
- var pattern = set[i];
23922
- var file = f;
23923
- if (options.matchBase && pattern.length === 1) {
23924
- file = [filename];
23925
- }
23926
- var hit = this.matchOne(file, pattern, partial);
23927
- if (hit) {
23928
- if (options.flipNegate)
23929
- return true;
23930
- return !this.negate;
23931
- }
23932
23938
  }
23933
- if (options.flipNegate)
23934
- return false;
23935
- return this.negate;
23936
- };
23937
- Minimatch.prototype.matchOne = function(file, pattern, partial) {
23938
- var options = this.options;
23939
- this.debug("matchOne", { "this": this, file, pattern });
23940
- this.debug("matchOne", file.length, pattern.length);
23941
- for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
23942
- this.debug("matchOne loop");
23943
- var p = pattern[pi];
23944
- var f = file[fi];
23945
- this.debug(pattern, p, f);
23946
- if (p === false)
23939
+ match(f, partial = this.partial) {
23940
+ this.debug("match", f, this.pattern);
23941
+ if (this.comment)
23947
23942
  return false;
23948
- if (p === GLOBSTAR) {
23949
- this.debug("GLOBSTAR", [pattern, p, f]);
23950
- var fr = fi;
23951
- var pr = pi + 1;
23952
- if (pr === pl) {
23953
- this.debug("** at the end");
23954
- for (; fi < fl; fi++) {
23955
- if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
23956
- return false;
23957
- }
23958
- return true;
23959
- }
23960
- while (fr < fl) {
23961
- var swallowee = file[fr];
23962
- this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
23963
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
23964
- this.debug("globstar found match!", fr, fl, swallowee);
23965
- return true;
23966
- } else {
23967
- if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
23968
- this.debug("dot detected!", file, fr, pattern, pr);
23969
- break;
23970
- }
23971
- this.debug("globstar swallow a segment, and continue");
23972
- fr++;
23973
- }
23943
+ if (this.empty)
23944
+ return f === "";
23945
+ if (f === "/" && partial)
23946
+ return true;
23947
+ const options = this.options;
23948
+ if (path.sep !== "/") {
23949
+ f = f.split(path.sep).join("/");
23950
+ }
23951
+ f = f.split(slashSplit);
23952
+ this.debug(this.pattern, "split", f);
23953
+ const set = this.set;
23954
+ this.debug(this.pattern, "set", set);
23955
+ let filename;
23956
+ for (let i = f.length - 1; i >= 0; i--) {
23957
+ filename = f[i];
23958
+ if (filename)
23959
+ break;
23960
+ }
23961
+ for (let i = 0; i < set.length; i++) {
23962
+ const pattern = set[i];
23963
+ let file = f;
23964
+ if (options.matchBase && pattern.length === 1) {
23965
+ file = [filename];
23974
23966
  }
23975
- if (partial) {
23976
- this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
23977
- if (fr === fl)
23967
+ const hit = this.matchOne(file, pattern, partial);
23968
+ if (hit) {
23969
+ if (options.flipNegate)
23978
23970
  return true;
23971
+ return !this.negate;
23979
23972
  }
23980
- return false;
23981
- }
23982
- var hit;
23983
- if (typeof p === "string") {
23984
- hit = f === p;
23985
- this.debug("string match", p, f, hit);
23986
- } else {
23987
- hit = f.match(p);
23988
- this.debug("pattern match", p, f, hit);
23989
23973
  }
23990
- if (!hit)
23974
+ if (options.flipNegate)
23991
23975
  return false;
23976
+ return this.negate;
23992
23977
  }
23993
- if (fi === fl && pi === pl) {
23994
- return true;
23995
- } else if (fi === fl) {
23996
- return partial;
23997
- } else if (pi === pl) {
23998
- return fi === fl - 1 && file[fi] === "";
23978
+ static defaults(def) {
23979
+ return minimatch.defaults(def).Minimatch;
23999
23980
  }
24000
- throw new Error("wtf?");
24001
23981
  };
24002
- function globUnescape(s) {
24003
- return s.replace(/\\(.)/g, "$1");
24004
- }
24005
- function regExpEscape(s) {
24006
- return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
24007
- }
23982
+ minimatch.Minimatch = Minimatch;
24008
23983
  }
24009
23984
  });
24010
23985
 
@@ -24045,14 +24020,14 @@ var require_readdir_glob = __commonJS({
24045
24020
  });
24046
24021
  });
24047
24022
  }
24048
- function stat(file, followSyslinks) {
24023
+ function stat(file, followSymlinks) {
24049
24024
  return new Promise((resolve2, reject) => {
24050
- const statFunc = followSyslinks ? fs.stat : fs.lstat;
24025
+ const statFunc = followSymlinks ? fs.stat : fs.lstat;
24051
24026
  statFunc(file, (err, stats) => {
24052
24027
  if (err) {
24053
24028
  switch (err.code) {
24054
24029
  case "ENOENT":
24055
- if (followSyslinks) {
24030
+ if (followSymlinks) {
24056
24031
  resolve2(stat(file, false));
24057
24032
  } else {
24058
24033
  resolve2(null);
@@ -24068,7 +24043,7 @@ var require_readdir_glob = __commonJS({
24068
24043
  });
24069
24044
  });
24070
24045
  }
24071
- async function* exploreWalkAsync(dir, path, followSyslinks, useStat, shouldSkip, strict) {
24046
+ async function* exploreWalkAsync(dir, path, followSymlinks, useStat, shouldSkip, strict) {
24072
24047
  let files = await readdir(path + dir, strict);
24073
24048
  for (const file of files) {
24074
24049
  let name = file.name;
@@ -24080,8 +24055,8 @@ var require_readdir_glob = __commonJS({
24080
24055
  const relative = filename.slice(1);
24081
24056
  const absolute = path + "/" + relative;
24082
24057
  let stats = null;
24083
- if (useStat || followSyslinks) {
24084
- stats = await stat(absolute, followSyslinks);
24058
+ if (useStat || followSymlinks) {
24059
+ stats = await stat(absolute, followSymlinks);
24085
24060
  }
24086
24061
  if (!stats && file.name !== void 0) {
24087
24062
  stats = file;
@@ -24092,15 +24067,15 @@ var require_readdir_glob = __commonJS({
24092
24067
  if (stats.isDirectory()) {
24093
24068
  if (!shouldSkip(relative)) {
24094
24069
  yield { relative, absolute, stats };
24095
- yield* exploreWalkAsync(filename, path, followSyslinks, useStat, shouldSkip, false);
24070
+ yield* exploreWalkAsync(filename, path, followSymlinks, useStat, shouldSkip, false);
24096
24071
  }
24097
24072
  } else {
24098
24073
  yield { relative, absolute, stats };
24099
24074
  }
24100
24075
  }
24101
24076
  }
24102
- async function* explore(path, followSyslinks, useStat, shouldSkip) {
24103
- yield* exploreWalkAsync("", path, followSyslinks, useStat, shouldSkip, true);
24077
+ async function* explore(path, followSymlinks, useStat, shouldSkip) {
24078
+ yield* exploreWalkAsync("", path, followSymlinks, useStat, shouldSkip, true);
24104
24079
  }
24105
24080
  function readOptions(options) {
24106
24081
  return {
@@ -31572,6 +31547,758 @@ var require_fs2 = __commonJS({
31572
31547
  }
31573
31548
  });
31574
31549
 
31550
+ // ../component-lib/node_modules/concat-map/index.js
31551
+ var require_concat_map = __commonJS({
31552
+ "../component-lib/node_modules/concat-map/index.js"(exports, module2) {
31553
+ module2.exports = function(xs, fn) {
31554
+ var res = [];
31555
+ for (var i = 0; i < xs.length; i++) {
31556
+ var x = fn(xs[i], i);
31557
+ if (isArray(x))
31558
+ res.push.apply(res, x);
31559
+ else
31560
+ res.push(x);
31561
+ }
31562
+ return res;
31563
+ };
31564
+ var isArray = Array.isArray || function(xs) {
31565
+ return Object.prototype.toString.call(xs) === "[object Array]";
31566
+ };
31567
+ }
31568
+ });
31569
+
31570
+ // ../component-lib/node_modules/brace-expansion/index.js
31571
+ var require_brace_expansion2 = __commonJS({
31572
+ "../component-lib/node_modules/brace-expansion/index.js"(exports, module2) {
31573
+ var concatMap = require_concat_map();
31574
+ var balanced = require_balanced_match();
31575
+ module2.exports = expandTop;
31576
+ var escSlash = "\0SLASH" + Math.random() + "\0";
31577
+ var escOpen = "\0OPEN" + Math.random() + "\0";
31578
+ var escClose = "\0CLOSE" + Math.random() + "\0";
31579
+ var escComma = "\0COMMA" + Math.random() + "\0";
31580
+ var escPeriod = "\0PERIOD" + Math.random() + "\0";
31581
+ function numeric(str) {
31582
+ return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
31583
+ }
31584
+ function escapeBraces(str) {
31585
+ return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
31586
+ }
31587
+ function unescapeBraces(str) {
31588
+ return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
31589
+ }
31590
+ function parseCommaParts(str) {
31591
+ if (!str)
31592
+ return [""];
31593
+ var parts = [];
31594
+ var m = balanced("{", "}", str);
31595
+ if (!m)
31596
+ return str.split(",");
31597
+ var pre = m.pre;
31598
+ var body = m.body;
31599
+ var post = m.post;
31600
+ var p = pre.split(",");
31601
+ p[p.length - 1] += "{" + body + "}";
31602
+ var postParts = parseCommaParts(post);
31603
+ if (post.length) {
31604
+ p[p.length - 1] += postParts.shift();
31605
+ p.push.apply(p, postParts);
31606
+ }
31607
+ parts.push.apply(parts, p);
31608
+ return parts;
31609
+ }
31610
+ function expandTop(str) {
31611
+ if (!str)
31612
+ return [];
31613
+ if (str.substr(0, 2) === "{}") {
31614
+ str = "\\{\\}" + str.substr(2);
31615
+ }
31616
+ return expand(escapeBraces(str), true).map(unescapeBraces);
31617
+ }
31618
+ function embrace(str) {
31619
+ return "{" + str + "}";
31620
+ }
31621
+ function isPadded(el) {
31622
+ return /^-?0\d/.test(el);
31623
+ }
31624
+ function lte(i, y) {
31625
+ return i <= y;
31626
+ }
31627
+ function gte(i, y) {
31628
+ return i >= y;
31629
+ }
31630
+ function expand(str, isTop) {
31631
+ var expansions = [];
31632
+ var m = balanced("{", "}", str);
31633
+ if (!m || /\$$/.test(m.pre))
31634
+ return [str];
31635
+ var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
31636
+ var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
31637
+ var isSequence = isNumericSequence || isAlphaSequence;
31638
+ var isOptions = m.body.indexOf(",") >= 0;
31639
+ if (!isSequence && !isOptions) {
31640
+ if (m.post.match(/,.*\}/)) {
31641
+ str = m.pre + "{" + m.body + escClose + m.post;
31642
+ return expand(str);
31643
+ }
31644
+ return [str];
31645
+ }
31646
+ var n;
31647
+ if (isSequence) {
31648
+ n = m.body.split(/\.\./);
31649
+ } else {
31650
+ n = parseCommaParts(m.body);
31651
+ if (n.length === 1) {
31652
+ n = expand(n[0], false).map(embrace);
31653
+ if (n.length === 1) {
31654
+ var post = m.post.length ? expand(m.post, false) : [""];
31655
+ return post.map(function(p) {
31656
+ return m.pre + n[0] + p;
31657
+ });
31658
+ }
31659
+ }
31660
+ }
31661
+ var pre = m.pre;
31662
+ var post = m.post.length ? expand(m.post, false) : [""];
31663
+ var N;
31664
+ if (isSequence) {
31665
+ var x = numeric(n[0]);
31666
+ var y = numeric(n[1]);
31667
+ var width = Math.max(n[0].length, n[1].length);
31668
+ var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
31669
+ var test = lte;
31670
+ var reverse = y < x;
31671
+ if (reverse) {
31672
+ incr *= -1;
31673
+ test = gte;
31674
+ }
31675
+ var pad = n.some(isPadded);
31676
+ N = [];
31677
+ for (var i = x; test(i, y); i += incr) {
31678
+ var c;
31679
+ if (isAlphaSequence) {
31680
+ c = String.fromCharCode(i);
31681
+ if (c === "\\")
31682
+ c = "";
31683
+ } else {
31684
+ c = String(i);
31685
+ if (pad) {
31686
+ var need = width - c.length;
31687
+ if (need > 0) {
31688
+ var z = new Array(need + 1).join("0");
31689
+ if (i < 0)
31690
+ c = "-" + z + c.slice(1);
31691
+ else
31692
+ c = z + c;
31693
+ }
31694
+ }
31695
+ }
31696
+ N.push(c);
31697
+ }
31698
+ } else {
31699
+ N = concatMap(n, function(el) {
31700
+ return expand(el, false);
31701
+ });
31702
+ }
31703
+ for (var j = 0; j < N.length; j++) {
31704
+ for (var k = 0; k < post.length; k++) {
31705
+ var expansion = pre + N[j] + post[k];
31706
+ if (!isTop || isSequence || expansion)
31707
+ expansions.push(expansion);
31708
+ }
31709
+ }
31710
+ return expansions;
31711
+ }
31712
+ }
31713
+ });
31714
+
31715
+ // ../component-lib/node_modules/minimatch/minimatch.js
31716
+ var require_minimatch2 = __commonJS({
31717
+ "../component-lib/node_modules/minimatch/minimatch.js"(exports, module2) {
31718
+ module2.exports = minimatch;
31719
+ minimatch.Minimatch = Minimatch;
31720
+ var path = function() {
31721
+ try {
31722
+ return require("path");
31723
+ } catch (e) {
31724
+ }
31725
+ }() || {
31726
+ sep: "/"
31727
+ };
31728
+ minimatch.sep = path.sep;
31729
+ var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
31730
+ var expand = require_brace_expansion2();
31731
+ var plTypes = {
31732
+ "!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
31733
+ "?": { open: "(?:", close: ")?" },
31734
+ "+": { open: "(?:", close: ")+" },
31735
+ "*": { open: "(?:", close: ")*" },
31736
+ "@": { open: "(?:", close: ")" }
31737
+ };
31738
+ var qmark = "[^/]";
31739
+ var star = qmark + "*?";
31740
+ var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
31741
+ var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
31742
+ var reSpecials = charSet("().*{}+?[]^$\\!");
31743
+ function charSet(s) {
31744
+ return s.split("").reduce(function(set, c) {
31745
+ set[c] = true;
31746
+ return set;
31747
+ }, {});
31748
+ }
31749
+ var slashSplit = /\/+/;
31750
+ minimatch.filter = filter;
31751
+ function filter(pattern, options) {
31752
+ options = options || {};
31753
+ return function(p, i, list) {
31754
+ return minimatch(p, pattern, options);
31755
+ };
31756
+ }
31757
+ function ext(a, b) {
31758
+ b = b || {};
31759
+ var t = {};
31760
+ Object.keys(a).forEach(function(k) {
31761
+ t[k] = a[k];
31762
+ });
31763
+ Object.keys(b).forEach(function(k) {
31764
+ t[k] = b[k];
31765
+ });
31766
+ return t;
31767
+ }
31768
+ minimatch.defaults = function(def) {
31769
+ if (!def || typeof def !== "object" || !Object.keys(def).length) {
31770
+ return minimatch;
31771
+ }
31772
+ var orig = minimatch;
31773
+ var m = function minimatch2(p, pattern, options) {
31774
+ return orig(p, pattern, ext(def, options));
31775
+ };
31776
+ m.Minimatch = function Minimatch2(pattern, options) {
31777
+ return new orig.Minimatch(pattern, ext(def, options));
31778
+ };
31779
+ m.Minimatch.defaults = function defaults(options) {
31780
+ return orig.defaults(ext(def, options)).Minimatch;
31781
+ };
31782
+ m.filter = function filter2(pattern, options) {
31783
+ return orig.filter(pattern, ext(def, options));
31784
+ };
31785
+ m.defaults = function defaults(options) {
31786
+ return orig.defaults(ext(def, options));
31787
+ };
31788
+ m.makeRe = function makeRe2(pattern, options) {
31789
+ return orig.makeRe(pattern, ext(def, options));
31790
+ };
31791
+ m.braceExpand = function braceExpand2(pattern, options) {
31792
+ return orig.braceExpand(pattern, ext(def, options));
31793
+ };
31794
+ m.match = function(list, pattern, options) {
31795
+ return orig.match(list, pattern, ext(def, options));
31796
+ };
31797
+ return m;
31798
+ };
31799
+ Minimatch.defaults = function(def) {
31800
+ return minimatch.defaults(def).Minimatch;
31801
+ };
31802
+ function minimatch(p, pattern, options) {
31803
+ assertValidPattern(pattern);
31804
+ if (!options)
31805
+ options = {};
31806
+ if (!options.nocomment && pattern.charAt(0) === "#") {
31807
+ return false;
31808
+ }
31809
+ return new Minimatch(pattern, options).match(p);
31810
+ }
31811
+ function Minimatch(pattern, options) {
31812
+ if (!(this instanceof Minimatch)) {
31813
+ return new Minimatch(pattern, options);
31814
+ }
31815
+ assertValidPattern(pattern);
31816
+ if (!options)
31817
+ options = {};
31818
+ pattern = pattern.trim();
31819
+ if (!options.allowWindowsEscape && path.sep !== "/") {
31820
+ pattern = pattern.split(path.sep).join("/");
31821
+ }
31822
+ this.options = options;
31823
+ this.set = [];
31824
+ this.pattern = pattern;
31825
+ this.regexp = null;
31826
+ this.negate = false;
31827
+ this.comment = false;
31828
+ this.empty = false;
31829
+ this.partial = !!options.partial;
31830
+ this.make();
31831
+ }
31832
+ Minimatch.prototype.debug = function() {
31833
+ };
31834
+ Minimatch.prototype.make = make;
31835
+ function make() {
31836
+ var pattern = this.pattern;
31837
+ var options = this.options;
31838
+ if (!options.nocomment && pattern.charAt(0) === "#") {
31839
+ this.comment = true;
31840
+ return;
31841
+ }
31842
+ if (!pattern) {
31843
+ this.empty = true;
31844
+ return;
31845
+ }
31846
+ this.parseNegate();
31847
+ var set = this.globSet = this.braceExpand();
31848
+ if (options.debug)
31849
+ this.debug = function debug() {
31850
+ console.error.apply(console, arguments);
31851
+ };
31852
+ this.debug(this.pattern, set);
31853
+ set = this.globParts = set.map(function(s) {
31854
+ return s.split(slashSplit);
31855
+ });
31856
+ this.debug(this.pattern, set);
31857
+ set = set.map(function(s, si, set2) {
31858
+ return s.map(this.parse, this);
31859
+ }, this);
31860
+ this.debug(this.pattern, set);
31861
+ set = set.filter(function(s) {
31862
+ return s.indexOf(false) === -1;
31863
+ });
31864
+ this.debug(this.pattern, set);
31865
+ this.set = set;
31866
+ }
31867
+ Minimatch.prototype.parseNegate = parseNegate;
31868
+ function parseNegate() {
31869
+ var pattern = this.pattern;
31870
+ var negate = false;
31871
+ var options = this.options;
31872
+ var negateOffset = 0;
31873
+ if (options.nonegate)
31874
+ return;
31875
+ for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
31876
+ negate = !negate;
31877
+ negateOffset++;
31878
+ }
31879
+ if (negateOffset)
31880
+ this.pattern = pattern.substr(negateOffset);
31881
+ this.negate = negate;
31882
+ }
31883
+ minimatch.braceExpand = function(pattern, options) {
31884
+ return braceExpand(pattern, options);
31885
+ };
31886
+ Minimatch.prototype.braceExpand = braceExpand;
31887
+ function braceExpand(pattern, options) {
31888
+ if (!options) {
31889
+ if (this instanceof Minimatch) {
31890
+ options = this.options;
31891
+ } else {
31892
+ options = {};
31893
+ }
31894
+ }
31895
+ pattern = typeof pattern === "undefined" ? this.pattern : pattern;
31896
+ assertValidPattern(pattern);
31897
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
31898
+ return [pattern];
31899
+ }
31900
+ return expand(pattern);
31901
+ }
31902
+ var MAX_PATTERN_LENGTH = 1024 * 64;
31903
+ var assertValidPattern = function(pattern) {
31904
+ if (typeof pattern !== "string") {
31905
+ throw new TypeError("invalid pattern");
31906
+ }
31907
+ if (pattern.length > MAX_PATTERN_LENGTH) {
31908
+ throw new TypeError("pattern is too long");
31909
+ }
31910
+ };
31911
+ Minimatch.prototype.parse = parse;
31912
+ var SUBPARSE = {};
31913
+ function parse(pattern, isSub) {
31914
+ assertValidPattern(pattern);
31915
+ var options = this.options;
31916
+ if (pattern === "**") {
31917
+ if (!options.noglobstar)
31918
+ return GLOBSTAR;
31919
+ else
31920
+ pattern = "*";
31921
+ }
31922
+ if (pattern === "")
31923
+ return "";
31924
+ var re = "";
31925
+ var hasMagic = !!options.nocase;
31926
+ var escaping = false;
31927
+ var patternListStack = [];
31928
+ var negativeLists = [];
31929
+ var stateChar;
31930
+ var inClass = false;
31931
+ var reClassStart = -1;
31932
+ var classStart = -1;
31933
+ var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
31934
+ var self2 = this;
31935
+ function clearStateChar() {
31936
+ if (stateChar) {
31937
+ switch (stateChar) {
31938
+ case "*":
31939
+ re += star;
31940
+ hasMagic = true;
31941
+ break;
31942
+ case "?":
31943
+ re += qmark;
31944
+ hasMagic = true;
31945
+ break;
31946
+ default:
31947
+ re += "\\" + stateChar;
31948
+ break;
31949
+ }
31950
+ self2.debug("clearStateChar %j %j", stateChar, re);
31951
+ stateChar = false;
31952
+ }
31953
+ }
31954
+ for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
31955
+ this.debug("%s %s %s %j", pattern, i, re, c);
31956
+ if (escaping && reSpecials[c]) {
31957
+ re += "\\" + c;
31958
+ escaping = false;
31959
+ continue;
31960
+ }
31961
+ switch (c) {
31962
+ case "/": {
31963
+ return false;
31964
+ }
31965
+ case "\\":
31966
+ clearStateChar();
31967
+ escaping = true;
31968
+ continue;
31969
+ case "?":
31970
+ case "*":
31971
+ case "+":
31972
+ case "@":
31973
+ case "!":
31974
+ this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c);
31975
+ if (inClass) {
31976
+ this.debug(" in class");
31977
+ if (c === "!" && i === classStart + 1)
31978
+ c = "^";
31979
+ re += c;
31980
+ continue;
31981
+ }
31982
+ self2.debug("call clearStateChar %j", stateChar);
31983
+ clearStateChar();
31984
+ stateChar = c;
31985
+ if (options.noext)
31986
+ clearStateChar();
31987
+ continue;
31988
+ case "(":
31989
+ if (inClass) {
31990
+ re += "(";
31991
+ continue;
31992
+ }
31993
+ if (!stateChar) {
31994
+ re += "\\(";
31995
+ continue;
31996
+ }
31997
+ patternListStack.push({
31998
+ type: stateChar,
31999
+ start: i - 1,
32000
+ reStart: re.length,
32001
+ open: plTypes[stateChar].open,
32002
+ close: plTypes[stateChar].close
32003
+ });
32004
+ re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
32005
+ this.debug("plType %j %j", stateChar, re);
32006
+ stateChar = false;
32007
+ continue;
32008
+ case ")":
32009
+ if (inClass || !patternListStack.length) {
32010
+ re += "\\)";
32011
+ continue;
32012
+ }
32013
+ clearStateChar();
32014
+ hasMagic = true;
32015
+ var pl = patternListStack.pop();
32016
+ re += pl.close;
32017
+ if (pl.type === "!") {
32018
+ negativeLists.push(pl);
32019
+ }
32020
+ pl.reEnd = re.length;
32021
+ continue;
32022
+ case "|":
32023
+ if (inClass || !patternListStack.length || escaping) {
32024
+ re += "\\|";
32025
+ escaping = false;
32026
+ continue;
32027
+ }
32028
+ clearStateChar();
32029
+ re += "|";
32030
+ continue;
32031
+ case "[":
32032
+ clearStateChar();
32033
+ if (inClass) {
32034
+ re += "\\" + c;
32035
+ continue;
32036
+ }
32037
+ inClass = true;
32038
+ classStart = i;
32039
+ reClassStart = re.length;
32040
+ re += c;
32041
+ continue;
32042
+ case "]":
32043
+ if (i === classStart + 1 || !inClass) {
32044
+ re += "\\" + c;
32045
+ escaping = false;
32046
+ continue;
32047
+ }
32048
+ var cs = pattern.substring(classStart + 1, i);
32049
+ try {
32050
+ RegExp("[" + cs + "]");
32051
+ } catch (er) {
32052
+ var sp = this.parse(cs, SUBPARSE);
32053
+ re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
32054
+ hasMagic = hasMagic || sp[1];
32055
+ inClass = false;
32056
+ continue;
32057
+ }
32058
+ hasMagic = true;
32059
+ inClass = false;
32060
+ re += c;
32061
+ continue;
32062
+ default:
32063
+ clearStateChar();
32064
+ if (escaping) {
32065
+ escaping = false;
32066
+ } else if (reSpecials[c] && !(c === "^" && inClass)) {
32067
+ re += "\\";
32068
+ }
32069
+ re += c;
32070
+ }
32071
+ }
32072
+ if (inClass) {
32073
+ cs = pattern.substr(classStart + 1);
32074
+ sp = this.parse(cs, SUBPARSE);
32075
+ re = re.substr(0, reClassStart) + "\\[" + sp[0];
32076
+ hasMagic = hasMagic || sp[1];
32077
+ }
32078
+ for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
32079
+ var tail = re.slice(pl.reStart + pl.open.length);
32080
+ this.debug("setting tail", re, pl);
32081
+ tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_2, $1, $2) {
32082
+ if (!$2) {
32083
+ $2 = "\\";
32084
+ }
32085
+ return $1 + $1 + $2 + "|";
32086
+ });
32087
+ this.debug("tail=%j\n %s", tail, tail, pl, re);
32088
+ var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
32089
+ hasMagic = true;
32090
+ re = re.slice(0, pl.reStart) + t + "\\(" + tail;
32091
+ }
32092
+ clearStateChar();
32093
+ if (escaping) {
32094
+ re += "\\\\";
32095
+ }
32096
+ var addPatternStart = false;
32097
+ switch (re.charAt(0)) {
32098
+ case "[":
32099
+ case ".":
32100
+ case "(":
32101
+ addPatternStart = true;
32102
+ }
32103
+ for (var n = negativeLists.length - 1; n > -1; n--) {
32104
+ var nl = negativeLists[n];
32105
+ var nlBefore = re.slice(0, nl.reStart);
32106
+ var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
32107
+ var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
32108
+ var nlAfter = re.slice(nl.reEnd);
32109
+ nlLast += nlAfter;
32110
+ var openParensBefore = nlBefore.split("(").length - 1;
32111
+ var cleanAfter = nlAfter;
32112
+ for (i = 0; i < openParensBefore; i++) {
32113
+ cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
32114
+ }
32115
+ nlAfter = cleanAfter;
32116
+ var dollar = "";
32117
+ if (nlAfter === "" && isSub !== SUBPARSE) {
32118
+ dollar = "$";
32119
+ }
32120
+ var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
32121
+ re = newRe;
32122
+ }
32123
+ if (re !== "" && hasMagic) {
32124
+ re = "(?=.)" + re;
32125
+ }
32126
+ if (addPatternStart) {
32127
+ re = patternStart + re;
32128
+ }
32129
+ if (isSub === SUBPARSE) {
32130
+ return [re, hasMagic];
32131
+ }
32132
+ if (!hasMagic) {
32133
+ return globUnescape(pattern);
32134
+ }
32135
+ var flags = options.nocase ? "i" : "";
32136
+ try {
32137
+ var regExp = new RegExp("^" + re + "$", flags);
32138
+ } catch (er) {
32139
+ return new RegExp("$.");
32140
+ }
32141
+ regExp._glob = pattern;
32142
+ regExp._src = re;
32143
+ return regExp;
32144
+ }
32145
+ minimatch.makeRe = function(pattern, options) {
32146
+ return new Minimatch(pattern, options || {}).makeRe();
32147
+ };
32148
+ Minimatch.prototype.makeRe = makeRe;
32149
+ function makeRe() {
32150
+ if (this.regexp || this.regexp === false)
32151
+ return this.regexp;
32152
+ var set = this.set;
32153
+ if (!set.length) {
32154
+ this.regexp = false;
32155
+ return this.regexp;
32156
+ }
32157
+ var options = this.options;
32158
+ var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
32159
+ var flags = options.nocase ? "i" : "";
32160
+ var re = set.map(function(pattern) {
32161
+ return pattern.map(function(p) {
32162
+ return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
32163
+ }).join("\\/");
32164
+ }).join("|");
32165
+ re = "^(?:" + re + ")$";
32166
+ if (this.negate)
32167
+ re = "^(?!" + re + ").*$";
32168
+ try {
32169
+ this.regexp = new RegExp(re, flags);
32170
+ } catch (ex) {
32171
+ this.regexp = false;
32172
+ }
32173
+ return this.regexp;
32174
+ }
32175
+ minimatch.match = function(list, pattern, options) {
32176
+ options = options || {};
32177
+ var mm = new Minimatch(pattern, options);
32178
+ list = list.filter(function(f) {
32179
+ return mm.match(f);
32180
+ });
32181
+ if (mm.options.nonull && !list.length) {
32182
+ list.push(pattern);
32183
+ }
32184
+ return list;
32185
+ };
32186
+ Minimatch.prototype.match = function match(f, partial) {
32187
+ if (typeof partial === "undefined")
32188
+ partial = this.partial;
32189
+ this.debug("match", f, this.pattern);
32190
+ if (this.comment)
32191
+ return false;
32192
+ if (this.empty)
32193
+ return f === "";
32194
+ if (f === "/" && partial)
32195
+ return true;
32196
+ var options = this.options;
32197
+ if (path.sep !== "/") {
32198
+ f = f.split(path.sep).join("/");
32199
+ }
32200
+ f = f.split(slashSplit);
32201
+ this.debug(this.pattern, "split", f);
32202
+ var set = this.set;
32203
+ this.debug(this.pattern, "set", set);
32204
+ var filename;
32205
+ var i;
32206
+ for (i = f.length - 1; i >= 0; i--) {
32207
+ filename = f[i];
32208
+ if (filename)
32209
+ break;
32210
+ }
32211
+ for (i = 0; i < set.length; i++) {
32212
+ var pattern = set[i];
32213
+ var file = f;
32214
+ if (options.matchBase && pattern.length === 1) {
32215
+ file = [filename];
32216
+ }
32217
+ var hit = this.matchOne(file, pattern, partial);
32218
+ if (hit) {
32219
+ if (options.flipNegate)
32220
+ return true;
32221
+ return !this.negate;
32222
+ }
32223
+ }
32224
+ if (options.flipNegate)
32225
+ return false;
32226
+ return this.negate;
32227
+ };
32228
+ Minimatch.prototype.matchOne = function(file, pattern, partial) {
32229
+ var options = this.options;
32230
+ this.debug("matchOne", { "this": this, file, pattern });
32231
+ this.debug("matchOne", file.length, pattern.length);
32232
+ for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
32233
+ this.debug("matchOne loop");
32234
+ var p = pattern[pi];
32235
+ var f = file[fi];
32236
+ this.debug(pattern, p, f);
32237
+ if (p === false)
32238
+ return false;
32239
+ if (p === GLOBSTAR) {
32240
+ this.debug("GLOBSTAR", [pattern, p, f]);
32241
+ var fr = fi;
32242
+ var pr = pi + 1;
32243
+ if (pr === pl) {
32244
+ this.debug("** at the end");
32245
+ for (; fi < fl; fi++) {
32246
+ if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
32247
+ return false;
32248
+ }
32249
+ return true;
32250
+ }
32251
+ while (fr < fl) {
32252
+ var swallowee = file[fr];
32253
+ this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
32254
+ if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
32255
+ this.debug("globstar found match!", fr, fl, swallowee);
32256
+ return true;
32257
+ } else {
32258
+ if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
32259
+ this.debug("dot detected!", file, fr, pattern, pr);
32260
+ break;
32261
+ }
32262
+ this.debug("globstar swallow a segment, and continue");
32263
+ fr++;
32264
+ }
32265
+ }
32266
+ if (partial) {
32267
+ this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
32268
+ if (fr === fl)
32269
+ return true;
32270
+ }
32271
+ return false;
32272
+ }
32273
+ var hit;
32274
+ if (typeof p === "string") {
32275
+ hit = f === p;
32276
+ this.debug("string match", p, f, hit);
32277
+ } else {
32278
+ hit = f.match(p);
32279
+ this.debug("pattern match", p, f, hit);
32280
+ }
32281
+ if (!hit)
32282
+ return false;
32283
+ }
32284
+ if (fi === fl && pi === pl) {
32285
+ return true;
32286
+ } else if (fi === fl) {
32287
+ return partial;
32288
+ } else if (pi === pl) {
32289
+ return fi === fl - 1 && file[fi] === "";
32290
+ }
32291
+ throw new Error("wtf?");
32292
+ };
32293
+ function globUnescape(s) {
32294
+ return s.replace(/\\(.)/g, "$1");
32295
+ }
32296
+ function regExpEscape(s) {
32297
+ return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
32298
+ }
32299
+ }
32300
+ });
32301
+
31575
32302
  // ../component-lib/node_modules/path-is-absolute/index.js
31576
32303
  var require_path_is_absolute = __commonJS({
31577
32304
  "../component-lib/node_modules/path-is-absolute/index.js"(exports, module2) {
@@ -31607,7 +32334,7 @@ var require_common = __commonJS({
31607
32334
  }
31608
32335
  var fs = require("fs");
31609
32336
  var path = require("path");
31610
- var minimatch = require_minimatch();
32337
+ var minimatch = require_minimatch2();
31611
32338
  var isAbsolute = require_path_is_absolute();
31612
32339
  var Minimatch = minimatch.Minimatch;
31613
32340
  function alphasort(a, b) {
@@ -31792,7 +32519,7 @@ var require_sync = __commonJS({
31792
32519
  module2.exports = globSync;
31793
32520
  globSync.GlobSync = GlobSync;
31794
32521
  var rp = require_fs2();
31795
- var minimatch = require_minimatch();
32522
+ var minimatch = require_minimatch2();
31796
32523
  var Minimatch = minimatch.Minimatch;
31797
32524
  var Glob = require_glob().Glob;
31798
32525
  var util = require("util");
@@ -32266,7 +32993,7 @@ var require_glob = __commonJS({
32266
32993
  "../component-lib/node_modules/glob/glob.js"(exports, module2) {
32267
32994
  module2.exports = glob;
32268
32995
  var rp = require_fs2();
32269
- var minimatch = require_minimatch();
32996
+ var minimatch = require_minimatch2();
32270
32997
  var Minimatch = minimatch.Minimatch;
32271
32998
  var inherits = require_inherits();
32272
32999
  var EE = require("events").EventEmitter;