vitest 0.0.98 → 0.0.99

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.
@@ -1,15 +1,16 @@
1
- import { i as isAbsolute, r as relative, d as dirname, b as basename, a as resolve } from './index-1488b423.js';
1
+ import { c, g as getNames, s as slash$1, a as getTests, i as isAbsolute, r as relative, d as dirname, b as basename, f as getSuites, h as resolve, n as noop$1, t as toArray, j as hasFailed } from './utils-b780070b.js';
2
2
  import { createServer, mergeConfig } from 'vite';
3
- import path$2 from 'path';
3
+ import path$a from 'path';
4
4
  import process$1 from 'process';
5
- import { promises } from 'fs';
6
- import fg from 'fast-glob';
7
- import require$$0 from 'util';
8
- import { d as defaultInclude, a as defaultExclude, b as defaultPort, c as distDir, e as configFiles } from './constants-e78c749a.js';
9
- import { c, g as getNames, s as slash, a as getTests, b as getSuites, n as noop, t as toArray, h as hasFailed } from './utils-70b78878.js';
5
+ import fs$8, { promises } from 'fs';
6
+ import require$$0 from 'os';
7
+ import require$$0$1 from 'util';
8
+ import require$$0$2 from 'stream';
9
+ import require$$2 from 'events';
10
+ import { d as defaultInclude, a as defaultExclude, b as defaultPort, c as distDir, e as configFiles } from './constants-3cbd9066.js';
10
11
  import { performance } from 'perf_hooks';
11
- import { s as stringWidth, a as ansiStyles, b as stripAnsi, c as sliceAnsi, F as F_POINTER, d as F_DOWN, e as F_LONG_DASH, f as F_DOWN_RIGHT, g as F_DOT, h as F_CHECK, i as F_CROSS, j as cliTruncate, k as F_RIGHT, p as printError } from './error-2437ee7f.js';
12
- import { o as onetime, s as signalExit } from './index-5cc247ff.js';
12
+ import { s as stringWidth, a as ansiStyles, b as stripAnsi, c as sliceAnsi, F as F_POINTER, d as F_DOWN, e as F_LONG_DASH, f as F_DOWN_RIGHT, g as F_DOT, h as F_CHECK, i as F_CROSS, j as cliTruncate, k as F_RIGHT, p as printError } from './error-34c1d9e5.js';
13
+ import { o as onetime, s as signalExit } from './index-825cb54c.js';
13
14
  import { MessageChannel } from 'worker_threads';
14
15
  import { pathToFileURL } from 'url';
15
16
  import { Tinypool } from 'tinypool';
@@ -227,7 +228,7 @@ async function locatePath(
227
228
 
228
229
  return pLocate(paths, async path_ => {
229
230
  try {
230
- const stat = await statFunction(path$2.resolve(cwd, path_));
231
+ const stat = await statFunction(path$a.resolve(cwd, path_));
231
232
  return matchType(type, stat);
232
233
  } catch {
233
234
  return false;
@@ -238,9 +239,9 @@ async function locatePath(
238
239
  const findUpStop = Symbol('findUpStop');
239
240
 
240
241
  async function findUpMultiple(name, options = {}) {
241
- let directory = path$2.resolve(options.cwd || '');
242
- const {root} = path$2.parse(directory);
243
- const stopAt = path$2.resolve(directory, options.stopAt || root);
242
+ let directory = path$a.resolve(options.cwd || '');
243
+ const {root} = path$a.parse(directory);
244
+ const stopAt = path$a.resolve(directory, options.stopAt || root);
244
245
  const limit = options.limit || Number.POSITIVE_INFINITY;
245
246
  const paths = [name].flat();
246
247
 
@@ -268,14 +269,14 @@ async function findUpMultiple(name, options = {}) {
268
269
  }
269
270
 
270
271
  if (foundPath) {
271
- matches.push(path$2.resolve(directory, foundPath));
272
+ matches.push(path$a.resolve(directory, foundPath));
272
273
  }
273
274
 
274
275
  if (directory === stopAt || matches.length >= limit) {
275
276
  break;
276
277
  }
277
278
 
278
- directory = path$2.dirname(directory);
279
+ directory = path$a.dirname(directory);
279
280
  }
280
281
 
281
282
  return matches;
@@ -286,7 +287,315 @@ async function findUp(name, options = {}) {
286
287
  return matches[0];
287
288
  }
288
289
 
289
- var utils$8 = {};
290
+ var tasks = {};
291
+
292
+ var utils$k = {};
293
+
294
+ var array$1 = {};
295
+
296
+ Object.defineProperty(array$1, "__esModule", { value: true });
297
+ array$1.splitWhen = array$1.flatten = void 0;
298
+ function flatten(items) {
299
+ return items.reduce((collection, item) => [].concat(collection, item), []);
300
+ }
301
+ array$1.flatten = flatten;
302
+ function splitWhen(items, predicate) {
303
+ const result = [[]];
304
+ let groupIndex = 0;
305
+ for (const item of items) {
306
+ if (predicate(item)) {
307
+ groupIndex++;
308
+ result[groupIndex] = [];
309
+ }
310
+ else {
311
+ result[groupIndex].push(item);
312
+ }
313
+ }
314
+ return result;
315
+ }
316
+ array$1.splitWhen = splitWhen;
317
+
318
+ var errno$1 = {};
319
+
320
+ Object.defineProperty(errno$1, "__esModule", { value: true });
321
+ errno$1.isEnoentCodeError = void 0;
322
+ function isEnoentCodeError(error) {
323
+ return error.code === 'ENOENT';
324
+ }
325
+ errno$1.isEnoentCodeError = isEnoentCodeError;
326
+
327
+ var fs$7 = {};
328
+
329
+ Object.defineProperty(fs$7, "__esModule", { value: true });
330
+ fs$7.createDirentFromStats = void 0;
331
+ class DirentFromStats$1 {
332
+ constructor(name, stats) {
333
+ this.name = name;
334
+ this.isBlockDevice = stats.isBlockDevice.bind(stats);
335
+ this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
336
+ this.isDirectory = stats.isDirectory.bind(stats);
337
+ this.isFIFO = stats.isFIFO.bind(stats);
338
+ this.isFile = stats.isFile.bind(stats);
339
+ this.isSocket = stats.isSocket.bind(stats);
340
+ this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
341
+ }
342
+ }
343
+ function createDirentFromStats$1(name, stats) {
344
+ return new DirentFromStats$1(name, stats);
345
+ }
346
+ fs$7.createDirentFromStats = createDirentFromStats$1;
347
+
348
+ var path$9 = {};
349
+
350
+ Object.defineProperty(path$9, "__esModule", { value: true });
351
+ path$9.removeLeadingDotSegment = path$9.escape = path$9.makeAbsolute = path$9.unixify = void 0;
352
+ const path$8 = path$a;
353
+ const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
354
+ const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;
355
+ /**
356
+ * Designed to work only with simple paths: `dir\\file`.
357
+ */
358
+ function unixify(filepath) {
359
+ return filepath.replace(/\\/g, '/');
360
+ }
361
+ path$9.unixify = unixify;
362
+ function makeAbsolute(cwd, filepath) {
363
+ return path$8.resolve(cwd, filepath);
364
+ }
365
+ path$9.makeAbsolute = makeAbsolute;
366
+ function escape(pattern) {
367
+ return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
368
+ }
369
+ path$9.escape = escape;
370
+ function removeLeadingDotSegment(entry) {
371
+ // We do not use `startsWith` because this is 10x slower than current implementation for some cases.
372
+ // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
373
+ if (entry.charAt(0) === '.') {
374
+ const secondCharactery = entry.charAt(1);
375
+ if (secondCharactery === '/' || secondCharactery === '\\') {
376
+ return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
377
+ }
378
+ }
379
+ return entry;
380
+ }
381
+ path$9.removeLeadingDotSegment = removeLeadingDotSegment;
382
+
383
+ var pattern$1 = {};
384
+
385
+ /*!
386
+ * is-extglob <https://github.com/jonschlinkert/is-extglob>
387
+ *
388
+ * Copyright (c) 2014-2016, Jon Schlinkert.
389
+ * Licensed under the MIT License.
390
+ */
391
+
392
+ var isExtglob$1 = function isExtglob(str) {
393
+ if (typeof str !== 'string' || str === '') {
394
+ return false;
395
+ }
396
+
397
+ var match;
398
+ while ((match = /(\\).|([@?!+*]\(.*\))/g.exec(str))) {
399
+ if (match[2]) return true;
400
+ str = str.slice(match.index + match[0].length);
401
+ }
402
+
403
+ return false;
404
+ };
405
+
406
+ /*!
407
+ * is-glob <https://github.com/jonschlinkert/is-glob>
408
+ *
409
+ * Copyright (c) 2014-2017, Jon Schlinkert.
410
+ * Released under the MIT License.
411
+ */
412
+
413
+ var isExtglob = isExtglob$1;
414
+ var chars = { '{': '}', '(': ')', '[': ']'};
415
+ var strictCheck = function(str) {
416
+ if (str[0] === '!') {
417
+ return true;
418
+ }
419
+ var index = 0;
420
+ var pipeIndex = -2;
421
+ var closeSquareIndex = -2;
422
+ var closeCurlyIndex = -2;
423
+ var closeParenIndex = -2;
424
+ var backSlashIndex = -2;
425
+ while (index < str.length) {
426
+ if (str[index] === '*') {
427
+ return true;
428
+ }
429
+
430
+ if (str[index + 1] === '?' && /[\].+)]/.test(str[index])) {
431
+ return true;
432
+ }
433
+
434
+ if (closeSquareIndex !== -1 && str[index] === '[' && str[index + 1] !== ']') {
435
+ if (closeSquareIndex < index) {
436
+ closeSquareIndex = str.indexOf(']', index);
437
+ }
438
+ if (closeSquareIndex > index) {
439
+ if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
440
+ return true;
441
+ }
442
+ backSlashIndex = str.indexOf('\\', index);
443
+ if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
444
+ return true;
445
+ }
446
+ }
447
+ }
448
+
449
+ if (closeCurlyIndex !== -1 && str[index] === '{' && str[index + 1] !== '}') {
450
+ closeCurlyIndex = str.indexOf('}', index);
451
+ if (closeCurlyIndex > index) {
452
+ backSlashIndex = str.indexOf('\\', index);
453
+ if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) {
454
+ return true;
455
+ }
456
+ }
457
+ }
458
+
459
+ if (closeParenIndex !== -1 && str[index] === '(' && str[index + 1] === '?' && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ')') {
460
+ closeParenIndex = str.indexOf(')', index);
461
+ if (closeParenIndex > index) {
462
+ backSlashIndex = str.indexOf('\\', index);
463
+ if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
464
+ return true;
465
+ }
466
+ }
467
+ }
468
+
469
+ if (pipeIndex !== -1 && str[index] === '(' && str[index + 1] !== '|') {
470
+ if (pipeIndex < index) {
471
+ pipeIndex = str.indexOf('|', index);
472
+ }
473
+ if (pipeIndex !== -1 && str[pipeIndex + 1] !== ')') {
474
+ closeParenIndex = str.indexOf(')', pipeIndex);
475
+ if (closeParenIndex > pipeIndex) {
476
+ backSlashIndex = str.indexOf('\\', pipeIndex);
477
+ if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
478
+ return true;
479
+ }
480
+ }
481
+ }
482
+ }
483
+
484
+ if (str[index] === '\\') {
485
+ var open = str[index + 1];
486
+ index += 2;
487
+ var close = chars[open];
488
+
489
+ if (close) {
490
+ var n = str.indexOf(close, index);
491
+ if (n !== -1) {
492
+ index = n + 1;
493
+ }
494
+ }
495
+
496
+ if (str[index] === '!') {
497
+ return true;
498
+ }
499
+ } else {
500
+ index++;
501
+ }
502
+ }
503
+ return false;
504
+ };
505
+
506
+ var relaxedCheck = function(str) {
507
+ if (str[0] === '!') {
508
+ return true;
509
+ }
510
+ var index = 0;
511
+ while (index < str.length) {
512
+ if (/[*?{}()[\]]/.test(str[index])) {
513
+ return true;
514
+ }
515
+
516
+ if (str[index] === '\\') {
517
+ var open = str[index + 1];
518
+ index += 2;
519
+ var close = chars[open];
520
+
521
+ if (close) {
522
+ var n = str.indexOf(close, index);
523
+ if (n !== -1) {
524
+ index = n + 1;
525
+ }
526
+ }
527
+
528
+ if (str[index] === '!') {
529
+ return true;
530
+ }
531
+ } else {
532
+ index++;
533
+ }
534
+ }
535
+ return false;
536
+ };
537
+
538
+ var isGlob$1 = function isGlob(str, options) {
539
+ if (typeof str !== 'string' || str === '') {
540
+ return false;
541
+ }
542
+
543
+ if (isExtglob(str)) {
544
+ return true;
545
+ }
546
+
547
+ var check = strictCheck;
548
+
549
+ // optionally relax check
550
+ if (options && options.strict === false) {
551
+ check = relaxedCheck;
552
+ }
553
+
554
+ return check(str);
555
+ };
556
+
557
+ var isGlob = isGlob$1;
558
+ var pathPosixDirname = path$a.posix.dirname;
559
+ var isWin32 = require$$0.platform() === 'win32';
560
+
561
+ var slash = '/';
562
+ var backslash = /\\/g;
563
+ var enclosure = /[\{\[].*[\}\]]$/;
564
+ var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
565
+ var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
566
+
567
+ /**
568
+ * @param {string} str
569
+ * @param {Object} opts
570
+ * @param {boolean} [opts.flipBackslashes=true]
571
+ * @returns {string}
572
+ */
573
+ var globParent$1 = function globParent(str, opts) {
574
+ var options = Object.assign({ flipBackslashes: true }, opts);
575
+
576
+ // flip windows path separators
577
+ if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
578
+ str = str.replace(backslash, slash);
579
+ }
580
+
581
+ // special case for strings ending in enclosure containing path separator
582
+ if (enclosure.test(str)) {
583
+ str += slash;
584
+ }
585
+
586
+ // preserves full path in case of trailing path separator
587
+ str += 'a';
588
+
589
+ // remove path parts that are globby
590
+ do {
591
+ str = pathPosixDirname(str);
592
+ } while (isGlob(str) || globby.test(str));
593
+
594
+ // remove escape chars and return result
595
+ return str.replace(escaped, '$1');
596
+ };
597
+
598
+ var utils$j = {};
290
599
 
291
600
  (function (exports) {
292
601
 
@@ -400,18 +709,18 @@ exports.flatten = (...args) => {
400
709
  flat(args);
401
710
  return result;
402
711
  };
403
- }(utils$8));
712
+ }(utils$j));
404
713
 
405
- const utils$7 = utils$8;
714
+ const utils$i = utils$j;
406
715
 
407
716
  var stringify$4 = (ast, options = {}) => {
408
717
  let stringify = (node, parent = {}) => {
409
- let invalidBlock = options.escapeInvalid && utils$7.isInvalidBrace(parent);
718
+ let invalidBlock = options.escapeInvalid && utils$i.isInvalidBrace(parent);
410
719
  let invalidNode = node.invalid === true && options.escapeInvalid === true;
411
720
  let output = '';
412
721
 
413
722
  if (node.value) {
414
- if ((invalidBlock || invalidNode) && utils$7.isOpenOrClose(node)) {
723
+ if ((invalidBlock || invalidNode) && utils$i.isOpenOrClose(node)) {
415
724
  return '\\' + node.value;
416
725
  }
417
726
  return node.value;
@@ -743,7 +1052,7 @@ var toRegexRange_1 = toRegexRange$1;
743
1052
  * Licensed under the MIT License.
744
1053
  */
745
1054
 
746
- const util$1 = require$$0;
1055
+ const util$1 = require$$0$1;
747
1056
  const toRegexRange = toRegexRange_1;
748
1057
 
749
1058
  const isObject$1 = val => val !== null && typeof val === 'object' && !Array.isArray(val);
@@ -985,11 +1294,11 @@ const fill$2 = (start, end, step, options = {}) => {
985
1294
  var fillRange = fill$2;
986
1295
 
987
1296
  const fill$1 = fillRange;
988
- const utils$6 = utils$8;
1297
+ const utils$h = utils$j;
989
1298
 
990
1299
  const compile$1 = (ast, options = {}) => {
991
1300
  let walk = (node, parent = {}) => {
992
- let invalidBlock = utils$6.isInvalidBrace(parent);
1301
+ let invalidBlock = utils$h.isInvalidBrace(parent);
993
1302
  let invalidNode = node.invalid === true && options.escapeInvalid === true;
994
1303
  let invalid = invalidBlock === true || invalidNode === true;
995
1304
  let prefix = options.escapeInvalid === true ? '\\' : '';
@@ -1019,7 +1328,7 @@ const compile$1 = (ast, options = {}) => {
1019
1328
  }
1020
1329
 
1021
1330
  if (node.nodes && node.ranges > 0) {
1022
- let args = utils$6.reduce(node.nodes);
1331
+ let args = utils$h.reduce(node.nodes);
1023
1332
  let range = fill$1(...args, { ...options, wrap: false, toRegex: true });
1024
1333
 
1025
1334
  if (range.length !== 0) {
@@ -1042,7 +1351,7 @@ var compile_1 = compile$1;
1042
1351
 
1043
1352
  const fill = fillRange;
1044
1353
  const stringify$2 = stringify$4;
1045
- const utils$5 = utils$8;
1354
+ const utils$g = utils$j;
1046
1355
 
1047
1356
  const append = (queue = '', stash = '', enclose = false) => {
1048
1357
  let result = [];
@@ -1052,7 +1361,7 @@ const append = (queue = '', stash = '', enclose = false) => {
1052
1361
 
1053
1362
  if (!stash.length) return queue;
1054
1363
  if (!queue.length) {
1055
- return enclose ? utils$5.flatten(stash).map(ele => `{${ele}}`) : stash;
1364
+ return enclose ? utils$g.flatten(stash).map(ele => `{${ele}}`) : stash;
1056
1365
  }
1057
1366
 
1058
1367
  for (let item of queue) {
@@ -1067,7 +1376,7 @@ const append = (queue = '', stash = '', enclose = false) => {
1067
1376
  }
1068
1377
  }
1069
1378
  }
1070
- return utils$5.flatten(result);
1379
+ return utils$g.flatten(result);
1071
1380
  };
1072
1381
 
1073
1382
  const expand$1 = (ast, options = {}) => {
@@ -1095,9 +1404,9 @@ const expand$1 = (ast, options = {}) => {
1095
1404
  }
1096
1405
 
1097
1406
  if (node.nodes && node.ranges > 0) {
1098
- let args = utils$5.reduce(node.nodes);
1407
+ let args = utils$g.reduce(node.nodes);
1099
1408
 
1100
- if (utils$5.exceedsLimit(...args, options.step, rangeLimit)) {
1409
+ if (utils$g.exceedsLimit(...args, options.step, rangeLimit)) {
1101
1410
  throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
1102
1411
  }
1103
1412
 
@@ -1111,7 +1420,7 @@ const expand$1 = (ast, options = {}) => {
1111
1420
  return;
1112
1421
  }
1113
1422
 
1114
- let enclose = utils$5.encloseBrace(node);
1423
+ let enclose = utils$g.encloseBrace(node);
1115
1424
  let queue = node.queue;
1116
1425
  let block = node;
1117
1426
 
@@ -1147,12 +1456,12 @@ const expand$1 = (ast, options = {}) => {
1147
1456
  return queue;
1148
1457
  };
1149
1458
 
1150
- return utils$5.flatten(walk(ast));
1459
+ return utils$g.flatten(walk(ast));
1151
1460
  };
1152
1461
 
1153
1462
  var expand_1 = expand$1;
1154
1463
 
1155
- var constants$3 = {
1464
+ var constants$4 = {
1156
1465
  MAX_LENGTH: 1024 * 64,
1157
1466
 
1158
1467
  // Digits
@@ -1230,7 +1539,7 @@ const {
1230
1539
  CHAR_SINGLE_QUOTE, /* ' */
1231
1540
  CHAR_NO_BREAK_SPACE,
1232
1541
  CHAR_ZERO_WIDTH_NOBREAK_SPACE
1233
- } = constants$3;
1542
+ } = constants$4;
1234
1543
 
1235
1544
  /**
1236
1545
  * parse
@@ -1706,9 +2015,9 @@ braces$1.create = (input, options = {}) => {
1706
2015
 
1707
2016
  var braces_1 = braces$1;
1708
2017
 
1709
- var utils$4 = {};
2018
+ var utils$f = {};
1710
2019
 
1711
- const path$1 = path$2;
2020
+ const path$7 = path$a;
1712
2021
  const WIN_SLASH = '\\\\/';
1713
2022
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
1714
2023
 
@@ -1791,7 +2100,7 @@ const POSIX_REGEX_SOURCE$1 = {
1791
2100
  xdigit: 'A-Fa-f0-9'
1792
2101
  };
1793
2102
 
1794
- var constants$2 = {
2103
+ var constants$3 = {
1795
2104
  MAX_LENGTH: 1024 * 64,
1796
2105
  POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
1797
2106
 
@@ -1861,7 +2170,7 @@ var constants$2 = {
1861
2170
  CHAR_VERTICAL_LINE: 124, /* | */
1862
2171
  CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
1863
2172
 
1864
- SEP: path$1.sep,
2173
+ SEP: path$7.sep,
1865
2174
 
1866
2175
  /**
1867
2176
  * Create EXTGLOB_CHARS
@@ -1888,14 +2197,14 @@ var constants$2 = {
1888
2197
 
1889
2198
  (function (exports) {
1890
2199
 
1891
- const path = path$2;
2200
+ const path = path$a;
1892
2201
  const win32 = process.platform === 'win32';
1893
2202
  const {
1894
2203
  REGEX_BACKSLASH,
1895
2204
  REGEX_REMOVE_BACKSLASH,
1896
2205
  REGEX_SPECIAL_CHARS,
1897
2206
  REGEX_SPECIAL_CHARS_GLOBAL
1898
- } = constants$2;
2207
+ } = constants$3;
1899
2208
 
1900
2209
  exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
1901
2210
  exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
@@ -1950,9 +2259,9 @@ exports.wrapOutput = (input, state = {}, options = {}) => {
1950
2259
  }
1951
2260
  return output;
1952
2261
  };
1953
- }(utils$4));
2262
+ }(utils$f));
1954
2263
 
1955
- const utils$3 = utils$4;
2264
+ const utils$e = utils$f;
1956
2265
  const {
1957
2266
  CHAR_ASTERISK, /* * */
1958
2267
  CHAR_AT, /* @ */
@@ -1969,7 +2278,7 @@ const {
1969
2278
  CHAR_RIGHT_CURLY_BRACE, /* } */
1970
2279
  CHAR_RIGHT_PARENTHESES, /* ) */
1971
2280
  CHAR_RIGHT_SQUARE_BRACKET /* ] */
1972
- } = constants$2;
2281
+ } = constants$3;
1973
2282
 
1974
2283
  const isPathSeparator = code => {
1975
2284
  return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
@@ -2269,10 +2578,10 @@ const scan$1 = (input, options) => {
2269
2578
  }
2270
2579
 
2271
2580
  if (opts.unescape === true) {
2272
- if (glob) glob = utils$3.removeBackslashes(glob);
2581
+ if (glob) glob = utils$e.removeBackslashes(glob);
2273
2582
 
2274
2583
  if (base && backslashes === true) {
2275
- base = utils$3.removeBackslashes(base);
2584
+ base = utils$e.removeBackslashes(base);
2276
2585
  }
2277
2586
  }
2278
2587
 
@@ -2342,8 +2651,8 @@ const scan$1 = (input, options) => {
2342
2651
 
2343
2652
  var scan_1 = scan$1;
2344
2653
 
2345
- const constants$1 = constants$2;
2346
- const utils$2 = utils$4;
2654
+ const constants$2 = constants$3;
2655
+ const utils$d = utils$f;
2347
2656
 
2348
2657
  /**
2349
2658
  * Constants
@@ -2355,7 +2664,7 @@ const {
2355
2664
  REGEX_NON_SPECIAL_CHARS,
2356
2665
  REGEX_SPECIAL_CHARS_BACKREF,
2357
2666
  REPLACEMENTS
2358
- } = constants$1;
2667
+ } = constants$2;
2359
2668
 
2360
2669
  /**
2361
2670
  * Helpers
@@ -2373,7 +2682,7 @@ const expandRange = (args, options) => {
2373
2682
  /* eslint-disable-next-line no-new */
2374
2683
  new RegExp(value);
2375
2684
  } catch (ex) {
2376
- return args.map(v => utils$2.escapeRegex(v)).join('..');
2685
+ return args.map(v => utils$d.escapeRegex(v)).join('..');
2377
2686
  }
2378
2687
 
2379
2688
  return value;
@@ -2413,11 +2722,11 @@ const parse$1 = (input, options) => {
2413
2722
  const tokens = [bos];
2414
2723
 
2415
2724
  const capture = opts.capture ? '' : '?:';
2416
- const win32 = utils$2.isWindows(options);
2725
+ const win32 = utils$d.isWindows(options);
2417
2726
 
2418
2727
  // create constants based on platform, for windows or posix
2419
- const PLATFORM_CHARS = constants$1.globChars(win32);
2420
- const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS);
2728
+ const PLATFORM_CHARS = constants$2.globChars(win32);
2729
+ const EXTGLOB_CHARS = constants$2.extglobChars(PLATFORM_CHARS);
2421
2730
 
2422
2731
  const {
2423
2732
  DOT_LITERAL,
@@ -2469,7 +2778,7 @@ const parse$1 = (input, options) => {
2469
2778
  tokens
2470
2779
  };
2471
2780
 
2472
- input = utils$2.removePrefix(input, state);
2781
+ input = utils$d.removePrefix(input, state);
2473
2782
  len = input.length;
2474
2783
 
2475
2784
  const extglobs = [];
@@ -2655,7 +2964,7 @@ const parse$1 = (input, options) => {
2655
2964
  return state;
2656
2965
  }
2657
2966
 
2658
- state.output = utils$2.wrapOutput(output, state, options);
2967
+ state.output = utils$d.wrapOutput(output, state, options);
2659
2968
  return state;
2660
2969
  }
2661
2970
 
@@ -2768,7 +3077,7 @@ const parse$1 = (input, options) => {
2768
3077
  */
2769
3078
 
2770
3079
  if (state.quotes === 1 && value !== '"') {
2771
- value = utils$2.escapeRegex(value);
3080
+ value = utils$d.escapeRegex(value);
2772
3081
  prev.value += value;
2773
3082
  append({ value });
2774
3083
  continue;
@@ -2858,11 +3167,11 @@ const parse$1 = (input, options) => {
2858
3167
 
2859
3168
  // when literal brackets are explicitly disabled
2860
3169
  // assume we should match with a regex character class
2861
- if (opts.literalBrackets === false || utils$2.hasRegexChars(prevValue)) {
3170
+ if (opts.literalBrackets === false || utils$d.hasRegexChars(prevValue)) {
2862
3171
  continue;
2863
3172
  }
2864
3173
 
2865
- const escaped = utils$2.escapeRegex(prev.value);
3174
+ const escaped = utils$d.escapeRegex(prev.value);
2866
3175
  state.output = state.output.slice(0, -prev.value.length);
2867
3176
 
2868
3177
  // when literal brackets are explicitly enabled
@@ -3034,7 +3343,7 @@ const parse$1 = (input, options) => {
3034
3343
  const next = peek();
3035
3344
  let output = value;
3036
3345
 
3037
- if (next === '<' && !utils$2.supportsLookbehinds()) {
3346
+ if (next === '<' && !utils$d.supportsLookbehinds()) {
3038
3347
  throw new Error('Node.js v10 or higher is required for regex lookbehinds');
3039
3348
  }
3040
3349
 
@@ -3294,19 +3603,19 @@ const parse$1 = (input, options) => {
3294
3603
 
3295
3604
  while (state.brackets > 0) {
3296
3605
  if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
3297
- state.output = utils$2.escapeLast(state.output, '[');
3606
+ state.output = utils$d.escapeLast(state.output, '[');
3298
3607
  decrement('brackets');
3299
3608
  }
3300
3609
 
3301
3610
  while (state.parens > 0) {
3302
3611
  if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
3303
- state.output = utils$2.escapeLast(state.output, '(');
3612
+ state.output = utils$d.escapeLast(state.output, '(');
3304
3613
  decrement('parens');
3305
3614
  }
3306
3615
 
3307
3616
  while (state.braces > 0) {
3308
3617
  if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
3309
- state.output = utils$2.escapeLast(state.output, '{');
3618
+ state.output = utils$d.escapeLast(state.output, '{');
3310
3619
  decrement('braces');
3311
3620
  }
3312
3621
 
@@ -3345,7 +3654,7 @@ parse$1.fastpaths = (input, options) => {
3345
3654
  }
3346
3655
 
3347
3656
  input = REPLACEMENTS[input] || input;
3348
- const win32 = utils$2.isWindows(options);
3657
+ const win32 = utils$d.isWindows(options);
3349
3658
 
3350
3659
  // create constants based on platform, for windows or posix
3351
3660
  const {
@@ -3358,7 +3667,7 @@ parse$1.fastpaths = (input, options) => {
3358
3667
  NO_DOTS_SLASH,
3359
3668
  STAR,
3360
3669
  START_ANCHOR
3361
- } = constants$1.globChars(win32);
3670
+ } = constants$2.globChars(win32);
3362
3671
 
3363
3672
  const nodot = opts.dot ? NO_DOTS : NO_DOT;
3364
3673
  const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
@@ -3413,7 +3722,7 @@ parse$1.fastpaths = (input, options) => {
3413
3722
  }
3414
3723
  };
3415
3724
 
3416
- const output = utils$2.removePrefix(input, state);
3725
+ const output = utils$d.removePrefix(input, state);
3417
3726
  let source = create(output);
3418
3727
 
3419
3728
  if (source && opts.strictSlashes !== true) {
@@ -3425,11 +3734,11 @@ parse$1.fastpaths = (input, options) => {
3425
3734
 
3426
3735
  var parse_1 = parse$1;
3427
3736
 
3428
- const path = path$2;
3737
+ const path$6 = path$a;
3429
3738
  const scan = scan_1;
3430
3739
  const parse = parse_1;
3431
- const utils$1 = utils$4;
3432
- const constants = constants$2;
3740
+ const utils$c = utils$f;
3741
+ const constants$1 = constants$3;
3433
3742
  const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
3434
3743
 
3435
3744
  /**
@@ -3474,7 +3783,7 @@ const picomatch$2 = (glob, options, returnState = false) => {
3474
3783
  }
3475
3784
 
3476
3785
  const opts = options || {};
3477
- const posix = utils$1.isWindows(options);
3786
+ const posix = utils$c.isWindows(options);
3478
3787
  const regex = isState
3479
3788
  ? picomatch$2.compileRe(glob, options)
3480
3789
  : picomatch$2.makeRe(glob, options, false, true);
@@ -3549,7 +3858,7 @@ picomatch$2.test = (input, regex, options, { glob, posix } = {}) => {
3549
3858
  }
3550
3859
 
3551
3860
  const opts = options || {};
3552
- const format = opts.format || (posix ? utils$1.toPosixSlashes : null);
3861
+ const format = opts.format || (posix ? utils$c.toPosixSlashes : null);
3553
3862
  let match = input === glob;
3554
3863
  let output = (match && format) ? format(input) : input;
3555
3864
 
@@ -3583,9 +3892,9 @@ picomatch$2.test = (input, regex, options, { glob, posix } = {}) => {
3583
3892
  * @api public
3584
3893
  */
3585
3894
 
3586
- picomatch$2.matchBase = (input, glob, options, posix = utils$1.isWindows(options)) => {
3895
+ picomatch$2.matchBase = (input, glob, options, posix = utils$c.isWindows(options)) => {
3587
3896
  const regex = glob instanceof RegExp ? glob : picomatch$2.makeRe(glob, options);
3588
- return regex.test(path.basename(input));
3897
+ return regex.test(path$6.basename(input));
3589
3898
  };
3590
3899
 
3591
3900
  /**
@@ -3758,7 +4067,7 @@ picomatch$2.toRegex = (source, options) => {
3758
4067
  * @return {Object}
3759
4068
  */
3760
4069
 
3761
- picomatch$2.constants = constants;
4070
+ picomatch$2.constants = constants$1;
3762
4071
 
3763
4072
  /**
3764
4073
  * Expose "picomatch"
@@ -3768,10 +4077,10 @@ var picomatch_1 = picomatch$2;
3768
4077
 
3769
4078
  var picomatch$1 = picomatch_1;
3770
4079
 
3771
- const util = require$$0;
4080
+ const util = require$$0$1;
3772
4081
  const braces = braces_1;
3773
4082
  const picomatch = picomatch$1;
3774
- const utils = utils$4;
4083
+ const utils$b = utils$f;
3775
4084
  const isEmptyString = val => val === '' || val === './';
3776
4085
 
3777
4086
  /**
@@ -3792,7 +4101,7 @@ const isEmptyString = val => val === '' || val === './';
3792
4101
  * @api public
3793
4102
  */
3794
4103
 
3795
- const micromatch = (list, patterns, options) => {
4104
+ const micromatch$1 = (list, patterns, options) => {
3796
4105
  patterns = [].concat(patterns);
3797
4106
  list = [].concat(list);
3798
4107
 
@@ -3848,7 +4157,7 @@ const micromatch = (list, patterns, options) => {
3848
4157
  * Backwards compatibility
3849
4158
  */
3850
4159
 
3851
- micromatch.match = micromatch;
4160
+ micromatch$1.match = micromatch$1;
3852
4161
 
3853
4162
  /**
3854
4163
  * Returns a matcher function from the given glob `pattern` and `options`.
@@ -3869,7 +4178,7 @@ micromatch.match = micromatch;
3869
4178
  * @api public
3870
4179
  */
3871
4180
 
3872
- micromatch.matcher = (pattern, options) => picomatch(pattern, options);
4181
+ micromatch$1.matcher = (pattern, options) => picomatch(pattern, options);
3873
4182
 
3874
4183
  /**
3875
4184
  * Returns true if **any** of the given glob `patterns` match the specified `string`.
@@ -3888,13 +4197,13 @@ micromatch.matcher = (pattern, options) => picomatch(pattern, options);
3888
4197
  * @api public
3889
4198
  */
3890
4199
 
3891
- micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
4200
+ micromatch$1.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
3892
4201
 
3893
4202
  /**
3894
4203
  * Backwards compatibility
3895
4204
  */
3896
4205
 
3897
- micromatch.any = micromatch.isMatch;
4206
+ micromatch$1.any = micromatch$1.isMatch;
3898
4207
 
3899
4208
  /**
3900
4209
  * Returns a list of strings that _**do not match any**_ of the given `patterns`.
@@ -3913,7 +4222,7 @@ micromatch.any = micromatch.isMatch;
3913
4222
  * @api public
3914
4223
  */
3915
4224
 
3916
- micromatch.not = (list, patterns, options = {}) => {
4225
+ micromatch$1.not = (list, patterns, options = {}) => {
3917
4226
  patterns = [].concat(patterns).map(String);
3918
4227
  let result = new Set();
3919
4228
  let items = [];
@@ -3923,7 +4232,7 @@ micromatch.not = (list, patterns, options = {}) => {
3923
4232
  items.push(state.output);
3924
4233
  };
3925
4234
 
3926
- let matches = micromatch(list, patterns, { ...options, onResult });
4235
+ let matches = micromatch$1(list, patterns, { ...options, onResult });
3927
4236
 
3928
4237
  for (let item of items) {
3929
4238
  if (!matches.includes(item)) {
@@ -3953,13 +4262,13 @@ micromatch.not = (list, patterns, options = {}) => {
3953
4262
  * @api public
3954
4263
  */
3955
4264
 
3956
- micromatch.contains = (str, pattern, options) => {
4265
+ micromatch$1.contains = (str, pattern, options) => {
3957
4266
  if (typeof str !== 'string') {
3958
4267
  throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
3959
4268
  }
3960
4269
 
3961
4270
  if (Array.isArray(pattern)) {
3962
- return pattern.some(p => micromatch.contains(str, p, options));
4271
+ return pattern.some(p => micromatch$1.contains(str, p, options));
3963
4272
  }
3964
4273
 
3965
4274
  if (typeof pattern === 'string') {
@@ -3972,7 +4281,7 @@ micromatch.contains = (str, pattern, options) => {
3972
4281
  }
3973
4282
  }
3974
4283
 
3975
- return micromatch.isMatch(str, pattern, { ...options, contains: true });
4284
+ return micromatch$1.isMatch(str, pattern, { ...options, contains: true });
3976
4285
  };
3977
4286
 
3978
4287
  /**
@@ -3995,11 +4304,11 @@ micromatch.contains = (str, pattern, options) => {
3995
4304
  * @api public
3996
4305
  */
3997
4306
 
3998
- micromatch.matchKeys = (obj, patterns, options) => {
3999
- if (!utils.isObject(obj)) {
4307
+ micromatch$1.matchKeys = (obj, patterns, options) => {
4308
+ if (!utils$b.isObject(obj)) {
4000
4309
  throw new TypeError('Expected the first argument to be an object');
4001
4310
  }
4002
- let keys = micromatch(Object.keys(obj), patterns, options);
4311
+ let keys = micromatch$1(Object.keys(obj), patterns, options);
4003
4312
  let res = {};
4004
4313
  for (let key of keys) res[key] = obj[key];
4005
4314
  return res;
@@ -4024,7 +4333,7 @@ micromatch.matchKeys = (obj, patterns, options) => {
4024
4333
  * @api public
4025
4334
  */
4026
4335
 
4027
- micromatch.some = (list, patterns, options) => {
4336
+ micromatch$1.some = (list, patterns, options) => {
4028
4337
  let items = [].concat(list);
4029
4338
 
4030
4339
  for (let pattern of [].concat(patterns)) {
@@ -4060,7 +4369,7 @@ micromatch.some = (list, patterns, options) => {
4060
4369
  * @api public
4061
4370
  */
4062
4371
 
4063
- micromatch.every = (list, patterns, options) => {
4372
+ micromatch$1.every = (list, patterns, options) => {
4064
4373
  let items = [].concat(list);
4065
4374
 
4066
4375
  for (let pattern of [].concat(patterns)) {
@@ -4099,7 +4408,7 @@ micromatch.every = (list, patterns, options) => {
4099
4408
  * @api public
4100
4409
  */
4101
4410
 
4102
- micromatch.all = (str, patterns, options) => {
4411
+ micromatch$1.all = (str, patterns, options) => {
4103
4412
  if (typeof str !== 'string') {
4104
4413
  throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
4105
4414
  }
@@ -4126,10 +4435,10 @@ micromatch.all = (str, patterns, options) => {
4126
4435
  * @api public
4127
4436
  */
4128
4437
 
4129
- micromatch.capture = (glob, input, options) => {
4130
- let posix = utils.isWindows(options);
4438
+ micromatch$1.capture = (glob, input, options) => {
4439
+ let posix = utils$b.isWindows(options);
4131
4440
  let regex = picomatch.makeRe(String(glob), { ...options, capture: true });
4132
- let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
4441
+ let match = regex.exec(posix ? utils$b.toPosixSlashes(input) : input);
4133
4442
 
4134
4443
  if (match) {
4135
4444
  return match.slice(1).map(v => v === void 0 ? '' : v);
@@ -4152,7 +4461,7 @@ micromatch.capture = (glob, input, options) => {
4152
4461
  * @api public
4153
4462
  */
4154
4463
 
4155
- micromatch.makeRe = (...args) => picomatch.makeRe(...args);
4464
+ micromatch$1.makeRe = (...args) => picomatch.makeRe(...args);
4156
4465
 
4157
4466
  /**
4158
4467
  * Scan a glob pattern to separate the pattern into segments. Used
@@ -4168,7 +4477,7 @@ micromatch.makeRe = (...args) => picomatch.makeRe(...args);
4168
4477
  * @api public
4169
4478
  */
4170
4479
 
4171
- micromatch.scan = (...args) => picomatch.scan(...args);
4480
+ micromatch$1.scan = (...args) => picomatch.scan(...args);
4172
4481
 
4173
4482
  /**
4174
4483
  * Parse a glob pattern to create the source string for a regular
@@ -4184,7 +4493,7 @@ micromatch.scan = (...args) => picomatch.scan(...args);
4184
4493
  * @api public
4185
4494
  */
4186
4495
 
4187
- micromatch.parse = (patterns, options) => {
4496
+ micromatch$1.parse = (patterns, options) => {
4188
4497
  let res = [];
4189
4498
  for (let pattern of [].concat(patterns || [])) {
4190
4499
  for (let str of braces(String(pattern), options)) {
@@ -4211,7 +4520,7 @@ micromatch.parse = (patterns, options) => {
4211
4520
  * @api public
4212
4521
  */
4213
4522
 
4214
- micromatch.braces = (pattern, options) => {
4523
+ micromatch$1.braces = (pattern, options) => {
4215
4524
  if (typeof pattern !== 'string') throw new TypeError('Expected a string');
4216
4525
  if ((options && options.nobrace === true) || !/\{.*\}/.test(pattern)) {
4217
4526
  return [pattern];
@@ -4223,16 +4532,2168 @@ micromatch.braces = (pattern, options) => {
4223
4532
  * Expand braces
4224
4533
  */
4225
4534
 
4226
- micromatch.braceExpand = (pattern, options) => {
4535
+ micromatch$1.braceExpand = (pattern, options) => {
4227
4536
  if (typeof pattern !== 'string') throw new TypeError('Expected a string');
4228
- return micromatch.braces(pattern, { ...options, expand: true });
4537
+ return micromatch$1.braces(pattern, { ...options, expand: true });
4229
4538
  };
4230
4539
 
4231
4540
  /**
4232
4541
  * Expose micromatch
4233
4542
  */
4234
4543
 
4235
- var micromatch_1 = micromatch;
4544
+ var micromatch_1 = micromatch$1;
4545
+
4546
+ Object.defineProperty(pattern$1, "__esModule", { value: true });
4547
+ pattern$1.matchAny = pattern$1.convertPatternsToRe = pattern$1.makeRe = pattern$1.getPatternParts = pattern$1.expandBraceExpansion = pattern$1.expandPatternsWithBraceExpansion = pattern$1.isAffectDepthOfReadingPattern = pattern$1.endsWithSlashGlobStar = pattern$1.hasGlobStar = pattern$1.getBaseDirectory = pattern$1.isPatternRelatedToParentDirectory = pattern$1.getPatternsOutsideCurrentDirectory = pattern$1.getPatternsInsideCurrentDirectory = pattern$1.getPositivePatterns = pattern$1.getNegativePatterns = pattern$1.isPositivePattern = pattern$1.isNegativePattern = pattern$1.convertToNegativePattern = pattern$1.convertToPositivePattern = pattern$1.isDynamicPattern = pattern$1.isStaticPattern = void 0;
4548
+ const path$5 = path$a;
4549
+ const globParent = globParent$1;
4550
+ const micromatch = micromatch_1;
4551
+ const GLOBSTAR = '**';
4552
+ const ESCAPE_SYMBOL = '\\';
4553
+ const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
4554
+ const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[.*]/;
4555
+ const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\(.*\|.*\)/;
4556
+ const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\(.*\)/;
4557
+ const BRACE_EXPANSIONS_SYMBOLS_RE = /{.*(?:,|\.\.).*}/;
4558
+ function isStaticPattern(pattern, options = {}) {
4559
+ return !isDynamicPattern(pattern, options);
4560
+ }
4561
+ pattern$1.isStaticPattern = isStaticPattern;
4562
+ function isDynamicPattern(pattern, options = {}) {
4563
+ /**
4564
+ * A special case with an empty string is necessary for matching patterns that start with a forward slash.
4565
+ * An empty string cannot be a dynamic pattern.
4566
+ * For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'.
4567
+ */
4568
+ if (pattern === '') {
4569
+ return false;
4570
+ }
4571
+ /**
4572
+ * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check
4573
+ * filepath directly (without read directory).
4574
+ */
4575
+ if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) {
4576
+ return true;
4577
+ }
4578
+ if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) {
4579
+ return true;
4580
+ }
4581
+ if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) {
4582
+ return true;
4583
+ }
4584
+ if (options.braceExpansion !== false && BRACE_EXPANSIONS_SYMBOLS_RE.test(pattern)) {
4585
+ return true;
4586
+ }
4587
+ return false;
4588
+ }
4589
+ pattern$1.isDynamicPattern = isDynamicPattern;
4590
+ function convertToPositivePattern(pattern) {
4591
+ return isNegativePattern(pattern) ? pattern.slice(1) : pattern;
4592
+ }
4593
+ pattern$1.convertToPositivePattern = convertToPositivePattern;
4594
+ function convertToNegativePattern(pattern) {
4595
+ return '!' + pattern;
4596
+ }
4597
+ pattern$1.convertToNegativePattern = convertToNegativePattern;
4598
+ function isNegativePattern(pattern) {
4599
+ return pattern.startsWith('!') && pattern[1] !== '(';
4600
+ }
4601
+ pattern$1.isNegativePattern = isNegativePattern;
4602
+ function isPositivePattern(pattern) {
4603
+ return !isNegativePattern(pattern);
4604
+ }
4605
+ pattern$1.isPositivePattern = isPositivePattern;
4606
+ function getNegativePatterns(patterns) {
4607
+ return patterns.filter(isNegativePattern);
4608
+ }
4609
+ pattern$1.getNegativePatterns = getNegativePatterns;
4610
+ function getPositivePatterns$1(patterns) {
4611
+ return patterns.filter(isPositivePattern);
4612
+ }
4613
+ pattern$1.getPositivePatterns = getPositivePatterns$1;
4614
+ /**
4615
+ * Returns patterns that can be applied inside the current directory.
4616
+ *
4617
+ * @example
4618
+ * // ['./*', '*', 'a/*']
4619
+ * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
4620
+ */
4621
+ function getPatternsInsideCurrentDirectory(patterns) {
4622
+ return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
4623
+ }
4624
+ pattern$1.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
4625
+ /**
4626
+ * Returns patterns to be expanded relative to (outside) the current directory.
4627
+ *
4628
+ * @example
4629
+ * // ['../*', './../*']
4630
+ * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
4631
+ */
4632
+ function getPatternsOutsideCurrentDirectory(patterns) {
4633
+ return patterns.filter(isPatternRelatedToParentDirectory);
4634
+ }
4635
+ pattern$1.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
4636
+ function isPatternRelatedToParentDirectory(pattern) {
4637
+ return pattern.startsWith('..') || pattern.startsWith('./..');
4638
+ }
4639
+ pattern$1.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
4640
+ function getBaseDirectory(pattern) {
4641
+ return globParent(pattern, { flipBackslashes: false });
4642
+ }
4643
+ pattern$1.getBaseDirectory = getBaseDirectory;
4644
+ function hasGlobStar(pattern) {
4645
+ return pattern.includes(GLOBSTAR);
4646
+ }
4647
+ pattern$1.hasGlobStar = hasGlobStar;
4648
+ function endsWithSlashGlobStar(pattern) {
4649
+ return pattern.endsWith('/' + GLOBSTAR);
4650
+ }
4651
+ pattern$1.endsWithSlashGlobStar = endsWithSlashGlobStar;
4652
+ function isAffectDepthOfReadingPattern(pattern) {
4653
+ const basename = path$5.basename(pattern);
4654
+ return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
4655
+ }
4656
+ pattern$1.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
4657
+ function expandPatternsWithBraceExpansion(patterns) {
4658
+ return patterns.reduce((collection, pattern) => {
4659
+ return collection.concat(expandBraceExpansion(pattern));
4660
+ }, []);
4661
+ }
4662
+ pattern$1.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
4663
+ function expandBraceExpansion(pattern) {
4664
+ return micromatch.braces(pattern, {
4665
+ expand: true,
4666
+ nodupes: true
4667
+ });
4668
+ }
4669
+ pattern$1.expandBraceExpansion = expandBraceExpansion;
4670
+ function getPatternParts(pattern, options) {
4671
+ let { parts } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true }));
4672
+ /**
4673
+ * The scan method returns an empty array in some cases.
4674
+ * See micromatch/picomatch#58 for more details.
4675
+ */
4676
+ if (parts.length === 0) {
4677
+ parts = [pattern];
4678
+ }
4679
+ /**
4680
+ * The scan method does not return an empty part for the pattern with a forward slash.
4681
+ * This is another part of micromatch/picomatch#58.
4682
+ */
4683
+ if (parts[0].startsWith('/')) {
4684
+ parts[0] = parts[0].slice(1);
4685
+ parts.unshift('');
4686
+ }
4687
+ return parts;
4688
+ }
4689
+ pattern$1.getPatternParts = getPatternParts;
4690
+ function makeRe(pattern, options) {
4691
+ return micromatch.makeRe(pattern, options);
4692
+ }
4693
+ pattern$1.makeRe = makeRe;
4694
+ function convertPatternsToRe(patterns, options) {
4695
+ return patterns.map((pattern) => makeRe(pattern, options));
4696
+ }
4697
+ pattern$1.convertPatternsToRe = convertPatternsToRe;
4698
+ function matchAny(entry, patternsRe) {
4699
+ return patternsRe.some((patternRe) => patternRe.test(entry));
4700
+ }
4701
+ pattern$1.matchAny = matchAny;
4702
+
4703
+ var stream$4 = {};
4704
+
4705
+ /*
4706
+ * merge2
4707
+ * https://github.com/teambition/merge2
4708
+ *
4709
+ * Copyright (c) 2014-2020 Teambition
4710
+ * Licensed under the MIT license.
4711
+ */
4712
+ const Stream = require$$0$2;
4713
+ const PassThrough = Stream.PassThrough;
4714
+ const slice = Array.prototype.slice;
4715
+
4716
+ var merge2_1 = merge2$1;
4717
+
4718
+ function merge2$1 () {
4719
+ const streamsQueue = [];
4720
+ const args = slice.call(arguments);
4721
+ let merging = false;
4722
+ let options = args[args.length - 1];
4723
+
4724
+ if (options && !Array.isArray(options) && options.pipe == null) {
4725
+ args.pop();
4726
+ } else {
4727
+ options = {};
4728
+ }
4729
+
4730
+ const doEnd = options.end !== false;
4731
+ const doPipeError = options.pipeError === true;
4732
+ if (options.objectMode == null) {
4733
+ options.objectMode = true;
4734
+ }
4735
+ if (options.highWaterMark == null) {
4736
+ options.highWaterMark = 64 * 1024;
4737
+ }
4738
+ const mergedStream = PassThrough(options);
4739
+
4740
+ function addStream () {
4741
+ for (let i = 0, len = arguments.length; i < len; i++) {
4742
+ streamsQueue.push(pauseStreams(arguments[i], options));
4743
+ }
4744
+ mergeStream();
4745
+ return this
4746
+ }
4747
+
4748
+ function mergeStream () {
4749
+ if (merging) {
4750
+ return
4751
+ }
4752
+ merging = true;
4753
+
4754
+ let streams = streamsQueue.shift();
4755
+ if (!streams) {
4756
+ process.nextTick(endStream);
4757
+ return
4758
+ }
4759
+ if (!Array.isArray(streams)) {
4760
+ streams = [streams];
4761
+ }
4762
+
4763
+ let pipesCount = streams.length + 1;
4764
+
4765
+ function next () {
4766
+ if (--pipesCount > 0) {
4767
+ return
4768
+ }
4769
+ merging = false;
4770
+ mergeStream();
4771
+ }
4772
+
4773
+ function pipe (stream) {
4774
+ function onend () {
4775
+ stream.removeListener('merge2UnpipeEnd', onend);
4776
+ stream.removeListener('end', onend);
4777
+ if (doPipeError) {
4778
+ stream.removeListener('error', onerror);
4779
+ }
4780
+ next();
4781
+ }
4782
+ function onerror (err) {
4783
+ mergedStream.emit('error', err);
4784
+ }
4785
+ // skip ended stream
4786
+ if (stream._readableState.endEmitted) {
4787
+ return next()
4788
+ }
4789
+
4790
+ stream.on('merge2UnpipeEnd', onend);
4791
+ stream.on('end', onend);
4792
+
4793
+ if (doPipeError) {
4794
+ stream.on('error', onerror);
4795
+ }
4796
+
4797
+ stream.pipe(mergedStream, { end: false });
4798
+ // compatible for old stream
4799
+ stream.resume();
4800
+ }
4801
+
4802
+ for (let i = 0; i < streams.length; i++) {
4803
+ pipe(streams[i]);
4804
+ }
4805
+
4806
+ next();
4807
+ }
4808
+
4809
+ function endStream () {
4810
+ merging = false;
4811
+ // emit 'queueDrain' when all streams merged.
4812
+ mergedStream.emit('queueDrain');
4813
+ if (doEnd) {
4814
+ mergedStream.end();
4815
+ }
4816
+ }
4817
+
4818
+ mergedStream.setMaxListeners(0);
4819
+ mergedStream.add = addStream;
4820
+ mergedStream.on('unpipe', function (stream) {
4821
+ stream.emit('merge2UnpipeEnd');
4822
+ });
4823
+
4824
+ if (args.length) {
4825
+ addStream.apply(null, args);
4826
+ }
4827
+ return mergedStream
4828
+ }
4829
+
4830
+ // check and pause streams for pipe.
4831
+ function pauseStreams (streams, options) {
4832
+ if (!Array.isArray(streams)) {
4833
+ // Backwards-compat with old-style streams
4834
+ if (!streams._readableState && streams.pipe) {
4835
+ streams = streams.pipe(PassThrough(options));
4836
+ }
4837
+ if (!streams._readableState || !streams.pause || !streams.pipe) {
4838
+ throw new Error('Only readable stream can be merged.')
4839
+ }
4840
+ streams.pause();
4841
+ } else {
4842
+ for (let i = 0, len = streams.length; i < len; i++) {
4843
+ streams[i] = pauseStreams(streams[i], options);
4844
+ }
4845
+ }
4846
+ return streams
4847
+ }
4848
+
4849
+ Object.defineProperty(stream$4, "__esModule", { value: true });
4850
+ stream$4.merge = void 0;
4851
+ const merge2 = merge2_1;
4852
+ function merge(streams) {
4853
+ const mergedStream = merge2(streams);
4854
+ streams.forEach((stream) => {
4855
+ stream.once('error', (error) => mergedStream.emit('error', error));
4856
+ });
4857
+ mergedStream.once('close', () => propagateCloseEventToSources(streams));
4858
+ mergedStream.once('end', () => propagateCloseEventToSources(streams));
4859
+ return mergedStream;
4860
+ }
4861
+ stream$4.merge = merge;
4862
+ function propagateCloseEventToSources(streams) {
4863
+ streams.forEach((stream) => stream.emit('close'));
4864
+ }
4865
+
4866
+ var string$1 = {};
4867
+
4868
+ Object.defineProperty(string$1, "__esModule", { value: true });
4869
+ string$1.isEmpty = string$1.isString = void 0;
4870
+ function isString(input) {
4871
+ return typeof input === 'string';
4872
+ }
4873
+ string$1.isString = isString;
4874
+ function isEmpty(input) {
4875
+ return input === '';
4876
+ }
4877
+ string$1.isEmpty = isEmpty;
4878
+
4879
+ Object.defineProperty(utils$k, "__esModule", { value: true });
4880
+ utils$k.string = utils$k.stream = utils$k.pattern = utils$k.path = utils$k.fs = utils$k.errno = utils$k.array = void 0;
4881
+ const array = array$1;
4882
+ utils$k.array = array;
4883
+ const errno = errno$1;
4884
+ utils$k.errno = errno;
4885
+ const fs$6 = fs$7;
4886
+ utils$k.fs = fs$6;
4887
+ const path$4 = path$9;
4888
+ utils$k.path = path$4;
4889
+ const pattern = pattern$1;
4890
+ utils$k.pattern = pattern;
4891
+ const stream$3 = stream$4;
4892
+ utils$k.stream = stream$3;
4893
+ const string = string$1;
4894
+ utils$k.string = string;
4895
+
4896
+ Object.defineProperty(tasks, "__esModule", { value: true });
4897
+ tasks.convertPatternGroupToTask = tasks.convertPatternGroupsToTasks = tasks.groupPatternsByBaseDirectory = tasks.getNegativePatternsAsPositive = tasks.getPositivePatterns = tasks.convertPatternsToTasks = tasks.generate = void 0;
4898
+ const utils$a = utils$k;
4899
+ function generate(patterns, settings) {
4900
+ const positivePatterns = getPositivePatterns(patterns);
4901
+ const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore);
4902
+ const staticPatterns = positivePatterns.filter((pattern) => utils$a.pattern.isStaticPattern(pattern, settings));
4903
+ const dynamicPatterns = positivePatterns.filter((pattern) => utils$a.pattern.isDynamicPattern(pattern, settings));
4904
+ const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false);
4905
+ const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true);
4906
+ return staticTasks.concat(dynamicTasks);
4907
+ }
4908
+ tasks.generate = generate;
4909
+ /**
4910
+ * Returns tasks grouped by basic pattern directories.
4911
+ *
4912
+ * Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
4913
+ * This is necessary because directory traversal starts at the base directory and goes deeper.
4914
+ */
4915
+ function convertPatternsToTasks(positive, negative, dynamic) {
4916
+ const tasks = [];
4917
+ const patternsOutsideCurrentDirectory = utils$a.pattern.getPatternsOutsideCurrentDirectory(positive);
4918
+ const patternsInsideCurrentDirectory = utils$a.pattern.getPatternsInsideCurrentDirectory(positive);
4919
+ const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
4920
+ const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
4921
+ tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
4922
+ /*
4923
+ * For the sake of reducing future accesses to the file system, we merge all tasks within the current directory
4924
+ * into a global task, if at least one pattern refers to the root (`.`). In this case, the global task covers the rest.
4925
+ */
4926
+ if ('.' in insideCurrentDirectoryGroup) {
4927
+ tasks.push(convertPatternGroupToTask('.', patternsInsideCurrentDirectory, negative, dynamic));
4928
+ }
4929
+ else {
4930
+ tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
4931
+ }
4932
+ return tasks;
4933
+ }
4934
+ tasks.convertPatternsToTasks = convertPatternsToTasks;
4935
+ function getPositivePatterns(patterns) {
4936
+ return utils$a.pattern.getPositivePatterns(patterns);
4937
+ }
4938
+ tasks.getPositivePatterns = getPositivePatterns;
4939
+ function getNegativePatternsAsPositive(patterns, ignore) {
4940
+ const negative = utils$a.pattern.getNegativePatterns(patterns).concat(ignore);
4941
+ const positive = negative.map(utils$a.pattern.convertToPositivePattern);
4942
+ return positive;
4943
+ }
4944
+ tasks.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
4945
+ function groupPatternsByBaseDirectory(patterns) {
4946
+ const group = {};
4947
+ return patterns.reduce((collection, pattern) => {
4948
+ const base = utils$a.pattern.getBaseDirectory(pattern);
4949
+ if (base in collection) {
4950
+ collection[base].push(pattern);
4951
+ }
4952
+ else {
4953
+ collection[base] = [pattern];
4954
+ }
4955
+ return collection;
4956
+ }, group);
4957
+ }
4958
+ tasks.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
4959
+ function convertPatternGroupsToTasks(positive, negative, dynamic) {
4960
+ return Object.keys(positive).map((base) => {
4961
+ return convertPatternGroupToTask(base, positive[base], negative, dynamic);
4962
+ });
4963
+ }
4964
+ tasks.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
4965
+ function convertPatternGroupToTask(base, positive, negative, dynamic) {
4966
+ return {
4967
+ dynamic,
4968
+ positive,
4969
+ negative,
4970
+ base,
4971
+ patterns: [].concat(positive, negative.map(utils$a.pattern.convertToNegativePattern))
4972
+ };
4973
+ }
4974
+ tasks.convertPatternGroupToTask = convertPatternGroupToTask;
4975
+
4976
+ var async$6 = {};
4977
+
4978
+ var stream$2 = {};
4979
+
4980
+ var out$3 = {};
4981
+
4982
+ var async$5 = {};
4983
+
4984
+ Object.defineProperty(async$5, "__esModule", { value: true });
4985
+ async$5.read = void 0;
4986
+ function read$3(path, settings, callback) {
4987
+ settings.fs.lstat(path, (lstatError, lstat) => {
4988
+ if (lstatError !== null) {
4989
+ return callFailureCallback$2(callback, lstatError);
4990
+ }
4991
+ if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
4992
+ return callSuccessCallback$2(callback, lstat);
4993
+ }
4994
+ settings.fs.stat(path, (statError, stat) => {
4995
+ if (statError !== null) {
4996
+ if (settings.throwErrorOnBrokenSymbolicLink) {
4997
+ return callFailureCallback$2(callback, statError);
4998
+ }
4999
+ return callSuccessCallback$2(callback, lstat);
5000
+ }
5001
+ if (settings.markSymbolicLink) {
5002
+ stat.isSymbolicLink = () => true;
5003
+ }
5004
+ callSuccessCallback$2(callback, stat);
5005
+ });
5006
+ });
5007
+ }
5008
+ async$5.read = read$3;
5009
+ function callFailureCallback$2(callback, error) {
5010
+ callback(error);
5011
+ }
5012
+ function callSuccessCallback$2(callback, result) {
5013
+ callback(null, result);
5014
+ }
5015
+
5016
+ var sync$7 = {};
5017
+
5018
+ Object.defineProperty(sync$7, "__esModule", { value: true });
5019
+ sync$7.read = void 0;
5020
+ function read$2(path, settings) {
5021
+ const lstat = settings.fs.lstatSync(path);
5022
+ if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
5023
+ return lstat;
5024
+ }
5025
+ try {
5026
+ const stat = settings.fs.statSync(path);
5027
+ if (settings.markSymbolicLink) {
5028
+ stat.isSymbolicLink = () => true;
5029
+ }
5030
+ return stat;
5031
+ }
5032
+ catch (error) {
5033
+ if (!settings.throwErrorOnBrokenSymbolicLink) {
5034
+ return lstat;
5035
+ }
5036
+ throw error;
5037
+ }
5038
+ }
5039
+ sync$7.read = read$2;
5040
+
5041
+ var settings$3 = {};
5042
+
5043
+ var fs$5 = {};
5044
+
5045
+ (function (exports) {
5046
+ Object.defineProperty(exports, "__esModule", { value: true });
5047
+ exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
5048
+ const fs = fs$8;
5049
+ exports.FILE_SYSTEM_ADAPTER = {
5050
+ lstat: fs.lstat,
5051
+ stat: fs.stat,
5052
+ lstatSync: fs.lstatSync,
5053
+ statSync: fs.statSync
5054
+ };
5055
+ function createFileSystemAdapter(fsMethods) {
5056
+ if (fsMethods === undefined) {
5057
+ return exports.FILE_SYSTEM_ADAPTER;
5058
+ }
5059
+ return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
5060
+ }
5061
+ exports.createFileSystemAdapter = createFileSystemAdapter;
5062
+ }(fs$5));
5063
+
5064
+ Object.defineProperty(settings$3, "__esModule", { value: true });
5065
+ const fs$4 = fs$5;
5066
+ class Settings$2 {
5067
+ constructor(_options = {}) {
5068
+ this._options = _options;
5069
+ this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
5070
+ this.fs = fs$4.createFileSystemAdapter(this._options.fs);
5071
+ this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
5072
+ this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
5073
+ }
5074
+ _getValue(option, value) {
5075
+ return option !== null && option !== void 0 ? option : value;
5076
+ }
5077
+ }
5078
+ settings$3.default = Settings$2;
5079
+
5080
+ Object.defineProperty(out$3, "__esModule", { value: true });
5081
+ out$3.statSync = out$3.stat = out$3.Settings = void 0;
5082
+ const async$4 = async$5;
5083
+ const sync$6 = sync$7;
5084
+ const settings_1$3 = settings$3;
5085
+ out$3.Settings = settings_1$3.default;
5086
+ function stat(path, optionsOrSettingsOrCallback, callback) {
5087
+ if (typeof optionsOrSettingsOrCallback === 'function') {
5088
+ return async$4.read(path, getSettings$2(), optionsOrSettingsOrCallback);
5089
+ }
5090
+ async$4.read(path, getSettings$2(optionsOrSettingsOrCallback), callback);
5091
+ }
5092
+ out$3.stat = stat;
5093
+ function statSync(path, optionsOrSettings) {
5094
+ const settings = getSettings$2(optionsOrSettings);
5095
+ return sync$6.read(path, settings);
5096
+ }
5097
+ out$3.statSync = statSync;
5098
+ function getSettings$2(settingsOrOptions = {}) {
5099
+ if (settingsOrOptions instanceof settings_1$3.default) {
5100
+ return settingsOrOptions;
5101
+ }
5102
+ return new settings_1$3.default(settingsOrOptions);
5103
+ }
5104
+
5105
+ var out$2 = {};
5106
+
5107
+ var async$3 = {};
5108
+
5109
+ var async$2 = {};
5110
+
5111
+ var out$1 = {};
5112
+
5113
+ var async$1 = {};
5114
+
5115
+ /*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
5116
+
5117
+ let promise;
5118
+
5119
+ var queueMicrotask_1 = typeof queueMicrotask === 'function'
5120
+ ? queueMicrotask.bind(globalThis)
5121
+ // reuse resolved promise, and allocate it lazily
5122
+ : cb => (promise || (promise = Promise.resolve()))
5123
+ .then(cb)
5124
+ .catch(err => setTimeout(() => { throw err }, 0));
5125
+
5126
+ /*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
5127
+
5128
+ var runParallel_1 = runParallel;
5129
+
5130
+ const queueMicrotask$1 = queueMicrotask_1;
5131
+
5132
+ function runParallel (tasks, cb) {
5133
+ let results, pending, keys;
5134
+ let isSync = true;
5135
+
5136
+ if (Array.isArray(tasks)) {
5137
+ results = [];
5138
+ pending = tasks.length;
5139
+ } else {
5140
+ keys = Object.keys(tasks);
5141
+ results = {};
5142
+ pending = keys.length;
5143
+ }
5144
+
5145
+ function done (err) {
5146
+ function end () {
5147
+ if (cb) cb(err, results);
5148
+ cb = null;
5149
+ }
5150
+ if (isSync) queueMicrotask$1(end);
5151
+ else end();
5152
+ }
5153
+
5154
+ function each (i, err, result) {
5155
+ results[i] = result;
5156
+ if (--pending === 0 || err) {
5157
+ done(err);
5158
+ }
5159
+ }
5160
+
5161
+ if (!pending) {
5162
+ // empty
5163
+ done(null);
5164
+ } else if (keys) {
5165
+ // object
5166
+ keys.forEach(function (key) {
5167
+ tasks[key](function (err, result) { each(key, err, result); });
5168
+ });
5169
+ } else {
5170
+ // array
5171
+ tasks.forEach(function (task, i) {
5172
+ task(function (err, result) { each(i, err, result); });
5173
+ });
5174
+ }
5175
+
5176
+ isSync = false;
5177
+ }
5178
+
5179
+ var constants = {};
5180
+
5181
+ Object.defineProperty(constants, "__esModule", { value: true });
5182
+ constants.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
5183
+ const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.');
5184
+ const MAJOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
5185
+ const MINOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
5186
+ const SUPPORTED_MAJOR_VERSION = 10;
5187
+ const SUPPORTED_MINOR_VERSION = 10;
5188
+ const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION;
5189
+ const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION;
5190
+ /**
5191
+ * IS `true` for Node.js 10.10 and greater.
5192
+ */
5193
+ constants.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
5194
+
5195
+ var utils$9 = {};
5196
+
5197
+ var fs$3 = {};
5198
+
5199
+ Object.defineProperty(fs$3, "__esModule", { value: true });
5200
+ fs$3.createDirentFromStats = void 0;
5201
+ class DirentFromStats {
5202
+ constructor(name, stats) {
5203
+ this.name = name;
5204
+ this.isBlockDevice = stats.isBlockDevice.bind(stats);
5205
+ this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
5206
+ this.isDirectory = stats.isDirectory.bind(stats);
5207
+ this.isFIFO = stats.isFIFO.bind(stats);
5208
+ this.isFile = stats.isFile.bind(stats);
5209
+ this.isSocket = stats.isSocket.bind(stats);
5210
+ this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
5211
+ }
5212
+ }
5213
+ function createDirentFromStats(name, stats) {
5214
+ return new DirentFromStats(name, stats);
5215
+ }
5216
+ fs$3.createDirentFromStats = createDirentFromStats;
5217
+
5218
+ Object.defineProperty(utils$9, "__esModule", { value: true });
5219
+ utils$9.fs = void 0;
5220
+ const fs$2 = fs$3;
5221
+ utils$9.fs = fs$2;
5222
+
5223
+ var common$6 = {};
5224
+
5225
+ Object.defineProperty(common$6, "__esModule", { value: true });
5226
+ common$6.joinPathSegments = void 0;
5227
+ function joinPathSegments$1(a, b, separator) {
5228
+ /**
5229
+ * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
5230
+ */
5231
+ if (a.endsWith(separator)) {
5232
+ return a + b;
5233
+ }
5234
+ return a + separator + b;
5235
+ }
5236
+ common$6.joinPathSegments = joinPathSegments$1;
5237
+
5238
+ Object.defineProperty(async$1, "__esModule", { value: true });
5239
+ async$1.readdir = async$1.readdirWithFileTypes = async$1.read = void 0;
5240
+ const fsStat$5 = out$3;
5241
+ const rpl = runParallel_1;
5242
+ const constants_1$1 = constants;
5243
+ const utils$8 = utils$9;
5244
+ const common$5 = common$6;
5245
+ function read$1(directory, settings, callback) {
5246
+ if (!settings.stats && constants_1$1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
5247
+ return readdirWithFileTypes$1(directory, settings, callback);
5248
+ }
5249
+ return readdir$1(directory, settings, callback);
5250
+ }
5251
+ async$1.read = read$1;
5252
+ function readdirWithFileTypes$1(directory, settings, callback) {
5253
+ settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
5254
+ if (readdirError !== null) {
5255
+ return callFailureCallback$1(callback, readdirError);
5256
+ }
5257
+ const entries = dirents.map((dirent) => ({
5258
+ dirent,
5259
+ name: dirent.name,
5260
+ path: common$5.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
5261
+ }));
5262
+ if (!settings.followSymbolicLinks) {
5263
+ return callSuccessCallback$1(callback, entries);
5264
+ }
5265
+ const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings));
5266
+ rpl(tasks, (rplError, rplEntries) => {
5267
+ if (rplError !== null) {
5268
+ return callFailureCallback$1(callback, rplError);
5269
+ }
5270
+ callSuccessCallback$1(callback, rplEntries);
5271
+ });
5272
+ });
5273
+ }
5274
+ async$1.readdirWithFileTypes = readdirWithFileTypes$1;
5275
+ function makeRplTaskEntry(entry, settings) {
5276
+ return (done) => {
5277
+ if (!entry.dirent.isSymbolicLink()) {
5278
+ return done(null, entry);
5279
+ }
5280
+ settings.fs.stat(entry.path, (statError, stats) => {
5281
+ if (statError !== null) {
5282
+ if (settings.throwErrorOnBrokenSymbolicLink) {
5283
+ return done(statError);
5284
+ }
5285
+ return done(null, entry);
5286
+ }
5287
+ entry.dirent = utils$8.fs.createDirentFromStats(entry.name, stats);
5288
+ return done(null, entry);
5289
+ });
5290
+ };
5291
+ }
5292
+ function readdir$1(directory, settings, callback) {
5293
+ settings.fs.readdir(directory, (readdirError, names) => {
5294
+ if (readdirError !== null) {
5295
+ return callFailureCallback$1(callback, readdirError);
5296
+ }
5297
+ const filepaths = names.map((name) => common$5.joinPathSegments(directory, name, settings.pathSegmentSeparator));
5298
+ const tasks = filepaths.map((filepath) => {
5299
+ return (done) => fsStat$5.stat(filepath, settings.fsStatSettings, done);
5300
+ });
5301
+ rpl(tasks, (rplError, results) => {
5302
+ if (rplError !== null) {
5303
+ return callFailureCallback$1(callback, rplError);
5304
+ }
5305
+ const entries = [];
5306
+ names.forEach((name, index) => {
5307
+ const stats = results[index];
5308
+ const entry = {
5309
+ name,
5310
+ path: filepaths[index],
5311
+ dirent: utils$8.fs.createDirentFromStats(name, stats)
5312
+ };
5313
+ if (settings.stats) {
5314
+ entry.stats = stats;
5315
+ }
5316
+ entries.push(entry);
5317
+ });
5318
+ callSuccessCallback$1(callback, entries);
5319
+ });
5320
+ });
5321
+ }
5322
+ async$1.readdir = readdir$1;
5323
+ function callFailureCallback$1(callback, error) {
5324
+ callback(error);
5325
+ }
5326
+ function callSuccessCallback$1(callback, result) {
5327
+ callback(null, result);
5328
+ }
5329
+
5330
+ var sync$5 = {};
5331
+
5332
+ Object.defineProperty(sync$5, "__esModule", { value: true });
5333
+ sync$5.readdir = sync$5.readdirWithFileTypes = sync$5.read = void 0;
5334
+ const fsStat$4 = out$3;
5335
+ const constants_1 = constants;
5336
+ const utils$7 = utils$9;
5337
+ const common$4 = common$6;
5338
+ function read(directory, settings) {
5339
+ if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
5340
+ return readdirWithFileTypes(directory, settings);
5341
+ }
5342
+ return readdir(directory, settings);
5343
+ }
5344
+ sync$5.read = read;
5345
+ function readdirWithFileTypes(directory, settings) {
5346
+ const dirents = settings.fs.readdirSync(directory, { withFileTypes: true });
5347
+ return dirents.map((dirent) => {
5348
+ const entry = {
5349
+ dirent,
5350
+ name: dirent.name,
5351
+ path: common$4.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
5352
+ };
5353
+ if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
5354
+ try {
5355
+ const stats = settings.fs.statSync(entry.path);
5356
+ entry.dirent = utils$7.fs.createDirentFromStats(entry.name, stats);
5357
+ }
5358
+ catch (error) {
5359
+ if (settings.throwErrorOnBrokenSymbolicLink) {
5360
+ throw error;
5361
+ }
5362
+ }
5363
+ }
5364
+ return entry;
5365
+ });
5366
+ }
5367
+ sync$5.readdirWithFileTypes = readdirWithFileTypes;
5368
+ function readdir(directory, settings) {
5369
+ const names = settings.fs.readdirSync(directory);
5370
+ return names.map((name) => {
5371
+ const entryPath = common$4.joinPathSegments(directory, name, settings.pathSegmentSeparator);
5372
+ const stats = fsStat$4.statSync(entryPath, settings.fsStatSettings);
5373
+ const entry = {
5374
+ name,
5375
+ path: entryPath,
5376
+ dirent: utils$7.fs.createDirentFromStats(name, stats)
5377
+ };
5378
+ if (settings.stats) {
5379
+ entry.stats = stats;
5380
+ }
5381
+ return entry;
5382
+ });
5383
+ }
5384
+ sync$5.readdir = readdir;
5385
+
5386
+ var settings$2 = {};
5387
+
5388
+ var fs$1 = {};
5389
+
5390
+ (function (exports) {
5391
+ Object.defineProperty(exports, "__esModule", { value: true });
5392
+ exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
5393
+ const fs = fs$8;
5394
+ exports.FILE_SYSTEM_ADAPTER = {
5395
+ lstat: fs.lstat,
5396
+ stat: fs.stat,
5397
+ lstatSync: fs.lstatSync,
5398
+ statSync: fs.statSync,
5399
+ readdir: fs.readdir,
5400
+ readdirSync: fs.readdirSync
5401
+ };
5402
+ function createFileSystemAdapter(fsMethods) {
5403
+ if (fsMethods === undefined) {
5404
+ return exports.FILE_SYSTEM_ADAPTER;
5405
+ }
5406
+ return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
5407
+ }
5408
+ exports.createFileSystemAdapter = createFileSystemAdapter;
5409
+ }(fs$1));
5410
+
5411
+ Object.defineProperty(settings$2, "__esModule", { value: true });
5412
+ const path$3 = path$a;
5413
+ const fsStat$3 = out$3;
5414
+ const fs = fs$1;
5415
+ class Settings$1 {
5416
+ constructor(_options = {}) {
5417
+ this._options = _options;
5418
+ this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
5419
+ this.fs = fs.createFileSystemAdapter(this._options.fs);
5420
+ this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$3.sep);
5421
+ this.stats = this._getValue(this._options.stats, false);
5422
+ this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
5423
+ this.fsStatSettings = new fsStat$3.Settings({
5424
+ followSymbolicLink: this.followSymbolicLinks,
5425
+ fs: this.fs,
5426
+ throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
5427
+ });
5428
+ }
5429
+ _getValue(option, value) {
5430
+ return option !== null && option !== void 0 ? option : value;
5431
+ }
5432
+ }
5433
+ settings$2.default = Settings$1;
5434
+
5435
+ Object.defineProperty(out$1, "__esModule", { value: true });
5436
+ out$1.Settings = out$1.scandirSync = out$1.scandir = void 0;
5437
+ const async = async$1;
5438
+ const sync$4 = sync$5;
5439
+ const settings_1$2 = settings$2;
5440
+ out$1.Settings = settings_1$2.default;
5441
+ function scandir(path, optionsOrSettingsOrCallback, callback) {
5442
+ if (typeof optionsOrSettingsOrCallback === 'function') {
5443
+ return async.read(path, getSettings$1(), optionsOrSettingsOrCallback);
5444
+ }
5445
+ async.read(path, getSettings$1(optionsOrSettingsOrCallback), callback);
5446
+ }
5447
+ out$1.scandir = scandir;
5448
+ function scandirSync(path, optionsOrSettings) {
5449
+ const settings = getSettings$1(optionsOrSettings);
5450
+ return sync$4.read(path, settings);
5451
+ }
5452
+ out$1.scandirSync = scandirSync;
5453
+ function getSettings$1(settingsOrOptions = {}) {
5454
+ if (settingsOrOptions instanceof settings_1$2.default) {
5455
+ return settingsOrOptions;
5456
+ }
5457
+ return new settings_1$2.default(settingsOrOptions);
5458
+ }
5459
+
5460
+ function reusify$1 (Constructor) {
5461
+ var head = new Constructor();
5462
+ var tail = head;
5463
+
5464
+ function get () {
5465
+ var current = head;
5466
+
5467
+ if (current.next) {
5468
+ head = current.next;
5469
+ } else {
5470
+ head = new Constructor();
5471
+ tail = head;
5472
+ }
5473
+
5474
+ current.next = null;
5475
+
5476
+ return current
5477
+ }
5478
+
5479
+ function release (obj) {
5480
+ tail.next = obj;
5481
+ tail = obj;
5482
+ }
5483
+
5484
+ return {
5485
+ get: get,
5486
+ release: release
5487
+ }
5488
+ }
5489
+
5490
+ var reusify_1 = reusify$1;
5491
+
5492
+ var reusify = reusify_1;
5493
+
5494
+ function fastqueue (context, worker, concurrency) {
5495
+ if (typeof context === 'function') {
5496
+ concurrency = worker;
5497
+ worker = context;
5498
+ context = null;
5499
+ }
5500
+
5501
+ if (concurrency < 1) {
5502
+ throw new Error('fastqueue concurrency must be greater than 1')
5503
+ }
5504
+
5505
+ var cache = reusify(Task);
5506
+ var queueHead = null;
5507
+ var queueTail = null;
5508
+ var _running = 0;
5509
+ var errorHandler = null;
5510
+
5511
+ var self = {
5512
+ push: push,
5513
+ drain: noop,
5514
+ saturated: noop,
5515
+ pause: pause,
5516
+ paused: false,
5517
+ concurrency: concurrency,
5518
+ running: running,
5519
+ resume: resume,
5520
+ idle: idle,
5521
+ length: length,
5522
+ getQueue: getQueue,
5523
+ unshift: unshift,
5524
+ empty: noop,
5525
+ kill: kill,
5526
+ killAndDrain: killAndDrain,
5527
+ error: error
5528
+ };
5529
+
5530
+ return self
5531
+
5532
+ function running () {
5533
+ return _running
5534
+ }
5535
+
5536
+ function pause () {
5537
+ self.paused = true;
5538
+ }
5539
+
5540
+ function length () {
5541
+ var current = queueHead;
5542
+ var counter = 0;
5543
+
5544
+ while (current) {
5545
+ current = current.next;
5546
+ counter++;
5547
+ }
5548
+
5549
+ return counter
5550
+ }
5551
+
5552
+ function getQueue () {
5553
+ var current = queueHead;
5554
+ var tasks = [];
5555
+
5556
+ while (current) {
5557
+ tasks.push(current.value);
5558
+ current = current.next;
5559
+ }
5560
+
5561
+ return tasks
5562
+ }
5563
+
5564
+ function resume () {
5565
+ if (!self.paused) return
5566
+ self.paused = false;
5567
+ for (var i = 0; i < self.concurrency; i++) {
5568
+ _running++;
5569
+ release();
5570
+ }
5571
+ }
5572
+
5573
+ function idle () {
5574
+ return _running === 0 && self.length() === 0
5575
+ }
5576
+
5577
+ function push (value, done) {
5578
+ var current = cache.get();
5579
+
5580
+ current.context = context;
5581
+ current.release = release;
5582
+ current.value = value;
5583
+ current.callback = done || noop;
5584
+ current.errorHandler = errorHandler;
5585
+
5586
+ if (_running === self.concurrency || self.paused) {
5587
+ if (queueTail) {
5588
+ queueTail.next = current;
5589
+ queueTail = current;
5590
+ } else {
5591
+ queueHead = current;
5592
+ queueTail = current;
5593
+ self.saturated();
5594
+ }
5595
+ } else {
5596
+ _running++;
5597
+ worker.call(context, current.value, current.worked);
5598
+ }
5599
+ }
5600
+
5601
+ function unshift (value, done) {
5602
+ var current = cache.get();
5603
+
5604
+ current.context = context;
5605
+ current.release = release;
5606
+ current.value = value;
5607
+ current.callback = done || noop;
5608
+
5609
+ if (_running === self.concurrency || self.paused) {
5610
+ if (queueHead) {
5611
+ current.next = queueHead;
5612
+ queueHead = current;
5613
+ } else {
5614
+ queueHead = current;
5615
+ queueTail = current;
5616
+ self.saturated();
5617
+ }
5618
+ } else {
5619
+ _running++;
5620
+ worker.call(context, current.value, current.worked);
5621
+ }
5622
+ }
5623
+
5624
+ function release (holder) {
5625
+ if (holder) {
5626
+ cache.release(holder);
5627
+ }
5628
+ var next = queueHead;
5629
+ if (next) {
5630
+ if (!self.paused) {
5631
+ if (queueTail === queueHead) {
5632
+ queueTail = null;
5633
+ }
5634
+ queueHead = next.next;
5635
+ next.next = null;
5636
+ worker.call(context, next.value, next.worked);
5637
+ if (queueTail === null) {
5638
+ self.empty();
5639
+ }
5640
+ } else {
5641
+ _running--;
5642
+ }
5643
+ } else if (--_running === 0) {
5644
+ self.drain();
5645
+ }
5646
+ }
5647
+
5648
+ function kill () {
5649
+ queueHead = null;
5650
+ queueTail = null;
5651
+ self.drain = noop;
5652
+ }
5653
+
5654
+ function killAndDrain () {
5655
+ queueHead = null;
5656
+ queueTail = null;
5657
+ self.drain();
5658
+ self.drain = noop;
5659
+ }
5660
+
5661
+ function error (handler) {
5662
+ errorHandler = handler;
5663
+ }
5664
+ }
5665
+
5666
+ function noop () {}
5667
+
5668
+ function Task () {
5669
+ this.value = null;
5670
+ this.callback = noop;
5671
+ this.next = null;
5672
+ this.release = noop;
5673
+ this.context = null;
5674
+ this.errorHandler = null;
5675
+
5676
+ var self = this;
5677
+
5678
+ this.worked = function worked (err, result) {
5679
+ var callback = self.callback;
5680
+ var errorHandler = self.errorHandler;
5681
+ var val = self.value;
5682
+ self.value = null;
5683
+ self.callback = noop;
5684
+ if (self.errorHandler) {
5685
+ errorHandler(err, val);
5686
+ }
5687
+ callback.call(self.context, err, result);
5688
+ self.release(self);
5689
+ };
5690
+ }
5691
+
5692
+ var queue = fastqueue;
5693
+
5694
+ var common$3 = {};
5695
+
5696
+ Object.defineProperty(common$3, "__esModule", { value: true });
5697
+ common$3.joinPathSegments = common$3.replacePathSegmentSeparator = common$3.isAppliedFilter = common$3.isFatalError = void 0;
5698
+ function isFatalError(settings, error) {
5699
+ if (settings.errorFilter === null) {
5700
+ return true;
5701
+ }
5702
+ return !settings.errorFilter(error);
5703
+ }
5704
+ common$3.isFatalError = isFatalError;
5705
+ function isAppliedFilter(filter, value) {
5706
+ return filter === null || filter(value);
5707
+ }
5708
+ common$3.isAppliedFilter = isAppliedFilter;
5709
+ function replacePathSegmentSeparator(filepath, separator) {
5710
+ return filepath.split(/[/\\]/).join(separator);
5711
+ }
5712
+ common$3.replacePathSegmentSeparator = replacePathSegmentSeparator;
5713
+ function joinPathSegments(a, b, separator) {
5714
+ if (a === '') {
5715
+ return b;
5716
+ }
5717
+ /**
5718
+ * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
5719
+ */
5720
+ if (a.endsWith(separator)) {
5721
+ return a + b;
5722
+ }
5723
+ return a + separator + b;
5724
+ }
5725
+ common$3.joinPathSegments = joinPathSegments;
5726
+
5727
+ var reader$1 = {};
5728
+
5729
+ Object.defineProperty(reader$1, "__esModule", { value: true });
5730
+ const common$2 = common$3;
5731
+ class Reader$1 {
5732
+ constructor(_root, _settings) {
5733
+ this._root = _root;
5734
+ this._settings = _settings;
5735
+ this._root = common$2.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
5736
+ }
5737
+ }
5738
+ reader$1.default = Reader$1;
5739
+
5740
+ Object.defineProperty(async$2, "__esModule", { value: true });
5741
+ const events_1 = require$$2;
5742
+ const fsScandir$2 = out$1;
5743
+ const fastq = queue;
5744
+ const common$1 = common$3;
5745
+ const reader_1$3 = reader$1;
5746
+ class AsyncReader extends reader_1$3.default {
5747
+ constructor(_root, _settings) {
5748
+ super(_root, _settings);
5749
+ this._settings = _settings;
5750
+ this._scandir = fsScandir$2.scandir;
5751
+ this._emitter = new events_1.EventEmitter();
5752
+ this._queue = fastq(this._worker.bind(this), this._settings.concurrency);
5753
+ this._isFatalError = false;
5754
+ this._isDestroyed = false;
5755
+ this._queue.drain = () => {
5756
+ if (!this._isFatalError) {
5757
+ this._emitter.emit('end');
5758
+ }
5759
+ };
5760
+ }
5761
+ read() {
5762
+ this._isFatalError = false;
5763
+ this._isDestroyed = false;
5764
+ setImmediate(() => {
5765
+ this._pushToQueue(this._root, this._settings.basePath);
5766
+ });
5767
+ return this._emitter;
5768
+ }
5769
+ get isDestroyed() {
5770
+ return this._isDestroyed;
5771
+ }
5772
+ destroy() {
5773
+ if (this._isDestroyed) {
5774
+ throw new Error('The reader is already destroyed');
5775
+ }
5776
+ this._isDestroyed = true;
5777
+ this._queue.killAndDrain();
5778
+ }
5779
+ onEntry(callback) {
5780
+ this._emitter.on('entry', callback);
5781
+ }
5782
+ onError(callback) {
5783
+ this._emitter.once('error', callback);
5784
+ }
5785
+ onEnd(callback) {
5786
+ this._emitter.once('end', callback);
5787
+ }
5788
+ _pushToQueue(directory, base) {
5789
+ const queueItem = { directory, base };
5790
+ this._queue.push(queueItem, (error) => {
5791
+ if (error !== null) {
5792
+ this._handleError(error);
5793
+ }
5794
+ });
5795
+ }
5796
+ _worker(item, done) {
5797
+ this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => {
5798
+ if (error !== null) {
5799
+ return done(error, undefined);
5800
+ }
5801
+ for (const entry of entries) {
5802
+ this._handleEntry(entry, item.base);
5803
+ }
5804
+ done(null, undefined);
5805
+ });
5806
+ }
5807
+ _handleError(error) {
5808
+ if (this._isDestroyed || !common$1.isFatalError(this._settings, error)) {
5809
+ return;
5810
+ }
5811
+ this._isFatalError = true;
5812
+ this._isDestroyed = true;
5813
+ this._emitter.emit('error', error);
5814
+ }
5815
+ _handleEntry(entry, base) {
5816
+ if (this._isDestroyed || this._isFatalError) {
5817
+ return;
5818
+ }
5819
+ const fullpath = entry.path;
5820
+ if (base !== undefined) {
5821
+ entry.path = common$1.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
5822
+ }
5823
+ if (common$1.isAppliedFilter(this._settings.entryFilter, entry)) {
5824
+ this._emitEntry(entry);
5825
+ }
5826
+ if (entry.dirent.isDirectory() && common$1.isAppliedFilter(this._settings.deepFilter, entry)) {
5827
+ this._pushToQueue(fullpath, entry.path);
5828
+ }
5829
+ }
5830
+ _emitEntry(entry) {
5831
+ this._emitter.emit('entry', entry);
5832
+ }
5833
+ }
5834
+ async$2.default = AsyncReader;
5835
+
5836
+ Object.defineProperty(async$3, "__esModule", { value: true });
5837
+ const async_1$3 = async$2;
5838
+ class AsyncProvider {
5839
+ constructor(_root, _settings) {
5840
+ this._root = _root;
5841
+ this._settings = _settings;
5842
+ this._reader = new async_1$3.default(this._root, this._settings);
5843
+ this._storage = new Set();
5844
+ }
5845
+ read(callback) {
5846
+ this._reader.onError((error) => {
5847
+ callFailureCallback(callback, error);
5848
+ });
5849
+ this._reader.onEntry((entry) => {
5850
+ this._storage.add(entry);
5851
+ });
5852
+ this._reader.onEnd(() => {
5853
+ callSuccessCallback(callback, [...this._storage]);
5854
+ });
5855
+ this._reader.read();
5856
+ }
5857
+ }
5858
+ async$3.default = AsyncProvider;
5859
+ function callFailureCallback(callback, error) {
5860
+ callback(error);
5861
+ }
5862
+ function callSuccessCallback(callback, entries) {
5863
+ callback(null, entries);
5864
+ }
5865
+
5866
+ var stream$1 = {};
5867
+
5868
+ Object.defineProperty(stream$1, "__esModule", { value: true });
5869
+ const stream_1$5 = require$$0$2;
5870
+ const async_1$2 = async$2;
5871
+ class StreamProvider {
5872
+ constructor(_root, _settings) {
5873
+ this._root = _root;
5874
+ this._settings = _settings;
5875
+ this._reader = new async_1$2.default(this._root, this._settings);
5876
+ this._stream = new stream_1$5.Readable({
5877
+ objectMode: true,
5878
+ read: () => { },
5879
+ destroy: () => {
5880
+ if (!this._reader.isDestroyed) {
5881
+ this._reader.destroy();
5882
+ }
5883
+ }
5884
+ });
5885
+ }
5886
+ read() {
5887
+ this._reader.onError((error) => {
5888
+ this._stream.emit('error', error);
5889
+ });
5890
+ this._reader.onEntry((entry) => {
5891
+ this._stream.push(entry);
5892
+ });
5893
+ this._reader.onEnd(() => {
5894
+ this._stream.push(null);
5895
+ });
5896
+ this._reader.read();
5897
+ return this._stream;
5898
+ }
5899
+ }
5900
+ stream$1.default = StreamProvider;
5901
+
5902
+ var sync$3 = {};
5903
+
5904
+ var sync$2 = {};
5905
+
5906
+ Object.defineProperty(sync$2, "__esModule", { value: true });
5907
+ const fsScandir$1 = out$1;
5908
+ const common = common$3;
5909
+ const reader_1$2 = reader$1;
5910
+ class SyncReader extends reader_1$2.default {
5911
+ constructor() {
5912
+ super(...arguments);
5913
+ this._scandir = fsScandir$1.scandirSync;
5914
+ this._storage = new Set();
5915
+ this._queue = new Set();
5916
+ }
5917
+ read() {
5918
+ this._pushToQueue(this._root, this._settings.basePath);
5919
+ this._handleQueue();
5920
+ return [...this._storage];
5921
+ }
5922
+ _pushToQueue(directory, base) {
5923
+ this._queue.add({ directory, base });
5924
+ }
5925
+ _handleQueue() {
5926
+ for (const item of this._queue.values()) {
5927
+ this._handleDirectory(item.directory, item.base);
5928
+ }
5929
+ }
5930
+ _handleDirectory(directory, base) {
5931
+ try {
5932
+ const entries = this._scandir(directory, this._settings.fsScandirSettings);
5933
+ for (const entry of entries) {
5934
+ this._handleEntry(entry, base);
5935
+ }
5936
+ }
5937
+ catch (error) {
5938
+ this._handleError(error);
5939
+ }
5940
+ }
5941
+ _handleError(error) {
5942
+ if (!common.isFatalError(this._settings, error)) {
5943
+ return;
5944
+ }
5945
+ throw error;
5946
+ }
5947
+ _handleEntry(entry, base) {
5948
+ const fullpath = entry.path;
5949
+ if (base !== undefined) {
5950
+ entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
5951
+ }
5952
+ if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
5953
+ this._pushToStorage(entry);
5954
+ }
5955
+ if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
5956
+ this._pushToQueue(fullpath, entry.path);
5957
+ }
5958
+ }
5959
+ _pushToStorage(entry) {
5960
+ this._storage.add(entry);
5961
+ }
5962
+ }
5963
+ sync$2.default = SyncReader;
5964
+
5965
+ Object.defineProperty(sync$3, "__esModule", { value: true });
5966
+ const sync_1$3 = sync$2;
5967
+ class SyncProvider {
5968
+ constructor(_root, _settings) {
5969
+ this._root = _root;
5970
+ this._settings = _settings;
5971
+ this._reader = new sync_1$3.default(this._root, this._settings);
5972
+ }
5973
+ read() {
5974
+ return this._reader.read();
5975
+ }
5976
+ }
5977
+ sync$3.default = SyncProvider;
5978
+
5979
+ var settings$1 = {};
5980
+
5981
+ Object.defineProperty(settings$1, "__esModule", { value: true });
5982
+ const path$2 = path$a;
5983
+ const fsScandir = out$1;
5984
+ class Settings {
5985
+ constructor(_options = {}) {
5986
+ this._options = _options;
5987
+ this.basePath = this._getValue(this._options.basePath, undefined);
5988
+ this.concurrency = this._getValue(this._options.concurrency, Infinity);
5989
+ this.deepFilter = this._getValue(this._options.deepFilter, null);
5990
+ this.entryFilter = this._getValue(this._options.entryFilter, null);
5991
+ this.errorFilter = this._getValue(this._options.errorFilter, null);
5992
+ this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$2.sep);
5993
+ this.fsScandirSettings = new fsScandir.Settings({
5994
+ followSymbolicLinks: this._options.followSymbolicLinks,
5995
+ fs: this._options.fs,
5996
+ pathSegmentSeparator: this._options.pathSegmentSeparator,
5997
+ stats: this._options.stats,
5998
+ throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
5999
+ });
6000
+ }
6001
+ _getValue(option, value) {
6002
+ return option !== null && option !== void 0 ? option : value;
6003
+ }
6004
+ }
6005
+ settings$1.default = Settings;
6006
+
6007
+ Object.defineProperty(out$2, "__esModule", { value: true });
6008
+ out$2.Settings = out$2.walkStream = out$2.walkSync = out$2.walk = void 0;
6009
+ const async_1$1 = async$3;
6010
+ const stream_1$4 = stream$1;
6011
+ const sync_1$2 = sync$3;
6012
+ const settings_1$1 = settings$1;
6013
+ out$2.Settings = settings_1$1.default;
6014
+ function walk(directory, optionsOrSettingsOrCallback, callback) {
6015
+ if (typeof optionsOrSettingsOrCallback === 'function') {
6016
+ return new async_1$1.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
6017
+ }
6018
+ new async_1$1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
6019
+ }
6020
+ out$2.walk = walk;
6021
+ function walkSync(directory, optionsOrSettings) {
6022
+ const settings = getSettings(optionsOrSettings);
6023
+ const provider = new sync_1$2.default(directory, settings);
6024
+ return provider.read();
6025
+ }
6026
+ out$2.walkSync = walkSync;
6027
+ function walkStream(directory, optionsOrSettings) {
6028
+ const settings = getSettings(optionsOrSettings);
6029
+ const provider = new stream_1$4.default(directory, settings);
6030
+ return provider.read();
6031
+ }
6032
+ out$2.walkStream = walkStream;
6033
+ function getSettings(settingsOrOptions = {}) {
6034
+ if (settingsOrOptions instanceof settings_1$1.default) {
6035
+ return settingsOrOptions;
6036
+ }
6037
+ return new settings_1$1.default(settingsOrOptions);
6038
+ }
6039
+
6040
+ var reader = {};
6041
+
6042
+ Object.defineProperty(reader, "__esModule", { value: true });
6043
+ const path$1 = path$a;
6044
+ const fsStat$2 = out$3;
6045
+ const utils$6 = utils$k;
6046
+ class Reader {
6047
+ constructor(_settings) {
6048
+ this._settings = _settings;
6049
+ this._fsStatSettings = new fsStat$2.Settings({
6050
+ followSymbolicLink: this._settings.followSymbolicLinks,
6051
+ fs: this._settings.fs,
6052
+ throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
6053
+ });
6054
+ }
6055
+ _getFullEntryPath(filepath) {
6056
+ return path$1.resolve(this._settings.cwd, filepath);
6057
+ }
6058
+ _makeEntry(stats, pattern) {
6059
+ const entry = {
6060
+ name: pattern,
6061
+ path: pattern,
6062
+ dirent: utils$6.fs.createDirentFromStats(pattern, stats)
6063
+ };
6064
+ if (this._settings.stats) {
6065
+ entry.stats = stats;
6066
+ }
6067
+ return entry;
6068
+ }
6069
+ _isFatalError(error) {
6070
+ return !utils$6.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
6071
+ }
6072
+ }
6073
+ reader.default = Reader;
6074
+
6075
+ Object.defineProperty(stream$2, "__esModule", { value: true });
6076
+ const stream_1$3 = require$$0$2;
6077
+ const fsStat$1 = out$3;
6078
+ const fsWalk$1 = out$2;
6079
+ const reader_1$1 = reader;
6080
+ class ReaderStream extends reader_1$1.default {
6081
+ constructor() {
6082
+ super(...arguments);
6083
+ this._walkStream = fsWalk$1.walkStream;
6084
+ this._stat = fsStat$1.stat;
6085
+ }
6086
+ dynamic(root, options) {
6087
+ return this._walkStream(root, options);
6088
+ }
6089
+ static(patterns, options) {
6090
+ const filepaths = patterns.map(this._getFullEntryPath, this);
6091
+ const stream = new stream_1$3.PassThrough({ objectMode: true });
6092
+ stream._write = (index, _enc, done) => {
6093
+ return this._getEntry(filepaths[index], patterns[index], options)
6094
+ .then((entry) => {
6095
+ if (entry !== null && options.entryFilter(entry)) {
6096
+ stream.push(entry);
6097
+ }
6098
+ if (index === filepaths.length - 1) {
6099
+ stream.end();
6100
+ }
6101
+ done();
6102
+ })
6103
+ .catch(done);
6104
+ };
6105
+ for (let i = 0; i < filepaths.length; i++) {
6106
+ stream.write(i);
6107
+ }
6108
+ return stream;
6109
+ }
6110
+ _getEntry(filepath, pattern, options) {
6111
+ return this._getStat(filepath)
6112
+ .then((stats) => this._makeEntry(stats, pattern))
6113
+ .catch((error) => {
6114
+ if (options.errorFilter(error)) {
6115
+ return null;
6116
+ }
6117
+ throw error;
6118
+ });
6119
+ }
6120
+ _getStat(filepath) {
6121
+ return new Promise((resolve, reject) => {
6122
+ this._stat(filepath, this._fsStatSettings, (error, stats) => {
6123
+ return error === null ? resolve(stats) : reject(error);
6124
+ });
6125
+ });
6126
+ }
6127
+ }
6128
+ stream$2.default = ReaderStream;
6129
+
6130
+ var provider = {};
6131
+
6132
+ var deep = {};
6133
+
6134
+ var partial = {};
6135
+
6136
+ var matcher = {};
6137
+
6138
+ Object.defineProperty(matcher, "__esModule", { value: true });
6139
+ const utils$5 = utils$k;
6140
+ class Matcher {
6141
+ constructor(_patterns, _settings, _micromatchOptions) {
6142
+ this._patterns = _patterns;
6143
+ this._settings = _settings;
6144
+ this._micromatchOptions = _micromatchOptions;
6145
+ this._storage = [];
6146
+ this._fillStorage();
6147
+ }
6148
+ _fillStorage() {
6149
+ /**
6150
+ * The original pattern may include `{,*,**,a/*}`, which will lead to problems with matching (unresolved level).
6151
+ * So, before expand patterns with brace expansion into separated patterns.
6152
+ */
6153
+ const patterns = utils$5.pattern.expandPatternsWithBraceExpansion(this._patterns);
6154
+ for (const pattern of patterns) {
6155
+ const segments = this._getPatternSegments(pattern);
6156
+ const sections = this._splitSegmentsIntoSections(segments);
6157
+ this._storage.push({
6158
+ complete: sections.length <= 1,
6159
+ pattern,
6160
+ segments,
6161
+ sections
6162
+ });
6163
+ }
6164
+ }
6165
+ _getPatternSegments(pattern) {
6166
+ const parts = utils$5.pattern.getPatternParts(pattern, this._micromatchOptions);
6167
+ return parts.map((part) => {
6168
+ const dynamic = utils$5.pattern.isDynamicPattern(part, this._settings);
6169
+ if (!dynamic) {
6170
+ return {
6171
+ dynamic: false,
6172
+ pattern: part
6173
+ };
6174
+ }
6175
+ return {
6176
+ dynamic: true,
6177
+ pattern: part,
6178
+ patternRe: utils$5.pattern.makeRe(part, this._micromatchOptions)
6179
+ };
6180
+ });
6181
+ }
6182
+ _splitSegmentsIntoSections(segments) {
6183
+ return utils$5.array.splitWhen(segments, (segment) => segment.dynamic && utils$5.pattern.hasGlobStar(segment.pattern));
6184
+ }
6185
+ }
6186
+ matcher.default = Matcher;
6187
+
6188
+ Object.defineProperty(partial, "__esModule", { value: true });
6189
+ const matcher_1 = matcher;
6190
+ class PartialMatcher extends matcher_1.default {
6191
+ match(filepath) {
6192
+ const parts = filepath.split('/');
6193
+ const levels = parts.length;
6194
+ const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels);
6195
+ for (const pattern of patterns) {
6196
+ const section = pattern.sections[0];
6197
+ /**
6198
+ * In this case, the pattern has a globstar and we must read all directories unconditionally,
6199
+ * but only if the level has reached the end of the first group.
6200
+ *
6201
+ * fixtures/{a,b}/**
6202
+ * ^ true/false ^ always true
6203
+ */
6204
+ if (!pattern.complete && levels > section.length) {
6205
+ return true;
6206
+ }
6207
+ const match = parts.every((part, index) => {
6208
+ const segment = pattern.segments[index];
6209
+ if (segment.dynamic && segment.patternRe.test(part)) {
6210
+ return true;
6211
+ }
6212
+ if (!segment.dynamic && segment.pattern === part) {
6213
+ return true;
6214
+ }
6215
+ return false;
6216
+ });
6217
+ if (match) {
6218
+ return true;
6219
+ }
6220
+ }
6221
+ return false;
6222
+ }
6223
+ }
6224
+ partial.default = PartialMatcher;
6225
+
6226
+ Object.defineProperty(deep, "__esModule", { value: true });
6227
+ const utils$4 = utils$k;
6228
+ const partial_1 = partial;
6229
+ class DeepFilter {
6230
+ constructor(_settings, _micromatchOptions) {
6231
+ this._settings = _settings;
6232
+ this._micromatchOptions = _micromatchOptions;
6233
+ }
6234
+ getFilter(basePath, positive, negative) {
6235
+ const matcher = this._getMatcher(positive);
6236
+ const negativeRe = this._getNegativePatternsRe(negative);
6237
+ return (entry) => this._filter(basePath, entry, matcher, negativeRe);
6238
+ }
6239
+ _getMatcher(patterns) {
6240
+ return new partial_1.default(patterns, this._settings, this._micromatchOptions);
6241
+ }
6242
+ _getNegativePatternsRe(patterns) {
6243
+ const affectDepthOfReadingPatterns = patterns.filter(utils$4.pattern.isAffectDepthOfReadingPattern);
6244
+ return utils$4.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
6245
+ }
6246
+ _filter(basePath, entry, matcher, negativeRe) {
6247
+ if (this._isSkippedByDeep(basePath, entry.path)) {
6248
+ return false;
6249
+ }
6250
+ if (this._isSkippedSymbolicLink(entry)) {
6251
+ return false;
6252
+ }
6253
+ const filepath = utils$4.path.removeLeadingDotSegment(entry.path);
6254
+ if (this._isSkippedByPositivePatterns(filepath, matcher)) {
6255
+ return false;
6256
+ }
6257
+ return this._isSkippedByNegativePatterns(filepath, negativeRe);
6258
+ }
6259
+ _isSkippedByDeep(basePath, entryPath) {
6260
+ /**
6261
+ * Avoid unnecessary depth calculations when it doesn't matter.
6262
+ */
6263
+ if (this._settings.deep === Infinity) {
6264
+ return false;
6265
+ }
6266
+ return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
6267
+ }
6268
+ _getEntryLevel(basePath, entryPath) {
6269
+ const entryPathDepth = entryPath.split('/').length;
6270
+ if (basePath === '') {
6271
+ return entryPathDepth;
6272
+ }
6273
+ const basePathDepth = basePath.split('/').length;
6274
+ return entryPathDepth - basePathDepth;
6275
+ }
6276
+ _isSkippedSymbolicLink(entry) {
6277
+ return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
6278
+ }
6279
+ _isSkippedByPositivePatterns(entryPath, matcher) {
6280
+ return !this._settings.baseNameMatch && !matcher.match(entryPath);
6281
+ }
6282
+ _isSkippedByNegativePatterns(entryPath, patternsRe) {
6283
+ return !utils$4.pattern.matchAny(entryPath, patternsRe);
6284
+ }
6285
+ }
6286
+ deep.default = DeepFilter;
6287
+
6288
+ var entry$1 = {};
6289
+
6290
+ Object.defineProperty(entry$1, "__esModule", { value: true });
6291
+ const utils$3 = utils$k;
6292
+ class EntryFilter {
6293
+ constructor(_settings, _micromatchOptions) {
6294
+ this._settings = _settings;
6295
+ this._micromatchOptions = _micromatchOptions;
6296
+ this.index = new Map();
6297
+ }
6298
+ getFilter(positive, negative) {
6299
+ const positiveRe = utils$3.pattern.convertPatternsToRe(positive, this._micromatchOptions);
6300
+ const negativeRe = utils$3.pattern.convertPatternsToRe(negative, this._micromatchOptions);
6301
+ return (entry) => this._filter(entry, positiveRe, negativeRe);
6302
+ }
6303
+ _filter(entry, positiveRe, negativeRe) {
6304
+ if (this._settings.unique && this._isDuplicateEntry(entry)) {
6305
+ return false;
6306
+ }
6307
+ if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
6308
+ return false;
6309
+ }
6310
+ if (this._isSkippedByAbsoluteNegativePatterns(entry.path, negativeRe)) {
6311
+ return false;
6312
+ }
6313
+ const filepath = this._settings.baseNameMatch ? entry.name : entry.path;
6314
+ const isMatched = this._isMatchToPatterns(filepath, positiveRe) && !this._isMatchToPatterns(entry.path, negativeRe);
6315
+ if (this._settings.unique && isMatched) {
6316
+ this._createIndexRecord(entry);
6317
+ }
6318
+ return isMatched;
6319
+ }
6320
+ _isDuplicateEntry(entry) {
6321
+ return this.index.has(entry.path);
6322
+ }
6323
+ _createIndexRecord(entry) {
6324
+ this.index.set(entry.path, undefined);
6325
+ }
6326
+ _onlyFileFilter(entry) {
6327
+ return this._settings.onlyFiles && !entry.dirent.isFile();
6328
+ }
6329
+ _onlyDirectoryFilter(entry) {
6330
+ return this._settings.onlyDirectories && !entry.dirent.isDirectory();
6331
+ }
6332
+ _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) {
6333
+ if (!this._settings.absolute) {
6334
+ return false;
6335
+ }
6336
+ const fullpath = utils$3.path.makeAbsolute(this._settings.cwd, entryPath);
6337
+ return utils$3.pattern.matchAny(fullpath, patternsRe);
6338
+ }
6339
+ _isMatchToPatterns(entryPath, patternsRe) {
6340
+ const filepath = utils$3.path.removeLeadingDotSegment(entryPath);
6341
+ return utils$3.pattern.matchAny(filepath, patternsRe);
6342
+ }
6343
+ }
6344
+ entry$1.default = EntryFilter;
6345
+
6346
+ var error = {};
6347
+
6348
+ Object.defineProperty(error, "__esModule", { value: true });
6349
+ const utils$2 = utils$k;
6350
+ class ErrorFilter {
6351
+ constructor(_settings) {
6352
+ this._settings = _settings;
6353
+ }
6354
+ getFilter() {
6355
+ return (error) => this._isNonFatalError(error);
6356
+ }
6357
+ _isNonFatalError(error) {
6358
+ return utils$2.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
6359
+ }
6360
+ }
6361
+ error.default = ErrorFilter;
6362
+
6363
+ var entry = {};
6364
+
6365
+ Object.defineProperty(entry, "__esModule", { value: true });
6366
+ const utils$1 = utils$k;
6367
+ class EntryTransformer {
6368
+ constructor(_settings) {
6369
+ this._settings = _settings;
6370
+ }
6371
+ getTransformer() {
6372
+ return (entry) => this._transform(entry);
6373
+ }
6374
+ _transform(entry) {
6375
+ let filepath = entry.path;
6376
+ if (this._settings.absolute) {
6377
+ filepath = utils$1.path.makeAbsolute(this._settings.cwd, filepath);
6378
+ filepath = utils$1.path.unixify(filepath);
6379
+ }
6380
+ if (this._settings.markDirectories && entry.dirent.isDirectory()) {
6381
+ filepath += '/';
6382
+ }
6383
+ if (!this._settings.objectMode) {
6384
+ return filepath;
6385
+ }
6386
+ return Object.assign(Object.assign({}, entry), { path: filepath });
6387
+ }
6388
+ }
6389
+ entry.default = EntryTransformer;
6390
+
6391
+ Object.defineProperty(provider, "__esModule", { value: true });
6392
+ const path = path$a;
6393
+ const deep_1 = deep;
6394
+ const entry_1 = entry$1;
6395
+ const error_1 = error;
6396
+ const entry_2 = entry;
6397
+ class Provider {
6398
+ constructor(_settings) {
6399
+ this._settings = _settings;
6400
+ this.errorFilter = new error_1.default(this._settings);
6401
+ this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
6402
+ this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
6403
+ this.entryTransformer = new entry_2.default(this._settings);
6404
+ }
6405
+ _getRootDirectory(task) {
6406
+ return path.resolve(this._settings.cwd, task.base);
6407
+ }
6408
+ _getReaderOptions(task) {
6409
+ const basePath = task.base === '.' ? '' : task.base;
6410
+ return {
6411
+ basePath,
6412
+ pathSegmentSeparator: '/',
6413
+ concurrency: this._settings.concurrency,
6414
+ deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
6415
+ entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
6416
+ errorFilter: this.errorFilter.getFilter(),
6417
+ followSymbolicLinks: this._settings.followSymbolicLinks,
6418
+ fs: this._settings.fs,
6419
+ stats: this._settings.stats,
6420
+ throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
6421
+ transform: this.entryTransformer.getTransformer()
6422
+ };
6423
+ }
6424
+ _getMicromatchOptions() {
6425
+ return {
6426
+ dot: this._settings.dot,
6427
+ matchBase: this._settings.baseNameMatch,
6428
+ nobrace: !this._settings.braceExpansion,
6429
+ nocase: !this._settings.caseSensitiveMatch,
6430
+ noext: !this._settings.extglob,
6431
+ noglobstar: !this._settings.globstar,
6432
+ posix: true,
6433
+ strictSlashes: false
6434
+ };
6435
+ }
6436
+ }
6437
+ provider.default = Provider;
6438
+
6439
+ Object.defineProperty(async$6, "__esModule", { value: true });
6440
+ const stream_1$2 = stream$2;
6441
+ const provider_1$2 = provider;
6442
+ class ProviderAsync extends provider_1$2.default {
6443
+ constructor() {
6444
+ super(...arguments);
6445
+ this._reader = new stream_1$2.default(this._settings);
6446
+ }
6447
+ read(task) {
6448
+ const root = this._getRootDirectory(task);
6449
+ const options = this._getReaderOptions(task);
6450
+ const entries = [];
6451
+ return new Promise((resolve, reject) => {
6452
+ const stream = this.api(root, task, options);
6453
+ stream.once('error', reject);
6454
+ stream.on('data', (entry) => entries.push(options.transform(entry)));
6455
+ stream.once('end', () => resolve(entries));
6456
+ });
6457
+ }
6458
+ api(root, task, options) {
6459
+ if (task.dynamic) {
6460
+ return this._reader.dynamic(root, options);
6461
+ }
6462
+ return this._reader.static(task.patterns, options);
6463
+ }
6464
+ }
6465
+ async$6.default = ProviderAsync;
6466
+
6467
+ var stream = {};
6468
+
6469
+ Object.defineProperty(stream, "__esModule", { value: true });
6470
+ const stream_1$1 = require$$0$2;
6471
+ const stream_2 = stream$2;
6472
+ const provider_1$1 = provider;
6473
+ class ProviderStream extends provider_1$1.default {
6474
+ constructor() {
6475
+ super(...arguments);
6476
+ this._reader = new stream_2.default(this._settings);
6477
+ }
6478
+ read(task) {
6479
+ const root = this._getRootDirectory(task);
6480
+ const options = this._getReaderOptions(task);
6481
+ const source = this.api(root, task, options);
6482
+ const destination = new stream_1$1.Readable({ objectMode: true, read: () => { } });
6483
+ source
6484
+ .once('error', (error) => destination.emit('error', error))
6485
+ .on('data', (entry) => destination.emit('data', options.transform(entry)))
6486
+ .once('end', () => destination.emit('end'));
6487
+ destination
6488
+ .once('close', () => source.destroy());
6489
+ return destination;
6490
+ }
6491
+ api(root, task, options) {
6492
+ if (task.dynamic) {
6493
+ return this._reader.dynamic(root, options);
6494
+ }
6495
+ return this._reader.static(task.patterns, options);
6496
+ }
6497
+ }
6498
+ stream.default = ProviderStream;
6499
+
6500
+ var sync$1 = {};
6501
+
6502
+ var sync = {};
6503
+
6504
+ Object.defineProperty(sync, "__esModule", { value: true });
6505
+ const fsStat = out$3;
6506
+ const fsWalk = out$2;
6507
+ const reader_1 = reader;
6508
+ class ReaderSync extends reader_1.default {
6509
+ constructor() {
6510
+ super(...arguments);
6511
+ this._walkSync = fsWalk.walkSync;
6512
+ this._statSync = fsStat.statSync;
6513
+ }
6514
+ dynamic(root, options) {
6515
+ return this._walkSync(root, options);
6516
+ }
6517
+ static(patterns, options) {
6518
+ const entries = [];
6519
+ for (const pattern of patterns) {
6520
+ const filepath = this._getFullEntryPath(pattern);
6521
+ const entry = this._getEntry(filepath, pattern, options);
6522
+ if (entry === null || !options.entryFilter(entry)) {
6523
+ continue;
6524
+ }
6525
+ entries.push(entry);
6526
+ }
6527
+ return entries;
6528
+ }
6529
+ _getEntry(filepath, pattern, options) {
6530
+ try {
6531
+ const stats = this._getStat(filepath);
6532
+ return this._makeEntry(stats, pattern);
6533
+ }
6534
+ catch (error) {
6535
+ if (options.errorFilter(error)) {
6536
+ return null;
6537
+ }
6538
+ throw error;
6539
+ }
6540
+ }
6541
+ _getStat(filepath) {
6542
+ return this._statSync(filepath, this._fsStatSettings);
6543
+ }
6544
+ }
6545
+ sync.default = ReaderSync;
6546
+
6547
+ Object.defineProperty(sync$1, "__esModule", { value: true });
6548
+ const sync_1$1 = sync;
6549
+ const provider_1 = provider;
6550
+ class ProviderSync extends provider_1.default {
6551
+ constructor() {
6552
+ super(...arguments);
6553
+ this._reader = new sync_1$1.default(this._settings);
6554
+ }
6555
+ read(task) {
6556
+ const root = this._getRootDirectory(task);
6557
+ const options = this._getReaderOptions(task);
6558
+ const entries = this.api(root, task, options);
6559
+ return entries.map(options.transform);
6560
+ }
6561
+ api(root, task, options) {
6562
+ if (task.dynamic) {
6563
+ return this._reader.dynamic(root, options);
6564
+ }
6565
+ return this._reader.static(task.patterns, options);
6566
+ }
6567
+ }
6568
+ sync$1.default = ProviderSync;
6569
+
6570
+ var settings = {};
6571
+
6572
+ (function (exports) {
6573
+ Object.defineProperty(exports, "__esModule", { value: true });
6574
+ exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
6575
+ const fs = fs$8;
6576
+ const os = require$$0;
6577
+ /**
6578
+ * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
6579
+ * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
6580
+ */
6581
+ const CPU_COUNT = Math.max(os.cpus().length, 1);
6582
+ exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
6583
+ lstat: fs.lstat,
6584
+ lstatSync: fs.lstatSync,
6585
+ stat: fs.stat,
6586
+ statSync: fs.statSync,
6587
+ readdir: fs.readdir,
6588
+ readdirSync: fs.readdirSync
6589
+ };
6590
+ class Settings {
6591
+ constructor(_options = {}) {
6592
+ this._options = _options;
6593
+ this.absolute = this._getValue(this._options.absolute, false);
6594
+ this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
6595
+ this.braceExpansion = this._getValue(this._options.braceExpansion, true);
6596
+ this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
6597
+ this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
6598
+ this.cwd = this._getValue(this._options.cwd, process.cwd());
6599
+ this.deep = this._getValue(this._options.deep, Infinity);
6600
+ this.dot = this._getValue(this._options.dot, false);
6601
+ this.extglob = this._getValue(this._options.extglob, true);
6602
+ this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
6603
+ this.fs = this._getFileSystemMethods(this._options.fs);
6604
+ this.globstar = this._getValue(this._options.globstar, true);
6605
+ this.ignore = this._getValue(this._options.ignore, []);
6606
+ this.markDirectories = this._getValue(this._options.markDirectories, false);
6607
+ this.objectMode = this._getValue(this._options.objectMode, false);
6608
+ this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
6609
+ this.onlyFiles = this._getValue(this._options.onlyFiles, true);
6610
+ this.stats = this._getValue(this._options.stats, false);
6611
+ this.suppressErrors = this._getValue(this._options.suppressErrors, false);
6612
+ this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
6613
+ this.unique = this._getValue(this._options.unique, true);
6614
+ if (this.onlyDirectories) {
6615
+ this.onlyFiles = false;
6616
+ }
6617
+ if (this.stats) {
6618
+ this.objectMode = true;
6619
+ }
6620
+ }
6621
+ _getValue(option, value) {
6622
+ return option === undefined ? value : option;
6623
+ }
6624
+ _getFileSystemMethods(methods = {}) {
6625
+ return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
6626
+ }
6627
+ }
6628
+ exports.default = Settings;
6629
+ }(settings));
6630
+
6631
+ const taskManager = tasks;
6632
+ const async_1 = async$6;
6633
+ const stream_1 = stream;
6634
+ const sync_1 = sync$1;
6635
+ const settings_1 = settings;
6636
+ const utils = utils$k;
6637
+ async function FastGlob(source, options) {
6638
+ assertPatternsInput(source);
6639
+ const works = getWorks(source, async_1.default, options);
6640
+ const result = await Promise.all(works);
6641
+ return utils.array.flatten(result);
6642
+ }
6643
+ // https://github.com/typescript-eslint/typescript-eslint/issues/60
6644
+ // eslint-disable-next-line no-redeclare
6645
+ (function (FastGlob) {
6646
+ function sync(source, options) {
6647
+ assertPatternsInput(source);
6648
+ const works = getWorks(source, sync_1.default, options);
6649
+ return utils.array.flatten(works);
6650
+ }
6651
+ FastGlob.sync = sync;
6652
+ function stream(source, options) {
6653
+ assertPatternsInput(source);
6654
+ const works = getWorks(source, stream_1.default, options);
6655
+ /**
6656
+ * The stream returned by the provider cannot work with an asynchronous iterator.
6657
+ * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams.
6658
+ * This affects performance (+25%). I don't see best solution right now.
6659
+ */
6660
+ return utils.stream.merge(works);
6661
+ }
6662
+ FastGlob.stream = stream;
6663
+ function generateTasks(source, options) {
6664
+ assertPatternsInput(source);
6665
+ const patterns = [].concat(source);
6666
+ const settings = new settings_1.default(options);
6667
+ return taskManager.generate(patterns, settings);
6668
+ }
6669
+ FastGlob.generateTasks = generateTasks;
6670
+ function isDynamicPattern(source, options) {
6671
+ assertPatternsInput(source);
6672
+ const settings = new settings_1.default(options);
6673
+ return utils.pattern.isDynamicPattern(source, settings);
6674
+ }
6675
+ FastGlob.isDynamicPattern = isDynamicPattern;
6676
+ function escapePath(source) {
6677
+ assertPatternsInput(source);
6678
+ return utils.path.escape(source);
6679
+ }
6680
+ FastGlob.escapePath = escapePath;
6681
+ })(FastGlob || (FastGlob = {}));
6682
+ function getWorks(source, _Provider, options) {
6683
+ const patterns = [].concat(source);
6684
+ const settings = new settings_1.default(options);
6685
+ const tasks = taskManager.generate(patterns, settings);
6686
+ const provider = new _Provider(settings);
6687
+ return tasks.map(provider.read, provider);
6688
+ }
6689
+ function assertPatternsInput(input) {
6690
+ const source = [].concat(input);
6691
+ const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item));
6692
+ if (!isValidSource) {
6693
+ throw new TypeError('Patterns must be a string (non empty) or an array of strings');
6694
+ }
6695
+ }
6696
+ var out = FastGlob;
4236
6697
 
4237
6698
  class SnapshotManager {
4238
6699
  constructor(config) {
@@ -4806,7 +7267,7 @@ function formatTestPath(root, path) {
4806
7267
  const dir = dirname(path);
4807
7268
  const ext = ((_a = path.match(/(\.(spec|test)\.[cm]?[tj]sx?)$/)) == null ? void 0 : _a[0]) || "";
4808
7269
  const base = basename(path, ext);
4809
- return slash(c.dim(`${dir}/`) + c.bold(base)) + c.dim(ext);
7270
+ return slash$1(c.dim(`${dir}/`) + c.bold(base)) + c.dim(ext);
4810
7271
  }
4811
7272
  function renderSnapshotSummary(rootDir, snapshots) {
4812
7273
  const summary = [];
@@ -5348,7 +7809,7 @@ class Vitest {
5348
7809
  this.isFirstRun = true;
5349
7810
  this.restartsCount = 0;
5350
7811
  this._onRestartListeners = [];
5351
- this.unregisterWatcher = noop;
7812
+ this.unregisterWatcher = noop$1;
5352
7813
  this.console = globalThis.console;
5353
7814
  }
5354
7815
  setServer(options, server) {
@@ -5364,7 +7825,7 @@ class Vitest {
5364
7825
  this.state = new StateManager();
5365
7826
  this.snapshot = new SnapshotManager(resolved);
5366
7827
  this.reporters = toArray(resolved.reporters);
5367
- if (!this.reporters.length)
7828
+ if (!this.reporters.length && !this.config.silent)
5368
7829
  this.reporters.push(new ConsoleReporter(this));
5369
7830
  if (this.config.watch)
5370
7831
  this.registerWatcher();
@@ -5412,7 +7873,9 @@ class Vitest {
5412
7873
  if (this.restartsCount !== currentCount)
5413
7874
  return;
5414
7875
  this.isFirstRun = false;
7876
+ this.snapshot.clear();
5415
7877
  const files = Array.from(this.changedTests);
7878
+ this.changedTests.clear();
5416
7879
  await this.report("onWatcherRerun", files, triggerId);
5417
7880
  await this.runFiles(files);
5418
7881
  await this.report("onWatcherStart");
@@ -5420,13 +7883,13 @@ class Vitest {
5420
7883
  }
5421
7884
  registerWatcher() {
5422
7885
  const onChange = (id) => {
5423
- id = slash(id);
7886
+ id = slash$1(id);
5424
7887
  this.handleFileChanged(id);
5425
7888
  if (this.changedTests.size)
5426
7889
  this.scheduleRerun(id);
5427
7890
  };
5428
7891
  const onUnlink = (id) => {
5429
- id = slash(id);
7892
+ id = slash$1(id);
5430
7893
  this.invalidates.add(id);
5431
7894
  if (id in this.state.filesMap) {
5432
7895
  delete this.state.filesMap[id];
@@ -5434,7 +7897,7 @@ class Vitest {
5434
7897
  }
5435
7898
  };
5436
7899
  const onAdd = (id) => {
5437
- id = slash(id);
7900
+ id = slash$1(id);
5438
7901
  if (this.isTargetFile(id)) {
5439
7902
  this.changedTests.add(id);
5440
7903
  this.scheduleRerun(id);
@@ -5448,24 +7911,24 @@ class Vitest {
5448
7911
  watcher.off("change", onChange);
5449
7912
  watcher.off("unlink", onUnlink);
5450
7913
  watcher.off("add", onAdd);
5451
- this.unregisterWatcher = noop;
7914
+ this.unregisterWatcher = noop$1;
5452
7915
  };
5453
7916
  }
5454
7917
  handleFileChanged(id) {
5455
7918
  if (this.changedTests.has(id) || this.invalidates.has(id) || this.config.watchIgnore.some((i) => id.match(i)))
5456
7919
  return;
7920
+ const mod = this.server.moduleGraph.getModuleById(id);
7921
+ if (!mod)
7922
+ return;
5457
7923
  this.invalidates.add(id);
5458
7924
  if (id in this.state.filesMap) {
5459
7925
  this.changedTests.add(id);
5460
7926
  return;
5461
7927
  }
5462
- const mod = this.server.moduleGraph.getModuleById(id);
5463
- if (mod) {
5464
- mod.importers.forEach((i) => {
5465
- if (i.id)
5466
- this.handleFileChanged(i.id);
5467
- });
5468
- }
7928
+ mod.importers.forEach((i) => {
7929
+ if (i.id)
7930
+ this.handleFileChanged(i.id);
7931
+ });
5469
7932
  }
5470
7933
  async close() {
5471
7934
  var _a;
@@ -5479,7 +7942,7 @@ class Vitest {
5479
7942
  }));
5480
7943
  }
5481
7944
  async globTestFiles(filters) {
5482
- let files = await fg(this.config.include, {
7945
+ let files = await out(this.config.include, {
5483
7946
  absolute: true,
5484
7947
  cwd: this.config.root,
5485
7948
  ignore: this.config.exclude
@@ -5516,7 +7979,7 @@ async function createVitest(options, viteOverrides = {}) {
5516
7979
  ctx.setServer(options, server2);
5517
7980
  haveStarted = true;
5518
7981
  if (options.api)
5519
- server2.middlewares.use((await import('./middleware-8b68d8d7.js')).default(ctx));
7982
+ server2.middlewares.use((await import('./middleware-991dfa87.js')).default(ctx));
5520
7983
  }
5521
7984
  }
5522
7985
  ],